pub struct MessageSystem<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> MessageSystem<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> MessageSystem<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>
Sourcepub async fn send_to(
&self,
to: M::PeerId,
contents: impl Into<Vec<u8>>,
) -> Result<(), NetworkError>
pub async fn send_to( &self, to: M::PeerId, contents: impl Into<Vec<u8>>, ) -> Result<(), NetworkError>
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>
pub async fn send_raw_message(&self, message: M) -> Result<(), NetworkError>
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
Trait Implementations§
Source§impl<M, B, L, N> Clone for MessageSystem<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> Clone for MessageSystem<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§impl<M, B, L, N> Drop for MessageSystem<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 MessageSystem<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 MessageSystem<M, B, L, N>
impl<M, B, L, N> !RefUnwindSafe for MessageSystem<M, B, L, N>
impl<M, B, L, N> Send for MessageSystem<M, B, L, N>
impl<M, B, L, N> Sync for MessageSystem<M, B, L, N>
impl<M, B, L, N> Unpin for MessageSystem<M, B, L, N>
impl<M, B, L, N> !UnwindSafe for MessageSystem<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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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