pub struct ReproducibleWasmCodec<E: WasmEngine>{ /* 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>
impl<E: WasmEngine> ReproducibleWasmCodec<E>
Sourcepub fn try_drop(self) -> Result<(), ReproducibleWasmCodecError>
pub fn try_drop(self) -> Result<(), ReproducibleWasmCodecError>
Sourcepub fn instruction_counter(
&self,
) -> Result<Wrapping<u64>, ReproducibleWasmCodecError>
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>
impl<E: WasmEngine> Clone for ReproducibleWasmCodec<E>
Source§impl<E: WasmEngine> Codec for ReproducibleWasmCodec<E>
impl<E: WasmEngine> Codec for ReproducibleWasmCodec<E>
Source§fn encode(&self, data: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>
fn encode(&self, data: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>
Encodes the
data and returns the result. Read moreSource§fn decode(&self, encoded: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>
fn decode(&self, encoded: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>
Decodes the
encoded data and returns the result. Read moreSource§fn decode_into(
&self,
encoded: AnyArrayView<'_>,
decoded: AnyArrayViewMut<'_>,
) -> Result<(), Self::Error>
fn decode_into( &self, encoded: AnyArrayView<'_>, decoded: AnyArrayViewMut<'_>, ) -> Result<(), Self::Error>
Source§impl<E: WasmEngine> Drop for ReproducibleWasmCodec<E>
impl<E: WasmEngine> Drop for ReproducibleWasmCodec<E>
Source§impl<E: WasmEngine> DynCodec for ReproducibleWasmCodec<E>
impl<E: WasmEngine> DynCodec for ReproducibleWasmCodec<E>
Source§type Type = ReproducibleWasmCodecType<E>
type Type = ReproducibleWasmCodecType<E>
Type object type for this codec.
Source§fn get_config<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>
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> !UnwindSafe for ReproducibleWasmCodec<E>
impl<E> Forget for ReproducibleWasmCodec<E>
impl<E> Move for ReproducibleWasmCodec<E>
impl<E> Send for ReproducibleWasmCodec<E>where
Mutex<Store<(), ReproducibleEngine<E>>>: Send,
Arc<InstanceInner>: Send,
Arc<Atomic<usize>>: Send,
BoxRaw<dyn AnyCloneBoxed>: Send,
TypeId: Send,
Arc<str>: Send,
Identifier: Send,
Arc<Schema>: Send,
Arc<[ValueType]>: Send,
Arc<GuestFunc>: Send,
Arc<ComponentInner>: Send,
Arc<dyn Fn(&Component, &str) -> Result<(Store<(), ReproducibleEngine<E>>, Instance, WasmCodecComponent), ReproducibleWasmCodecError> + Sync + Send>: Send,
impl<E> Sync for ReproducibleWasmCodec<E>where
Mutex<Store<(), ReproducibleEngine<E>>>: Sync,
Arc<InstanceInner>: Sync,
Arc<Atomic<usize>>: Sync,
BoxRaw<dyn AnyCloneBoxed>: Sync,
TypeId: Sync,
Arc<str>: Sync,
Identifier: Sync,
Arc<Schema>: Sync,
Arc<[ValueType]>: Sync,
Arc<GuestFunc>: Sync,
Arc<ComponentInner>: Sync,
Arc<dyn Fn(&Component, &str) -> Result<(Store<(), ReproducibleEngine<E>>, Instance, WasmCodecComponent), ReproducibleWasmCodecError> + Sync + Send>: Sync,
impl<E> Unpin for ReproducibleWasmCodec<E>where
Align4<u32>: Unpin,
Align1<u8>: Unpin,
ReproducibleStore<StoreInner<(), ReproducibleEngine<E>>, E>: Unpin,
Arc<InstanceInner>: Unpin,
Arc<Atomic<usize>>: Unpin,
Box<dyn AnyCloneBoxed>: Unpin,
*const (): Unpin,
Arc<str>: Unpin,
*const u8 is !null: Unpin,
Arc<Schema>: Unpin,
Arc<[ValueType]>: Unpin,
Arc<GuestFunc>: Unpin,
Arc<ComponentInner>: Unpin,
Arc<dyn Fn(&Component, &str) -> Result<(Store<(), ReproducibleEngine<E>>, Instance, WasmCodecComponent), ReproducibleWasmCodecError> + Sync + Send>: Unpin,
impl<E> UnsafeUnpin for ReproducibleWasmCodec<E>where
Align4<u32>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
ReproducibleStore<StoreInner<(), ReproducibleEngine<E>>, E>: UnsafeUnpin,
*const ArcInner<InstanceInner> is !null: UnsafeUnpin,
PhantomData<ArcInner<InstanceInner>>: UnsafeUnpin,
*const ArcInner<Atomic<usize>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Atomic<usize>>>: UnsafeUnpin,
*const dyn AnyCloneBoxed is !null: UnsafeUnpin,
PhantomData<dyn AnyCloneBoxed>: UnsafeUnpin,
*const (): UnsafeUnpin,
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
*const ArcInner<Schema> is !null: UnsafeUnpin,
PhantomData<ArcInner<Schema>>: UnsafeUnpin,
*const ArcInner<[ValueType]> is !null: UnsafeUnpin,
PhantomData<ArcInner<[ValueType]>>: UnsafeUnpin,
*const ArcInner<GuestFunc> is !null: UnsafeUnpin,
PhantomData<ArcInner<GuestFunc>>: UnsafeUnpin,
*const ArcInner<ComponentInner> is !null: UnsafeUnpin,
PhantomData<ArcInner<ComponentInner>>: UnsafeUnpin,
*const ArcInner<dyn Fn(&Component, &str) -> Result<(Store<(), ReproducibleEngine<E>>, Instance, WasmCodecComponent), ReproducibleWasmCodecError> + Sync + Send> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(&Component, &str) -> Result<(Store<(), ReproducibleEngine<E>>, Instance, WasmCodecComponent), ReproducibleWasmCodecError> + Sync + Send>>: UnsafeUnpin,
PhantomData<fn(()) -> u64>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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