History

gix-actor docs: document conversions between `Signature` and `SignatureRef`

Ilya Grigoriev committed 1 year ago

Commit 8bebd2e1 parent 92febae2 files · +6 −2Browse files

Unified · Split

2 files
  1. gix-actor/src/lib.rs +3 −1
  2. gix-actor/src/signature/mod.rs +3 −1
gix-actor/src/lib.rs+3−1
@@ -71,6 +71,8 @@ pub struct Signature { · 70 unmodified lines
7171
7272 /// An immutable signature that is created by an actor at a certain time.
7373 ///
74+/// Not fully parsed.
75+///
7476 /// Note that this is not a cryptographical signature.
7577 #[derive(Default, PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
7678 #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
@@ -84,6 +86,6 @@ pub struct SignatureRef<'a> { · 7 unmodified lines
8486 ///
8587 /// Use [SignatureRef::trim()] or trim manually to be able to clean it up.
8688 pub email: &'a BStr,
87− /// The timestamp at which the signature was performed.
89+ /// The timestamp at which the signature was performed, potentially malformed.
8890 pub time: &'a str,
8991 }
gix-actor/src/signature/mod.rs+3−1
@@ -14,7 +14,7 @@ mod _ref { · 13 unmodified lines
1414 decode.parse_next(&mut data)
1515 }
1616
17− /// Create an owned instance from this shared one.
17+ /// Try to parse the timestamp and create an owned instance from this shared one.
1818 pub fn to_owned(&self) -> Result<Signature, gix_date::parse::Error> {
1919 Ok(Signature {
2020 name: self.name.to_owned(),
@@ -71,6 +71,8 @@ mod convert { · 50 unmodified lines
7171
7272 impl Signature {
7373 /// Borrow this instance as immutable, serializing the `time` field into `buf`.
74+ ///
75+ /// Commonly used as `signature.to_ref(&mut TimeBuf::default())`.
7476 pub fn to_ref<'a>(&'a self, time_buf: &'a mut TimeBuf) -> SignatureRef<'a> {
7577 SignatureRef {
7678 name: self.name.as_ref(),