Struct twilight_gateway::MessageSender
source · pub struct MessageSender { /* private fields */ }
Expand description
Implementations§
source§impl MessageSender
impl MessageSender
sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Whether the channel is closed.
The channel will only be closed if the associated shard has been dropped.
sourcepub fn command(&self, command: &impl Command) -> Result<(), SendError>
pub fn command(&self, command: &impl Command) -> Result<(), SendError>
Send a command to the associated shard.
Errors
Returns a SendErrorType::Sending
error type if the channel is
closed.
Returns a SendErrorType::Serializing
error type if the provided
command failed to serialize.
sourcepub fn send(&self, json: String) -> Result<(), SendError>
pub fn send(&self, json: String) -> Result<(), SendError>
Send a JSON encoded gateway event to the associated shard.
Errors
Returns a SendErrorType::Sending
error type if the channel is
closed.
sourcepub fn close(&self, close_frame: CloseFrame<'static>) -> Result<(), SendError>
pub fn close(&self, close_frame: CloseFrame<'static>) -> Result<(), SendError>
Send a Websocket close frame to the associated shard.
Subsequent calls may be queued up to be sent once the shard’s
reestablished a Websocket connection or ignored if the queue is full.
The internal queue capacity is currently 1
.
See the Shard::close
docs for further information.
Errors
Returns a SendErrorType::Sending
error type if the channel is
closed.
Trait Implementations§
source§impl Clone for MessageSender
impl Clone for MessageSender
source§fn clone(&self) -> MessageSender
fn clone(&self) -> MessageSender
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more