pub struct Signature<'a> { /* private fields */ }
Expand description
A Signature is used to indicate authorship of various actions throughout the library.
Signatures contain a name, email, and timestamp. All fields can be specified
with new
while the now
constructor omits the timestamp. The
Repository::signature
method can be used to create a default signature
with name and email values read from the configuration.
Implementations
sourceimpl<'a> Signature<'a>
impl<'a> Signature<'a>
sourcepub fn now(name: &str, email: &str) -> Result<Signature<'static>, Error>
pub fn now(name: &str, email: &str) -> Result<Signature<'static>, Error>
Create a new action signature with a timestamp of ‘now’.
See new
for more information
sourcepub fn new(
name: &str,
email: &str,
time: &Time
) -> Result<Signature<'static>, Error>
pub fn new(
name: &str,
email: &str,
time: &Time
) -> Result<Signature<'static>, Error>
Create a new action signature.
The time
specified is in seconds since the epoch, and the offset
is
the time zone offset in minutes.
Returns error if either name
or email
contain angle brackets.
sourcepub fn name(&self) -> Option<&str>
pub fn name(&self) -> Option<&str>
Gets the name on the signature.
Returns None
if the name is not valid utf-8
sourcepub fn name_bytes(&self) -> &[u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
pub fn name_bytes(&self) -> &[u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
Gets the name on the signature as a byte slice.
sourcepub fn email(&self) -> Option<&str>
pub fn email(&self) -> Option<&str>
Gets the email on the signature.
Returns None
if the email is not valid utf-8
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Signature<'a>
impl<'a> !Send for Signature<'a>
impl<'a> !Sync for Signature<'a>
impl<'a> Unpin for Signature<'a>
impl<'a> UnwindSafe for Signature<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more