Struct extra_safe::ExtraSponge

source ·
pub struct ExtraSponge<A: SpongeAPI, I: List> { /* private fields */ }
Expand description

This is a slightly extended generic NewType wrapper around the original SpongeAPI. It is decorated with the IOPattern I intended for this sponge instance.

Implementations§

source§

impl<A: SpongeAPI, I: Normalize> ExtraSponge<A, I>where Norm<I>: ToIOPattern,

source

pub fn start( domain_separator: Option<u32>, api: A, acc: &mut A::Acc ) -> ExtraSponge<A, Norm<I>>

Creates a sponge with the IOPatten given as a type parameter. Note that we do not require this pattern to be normalized - instead the constructor will return an ExtraSPonge with a normalized pattern.

source§

impl<A: SpongeAPI, I: Normalize> ExtraSponge<A, I>

source

pub fn absorb<U>( self, harray: Array<A::Value, U>, acc: &mut A::Acc ) -> ExtraSponge<A, Use<I, Absorb<U>>>where U: ArraySize<A::Value>, I: Consume<Absorb<U>>,

This pass-through function is used to absorb elements in the sponge. It calls the underlying API’s absorb function, and then returns a new ExtraSponge but a successful method dispatch to this implementation gaurantees the call is coherent with the IOPattern.

source§

impl<A: SpongeAPI, I: Normalize> ExtraSponge<A, I>

source

pub fn squeeze<U>( self, harray: &mut Array<A::Value, U>, acc: &mut A::Acc ) -> ExtraSponge<A, Use<I, Squeeze<U>>>where U: ArraySize<A::Value>, I: Consume<Squeeze<U>>,

This pass-through function is used to squeeze elements out of the sponge. It calls the underlying API’s squeeze function, and then returns a new ExtraSponge but a successful method dispatch to this implementation gaurantees the call is coherent with the IOPattern.

Trait Implementations§

source§

impl<A: Debug + SpongeAPI, I: Debug + List> Debug for ExtraSponge<A, I>

source§

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

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

impl<A: SpongeAPI, I: List> Drop for ExtraSponge<A, I>

This implementation of drop is called automatically when the ExtraSponge drops out of scope. It checks that the IOPattern is empty by then, and if it is not, it panics. Otherwise, it calls finalize.

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<A, I> RefUnwindSafe for ExtraSponge<A, I>where A: RefUnwindSafe, I: RefUnwindSafe,

§

impl<A, I> Send for ExtraSponge<A, I>where A: Send, I: Send,

§

impl<A, I> Sync for ExtraSponge<A, I>where A: Sync, I: Sync,

§

impl<A, I> Unpin for ExtraSponge<A, I>where A: Unpin, I: Unpin,

§

impl<A, I> UnwindSafe for ExtraSponge<A, I>where A: UnwindSafe, I: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.