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,
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,
pub async fn new( backend: B, local_delivery: L, network: N, ) -> Result<Self, BackendError<M>>
Sourcepub async fn send_to(
&self,
to: M::PeerId,
contents: impl Into<M::Contents>,
) -> Result<(), NetworkError<M>>
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
Sourcepub async fn send_raw_message(&self, message: M) -> Result<(), NetworkError<M>>
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
Sourcepub async fn shutdown(&self, timeout: Duration) -> Result<(), NetworkError<M>>
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
pub async fn get_connected_peers(&self) -> Vec<M::PeerId>
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,
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,
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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