Struct PropertyType

pub struct PropertyType<T> { /* private fields */ }
Expand description

An instance of a PropertyType represents a single property type in the Kanzi property system. A property type exists throughout the lifetime of an application, including the property types that you create during the runtime of an application.

Implementations§

§

impl<T> PropertyType<T>

pub const fn as_ptr(&self) -> *mut PropertyTypeWrapper

pub fn get_native(&self) -> Result<NonNull<c_void>, Error>

Gets a pointer to the backing C++ instance.

§

impl<T> PropertyType<T>

pub fn compare(&self, rhs: &PropertyType<T>) -> Result<bool, Error>

Compares two property types.

pub fn is_inherited(&self) -> Result<bool, Error>

pub fn get_change_flags(&self) -> Result<ChangeFlags, Error>

pub fn get_data_type(&self) -> Result<PropertyDataType, Error>

pub fn get_name(&self) -> Result<KanziString, Error>

Gets name of the property type.

pub fn get_editor_info(&self) -> Result<Option<EditorInfo>, Error>

Gets editor info for the property type.

§

impl PropertyType<()>

pub fn cast<T>(self) -> Result<Option<PropertyType<T>>, Error>

Casts AbstractPropertyType to a more concrete type.

pub fn cast_ref<T>(&self) -> Result<Option<&PropertyType<T>>, Error>

Casts AbstractPropertyType reference to a more concrete type.

pub unsafe fn cast_unchecked<T>(self) -> PropertyType<T>

Casts AbstractPropertyType to a more concrete type.

§Safety

The caller must ensure that T matches the internal property type.

pub unsafe fn cast_ref_unchecked<T>(&self) -> &PropertyType<T>

Casts AbstractPropertyType reference to a more concrete type.

§Safety

The caller must ensure that T matches the internal property type.

pub fn find( domain: &Domain, name: impl AsRef<KanziStr>, ) -> Result<Option<PropertyType<()>>, Error>

Finds a registered property type by name.

§Returns

If None is returned, property was not found.

pub fn debug_string(&self, object: &Object) -> Result<String, Error>

Constructs a debug string containing the property value of a provided Object.

§

impl<T> PropertyType<T>

pub fn as_abstract(&self) -> &PropertyType<()>

Casts a PropertyType reference to its abstract representation.

pub fn to_abstract(self) -> PropertyType<()>

Casts a PropertyType to its abstract representation. Useful for returning a typed PropertyType in callbacks that expect a generic PropertyType.

pub fn get_default_value( &self, ) -> Result<<T as VariantConstraint>::RetArg, Error>

Gets the default value of a property type. When no other value is available, property functions return the default value.

pub fn find( domain: &Domain, name: impl AsRef<KanziStr>, ) -> Result<PropertyType<T>, Error>

Finds a registered property type by name.

§Errors

Returns an OBJECT_NOT_FOUND error if the property is not found, or a TYPE_MISMATCH error if the property exists but cannot be cast to the required type.

pub fn debug_string(&self, object: &Object) -> Result<String, Error>

Constructs a debug string representing the property value of an Object.

Trait Implementations§

§

impl<T> Clone for PropertyType<T>

§

fn clone(&self) -> PropertyType<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<T> Debug for PropertyType<T>

§

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

Formats the value using the given formatter. Read more
§

impl<T> Drop for PropertyType<T>

§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

impl<T> PartialEq for PropertyType<T>

§

fn eq(&self, rhs: &PropertyType<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<T> Eq for PropertyType<T>

§

impl<T> Sync for PropertyType<T>

Auto Trait Implementations§

§

impl<T> Freeze for PropertyType<T>

§

impl<T> RefUnwindSafe for PropertyType<T>
where T: RefUnwindSafe,

§

impl<T> !Send for PropertyType<T>

§

impl<T> Unpin for PropertyType<T>
where T: Unpin,

§

impl<T> UnwindSafe for PropertyType<T>
where T: UnwindSafe,

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
§

impl<T> AsAny for T
where T: 'static,

§

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

§

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

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Inherits<T> for T

§

fn upcast(self) -> Base

§

fn upcast_ref(&self) -> &Base

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.