Skip to main content

PrnsNodeApi

Trait PrnsNodeApi 

Source
pub trait PrnsNodeApi {
    // Required methods
    fn issue(&self, command: PrnsCommand) -> Option<CommandId>;
    async fn send_single_packet(
        &self,
        destination: DestinationHash,
        data: &[u8],
    ) -> Result<PacketReceiptDelivered, SendError<SendSinglePacketFailure>>;
    fn respond_packed(&self, responder: RespondToken, packed: &[u8]) -> bool;
    fn close_link(&self, link_id: LinkId) -> bool;

    // Provided method
    fn announce(&self, destination: DestinationHash) -> Option<CommandId> { ... }
}
Expand description

The high-level API shared by every platform’s node handle. Tokio carries commands over an unbounded channel with per-command oneshots; Embassy uses a bounded channel and static completion pool.

issue returns a minted CommandId immediately, while awaited operations settle through that id. Platform-specific capabilities remain inherent methods on the concrete handle.

Required Methods§

Source

fn issue(&self, command: PrnsCommand) -> Option<CommandId>

Queues an engine command and returns the CommandId it was minted under. If you’re looking for its settlement, watch the event stream for the settlement tagged with that CommandId.

You may not ever need this, since many operations have their own convenience methods, usually awaitable.

Source

async fn send_single_packet( &self, destination: DestinationHash, data: &[u8], ) -> Result<PacketReceiptDelivered, SendError<SendSinglePacketFailure>>

Source

fn respond_packed(&self, responder: RespondToken, packed: &[u8]) -> bool

Provided Methods§

Source

fn announce(&self, destination: DestinationHash) -> Option<CommandId>

Announce destination on every interface with its registered app_data: RNS 1.4.2 Destination.announce() with no arguments.

Returns None if the node has stopped. If you want to target a specific interface or provide explicit app_data, issue a custom AnnounceNow. Some platform implementations may provide an awaitable convenience method, specifically for announce_now, on top of this.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§