[][src]Struct exonum::blockchain::ApiSender

pub struct ApiSender<T = Verified<AnyTx>>(_);

Asynchronous sender of messages (transactions by default). The receiver of messages is usually an Exonum node, which then processes them with the consensus algorithm.

Methods

impl<T: Send + 'static> ApiSender<T>[src]

pub fn new(inner: Sender<T>) -> Self[src]

Creates new ApiSender with the given channel.

pub fn closed() -> Self[src]

Creates a dummy sender which is not connected to anything and thus cannot send messages.

pub async fn send_message<'_>(&'_ mut self, message: T) -> Result<(), SendError>[src]

Sends a message to the node asynchronously.

Return value

The failure means that the node is being shut down.

pub fn send_message_blocking(&self, message: T) -> Result<(), SendError>[src]

Sends a message to the node synchronously.

Return value

The failure means that the node is being shut down.

impl ApiSender[src]

pub fn broadcast_transaction(
    &self,
    tx: Verified<AnyTx>
) -> impl Future<Output = Result<(), SendError>>
[src]

Sends a transaction over the channel. If this sender is connected to a node, this will broadcast the transaction to all nodes in the blockchain network.

Return value

The failure means that the node is being shut down.

pub fn broadcast_transaction_blocking(
    &self,
    tx: Verified<AnyTx>
) -> Result<(), SendError>
[src]

Sends a transaction over the channel synchronously. If this sender is connected to a node, this will broadcast the transaction to all nodes in the blockchain network.

This is an blocking operation that can take some time if the node is overloaded with requests.

Return value

The failure means that the node is being shut down.

Trait Implementations

impl<T> Clone for ApiSender<T>[src]

impl<T> Debug for ApiSender<T>[src]

Auto Trait Implementations

impl<T = Verified<AnyTx>> !RefUnwindSafe for ApiSender<T>

impl<T> Send for ApiSender<T> where
    T: Send

impl<T> Sync for ApiSender<T> where
    T: Send

impl<T> Unpin for ApiSender<T>

impl<T = Verified<AnyTx>> !UnwindSafe for ApiSender<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,