[−][src]Struct spectacles_gateway::Shard
A Spectacles Gateway shard.
Fields
token: String
The bot token that this shard will use.
info: [usize; 2]
The shard's info. Includes the shard's ID and the total amount of shards.
presence: ClientPresence
The currently active presence for this shard.
session_id: Option<String>
The session ID of this shard, if applicable.
interval: Option<u64>
The interval at which a heartbeat is made.
sender: Arc<Mutex<UnboundedSender<WebsocketMessage>>>
The channel which is used to send websocket messages.
stream: Arc<Mutex<Option<SplitStream<WebSocketStream<TungsteniteStream<TokioTcpStream, TlsStream<TokioTcpStream>>>>>>>
The shard's message stream, which is used to receive messages.
heartbeat: Arc<Mutex<Heartbeat>>
This shard's current heartbeat.
Methods
impl Shard
[src]
pub fn new(
token: String,
info: [usize; 2],
ws_uri: String
) -> impl Future<Item = Shard, Error = Error>
[src]
token: String,
info: [usize; 2],
ws_uri: String
) -> impl Future<Item = Shard, Error = Error>
Creates a new Discord Shard, with the provided token.
pub fn fulfill_gateway(&mut self, packet: ReceivePacket) -> Result<ShardAction>
[src]
pub fn identify(&mut self) -> Result<()>
[src]
Identifies a shard with Discord.
pub fn autoreconnect(
&mut self
) -> Box<dyn Future<Item = (), Error = Error> + Send>
[src]
&mut self
) -> Box<dyn Future<Item = (), Error = Error> + Send>
Attempts to automatically reconnect the shard to Discord.
pub fn reconnect(&mut self) -> impl Future<Item = (), Error = Error> + Send
[src]
Makes a request to reconnect the shard.
pub fn resume(&mut self) -> impl Future<Item = (), Error = Error> + Send
[src]
Resumes a shard's past session.
pub fn resolve_packet(&self, mess: &WebsocketMessage) -> Result<ReceivePacket>
[src]
Resolves a Websocket message into a ReceivePacket struct.
pub fn send_payload<T: SendablePacket>(&self, payload: T) -> Result<()>
[src]
Sends a payload to the Discord Gateway.
pub fn change_status(&mut self, status: Status) -> Result<()>
[src]
Change the status of the current shard.
pub fn change_activity(&mut self, activity: ClientActivity) -> Result<()>
[src]
Change the activity of the current shard.
pub fn change_presence(&mut self, presence: ClientPresence) -> Result<()>
[src]
Change the presence of the current shard.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Erased for T
impl<T> Same for T
type Output = T
Should always be Self
impl<T, U> TryInto for T where
U: TryFrom<T>,
U: TryFrom<T>,