pub trait Component: Sized {
const KIND: &'static str;
// Required methods
fn from_address(address: Address) -> Self;
fn address(&self) -> &Address;
// Provided methods
fn first() -> Option<Self> { ... }
fn all() -> Vec<Self> { ... }
fn at(address: impl Into<Address>) -> Option<Self> { ... }
fn invoke(&self, method: &str, args: Vec<Value>) -> Result<Vec<Value>> { ... }
fn invoke_async(&self, method: &str, args: Vec<Value>) -> Call ⓘ { ... }
}Expand description
A typed component wrapper.
Required Associated Constants§
Required Methods§
Sourcefn from_address(address: Address) -> Self
fn from_address(address: Address) -> Self
Wraps an address without checking what is there.
fn address(&self) -> &Address
Provided Methods§
Sourcefn at(address: impl Into<Address>) -> Option<Self>
fn at(address: impl Into<Address>) -> Option<Self>
The component at address, if it is of this type.
Sourcefn invoke(&self, method: &str, args: Vec<Value>) -> Result<Vec<Value>>
fn invoke(&self, method: &str, args: Vec<Value>) -> Result<Vec<Value>>
An untyped call, for methods the wrapper doesn’t know.
Sourcefn invoke_async(&self, method: &str, args: Vec<Value>) -> Call ⓘ
fn invoke_async(&self, method: &str, args: Vec<Value>) -> Call ⓘ
Component::invoke without blocking; see invoke_async.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".