Skip to main content

DirectPropertyBase

Struct DirectPropertyBase 

Source
pub struct DirectPropertyBase<T: PropertyValue> { /* private fields */ }
Expand description

Base class for direct properties.

Holds everything about a direct property that does not depend on the type of its owner.

Implementations§

Source§

impl<T: PropertyValue> DirectPropertyBase<T>

Source

pub fn as_property(&'static self) -> &'static FerroProperty

The untyped base of the property.

Source

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

The class that registered this instance of the property.

Source

pub fn get_unset_value(&self, type_: &'static TypeInfo) -> T

Gets the unset value for the property on the specified type.

Source

pub fn get_unset_value_for(&self, owner: &FerroObject) -> T

Gets the unset value for the property on the type of owner.

Source

pub fn get_metadata( &self, type_: &'static TypeInfo, ) -> Rc<DirectPropertyMetadata<T>>

Gets the property metadata for the specified type.

Source

pub fn get_metadata_for( &self, owner: &FerroObject, ) -> Rc<DirectPropertyMetadata<T>>

Gets the property metadata for the type of owner.

Source

pub fn override_metadata<TOwner: ObjectType>( &self, metadata: DirectPropertyMetadata<T>, )

Overrides the metadata for the property on class TOwner.

Source

pub fn override_metadata_for( &self, type_: &'static TypeInfo, metadata: DirectPropertyMetadata<T>, )

Overrides the metadata for the property on the specified type.

Source

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

Removes the metadata registered for the specified type.

Methods from Deref<Target = 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

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

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.

Trait Implementations§

Source§

impl<T: PropertyValue> Deref for DirectPropertyBase<T>

Source§

type Target = FerroProperty

The resulting type after dereferencing.
Source§

fn deref(&self) -> &FerroProperty

Dereferences the value.
Source§

impl<T: PropertyValue> TypedProperty for DirectPropertyBase<T>

Source§

type Value = T

The value type of the property.
Source§

fn untyped(&'static self) -> &'static FerroProperty

The untyped base of the property.

Auto Trait Implementations§

§

impl<T> !Freeze for DirectPropertyBase<T>

§

impl<T> !RefUnwindSafe for DirectPropertyBase<T>

§

impl<T> !Send for DirectPropertyBase<T>

§

impl<T> !Sync for DirectPropertyBase<T>

§

impl<T> !UnwindSafe for DirectPropertyBase<T>

§

impl<T> Unpin for DirectPropertyBase<T>
where MetadataTable<DirectPropertyMetadata<T>>: Unpin, OnceCell<&'static dyn DirectPropertyAccessor<T>>: Unpin,

§

impl<T> UnsafeUnpin for DirectPropertyBase<T>
where MetadataTable<DirectPropertyMetadata<T>>: UnsafeUnpin, OnceCell<&'static dyn DirectPropertyAccessor<T>>: UnsafeUnpin,

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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.