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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
use glib::translate::*;
use std::fmt;
glib::wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct FileAttributeMatcher(Shared<ffi::GFileAttributeMatcher>);
match fn {
ref => |ptr| ffi::g_file_attribute_matcher_ref(ptr),
unref => |ptr| ffi::g_file_attribute_matcher_unref(ptr),
type_ => || ffi::g_file_attribute_matcher_get_type(),
}
}
impl FileAttributeMatcher {
#[doc(alias = "g_file_attribute_matcher_new")]
pub fn new(attributes: &str) -> FileAttributeMatcher {
unsafe {
from_glib_full(ffi::g_file_attribute_matcher_new(
attributes.to_glib_none().0,
))
}
}
#[doc(alias = "g_file_attribute_matcher_enumerate_namespace")]
pub fn enumerate_namespace(&self, ns: &str) -> bool {
unsafe {
from_glib(ffi::g_file_attribute_matcher_enumerate_namespace(
self.to_glib_none().0,
ns.to_glib_none().0,
))
}
}
#[doc(alias = "g_file_attribute_matcher_matches")]
pub fn matches(&self, attribute: &str) -> bool {
unsafe {
from_glib(ffi::g_file_attribute_matcher_matches(
self.to_glib_none().0,
attribute.to_glib_none().0,
))
}
}
#[doc(alias = "g_file_attribute_matcher_matches_only")]
pub fn matches_only(&self, attribute: &str) -> bool {
unsafe {
from_glib(ffi::g_file_attribute_matcher_matches_only(
self.to_glib_none().0,
attribute.to_glib_none().0,
))
}
}
#[doc(alias = "g_file_attribute_matcher_subtract")]
#[must_use]
pub fn subtract(
&self,
subtract: Option<&FileAttributeMatcher>,
) -> Option<FileAttributeMatcher> {
unsafe {
from_glib_full(ffi::g_file_attribute_matcher_subtract(
self.to_glib_none().0,
subtract.to_glib_none().0,
))
}
}
#[doc(alias = "g_file_attribute_matcher_to_string")]
#[doc(alias = "to_string")]
pub fn to_str(&self) -> glib::GString {
unsafe {
from_glib_full(ffi::g_file_attribute_matcher_to_string(
self.to_glib_none().0,
))
}
}
}
impl fmt::Display for FileAttributeMatcher {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(&self.to_str())
}
}