pub struct GatewayClient { /* private fields */ }Expand description
Connected client before its command and event halves are separated.
Implementations§
Source§impl GatewayClient
impl GatewayClient
Sourcepub async fn connect(
endpoint: &Endpoint,
token: &str,
client_kind: ClientKind,
) -> Result<Self>
pub async fn connect( endpoint: &Endpoint, token: &str, client_kind: ClientKind, ) -> Result<Self>
Authenticates an existing client and leaves the gateway Ready frame for events.
§Errors
Returns an error if the transport fails or returns invalid data.
Sourcepub async fn connect_with(
endpoint: &Endpoint,
token: &str,
client_kind: ClientKind,
options: &mut ConnectOptions,
) -> Result<Self>
pub async fn connect_with( endpoint: &Endpoint, token: &str, client_kind: ClientKind, options: &mut ConnectOptions, ) -> Result<Self>
Self::connect with a catalog hint and pipelined requests, which options holds
again afterwards, whether or not the connection succeeded.
§Errors
Returns an error if the transport fails or returns invalid data.
Sourcepub async fn pair(
endpoint: &Endpoint,
code: impl Into<String>,
client_label: impl Into<String>,
client_kind: ClientKind,
) -> Result<(Self, PairedClient)>
pub async fn pair( endpoint: &Endpoint, code: impl Into<String>, client_label: impl Into<String>, client_kind: ClientKind, ) -> Result<(Self, PairedClient)>
Consumes a pending pairing code and returns a connected independent client.
§Errors
Returns an error if authentication fails or its stored state is invalid.
Sourcepub fn into_parts(self) -> (GatewaySender, GatewayEvents)
pub fn into_parts(self) -> (GatewaySender, GatewayEvents)
Separates the clonable command writer from the single event reader.
Auto Trait Implementations§
impl !RefUnwindSafe for GatewayClient
impl !Sync for GatewayClient
impl !UnwindSafe for GatewayClient
impl Freeze for GatewayClient
impl Send for GatewayClient
impl Unpin for GatewayClient
impl UnsafeUnpin for GatewayClient
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