1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use crate::{CssParserWarning, Ordering};
use glib::error::ErrorDomain;
use glib::translate::*;
use glib::Quark;
use std::cmp;
impl From<cmp::Ordering> for Ordering {
fn from(o: cmp::Ordering) -> Self {
skip_assert_initialized!();
match o {
cmp::Ordering::Equal => Self::Equal,
cmp::Ordering::Greater => Self::Larger,
cmp::Ordering::Less => Self::Smaller,
}
}
}
impl From<Ordering> for cmp::Ordering {
fn from(o: Ordering) -> Self {
skip_assert_initialized!();
match o {
Ordering::Equal => Self::Equal,
Ordering::Larger => Self::Greater,
Ordering::Smaller => Self::Less,
Ordering::__Unknown(_) => unreachable!(),
}
}
}
impl ErrorDomain for CssParserWarning {
fn domain() -> Quark {
skip_assert_initialized!();
unsafe { from_glib(ffi::gtk_css_parser_warning_quark()) }
}
fn code(self) -> i32 {
self.into_glib()
}
fn from(code: i32) -> Option<Self> {
skip_assert_initialized!();
match code {
ffi::GTK_CSS_PARSER_WARNING_DEPRECATED => Some(Self::Deprecated),
ffi::GTK_CSS_PARSER_WARNING_SYNTAX => Some(Self::Syntax),
ffi::GTK_CSS_PARSER_WARNING_UNIMPLEMENTED => Some(Self::Unimplemented),
value => Some(Self::__Unknown(value)),
}
}
}