Struct Session

Source
pub struct Session<T> { /* private fields */ }
Expand description

Session structure which allows clients making requests to a server.

Implementations§

Source§

impl Session<TransportTcp>

Source

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>

Source

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>

Source§

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,

Source§

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>

Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

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>

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>>
where Q: 'async_trait + ToString + Send, Self: 'async_trait, 'life0: '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§

fn prepare<'life0, 'async_trait, Q>( self: Pin<&'life0 mut Self>, query: Q, ) -> Pin<Box<dyn Future<Output = Result<PreparedQuery>> + Send + 'async_trait>>
where Q: 'async_trait + ToString + Send, Self: Send + 'async_trait, 'life0: 'async_trait,

It prepares query without additional tracing information and warnings.
Source§

impl<T: CDRSTransport> QueryExecutor for Session<T>

Source§

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>>
where Q: 'async_trait + ToString + Send, Self: 'async_trait, 'life0: '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>>
where Q: 'async_trait + ToString + Send, Self: 'async_trait, 'life0: '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>>
where Q: 'async_trait + ToString + Send, Self: 'async_trait, 'life0: '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,

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,

Executes a query with bounded values (either with or without names) and ability to see warnings, trace a request and default parameters.
Source§

fn query_with_params<'life0, 'async_trait, Q>( self: Pin<&'life0 mut Self>, query: Q, query_params: QueryParams, ) -> Pin<Box<dyn Future<Output = Result<Frame>> + Send + 'async_trait>>
where Q: 'async_trait + ToString + Send, Self: 'async_trait, 'life0: 'async_trait,

Executes a query with query params without warnings and tracing.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.