pub struct ConnectOptions { /* private fields */ }
Expand description
The configuration for creating a new connection.
§Example
let config = Connection::build("localhost")
.name("MyUser")
.channel("Default Channel/Nested");
let con = Connection::new(config);
Implementations§
Source§impl ConnectOptions
impl ConnectOptions
Sourcepub fn new<A: Into<ServerAddress>>(address: A) -> Self
👎Deprecated since 0.2.0: Connection::build should be used instead
pub fn new<A: Into<ServerAddress>>(address: A) -> Self
Start creating the configuration of a new connection.
§Arguments
The address of the server has to be supplied. The address can be a
SocketAddr
, a string or directly a ServerAddress
. A string
will automatically be resolved from all formats supported by TeamSpeak.
For details, see resolver::resolve
.
Sourcepub fn connect(self) -> Result<Connection, Error>
pub fn connect(self) -> Result<Connection, Error>
Create the connection object from these options.
This function opens a new connection to a server. The connection needs to be polled for events to do something.
§Examples
This will open a connection to the TeamSpeak server at localhost
.
let mut con = Connection::build("localhost").connect().unwrap();
// Wait until connected
con.events()
// We are connected when we receive the first BookEvents
.try_filter(|e| future::ready(matches!(e, StreamItem::BookEvents(_))))
.next()
.await
.unwrap();
Sourcepub fn local_address(self, local_address: SocketAddr) -> Self
pub fn local_address(self, local_address: SocketAddr) -> Self
The address for the socket of our client
§Default
The default is 0.0.0:0
when connecting to an IPv4 address and [::]:0
when connecting to an IPv6 address.
Sourcepub fn server(self, server: UidBuf) -> Self
pub fn server(self, server: UidBuf) -> Self
Check the identity of the server to be equal with the given uid.
If the public key of the server does not match this uid, the connection will be aborted.
§Default
Allow the server to have any identity.
Sourcepub fn hardware_id<S: Into<Cow<'static, str>>>(self, hwid: S) -> Self
pub fn hardware_id<S: Into<Cow<'static, str>>>(self, hwid: S) -> Self
The hardware ID (HWID) of the client.
§Default
923f136fb1e22ae6ce95e60255529c00,d13231b1bc33edfecfb9169cc7a63bcc
Sourcepub fn channel<S: Into<Cow<'static, str>>>(self, path: S) -> Self
pub fn channel<S: Into<Cow<'static, str>>>(self, path: S) -> Self
Connect to a specific channel.
§Example
let opts = Connection::build("localhost").channel("Default Channel");
Connecting to a channel further down in the hierarchy.
let opts = Connection::build("localhost").channel("Default Channel/Nested");
Sourcepub fn channel_id(self, channel: ChannelId) -> Self
pub fn channel_id(self, channel: ChannelId) -> Self
Connect to a specific channel.
Setting the channel id is equal to connecting to the channel /<id>
.
§Example
let opts = Connection::build("localhost").channel_id(ChannelId(2));
Sourcepub fn channel_password<S: Into<Cow<'static, str>>>(self, pwd: S) -> Self
pub fn channel_password<S: Into<Cow<'static, str>>>(self, pwd: S) -> Self
Use a password for the given channel when connecting.
§Example
let opts = Connection::build("localhost")
.channel("Secret Channel")
.channel_password("My secret password");
Sourcepub fn password<S: Into<Cow<'static, str>>>(self, pwd: S) -> Self
pub fn password<S: Into<Cow<'static, str>>>(self, pwd: S) -> Self
Use a server password when connecting.
§Example
let opts = Connection::build("localhost").password("My secret password");
Sourcepub fn input_muted(self, input_muted: bool) -> Self
pub fn input_muted(self, input_muted: bool) -> Self
Connect to the server in a muted state.
§Example
let opts = Connection::build("localhost").input_muted(true);
Sourcepub fn output_muted(self, output_muted: bool) -> Self
pub fn output_muted(self, output_muted: bool) -> Self
Connect to the server with the output muted.
§Example
let opts = Connection::build("localhost").output_muted(true);
Sourcepub fn input_hardware_enabled(self, input_hardware_enabled: bool) -> Self
pub fn input_hardware_enabled(self, input_hardware_enabled: bool) -> Self
Connect to the server with input hardware disabled state.
§Example
let opts = Connection::build("localhost").input_hardware_enabled(true);
Sourcepub fn output_hardware_enabled(self, output_hardware_enabled: bool) -> Self
pub fn output_hardware_enabled(self, output_hardware_enabled: bool) -> Self
Connect to the server with output hardware disabled stat.
§Example
let opts = Connection::build("localhost").output_hardware_enabled(true);
Sourcepub fn away<S: Into<Cow<'static, str>>>(self, message: S) -> Self
pub fn away<S: Into<Cow<'static, str>>>(self, message: S) -> Self
Connect to the server with an away message.
§Example
let opts = Connection::build("localhost").away("Buying groceries");
Sourcepub fn log_commands(self, log_commands: bool) -> Self
pub fn log_commands(self, log_commands: bool) -> Self
Sourcepub fn log_packets(self, log_packets: bool) -> Self
pub fn log_packets(self, log_packets: bool) -> Self
Sourcepub fn log_udp_packets(self, log_udp_packets: bool) -> Self
pub fn log_udp_packets(self, log_udp_packets: bool) -> Self
If the content of all udp packets in byte-array form should be written to the logger.
§Default
false
pub fn get_address(&self) -> &ServerAddress
pub fn get_local_address(&self) -> Option<&SocketAddr>
pub fn get_identity(&self) -> Option<&Identity>
pub fn get_server(&self) -> Option<&Uid>
pub fn get_name(&self) -> &str
pub fn get_version(&self) -> &Version
pub fn get_hardware_id(&self) -> &str
pub fn get_channel(&self) -> Option<&str>
pub fn get_channel_password(&self) -> Option<&str>
pub fn get_password(&self) -> Option<&str>
pub fn get_input_muted(&self) -> bool
pub fn get_output_muted(&self) -> bool
pub fn get_input_hardware_enabled(&self) -> bool
pub fn get_output_hardware_enabled(&self) -> bool
pub fn get_away(&self) -> Option<&str>
pub fn get_logger(&self) -> Option<&Logger>
pub fn get_log_commands(&self) -> bool
pub fn get_log_packets(&self) -> bool
pub fn get_log_udp_packets(&self) -> bool
Trait Implementations§
Source§impl Clone for ConnectOptions
impl Clone for ConnectOptions
Source§fn clone(&self) -> ConnectOptions
fn clone(&self) -> ConnectOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for ConnectOptions
impl RefUnwindSafe for ConnectOptions
impl Send for ConnectOptions
impl Sync for ConnectOptions
impl Unpin for ConnectOptions
impl UnwindSafe for ConnectOptions
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§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) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
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) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
Source§impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
Source§impl<T> PipeDeref for T
impl<T> PipeDeref for T
Source§impl<T> PipeRef for T
impl<T> PipeRef for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
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)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.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)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.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)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
Source§fn tap_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
tap
in debug builds, and does nothing in release builds.Source§fn tap_mut<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
Source§fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
tap_mut
in debug builds, and does nothing in release builds.Source§impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
Source§fn tap_ref<F, R>(self, func: F) -> Self
fn tap_ref<F, R>(self, func: F) -> Self
Source§fn tap_ref_dbg<F, R>(self, func: F) -> Self
fn tap_ref_dbg<F, R>(self, func: F) -> Self
tap_ref
in debug builds, and does nothing in release builds.Source§fn tap_ref_mut<F, R>(self, func: F) -> Self
fn tap_ref_mut<F, R>(self, func: F) -> Self
Source§impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
Source§fn tap_borrow<F, R>(self, func: F) -> Self
fn tap_borrow<F, R>(self, func: F) -> Self
Source§fn tap_borrow_dbg<F, R>(self, func: F) -> Self
fn tap_borrow_dbg<F, R>(self, func: F) -> Self
tap_borrow
in debug builds, and does nothing in release builds.Source§fn tap_borrow_mut<F, R>(self, func: F) -> Self
fn tap_borrow_mut<F, R>(self, func: F) -> Self
Source§impl<T> TapDeref for T
impl<T> TapDeref for T
Source§fn tap_deref_dbg<F, R>(self, func: F) -> Self
fn tap_deref_dbg<F, R>(self, func: F) -> Self
tap_deref
in debug builds, and does nothing in release builds.Source§fn tap_deref_mut<F, R>(self, func: F) -> Self
fn tap_deref_mut<F, R>(self, func: F) -> Self
self
for modification.