Skip to main content

IdentFields

Struct IdentFields 

Source
pub struct IdentFields<'a> {
    pub name: &'a [u8],
    pub email: &'a [u8],
    pub date: Option<&'a [u8]>,
    pub tz: Option<&'a [u8]>,
}
Expand description

A tolerant parse-view of a git identity line split git’s way (ident.c’s split_ident_line). Unlike Signature::from_ident_line — which is a strict, byte-exact round-trip parser — this mirrors how git’s pretty-printer recovers fields from broken idents: the email is the run between the first < and the first following >, while the timestamp is located by scanning backwards from the end of the line for the last >. That split lets a corrupt ident like Name <a@b>-<> 123 +0000 still surrender the correct name (Name), email (a@b), and date (123 +0000).

Fields§

§name: &'a [u8]

Everything before the first <, with one trailing separator space removed.

§email: &'a [u8]

The bytes between the first < and the first following >.

§date: Option<&'a [u8]>

The decimal timestamp digit-run, or None when the line has no parseable <digits> <±digits> date tail (git’s “person only” case).

§tz: Option<&'a [u8]>

The timezone token (± plus digits), present iff date is.

Auto Trait Implementations§

§

impl<'a> Freeze for IdentFields<'a>

§

impl<'a> RefUnwindSafe for IdentFields<'a>

§

impl<'a> Send for IdentFields<'a>

§

impl<'a> Sync for IdentFields<'a>

§

impl<'a> Unpin for IdentFields<'a>

§

impl<'a> UnsafeUnpin for IdentFields<'a>

§

impl<'a> UnwindSafe for IdentFields<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.