FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    IValidationRule

    trait · ferroui-xaml-interactions-custom · v0.5.0

    trait IValidationRule
    

    Defines a validation rule.

    Deviation (DEVIATIONS.md, Behaviors): the reference contract is generic over the type of the validated value (IValidationRule<in T>); here the value is untyped (the value of the validated property, null when the property holds no value), and a rule that expects another type of value does not validate it. The rules are objects of the class model, so a class states that it implements the contract in its static constructor (<dyn IValidationRule>::register::<MyRule>()), and the contract finds the implementation of an object through its runtime type (<dyn IValidationRule>::of(object)), as the contracts of the interactivity crate do.

    View source

    Members

    error_message

    fn error_message(self: &Self) -> Option<String>
    

    Gets the error message for failed validation.

    Source

    set_error_message

    fn set_error_message(self: &Self, value: Option<String>)
    

    Sets the error message for failed validation.

    Source

    validate

    fn validate(self: &Self, value: Option<&BoxedValue>) -> bool
    

    Validates the specified value (null when the property holds no value).

    Returns true if value is valid.

    Source

    Trait implementations

    Availability

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