#[non_exhaustive]pub enum EndBehavior {
Manual,
AfterSilence(Duration),
AfterInactivity(Duration),
}Expand description
When a VoiceStream ends by itself (D-365); it always ends with its call.
discord.js counterpart: EndBehaviorType and the end option of
VoiceReceiver#subscribe.
§Examples
use std::time::Duration;
use djs_voice::{EndBehavior, ReceiveOptions};
// One stream per utterance: it ends a second after the user stops speaking.
let options = ReceiveOptions::new().end(EndBehavior::AfterSilence(Duration::from_secs(1)));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Manual
Only when the stream is dropped or the call ends.
AfterSilence(Duration)
When this long has passed since the user’s last packet of audio other than silence (Discord clients send a few frames of silence when they stop speaking). The time starts at their first packet: a stream of someone who never speaks does not end.
AfterInactivity(Duration)
When this long has passed since the user’s last packet, silence or not; from their first packet too.
Trait Implementations§
Source§impl Clone for EndBehavior
impl Clone for EndBehavior
Source§fn clone(&self) -> EndBehavior
fn clone(&self) -> EndBehavior
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for EndBehavior
Source§impl Debug for EndBehavior
impl Debug for EndBehavior
Source§impl Default for EndBehavior
impl Default for EndBehavior
Source§fn default() -> EndBehavior
fn default() -> EndBehavior
Returns the “default value” for a type. Read more
impl Eq for EndBehavior
Source§impl Hash for EndBehavior
impl Hash for EndBehavior
Source§impl PartialEq for EndBehavior
impl PartialEq for EndBehavior
impl StructuralPartialEq for EndBehavior
Auto Trait Implementations§
impl Freeze for EndBehavior
impl RefUnwindSafe for EndBehavior
impl Send for EndBehavior
impl Sync for EndBehavior
impl Unpin for EndBehavior
impl UnsafeUnpin for EndBehavior
impl UnwindSafe for EndBehavior
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
Mutably borrows from an owned value. Read more
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
Checks if this value is equivalent to the given key. Read more
§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
Checks if this value is equivalent to the given key. Read more
§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
Compare self to
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> ⓘ
Converts
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> ⓘ
Converts
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