ArrayValue

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;

    // Required methods
    fn get_scalar_fill(fill: &Fill<'_>) -> Result<FillValue<Self>, &'static str>;
    fn get_array_fill(
        fill: &Fill<'_>,
    ) -> Result<FillValue<Array<Self>>, &'static str>;
    fn array_hash<H: Hasher>(&self, hasher: &mut H);
    fn proxy() -> Self;

    // Provided methods
    fn nested_value(&self) -> Option<&Value> { ... }
    fn has_wildcard(&self) -> bool { ... }
    fn sort_list(list: &mut [Self], up: bool) { ... }
    fn is_sortable(&self) -> bool { ... }
    fn dbg_validate(arr: &Array<Self>) { ... }
}
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<FillValue<Self>, &'static str>

Get the scalar fill value from the environment

Source

fn get_array_fill( fill: &Fill<'_>, ) -> Result<FillValue<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 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 sort_list(list: &mut [Self], up: bool)

Sort a list of this type

Source

fn is_sortable(&self) -> bool

Whether this value can be sorted

Source

fn dbg_validate(arr: &Array<Self>)

Validate array correctness in debug mode

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<FillValue<Self>, &'static str>

Source§

fn get_array_fill( fill: &Fill<'_>, ) -> Result<FillValue<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§

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<FillValue<Self>, &'static str>

Source§

fn get_array_fill( fill: &Fill<'_>, ) -> Result<FillValue<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 is_sortable(&self) -> bool

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<FillValue<Self>, &'static str>

Source§

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

Source§

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

Source§

fn proxy() -> Self

Source§

fn sort_list(list: &mut [Self], up: bool)

Source§

fn dbg_validate(arr: &Array<Self>)

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