pub struct JsonReader { /* private fields */ }Expand description
Owned, ergonomic handle over an erased JsonBufferReader.
Returned by subscribe_json. Awaiting recv_json or
recv_json_bytes wraps the corresponding poll method via
core::future::poll_fn — no extra per-message future box.
Implementations§
Source§impl JsonReader
impl JsonReader
Sourcepub fn new(inner: Box<dyn JsonBufferReader + Send>) -> Self
pub fn new(inner: Box<dyn JsonBufferReader + Send>) -> Self
Wrap an erased JSON reader in an ergonomic handle.
Sourcepub async fn recv_json(&mut self) -> Result<Value, DbError>
pub async fn recv_json(&mut self) -> Result<Value, DbError>
Receive the next value as JSON, awaiting until one is available.
Sourcepub async fn recv_json_bytes(&mut self) -> Result<Vec<u8>, DbError>
pub async fn recv_json_bytes(&mut self) -> Result<Vec<u8>, DbError>
Receive the next value as owned JSON bytes.
Sourcepub fn try_recv_json(&mut self) -> Result<Value, DbError>
pub fn try_recv_json(&mut self) -> Result<Value, DbError>
Non-blocking receive as JSON — returns immediately.
Returns Err(DbError::BufferEmpty) if no pending values.
Auto Trait Implementations§
impl !RefUnwindSafe for JsonReader
impl !Sync for JsonReader
impl !UnwindSafe for JsonReader
impl Freeze for JsonReader
impl Send for JsonReader
impl Unpin for JsonReader
impl UnsafeUnpin for JsonReader
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