Skip to main content

FerroProperty

Struct FerroProperty 

Source
pub struct FerroProperty { /* private fields */ }
Expand description

Base class for properties: the untyped identity and description of a property that can be set on a FerroObject.

Implementations§

Source§

impl FerroProperty

Source

pub fn as_property_info(&'static self) -> Rc<dyn IPropertyInfo>

The property as a shared property description (Rc<dyn IPropertyInfo>), for the places that take a registered property through the property description contract. IPropertyInfo::as_ferro_property gives the property back.

Source§

impl FerroProperty

Source

pub fn bind(&'static self) -> IndexerDescriptor

Gets a description of a binding to the property, for the binding indexer of FerroObject. This is the ! operator of a property: !Border.BackgroundProperty is Border::background_property().bind(), and the two-way forms !!Property and ~Property are !Property.bind().

Source§

impl FerroProperty

Source

pub fn host_type(&self) -> Option<&'static TypeInfo>

The class an attached property is declared for: the THost of its registration, the type of the objects its accessors (GetX/SetX) take. None for properties that are not attached.

Source

pub fn name(&self) -> &str

The name of the property.

Source

pub fn property_type(&self) -> TypeId

The type of the property’s value.

Source

pub fn property_type_name(&self) -> &'static str

The Rust type name of the property’s value type.

Source

pub fn owner_type(&self) -> &'static TypeInfo

The class that registered the property.

Source

pub fn inherits(&self) -> bool

Whether the property inherits its value.

Source

pub fn is_attached(&self) -> bool

Whether this is an attached property.

Source

pub fn is_direct(&self) -> bool

Whether this is a direct property.

Source

pub fn is_read_only(&self) -> bool

Whether this is a readonly property.

Source

pub fn assign_binding(&self) -> bool

Whether a binding given for this property in markup is assigned to the property as its value rather than bound to it (the “assign binding” attribute of the managed property). The property’s value type is then a binding type. A fact about the definition: it is the same for every owner and is not part of the metadata.

Source

pub fn set_assign_binding(&self, value: bool)

Marks the property as one that bindings are assigned to. Part of the definition of the property: call it where the property is registered (styled and attached properties state it through StyledPropertyOptions::assign_binding).

Source

pub fn id(&self) -> u32

An integer ID that uniquely identifies the property; shared by all owners added with add_owner.

Source

pub fn changed(&'static self) -> &'static PropertyChangedObservable

Notifications of changes to this property on any object.

The handlers are invoked after the object’s own change handling.

Source

pub fn get_metadata(&self, type_: &'static TypeInfo) -> FerroPropertyMetadata

Gets the base metadata of the property on the specified type.

Source

pub fn get_metadata_for(&self, owner: &FerroObject) -> FerroPropertyMetadata

Gets the base metadata of the property on the type of owner.

Source

pub fn unregister(&self, type_: &'static TypeInfo)

Removes the metadata registered for the property on the specified type.

Source

pub fn is_valid_value(&self, value: &dyn Any) -> bool

Checks whether value is valid for the property: of the property’s value type and accepted by its validation callback.

Source

pub fn as_styled<T: PropertyValue>( &'static self, ) -> Option<&'static StyledProperty<T>>

The property as a styled (or attached) property with value type T: the typed view needed to read, set and bind it without boxing. None for direct properties and when T is not the property’s value type.

Source

pub fn unset_value() -> BoxedValue

The marker value that represents an unset property value.

Source

pub fn register<TOwner: ObjectType, TValue: PropertyValue>( name: &str, default_value: TValue, ) -> &'static StyledProperty<TValue>

Registers a styled property with a default value.

Source

pub fn register_with<TOwner: ObjectType, TValue: PropertyValue>( name: &str, options: StyledPropertyOptions<TValue>, ) -> &'static StyledProperty<TValue>

Registers a styled property.

Source

pub fn register_attached<TOwner: StaticType, THost: ObjectType, TValue: PropertyValue>( name: &str, default_value: TValue, ) -> &'static AttachedProperty<TValue>

Registers an attached property with a default value.

TOwner is the class that registers the property and THost the class of objects the property can be set on.

Source

pub fn register_attached_with<TOwner: StaticType, THost: ObjectType, TValue: PropertyValue>( name: &str, options: StyledPropertyOptions<TValue>, ) -> &'static AttachedProperty<TValue>

Registers an attached property.

Source

pub fn register_direct<TOwner: ObjectType, TValue: PropertyValue>( name: &str, getter: fn(&TOwner) -> TValue, setter: Option<fn(&TOwner, TValue)>, unset_value: TValue, ) -> &'static DirectProperty<TOwner, TValue>

Registers a direct property: a property whose value is stored in a field of the owner and accessed through a getter and setter.

Source

pub fn register_direct_with<TOwner: ObjectType, TValue: PropertyValue>( name: &str, getter: fn(&TOwner) -> TValue, setter: Option<fn(&TOwner, TValue)>, metadata: DirectPropertyMetadata<TValue>, ) -> &'static DirectProperty<TOwner, TValue>

Registers a direct property with explicit metadata.

Trait Implementations§

Source§

impl Debug for FerroProperty

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for FerroProperty

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for FerroProperty

Source§

impl Hash for FerroProperty

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IPropertyInfo for FerroProperty

A registered property is a property info: the untyped accessors read and write the property on an object of the class hierarchy.

Source§

fn get(&self, target: &dyn AnyValue) -> Option<BoxedValue>

Panics if target is not an object of the class hierarchy.

Source§

fn as_any(&self) -> Option<&dyn Any>

The implementing value, for casting to its concrete type (as_any()?.downcast_ref::<T>()): the equivalent of is/as on the contract. None for an implementation that does not expose itself.
Source§

fn name(&self) -> &str

The name of the property.
Source§

fn try_get( &self, target: &dyn AnyValue, ) -> Result<Option<BoxedValue>, BindingError>

Reads the property from target. An Err is the equivalent of the getter throwing, for example because target is not of the type that declares the property.
Source§

fn set( &self, target: &dyn AnyValue, value: Option<&BoxedValue>, ) -> Result<(), BindingError>

Writes the property on target. An Err is the equivalent of the setter throwing.
Source§

fn can_set(&self) -> bool

Source§

fn can_get(&self) -> bool

Source§

fn property_type(&self) -> ValueType

The type of the property’s value.
Source§

fn as_ferro_property(&self) -> Option<&'static FerroProperty>

The registered property this description is, if it is one (the cast of a property description back to the registered property class).
Source§

fn get_boxed(&self, target: &BoxedValue) -> Option<BoxedValue>

get for an owner known as an untyped handle. The accessors of binding paths read through the boxed forms, so that a property description whose accessors need the handle of the owner (not only a view of it) can override them; the defaults forward to the forms taking a view. Override the three boxed forms together.
Source§

fn try_get_boxed( &self, target: &BoxedValue, ) -> Result<Option<BoxedValue>, BindingError>

try_get for an owner known as an untyped handle.
Source§

fn set_boxed( &self, target: &BoxedValue, value: Option<&BoxedValue>, ) -> Result<(), BindingError>

set for an owner known as an untyped handle.
Source§

impl MarkupTyped for FerroProperty

Source§

const MARKUP: &'static MarkupType

The markup metadata of the type.
Source§

impl PartialEq for FerroProperty

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyValue for T
where T: PartialEq + 'static,

Source§

fn any_value_as_any(&self) -> &(dyn Any + 'static)

Source§

fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool

Source§

fn any_value_type_name(&self) -> &'static str

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ResourceKeyObject for T
where T: Eq + Hash + 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn dyn_eq(&self, other: &(dyn ResourceKeyObject + 'static)) -> bool

Source§

fn dyn_hash(&self, state: &mut dyn Hasher)

Source§

fn key_type_name(&self) -> &'static str

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.