pub struct Sender<Tx: WireTx> { /* private fields */ }
Expand description
Implementations§
Source§impl<Tx: WireTx> Sender<Tx>
impl<Tx: WireTx> Sender<Tx>
Sourcepub fn new(tx: Tx, kkind: VarKeyKind) -> Self
pub fn new(tx: Tx, kkind: VarKeyKind) -> Self
Create a new Sender
Takes a WireTx
impl, as well as the VarKeyKind
used when sending messages
to the client.
kkind
should usually come from Dispatch::min_key_len()
.
Sourcepub async fn reply<E>(
&self,
seq_no: VarSeq,
resp: &E::Response,
) -> Result<(), Tx::Error>
pub async fn reply<E>( &self, seq_no: VarSeq, resp: &E::Response, ) -> Result<(), Tx::Error>
Send a reply for the given endpoint
Sourcepub async fn reply_keyed<T>(
&self,
seq_no: VarSeq,
key: Key,
resp: &T,
) -> Result<(), Tx::Error>
pub async fn reply_keyed<T>( &self, seq_no: VarSeq, key: Key, resp: &T, ) -> Result<(), Tx::Error>
Send a reply with the given Key
This is useful when replying with “unusual” keys, for example Error responses not tied to any specific Endpoint.
Sourcepub async fn publish<T>(
&self,
seq_no: VarSeq,
msg: &T::Message,
) -> Result<(), Tx::Error>
pub async fn publish<T>( &self, seq_no: VarSeq, msg: &T::Message, ) -> Result<(), Tx::Error>
Publish a Topic message
Sourcepub async fn log_str(&self, msg: &str) -> Result<(), Tx::Error>
pub async fn log_str(&self, msg: &str) -> Result<(), Tx::Error>
Log a str
directly to the LoggingTopic
Sourcepub async fn log_fmt(&self, msg: Arguments<'_>) -> Result<(), Tx::Error>
pub async fn log_fmt(&self, msg: Arguments<'_>) -> Result<(), Tx::Error>
Format a message to the LoggingTopic
Sourcepub async fn error(
&self,
seq_no: VarSeq,
error: WireError,
) -> Result<(), Tx::Error>
pub async fn error( &self, seq_no: VarSeq, error: WireError, ) -> Result<(), Tx::Error>
Send a single error message
Sourcepub async fn send_all_schemas(
&self,
hdr: &VarHeader,
device_map: &DeviceMap,
) -> Result<(), Tx::Error>
pub async fn send_all_schemas( &self, hdr: &VarHeader, device_map: &DeviceMap, ) -> Result<(), Tx::Error>
Implements the GetAllSchemasEndpoint
endpoint
Trait Implementations§
Auto Trait Implementations§
impl<Tx> Freeze for Sender<Tx>where
Tx: Freeze,
impl<Tx> RefUnwindSafe for Sender<Tx>where
Tx: RefUnwindSafe,
impl<Tx> Send for Sender<Tx>where
Tx: Send,
impl<Tx> Sync for Sender<Tx>where
Tx: Sync,
impl<Tx> Unpin for Sender<Tx>where
Tx: Unpin,
impl<Tx> UnwindSafe for Sender<Tx>where
Tx: UnwindSafe,
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