pub struct Session<T> { /* private fields */ }
Expand description
Session structure which allows clients making requests to a server.
Implementations§
Source§impl Session<TransportTcp>
impl Session<TransportTcp>
Sourcepub async fn connect<Addr: ToString>(
addr: Addr,
compressor: Compression,
authenticator: Authenticator,
) -> Result<Self>
pub async fn connect<Addr: ToString>( addr: Addr, compressor: Compression, authenticator: Authenticator, ) -> Result<Self>
Examples found in repository?
examples/basic.rs (lines 21-25)
18fn main() {
19 task::block_on(async {
20 let authenticator_strategy = NoneAuthenticator {};
21 let mut session = Session::connect(
22 "127.0.0.1:9042",
23 Compression::None,
24 authenticator_strategy.into(),
25 )
26 .await
27 .expect("session connect");
28 let pinned_session = Pin::new(&mut session);
29
30 let r = pinned_session.query(CREATE_KS_QUERY).await;
31 println!("Result {:?}", r);
32 });
33}
Source§impl Session<TransportTls>
impl Session<TransportTls>
pub async fn connect_tls<Addr: ToString>( __arg0: (Addr, TlsConnector), compressor: Compression, authenticator: Authenticator, ) -> Result<Self>
Trait Implementations§
Source§impl<T: CDRSTransport> BatchExecutor for Session<T>
impl<T: CDRSTransport> BatchExecutor for Session<T>
fn batch_with_params_tw<'life0, 'async_trait>(
self: Pin<&'life0 mut Self>,
batch: QueryBatch,
with_tracing: bool,
with_warnings: bool,
) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn batch_with_params<'life0, 'async_trait>(
self: Pin<&'life0 mut Self>,
batch: QueryBatch,
) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl<T: CDRSTransport> ExecExecutor for Session<T>
impl<T: CDRSTransport> ExecExecutor for Session<T>
fn exec_with_params_tw<'life0, 'life1, 'async_trait>(
self: Pin<&'life0 mut Self>,
prepared: &'life1 PreparedQuery,
query_parameters: QueryParams,
with_tracing: bool,
with_warnings: bool,
) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exec_with_params<'life0, 'life1, 'async_trait>(
self: Pin<&'life0 mut Self>,
prepared: &'life1 CBytesShort,
query_parameters: QueryParams,
) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exec_with_values_tw<'life0, 'life1, 'async_trait, V>(
self: Pin<&'life0 mut Self>,
prepared: &'life1 CBytesShort,
values: V,
with_tracing: bool,
with_warnings: bool,
) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>where
V: 'async_trait + Into<QueryValues> + Send,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exec_with_values<'life0, 'life1, 'async_trait, V>(
self: Pin<&'life0 mut Self>,
prepared: &'life1 CBytesShort,
values: V,
) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>where
V: 'async_trait + Into<QueryValues> + Send,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exec_tw<'life0, 'life1, 'async_trait>(
self: Pin<&'life0 mut Self>,
prepared: &'life1 CBytesShort,
with_tracing: bool,
with_warnings: bool,
) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exec<'life0, 'life1, 'async_trait>(
self: Pin<&'life0 mut Self>,
prepared: &'life1 CBytesShort,
) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl<T: CDRSTransport> PrepareExecutor for Session<T>
impl<T: CDRSTransport> PrepareExecutor for Session<T>
Source§fn prepare_tw<'life0, 'async_trait, Q>(
self: Pin<&'life0 mut Self>,
query: Q,
with_tracing: bool,
with_warnings: bool,
) -> Pin<Box<dyn Future<Output = Result<PreparedQuery>> + Send + 'async_trait>>
fn prepare_tw<'life0, 'async_trait, Q>( self: Pin<&'life0 mut Self>, query: Q, with_tracing: bool, with_warnings: bool, ) -> Pin<Box<dyn Future<Output = Result<PreparedQuery>> + Send + 'async_trait>>
It prepares a query for execution, along with query itself
the method takes
with_tracing
and with_warnings
flags
to get tracing information and warnings.Source§impl<T: CDRSTransport> QueryExecutor for Session<T>
impl<T: CDRSTransport> QueryExecutor for Session<T>
fn query_with_params_tw<'life0, 'async_trait, Q>( self: Pin<&'life0 mut Self>, query: Q, query_params: QueryParams, with_tracing: bool, with_warnings: bool, ) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>
Source§fn query<'life0, 'async_trait, Q>(
self: Pin<&'life0 mut Self>,
query: Q,
) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>
fn query<'life0, 'async_trait, Q>( self: Pin<&'life0 mut Self>, query: Q, ) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>
Executes a query with default parameters: Read more
Source§fn query_tw<'life0, 'async_trait, Q>(
self: Pin<&'life0 mut Self>,
query: Q,
with_tracing: bool,
with_warnings: bool,
) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>
fn query_tw<'life0, 'async_trait, Q>( self: Pin<&'life0 mut Self>, query: Q, with_tracing: bool, with_warnings: bool, ) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>
Executes a query with ability to trace it and see warnings, and default parameters: Read more
Source§fn query_with_values<'life0, 'async_trait, Q, V>(
self: Pin<&'life0 mut Self>,
query: Q,
values: V,
) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>where
Q: 'async_trait + ToString + Send,
V: 'async_trait + Into<QueryValues> + Send,
Self: 'async_trait,
'life0: 'async_trait,
fn query_with_values<'life0, 'async_trait, Q, V>(
self: Pin<&'life0 mut Self>,
query: Q,
values: V,
) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>where
Q: 'async_trait + ToString + Send,
V: 'async_trait + Into<QueryValues> + Send,
Self: 'async_trait,
'life0: 'async_trait,
Executes a query with bounded values (either with or without names).
Source§fn query_with_values_tw<'life0, 'async_trait, Q, V>(
self: Pin<&'life0 mut Self>,
query: Q,
values: V,
with_tracing: bool,
with_warnings: bool,
) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>where
Q: 'async_trait + ToString + Send,
V: 'async_trait + Into<QueryValues> + Send,
Self: 'async_trait,
'life0: 'async_trait,
fn query_with_values_tw<'life0, 'async_trait, Q, V>(
self: Pin<&'life0 mut Self>,
query: Q,
values: V,
with_tracing: bool,
with_warnings: bool,
) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>where
Q: 'async_trait + ToString + Send,
V: 'async_trait + Into<QueryValues> + Send,
Self: 'async_trait,
'life0: 'async_trait,
Executes a query with bounded values (either with or without names)
and ability to see warnings, trace a request and default parameters.
Auto Trait Implementations§
impl<T> Freeze for Session<T>where
T: Freeze,
impl<T> RefUnwindSafe for Session<T>where
T: RefUnwindSafe,
impl<T> Send for Session<T>where
T: Send,
impl<T> Sync for Session<T>where
T: Sync,
impl<T> Unpin for Session<T>where
T: Unpin,
impl<T> UnwindSafe for Session<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