#[repr(transparent)]
pub struct oid { /* private fields */ }
Expand description

A borrowed reference to a hash identifying objects.

Future Proofing

In case we wish to support multiple hashes with the same length we cannot discriminate using the slice length anymore. To make that work, we will use the high bits of the internal bytes slice length (a fat pointer, pointing to data and its length in bytes) to encode additinoal information. Before accessing or returning the bytes, a new adjusted slice will be constructed, while the high bits will be used to help resolving the hash [kind()][oid::kind()]. We expect to have quite a few bits available for such ‘conflict resolution’ as most hashes aren’t longer than 64 bytes.

Implementations

Conversion

Try to create a shared object id from a slice of bytes representing a hash digest

Create an OID from the input value slice without performing any safety check. Use only once sure that value is a hash of valid length.

Access

The kind of hash used for this Digest

The first byte of the hash, commonly used to partition a set of Ids

Interpret this object id as raw byte slice.

Return a type which can display itself in hexadecimal form with the len amount of characters.

Return a type which displays this oid as hex in full.

Sha1 specific methods

Write ourselves to the out in hexadecimal notation, returning the amount of written bytes.

Panics if the buffer isn’t big enough to hold twice as many bytes as the current binary size.

Write ourselves to out in hexadecimal notation

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Immutably borrows from an owned value. Read more

Formats the value using the given formatter. Read more

Manually created from a version that uses a slice, and we forcefully try to convert it into a borrowed array of the desired size Could be improved by fitting this into serde Unfortunately the serde::Deserialize derive wouldn’t work for borrowed arrays.

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

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

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

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

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

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

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

Serialize this value into the given Serde serializer. Read more

The resulting type after obtaining ownership.

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

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more