[][src]Struct tarantool_module::tuple::Tuple

pub struct Tuple { /* fields omitted */ }

Tuple

Implementations

impl Tuple[src]

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

Creates new tuple from value.

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

See also: AsTuple

pub fn len(&self) -> u32[src]

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

pub fn bsize(&self) -> usize[src]

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

pub fn format(&self) -> TupleFormat[src]

Return the associated format.

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

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);

pub fn field<T>(&self, fieldno: u32) -> Result<Option<T>, Error> where
    T: DeserializeOwned
[src]

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

pub fn into_struct<T>(self) -> Result<T, Error> where
    T: DeserializeOwned
[src]

Deserializes tuple contents into structure of type T

Trait Implementations

impl Clone for Tuple[src]

impl Drop for Tuple[src]

impl Into<Tuple> for FunctionArgs[src]

Auto Trait Implementations

impl RefUnwindSafe for Tuple

impl !Send for Tuple

impl !Sync for Tuple

impl Unpin for Tuple

impl UnwindSafe for Tuple

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.