Struct oc_wasm_safe::component::MethodCall

source ·
pub struct MethodCall<'invoker>(/* private fields */);
Expand description

An in-progress method call.

The 'invoker lifetime parameter is the lifetime of the method invoker that is performing the call.

If a value of this type is dropped, the method call is cancelled. If it has not executed yet, it will not execute; if it has already executed, its result is discarded.

Implementations§

source§

impl<'invoker> MethodCall<'invoker>

source

pub fn end_length(self) -> InvokeEndLengthResult<'invoker>

Returns the length, in bytes, of the result of the method call, or an indication that the call is not finished.

On success, the length and the MethodCall are returned, allowing the MethodCall to be reused to fetch the actual bytes.

§Errors
  • NoSuchComponent is returned if the method call failed because the component does not exist or is inaccessible.
  • NoSuchMethod is returned if the method call failed because the method does not exist on the component.
  • BadParameters is returned if the parameters provided when starting the call are not acceptable for the method.
  • Other is returned if the method call failed.
source

pub unsafe fn end_ptr( self, buffer: *mut u8, len: usize, ) -> InvokeEndResult<'invoker>

Returns the result of the method call as a CBOR-encoded data item, or an indication that the call is not finished.

On success, the result is written into up to len bytes pointed to by buffer, and the number of bytes written is returned. If the buffer is not large enough to hold the call result, BufferTooShort is returned, containing the MethodCall object, allowing the caller to retry fetching the results with a larger buffer, or call end_length to obtain the needed buffer size.

§Errors
  • NoSuchComponent is returned if the method call failed because the component does not exist or is inaccessible.
  • NoSuchMethod is returned if the method call failed because the method does not exist on the component.
  • BadParameters is returned if the parameters provided when starting the call are not acceptable for the method.
  • Other is returned if the method call failed.
§Safety

The caller must ensure that len bytes pointed to by buffer are writeable.

source

pub fn end(self, buffer: &mut [u8]) -> InvokeEndResult<'invoker>

Returns the result of the method call as a CBOR-encoded data item, or an indication that the call is not finished.

On success, the result is written into buffer, and the number of bytes written is returned. If the buffer is not large enough to hold the call result, BufferTooShort is returned, containing the MethodCall object, allowing the caller to retry fetching the results with a larger buffer, or call end_length to obtain the needed buffer size.

§Errors
  • NoSuchComponent is returned if the method call failed because the component does not exist or is inaccessible.
  • NoSuchMethod is returned if the method call failed because the method does not exist on the component.
  • BadParameters is returned if the parameters provided when starting the call are not acceptable for the method.
  • Other is returned if the method call failed.

Trait Implementations§

source§

impl<'invoker> Debug for MethodCall<'invoker>

source§

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

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

impl Drop for MethodCall<'_>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'invoker> PartialEq for MethodCall<'invoker>

source§

fn eq(&self, other: &MethodCall<'invoker>) -> 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<'invoker> Eq for MethodCall<'invoker>

source§

impl<'invoker> StructuralPartialEq for MethodCall<'invoker>

Auto Trait Implementations§

§

impl<'invoker> Freeze for MethodCall<'invoker>

§

impl<'invoker> RefUnwindSafe for MethodCall<'invoker>

§

impl<'invoker> Send for MethodCall<'invoker>

§

impl<'invoker> Sync for MethodCall<'invoker>

§

impl<'invoker> Unpin for MethodCall<'invoker>

§

impl<'invoker> !UnwindSafe for MethodCall<'invoker>

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.