FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    BindingNotification

    struct · ferroui-base · v0.5.0

    struct BindingNotification
    

    Represents a binding notification that can be a valid binding value, or a binding or data validation error.

    This type is very similar to BindingValue, but where BindingValue is used by typed bindings, this type is used to hold binding and data validation errors in untyped bindings.

    A notification has reference semantics: it is shared as Rc<BindingNotification> (which converts to a BoxedValue holding the notification) and is modified in place.

    View source

    Members

    null

    fn null() -> Rc<BindingNotification>
    

    A binding notification representing the null value.

    Source

    unset_value

    fn unset_value() -> Rc<BindingNotification>
    

    A binding notification representing the unset value marker.

    Source

    new

    fn new(value: Option<BoxedValue>) -> Self
    

    Creates a binding notification for a binding value.

    Source

    with_error

    fn with_error(error: BindingError, error_type: BindingErrorType) -> Self
    

    Creates a binding notification for a binding error.

    Panics if error_type is BindingErrorType::None.

    Source

    with_error_and_fallback

    fn with_error_and_fallback(error: BindingError, error_type: BindingErrorType, fallback_value: Option<BoxedValue>) -> Self
    

    Creates a binding notification for a binding error with a fallback value.

    Panics if error_type is BindingErrorType::None.

    Source

    value

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

    Gets the value that should be passed to the target when has_value is true.

    If this is read when has_value is false then it returns the unset value marker.

    Source

    has_value

    fn has_value(self: &Self) -> bool
    

    Gets a value indicating whether value should be pushed to the target.

    Source

    error

    fn error(self: &Self) -> Option<BindingError>
    

    Gets the error that occurred on the source, if any.

    Source

    set_error

    fn set_error(self: &Self, error: Option<BindingError>)
    

    Sets the error that occurred on the source.

    Source

    error_type

    fn error_type(self: &Self) -> BindingErrorType
    

    Gets the type of error that error represents, if any.

    Source

    set_error_type

    fn set_error_type(self: &Self, error_type: BindingErrorType)
    

    Sets the type of error that error represents.

    Source

    extract_value

    fn extract_value(o: Option<&BoxedValue>) -> Option<BoxedValue>
    

    Gets a value from an untyped value that may be a binding notification.

    If o is a binding notification then returns the binding notification's value. If not, returns the value unchanged.

    Source

    update_value

    fn update_value(o: Option<&BoxedValue>, value: Option<&BoxedValue>) -> Option<BoxedValue>
    

    Updates the value of an untyped value that may be a binding notification.

    If o is a binding notification then sets its value to value and returns the notification; otherwise returns value. If value is a binding notification then its value is extracted first.

    Source

    extract_error

    fn extract_error(o: Option<&BoxedValue>) -> Option<BoxedValue>
    

    Gets an error from an untyped value that may be a binding notification.

    If o is a binding notification then returns the binding notification's error (boxed as a BindingError). If not, returns the value unchanged.

    Source

    add_error

    fn add_error(self: &Self, e: BindingError, error_type: BindingErrorType)
    

    Adds an error to the binding notification.

    Panics if error_type is BindingErrorType::None.

    Source

    clear_value

    fn clear_value(self: &Self)
    

    Removes the value and makes has_value return false.

    Source

    set_value

    fn set_value(self: &Self, value: Option<BoxedValue>)
    

    Sets the value.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • AnyValue
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToString
    • ErasedDestructor
    • IntoEither
    • PartialEq
    • Display
    • Debug

    Availability

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