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>

Queue an engine command and return the CommandId it was minted under — watch the event stream for the settlement tagged with it. None once the node has stopped (or the bounded embedded lane is full). The fire-and-forget escape hatch.

Source

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

Send one Single data packet to destination and await its delivery proof — Ok(Delivered) with the measured round trip, or the typed reason it did not deliver.

Source

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

Sever an active link. Returns false once the node has stopped.

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. None once the node has stopped. For one interface or explicit app_data, issue a custom AnnounceNow.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§