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>
impl<'invoker> MethodCall<'invoker>
sourcepub fn end_length(self) -> InvokeEndLengthResult<'invoker>
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.
sourcepub unsafe fn end_ptr(
self,
buffer: *mut u8,
len: usize,
) -> InvokeEndResult<'invoker>
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.
sourcepub fn end(self, buffer: &mut [u8]) -> InvokeEndResult<'invoker>
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>
impl<'invoker> Debug for MethodCall<'invoker>
source§impl Drop for MethodCall<'_>
impl Drop for MethodCall<'_>
source§impl<'invoker> PartialEq for MethodCall<'invoker>
impl<'invoker> PartialEq for MethodCall<'invoker>
source§fn eq(&self, other: &MethodCall<'invoker>) -> bool
fn eq(&self, other: &MethodCall<'invoker>) -> bool
self
and other
values to be equal, and is used
by ==
.