Skip to main content

IterableKind

Enum IterableKind 

Source
pub enum IterableKind {
    Numbers(Vec<f64>),
    Integers(Vec<i64>),
    PositiveIntegers(Vec<u64>),
    Strings(Vec<String>),
    Edges(Vec<GraphEdge>),
    Nodes(Vec<GraphNode>),
    Graphs(Vec<Graph>),
    Tuples(Vec<Tuple>),
    Booleans(Vec<bool>),
    Iterables(Vec<IterableKind>),
    Anys(Vec<Primitive>),
}
Expand description

Represents different types of iterable collections in the system.

Each variant stores a vector of values of a specific primitive type. This allows for type-safe iteration and operations over collections of homogeneous elements.

§Example

use rooc::IterableKind;

let numbers = IterableKind::Numbers(vec![1.0, 2.0, 3.0]);
let strings = IterableKind::Strings(vec!["a".to_string(), "b".to_string()]);

Variants§

§

Numbers(Vec<f64>)

Collection of floating point numbers

§

Integers(Vec<i64>)

Collection of signed integers

§

PositiveIntegers(Vec<u64>)

Collection of unsigned integers

§

Strings(Vec<String>)

Collection of strings

§

Edges(Vec<GraphEdge>)

Collection of graph edges

§

Nodes(Vec<GraphNode>)

Collection of graph nodes

§

Graphs(Vec<Graph>)

Collection of graphs

§

Tuples(Vec<Tuple>)

Collection of tuples

§

Booleans(Vec<bool>)

Collection of boolean values

§

Iterables(Vec<IterableKind>)

Nested collection of iterables

§

Anys(Vec<Primitive>)

Collection of any primitive type

Implementations§

Source§

impl IterableKind

Source

pub fn get_type(&self) -> PrimitiveKind

Gets the primitive type of this iterable collection.

§Returns

A PrimitiveKind::Iterable containing the type of elements in the collection

Source

pub fn into_primitive(self) -> Primitive

Converts this iterable into a primitive value.

Source

pub fn flatten(self) -> IterableKind

tries to flatten an array of primitives into an easier form

Source

pub fn inner_type(&self) -> PrimitiveKind

Gets the type of elements contained in this iterable.

For nested iterables, returns the type of the innermost elements.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn to_primitives(self) -> Vec<Primitive>

Converts this iterable into a vector of primitive values.

Source

pub fn read(&self, indexes: Vec<usize>) -> Result<Primitive, TransformError>

Reads a value from the iterable at the specified indexes.

For nested iterables, the indexes specify the path to the desired element.

§Arguments
  • indexes - Vector of indexes specifying the path to the desired element
§Returns
  • Ok(Primitive) - The value at the specified indexes
  • Err(TransformError) - If the indexes are out of bounds
Source

pub fn depth(&self) -> usize

Returns the nesting depth of this iterable.

For non-nested iterables, returns 1. For nested iterables, returns the maximum nesting depth.

Source

pub fn to_string_depth(&self, depth: usize) -> String

Returns a string representation of the iterable with proper indentation.

§Arguments
  • depth - The current indentation depth
Source

pub fn latexify(&self, include_block: bool) -> String

Returns a LaTeX representation of the iterable.

§Arguments
  • include_block - Whether to wrap the output in a matrix block

Trait Implementations§

Source§

impl ApplyOp for IterableKind

Source§

impl Clone for IterableKind

Source§

fn clone(&self) -> IterableKind

Returns a duplicate 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 Debug for IterableKind

Source§

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

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

impl<'de> Deserialize<'de> for IterableKind

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for IterableKind

Source§

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

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

impl PartialEq for IterableKind

Source§

fn eq(&self, other: &IterableKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for IterableKind

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Spreadable for IterableKind

Source§

fn to_primitive_set(self) -> Result<Vec<Primitive>, TransformError>

Converts self into a vector of primitives. Read more
Source§

impl StructuralPartialEq for IterableKind

Auto Trait Implementations§

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,