Struct gitoid::GitOid

source ·
#[repr(C)]
pub struct GitOid<H, O>{ /* private fields */ }
Expand description

A struct that computes gitoids based on the selected algorithm

Implementations§

source§

impl<H, O> GitOid<H, O>

source

pub fn id_bytes<B: AsRef<[u8]>>(content: B) -> GitOid<H, O>

Create a new GitOid based on a slice of bytes.

source

pub fn id_str<S: AsRef<str>>(s: S) -> GitOid<H, O>

Create a GitOid from a UTF-8 string slice.

source

pub fn id_reader<R: Read + Seek>(reader: R) -> Result<GitOid<H, O>, Error>

Create a GitOid from a reader.

source

pub fn id_reader_with_length<R: Read>( reader: R, expected_length: usize ) -> Result<GitOid<H, O>, Error>

Generate a GitOid from a reader, providing an expected length in bytes.

source

pub async fn id_async_reader<R: AsyncRead + AsyncSeek + Unpin>( reader: R ) -> Result<GitOid<H, O>, Error>

Generate a GitOid from an asynchronous reader.

source

pub async fn id_async_reader_with_length<R: AsyncRead + Unpin>( reader: R, expected_length: usize ) -> Result<GitOid<H, O>, Error>

Generate a GitOid from an asynchronous reader, providing an expected length in bytes.

source

pub fn try_from_url(url: Url) -> Result<GitOid<H, O>, Error>

Construct a new GitOid from a Url.

source

pub fn url(&self) -> Url

Get a URL for the current GitOid.

source

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

Get the underlying bytes of the hash.

source

pub fn as_hex(&self) -> String

Convert the hash to a hexadecimal string.

source

pub const fn hash_algorithm(&self) -> &'static str

Get the hash algorithm used for the GitOid.

source

pub const fn object_type(&self) -> &'static str

Get the object type of the GitOid.

source

pub fn hash_len(&self) -> usize

Get the length of the hash in bytes.

Trait Implementations§

source§

impl<H, O> Clone for GitOid<H, O>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<H, O> Debug for GitOid<H, O>

source§

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

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

impl<'de, H, O> Deserialize<'de> for GitOid<H, O>

source§

fn deserialize<D>(deserializer: D) -> StdResult<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<H, O> Display for GitOid<H, O>

source§

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

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

impl<H, O> FromStr for GitOid<H, O>

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<GitOid<H, O>, Error>

Parses a string s to return a value of this type. Read more
source§

impl<H, O> Hash for GitOid<H, O>

source§

fn hash<H2>(&self, state: &mut H2)
where H2: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<H, O> Ord for GitOid<H, O>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<H, O> PartialEq for GitOid<H, O>

source§

fn eq(&self, other: &GitOid<H, O>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<H, O> PartialOrd for GitOid<H, O>

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<H, O> Serialize for GitOid<H, O>

source§

fn serialize<S>(&self, serializer: S) -> StdResult<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<H, O> TryFrom<Url> for GitOid<H, O>

§

type Error = Error

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

fn try_from(url: Url) -> Result<GitOid<H, O>, Error>

Performs the conversion.
source§

impl<H, O> Copy for GitOid<H, O>

source§

impl<H, O> Eq for GitOid<H, O>

Auto Trait Implementations§

§

impl<H, O> RefUnwindSafe for GitOid<H, O>

§

impl<H, O> Send for GitOid<H, O>
where O: Send, <H as HashAlgorithm>::Array: Send,

§

impl<H, O> Sync for GitOid<H, O>
where O: Sync, <H as HashAlgorithm>::Array: Sync,

§

impl<H, O> Unpin for GitOid<H, O>
where O: Unpin, <H as HashAlgorithm>::Array: Unpin,

§

impl<H, O> UnwindSafe for GitOid<H, O>

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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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§

default 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>,

§

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

§

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,