pub struct Opts(_);
Expand description
Mysql connection options.
Build one with OptsBuilder
.
Implementations§
source§impl Opts
impl Opts
pub fn from_url(url: &str) -> Result<Opts, UrlError>
sourcepub fn get_ip_or_hostname(&self) -> Cow<'_, str>
pub fn get_ip_or_hostname(&self) -> Cow<'_, str>
Address of mysql server (defaults to 127.0.0.1
). Hostnames should also work.
sourcepub fn get_tcp_port(&self) -> u16
pub fn get_tcp_port(&self) -> u16
TCP port of mysql server (defaults to 3306
).
sourcepub fn get_socket(&self) -> Option<&str>
pub fn get_socket(&self) -> Option<&str>
Socket path on unix or pipe name on windows (defaults to None
).
sourcepub fn get_db_name(&self) -> Option<&str>
pub fn get_db_name(&self) -> Option<&str>
Database name (defaults to None
).
sourcepub fn get_read_timeout(&self) -> Option<&Duration>
pub fn get_read_timeout(&self) -> Option<&Duration>
The timeout for each attempt to write to the server.
sourcepub fn get_write_timeout(&self) -> Option<&Duration>
pub fn get_write_timeout(&self) -> Option<&Duration>
The timeout for each attempt to write to the server.
sourcepub fn get_prefer_socket(&self) -> bool
pub fn get_prefer_socket(&self) -> bool
Prefer socket connection (defaults to true
).
Will reconnect via socket (or named pipe on windows) after TCP connection
to 127.0.0.1
if true
.
Will fall back to TCP on error. Use socket
option to enforce socket connection.
sourcepub fn get_ssl_opts(&self) -> Option<&SslOpts>
pub fn get_ssl_opts(&self) -> Option<&SslOpts>
Driver will require SSL connection if this option isn’t None
(default to None
).
sourcepub fn get_tcp_nodelay(&self) -> bool
pub fn get_tcp_nodelay(&self) -> bool
Whether TCP_NODELAY
will be set for mysql connection.
sourcepub fn get_tcp_keepalive_time_ms(&self) -> Option<u32>
pub fn get_tcp_keepalive_time_ms(&self) -> Option<u32>
TCP keep alive time for mysql connection.
sourcepub fn get_tcp_keepalive_probe_interval_secs(&self) -> Option<u32>
pub fn get_tcp_keepalive_probe_interval_secs(&self) -> Option<u32>
TCP keep alive interval between subsequent probes for mysql connection.
sourcepub fn get_tcp_keepalive_probe_count(&self) -> Option<u32>
pub fn get_tcp_keepalive_probe_count(&self) -> Option<u32>
TCP keep alive probe count for mysql connection.
sourcepub fn get_tcp_user_timeout_ms(&self) -> Option<u32>
pub fn get_tcp_user_timeout_ms(&self) -> Option<u32>
TCP_USER_TIMEOUT time for mysql connection.
sourcepub fn get_local_infile_handler(&self) -> Option<&LocalInfileHandler>
pub fn get_local_infile_handler(&self) -> Option<&LocalInfileHandler>
Callback to handle requests for local files.
sourcepub fn get_tcp_connect_timeout(&self) -> Option<Duration>
pub fn get_tcp_connect_timeout(&self) -> Option<Duration>
Tcp connect timeout (defaults to None
).
sourcepub fn bind_address(&self) -> Option<&SocketAddr>
pub fn bind_address(&self) -> Option<&SocketAddr>
Bind address for a client (defaults to None
).
Use carefully. Will probably make pool unusable because of address already in use errors.
sourcepub fn get_stmt_cache_size(&self) -> usize
pub fn get_stmt_cache_size(&self) -> usize
Number of prepared statements cached on the client side (per connection).
Defaults to DEFAULT_STMT_CACHE_SIZE
.
Can be defined using stmt_cache_size
connection url parameter.
sourcepub fn get_compress(&self) -> Option<Compression>
pub fn get_compress(&self) -> Option<Compression>
If not None
, then client will ask for compression if server supports it
(defaults to None
).
Can be defined using compress
connection url parameter with values:
true
- library defined default compression level;fast
- library defined fast compression level;best
- library defined best compression level;0
,1
, …,9
- explicitly defined compression level where0
stands for “no compression”;
Note that compression level defined here will affect only outgoing packets.
sourcepub fn get_additional_capabilities(&self) -> CapabilityFlags
pub fn get_additional_capabilities(&self) -> CapabilityFlags
Additional client capabilities to set (defaults to empty).
This value will be OR’ed with other client capabilities during connection initialisation.
Note
It is a good way to set something like CLIENT_FOUND_ROWS
but you should note that it
won’t let you to interfere with capabilities managed by other options (like
CLIENT_SSL
or CLIENT_COMPRESS
). Also note that some capabilities are reserved,
pointless or may broke the connection, so this option should be used with caution.
sourcepub fn get_connect_attrs(&self) -> &HashMap<String, String>
pub fn get_connect_attrs(&self) -> &HashMap<String, String>
Connect attributes
This value is sent to the server as custom name-value attributes.
You can see them from performance_schema tables: session_account_connect_attrs
and session_connect_attrs
when all of the following conditions
are met.
- The server is MySQL 5.6 or later, or MariaDB 10.0 or later.
performance_schema
is on.performance_schema_session_connect_attrs_size
is -1 or big enough to store specified attributes.
Note
Attribute names that begin with an underscore (_
) are not set by
application programs because they are reserved for internal use.
The following attributes are sent in addition to ones set by programs.
name | value |
---|---|
_client_name | The client library name (rust-mysql-simple ) |
_client_version | The client library version |
_os | The operation system (target_os cfg feature) |
_pid | The client process ID |
_platform | The machine platform (target_arch cfg feature) |
program_name | The first element of std::env::args if program_name isn’t set by programs. |
sourcepub fn get_secure_auth(&self) -> bool
pub fn get_secure_auth(&self) -> bool
Disables mysql_old_password
plugin (defaults to true
).
Available via secure_auth
connection url parameter.
Trait Implementations§
source§impl From<OptsBuilder> for Opts
impl From<OptsBuilder> for Opts
source§fn from(builder: OptsBuilder) -> Opts
fn from(builder: OptsBuilder) -> Opts
impl Eq for Opts
impl StructuralEq for Opts
impl StructuralPartialEq for Opts
Auto Trait Implementations§
impl RefUnwindSafe for Opts
impl Send for Opts
impl Sync for Opts
impl Unpin for Opts
impl UnwindSafe for Opts
Blanket Implementations§
§impl<T> Conv for T
impl<T> Conv for T
§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T, U, I> LiftInto<U, I> for Twhere
U: LiftFrom<T, I>,
impl<T, U, I> LiftInto<U, I> for Twhere
U: LiftFrom<T, I>,
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<Source> Sculptor<HNil, HNil> for Source
impl<Source> Sculptor<HNil, HNil> for Source
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds. Read more§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds. Read more§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read more§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds. Read more§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds. Read more