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
impl ConnectionOption
Sourcepub fn new() -> ConnectionOption
pub fn new() -> ConnectionOption
Creates a new instance.
Sourcepub fn set_endpoint(&mut self, endpoint: Endpoint)
pub fn set_endpoint(&mut self, endpoint: Endpoint)
Set endpoint.
Sourcepub fn set_endpoint_url(&mut self, endpoint: &str) -> Result<(), TgError>
pub fn set_endpoint_url(&mut self, endpoint: &str) -> Result<(), TgError>
Sourcepub fn set_credential(&mut self, credential: Credential)
pub fn set_credential(&mut self, credential: Credential)
Set credential.
since 0.5.0
Sourcepub fn credential(&self) -> &Credential
pub fn credential(&self) -> &Credential
Get credential.
since 0.5.0
Sourcepub fn set_validity_period(&mut self, duration: Duration)
pub fn set_validity_period(&mut self, duration: Duration)
Set validity period for UserPasswordCredential.
For internal use.
since 0.5.0
Sourcepub fn validity_period(&self) -> Duration
pub fn validity_period(&self) -> Duration
Get validity period.
For internal use.
since 0.5.0
Sourcepub fn set_application_name(&mut self, name: &str)
pub fn set_application_name(&mut self, name: &str)
Set application name.
Sourcepub fn application_name(&self) -> Option<&String>
pub fn application_name(&self) -> Option<&String>
Get application name.
Sourcepub fn set_session_label(&mut self, label: &str)
pub fn set_session_label(&mut self, label: &str)
Set session label.
Sourcepub fn session_label(&self) -> Option<&String>
pub fn session_label(&self) -> Option<&String>
Get session label
Sourcepub fn set_keep_alive(&mut self, keep_alive: Duration)
pub fn set_keep_alive(&mut self, keep_alive: Duration)
Set keep alive interval.
Do not keep alive when keep_alive is 0.
Sourcepub fn keep_alive(&self) -> Duration
pub fn keep_alive(&self) -> Duration
Get keep alive interval.
Sourcepub fn add_large_object_path_mapping<T: AsRef<Path>>(
&mut self,
client_path: T,
server_path: &str,
)
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
Sourcepub fn add_large_object_path_mapping_on_send<T: AsRef<Path>>(
&mut self,
client_path: T,
server_path: &str,
)
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
Sourcepub fn add_large_object_path_mapping_on_recv<T: AsRef<Path>>(
&mut self,
server_path: &str,
client_path: T,
)
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
Sourcepub fn set_default_timeout(&mut self, timeout: Duration)
pub fn set_default_timeout(&mut self, timeout: Duration)
Set default timeout.
Sourcepub fn default_timeout(&self) -> Duration
pub fn default_timeout(&self) -> Duration
Get default timeout.
Sourcepub fn set_send_timeout(&mut self, timeout: Duration)
pub fn set_send_timeout(&mut self, timeout: Duration)
Set communication send timeout.
Sourcepub fn send_timeout(&self) -> Duration
pub fn send_timeout(&self) -> Duration
Get communication send timeout.
Sourcepub fn set_recv_timeout(&mut self, timeout: Duration)
pub fn set_recv_timeout(&mut self, timeout: Duration)
Set communication recv timeout.
Sourcepub fn recv_timeout(&self) -> Duration
pub fn recv_timeout(&self) -> Duration
Get communication recv timeout.
Trait Implementations§
Source§impl Clone for ConnectionOption
impl Clone for ConnectionOption
Source§fn clone(&self) -> ConnectionOption
fn clone(&self) -> ConnectionOption
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more