glib::subclass::boxed

Trait BoxedType

Source
pub trait BoxedType:
    StaticType
    + Clone
    + Sized
    + 'static {
    const NAME: &'static str;
    const ALLOW_NAME_CONFLICT: bool = false;
}
Expand description

Trait for defining boxed types.

Links together the type name with the type itself.

See register_boxed_type for registering an implementation of this trait with the type system.

Required Associated Constants§

Source

const NAME: &'static str

Boxed type name.

This must be unique in the whole process.

Provided Associated Constants§

Source

const ALLOW_NAME_CONFLICT: bool = false

Allow name conflicts for this boxed type.

By default, trying to register a type with a name that was registered before will panic. If this is set to true then a new name will be selected by appending a counter.

This is useful for defining new types in Rust library crates that might be linked multiple times in the same process.

A consequence of setting this to true is that it’s not guaranteed that glib::Type::from_name(Self::NAME).unwrap() == Self::static_type().

Optional.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§