pub struct Connect<C: Connection, Response> { /* private fields */ }
Expand description
The future returned when creating a new SurrealDB instance
Implementations§
Source§impl<C, R> Connect<C, R>where
C: Connection,
impl<C, R> Connect<C, R>where
C: Connection,
Sourcepub const fn with_capacity(self, capacity: usize) -> Self
pub const fn with_capacity(self, capacity: usize) -> Self
Sets the maximum capacity of the connection
This is used to set bounds of the channels used internally
as well set the capacity of the HashMap
used for routing
responses in case of the WebSocket client.
Setting this capacity to 0
(the default) means that
unbounded channels will be used. If your queries per second
are so high that the client is running out of memory,
it might be helpful to set this to a number that works best
for you.
§Examples
use surrealdb::engine::remote::ws::Ws;
use surrealdb::Surreal;
let db = Surreal::new::<Ws>("localhost:8000")
.with_capacity(100_000)
.await?;
Trait Implementations§
Source§impl<Client> IntoFuture for Connect<Client, ()>where
Client: Connection,
impl<Client> IntoFuture for Connect<Client, ()>where
Client: Connection,
Source§type IntoFuture = Pin<Box<dyn Future<Output = <Connect<Client, ()> as IntoFuture>::Output> + Send + Sync>>
type IntoFuture = Pin<Box<dyn Future<Output = <Connect<Client, ()> as IntoFuture>::Output> + Send + Sync>>
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
Source§impl<Client> IntoFuture for Connect<Client, Surreal<Client>>where
Client: Connection,
impl<Client> IntoFuture for Connect<Client, Surreal<Client>>where
Client: Connection,
Source§type Output = Result<Surreal<Client>, Error>
type Output = Result<Surreal<Client>, Error>
The output that the future will produce on completion.
Source§type IntoFuture = Pin<Box<dyn Future<Output = <Connect<Client, Surreal<Client>> as IntoFuture>::Output> + Send + Sync>>
type IntoFuture = Pin<Box<dyn Future<Output = <Connect<Client, Surreal<Client>> as IntoFuture>::Output> + Send + Sync>>
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<C, Response> Freeze for Connect<C, Response>
impl<C, Response> !RefUnwindSafe for Connect<C, Response>
impl<C, Response> Send for Connect<C, Response>where
Response: Send,
impl<C, Response> Sync for Connect<C, Response>where
Response: Sync,
impl<C, Response> Unpin for Connect<C, Response>
impl<C, Response> !UnwindSafe for Connect<C, Response>
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