pub struct AsyncRecordEncoder<W>where
W: AsyncWriteExt + Unpin,{ /* private fields */ }async only.Expand description
An async encoder of DBN records.
Implementations§
Source§impl<W> RecordEncoder<W>where
W: AsyncWriteExt + Unpin,
impl<W> RecordEncoder<W>where
W: AsyncWriteExt + Unpin,
Sourcepub fn new(writer: W) -> Self
pub fn new(writer: W) -> Self
Creates a new instance of RecordEncoder that will forward its output to
writer.
Sourcepub async fn encode<R: DbnEncodable>(&mut self, record: &R) -> Result<()>
pub async fn encode<R: DbnEncodable>(&mut self, record: &R) -> Result<()>
Encode a single DBN record of type R.
§Errors
This function returns an error if it’s unable to write to the underlying writer.
§Cancel safety
This method is not cancellation safe. If this method is used in a
tokio::select! statement and another branch completes first, then the
record may have been partially written, but future calls will begin writing the
encoded record from the beginning.
Sourcepub async fn encode_ref(&mut self, record_ref: RecordRef<'_>) -> Result<()>
pub async fn encode_ref(&mut self, record_ref: RecordRef<'_>) -> Result<()>
Encodes a single DBN record of type R.
§Errors
This function returns an error if it’s unable to write to the underlying writer.
§Cancel safety
This method is not cancellation safe. If this method is used in a
tokio::select! statement and another branch completes first, then the
record may have been partially written, but future calls will begin writing the
encoded record from the beginning.
Sourcepub fn into_inner(self) -> W
pub fn into_inner(self) -> W
Consumes the encoder returning the original writer.