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
impl IterableKind
Sourcepub fn get_type(&self) -> PrimitiveKind
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
Sourcepub fn into_primitive(self) -> Primitive
pub fn into_primitive(self) -> Primitive
Converts this iterable into a primitive value.
Sourcepub fn flatten(self) -> IterableKind
pub fn flatten(self) -> IterableKind
tries to flatten an array of primitives into an easier form
Sourcepub fn inner_type(&self) -> PrimitiveKind
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.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn to_primitives(self) -> Vec<Primitive>
pub fn to_primitives(self) -> Vec<Primitive>
Converts this iterable into a vector of primitive values.
Sourcepub fn read(&self, indexes: Vec<usize>) -> Result<Primitive, TransformError>
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 indexesErr(TransformError)- If the indexes are out of bounds
Sourcepub fn depth(&self) -> usize
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.
Sourcepub fn to_string_depth(&self, depth: usize) -> String
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
Trait Implementations§
Source§impl ApplyOp for IterableKind
impl ApplyOp for IterableKind
type TargetType = PrimitiveKind
type Target = Primitive
type Error = OperatorError
fn apply_binary_op( &self, op: BinOp, _to: &Primitive, ) -> Result<Primitive, OperatorError>
fn apply_unary_op(&self, op: UnOp) -> Result<Self::Target, Self::Error>
fn can_apply_binary_op(_: BinOp, _: Self::TargetType) -> bool
fn can_apply_unary_op(_: UnOp) -> bool
Source§impl Clone for IterableKind
impl Clone for IterableKind
Source§fn clone(&self) -> IterableKind
fn clone(&self) -> IterableKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IterableKind
impl Debug for IterableKind
Source§impl<'de> Deserialize<'de> for IterableKind
impl<'de> Deserialize<'de> for IterableKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for IterableKind
impl Display for IterableKind
Source§impl PartialEq for IterableKind
impl PartialEq for IterableKind
Source§impl Serialize for IterableKind
impl Serialize for IterableKind
Source§impl Spreadable for IterableKind
impl Spreadable for IterableKind
Source§fn to_primitive_set(self) -> Result<Vec<Primitive>, TransformError>
fn to_primitive_set(self) -> Result<Vec<Primitive>, TransformError>
impl StructuralPartialEq for IterableKind
Auto Trait Implementations§
impl Freeze for IterableKind
impl RefUnwindSafe for IterableKind
impl Send for IterableKind
impl Sync for IterableKind
impl Unpin for IterableKind
impl UnsafeUnpin for IterableKind
impl UnwindSafe for IterableKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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