pub enum Nonce {
    Nonce96(GenericArray<u8, U12>),
    Nonce128(GenericArray<u8, U16>),
    Empty,
}
Expand description

Enumeration over allowed nonce types.

Variants§

§

Nonce96(GenericArray<u8, U12>)

96-bit, 12-byte nonce, e.g. xid.

§

Nonce128(GenericArray<u8, U16>)

128-bit, 16-byte nonce.

§

Empty

No Nonce attributed.

Implementations§

source§

impl Nonce

source

pub fn is_nonce96(&self) -> bool

Returns true if this is a Nonce::Nonce96, otherwise false

source

pub fn as_nonce96_mut(&mut self) -> Option<&mut GenericArray<u8, U12>>

Optionally returns mutable references to the inner fields if this is a Nonce::Nonce96, otherwise None

source

pub fn as_nonce96(&self) -> Option<&GenericArray<u8, U12>>

Optionally returns references to the inner fields if this is a Nonce::Nonce96, otherwise None

source

pub fn into_nonce96(self) -> Result<GenericArray<u8, U12>, Self>

Returns the inner fields if this is a Nonce::Nonce96, otherwise returns back the enum in the Err case of the result

source

pub fn is_nonce128(&self) -> bool

Returns true if this is a Nonce::Nonce128, otherwise false

source

pub fn as_nonce128_mut(&mut self) -> Option<&mut GenericArray<u8, U16>>

Optionally returns mutable references to the inner fields if this is a Nonce::Nonce128, otherwise None

source

pub fn as_nonce128(&self) -> Option<&GenericArray<u8, U16>>

Optionally returns references to the inner fields if this is a Nonce::Nonce128, otherwise None

source

pub fn into_nonce128(self) -> Result<GenericArray<u8, U16>, Self>

Returns the inner fields if this is a Nonce::Nonce128, otherwise returns back the enum in the Err case of the result

source

pub fn is_empty(&self) -> bool

Returns true if this is a Nonce::Empty, otherwise false

source§

impl Nonce

source

pub fn generate() -> Self

Default generator, outputting a xid nonce, which is a 96-bit, 12-byte nonce.

source

pub fn generate_128() -> Self

Generate a default, 128-bit, 16-byte nonce via Uuid::new_v4().

Trait Implementations§

source§

impl Clone for Nonce

source§

fn clone(&self) -> Nonce

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 Debug for Nonce

source§

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

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

impl<'de> Deserialize<'de> for Nonce

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

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

impl Display for Nonce

source§

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

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

impl From<Nonce> for Ipld

source§

fn from(nonce: Nonce) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Nonce

source§

fn eq(&self, other: &Nonce) -> 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 Serialize for Nonce

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

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

impl TryFrom<&Ipld> for Nonce

§

type Error = Error<Unit>

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

fn try_from(ipld: &Ipld) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Ipld> for Nonce

§

type Error = Error<Unit>

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

fn try_from(ipld: Ipld) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl StructuralPartialEq for Nonce

Auto Trait Implementations§

§

impl RefUnwindSafe for Nonce

§

impl Send for Nonce

§

impl Sync for Nonce

§

impl Unpin for Nonce

§

impl UnwindSafe for Nonce

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> Base64Encode for T
where T: DagJson,

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

source§

fn to_dag_json(&self) -> Result<Vec<u8>, Error>

source§

fn from_dag_json(json_bytes: &[u8]) -> Result<Self, Error>

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

source§

fn into_sql<T>(self) -> Self::Expression

Convert self to an expression for Diesel’s query builder. Read more
source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression

Convert &self to an expression for Diesel’s query builder. Read more
§

impl<T> References<RawCodec> for T

§

fn references<R, E>(_c: RawCodec, _r: &mut R, _set: &mut E) -> Result<(), Error>
where R: Read, E: Extend<Cid<64>>,

Scrape the references from an impl Read. Read more
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.
§

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

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<U> UcanStoreConditionalSend for U
where U: Send,

source§

impl<U> UcanStoreConditionalSendSync for U
where U: Send + Sync,