#[non_exhaustive]pub struct ReceiveOptions { /* private fields */ }Expand description
How Call::subscribe_with receives a user’s audio (D-372):
the packets as Opus or decoded to PCM (D-364), and when the stream ends (D-365). The
default is Opus, ended manually, as discord.js’s VoiceReceiver#subscribe.
§Examples
use std::time::Duration;
use djs_voice::{EndBehavior, ReceiveOptions};
// Decoded audio, until a user has said nothing for half a second.
let options = ReceiveOptions::new()
.decode(true)
.end(EndBehavior::AfterSilence(Duration::from_millis(500)));
assert_ne!(options, ReceiveOptions::default());Implementations§
Source§impl ReceiveOptions
impl ReceiveOptions
Sourcepub const fn new() -> ReceiveOptions
pub const fn new() -> ReceiveOptions
The default options: Opus packets, EndBehavior::Manual.
discord.js counterpart: AudioReceiveStreamOptions (@discordjs/voice).
Sourcepub const fn decode(self, decode: bool) -> ReceiveOptions
pub const fn decode(self, decode: bool) -> ReceiveOptions
Whether the packets are decoded (D-364, D-370): VoiceData::Pcm at 48 kHz, stereo,
interleaved i16 samples, lost packets concealed by Opus (rebuilt from the next
packet’s forward error correction when it has some). Otherwise VoiceData::Opus,
as they came, and VoiceData::Lost for the lost ones.
discord.js counterpart: none (@discordjs/voice hands Opus packets only).
Sourcepub const fn end(self, end: EndBehavior) -> ReceiveOptions
pub const fn end(self, end: EndBehavior) -> ReceiveOptions
When the stream ends by itself (D-365).
discord.js counterpart: the end of AudioReceiveStreamOptions (@discordjs/voice).
Trait Implementations§
Source§impl Clone for ReceiveOptions
impl Clone for ReceiveOptions
Source§fn clone(&self) -> ReceiveOptions
fn clone(&self) -> ReceiveOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ReceiveOptions
Source§impl Debug for ReceiveOptions
impl Debug for ReceiveOptions
Source§impl Default for ReceiveOptions
impl Default for ReceiveOptions
Source§fn default() -> ReceiveOptions
fn default() -> ReceiveOptions
impl Eq for ReceiveOptions
Source§impl Hash for ReceiveOptions
impl Hash for ReceiveOptions
Source§impl PartialEq for ReceiveOptions
impl PartialEq for ReceiveOptions
impl StructuralPartialEq for ReceiveOptions
Auto Trait Implementations§
impl Freeze for ReceiveOptions
impl RefUnwindSafe for ReceiveOptions
impl Send for ReceiveOptions
impl Sync for ReceiveOptions
impl Unpin for ReceiveOptions
impl UnsafeUnpin for ReceiveOptions
impl UnwindSafe for ReceiveOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 more