Skip to main content

Signature

Struct Signature 

Source
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>

Source

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

Source

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.

Source

pub fn name(&self) -> Result<&str, Error>

Gets the name on the signature.

Source

pub fn name_bytes(&self) -> &[u8]

Gets the name on the signature as a byte slice.

Source

pub fn email(&self) -> Result<&str, Error>

Gets the email on the signature.

Source

pub fn email_bytes(&self) -> &[u8]

Gets the email on the signature as a byte slice.

Source

pub fn when(&self) -> Time

Get the when of this signature.

Source

pub fn to_owned(&self) -> Signature<'static>

Convert a signature of any lifetime into an owned signature with a static lifetime.

Trait Implementations§

Source§

impl<'a> Binding for Signature<'a>

Source§

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>

Build a git2 struct from its Binding::Raw value.
Source§

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>
where T: Copy + IsNull, Self: Binding<Raw = T>,

A null-handling version of Binding::from_raw. Read more
Source§

impl Clone for Signature<'static>

Source§

fn clone(&self) -> Signature<'static>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Display for Signature<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a> Drop for Signature<'a>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Eq for Signature<'_>

Source§

impl PartialEq for Signature<'_>

Source§

fn eq(&self, other: &Signature<'_>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl TryFrom<&Author> for Signature<'_>

Source§

type Error = Error

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

fn try_from( person: &Author, ) -> Result<Signature<'_>, <Signature<'_> as TryFrom<&Author>>::Error>

Performs the conversion.

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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V