pub struct WeakControlHandle<RS> { /* private fields */ }
Implementations§
Source§impl<RS> WeakControlHandle<RS>where
RS: RequestStream,
impl<RS> WeakControlHandle<RS>where
RS: RequestStream,
Sourcepub fn use_control_handle<User, R>(&self, user: User) -> Option<R>where
User: FnOnce(RS::ControlHandle) -> R,
pub fn use_control_handle<User, R>(&self, user: User) -> Option<R>where
User: FnOnce(RS::ControlHandle) -> R,
If the server endpoint is not unbound, calls user
function with the
control handle and propagates the return value. Otherwise, returns None
.
Typically you can use it to send an event within the closure:
let control_handle = stream.control_handle();
let result = control_handle.use_control_handle(
|control_handle| control_handle.send_my_event());
Auto Trait Implementations§
impl<RS> Freeze for WeakControlHandle<RS>
impl<RS> !RefUnwindSafe for WeakControlHandle<RS>
impl<RS> Send for WeakControlHandle<RS>where
RS: Send,
impl<RS> Sync for WeakControlHandle<RS>where
RS: Send,
impl<RS> Unpin for WeakControlHandle<RS>
impl<RS> !UnwindSafe for WeakControlHandle<RS>
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