Skip to main content

AnyValue

Trait AnyValue 

Source
pub trait AnyValue: Any { }
Expand description

A value of any property value type, for untyped access to properties.

Implemented for every type that can be a property value. Unlike Any, it supports equality, so untyped values can themselves be property values (for example a data context).

Implementations§

Source§

impl dyn AnyValue

Source

pub fn as_any(&self) -> &dyn Any

The contained value as Any, for downcasting.

Source

pub fn value_type_id(&self) -> TypeId

The TypeId of the contained value.

Source

pub fn type_name(&self) -> &'static str

The Rust type name of the contained value.

Source

pub fn is<T: 'static>(&self) -> bool

Whether the contained value is of type T.

Source

pub fn downcast_ref<T: 'static>(&self) -> Option<&T>

The contained value, if it is of type T.

Source

pub fn value_eq(&self, other: &dyn AnyValue) -> bool

Compares with another untyped value: equal if both hold the same type and the values are equal.

Trait Implementations§

Source§

impl Debug for dyn AnyValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for dyn AnyValue

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: PartialEq + 'static> AnyValue for T