[−][src]Struct mysql_async::OptsBuilder
Provides a way to build Opts
.
// You can create new default builder let mut builder = OptsBuilder::new(); builder.ip_or_hostname(Some("foo")) .db_name(Some("bar")) .ssl_opts(Some(("/foo/cert.pem", None::<(String, String)>))); // Or use existing T: Into<Opts> let mut builder = OptsBuilder::from_opts(existing_opts); builder.ip_or_hostname(Some("foo")) .db_name(Some("bar"));
Methods
impl OptsBuilder
[src]
pub fn new() -> Self
[src]
pub fn from_opts<T: Into<Opts>>(opts: T) -> Self
[src]
pub fn ip_or_hostname<T: Into<String>>(
&mut self,
ip_or_hostname: T
) -> &mut Self
[src]
&mut self,
ip_or_hostname: T
) -> &mut Self
Address of mysql server (defaults to 127.0.0.1
). Hostnames should also work.
pub fn tcp_port(&mut self, tcp_port: u16) -> &mut Self
[src]
TCP port of mysql server (defaults to 3306
).
pub fn user<T: Into<String>>(&mut self, user: Option<T>) -> &mut Self
[src]
User (defaults to None
).
pub fn pass<T: Into<String>>(&mut self, pass: Option<T>) -> &mut Self
[src]
Password (defaults to None
).
pub fn db_name<T: Into<String>>(&mut self, db_name: Option<T>) -> &mut Self
[src]
Database name (defaults to None
).
pub fn init<T: Into<String>>(&mut self, init: Vec<T>) -> &mut Self
[src]
Commands to execute on each new database connection.
pub fn tcp_keepalive<T: Into<u32>>(
&mut self,
tcp_keepalive: Option<T>
) -> &mut Self
[src]
&mut self,
tcp_keepalive: Option<T>
) -> &mut Self
TCP keep alive timeout in milliseconds (defaults to None
).
pub fn tcp_nodelay(&mut self, nodelay: bool) -> &mut Self
[src]
Set the TCP_NODELAY
option for the mysql connection (defaults to true
).
Setting this option to false re-enables Nagle's algorithm, which can cause unusually high latency (~40ms) but may increase maximum throughput. See #132.
pub fn local_infile_handler<T>(&mut self, handler: Option<T>) -> &mut Self where
T: LocalInfileHandler + 'static,
[src]
T: LocalInfileHandler + 'static,
Handler for local infile requests (defaults to None
).
pub fn pool_options<T: Into<Option<PoolOptions>>>(
&mut self,
pool_options: T
) -> &mut Self
[src]
&mut self,
pool_options: T
) -> &mut Self
Connection pool options (defaults to PoolOptions::default()
).
pub fn conn_ttl<T: Into<Option<Duration>>>(&mut self, conn_ttl: T) -> &mut Self
[src]
Pool will close connection if time since last IO exceeds this number of seconds
(defaults to wait_timeout
. None
to reset to default).
pub fn stmt_cache_size<T>(&mut self, cache_size: T) -> &mut Self where
T: Into<Option<usize>>,
[src]
T: Into<Option<usize>>,
Number of prepared statements cached on the client side (per connection). Defaults to 10
.
Call with None
to reset to default.
pub fn ssl_opts<T: Into<Option<SslOpts>>>(&mut self, ssl_opts: T) -> &mut Self
[src]
Driver will require SSL connection if this option isn't None
(default to None
).
pub fn prefer_socket<T: Into<Option<bool>>>(
&mut self,
prefer_socket: T
) -> &mut Self
[src]
&mut self,
prefer_socket: T
) -> &mut Self
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.
Note
Library will query the @@socket
server variable to get socket address,
and this address may be incorrect in some cases (i.e. docker).
pub fn socket<T: Into<String>>(&mut self, socket: Option<T>) -> &mut Self
[src]
Path to unix socket (or named pipe on Windows) (defaults to None
).
pub fn compression<T: Into<Option<Compression>>>(
&mut self,
compression: T
) -> &mut Self
[src]
&mut self,
compression: T
) -> &mut Self
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:
fast
- for compression level 1;best
- for compression level 9;on
,true
- for default compression level;0
, ...,9
.
Note that compression level defined here will affect only outgoing packets.
Trait Implementations
impl Clone for OptsBuilder
[src]
fn clone(&self) -> OptsBuilder
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for OptsBuilder
[src]
impl Default for OptsBuilder
[src]
impl Eq for OptsBuilder
[src]
impl From<OptsBuilder> for Opts
[src]
fn from(builder: OptsBuilder) -> Opts
[src]
impl PartialEq<OptsBuilder> for OptsBuilder
[src]
fn eq(&self, other: &OptsBuilder) -> bool
[src]
fn ne(&self, other: &OptsBuilder) -> bool
[src]
impl StructuralEq for OptsBuilder
[src]
impl StructuralPartialEq for OptsBuilder
[src]
Auto Trait Implementations
impl !RefUnwindSafe for OptsBuilder
impl Send for OptsBuilder
impl Sync for OptsBuilder
impl Unpin for OptsBuilder
impl !UnwindSafe for OptsBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,