Struct vtubestudio::client::ClientEventStream
source · [−]pub struct ClientEventStream { /* private fields */ }
Expand description
A wrapper for a mpsc::Receiver
that yields client events.
Implementations
sourceimpl ClientEventStream
impl ClientEventStream
sourcepub async fn next(&mut self) -> Option<ClientEvent>
pub async fn next(&mut self) -> Option<ClientEvent>
Returns new tokens after successful authentication. If None
is returned, it means the
sender (the underlying Client
) has been dropped.
Example
use vtubestudio::{Client, ClientEvent};
use vtubestudio::data::EventData;
let (mut client, mut events) = Client::builder()
.authentication("Plugin name", "Developer name", None)
.build_tungstenite();
tokio::spawn(async move {
while let Some(event) = events.next().await {
match event {
ClientEvent::NewAuthToken(token) =>
println!("Got new token: {token}"),
_ =>
println!("Received event {:?}", event),
}
}
});
sourcepub fn into_inner(self) -> Receiver<ClientEvent>
pub fn into_inner(self) -> Receiver<ClientEvent>
Consume this receiver and return the underlying mpsc::Receiver
.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for ClientEventStream
impl Send for ClientEventStream
impl Sync for ClientEventStream
impl Unpin for ClientEventStream
impl !UnwindSafe for ClientEventStream
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more