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.
Members
nullunset_valuenewwith_errorwith_error_and_fallbackvaluehas_valueerrorset_errorerror_typeset_error_typeextract_valueupdate_valueextract_erroradd_errorclear_valueset_value
null
fn null() -> Rc<BindingNotification>
A binding notification representing the null value.
unset_value
fn unset_value() -> Rc<BindingNotification>
A binding notification representing the unset value marker.
new
fn new(value: Option<BoxedValue>) -> Self
Creates a binding notification for a binding value.
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.
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.
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.
has_value
fn has_value(self: &Self) -> bool
Gets a value indicating whether value should be
pushed to the target.
error
fn error(self: &Self) -> Option<BindingError>
Gets the error that occurred on the source, if any.
set_error
fn set_error(self: &Self, error: Option<BindingError>)
Sets the error that occurred on the source.
error_type
fn error_type(self: &Self) -> BindingErrorType
Gets the type of error that error represents, if any.
set_error_type
fn set_error_type(self: &Self, error_type: BindingErrorType)
Sets the type of error that error represents.
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.
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.
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.
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.
clear_value
fn clear_value(self: &Self)
Removes the value and makes
has_value return false.
set_value
fn set_value(self: &Self, value: Option<BoxedValue>)
Sets the value.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeAnyValueClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyToStringErasedDestructorIntoEitherPartialEqDisplayDebug
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.