FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    IBindingTypeConverter

    trait · ferroui-reactiveui · v0.5.0

    trait IBindingTypeConverter
    

    Converts the values of one type to another for the bindings (IBindingTypeConverter).

    A converter names its source and target types; BindingTypeConverterRegistry finds it by that pair, and of several converters of one pair the one with the highest affinity wins. Most converters derive from the base BindingTypeConverter, which writes this trait from a typed conversion; a converter that handles its input itself implements this trait directly.

    Values cross this API type-erased: the input is a &dyn Any (None stands for upstream's null), and a converted value is an Rc<dyn Any> holding a value of to_type.

    View source

    Members

    from_type

    fn from_type(self: &Self) -> ConverterType
    

    The type this converter converts from (FromType).

    Source

    to_type

    fn to_type(self: &Self) -> ConverterType
    

    The type this converter converts to (ToType).

    Source

    get_affinity_for_objects

    fn get_affinity_for_objects(self: &Self) -> i32
    

    How well this converter converts from from_type to to_type: a positive score when it can, where a higher score wins; zero or less when it cannot (GetAffinityForObjects). The built-in converters score BindingAffinity::DEFAULT_INTERNAL_TYPE_CONVERTER.

    Source

    try_convert_typed

    fn try_convert_typed(self: &Self, from: Option<&dyn Any>, conversion_hint: Option<&dyn Any>) -> Option<Rc<dyn Any>>
    

    Converts from (None for upstream's null), with an optional conversion_hint (a format, a width, a value to compare with: what the converter makes of it), and returns the converted value, or None when from is not a value of from_type or cannot be converted (TryConvertTyped).

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.