pub trait SharedType:
Sized
+ StaticType
+ Clone
+ 'static {
type RefCountedType: RefCounted;
const NAME: &'static str;
const ALLOW_NAME_CONFLICT: bool = false;
// Required methods
fn into_refcounted(self) -> Self::RefCountedType;
fn from_refcounted(this: Self::RefCountedType) -> Self;
}
Expand description
Trait for defining shared types.
Links together the type name with the type itself.
See register_shared_type
for registering an implementation of this trait
with the type system.
Required Associated Constants§
Provided Associated Constants§
sourceconst ALLOW_NAME_CONFLICT: bool = false
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.
Required Associated Types§
sourcetype RefCountedType: RefCounted
type RefCountedType: RefCounted
The inner refcounted type
Required Methods§
sourcefn into_refcounted(self) -> Self::RefCountedType
fn into_refcounted(self) -> Self::RefCountedType
Converts the SharedType into its inner RefCountedType
sourcefn from_refcounted(this: Self::RefCountedType) -> Self
fn from_refcounted(this: Self::RefCountedType) -> Self
Constructs a SharedType from a RefCountedType