Struct vtubestudio::client::ClientEventStream
source · pub struct ClientEventStream { /* private fields */ }
Expand description
A wrapper for a mpsc::Receiver
that yields client events.
Implementations§
source§impl ClientEventStream
impl ClientEventStream
sourcepub async fn next(&mut self) -> Option<ClientEvent>
pub async fn next(&mut self) -> Option<ClientEvent>
Returns ClientEvent
s.
§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 Freeze for ClientEventStream
impl !RefUnwindSafe for ClientEventStream
impl Send for ClientEventStream
impl Sync for ClientEventStream
impl Unpin for ClientEventStream
impl !UnwindSafe for ClientEventStream
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