Struct mysql::Opts[][src]

pub struct Opts(_);
Expand description

Mysql connection options.

Build one with OptsBuilder.

Implementations

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

TCP port of mysql server (defaults to 3306).

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

User (defaults to None).

Password (defaults to None).

Database name (defaults to None).

The timeout for each attempt to write to the server.

The timeout for each attempt to write to the server.

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.

Commands to execute on each new database connection.

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

Whether TCP_NODELAY will be set for mysql connection.

TCP keep alive time for mysql connection.

Callback to handle requests for local files.

Tcp connect timeout (defaults to None).

Bind address for a client (defaults to None).

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

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.

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.

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.

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.

Disables mysql_old_password plugin (defaults to true).

Available via secure_auth connection url parameter.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Converts self into T using Into<T>. Read more

Extract a subset of the possible types in a coproduct (or get the remaining possibilities) Read more

Causes self to use its Binary implementation when Debug-formatted.

Causes self to use its Display implementation when Debug-formatted. Read more

Causes self to use its LowerExp implementation when Debug-formatted. Read more

Causes self to use its LowerHex implementation when Debug-formatted. Read more

Causes self to use its Octal implementation when Debug-formatted.

Causes self to use its Pointer implementation when Debug-formatted. Read more

Causes self to use its UpperExp implementation when Debug-formatted. Read more

Causes self to use its UpperHex implementation when Debug-formatted. Read more

Performs the conversion.

Performs the conversion.

Performs the indexed conversion.

Pipes by value. This is generally the method you want to use. Read more

Borrows self and passes that borrow into the pipe function. Read more

Mutably borrows self and passes that borrow into the pipe function. Read more

Borrows self, then passes self.borrow() into the pipe function. Read more

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more

Borrows self, then passes self.as_ref() into the pipe function.

Mutably borrows self, then passes self.as_mut() into the pipe function. Read more

Borrows self, then passes self.deref() into the pipe function.

Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more

Should always be Self

Consumes the current HList and returns an HList with the requested shape. Read more

Immutable access to a value. Read more

Mutable access to a value. Read more

Immutable access to the Borrow<B> of a value. Read more

Mutable access to the BorrowMut<B> of a value. Read more

Immutable access to the AsRef<R> view of a value. Read more

Mutable access to the AsMut<R> view of a value. Read more

Immutable access to the Deref::Target of a value. Read more

Mutable access to the Deref::Target of a value. Read more

Calls .tap() only in debug builds, and is erased in release builds.

Calls .tap_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Attempts to convert self into T using TryInto<T>. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.