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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
use Filter;
use NewLineFormat;
use ParamEncodingMethod;
use ffi;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
glib_wrapper! {
pub struct FormatOptions(Boxed<ffi::GMimeFormatOptions>);
match fn {
copy => |ptr| gobject_ffi::g_boxed_copy(ffi::g_mime_format_options_get_type(), ptr as *mut _) as *mut ffi::GMimeFormatOptions,
free => |ptr| gobject_ffi::g_boxed_free(ffi::g_mime_format_options_get_type(), ptr as *mut _),
get_type => || ffi::g_mime_format_options_get_type(),
}
}
impl FormatOptions {
pub fn new() -> FormatOptions {
unsafe {
from_glib_full(ffi::g_mime_format_options_new())
}
}
pub fn add_hidden_header(&mut self, header: &str) {
unsafe {
ffi::g_mime_format_options_add_hidden_header(self.to_glib_none_mut().0, header.to_glib_none().0);
}
}
pub fn clear_hidden_headers(&mut self) {
unsafe {
ffi::g_mime_format_options_clear_hidden_headers(self.to_glib_none_mut().0);
}
}
pub fn clone(&mut self) -> Option<FormatOptions> {
unsafe {
from_glib_full(ffi::g_mime_format_options_clone(self.to_glib_none_mut().0))
}
}
pub fn create_newline_filter(&mut self, ensure_newline: bool) -> Option<Filter> {
unsafe {
from_glib_full(ffi::g_mime_format_options_create_newline_filter(self.to_glib_none_mut().0, ensure_newline.to_glib()))
}
}
pub fn get_newline(&mut self) -> Option<String> {
unsafe {
from_glib_none(ffi::g_mime_format_options_get_newline(self.to_glib_none_mut().0))
}
}
pub fn get_newline_format(&mut self) -> NewLineFormat {
unsafe {
from_glib(ffi::g_mime_format_options_get_newline_format(self.to_glib_none_mut().0))
}
}
pub fn get_param_encoding_method(&mut self) -> ParamEncodingMethod {
unsafe {
from_glib(ffi::g_mime_format_options_get_param_encoding_method(self.to_glib_none_mut().0))
}
}
pub fn is_hidden_header(&mut self, header: &str) -> bool {
unsafe {
from_glib(ffi::g_mime_format_options_is_hidden_header(self.to_glib_none_mut().0, header.to_glib_none().0))
}
}
pub fn remove_hidden_header(&mut self, header: &str) {
unsafe {
ffi::g_mime_format_options_remove_hidden_header(self.to_glib_none_mut().0, header.to_glib_none().0);
}
}
pub fn set_newline_format(&mut self, newline: NewLineFormat) {
unsafe {
ffi::g_mime_format_options_set_newline_format(self.to_glib_none_mut().0, newline.to_glib());
}
}
pub fn set_param_encoding_method(&mut self, method: ParamEncodingMethod) {
unsafe {
ffi::g_mime_format_options_set_param_encoding_method(self.to_glib_none_mut().0, method.to_glib());
}
}
pub fn get_default() -> Option<FormatOptions> {
unsafe {
from_glib_full(ffi::g_mime_format_options_get_default())
}
}
}
impl Default for FormatOptions {
fn default() -> Self {
Self::new()
}
}