pub struct Id { /* private fields */ }
Expand description
This is the Id type, that uniquely identifies slices of bytes,
in rust equivalent to &[u8]
. As in the case with &[u8]
the length is
also encoded in the type, making it a kind of a fat-pointer for content
addressed byte-slices.
The length of the corresponding byte-string is encoded in the first two bytes in big endian.
If the length of the byteslice is less than or equal to 32 bytes, the bytes
are stored directly inline in the bytes
field.
Proposal: The trailing bytes in an inlined value MUST be set to zero
Implementations
Returns the computed hash of the value.
Note that this is different from the payload itself in case of an inlined value, that normally does not get hashed.
Useful for giving a well-distributed unique id for all Canon
types,
for use in hash maps for example.
Consumes the Id and returns the payload bytes
Attempts to reify the Id as an instance of type T
Takes the bytes corresponding to this id out of the underlying store.
If the Id is inlined, this is a no-op and returns Ok(None)
Trait Implementations
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
Auto Trait Implementations
Blanket Implementations
Mutably borrows from an owned value. Read more