Skip to main content

AsyncEncodeRecordRef

Trait AsyncEncodeRecordRef 

Source
pub trait AsyncEncodeRecordRef {
    // Required methods
    async fn encode_record_ref(
        &mut self,
        record_ref: RecordRef<'_>,
    ) -> Result<()>;
    async unsafe fn encode_record_ref_ts_out(
        &mut self,
        record_ref: RecordRef<'_>,
        ts_out: bool,
    ) -> Result<()>;

    // Provided method
    async fn encode_record_refs(
        &mut self,
        record_refs: &[RecordRef<'_>],
    ) -> Result<()> { ... }
}
Available on crate feature async only.
Expand description

Trait for async encoding of DBN of RecordRef records.

Required Methods§

Source

async fn encode_record_ref(&mut self, record_ref: RecordRef<'_>) -> Result<()>

Encodes a single RecordRef.

§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.

Source

async unsafe fn encode_record_ref_ts_out( &mut self, record_ref: RecordRef<'_>, ts_out: bool, ) -> Result<()>

Encodes a single DBN RecordRef with an optional ts_out (see record::WithTsOut).

§Safety

ts_out must be false if record does not have an appended ts_out.

§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§

Source

async fn encode_record_refs( &mut self, record_refs: &[RecordRef<'_>], ) -> Result<()>

Encodes a slice of RecordRefs.

§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.

Implementors§

Source§

impl<S, E> AsyncEncodeRecordRef for SplitEncoder<S, E>

Source§

impl<W> AsyncEncodeRecordRef for dbn::encode::dbn::AsyncEncoder<W>
where W: AsyncWriteExt + Unpin,

Source§

impl<W> AsyncEncodeRecordRef for RecordEncoder<W>
where W: AsyncWriteExt + Unpin,

Source§

impl<W> AsyncEncodeRecordRef for dbn::encode::json::AsyncEncoder<W>
where W: AsyncWriteExt + Unpin,