pub struct Request { /* private fields */ }Expand description
One request on its way to the app thread. Answer it with Request::reply (or a shortcut);
a request dropped unanswered replies with an error by itself, so the connection never hangs.
It may be kept and answered on a later frame (the element is not on screen yet, a screenshot
needs the next paint).
Implementations§
Source§impl Request
impl Request
Sourcepub fn new(method: impl Into<String>, params: Value) -> (Self, Receiver<Reply>)
pub fn new(method: impl Into<String>, params: Value) -> (Self, Receiver<Reply>)
A request and the receiver its reply arrives on. params that are null become {}.
pub fn method(&self) -> &str
pub fn params(&self) -> &Value
Sourcepub fn reply(self, r: Reply)
pub fn reply(self, r: Reply)
Answer. The receiver may be gone (the connection closed or timed out): that is fine.
pub fn ok(self, v: Value)
pub fn fail(self, e: impl Display)
Trait Implementations§
Auto Trait Implementations§
impl Forget for Request
impl Freeze for Request
impl Move for Request
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnsafeUnpin for Request
impl UnwindSafe for Request
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