Struct graphql_ws_client::ClientBuilder
source · pub struct ClientBuilder { /* private fields */ }
Expand description
Builder for Graphql over Websocket clients
This can be used to configure the client prior to construction, but can also create subscriptions directly in the case where users only need to run one per connection.
use graphql_ws_client::Client;
use std::future::IntoFuture;
let (client, actor) = Client::build(connection).await?;
Implementations§
source§impl ClientBuilder
impl ClientBuilder
sourcepub fn payload<NewPayload>(
self,
payload: NewPayload
) -> Result<ClientBuilder, Error>where
NewPayload: Serialize,
pub fn payload<NewPayload>(
self,
payload: NewPayload
) -> Result<ClientBuilder, Error>where
NewPayload: Serialize,
Add payload to connection_init
sourcepub fn subscription_buffer_size(self, new: usize) -> Self
pub fn subscription_buffer_size(self, new: usize) -> Self
Sets the size of the incoming message buffer that subscriptions created by this client will use
sourcepub async fn subscribe<'a, Operation>(
self,
op: Operation
) -> Result<Subscription<Operation>, Error>
pub async fn subscribe<'a, Operation>( self, op: Operation ) -> Result<Subscription<Operation>, Error>
Initialise a Client and use it to run a single subscription
use graphql_ws_client::Client;
use std::future::IntoFuture;
let stream = Client::build(connection).subscribe(subscription).await?;
Note that this takes ownership of the client, so it cannot be used to run any more operations.
If users want to run mutliple operations on a connection they
should use the IntoFuture
impl to construct a Client
source§impl ClientBuilder
impl ClientBuilder
Trait Implementations§
source§impl IntoFuture for ClientBuilder
impl IntoFuture for ClientBuilder
§type Output = Result<(Client, ConnectionActor), Error>
type Output = Result<(Client, ConnectionActor), Error>
The output that the future will produce on completion.
§type IntoFuture = Pin<Box<dyn Future<Output = <ClientBuilder as IntoFuture>::Output> + Send>>
type IntoFuture = Pin<Box<dyn Future<Output = <ClientBuilder as IntoFuture>::Output> + Send>>
Which kind of future are we turning this into?
source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Creates a future from a value. Read more
Auto Trait Implementations§
impl Freeze for ClientBuilder
impl !RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl !Sync for ClientBuilder
impl Unpin for ClientBuilder
impl !UnwindSafe for ClientBuilder
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