pub trait AsyncDecodeRecordRef {
// Required method
async fn decode_record_ref(&mut self) -> Result<Option<RecordRef<'_>>>;
// Provided method
fn decode_stream(&mut self) -> impl Stream<Item = Result<RecordBuf>> + '_ { ... }
}async only.Expand description
Async trait for types that decode references to DBN records of a dynamic type.
Required Methods§
Sourceasync fn decode_record_ref(&mut self) -> Result<Option<RecordRef<'_>>>
async fn decode_record_ref(&mut self) -> Result<Option<RecordRef<'_>>>
Tries to decode a generic reference a record. Returns Ok(None) if input
has been exhausted.
§Errors
This function returns an error if the underlying reader returns an error of a
kind other than io::ErrorKind::UnexpectedEof upon reading.
If the length property of the record is invalid, an
Error::Decode will be returned.
§Cancel safety
This method is cancel safe. It can be used within a tokio::select! statement
without the potential for corrupting the input stream.
Provided Methods§
Sourcefn decode_stream(&mut self) -> impl Stream<Item = Result<RecordBuf>> + '_
fn decode_stream(&mut self) -> impl Stream<Item = Result<RecordBuf>> + '_
Returns a Stream of owned RecordBufs decoded
from this reader.
Each record is copied from the internal decode buffer into a RecordBuf.
For zero-copy access, use decode_record_ref() instead.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".