FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    MarkupType

    struct · ferroui-base · v0.5.0

    struct MarkupType
    

    The markup metadata of a type. Built by the declaration macros as constant data; see the module documentation.

    A MarkupType is built only through MarkupType::new and the struct update syntax (MarkupType { events: .., ..MarkupType::new(name, kind, module_path!()) }): its fields grow with the compiler metadata of the markup compiler, and an added field is not a breaking change of the API (docs/release.md, "API stability").

    View source

    Members

    name

    name: &'static str
    

    The type name, without namespace, as markup spells it.

    Source

    explicit_namespace

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

    Source

    module_path

    module_path: &'static str
    

    The Rust module that declares the type (module_path!()).

    Source

    kind

    kind: MarkupTypeKind
    

    Source

    handles

    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.

    Source

    nullable

    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.

    Source

    type_info

    type_info: Option<fn() -> &'static crate::TypeInfo>
    

    The class of the object model this metadata belongs to, if any.

    Source

    base

    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.

    Source

    interfaces

    interfaces: &'static [TypeOf]
    

    The contracts the type implements (by their handles), in addition to the ones of its base type.

    Source

    generic

    generic: Option<MarkupGeneric>
    

    Source

    content_property

    content_property: Option<&'static str>
    

    The name of the content property (the [Content] attribute of the managed original). Inherited by deriving types.

    Source

    parse

    parse: Option<MarkupInvoke>
    

    Converts text to a value of the type: (text) -> value. The Parse(string) method of the managed original.

    Source

    constructors

    constructors: &'static [MarkupConstructor]
    

    Source

    properties

    properties: &'static [MarkupProperty]
    

    Source

    indexers

    indexers: &'static [MarkupIndexer]
    

    The indexers the type declares (not the ones of its base types), in declaration order.

    Source

    property_attributes

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

    Source

    methods

    methods: &'static [MarkupMethod]
    

    Source

    fields

    fields: &'static [MarkupField]
    

    The static fields and constants (static readonly / const of the managed original).

    Source

    static_properties

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

    Source

    events

    events: &'static [MarkupEvent]
    

    Source

    enum_members

    enum_members: &'static [MarkupEnumMember]
    

    Source

    is_flags

    is_flags: bool
    

    Whether an enumeration is a set of flags.

    Source

    enum_from_value

    enum_from_value: Option<fn(i64) -> Option<crate::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.

    Source

    enum_to_value

    enum_to_value: Option<fn(&dyn crate::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.

    Source

    enum_i32_factory

    enum_i32_factory: CompilerMetadata<Option<&'static str>>
    

    Explicit associated function fn(i32) -> enum value on the public metadata carrier, for unnamed numeric literals of an open plain enumeration. Declares support for every signed Int32 value; absent for closed enums. Compiler metadata names the typed function; it never guesses a constructor.

    Source

    attributes

    attributes: &'static [MarkupAttribute]
    

    Source

    notify_property_changed

    notify_property_changed: Option<fn(&dyn crate::AnyValue) -> Option<&dyn crate::data::model::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.

    Source

    this

    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.

    Source

    value

    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.

    Source

    owner_rust_name

    owner_rust_name: CompilerMetadata<Option<fn() -> &'static str>>
    

    The actual Rust declaration that owns the typed metadata functions. It can differ from this/value for external-model descriptor carriers. Compiler-only, like the typed function and public-path tables.

    Source

    value_types

    value_types: Option<fn() -> ()>
    

    Registers the declared type with the untyped value conversions when the metadata becomes known (#566): the ValueTypeRegistration of the type, when it has one, made a used type (ValueTypes::register_used). The declaration macros state it; it does nothing for a type without registrations. It runs once, when the metadata is first registered: as the value type of a property of a registered type, as a type of an application, or with the tables of types.

    Source

    new

    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

    namespace

    fn namespace(self: &Self) -> &'static str
    

    The dotted, markup-facing namespace of the type.

    Source

    full_name

    fn full_name(self: &Self) -> String
    

    The namespace-qualified name of the type.

    Source

    handle

    fn handle(self: &Self) -> Option<ValueType>
    

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

    Source

    find_property

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

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

    Source

    find_indexer

    fn find_indexer(self: &Self, parameter_count: usize) -> Option<&'static MarkupIndexer>
    

    The indexer this type declares (not its base types) that takes parameter_count index arguments.

    Source

    base_type

    fn base_type(self: &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

    find_property_attributes

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

    The attributes this type declares for its registered property name.

    Source

    find_methods

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

    The methods named name declared by this type.

    Source

    find_field

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

    The static field name declared by this type.

    Source

    find_static_property

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

    The static property name declared by this type.

    Source

    find_event

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

    The event name declared by this type.

    Source

    find_attribute

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

    The attribute name of the type.

    Source

    find_enum_member

    fn find_enum_member(self: &Self, name: &str, ignore_case: bool) -> Option<&'static MarkupEnumMember>
    

    The enumeration member name; ignore_case as the managed Enum.Parse(.., ignoreCase).

    Source

    find_enum_member_of

    fn find_enum_member_of(self: &Self, value: &dyn crate::AnyValue) -> Option<&'static MarkupEnumMember>
    

    The first enumeration member that value (a value of the enumeration type) is: the member with its numeric value. None for a value of another type and for a combination of flags that is no member.

    Source

    register

    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.

    Always registers. An application registers its own types with this function; a crate of the framework registers its table of types from its register_types() function with register_table. The metadata of a class of the object model needs no registration to be reachable from its runtime type (TypeInfo::markup).

    Source

    register_all

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

    Registers several types; see register.

    Always registers. An application registers its own types with this function or register; a crate of the framework registers its table of types with register_table.

    Source

    register_table

    fn register_table(types: &[&'static MarkupType])
    

    Registers the table of types of a crate of the framework, at start-up from the crate's register_types() function; as register_all. Without the feature type-tables the table is trimmed: this does nothing, and what only the table reaches is left out of the binary. An application registers its own types with register or register_all, which always register.

    Source

    register_used

    fn register_used(type_: &'static MarkupType)
    

    Registers the metadata of a type that is used: the value type of a property, when the property is registered (ferro_property!). What finds metadata by handle (the text of an enumeration member, the parsing of text) then knows the type with the tables of types trimmed. With type-tables the tables already hold every type, and this does nothing.

    Source

    register_handle

    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

    find

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

    Finds a registered type by namespace and name.

    Source

    find_by_handle

    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

    find_by_nullable_handle

    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

    find_by_type_info

    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

    registered_types

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

    Every registered type, in registration order.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ErasedDestructor
    • IntoEither
    • Clone
    • Copy
    • Debug

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.