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§
Source§impl<'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_bytes(&self) -> &[u8] ⓘ
pub fn name_bytes(&self) -> &[u8] ⓘ
Gets the name on the signature as a byte slice.
Sourcepub fn email_bytes(&self) -> &[u8] ⓘ
pub fn email_bytes(&self) -> &[u8] ⓘ
Gets the email on the signature as a byte slice.
Trait Implementations§
Source§impl<'a> Binding for Signature<'a>
impl<'a> Binding for Signature<'a>
Source§type Raw = *mut git_signature
type Raw = *mut git_signature
The raw type that allows you to interact with libgit2-sys.
Source§unsafe fn from_raw(raw: *mut git_signature) -> Signature<'a>
unsafe fn from_raw(raw: *mut git_signature) -> Signature<'a>
Build a git2 struct from its Binding::Raw value.
Source§fn raw(&self) -> *mut git_signature
fn raw(&self) -> *mut git_signature
Access the Binding::Raw value for a struct. Read more
Source§unsafe fn from_raw_opt<T>(raw: T) -> Option<Self>
unsafe fn from_raw_opt<T>(raw: T) -> Option<Self>
A null-handling version of Binding::from_raw. Read more
impl Eq for Signature<'_>
Auto Trait Implementations§
impl<'a> !Send for Signature<'a>
impl<'a> !Sync for Signature<'a>
impl<'a> Freeze for Signature<'a>
impl<'a> RefUnwindSafe for Signature<'a>
impl<'a> Unpin for Signature<'a>
impl<'a> UnsafeUnpin for Signature<'a>
impl<'a> UnwindSafe for Signature<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more