pub struct WasmTapAgent { /* private fields */ }
Expand description
TAP Agent implementation for WASM bindings
Implementations§
Source§impl WasmTapAgent
impl WasmTapAgent
Sourcepub fn new(config: JsValue) -> Result<WasmTapAgent, JsValue>
pub fn new(config: JsValue) -> Result<WasmTapAgent, JsValue>
Creates a new agent with the specified configuration
Sourcepub fn pack_message(&self, message_js: JsValue) -> Promise
pub fn pack_message(&self, message_js: JsValue) -> Promise
Pack a message using this agent’s keys for transmission
Sourcepub fn unpack_message(
&self,
packed_message: &str,
expected_type: Option<String>,
) -> Promise
pub fn unpack_message( &self, packed_message: &str, expected_type: Option<String>, ) -> Promise
Unpack a message received by this agent
Sourcepub fn register_message_handler(
&mut self,
message_type: &str,
handler: Function,
)
pub fn register_message_handler( &mut self, message_type: &str, handler: Function, )
Registers a message handler function for a specific message type
Sourcepub fn process_message(&self, message: JsValue, metadata: JsValue) -> Promise
pub fn process_message(&self, message: JsValue, metadata: JsValue) -> Promise
Processes a received message by routing it to the appropriate handler
Sourcepub fn subscribe_to_messages(&mut self, callback: Function) -> Function
pub fn subscribe_to_messages(&mut self, callback: Function) -> Function
Subscribes to all messages processed by this agent
Sourcepub fn create_message(&self, message_type: &str) -> JsValue
pub fn create_message(&self, message_type: &str) -> JsValue
Creates a new message with a random ID
Sourcepub fn generate_key(&self, key_type_str: &str) -> Promise
pub fn generate_key(&self, key_type_str: &str) -> Promise
Generate a new key for the agent
Trait Implementations§
Source§impl Clone for WasmTapAgent
impl Clone for WasmTapAgent
Source§fn clone(&self) -> WasmTapAgent
fn clone(&self) -> WasmTapAgent
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 moreSource§impl From<WasmTapAgent> for JsValue
impl From<WasmTapAgent> for JsValue
Source§fn from(value: WasmTapAgent) -> Self
fn from(value: WasmTapAgent) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for WasmTapAgent
impl FromWasmAbi for WasmTapAgent
Source§impl IntoWasmAbi for WasmTapAgent
impl IntoWasmAbi for WasmTapAgent
Source§impl LongRefFromWasmAbi for WasmTapAgent
impl LongRefFromWasmAbi for WasmTapAgent
Source§impl OptionFromWasmAbi for WasmTapAgent
impl OptionFromWasmAbi for WasmTapAgent
Source§impl OptionIntoWasmAbi for WasmTapAgent
impl OptionIntoWasmAbi for WasmTapAgent
Source§impl RefFromWasmAbi for WasmTapAgent
impl RefFromWasmAbi for WasmTapAgent
Source§type Anchor = RcRef<WasmTapAgent>
type Anchor = RcRef<WasmTapAgent>
The type that holds the reference to
Self
for the duration of the
invocation of the function that has an &Self
parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for WasmTapAgent
impl RefMutFromWasmAbi for WasmTapAgent
Source§impl TryFromJsValue for WasmTapAgent
impl TryFromJsValue for WasmTapAgent
Source§impl VectorFromWasmAbi for WasmTapAgent
impl VectorFromWasmAbi for WasmTapAgent
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[WasmTapAgent]>
Source§impl VectorIntoJsValue for WasmTapAgent
impl VectorIntoJsValue for WasmTapAgent
fn vector_into_jsvalue(vector: Box<[WasmTapAgent]>) -> JsValue
Source§impl VectorIntoWasmAbi for WasmTapAgent
impl VectorIntoWasmAbi for WasmTapAgent
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[WasmTapAgent]>) -> Self::Abi
Source§impl WasmDescribeVector for WasmTapAgent
impl WasmDescribeVector for WasmTapAgent
impl SupportsConstructor for WasmTapAgent
impl SupportsInstanceProperty for WasmTapAgent
impl SupportsStaticProperty for WasmTapAgent
Auto Trait Implementations§
impl Freeze for WasmTapAgent
impl RefUnwindSafe for WasmTapAgent
impl !Send for WasmTapAgent
impl !Sync for WasmTapAgent
impl Unpin for WasmTapAgent
impl UnwindSafe for WasmTapAgent
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> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::Abi
Source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
.