Struct mysql_async::OptsBuilder
source · pub struct OptsBuilder { /* private fields */ }
Expand description
Provides a way to build Opts
.
// You can use the default builder
let existing_opts = OptsBuilder::default()
.ip_or_hostname("foo")
.db_name(Some("bar"))
// ..
// Or use existing T: Into<Opts>
let builder = OptsBuilder::from(existing_opts)
.ip_or_hostname("baz")
.tcp_port(33306)
// ..
Implementations§
source§impl OptsBuilder
impl OptsBuilder
sourcepub fn from_opts<T>(opts: T) -> Selfwhere
Opts: TryFrom<T>,
<Opts as TryFrom<T>>::Error: Error,
pub fn from_opts<T>(opts: T) -> Selfwhere Opts: TryFrom<T>, <Opts as TryFrom<T>>::Error: Error,
sourcepub fn ip_or_hostname<T: Into<String>>(self, ip_or_hostname: T) -> Self
pub fn ip_or_hostname<T: Into<String>>(self, ip_or_hostname: T) -> Self
Defines server IP or hostname. See Opts::ip_or_hostname
.
sourcepub fn tcp_port(self, tcp_port: u16) -> Self
pub fn tcp_port(self, tcp_port: u16) -> Self
Defines TCP port. See Opts::tcp_port
.
sourcepub fn db_name<T: Into<String>>(self, db_name: Option<T>) -> Self
pub fn db_name<T: Into<String>>(self, db_name: Option<T>) -> Self
Defines database name. See Opts::db_name
.
sourcepub fn init<T: Into<String>>(self, init: Vec<T>) -> Self
pub fn init<T: Into<String>>(self, init: Vec<T>) -> Self
Defines initial queries. See Opts::init
.
sourcepub fn tcp_keepalive<T: Into<u32>>(self, tcp_keepalive: Option<T>) -> Self
pub fn tcp_keepalive<T: Into<u32>>(self, tcp_keepalive: Option<T>) -> Self
Defines tcp_keepalive
option. See Opts::tcp_keepalive
.
sourcepub fn tcp_nodelay(self, nodelay: bool) -> Self
pub fn tcp_nodelay(self, nodelay: bool) -> Self
Defines tcp_nodelay
option. See Opts::tcp_nodelay
.
sourcepub fn local_infile_handler<T>(self, handler: Option<T>) -> Selfwhere
T: GlobalHandler,
pub fn local_infile_handler<T>(self, handler: Option<T>) -> Selfwhere T: GlobalHandler,
Defines global LOCAL INFILE handler (see crate-level docs).
sourcepub fn pool_opts<T: Into<Option<PoolOpts>>>(self, pool_opts: T) -> Self
pub fn pool_opts<T: Into<Option<PoolOpts>>>(self, pool_opts: T) -> Self
Defines pool options. See Opts::pool_opts
.
sourcepub fn conn_ttl<T: Into<Option<Duration>>>(self, conn_ttl: T) -> Self
pub fn conn_ttl<T: Into<Option<Duration>>>(self, conn_ttl: T) -> Self
Defines connection TTL. See Opts::conn_ttl
.
sourcepub fn stmt_cache_size<T>(self, cache_size: T) -> Selfwhere
T: Into<Option<usize>>,
pub fn stmt_cache_size<T>(self, cache_size: T) -> Selfwhere T: Into<Option<usize>>,
Defines statement cache size. See Opts::stmt_cache_size
.
sourcepub fn ssl_opts<T: Into<Option<SslOpts>>>(self, ssl_opts: T) -> Self
pub fn ssl_opts<T: Into<Option<SslOpts>>>(self, ssl_opts: T) -> Self
Defines SSL options. See Opts::ssl_opts
.
sourcepub fn prefer_socket<T: Into<Option<bool>>>(self, prefer_socket: T) -> Self
pub fn prefer_socket<T: Into<Option<bool>>>(self, prefer_socket: T) -> Self
Defines prefer_socket
option. See Opts::prefer_socket
.
sourcepub fn socket<T: Into<String>>(self, socket: Option<T>) -> Self
pub fn socket<T: Into<String>>(self, socket: Option<T>) -> Self
Defines socket path. See Opts::socket
.
sourcepub fn compression<T: Into<Option<Compression>>>(self, compression: T) -> Self
pub fn compression<T: Into<Option<Compression>>>(self, compression: T) -> Self
Defines compression. See Opts::compression
.
sourcepub fn max_allowed_packet(self, max_allowed_packet: Option<usize>) -> Self
pub fn max_allowed_packet(self, max_allowed_packet: Option<usize>) -> Self
Defines max_allowed_packet
option. See Opts::max_allowed_packet
.
Note that it’ll saturate to proper minimum and maximum values for this parameter (see MySql documentation).
sourcepub fn wait_timeout(self, wait_timeout: Option<usize>) -> Self
pub fn wait_timeout(self, wait_timeout: Option<usize>) -> Self
Defines wait_timeout
option. See Opts::wait_timeout
.
Note that it’ll saturate to proper minimum and maximum values for this parameter (see MySql documentation).
sourcepub fn secure_auth(self, secure_auth: bool) -> Self
pub fn secure_auth(self, secure_auth: bool) -> Self
Disables mysql_old_password
plugin (defaults to true
).
Available via secure_auth
connection url parameter.
Trait Implementations§
source§impl Clone for OptsBuilder
impl Clone for OptsBuilder
source§fn clone(&self) -> OptsBuilder
fn clone(&self) -> OptsBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for OptsBuilder
impl Debug for OptsBuilder
source§impl Default for OptsBuilder
impl Default for OptsBuilder
source§impl From<OptsBuilder> for Opts
impl From<OptsBuilder> for Opts
source§fn from(builder: OptsBuilder) -> Opts
fn from(builder: OptsBuilder) -> Opts
source§impl PartialEq for OptsBuilder
impl PartialEq for OptsBuilder
source§fn eq(&self, other: &OptsBuilder) -> bool
fn eq(&self, other: &OptsBuilder) -> bool
self
and other
values to be equal, and is used
by ==
.impl Eq for OptsBuilder
impl StructuralEq for OptsBuilder
impl StructuralPartialEq for OptsBuilder
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> FmtForward for T
impl<T> FmtForward for T
source§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.source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,
self
to use its Display
implementation when
Debug
-formatted.source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.source§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.source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere Self: Sized,
source§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 moresource§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 moresource§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,
source§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,
source§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.source§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,
self
, then passes self.as_mut()
into the pipe
function.source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> Tap for T
impl<T> Tap for T
source§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 moresource§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 moresource§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 moresource§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 moresource§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 moresource§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 moresource§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.source§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.source§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.source§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.source§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.source§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.