[]Struct gio::Icon

pub struct Icon(_, _);

Icon is a very minimal interface for icons. It provides functions for checking the equality of two icons, hashing of icons and serializing an icon to and from strings.

Icon does not provide the actual pixmap for the icon as this is out of GIO's scope, however implementations of Icon may contain the name of an icon (see ThemedIcon), or the path to an icon (see LoadableIcon).

To obtain a hash of a Icon, see Icon::hash.

To check if two GIcons are equal, see Icon::equal.

For serializing a Icon, use Icon::serialize and Icon::deserialize.

If you want to consume Icon (for example, in a toolkit) you must be prepared to handle at least the three following cases: LoadableIcon, ThemedIcon and EmblemedIcon. It may also make sense to have fast-paths for other cases (like handling GdkPixbuf directly, for example) but all compliant Icon implementations outside of GIO must implement LoadableIcon.

If your application or library provides one or more Icon implementations you need to ensure that your new implementation also implements LoadableIcon. Additionally, you must provide an implementation of Icon::serialize that gives a result that is understood by Icon::deserialize, yielding one of the built-in icon types.

Implements

IconExt

Implementations

impl Icon[src]

pub fn deserialize(value: &Variant) -> Option<Icon>[src]

Deserializes a Icon previously serialized using Icon::serialize.

value

a glib::Variant created with Icon::serialize

Returns

a Icon, or None when deserialization fails.

pub fn hash(&self) -> u32[src]

Gets a hash for an icon.

icon

gconstpointer to an icon object.

Returns

a guint containing a hash for the icon, suitable for use in a glib::HashTable or similar data structure.

pub fn new_for_string(str: &str) -> Result<Icon, Error>[src]

Generate a Icon instance from str. This function can fail if str is not valid - see Icon::to_string for discussion.

If your application or library provides one or more Icon implementations you need to ensure that each glib::Type is registered with the type system prior to calling Icon::new_for_string.

str

A string obtained via Icon::to_string.

Returns

An object implementing the Icon interface or None if error is set.

Trait Implementations

impl Clone for Icon

impl Debug for Icon

impl Display for Icon[src]

impl Eq for Icon

impl Hash for Icon

impl IsA<Icon> for BytesIcon

impl IsA<Icon> for Emblem

impl IsA<Icon> for EmblemedIcon

impl IsA<Icon> for FileIcon

impl IsA<Icon> for LoadableIcon

impl IsA<Icon> for ThemedIcon

impl Ord for Icon

impl<T: ObjectType> PartialEq<T> for Icon

impl<T: ObjectType> PartialOrd<T> for Icon

impl StaticType for Icon

Auto Trait Implementations

impl RefUnwindSafe for Icon

impl !Send for Icon

impl !Sync for Icon

impl Unpin for Icon

impl UnwindSafe for Icon

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Super, Sub> CanDowncast<Sub> for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 

impl<T> Cast for T where
    T: ObjectType, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ObjectExt for T where
    T: ObjectType, 

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 

type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.