pub struct EntryPointsCaller { /* private fields */ }Expand description
A struct representing an entry point caller.
The caller is used by the host environment to call entry points of a contract.
This struct is responsible for calling the entry points of a contract. It holds the host environment, a list of entry points, and a function pointer that takes a contract environment and a call definition as arguments and returns a result in the form of bytes.
Implementations§
Source§impl EntryPointsCaller
impl EntryPointsCaller
Sourcepub fn new(
host_env: HostEnv,
entry_points: Vec<EntryPoint>,
f: fn(contract_env: ContractEnv, call_def: CallDef) -> OdraResult<Bytes>,
) -> Self
pub fn new( host_env: HostEnv, entry_points: Vec<EntryPoint>, f: fn(contract_env: ContractEnv, call_def: CallDef) -> OdraResult<Bytes>, ) -> Self
Creates a new instance of EntryPointsCaller.
§Arguments
host_env- The host environment.entry_points- A collection of available entry points.f- A function pointer that performs a call using a given contract environment and a call definition and returns a result in the form of bytes.
§Returns
A new instance of EntryPointsCaller.
Sourcepub fn call(&self, call_def: CallDef) -> OdraResult<Bytes>
pub fn call(&self, call_def: CallDef) -> OdraResult<Bytes>
Calls the entry point with the given call definition. Returns the result of the entry point call in the form of bytes.
Sourcepub fn entry_points(&self) -> &[EntryPoint]
pub fn entry_points(&self) -> &[EntryPoint]
Returns a reference to the list of entry points.
Sourcepub fn remove_entry_point(&mut self, name: &str)
pub fn remove_entry_point(&mut self, name: &str)
Removes an entry point by its name.
Trait Implementations§
Source§impl Clone for EntryPointsCaller
impl Clone for EntryPointsCaller
Source§fn clone(&self) -> EntryPointsCaller
fn clone(&self) -> EntryPointsCaller
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EntryPointsCaller
impl !RefUnwindSafe for EntryPointsCaller
impl !Send for EntryPointsCaller
impl !Sync for EntryPointsCaller
impl Unpin for EntryPointsCaller
impl !UnwindSafe for EntryPointsCaller
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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