Struct Metaclass

pub struct Metaclass<T = Borrowed> { /* private fields */ }
Expand description

Metaclass provides type inspection mechanism for Kanzi classes.

Classes deriving from Object can register information about their type, properties, methods, messages by using Metaclass and accompanying macros.

Such information is used by serialization, scripting and to display friendly type information in Kanzi Studio.

Implementations§

§

impl<T> Metaclass<T>

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

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

Gets a pointer to the backing C++ instance.

§

impl Metaclass

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

Finds an existing metaclass by name.

§

impl Metaclass

pub fn get_property_type_iterator(&self) -> Result<PropertyTypeIterator, Error>

Gets iterator over properties defined on a provided Metaclass.

pub fn get_property_types(&self) -> Result<Vec<PropertyType<()>>, Error>

Gets all properties defined on a provided Metaclass.

pub fn get_message_type_iterator(&self) -> Result<MessageTypeIterator, Error>

Gets iterator over messages defined on a provided Metaclass.

pub fn get_message_types( &self, ) -> Result<Vec<MessageType<MessageArguments>>, Error>

Gets all messages defined on a provided Metaclass.

pub fn get_nested_metaclass_iterator( &self, ) -> Result<NestedMetaclassIterator, Error>

Gets iterator over nested metaclasses defined on a provided Metaclass.

pub fn get_nested_metaclasses(&self) -> Result<Vec<Metaclass>, Error>

Gets all nested metaclasses defined on a provided Metaclass.

§

impl<T> Metaclass<T>

pub fn create_instance( &self, domain: &Domain, name: impl AsRef<KanziStr>, ) -> Result<Option<Object>, Error>

Creates an instance of a class this metaclass describes.

§Returns
  • If None is returned, metaclass doesn’t specify Object as a base metaclass.

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

Compares two metaclasses.

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

Gets the fully qualified name of the message type.

assert_eq!(
    Node2D::get_static_metaclass().get_name()?,
    "Kanzi.Node2D",
);

pub fn get_base(&self) -> Result<Option<Metaclass<T>>, Error>

Determines whether the class this metaclass describes derives from a class described by specified metaclass.

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

Gets editor info for the specified metaclass.

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

Determines whether the class this metaclass describes derives from a class described by specified metaclass.

pub fn is_derived_from<E>(&self, base: &Metaclass<E>) -> Result<bool, Error>

Determines whether the class this metaclass describes derives from a class described by specified metaclass.

Trait Implementations§

§

impl<T> Debug for Metaclass<T>

§

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

Formats the value using the given formatter. Read more
§

impl<T> Drop for Metaclass<T>

§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

impl<T, E> PartialEq<Metaclass<E>> for Metaclass<T>

§

fn eq(&self, rhs: &Metaclass<E>) -> 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 Metaclass<T>

§

impl<T> Send for Metaclass<T>

§

impl<T> Sync for Metaclass<T>

Auto Trait Implementations§

§

impl<T> Freeze for Metaclass<T>

§

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

§

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

§

impl<T> UnwindSafe for Metaclass<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> 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, 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.