[][src]Struct mysql::Opts

pub struct Opts(_);

Mysql connection options.

Build one with OptsBuilder.

Implementations

impl Opts[src]

pub fn from_url(url: &str) -> Result<Opts, UrlError>[src]

pub fn get_ip_or_hostname(&self) -> Cow<'_, str>[src]

Address of mysql server (defaults to 127.0.0.1). Hostnames should also work.

pub fn get_tcp_port(&self) -> u16[src]

TCP port of mysql server (defaults to 3306).

pub fn get_socket(&self) -> Option<&str>[src]

Socket path on unix or pipe name on windows (defaults to None).

pub fn get_user(&self) -> Option<&str>[src]

User (defaults to None).

pub fn get_pass(&self) -> Option<&str>[src]

Password (defaults to None).

pub fn get_db_name(&self) -> Option<&str>[src]

Database name (defaults to None).

pub fn get_read_timeout(&self) -> Option<&Duration>[src]

The timeout for each attempt to write to the server.

pub fn get_write_timeout(&self) -> Option<&Duration>[src]

The timeout for each attempt to write to the server.

pub fn get_prefer_socket(&self) -> bool[src]

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.

pub fn get_init(&self) -> Vec<String>[src]

Commands to execute on each new database connection.

pub fn get_ssl_opts(&self) -> Option<&SslOpts>[src]

Driver will require SSL connection if this option isn't None (default to None).

pub fn get_tcp_nodelay(&self) -> bool[src]

Whether TCP_NODELAY will be set for mysql connection.

pub fn get_tcp_keepalive_time_ms(&self) -> Option<u32>[src]

TCP keep alive time for mysql connection.

pub fn get_local_infile_handler(&self) -> Option<&LocalInfileHandler>[src]

Callback to handle requests for local files.

pub fn get_tcp_connect_timeout(&self) -> Option<Duration>[src]

Tcp connect timeout (defaults to None).

pub fn bind_address(&self) -> Option<&SocketAddr>[src]

Bind address for a client (defaults to None).

Use carefully. Will probably make pool unusable because of address already in use errors.

pub fn get_stmt_cache_size(&self) -> usize[src]

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.

pub fn get_compress(&self) -> Option<Compression>[src]

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 where 0 stands for "no compression";

Note that compression level defined here will affect only outgoing packets.

pub fn get_additional_capabilities(&self) -> CapabilityFlags[src]

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.

pub fn get_connect_attrs(&self) -> &HashMap<String, String>[src]

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.

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.

namevalue
_client_nameThe client library name (rust-mysql-simple)
_client_versionThe client library version
_osThe operation system (target_os cfg feature)
_pidThe client proces ID
_platformThe machine platform (target_arch cfg feature)
program_nameThe first element of std::env::args if program_name isn't set by programs.

Trait Implementations

impl Clone for Opts[src]

impl Debug for Opts[src]

impl Default for Opts[src]

impl Eq for Opts[src]

impl From<OptsBuilder> for Opts[src]

impl<S: AsRef<str>> From<S> for Opts[src]

impl PartialEq<Opts> for Opts[src]

impl StructuralEq for Opts[src]

impl StructuralPartialEq for Opts[src]

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

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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