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

Tuple

Implementations

Creates new tuple from value.

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

See also: AsTuple

Safety

data must point to a buffer containing len bytes representing a valid messagepack array

Safety

data must represent a valid messagepack array

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

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

Return the associated format.

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::<T>().unwrap() {
    // process data
}

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

// rewind iterator to first position
let field = it.seek::<T>(3).unwrap();
assert!(it.position() == 4);
}

Deserialize a tuple field specified by zero-based array index.

  • fieldno - zero-based index in MsgPack array.

Returns:

  • Ok(None) if fieldno >= self.len()
  • Err(e) if deserialization failed
  • Ok(Some(field value)) otherwise

See also Tuple::try_get, Tuple::get.

Deserialize a tuple field specified by an index implementing TupleIndex trait.

Currently 2 types of indexes are supported:

  • u32 - zero-based index in MsgPack array (See also Tuple::field)
  • &str - JSON path for tuples with non default formats

Returns:

  • Ok(None) if index wasn’t found
  • Err(e) if deserialization failed
  • Ok(Some(field value)) otherwise

See also Tuple::get.

Deserialize a tuple field specified by an index implementing TupleIndex trait.

Currently 2 types of indexes are supported:

  • u32 - zero-based index in MsgPack array (See also Tuple::field)
  • &str - JSON path for tuples with non default formats

Returns:

  • None if index wasn’t found
  • panics if deserialization failed
  • Some(field value) otherwise

See also Tuple::get.

Deserializes tuple contents into structure of type T

Deserializes tuple contents into structure of type T

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Reads the data from Lua at a given position.

Reads the data from Lua.

Error that can happen when pushing a value.

Pushes the value on the top of the stack. Read more

Same as push_to_lua but can only succeed and is only available if Err implements Into<Void>. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.