Skip to main content

TypeContractValue

Trait TypeContractValue 

Source
pub trait TypeContractValue: Sized {
    // Required method
    fn runtime_type_kind(&self) -> RuntimeTypeKind;

    // Provided methods
    fn list_items(&self) -> Option<&[Self]> { ... }
    fn record_field(&self, _name: &str) -> Option<&Self> { ... }
    fn record_values_match(
        &self,
        _predicate: &mut dyn FnMut(&Self) -> bool,
    ) -> Option<bool> { ... }
    fn string_literal(&self) -> Option<&str> { ... }
    fn int_literal(&self) -> Option<i64> { ... }
    fn nominal_type_name(&self) -> Option<&str> { ... }
}

Required Methods§

Provided Methods§

Source

fn list_items(&self) -> Option<&[Self]>

Source

fn record_field(&self, _name: &str) -> Option<&Self>

Source

fn record_values_match( &self, _predicate: &mut dyn FnMut(&Self) -> bool, ) -> Option<bool>

Apply predicate to every value in a dictionary-like value.

Returning None distinguishes a value that is not enumerable from an empty dictionary. This keeps homogeneous dict<K, V> checks exact without forcing either runtime to allocate a projection vector.

Source

fn string_literal(&self) -> Option<&str>

Source

fn int_literal(&self) -> Option<i64>

Source

fn nominal_type_name(&self) -> Option<&str>

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§