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
impl ClrPropertyInfo
Sourcepub fn new(
name: &str,
getter: Option<PropertyGetter>,
setter: Option<PropertySetter>,
property_type: ValueType,
) -> Self
pub fn new( name: &str, getter: Option<PropertyGetter>, setter: Option<PropertySetter>, property_type: ValueType, ) -> Self
Creates a property description from untyped accessors.
Sourcepub fn new_fallible(
name: &str,
getter: Option<FalliblePropertyGetter>,
setter: Option<PropertySetter>,
property_type: ValueType,
) -> Self
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.
Sourcepub fn with_boxed_accessors(
self,
getter: Option<BoxedPropertyGetter>,
setter: Option<BoxedPropertySetter>,
) -> Self
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).
Sourcepub fn read_only_fallible<O: 'static, K: PropertyKind>(
name: &str,
get: impl Fn(&O) -> Result<K::Typed, BindingError> + 'static,
) -> Self
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.
Sourcepub 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
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.
Sourcepub fn read_only<O: 'static, K: PropertyKind>(
name: &str,
get: impl Fn(&O) -> K::Typed + 'static,
) -> Self
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.
Sourcepub fn read_write<O: 'static, K: PropertyKind>(
name: &str,
get: impl Fn(&O) -> K::Typed + 'static,
set: impl Fn(&O, K::Typed) + 'static,
) -> Self
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.
Sourcepub 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
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
impl IPropertyInfo for ClrPropertyInfo
Source§fn as_any(&self) -> Option<&dyn Any>
fn as_any(&self) -> Option<&dyn Any>
as_any()?.downcast_ref::<T>()): the equivalent of is/as on the
contract. None for an implementation that does not expose itself.Source§fn get(&self, target: &dyn AnyValue) -> Option<BoxedValue>
fn get(&self, target: &dyn AnyValue) -> Option<BoxedValue>
target. Null is None.Source§fn try_get(
&self,
target: &dyn AnyValue,
) -> Result<Option<BoxedValue>, BindingError>
fn try_get( &self, target: &dyn AnyValue, ) -> Result<Option<BoxedValue>, BindingError>
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>
fn set( &self, target: &dyn AnyValue, value: Option<&BoxedValue>, ) -> Result<(), BindingError>
target. An Err is the equivalent of the
setter throwing.Source§fn get_boxed(&self, target: &BoxedValue) -> Option<BoxedValue>
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>
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>
fn set_boxed( &self, target: &BoxedValue, value: Option<&BoxedValue>, ) -> Result<(), BindingError>
set for an owner known as an untyped handle.fn can_set(&self) -> bool
fn can_get(&self) -> bool
Source§fn property_type(&self) -> ValueType
fn property_type(&self) -> ValueType
Source§fn as_ferro_property(&self) -> Option<&'static FerroProperty>
fn as_ferro_property(&self) -> Option<&'static FerroProperty>
Source§impl MarkupTyped for ClrPropertyInfo
impl MarkupTyped for ClrPropertyInfo
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
Auto Trait Implementations§
impl !RefUnwindSafe for ClrPropertyInfo
impl !Send for ClrPropertyInfo
impl !Sync for ClrPropertyInfo
impl !UnwindSafe for ClrPropertyInfo
impl Freeze for ClrPropertyInfo
impl Unpin for ClrPropertyInfo
impl UnsafeUnpin for ClrPropertyInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more