Struct Tuple

Source
pub struct Tuple { /* private fields */ }
Expand description

Tuple

Implementations§

Source§

impl Tuple

Source

pub fn from_struct<T>(value: &T) -> Result<Self, Error>
where T: AsTuple,

Creates new tuple from value.

This function will serialize structure instance value of type T into tuple internal representation

See also: AsTuple

Source

pub fn len(&self) -> u32

Return the number of fields in tuple (the size of MsgPack Array).

Source

pub fn bsize(&self) -> usize

Will return the number of bytes in the tuple.

With both the memtx storage engine and the vinyl storage engine the default maximum is one megabyte (memtx_max_tuple_size or vinyl_max_tuple_size). Every field has one or more “length” bytes preceding the actual contents, so bsize() returns a value which is slightly greater than the sum of the lengths of the contents.

The value does not include the size of “struct tuple” (for the current size of this structure look in the tuple.h file in Tarantool’s source code).

Source

pub fn format(&self) -> TupleFormat

Return the associated format.

Source

pub fn iter(&self) -> Result<TupleIterator, Error>

Allocate and initialize a new Tuple iterator. The Tuple iterator allow to iterate over fields at root level of MsgPack array.

Example:

let mut it = tuple.iter().unwrap();

while let Some(field) = it.next().unwrap() {
    // process data
}

// rewind iterator to first position
it.rewind();
assert!(it.position() == 0);

// rewind iterator to first position
field = it.seek(3).unwrap();
assert!(it.position() == 4);
Source

pub fn field<T>(&self, fieldno: u32) -> Result<Option<T>, Error>

Return the raw Tuple field in MsgPack format.

The buffer is valid until next call to box_tuple_* functions.

  • fieldno - zero-based index in MsgPack array.

Returns:

  • None if i >= box_tuple_field_count(Tuple) or if field has a non primitive type
  • field value otherwise
Source

pub fn into_struct<T>(self) -> Result<T, Error>

Deserializes tuple contents into structure of type T

Trait Implementations§

Source§

impl Clone for Tuple

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Drop for Tuple

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Into<Tuple> for FunctionArgs

Source§

fn into(self) -> Tuple

Converts this type into the (usually inferred) input type.

Auto Trait Implementations§

§

impl Freeze for Tuple

§

impl RefUnwindSafe for Tuple

§

impl !Send for Tuple

§

impl !Sync for Tuple

§

impl Unpin for Tuple

§

impl UnwindSafe for Tuple

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.