Skip to main content

DataTableDynValue

Trait DataTableDynValue 

Source
pub trait DataTableDynValue:
    Display
    + Send
    + Sync {
    // Required methods
    fn compare(&self, other: &dyn DataTableDynValue) -> Ordering;
    fn clone_box(&self) -> Box<dyn DataTableDynValue>;
    fn as_any(&self) -> &(dyn Any + 'static);

    // Provided methods
    fn as_string(&self) -> String { ... }
    fn contains_str(&self, needle: &str) -> bool { ... }
    fn as_f64(&self) -> Option<f64> { ... }
}
Expand description

Trait for dynamically typed values that support comparison and display.

Implementations are provided for common Rust types including String, &'static str, i32, i64, f64, bool, and usize.

Required Methods§

Source

fn compare(&self, other: &dyn DataTableDynValue) -> Ordering

Compares this value to another for sorting.

§Parameters
  • other: The other value to compare against.
§Returns
  • Ordering: The comparison result.
Source

fn clone_box(&self) -> Box<dyn DataTableDynValue>

Clone into a boxed trait object.

§Returns
  • Box<dyn DataTableDynValue>: A boxed clone of this value.
Source

fn as_any(&self) -> &(dyn Any + 'static)

Returns the value as Any for downcasting.

§Returns
  • &dyn Any: A reference to the value as Any.

Provided Methods§

Source

fn as_string(&self) -> String

Returns the value as a string for filtering.

Source

fn contains_str(&self, needle: &str) -> bool

Returns true if this value contains the given substring (case-insensitive).

§Parameters
  • needle: The substring to search for.
§Returns
  • bool: Whether the value contains the substring.
Source

fn as_f64(&self) -> Option<f64>

Returns an optional f64 representation for numeric comparisons.

§Returns
  • Option<f64>: The numeric value if available.

Implementations on Foreign Types§

Source§

impl DataTableDynValue for &'static str

Implements DataTableDynValue for static string slices.

Source§

fn compare(&self, other: &dyn DataTableDynValue) -> Ordering

Source§

fn clone_box(&self) -> Box<dyn DataTableDynValue>

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl DataTableDynValue for bool

Implements DataTableDynValue for bool with downcast-optimized comparison.

Source§

fn compare(&self, other: &dyn DataTableDynValue) -> Ordering

Source§

fn clone_box(&self) -> Box<dyn DataTableDynValue>

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl DataTableDynValue for f64

Implements DataTableDynValue for f64 with floating-point comparison.

Source§

fn compare(&self, other: &dyn DataTableDynValue) -> Ordering

Source§

fn clone_box(&self) -> Box<dyn DataTableDynValue>

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn as_f64(&self) -> Option<f64>

Source§

impl DataTableDynValue for i32

Implements DataTableDynValue for i32 with numeric comparison support.

Source§

fn compare(&self, other: &dyn DataTableDynValue) -> Ordering

Source§

fn clone_box(&self) -> Box<dyn DataTableDynValue>

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn as_f64(&self) -> Option<f64>

Source§

impl DataTableDynValue for i64

Implements DataTableDynValue for i64 with numeric comparison support.

Source§

fn compare(&self, other: &dyn DataTableDynValue) -> Ordering

Source§

fn clone_box(&self) -> Box<dyn DataTableDynValue>

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn as_f64(&self) -> Option<f64>

Source§

impl DataTableDynValue for usize

Implements DataTableDynValue for usize with numeric comparison support.

Source§

fn compare(&self, other: &dyn DataTableDynValue) -> Ordering

Source§

fn clone_box(&self) -> Box<dyn DataTableDynValue>

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn as_f64(&self) -> Option<f64>

Source§

impl DataTableDynValue for String

Implements DataTableDynValue for String with downcast-optimized comparison.

Source§

fn compare(&self, other: &dyn DataTableDynValue) -> Ordering

Source§

fn clone_box(&self) -> Box<dyn DataTableDynValue>

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Implementors§