Struct ReproducibleWasmCodec

Source
pub struct ReproducibleWasmCodec<E: WasmEngine>
where Store<(), ReproducibleEngine<E>>: Send,
{ /* private fields */ }
Expand description

Codec instantiated inside a WebAssembly component.

The codec is loaded such that its execution is reproducible across any platform. Importantly, each codec owns its own component instance such that two codecs cannot interfere.

Implementations§

Source§

impl<E: WasmEngine> ReproducibleWasmCodec<E>
where Store<(), ReproducibleEngine<E>>: Send,

Source

pub fn try_clone(&self) -> Result<Self, Error>

Try cloning the codec by recreating it from its configuration.

ReproducibleWasmCodec implements Clone by calling this method and panicking if it fails.

§Errors

Errors if serializing the codec configuration, constructing the new codec, or interacting with the component fails.

Source

pub fn try_drop(self) -> Result<(), ReproducibleWasmCodecError>

Try dropping the codec.

ReproducibleWasmCodec implements Drop by calling this method and ignoring any errors.

§Errors

Errors if dropping the codec’s resource or component, or interacting with the component fails.

Source

pub fn instruction_counter( &self, ) -> Result<Wrapping<u64>, ReproducibleWasmCodecError>

Read the codec’s instruction counter, which is based on the number of WebAssembly bytecode instructions executed.

The instruction counter is never reset and wraps around. Comparisons of the counter values before and after, e.g. a call to Self::encode, should thus use wrapping arithmetic.

§Errors

Errors if interacting with the component fails.

Trait Implementations§

Source§

impl<E: WasmEngine> Clone for ReproducibleWasmCodec<E>
where Store<(), ReproducibleEngine<E>>: Send,

Source§

fn clone(&self) -> Self

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<E: WasmEngine> Codec for ReproducibleWasmCodec<E>
where Store<(), ReproducibleEngine<E>>: Send,

Source§

type Error = ReproducibleWasmCodecError

Error type that may be returned during encodeing and decodeing.
Source§

fn encode(&self, data: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>

Encodes the data and returns the result. Read more
Source§

fn decode(&self, encoded: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>

Decodes the encoded data and returns the result. Read more
Source§

fn decode_into( &self, encoded: AnyArrayView<'_>, decoded: AnyArrayViewMut<'_>, ) -> Result<(), Self::Error>

Decodes the encoded data and writes the result into the provided decoded output. Read more
Source§

impl<E: WasmEngine> Drop for ReproducibleWasmCodec<E>
where Store<(), ReproducibleEngine<E>>: Send,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<E: WasmEngine> DynCodec for ReproducibleWasmCodec<E>
where Store<(), ReproducibleEngine<E>>: Send,

Source§

type Type = ReproducibleWasmCodecType<E>

Type object type for this codec.
Source§

fn ty(&self) -> Self::Type

Returns the type object for this codec.
Source§

fn get_config<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serializes the configuration parameters for this codec. Read more

Auto Trait Implementations§

§

impl<E> !Freeze for ReproducibleWasmCodec<E>

§

impl<E> !RefUnwindSafe for ReproducibleWasmCodec<E>

§

impl<E> Send for ReproducibleWasmCodec<E>

§

impl<E> Sync for ReproducibleWasmCodec<E>

§

impl<E> Unpin for ReproducibleWasmCodec<E>
where <E as WasmEngine>::Store<StoreData<StoreInner<(), ReproducibleEngine<E>>, E>>: Unpin,

§

impl<E> !UnwindSafe for ReproducibleWasmCodec<E>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Is for T
where T: ?Sized,

§

type EqTo = T

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T