# Trait glib::error::ErrorDomain [−] [src]

    pub trait ErrorDomain: Copy {
        fn domain() -> GQuark;
        fn code(self) -> i32;
        fn from(code: i32) -> Option<Self>
        where
            Self: Sized;
    }

`GLib` error domain.

This trait is implemented by error enums that represent error domains (types).

## Required Methods

### `fn domain() -> GQuark`

Returns the quark identifying the error domain.

As returned from `g_some_error_quark`.

### `fn code(self) -> i32`

Gets the integer representation of the variant.

### `fn from(code: i32) -> Option<Self> where
Self: Sized,`

Tries to convert an integer code to an enum variant.

By convention, the `Failed` variant, if present, is a catch-all, i.e. any unrecognized codes map to it.

## Implementors

- [src]
  `impl ErrorDomain for KeyFileError`
- [src]
  `impl ErrorDomain for FileError`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
↑
  Move up in search results
↓
  Move down in search results
↹
  Switch tab
⏎
  Go to active search result
+ / -
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)