Trait tarantool::tuple::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
ToTupleBuffer Types implementing this trait can be converted to tarantool tuple (msgpack array).
Required Methods§
fn write_tuple_data(&self, w: &mut impl Write) -> Result<()>
Provided Methods§
fn to_tuple_buffer(&self) -> Result<TupleBuffer>
sourcefn tuple_data(&self) -> Option<&[u8]>
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.).
Object Safety§
This trait is not object safe.