pub trait AsyncEncodeRecord {
// Required methods
async fn encode_record<R: DbnEncodable>(&mut self, record: &R) -> Result<()>;
async fn flush(&mut self) -> Result<()>;
async fn shutdown(&mut self) -> Result<()>;
// Provided method
async fn encode_records<R: DbnEncodable>(
&mut self,
records: &[R],
) -> Result<()> { ... }
}async only.Expand description
Trait for async encoding of DBN records of a specific type.
Required Methods§
Sourceasync fn encode_record<R: DbnEncodable>(&mut self, record: &R) -> Result<()>
async fn encode_record<R: DbnEncodable>(&mut self, record: &R) -> 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 or there’s a serialization error.
§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.
Provided Methods§
Sourceasync fn encode_records<R: DbnEncodable>(&mut self, records: &[R]) -> Result<()>
async fn encode_records<R: DbnEncodable>(&mut self, records: &[R]) -> Result<()>
Encodes a slice of DBN records.
§Errors
This function returns an error if it’s unable to write to the underlying writer or there’s a serialization error.
§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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.