#[repr(C)]pub enum Value {
Num(Array<f64>),
Byte(Array<u8>),
Complex(Array<Complex>),
Char(Array<char>),
Box(Array<Boxed>),
}Expand description
A generic array value
This enum is used to represent all possible array types.
Variants§
Num(Array<f64>)
Common number array
Byte(Array<u8>)
Byte array used for some boolean operations and for I/O
Complex(Array<Complex>)
Complex number array
Char(Array<char>)
Common character array
Box(Array<Boxed>)
Common box array
Implementations§
source§impl Value
impl Value
sourcepub fn join(self, other: Self, env: &Uiua) -> UiuaResult<Self>
pub fn join(self, other: Self, env: &Uiua) -> UiuaResult<Self>
join the array with another
sourcepub fn join_infallible(self, other: Self) -> Self
pub fn join_infallible(self, other: Self) -> Self
source§impl Value
impl Value
sourcepub fn couple(self, other: Self, env: &Uiua) -> UiuaResult<Self>
pub fn couple(self, other: Self, env: &Uiua) -> UiuaResult<Self>
couple the value with another
sourcepub fn couple_infallible(self, other: Self) -> Self
pub fn couple_infallible(self, other: Self) -> Self
sourcepub fn uncouple(self, env: &Uiua) -> UiuaResult<(Self, Self)>
pub fn uncouple(self, env: &Uiua) -> UiuaResult<(Self, Self)>
Uncouple the value into two values
source§impl Value
impl Value
sourcepub fn from_row_values_infallible<V>(values: V) -> Self
pub fn from_row_values_infallible<V>(values: V) -> Self
sourcepub fn from_row_values<V, C>(values: V, ctx: &C) -> Result<Self, C::Error>
pub fn from_row_values<V, C>(values: V, ctx: &C) -> Result<Self, C::Error>
Create a value from row values
source§impl Value
impl Value
sourcepub fn pick(self, from: Self, env: &Uiua) -> UiuaResult<Self>
pub fn pick(self, from: Self, env: &Uiua) -> UiuaResult<Self>
Use this array as an index to pick from another
source§impl Value
impl Value
sourcepub fn take(self, from: Self, env: &Uiua) -> UiuaResult<Self>
pub fn take(self, from: Self, env: &Uiua) -> UiuaResult<Self>
Use this value to take from another
sourcepub fn drop(self, from: Self, env: &Uiua) -> UiuaResult<Self>
pub fn drop(self, from: Self, env: &Uiua) -> UiuaResult<Self>
Use this value to drop from another
source§impl Value
impl Value
sourcepub fn select(&self, from: &Self, env: &Uiua) -> UiuaResult<Self>
pub fn select(&self, from: &Self, env: &Uiua) -> UiuaResult<Self>
Use this value to select from another
source§impl Value
impl Value
sourcepub fn reshape(&mut self, shape: &Self, env: &Uiua) -> UiuaResult
pub fn reshape(&mut self, shape: &Self, env: &Uiua) -> UiuaResult
reshape this value with another
source§impl Value
impl Value
sourcepub fn rerank(&mut self, rank: &Self, env: &Uiua) -> UiuaResult
pub fn rerank(&mut self, rank: &Self, env: &Uiua) -> UiuaResult
rerank this value with another
source§impl Value
impl Value
sourcepub fn keep(&self, kept: Self, env: &Uiua) -> UiuaResult<Self>
pub fn keep(&self, kept: Self, env: &Uiua) -> UiuaResult<Self>
Use this value as counts to keep another
source§impl Value
impl Value
sourcepub fn rotate(&self, rotated: Self, env: &Uiua) -> UiuaResult<Self>
pub fn rotate(&self, rotated: Self, env: &Uiua) -> UiuaResult<Self>
Use this value to rotate another
source§impl Value
impl Value
sourcepub fn windows(&self, from: &Self, env: &Uiua) -> UiuaResult<Self>
pub fn windows(&self, from: &Self, env: &Uiua) -> UiuaResult<Self>
Use this array to windows another
source§impl Value
impl Value
sourcepub fn find(&self, searched: &Self, env: &Uiua) -> UiuaResult<Self>
pub fn find(&self, searched: &Self, env: &Uiua) -> UiuaResult<Self>
Try to find this value in another
source§impl Value
impl Value
sourcepub fn member(&self, of: &Self, env: &Uiua) -> UiuaResult<Self>
pub fn member(&self, of: &Self, env: &Uiua) -> UiuaResult<Self>
Check which rows of this value are members of another
source§impl Value
impl Value
sourcepub fn index_of(&self, searched_in: &Value, env: &Uiua) -> UiuaResult<Value>
pub fn index_of(&self, searched_in: &Value, env: &Uiua) -> UiuaResult<Value>
Get the index of the rows of this value in another
sourcepub fn progressive_index_of(
&self,
searched_in: &Value,
env: &Uiua
) -> UiuaResult<Value>
pub fn progressive_index_of( &self, searched_in: &Value, env: &Uiua ) -> UiuaResult<Value>
Get the progressive index of the rows of this value in another
source§impl Value
impl Value
sourcepub fn map(self, values: Self, env: &Uiua) -> UiuaResult<Value>
pub fn map(self, values: Self, env: &Uiua) -> UiuaResult<Value>
Create a map array
sourcepub fn unmap(self, env: &Uiua) -> UiuaResult<(Value, Value)>
pub fn unmap(self, env: &Uiua) -> UiuaResult<(Value, Value)>
Turn a map array into its keys and values
sourcepub fn has_key(&self, key: &Value, env: &Uiua) -> UiuaResult<bool>
pub fn has_key(&self, key: &Value, env: &Uiua) -> UiuaResult<bool>
Check if a map array contains a key
sourcepub fn insert(&mut self, key: Value, value: Value, env: &Uiua) -> UiuaResult
pub fn insert(&mut self, key: Value, value: Value, env: &Uiua) -> UiuaResult
Insert a key-value pair into a map array
sourcepub fn remove(&mut self, key: Value, env: &Uiua) -> UiuaResult
pub fn remove(&mut self, key: Value, env: &Uiua) -> UiuaResult
Remove a key-value pair from a map array
source§impl Value
impl Value
sourcepub fn parse_num(&self, env: &Uiua) -> UiuaResult<Self>
pub fn parse_num(&self, env: &Uiua) -> UiuaResult<Self>
Attempt to parse the value into a number
sourcepub fn representation(&self) -> Self
pub fn representation(&self) -> Self
Convert value into a string that can be understood by the interpreter
source§impl Value
impl Value
sourcepub fn first(self, env: &Uiua) -> UiuaResult<Self>
pub fn first(self, env: &Uiua) -> UiuaResult<Self>
Get the first row of the value
sourcepub fn last(self, env: &Uiua) -> UiuaResult<Self>
pub fn last(self, env: &Uiua) -> UiuaResult<Self>
Get the last row of the value
source§impl Value
impl Value
sourcepub fn sort_up(&mut self, env: &Uiua) -> UiuaResult
pub fn sort_up(&mut self, env: &Uiua) -> UiuaResult
Sort the value ascending
sourcepub fn sort_down(&mut self, env: &Uiua) -> UiuaResult
pub fn sort_down(&mut self, env: &Uiua) -> UiuaResult
Sort the value descending
sourcepub fn deduplicate(&mut self)
pub fn deduplicate(&mut self)
deduplicate the rows of the value
source§impl Value
impl Value
sourcepub fn wher(&self, env: &Uiua) -> UiuaResult<Array<f64>>
pub fn wher(&self, env: &Uiua) -> UiuaResult<Array<f64>>
Get the indices where the value is nonzero
sourcepub fn first_where(&self, env: &Uiua) -> UiuaResult<Array<f64>>
pub fn first_where(&self, env: &Uiua) -> UiuaResult<Array<f64>>
Get the first index where the value is nonzero
sourcepub fn inv_where(&self, env: &Uiua) -> UiuaResult<Self>
pub fn inv_where(&self, env: &Uiua) -> UiuaResult<Self>
un where
source§impl Value
impl Value
sourcepub fn utf8(&self, env: &Uiua) -> UiuaResult<Self>
pub fn utf8(&self, env: &Uiua) -> UiuaResult<Self>
Convert a string value to a list of UTF-8 bytes
sourcepub fn inv_utf8(&self, env: &Uiua) -> UiuaResult<Self>
pub fn inv_utf8(&self, env: &Uiua) -> UiuaResult<Self>
Convert a list of UTF-8 bytes to a string value
source§impl Value
impl Value
sourcepub fn as_num_array(&self) -> Option<&Array<f64>>
pub fn as_num_array(&self) -> Option<&Array<f64>>
Get a reference to a possible number array
sourcepub fn as_byte_array(&self) -> Option<&Array<u8>>
pub fn as_byte_array(&self) -> Option<&Array<u8>>
Get a reference to a possible byte array
sourcepub fn as_char_array(&self) -> Option<&Array<char>>
pub fn as_char_array(&self) -> Option<&Array<char>>
Get a reference to a possible character array
sourcepub fn as_box_array(&self) -> Option<&Array<Boxed>>
pub fn as_box_array(&self) -> Option<&Array<Boxed>>
Get a reference to a possible box array
sourcepub fn rows(&self) -> Box<dyn ExactSizeIterator<Item = Self> + '_>
pub fn rows(&self) -> Box<dyn ExactSizeIterator<Item = Self> + '_>
Get an iterator over the rows of the value
sourcepub fn row_shaped_slices(
&self,
row_shape: Shape
) -> Box<dyn ExactSizeIterator<Item = Self> + '_>
pub fn row_shaped_slices( &self, row_shape: Shape ) -> Box<dyn ExactSizeIterator<Item = Self> + '_>
Get an iterator over the rows of the value that have the given shape
sourcepub fn into_row_shaped_slices(
self,
row_shape: Shape
) -> Box<dyn DoubleEndedIterator<Item = Self>>
pub fn into_row_shaped_slices( self, row_shape: Shape ) -> Box<dyn DoubleEndedIterator<Item = Self>>
Get an iterator over the rows of the value that have the given shape
sourcepub fn into_rows(self) -> Box<dyn ExactDoubleIterator<Item = Self>>
pub fn into_rows(self) -> Box<dyn ExactDoubleIterator<Item = Self>>
Consume the value and get an iterator over its rows
sourcepub fn into_elements(self) -> Box<dyn Iterator<Item = Self>>
pub fn into_elements(self) -> Box<dyn Iterator<Item = Self>>
Cosume the value and get an iterator over its elements
sourcepub fn type_name_plural(&self) -> &'static str
pub fn type_name_plural(&self) -> &'static str
Get a plural form of the value’s type name
source§impl Value
impl Value
sourcepub fn element_count(&self) -> usize
pub fn element_count(&self) -> usize
Get the number of elements
sourcepub fn take_label(&mut self) -> Option<EcoString>
pub fn take_label(&mut self) -> Option<EcoString>
Take the label from the value
sourcepub fn combine_meta(&mut self, other: &ArrayMeta)
pub fn combine_meta(&mut self, other: &ArrayMeta)
Combine this value’s metadata with another
sourcepub fn reset_meta(&mut self)
pub fn reset_meta(&mut self)
Reset this value’s metadata
sourcepub fn reset_meta_flags(&mut self)
pub fn reset_meta_flags(&mut self)
Reset this value’s metadata flags
sourcepub fn show(&self) -> String
pub fn show(&self) -> String
Get the pretty-printed string representation of the value that appears in output
sourcepub fn format(&self) -> String
pub fn format(&self) -> String
Get the pretty-printed string representation of the value that appears when formatted
sourcepub fn as_ints(
&self,
env: &Uiua,
requirement: &'static str
) -> UiuaResult<Vec<isize>>
pub fn as_ints( &self, env: &Uiua, requirement: &'static str ) -> UiuaResult<Vec<isize>>
Attempt to convert the array to a list of integers
The requirement parameter is used in error messages.
sourcepub fn as_bool(&self, env: &Uiua, requirement: &'static str) -> UiuaResult<bool>
pub fn as_bool(&self, env: &Uiua, requirement: &'static str) -> UiuaResult<bool>
Attempt to convert the array to a single boolean
The requirement parameter is used in error messages.
sourcepub fn as_nat(&self, env: &Uiua, requirement: &'static str) -> UiuaResult<usize>
pub fn as_nat(&self, env: &Uiua, requirement: &'static str) -> UiuaResult<usize>
Attempt to convert the array to a single natural number
The requirement parameter is used in error messages.
sourcepub fn as_int(&self, env: &Uiua, requirement: &'static str) -> UiuaResult<isize>
pub fn as_int(&self, env: &Uiua, requirement: &'static str) -> UiuaResult<isize>
Attempt to convert the array to a single integer
The requirement parameter is used in error messages.
sourcepub fn as_num(&self, env: &Uiua, requirement: &'static str) -> UiuaResult<f64>
pub fn as_num(&self, env: &Uiua, requirement: &'static str) -> UiuaResult<f64>
Attempt to convert the array to a single number
The requirement parameter is used in error messages.
sourcepub fn as_nums(
&self,
env: &Uiua,
requirement: &'static str
) -> UiuaResult<Vec<f64>>
pub fn as_nums( &self, env: &Uiua, requirement: &'static str ) -> UiuaResult<Vec<f64>>
Attempt to convert the array to a list of numbers
The requirement parameter is used in error messages.
sourcepub fn as_nats(
&self,
env: &Uiua,
requirement: &'static str
) -> UiuaResult<Vec<usize>>
pub fn as_nats( &self, env: &Uiua, requirement: &'static str ) -> UiuaResult<Vec<usize>>
Attempt to convert the array to a list of natural numbers
The requirement parameter is used in error messages.
sourcepub fn as_bytes(
&self,
env: &Uiua,
requirement: &'static str
) -> UiuaResult<Vec<u8>>
pub fn as_bytes( &self, env: &Uiua, requirement: &'static str ) -> UiuaResult<Vec<u8>>
Attempt to convert the array to a list of bytes
The requirement parameter is used in error messages.
sourcepub fn as_rank_list(
&self,
env: &Uiua,
requirement: &'static str
) -> UiuaResult<Vec<Option<isize>>>
pub fn as_rank_list( &self, env: &Uiua, requirement: &'static str ) -> UiuaResult<Vec<Option<isize>>>
Attempt to convert the array to a list of integers or infinity
None represents infinity.
The requirement parameter is used in error messages.
sourcepub fn as_string(
&self,
env: &Uiua,
requirement: &'static str
) -> UiuaResult<String>
pub fn as_string( &self, env: &Uiua, requirement: &'static str ) -> UiuaResult<String>
Attempt to convert the array to a string
The requirement parameter is used in error messages.
sourcepub fn into_bytes(
self,
env: &Uiua,
requirement: &'static str
) -> UiuaResult<Vec<u8>>
pub fn into_bytes( self, env: &Uiua, requirement: &'static str ) -> UiuaResult<Vec<u8>>
Attempt to convert the array to a list of bytes
The requirement parameter is used in error messages.
sourcepub fn map_boxed(self, f: impl FnOnce(Self) -> Self) -> Self
pub fn map_boxed(self, f: impl FnOnce(Self) -> Self) -> Self
Apply a function to the highest-level unboxed value
sourcepub fn try_map_boxed(
self,
f: impl FnOnce(Self) -> UiuaResult<Self>
) -> UiuaResult<Self>
pub fn try_map_boxed( self, f: impl FnOnce(Self) -> UiuaResult<Self> ) -> UiuaResult<Self>
Apply a function to the highest-level unboxed value
sourcepub fn box_if_not(&mut self)
pub fn box_if_not(&mut self)
Turn the value into a scalar box if it is not one already
sourcepub fn boxed_if_not(self) -> Boxed
pub fn boxed_if_not(self) -> Boxed
Turn the value into a scalar box if it is not one already
sourcepub fn compress(&mut self)
pub fn compress(&mut self)
Turn a number array into a byte array if no information is lost.
Does nothing without the bytes feature enabled.
sourcepub fn coerce_to_boxes(self) -> Array<Boxed>
pub fn coerce_to_boxes(self) -> Array<Boxed>
Convert to a box array by boxing every element
sourcepub fn coerce_as_boxes(&self) -> Cow<'_, Array<Boxed>>
pub fn coerce_as_boxes(&self) -> Cow<'_, Array<Boxed>>
Convert to a box array by boxing every element
sourcepub fn keep_label(
self,
f: impl FnOnce(Self) -> UiuaResult<Self>
) -> UiuaResult<Self>
pub fn keep_label( self, f: impl FnOnce(Self) -> UiuaResult<Self> ) -> UiuaResult<Self>
Propogate a value’s label accross an operation
sourcepub fn keep_labels(
self,
other: Self,
f: impl FnOnce(Self, Self) -> UiuaResult<Self>
) -> UiuaResult<Self>
pub fn keep_labels( self, other: Self, f: impl FnOnce(Self, Self) -> UiuaResult<Self> ) -> UiuaResult<Self>
Propogate values’ labels accross an operation
Trait Implementations§
source§impl BorrowMut<Value> for Boxed
impl BorrowMut<Value> for Boxed
source§fn borrow_mut(&mut self) -> &mut Value
fn borrow_mut(&mut self) -> &mut Value
source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
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 FromIterator<Boxed> for Value
impl FromIterator<Boxed> for Value
source§impl FromIterator<Complex> for Value
impl FromIterator<Complex> for Value
source§impl FromIterator<char> for Value
impl FromIterator<char> for Value
source§impl FromIterator<f64> for Value
impl FromIterator<f64> for Value
source§impl FromIterator<u8> for Value
impl FromIterator<u8> for Value
source§impl FromIterator<usize> for Value
impl FromIterator<usize> for Value
source§impl Ord for Value
impl Ord for Value
source§impl PartialEq for Value
impl PartialEq for Value
source§impl PartialOrd for Value
impl PartialOrd for Value
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moreimpl Eq for Value
Auto Trait Implementations§
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().