Struct Barrel
pub struct Barrel<H: Send + Clone> { /* private fields */ }Expand description
Barrel encapsulates the concept of a running Lyquid instance given a specific execution context
(Barrel::host, which also includes the a version of network state). The given H generic
type should be clonable in a way that all clones effecitvely represent the same context/state.
In the implementation, all Bottles (e.g., call frames) in a Barrel share the same [LyteMemory] object.
Implementations§
§impl<H: Send + Clone> Barrel<H>
impl<H: Send + Clone> Barrel<H>
pub fn builder(
wasm_bin: Bytes,
lite_memory: LyteMemory,
host: H,
) -> Result<BarrelBuilder<H>, Error>
pub fn builder( wasm_bin: Bytes, lite_memory: LyteMemory, host: H, ) -> Result<BarrelBuilder<H>, Error>
Create a builder for Barrel.
pub async fn nuke_state(&self) -> Result<(), Error>
pub async fn nuke_state(&self) -> Result<(), Error>
Mark the network & instance state as uninitialized, which means the next call made to the Barrel will start with a new state.
pub fn memory(&self) -> &LyteMemory
pub fn memory(&self) -> &LyteMemory
Access the underlying LyteMemory for this Barrel (all Bottles use the same LyteMemory).
pub async fn call<O, F: FnOnce(&[u8]) -> Result<O, Error>>(
&self,
method: &str,
input: &[u8],
output_decoder: F,
abi: InputABI,
) -> Result<O, Error>
pub async fn call<O, F: FnOnce(&[u8]) -> Result<O, Error>>( &self, method: &str, input: &[u8], output_decoder: F, abi: InputABI, ) -> Result<O, Error>
Call the given Lyquid function with raw input and customized output decoder.
pub async fn call_network_func(
&self,
params: CallParams,
) -> Result<Vec<u8>, Error>
pub async fn call_network_func( &self, params: CallParams, ) -> Result<Vec<u8>, Error>
Make a network call with raw input and output.
pub async fn call_instance_func(
&self,
params: CallParams,
) -> Result<Vec<u8>, Error>
pub async fn call_instance_func( &self, params: CallParams, ) -> Result<Vec<u8>, Error>
Make an instance call with raw input and output.
pub async fn call_instance_func_decoded<O: for<'a> Deserialize<'a>>(
&self,
params: CallParams,
) -> Result<O, Error>
pub async fn call_instance_func_decoded<O: for<'a> Deserialize<'a>>( &self, params: CallParams, ) -> Result<O, Error>
Make an instance call with typed input and output.
pub fn host(&self) -> &H
Auto Trait Implementations§
impl<H> Freeze for Barrel<H>where
H: Freeze,
impl<H> !RefUnwindSafe for Barrel<H>
impl<H> Send for Barrel<H>
impl<H> Sync for Barrel<H>where
H: Sync,
impl<H> Unpin for Barrel<H>where
H: Unpin,
impl<H> !UnwindSafe for Barrel<H>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<'de, F, T> Deserialize<'de, As<F>> for Twhere
F: BareFormula + ?Sized,
T: Deserialize<'de, F>,
impl<'de, F, T> Deserialize<'de, As<F>> for Twhere
F: BareFormula + ?Sized,
T: Deserialize<'de, F>,
§fn deserialize(deserializer: Deserializer<'de>) -> Result<T, DeserializeError>
fn deserialize(deserializer: Deserializer<'de>) -> Result<T, DeserializeError>
§fn deserialize_in_place(
&mut self,
deserializer: Deserializer<'de>,
) -> Result<(), DeserializeError>
fn deserialize_in_place( &mut self, deserializer: Deserializer<'de>, ) -> Result<(), DeserializeError>
self with data from the input. Read more§impl<'de, F, T> Deserialize<'de, Ref<F>> for T
impl<'de, F, T> Deserialize<'de, Ref<F>> for T
§fn deserialize(de: Deserializer<'de>) -> Result<T, DeserializeError>
fn deserialize(de: Deserializer<'de>) -> Result<T, DeserializeError>
§fn deserialize_in_place(
&mut self,
de: Deserializer<'de>,
) -> Result<(), DeserializeError>
fn deserialize_in_place( &mut self, de: Deserializer<'de>, ) -> Result<(), DeserializeError>
self with data from the input. Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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