gdk_pixbuf::subclass::prelude

Trait SharedType

source
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§

source

const NAME: &'static str

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

Required Associated Types§

source

type RefCountedType: RefCounted

The inner refcounted type

Required Methods§

source

fn into_refcounted(self) -> Self::RefCountedType

Converts the SharedType into its inner RefCountedType

source

fn from_refcounted(this: Self::RefCountedType) -> Self

Constructs a SharedType from a RefCountedType

Object Safety§

This trait is not object safe.

Implementors§