Struct Barrel
pub struct Barrel<E: RuntimeEnv + 'static, H: Send + Clone + 'static> { /* 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<E: RuntimeEnv + 'static, H: Send + Clone + 'static> Barrel<E, H>
impl<E: RuntimeEnv + 'static, H: Send + Clone + 'static> Barrel<E, H>
pub fn builder(
wasm_bin: Bytes,
lite_memory: LyteMemory,
env: E,
host: H,
) -> Result<BarrelBuilder<E, H>, Error>
pub fn builder( wasm_bin: Bytes, lite_memory: LyteMemory, env: E, host: H, ) -> Result<BarrelBuilder<E, 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 fn functions(&self) -> &[LyquidFunc]
pub fn functions(&self) -> &[LyquidFunc]
Get the list of Lyquid functions.
pub async fn call_network_func(
&self,
params: CallParams,
) -> Result<Vec<u8>, Error>where
H: HasCallKind,
pub async fn call_network_func(
&self,
params: CallParams,
) -> Result<Vec<u8>, Error>where
H: HasCallKind,
Make a network call with raw input and output.
pub async fn call_instance_func(
&self,
params: CallParams,
) -> Result<Vec<u8>, Error>where
H: HasCallKind,
pub async fn call_instance_func(
&self,
params: CallParams,
) -> Result<Vec<u8>, Error>where
H: HasCallKind,
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>where
H: HasCallKind,
pub async fn call_instance_func_decoded<O: for<'a> Deserialize<'a>>(
&self,
params: CallParams,
) -> Result<O, Error>where
H: HasCallKind,
Make an instance call with typed input and output.
pub fn host(&self) -> &H
Auto Trait Implementations§
impl<E, H> Freeze for Barrel<E, H>
impl<E, H> !RefUnwindSafe for Barrel<E, H>
impl<E, H> Send for Barrel<E, H>
impl<E, H> Sync for Barrel<E, H>where
H: Sync,
impl<E, H> Unpin for Barrel<E, H>
impl<E, H> !UnwindSafe for Barrel<E, 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<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