Skip to main content

TypeModel

Struct TypeModel 

Source
pub struct TypeModel {
Show 35 fields pub namespace: String, pub explicit_namespace: Option<String>, pub name: String, pub kind: TypeKind, pub object_model: bool, pub class_markup: bool, pub unregistered: bool, pub rust_path: RustType, pub public_path: Option<String>, pub stated_path: Option<String>, pub module: String, pub cfg: Vec<String>, pub handles: Vec<RustType>, pub this: Option<RustType>, pub base: Option<RustType>, pub interfaces: Vec<RustType>, pub generic: Option<GenericModel>, pub type_info: Option<RustType>, pub default_constructor: Option<CallableModel>, pub content_property: Option<String>, pub parse: Option<CallableModel>, pub parse_call: Option<CallForm>, pub constructors: Vec<MemberModel>, pub properties: Vec<PropertyModel>, pub static_properties: Vec<PropertyModel>, pub indexers: Vec<PropertyModel>, pub registered: Vec<RegisteredModel>, pub methods: Vec<MemberModel>, pub fields: Vec<MemberModel>, pub events: Vec<MemberModel>, pub enum_members: Vec<EnumMemberModel>, pub is_flags: bool, pub attributes: Vec<AttributeModel>, pub property_attributes: Vec<(String, Vec<AttributeModel>)>, pub notify_property_changed: Option<RustType>,
}
Expand description

A type of a crate (TypeModel).

Fields§

§namespace: String

The dotted namespace: the explicit one, else the one the namespace table of the crate gives the declaring module; empty when the table has none.

§explicit_namespace: Option<String>

namespace: ".." of the markup metadata.

§name: String

The markup name.

§kind: TypeKind§object_model: bool

The type is a type of the object model: a class (ferro_class!) or the static owner type of attached properties (ferro_static_type!), with a runtime type of its own. Its handles (Ref<X>, Option<Ref<X>> for a class) are implied.

§class_markup: bool

The class states markup metadata of its own (markup: { .. } of a ferro_class_info!): its runtime type has metadata, whatever the part lists.

§unregistered: bool

The crate has a list of the classes it registers (const TYPES: &[&TypeInfo], which its register_types() hands to TypeInfo::register_all) and the type is not in it: the type is not known by its name or by its handle until an instance of it is created. Never set for a crate without such a list, and never for a type that is not of the object model.

§rust_path: RustType

The Rust type: for a type the crate declares, the absolute path of the declaring module and the name; for a type the metadata is declared for, the type as the declaration writes it, normalised.

§public_path: Option<String>

The shortest path another crate names the type by, when the scanner found one (::ferroui_controls::Border).

§stated_path: Option<String>

The path the crate states for the type where no public path is found: the one of an instantiation of a generic type (generics: of ferro_rust_paths!), written with the name the crate has for the generic type and the public paths of its arguments (::ferroui_controls::FerroListOf<::ferroui_base::Ref<::ferroui_controls::RowDefinition>>).

§module: String

The module of the declaration that gives the type its namespace (ferroui_controls::border).

§cfg: Vec<String>

The cfg conditions the declaration is under, as written, outermost first.

§handles: Vec<RustType>

The Rust types that hold a value of the type, the untyped form first. For a class of the object model Ref<X> and Option<Ref<X>> are implied and not listed.

§this: Option<RustType>

The type instance members receive (this:).

§base: Option<RustType>

The base class of a class of the object model, or the base type by handle (base:).

§interfaces: Vec<RustType>

The contracts, by handle (interfaces:).

§generic: Option<GenericModel>§type_info: Option<RustType>

type_info: X: the runtime type the metadata of a static type belongs to.

§default_constructor: Option<CallableModel>

new: of a class: the constructor without parameters.

§content_property: Option<String>§parse: Option<CallableModel>

parse: (has_parse of the design is parse.is_some()); its typed function is __markup_parse.

§parse_call: Option<CallForm>

The call form of parse: (9.5.3), once it is chosen.

§constructors: Vec<MemberModel>§properties: Vec<PropertyModel>§static_properties: Vec<PropertyModel>§indexers: Vec<PropertyModel>§registered: Vec<RegisteredModel>§methods: Vec<MemberModel>§fields: Vec<MemberModel>§events: Vec<MemberModel>§enum_members: Vec<EnumMemberModel>§is_flags: bool§attributes: Vec<AttributeModel>§property_attributes: Vec<(String, Vec<AttributeModel>)>

The attributes of registered properties, by the name of the property.

§notify_property_changed: Option<RustType>

notify_property_changed: T.

Implementations§

Source§

impl TypeModel

Source

pub fn new( name: &str, kind: TypeKind, rust_path: RustType, module: &str, ) -> TypeModel

A type with nothing but its identity.

Source

pub fn full_name(&self) -> String

The namespace-qualified name (FerroUI.Controls.Border).

Source

pub fn registered(&self, name: &str) -> Option<&RegisteredModel>

The registered property of the type with the name name.

Source

pub fn named_path(&self) -> &str

The path generated code and other crates name the type by: the public path when the scanner found one, else the Rust type.

Source

pub fn visit_types_mut(&mut self, visit: &mut dyn FnMut(&mut RustType))

Calls visit with every type text of the type: its own, its handles, base and interfaces, and the types of its members and of the arguments of its attributes.

Source

pub fn visit_callables_mut(&mut self, visit: &mut dyn FnMut(&mut CallableModel))

Calls visit with every callable of the type that is a path: its constructors, parse:, the accessors of its properties, its members, and the sources of its registered properties.

Trait Implementations§

Source§

impl Clone for TypeModel

Source§

fn clone(&self) -> TypeModel

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 Debug for TypeModel

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for TypeModel

Source§

impl PartialEq for TypeModel

Source§

fn eq(&self, other: &TypeModel) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TypeModel

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> AnyValue for T
where T: PartialEq + 'static,

Source§

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

Source§

fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool

Source§

fn any_value_type_name(&self) -> &'static str

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> PropertyValue for T
where T: Clone + PartialEq + 'static,

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.