Skip to main content

ClrPropertyInfo

Struct ClrPropertyInfo 

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

A property description built from accessor closures. This is what compiled bindings use to read and write plain properties.

Implementations§

Source§

impl ClrPropertyInfo

Source

pub fn new( name: &str, getter: Option<PropertyGetter>, setter: Option<PropertySetter>, property_type: ValueType, ) -> Self

Creates a property description from untyped accessors.

Source

pub fn new_fallible( name: &str, getter: Option<FalliblePropertyGetter>, setter: Option<PropertySetter>, property_type: ValueType, ) -> Self

Creates a property description from untyped accessors, with a getter that can fail.

Source

pub fn with_boxed_accessors( self, getter: Option<BoxedPropertyGetter>, setter: Option<BoxedPropertySetter>, ) -> Self

Adds accessors that take the owner as an untyped handle. A property description built over accessors that need the handle of the owner and not only a view of it (the invokers of markup metadata) is read and written through them by the boxed forms of the contract (IPropertyInfo::get_boxed, IPropertyInfo::try_get_boxed, IPropertyInfo::set_boxed).

Source

pub fn read_only_fallible<O: 'static, K: PropertyKind>( name: &str, get: impl Fn(&O) -> Result<K::Typed, BindingError> + 'static, ) -> Self

A read-only property of owner type O whose getter can fail, the way the getter of an indexer throws for a bad index or key.

Source

pub fn read_write_fallible<O: 'static, K: PropertyKind>( name: &str, get: impl Fn(&O) -> Result<K::Typed, BindingError> + 'static, set: impl Fn(&O, K::Typed) -> Result<(), BindingError> + 'static, ) -> Self

A read-write property of owner type O whose getter and setter can fail.

Source

pub fn read_only<O: 'static, K: PropertyKind>( name: &str, get: impl Fn(&O) -> K::Typed + 'static, ) -> Self

A read-only property of owner type O, from a typed getter.

Source

pub fn read_write<O: 'static, K: PropertyKind>( name: &str, get: impl Fn(&O) -> K::Typed + 'static, set: impl Fn(&O, K::Typed) + 'static, ) -> Self

A read-write property of owner type O, from typed accessors.

Source

pub fn read_write_validated<O: 'static, K: PropertyKind>( name: &str, get: impl Fn(&O) -> K::Typed + 'static, set: impl Fn(&O, K::Typed) -> Result<(), BindingError> + 'static, ) -> Self

A read-write property whose setter can reject values.

Trait Implementations§

Source§

impl IPropertyInfo for ClrPropertyInfo

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 get(&self, target: &dyn AnyValue) -> Option<BoxedValue>

Reads the property from target. Null is None.
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 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§

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§

impl MarkupTyped for ClrPropertyInfo

Source§

const MARKUP: &'static MarkupType

The markup metadata of the type.

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> 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, 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.