ExtraSponge

Struct 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> Freeze for ExtraSponge<A, I>
where A: Freeze,

§

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

§

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

Source§

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.