Tuplable

Trait Tuplable 

Source
pub trait Tuplable: Valuable {
    // Required method
    fn definition(&self) -> TupleDef;
}
Expand description

A tuple-like Valuable sub-type.

Implemented by Valuable types that have a tuple-like shape. Fields are always unnamed. Values that implement Tuplable must return Value::Tuplable from their Valuable::as_value implementation.

It is uncommon for users to implement this type as the crate provides implementations of Tuplable for Rust tuples.

§Inspecting

Inspecting fields contained by a Tuplable instance is done by visiting the tuple. When visiting a Tuple, the visit_unnamed_fields() method is called. When the tuple is statically defined, visit_unnamed_fields() is called once with the values of all the fields. A dynamic tuple implementation may call visit_unnamed_fields() multiple times.

Required Methods§

Source

fn definition(&self) -> TupleDef

Returns the tuple’s definition.

See TupleDef documentation for more details.

§Examples
use valuable::{Tuplable, TupleDef};

let tuple = (123, "hello");

if let TupleDef::Static { fields, .. } = tuple.definition() {
    assert_eq!(2, fields);
}

Trait Implementations§

Source§

impl Debug for dyn Tuplable + '_

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a> From<&'a dyn Tuplable> for Value<'a>

A tuple value

§Examples

use valuable::{Value, Valuable};

let my_tuple = (123, 456);
let v = Value::Tuplable(&my_tuple);
Source§

fn from(src: &'a dyn Tuplable) -> Value<'a>

Converts to this type from the input type.

Implementations on Foreign Types§

Source§

impl Tuplable for ()

Source§

impl<T0> Tuplable for (T0,)
where T0: Valuable,

Source§

impl<T0, T1> Tuplable for (T0, T1)
where T0: Valuable, T1: Valuable,

Source§

impl<T0, T1, T2> Tuplable for (T0, T1, T2)
where T0: Valuable, T1: Valuable, T2: Valuable,

Source§

impl<T0, T1, T2, T3> Tuplable for (T0, T1, T2, T3)
where T0: Valuable, T1: Valuable, T2: Valuable, T3: Valuable,

Source§

impl<T0, T1, T2, T3, T4> Tuplable for (T0, T1, T2, T3, T4)
where T0: Valuable, T1: Valuable, T2: Valuable, T3: Valuable, T4: Valuable,

Source§

impl<T0, T1, T2, T3, T4, T5> Tuplable for (T0, T1, T2, T3, T4, T5)
where T0: Valuable, T1: Valuable, T2: Valuable, T3: Valuable, T4: Valuable, T5: Valuable,

Source§

impl<T0, T1, T2, T3, T4, T5, T6> Tuplable for (T0, T1, T2, T3, T4, T5, T6)
where T0: Valuable, T1: Valuable, T2: Valuable, T3: Valuable, T4: Valuable, T5: Valuable, T6: Valuable,

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7> Tuplable for (T0, T1, T2, T3, T4, T5, T6, T7)
where T0: Valuable, T1: Valuable, T2: Valuable, T3: Valuable, T4: Valuable, T5: Valuable, T6: Valuable, T7: Valuable,

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> Tuplable for (T0, T1, T2, T3, T4, T5, T6, T7, T8)
where T0: Valuable, T1: Valuable, T2: Valuable, T3: Valuable, T4: Valuable, T5: Valuable, T6: Valuable, T7: Valuable, T8: Valuable,

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> Tuplable for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
where T0: Valuable, T1: Valuable, T2: Valuable, T3: Valuable, T4: Valuable, T5: Valuable, T6: Valuable, T7: Valuable, T8: Valuable, T9: Valuable,

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Tuplable for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
where T0: Valuable, T1: Valuable, T2: Valuable, T3: Valuable, T4: Valuable, T5: Valuable, T6: Valuable, T7: Valuable, T8: Valuable, T9: Valuable, T10: Valuable,

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Tuplable for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
where T0: Valuable, T1: Valuable, T2: Valuable, T3: Valuable, T4: Valuable, T5: Valuable, T6: Valuable, T7: Valuable, T8: Valuable, T9: Valuable, T10: Valuable, T11: Valuable,

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Tuplable for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)
where T0: Valuable, T1: Valuable, T2: Valuable, T3: Valuable, T4: Valuable, T5: Valuable, T6: Valuable, T7: Valuable, T8: Valuable, T9: Valuable, T10: Valuable, T11: Valuable, T12: Valuable,

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> Tuplable for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)
where T0: Valuable, T1: Valuable, T2: Valuable, T3: Valuable, T4: Valuable, T5: Valuable, T6: Valuable, T7: Valuable, T8: Valuable, T9: Valuable, T10: Valuable, T11: Valuable, T12: Valuable, T13: Valuable,

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> Tuplable for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)
where T0: Valuable, T1: Valuable, T2: Valuable, T3: Valuable, T4: Valuable, T5: Valuable, T6: Valuable, T7: Valuable, T8: Valuable, T9: Valuable, T10: Valuable, T11: Valuable, T12: Valuable, T13: Valuable, T14: Valuable,

Source§

impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Tuplable for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)
where T0: Valuable, T1: Valuable, T2: Valuable, T3: Valuable, T4: Valuable, T5: Valuable, T6: Valuable, T7: Valuable, T8: Valuable, T9: Valuable, T10: Valuable, T11: Valuable, T12: Valuable, T13: Valuable, T14: Valuable, T15: Valuable,

Source§

impl<T> Tuplable for &T
where T: Tuplable + ?Sized,

Source§

impl<T> Tuplable for &mut T
where T: Tuplable + ?Sized,

Source§

impl<T> Tuplable for Box<T>
where T: Tuplable + ?Sized,

Available on crate feature alloc only.
Source§

impl<T> Tuplable for Rc<T>
where T: Tuplable + ?Sized,

Available on crate feature alloc only.
Source§

impl<T> Tuplable for Arc<T>
where T: Tuplable + ?Sized,

Available on non-valuable_no_atomic_cas and crate feature alloc only.

Implementors§