ConnectionOption

Struct ConnectionOption 

Source
pub struct ConnectionOption { /* private fields */ }
Expand description

Option to connect to Tsurugi server.

See Session::connect().

§Examples

use std::sync::Arc;
use tsubakuro_rust_core::prelude::*;

async fn example() -> Result<Arc<Session>, TgError> {
    let credential = Credential::from_user_password("user", Some("password"));

    let mut connection_option = ConnectionOption::new();
    connection_option.set_endpoint_url("tcp://localhost:12345")?;
    connection_option.set_credential(credential);
    connection_option.set_application_name("Tsubakuro/Rust example");
    connection_option.set_session_label("example session");
    connection_option.set_default_timeout(std::time::Duration::from_secs(10));

    let session = Session::connect(&connection_option).await?;

    Ok(session)
}

Implementations§

Source§

impl ConnectionOption

Source

pub fn new() -> ConnectionOption

Creates a new instance.

Source

pub fn set_endpoint(&mut self, endpoint: Endpoint)

Set endpoint.

Source

pub fn set_endpoint_url(&mut self, endpoint: &str) -> Result<(), TgError>

Set endpoint.

§Parameters
  • endpoint - endpoint url. (e.g. tcp://localhost:12345)
Source

pub fn endpoint(&self) -> Option<&Endpoint>

Get endpoint.

Source

pub fn set_credential(&mut self, credential: Credential)

Set credential.

since 0.5.0

Source

pub fn credential(&self) -> &Credential

Get credential.

since 0.5.0

Source

pub fn set_validity_period(&mut self, duration: Duration)

Set validity period for UserPasswordCredential.

For internal use.

since 0.5.0

Source

pub fn validity_period(&self) -> Duration

Get validity period.

For internal use.

since 0.5.0

Source

pub fn set_application_name(&mut self, name: &str)

Set application name.

Source

pub fn application_name(&self) -> Option<&String>

Get application name.

Source

pub fn set_session_label(&mut self, label: &str)

Set session label.

Source

pub fn session_label(&self) -> Option<&String>

Get session label

Source

pub fn set_keep_alive(&mut self, keep_alive: Duration)

Set keep alive interval.

Do not keep alive when keep_alive is 0.

Source

pub fn keep_alive(&self) -> Duration

Get keep alive interval.

Source

pub fn add_large_object_path_mapping<T: AsRef<Path>>( &mut self, client_path: T, server_path: &str, )

Adds a path mapping entry for both sending and receiving BLOB/CLOB.

since 0.2.0

Source

pub fn add_large_object_path_mapping_on_send<T: AsRef<Path>>( &mut self, client_path: T, server_path: &str, )

Adds a path mapping entry for sending BLOB/CLOB.

since 0.2.0

Source

pub fn add_large_object_path_mapping_on_recv<T: AsRef<Path>>( &mut self, server_path: &str, client_path: T, )

Adds a path mapping entry for receiving BLOB/CLOB.

since 0.2.0

Source

pub fn set_default_timeout(&mut self, timeout: Duration)

Set default timeout.

Source

pub fn default_timeout(&self) -> Duration

Get default timeout.

Source

pub fn set_send_timeout(&mut self, timeout: Duration)

Set communication send timeout.

Source

pub fn send_timeout(&self) -> Duration

Get communication send timeout.

Source

pub fn set_recv_timeout(&mut self, timeout: Duration)

Set communication recv timeout.

Source

pub fn recv_timeout(&self) -> Duration

Get communication recv timeout.

Trait Implementations§

Source§

impl Clone for ConnectionOption

Source§

fn clone(&self) -> ConnectionOption

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConnectionOption

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ConnectionOption

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,