uiua

Trait ArrayValue

Source
pub trait ArrayValue:
    Default
    + Clone
    + Debug
    + Display
    + GridFmt
    + ArrayCmp
    + Send
    + Sync
    + 'static {
    const NAME: &'static str;
    const SYMBOL: char;
    const TYPE_ID: u8;
Show 15 methods // Required methods fn get_scalar_fill(fill: &Fill<'_>) -> Result<Self, &'static str>; fn get_array_fill(fill: &Fill<'_>) -> Result<Array<Self>, &'static str>; fn array_hash<H: Hasher>(&self, hasher: &mut H); fn proxy() -> Self; // Provided methods fn format_delims() -> (&'static str, &'static str) { ... } fn empty_list_inner() -> &'static str { ... } fn format_sep() -> &'static str { ... } fn grid_fmt_delims(boxed: bool) -> (char, char) { ... } fn compress_list_grid() -> bool { ... } fn nested_value(&self) -> Option<&Value> { ... } fn has_wildcard(&self) -> bool { ... } fn summarize(elems: &[Self]) -> String { ... } fn summary_min_elems() -> usize { ... } fn alignment() -> ElemAlign { ... } fn max_col_width<'a>( rows: impl Iterator<Item = &'a [char]> + Clone, ) -> usize { ... }
}
Expand description

A trait for types that can be used as array elements

Required Associated Constants§

Source

const NAME: &'static str

The type name

Source

const SYMBOL: char

A glyph indicating the type

Source

const TYPE_ID: u8

An ID for the type

Required Methods§

Source

fn get_scalar_fill(fill: &Fill<'_>) -> Result<Self, &'static str>

Get the scalar fill value from the environment

Source

fn get_array_fill(fill: &Fill<'_>) -> Result<Array<Self>, &'static str>

Get the array fill value from the environment

Source

fn array_hash<H: Hasher>(&self, hasher: &mut H)

Hash the value

Source

fn proxy() -> Self

Get the proxy value

Provided Methods§

Source

fn format_delims() -> (&'static str, &'static str)

Delimiters for formatting

Source

fn empty_list_inner() -> &'static str

Marker for empty lists in grid formatting

Source

fn format_sep() -> &'static str

Separator for formatting

Source

fn grid_fmt_delims(boxed: bool) -> (char, char)

Delimiters for grid formatting

Source

fn compress_list_grid() -> bool

Whether to compress all items of a list when grid formatting

Source

fn nested_value(&self) -> Option<&Value>

Get a nested value

Source

fn has_wildcard(&self) -> bool

Check if this element has the wildcard value

Source

fn summarize(elems: &[Self]) -> String

Summarize the elements of an array of this type

Source

fn summary_min_elems() -> usize

The minimum number of elements that require a summary

Source

fn alignment() -> ElemAlign

How to align elements when formatting

Source

fn max_col_width<'a>(rows: impl Iterator<Item = &'a [char]> + Clone) -> usize

How to determine the maximum width of a formatted column

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ArrayValue for char

Source§

const NAME: &'static str = "character"

Source§

const SYMBOL: char = '@'

Source§

const TYPE_ID: u8 = 1u8

Source§

fn get_scalar_fill(fill: &Fill<'_>) -> Result<Self, &'static str>

Source§

fn get_array_fill(fill: &Fill<'_>) -> Result<Array<Self>, &'static str>

Source§

fn format_delims() -> (&'static str, &'static str)

Source§

fn format_sep() -> &'static str

Source§

fn array_hash<H: Hasher>(&self, hasher: &mut H)

Source§

fn proxy() -> Self

Source§

fn grid_fmt_delims(boxed: bool) -> (char, char)

Source§

fn compress_list_grid() -> bool

Source§

fn has_wildcard(&self) -> bool

Source§

fn summarize(elems: &[Self]) -> String

Source§

impl ArrayValue for f64

Source§

const NAME: &'static str = "number"

Source§

const SYMBOL: char = 'ℝ'

Source§

const TYPE_ID: u8 = 0u8

Source§

fn get_scalar_fill(fill: &Fill<'_>) -> Result<Self, &'static str>

Source§

fn get_array_fill(fill: &Fill<'_>) -> Result<Array<Self>, &'static str>

Source§

fn array_hash<H: Hasher>(&self, hasher: &mut H)

Source§

fn proxy() -> Self

Source§

fn has_wildcard(&self) -> bool

Source§

fn summarize(elems: &[Self]) -> String

Source§

fn alignment() -> ElemAlign

Source§

fn max_col_width<'a>(rows: impl Iterator<Item = &'a [char]>) -> usize

Source§

impl ArrayValue for u8

Source§

const NAME: &'static str = "number"

Source§

const SYMBOL: char = 'ℝ'

Source§

const TYPE_ID: u8 = 0u8

Source§

fn get_scalar_fill(fill: &Fill<'_>) -> Result<Self, &'static str>

Source§

fn get_array_fill(fill: &Fill<'_>) -> Result<Array<Self>, &'static str>

Source§

fn array_hash<H: Hasher>(&self, hasher: &mut H)

Source§

fn proxy() -> Self

Source§

fn summarize(elems: &[Self]) -> String

Source§

fn alignment() -> ElemAlign

Implementors§

Source§

impl ArrayValue for Boxed

Source§

const NAME: &'static str = "box"

Source§

const SYMBOL: char = '□'

Source§

const TYPE_ID: u8 = 2u8

Source§

impl ArrayValue for Complex

Source§

const NAME: &'static str = "complex"

Source§

const SYMBOL: char = 'ℂ'

Source§

const TYPE_ID: u8 = 3u8