pub struct MarkupType {Show 28 fields
pub name: &'static str,
pub explicit_namespace: Option<&'static str>,
pub module_path: &'static str,
pub kind: MarkupTypeKind,
pub handles: &'static [TypeOf],
pub nullable: Option<TypeOf>,
pub type_info: Option<fn() -> &'static TypeInfo>,
pub base: Option<TypeOf>,
pub interfaces: &'static [TypeOf],
pub generic: Option<MarkupGeneric>,
pub content_property: Option<&'static str>,
pub parse: Option<MarkupInvoke>,
pub constructors: &'static [MarkupConstructor],
pub properties: &'static [MarkupProperty],
pub indexers: &'static [MarkupIndexer],
pub property_attributes: &'static [(&'static str, &'static [MarkupAttribute])],
pub methods: &'static [MarkupMethod],
pub fields: &'static [MarkupField],
pub static_properties: &'static [MarkupProperty],
pub events: &'static [MarkupEvent],
pub enum_members: &'static [MarkupEnumMember],
pub is_flags: bool,
pub enum_from_value: Option<fn(i64) -> Option<BoxedValue>>,
pub enum_to_value: Option<fn(&dyn AnyValue) -> Option<i64>>,
pub attributes: &'static [MarkupAttribute],
pub notify_property_changed: Option<fn(&dyn AnyValue) -> Option<&dyn INotifyPropertyChanged>>,
pub this: CompilerMetadata<Option<TypeOf>>,
pub value: CompilerMetadata<Option<TypeOf>>,
}Expand description
The markup metadata of a type. Built by the declaration macros as constant data; see the module documentation.
Fields§
§name: &'static strThe type name, without namespace, as markup spells it.
explicit_namespace: Option<&'static str>The dotted namespace, when it is not the namespace registered for
module_path (types that mirror runtime library
types state "System" here).
module_path: &'static strThe Rust module that declares the type (module_path!()).
kind: MarkupTypeKind§handles: &'static [TypeOf]The Rust types values of this type are held in, the untyped
(canonical) form first: [Ref<T>, Option<Ref<T>>] for a class,
[T, Rc<T>, Option<Rc<T>>] for a reference type, [T] for a
value type (its nullable form Option<T> is a type of its own, as
in the managed original), [Rc<dyn I>, Option<Rc<dyn I>>] for a
contract. Empty for static types.
nullable: Option<TypeOf>The nullable form of a value type or enumeration (Option<T>), which
is a type of its own (the Nullable<T> of the managed original).
None for every other kind of type.
type_info: Option<fn() -> &'static TypeInfo>The class of the object model this metadata belongs to, if any.
base: Option<TypeOf>The base type (by one of its handles). Classes of the object model
leave this empty: their base is TypeInfo::base_type.
interfaces: &'static [TypeOf]The contracts the type implements (by their handles), in addition to the ones of its base type.
generic: Option<MarkupGeneric>§content_property: Option<&'static str>The name of the content property (the [Content] attribute of the
managed original). Inherited by deriving types.
parse: Option<MarkupInvoke>Converts text to a value of the type: (text) -> value. The
Parse(string) method of the managed original.
constructors: &'static [MarkupConstructor]§properties: &'static [MarkupProperty]§indexers: &'static [MarkupIndexer]The indexers the type declares (not the ones of its base types), in declaration order.
property_attributes: &'static [(&'static str, &'static [MarkupAttribute])]Attributes of REGISTERED properties (styled, direct, attached) the
type declares or owns, by property name. Registered properties need
no declaration; this only carries what the property system does not
know about them ([DependsOn], [ResolveByName],
[InheritDataTypeFromItems], [TemplateContent], …).
methods: &'static [MarkupMethod]§fields: &'static [MarkupField]The static fields and constants (static readonly / const of the
managed original).
static_properties: &'static [MarkupProperty]The static properties (static T Name { get; set; } of the managed
original): the accessors take no instance, get is () -> value
and set is (value).
events: &'static [MarkupEvent]§enum_members: &'static [MarkupEnumMember]§is_flags: boolWhether an enumeration is a set of flags.
enum_from_value: Option<fn(i64) -> Option<BoxedValue>>Converts a numeric value to a value of the enumeration: the cast
(TEnum)value of the managed original. For a plain enumeration the
value must be the value of a member; for a set of flags any
combination of the bits of its members.
enum_to_value: Option<fn(&dyn AnyValue) -> Option<i64>>The numeric value of a value of the enumeration: the cast
(int)value of the managed original. None for a value that is not
of the enumeration type.
attributes: &'static [MarkupAttribute]§notify_property_changed: Option<fn(&dyn AnyValue) -> Option<&dyn INotifyPropertyChanged>>Views an untyped value of this type as a source of property change
notifications (the INotifyPropertyChanged of the managed original),
for types that are not classes of the object model: view models.
Bindings resolved through metadata (reflection bindings, compiled
bindings built at run time) subscribe through it; None means the
properties of the type are read once.
this: CompilerMetadata<Option<TypeOf>>The Rust type instance members receive (&This): the this: of the
declaration, else the declared type (Ref<Class> for a class). The
typed functions of the instance members (MarkupEmit) take it.
value: CompilerMetadata<Option<TypeOf>>The Rust type of a value of the type as its constructors and its
Parse return it, and so their typed functions (MarkupEmit):
the instance type when the declaration states this:, else the
first of its handles, else the declared type (Rc<dyn Trait> for a
contract). Ref<Class> for a class.
Implementations§
Source§impl MarkupType
impl MarkupType
Sourcepub const fn new(
name: &'static str,
kind: MarkupTypeKind,
module_path: &'static str,
) -> Self
pub const fn new( name: &'static str, kind: MarkupTypeKind, module_path: &'static str, ) -> Self
Metadata that states nothing but the name and kind of the type.
Sourcepub fn handle(&self) -> Option<ValueType>
pub fn handle(&self) -> Option<ValueType>
The untyped (canonical) handle type of the type, if it has values.
Sourcepub fn find_property(&self, name: &str) -> Option<&'static MarkupProperty>
pub fn find_property(&self, name: &str) -> Option<&'static MarkupProperty>
The plain property name declared by this type (not by its base
types).
Sourcepub fn find_indexer(
&self,
parameter_count: usize,
) -> Option<&'static MarkupIndexer>
pub fn find_indexer( &self, parameter_count: usize, ) -> Option<&'static MarkupIndexer>
The indexer this type declares (not its base types) that takes
parameter_count index arguments.
Sourcepub fn base_type(&self) -> Option<&'static MarkupType>
pub fn base_type(&self) -> Option<&'static MarkupType>
The registered metadata of the base type (base): for
a class of the object model the metadata of the nearest base class
that has any, otherwise the registered type that the base handle
belongs to. This is how untyped code walks the hierarchy of a type,
as reflection walks base classes.
Sourcepub fn find_property_attributes(&self, name: &str) -> &'static [MarkupAttribute]
pub fn find_property_attributes(&self, name: &str) -> &'static [MarkupAttribute]
The attributes this type declares for its registered property name.
Sourcepub fn find_methods<'a>(
&self,
name: &'a str,
) -> impl Iterator<Item = &'static MarkupMethod> + 'a
pub fn find_methods<'a>( &self, name: &'a str, ) -> impl Iterator<Item = &'static MarkupMethod> + 'a
The methods named name declared by this type.
Sourcepub fn find_field(&self, name: &str) -> Option<&'static MarkupField>
pub fn find_field(&self, name: &str) -> Option<&'static MarkupField>
The static field name declared by this type.
Sourcepub fn find_static_property(
&self,
name: &str,
) -> Option<&'static MarkupProperty>
pub fn find_static_property( &self, name: &str, ) -> Option<&'static MarkupProperty>
The static property name declared by this type.
Sourcepub fn find_event(&self, name: &str) -> Option<&'static MarkupEvent>
pub fn find_event(&self, name: &str) -> Option<&'static MarkupEvent>
The event name declared by this type.
Sourcepub fn find_attribute(&self, name: &str) -> Option<&'static MarkupAttribute>
pub fn find_attribute(&self, name: &str) -> Option<&'static MarkupAttribute>
The attribute name of the type.
Sourcepub fn find_enum_member(
&self,
name: &str,
ignore_case: bool,
) -> Option<&'static MarkupEnumMember>
pub fn find_enum_member( &self, name: &str, ignore_case: bool, ) -> Option<&'static MarkupEnumMember>
The enumeration member name; ignore_case as the managed
Enum.Parse(.., ignoreCase).
Sourcepub fn register(type_: &'static MarkupType)
pub fn register(type_: &'static MarkupType)
Adds a type to the process-wide table of types with markup metadata,
making it discoverable with find and
find_by_handle. Registering a type again
does nothing.
A crate registers its types from its register_types() function.
The metadata of a class of the object model needs no registration to
be reachable from its runtime type (TypeInfo::markup).
Sourcepub fn register_all(types: &[&'static MarkupType])
pub fn register_all(types: &[&'static MarkupType])
Registers several types; see register.
Sourcepub fn register_handle<H: 'static>(type_: &'static MarkupType)
pub fn register_handle<H: 'static>(type_: &'static MarkupType)
Registers the Rust type H as one more handle of the registered type type_: a
type of another crate whose values are values of type_ (a wrapper a property
holds the value in), next to the handles the declaration lists.
The crate that declares H also registers the casts between H and the handles
of the type (ValueTypes::register_cast). A handle that is already known keeps
its type.
Sourcepub fn find(namespace: &str, name: &str) -> Option<&'static MarkupType>
pub fn find(namespace: &str, name: &str) -> Option<&'static MarkupType>
Finds a registered type by namespace and name.
Sourcepub fn find_by_handle(handle: TypeId) -> Option<&'static MarkupType>
pub fn find_by_handle(handle: TypeId) -> Option<&'static MarkupType>
Finds the registered type that values of the Rust type handle are
values of (any of its handles).
Sourcepub fn find_by_nullable_handle(handle: TypeId) -> Option<&'static MarkupType>
pub fn find_by_nullable_handle(handle: TypeId) -> Option<&'static MarkupType>
Finds the registered value type or enumeration whose nullable form
(nullable) is the Rust type handle.
Sourcepub fn find_by_type_info(
type_: &'static TypeInfo,
) -> Option<&'static MarkupType>
pub fn find_by_type_info( type_: &'static TypeInfo, ) -> Option<&'static MarkupType>
Finds the registered metadata that belongs to the runtime type
type_ (type_info): the metadata of a static
type declared with ferro_markup_type!(static X { type_info: X, .. }).
(The metadata of a class is its TypeInfo::markup.)
Sourcepub fn registered_types() -> Vec<&'static MarkupType>
pub fn registered_types() -> Vec<&'static MarkupType>
Every registered type, in registration order.
Trait Implementations§
Source§impl Clone for MarkupType
impl Clone for MarkupType
impl Copy for MarkupType
Auto Trait Implementations§
impl Freeze for MarkupType
impl RefUnwindSafe for MarkupType
impl Send for MarkupType
impl Sync for MarkupType
impl Unpin for MarkupType
impl UnsafeUnpin for MarkupType
impl UnwindSafe for MarkupType
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