Unified · Split
| @@ -71,6 +71,8 @@ pub struct Signature { · 70 unmodified lines | |||
| 71 | 71 | ||
| 72 | /// An immutable signature that is created by an actor at a certain time. | 72 | /// An immutable signature that is created by an actor at a certain time. |
| 73 | /// | 73 | /// |
| 74 | /// Not fully parsed. | ||
| 75 | /// | ||
| 74 | /// Note that this is not a cryptographical signature. | 76 | /// Note that this is not a cryptographical signature. |
| 75 | #[derive(Default, PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)] | 77 | #[derive(Default, PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)] |
| 76 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] | 78 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] |
| @@ -84,6 +86,6 @@ pub struct SignatureRef<'a> { · 7 unmodified lines | |||
| 84 | /// | 86 | /// |
| 85 | /// Use [SignatureRef::trim()] or trim manually to be able to clean it up. | 87 | /// Use [SignatureRef::trim()] or trim manually to be able to clean it up. |
| 86 | pub email: &'a BStr, | 88 | pub email: &'a BStr, |
| 87 | /// The timestamp at which the signature was performed. | 89 | /// The timestamp at which the signature was performed, potentially malformed. |
| 88 | pub time: &'a str, | 90 | pub time: &'a str, |
| 89 | } | 91 | } |
| @@ -14,7 +14,7 @@ mod _ref { · 13 unmodified lines | |||
| 14 | decode.parse_next(&mut data) | 14 | decode.parse_next(&mut data) |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | /// Create an owned instance from this shared one. | 17 | /// Try to parse the timestamp and create an owned instance from this shared one. |
| 18 | pub fn to_owned(&self) -> Result<Signature, gix_date::parse::Error> { | 18 | pub fn to_owned(&self) -> Result<Signature, gix_date::parse::Error> { |
| 19 | Ok(Signature { | 19 | Ok(Signature { |
| 20 | name: self.name.to_owned(), | 20 | name: self.name.to_owned(), |
| @@ -71,6 +71,8 @@ mod convert { · 50 unmodified lines | |||
| 71 | 71 | ||
| 72 | impl Signature { | 72 | impl Signature { |
| 73 | /// Borrow this instance as immutable, serializing the `time` field into `buf`. | 73 | /// Borrow this instance as immutable, serializing the `time` field into `buf`. |
| 74 | /// | ||
| 75 | /// Commonly used as `signature.to_ref(&mut TimeBuf::default())`. | ||
| 74 | pub fn to_ref<'a>(&'a self, time_buf: &'a mut TimeBuf) -> SignatureRef<'a> { | 76 | pub fn to_ref<'a>(&'a self, time_buf: &'a mut TimeBuf) -> SignatureRef<'a> { |
| 75 | SignatureRef { | 77 | SignatureRef { |
| 76 | name: self.name.as_ref(), | 78 | name: self.name.as_ref(), |