pub struct Client<T> { /* private fields */ }Expand description
Glimesh client. The client is generic over its connection/transport, meaning it can be used with http or websockets (or any future transport Glimesh might support).
To create a client you first create the underlying connection/transport,
such as crate::http::Connection.
Implementations§
Source§impl<T> Client<T>
impl<T> Client<T>
Sourcepub fn new(conn: T) -> Self
pub fn new(conn: T) -> Self
Create a new client from a connection. Prefer calling into_client on the connection itself.
Sourcepub fn into_connection(self) -> T
pub fn into_connection(self) -> T
Turn this client back into its underlying connection
Source§impl<T> Client<T>where
T: QueryConn,
impl<T> Client<T>where
T: QueryConn,
Sourcepub async fn query<Q>(
&self,
variables: Q::Variables,
) -> Result<Q::ResponseData, T::Error>
pub async fn query<Q>( &self, variables: Q::Variables, ) -> Result<Q::ResponseData, T::Error>
Perform a graphql query using the underlying connection.
§Errors
See QueryConn::query for error information
Source§impl<T> Client<T>where
T: MutationConn,
impl<T> Client<T>where
T: MutationConn,
Sourcepub async fn mutate<Q>(
&self,
variables: Q::Variables,
) -> Result<Q::ResponseData, T::Error>
pub async fn mutate<Q>( &self, variables: Q::Variables, ) -> Result<Q::ResponseData, T::Error>
Perform a graphql mutation using the underlying connection
§Errors
See MutationConn::mutate for error information
Source§impl<T> Client<T>where
T: SubscriptionConn,
impl<T> Client<T>where
T: SubscriptionConn,
Sourcepub async fn subscribe<'a, Q>(
&self,
variables: Q::Variables,
) -> Result<Subscription<Q::ResponseData>, T::Error>
pub async fn subscribe<'a, Q>( &self, variables: Q::Variables, ) -> Result<Subscription<Q::ResponseData>, T::Error>
Subscribe to a graphql subcription using the underlying connection.
§Errors
See SubscriptionConn::subscribe for error information
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Client<T>where
T: Freeze,
impl<T> RefUnwindSafe for Client<T>where
T: RefUnwindSafe,
impl<T> Send for Client<T>where
T: Send,
impl<T> Sync for Client<T>where
T: Sync,
impl<T> Unpin for Client<T>where
T: Unpin,
impl<T> UnwindSafe for Client<T>where
T: 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