Skip to main content

MarkupType

Struct MarkupType 

Source
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 str

The 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 str

The 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: bool

Whether 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

Source

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.

Source

pub fn namespace(&self) -> &'static str

The dotted, markup-facing namespace of the type.

Source

pub fn full_name(&self) -> String

The namespace-qualified name of the type.

Source

pub fn handle(&self) -> Option<ValueType>

The untyped (canonical) handle type of the type, if it has values.

Source

pub fn find_property(&self, name: &str) -> Option<&'static MarkupProperty>

The plain property name declared by this type (not by its base types).

Source

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.

Source

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.

Source

pub fn find_property_attributes(&self, name: &str) -> &'static [MarkupAttribute]

The attributes this type declares for its registered property name.

Source

pub fn find_methods<'a>( &self, name: &'a str, ) -> impl Iterator<Item = &'static MarkupMethod> + 'a

The methods named name declared by this type.

Source

pub fn find_field(&self, name: &str) -> Option<&'static MarkupField>

The static field name declared by this type.

Source

pub fn find_static_property( &self, name: &str, ) -> Option<&'static MarkupProperty>

The static property name declared by this type.

Source

pub fn find_event(&self, name: &str) -> Option<&'static MarkupEvent>

The event name declared by this type.

Source

pub fn find_attribute(&self, name: &str) -> Option<&'static MarkupAttribute>

The attribute name of the type.

Source

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

Source

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

Source

pub fn register_all(types: &[&'static MarkupType])

Registers several types; see register.

Source

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.

Source

pub fn find(namespace: &str, name: &str) -> Option<&'static MarkupType>

Finds a registered type by namespace and name.

Source

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

Source

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.

Source

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

Source

pub fn registered_types() -> Vec<&'static MarkupType>

Every registered type, in registration order.

Trait Implementations§

Source§

impl Clone for MarkupType

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for MarkupType

Source§

impl Debug for MarkupType

Source§

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

Formats the value using the given formatter. Read more

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

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 = !

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.