pub struct Invoker(/* private fields */);
Expand description

An object that is capable of invoking methods.

Because only one method can be invoked at a time, only one value of this type can exist. An application written as a state machine should take the instance and store it in a static variable. An application using async and await in which only one task needs to make method calls should either take the value in that task, or take it in the top-level task and move it into the task that needs it. An application using async and await in which multiple tasks all need to make method calls needs to arrange mutual exclusion so that only one task can access the invoker at a time.

Implementations§

source§

impl Invoker

source

pub fn take() -> Option<Self>

Returns the invoker.

This function can only be called once in the lifetime of the application. On the second and subsequent calls, it will return None.

source

pub fn component_method<'invoker>( &'invoker mut self, address: &Address, method: &str, params: Option<&[u8]> ) -> Result<(InvokeResult, MethodCall<'invoker>)>

Starts invoking a method on a component.

The address parameter identifies the component by its UUID. The method parameter identifies the method by its name. The params parameter, if present, contains a CBOR-encoded array of parameters to pass to the method.

§Errors
  • CborDecode is returned if the params parameter is present but contains an invalid or unsupported CBOR sequence.
  • BadDescriptor is returned if the parameters contain a descriptor reference to a descriptor that is not open.
  • TooManyDescriptors is returned if the descriptor table is too full and some descriptors must be closed before another method call can be made.
source

pub fn value<'invoker>( &'invoker mut self, descriptor: &impl AsDescriptor, params: Option<&[u8]> ) -> Result<(InvokeResult, MethodCall<'invoker>)>

Starts invoking a callable opaque value.

The descriptor parameter identifies the opaque value by its descriptor. The params parameter, if present, contains a CBOR-encoded array of parameters to pass to the method.

§Errors
  • CborDecode is returned if the params parameter is present but contains an invalid or unsupported CBOR sequence.
  • BadDescriptor is returned if the parameters contain a descriptor reference to a descriptor that is not open.
  • TooManyDescriptors is returned if the descriptor table is too full and some descriptors must be closed before another method call can be made.
source

pub fn value_indexed_read<'invoker>( &'invoker mut self, descriptor: &impl AsDescriptor, params: Option<&[u8]> ) -> Result<(InvokeResult, MethodCall<'invoker>)>

Starts reading from an index of an opaque value.

The descriptor parameter identifies the opaque value by its descriptor. The params parameter, if present, contains a CBOR-encoded array of parameters to use for indexing.

§Errors
  • CborDecode is returned if the params parameter is present but contains an invalid or unsupported CBOR sequence.
  • BadDescriptor is returned if the parameters contain a descriptor reference to a descriptor that is not open.
  • TooManyDescriptors is returned if the descriptor table is too full and some descriptors must be closed before another method call can be made.
source

pub fn value_indexed_write<'invoker>( &'invoker mut self, descriptor: &impl AsDescriptor, params: Option<&[u8]> ) -> Result<(InvokeResult, MethodCall<'invoker>)>

Starts writing to an index of an opaque value.

The descriptor parameter identifies the opaque value by its descriptor. The params parameter, if present, contains a CBOR-encoded array of parameters to use for indexing and the value to write.

§Errors
  • CborDecode is returned if the params parameter is present but contains an invalid or unsupported CBOR sequence.
  • BadDescriptor is returned if the parameters contain a descriptor reference to a descriptor that is not open.
  • TooManyDescriptors is returned if the descriptor table is too full and some descriptors must be closed before another method call can be made.
source

pub fn value_method<'invoker>( &'invoker mut self, descriptor: &impl AsDescriptor, method: &str, params: Option<&[u8]> ) -> Result<(InvokeResult, MethodCall<'invoker>)>

Starts invoking a method on an opaque value.

The descriptor parameter identifies the opaque value by its descriptor. The method parameter identifies the method by its name. The params parameter, if present, contains a CBOR-encoded array of parameters to pass to the method.

§Errors
  • CborDecode is returned if the params parameter is present but contains an invalid or unsupported CBOR sequence.
  • BadDescriptor is returned if the parameters contain a descriptor reference to a descriptor that is not open.
  • TooManyDescriptors is returned if the descriptor table is too full and some descriptors must be closed before another method call can be made.

Trait Implementations§

source§

impl Debug for Invoker

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for Invoker

source§

fn eq(&self, _: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Invoker

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.