Struct ILM

Source
pub struct ILM<M, B, L, N>
where M: MessageMetadata + Clone + Send + Sync + Serialize + for<'de> Deserialize<'de> + 'static, B: Backend<M> + Send + Sync + 'static, L: LocalDelivery<M> + Send + Sync + 'static, N: UnderlyingSessionTransport<Message = M> + Send + Sync + 'static,
{ /* private fields */ }

Implementations§

Source§

impl<M, B, L, N> ILM<M, B, L, N>
where M: MessageMetadata + Clone + Send + Sync + Serialize + for<'de> Deserialize<'de> + 'static, B: Backend<M> + Send + Sync + 'static, L: LocalDelivery<M> + Send + Sync + 'static, N: UnderlyingSessionTransport<Message = M> + Send + Sync + 'static,

Source

pub async fn new( backend: B, local_delivery: L, network: N, ) -> Result<Self, BackendError<M>>

Source

pub async fn send_to( &self, to: M::PeerId, contents: impl Into<M::Contents>, ) -> Result<(), NetworkError<M>>

The preferred entrypoint for sending messages. Unlike [Self::send_raw_message], this ensures the message is properly created

Source

pub async fn send_raw_message(&self, message: M) -> Result<(), NetworkError<M>>

This message should only be used internally or if the developer needs to manually create messages. In this case, the message ID must be an auto-incremented value to ensure uniqueness, and the source_id must match the ID of the node sending the message in the networking layer. Additionally, the source and destination fields cannot be the same

Source

pub async fn shutdown(&self, timeout: Duration) -> Result<(), NetworkError<M>>

Shutdown the message system gracefully This will stop the background tasks and wait for pending outbound messages to be processed

Source

pub async fn get_connected_peers(&self) -> Vec<M::PeerId>

Source

pub fn local_id(&self) -> M::PeerId

Returns the ID of this node in the network

Trait Implementations§

Source§

impl<M, B, L, N> Drop for ILM<M, B, L, N>
where M: MessageMetadata + Clone + Send + Sync + Serialize + for<'de> Deserialize<'de> + 'static, B: Backend<M> + Send + Sync + 'static, L: LocalDelivery<M> + Send + Sync + 'static, N: UnderlyingSessionTransport<Message = M> + Send + Sync + 'static,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<M, B, L, N> Freeze for ILM<M, B, L, N>

§

impl<M, B, L, N> !RefUnwindSafe for ILM<M, B, L, N>

§

impl<M, B, L, N> Send for ILM<M, B, L, N>

§

impl<M, B, L, N> Sync for ILM<M, B, L, N>

§

impl<M, B, L, N> Unpin for ILM<M, B, L, N>

§

impl<M, B, L, N> !UnwindSafe for ILM<M, B, L, N>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.