ToTupleBuffer

Trait ToTupleBuffer 

Source
pub trait ToTupleBuffer {
    // Required method
    fn write_tuple_data(&self, w: &mut impl Write) -> Result<()>;

    // Provided methods
    fn to_tuple_buffer(&self) -> Result<TupleBuffer> { ... }
    fn tuple_data(&self) -> Option<&[u8]> { ... }
}
Expand description

Types implementing this trait can be converted to tarantool tuple (msgpack array).

Required Methods§

Source

fn write_tuple_data(&self, w: &mut impl Write) -> Result<()>

Provided Methods§

Source

fn to_tuple_buffer(&self) -> Result<TupleBuffer>

Source

fn tuple_data(&self) -> Option<&[u8]>

Returns a slice of bytes represeting the underlying tarantool tuple.

Returns None if Self doesn’t contain the data, in which case the ToTupleBuffer::to_tuple_buffer should be used.

This method exists as an optimization for wrapper types to eliminate extra copies, in cases where the implementing type already contains the tuple data (e.g. TupleBuffer, RawBytes, etc.).

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§