nm_rs/auto/
ip_routing_rule.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir
3// from gtk-girs (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5
6use crate::ffi;
7#[cfg(feature = "v1_18")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
9use glib::translate::*;
10
11glib::wrapper! {
12    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
13    pub struct IPRoutingRule(Shared<ffi::NMIPRoutingRule>);
14
15    match fn {
16        ref => |ptr| ffi::nm_ip_routing_rule_ref(ptr),
17        unref => |ptr| ffi::nm_ip_routing_rule_unref(ptr),
18        type_ => || ffi::nm_ip_routing_rule_get_type(),
19    }
20}
21
22impl IPRoutingRule {
23    /// ## `addr_family`
24    /// the address family of the routing rule. Must be either
25    ///   `AF_INET` (2) or `AF_INET6` (10).
26    ///
27    /// # Returns
28    ///
29    /// a newly created rule instance with the
30    ///   provided address family. The instance is unsealed.
31    #[cfg(feature = "v1_18")]
32    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
33    #[doc(alias = "nm_ip_routing_rule_new")]
34    pub fn new(addr_family: i32) -> IPRoutingRule {
35        assert_initialized_main_thread!();
36        unsafe { from_glib_full(ffi::nm_ip_routing_rule_new(addr_family)) }
37    }
38
39    /// ## `other`
40    /// the other #NMIPRoutingRule instance to compare
41    ///
42    /// # Returns
43    ///
44    /// zero, a positive, or a negative integer to indicate
45    ///   equality or how the arguments compare.
46    #[cfg(feature = "v1_18")]
47    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
48    #[doc(alias = "nm_ip_routing_rule_cmp")]
49    pub fn cmp(&self, other: Option<&IPRoutingRule>) -> i32 {
50        unsafe { ffi::nm_ip_routing_rule_cmp(self.to_glib_none().0, other.to_glib_none().0) }
51    }
52
53    ///
54    /// # Returns
55    ///
56    /// the set action.
57    #[cfg(feature = "v1_18")]
58    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
59    #[doc(alias = "nm_ip_routing_rule_get_action")]
60    #[doc(alias = "get_action")]
61    pub fn action(&self) -> u8 {
62        unsafe { ffi::nm_ip_routing_rule_get_action(self.to_glib_none().0) }
63    }
64
65    ///
66    /// # Returns
67    ///
68    /// the address family of the rule. Either `AF_INET` or `AF_INET6`.
69    #[cfg(feature = "v1_18")]
70    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
71    #[doc(alias = "nm_ip_routing_rule_get_addr_family")]
72    #[doc(alias = "get_addr_family")]
73    pub fn addr_family(&self) -> i32 {
74        unsafe { ffi::nm_ip_routing_rule_get_addr_family(self.to_glib_none().0) }
75    }
76
77    ///
78    /// # Returns
79    ///
80    /// the destination port end setting.
81    #[cfg(feature = "v1_18")]
82    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
83    #[doc(alias = "nm_ip_routing_rule_get_destination_port_end")]
84    #[doc(alias = "get_destination_port_end")]
85    pub fn destination_port_end(&self) -> u16 {
86        unsafe { ffi::nm_ip_routing_rule_get_destination_port_end(self.to_glib_none().0) }
87    }
88
89    ///
90    /// # Returns
91    ///
92    /// the destination port start setting.
93    #[cfg(feature = "v1_18")]
94    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
95    #[doc(alias = "nm_ip_routing_rule_get_destination_port_start")]
96    #[doc(alias = "get_destination_port_start")]
97    pub fn destination_port_start(&self) -> u16 {
98        unsafe { ffi::nm_ip_routing_rule_get_destination_port_start(self.to_glib_none().0) }
99    }
100
101    ///
102    /// # Returns
103    ///
104    /// the set from/src parameter or
105    ///   [`None`], if no value is set.
106    #[cfg(feature = "v1_18")]
107    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
108    #[doc(alias = "nm_ip_routing_rule_get_from")]
109    #[doc(alias = "get_from")]
110    pub fn from(&self) -> glib::GString {
111        unsafe { from_glib_none(ffi::nm_ip_routing_rule_get_from(self.to_glib_none().0)) }
112    }
113
114    ///
115    /// # Returns
116    ///
117    /// the set prefix length for the from/src parameter.
118    #[cfg(feature = "v1_18")]
119    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
120    #[doc(alias = "nm_ip_routing_rule_get_from_len")]
121    #[doc(alias = "get_from_len")]
122    pub fn from_len(&self) -> u8 {
123        unsafe { ffi::nm_ip_routing_rule_get_from_len(self.to_glib_none().0) }
124    }
125
126    ///
127    /// # Returns
128    ///
129    /// the fwmark setting.
130    #[cfg(feature = "v1_18")]
131    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
132    #[doc(alias = "nm_ip_routing_rule_get_fwmark")]
133    #[doc(alias = "get_fwmark")]
134    pub fn fwmark(&self) -> u32 {
135        unsafe { ffi::nm_ip_routing_rule_get_fwmark(self.to_glib_none().0) }
136    }
137
138    ///
139    /// # Returns
140    ///
141    /// the fwmask setting.
142    #[cfg(feature = "v1_18")]
143    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
144    #[doc(alias = "nm_ip_routing_rule_get_fwmask")]
145    #[doc(alias = "get_fwmask")]
146    pub fn fwmask(&self) -> u32 {
147        unsafe { ffi::nm_ip_routing_rule_get_fwmask(self.to_glib_none().0) }
148    }
149
150    ///
151    /// # Returns
152    ///
153    /// the set iifname or [`None`] if unset.
154    #[cfg(feature = "v1_18")]
155    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
156    #[doc(alias = "nm_ip_routing_rule_get_iifname")]
157    #[doc(alias = "get_iifname")]
158    pub fn iifname(&self) -> glib::GString {
159        unsafe { from_glib_none(ffi::nm_ip_routing_rule_get_iifname(self.to_glib_none().0)) }
160    }
161
162    ///
163    /// # Returns
164    ///
165    /// the "invert" setting of the rule.
166    #[cfg(feature = "v1_18")]
167    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
168    #[doc(alias = "nm_ip_routing_rule_get_invert")]
169    #[doc(alias = "get_invert")]
170    pub fn inverts(&self) -> bool {
171        unsafe { from_glib(ffi::nm_ip_routing_rule_get_invert(self.to_glib_none().0)) }
172    }
173
174    ///
175    /// # Returns
176    ///
177    /// the ipproto of the rule.
178    #[cfg(feature = "v1_18")]
179    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
180    #[doc(alias = "nm_ip_routing_rule_get_ipproto")]
181    #[doc(alias = "get_ipproto")]
182    pub fn ipproto(&self) -> u8 {
183        unsafe { ffi::nm_ip_routing_rule_get_ipproto(self.to_glib_none().0) }
184    }
185
186    ///
187    /// # Returns
188    ///
189    /// the set oifname or [`None`] if unset.
190    #[cfg(feature = "v1_18")]
191    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
192    #[doc(alias = "nm_ip_routing_rule_get_oifname")]
193    #[doc(alias = "get_oifname")]
194    pub fn oifname(&self) -> glib::GString {
195        unsafe { from_glib_none(ffi::nm_ip_routing_rule_get_oifname(self.to_glib_none().0)) }
196    }
197
198    ///
199    /// # Returns
200    ///
201    /// the priority. A valid priority is in the range from
202    ///   0 to `G_MAXUINT32`. If unset, -1 is returned.
203    #[cfg(feature = "v1_18")]
204    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
205    #[doc(alias = "nm_ip_routing_rule_get_priority")]
206    #[doc(alias = "get_priority")]
207    pub fn priority(&self) -> i64 {
208        unsafe { ffi::nm_ip_routing_rule_get_priority(self.to_glib_none().0) }
209    }
210
211    ///
212    /// # Returns
213    ///
214    /// the source port end setting.
215    #[cfg(feature = "v1_18")]
216    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
217    #[doc(alias = "nm_ip_routing_rule_get_source_port_end")]
218    #[doc(alias = "get_source_port_end")]
219    pub fn source_port_end(&self) -> u16 {
220        unsafe { ffi::nm_ip_routing_rule_get_source_port_end(self.to_glib_none().0) }
221    }
222
223    ///
224    /// # Returns
225    ///
226    /// the source port start setting.
227    #[cfg(feature = "v1_18")]
228    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
229    #[doc(alias = "nm_ip_routing_rule_get_source_port_start")]
230    #[doc(alias = "get_source_port_start")]
231    pub fn source_port_start(&self) -> u16 {
232        unsafe { ffi::nm_ip_routing_rule_get_source_port_start(self.to_glib_none().0) }
233    }
234
235    ///
236    /// # Returns
237    ///
238    /// the suppress_prefixlength of the rule. -1 means that the value is unset.
239    #[cfg(feature = "v1_20")]
240    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
241    #[doc(alias = "nm_ip_routing_rule_get_suppress_prefixlength")]
242    #[doc(alias = "get_suppress_prefixlength")]
243    pub fn suppress_prefixlength(&self) -> i32 {
244        unsafe { ffi::nm_ip_routing_rule_get_suppress_prefixlength(self.to_glib_none().0) }
245    }
246
247    ///
248    /// # Returns
249    ///
250    /// the set table.
251    #[cfg(feature = "v1_18")]
252    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
253    #[doc(alias = "nm_ip_routing_rule_get_table")]
254    #[doc(alias = "get_table")]
255    pub fn table(&self) -> u32 {
256        unsafe { ffi::nm_ip_routing_rule_get_table(self.to_glib_none().0) }
257    }
258
259    ///
260    /// # Returns
261    ///
262    /// the set to/dst parameter or
263    ///   [`None`], if no value is set.
264    #[cfg(feature = "v1_18")]
265    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
266    #[doc(alias = "nm_ip_routing_rule_get_to")]
267    #[doc(alias = "get_to")]
268    pub fn to(&self) -> glib::GString {
269        unsafe { from_glib_none(ffi::nm_ip_routing_rule_get_to(self.to_glib_none().0)) }
270    }
271
272    ///
273    /// # Returns
274    ///
275    /// the set prefix length for the to/dst parameter.
276    #[cfg(feature = "v1_18")]
277    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
278    #[doc(alias = "nm_ip_routing_rule_get_to_len")]
279    #[doc(alias = "get_to_len")]
280    pub fn to_len(&self) -> u8 {
281        unsafe { ffi::nm_ip_routing_rule_get_to_len(self.to_glib_none().0) }
282    }
283
284    ///
285    /// # Returns
286    ///
287    /// the tos of the rule.
288    #[cfg(feature = "v1_18")]
289    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
290    #[doc(alias = "nm_ip_routing_rule_get_tos")]
291    #[doc(alias = "get_tos")]
292    pub fn tos(&self) -> u8 {
293        unsafe { ffi::nm_ip_routing_rule_get_tos(self.to_glib_none().0) }
294    }
295
296    ///
297    /// # Returns
298    ///
299    /// [`true`] if a uid range is set.
300    ///
301    /// This API was wrongly introduced in the header files for 1.32, but the
302    /// symbols were not exported. The API only works since 1.34 and newer.
303    ///
304    /// ## `out_range_start`
305    /// returns the start of the range
306    ///   or 0 if the range is not set.
307    ///
308    /// ## `out_range_end`
309    /// returns the end of the range
310    ///   or 0 if the range is not set.
311    #[cfg(feature = "v1_34")]
312    #[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
313    #[doc(alias = "nm_ip_routing_rule_get_uid_range")]
314    #[doc(alias = "get_uid_range")]
315    pub fn uid_range(&self) -> Option<(u32, u32)> {
316        unsafe {
317            let mut out_range_start = std::mem::MaybeUninit::uninit();
318            let mut out_range_end = std::mem::MaybeUninit::uninit();
319            let ret = from_glib(ffi::nm_ip_routing_rule_get_uid_range(
320                self.to_glib_none().0,
321                out_range_start.as_mut_ptr(),
322                out_range_end.as_mut_ptr(),
323            ));
324            if ret {
325                Some((out_range_start.assume_init(), out_range_end.assume_init()))
326            } else {
327                None
328            }
329        }
330    }
331
332    ///
333    /// # Returns
334    ///
335    /// whether @self is sealed. Once sealed, an instance
336    ///   cannot be modified nor unsealed.
337    #[cfg(feature = "v1_18")]
338    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
339    #[doc(alias = "nm_ip_routing_rule_is_sealed")]
340    pub fn is_sealed(&self) -> bool {
341        unsafe { from_glib(ffi::nm_ip_routing_rule_is_sealed(self.to_glib_none().0)) }
342    }
343
344    /// Since 1.42, ref-counting of #NMIPRoutingRule is thread-safe.
345    ///
346    /// # Returns
347    ///
348    /// a newly created rule instance with
349    ///   the same settings as @self. Note that the instance will
350    ///   always be unsealed.
351    #[cfg(feature = "v1_18")]
352    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
353    #[doc(alias = "nm_ip_routing_rule_new_clone")]
354    #[must_use]
355    pub fn new_clone(&self) -> IPRoutingRule {
356        unsafe { from_glib_full(ffi::nm_ip_routing_rule_new_clone(self.to_glib_none().0)) }
357    }
358
359    /// Seals the routing rule. Afterwards, the instance can no longer be
360    /// modified, and it is a bug to call any of the accessors that would
361    /// modify the rule. If @self was already sealed, this has no effect.
362    #[cfg(feature = "v1_18")]
363    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
364    #[doc(alias = "nm_ip_routing_rule_seal")]
365    pub fn seal(&self) {
366        unsafe {
367            ffi::nm_ip_routing_rule_seal(self.to_glib_none().0);
368        }
369    }
370
371    /// Note that currently only certain actions are allowed. nm_ip_routing_rule_validate()
372    /// will reject unsupported actions as invalid.
373    /// ## `action`
374    /// the action to set
375    #[cfg(feature = "v1_18")]
376    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
377    #[doc(alias = "nm_ip_routing_rule_set_action")]
378    pub fn set_action(&self, action: u8) {
379        unsafe {
380            ffi::nm_ip_routing_rule_set_action(self.to_glib_none().0, action);
381        }
382    }
383
384    /// ## `start`
385    /// the start port to set.
386    /// ## `end`
387    /// the end port to set.
388    #[cfg(feature = "v1_18")]
389    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
390    #[doc(alias = "nm_ip_routing_rule_set_destination_port")]
391    pub fn set_destination_port(&self, start: u16, end: u16) {
392        unsafe {
393            ffi::nm_ip_routing_rule_set_destination_port(self.to_glib_none().0, start, end);
394        }
395    }
396
397    /// Setting invalid values is accepted, but will later fail
398    /// during nm_ip_routing_rule_validate().
399    /// ## `from`
400    /// the from/src address to set.
401    ///   The address family must match.
402    /// ## `len`
403    /// the corresponding prefix length of the address.
404    #[cfg(feature = "v1_18")]
405    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
406    #[doc(alias = "nm_ip_routing_rule_set_from")]
407    pub fn set_from(&self, from: Option<&str>) {
408        if let Some(s) = from {
409            let len = s.len() as _;
410            unsafe {
411                ffi::nm_ip_routing_rule_set_from(self.to_glib_none().0, s.to_glib_none().0, len);
412            }
413        }
414    }
415
416    /// ## `fwmark`
417    /// the fwmark
418    /// ## `fwmask`
419    /// the fwmask
420    #[cfg(feature = "v1_18")]
421    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
422    #[doc(alias = "nm_ip_routing_rule_set_fwmark")]
423    pub fn set_fwmark(&self, fwmark: u32, fwmask: u32) {
424        unsafe {
425            ffi::nm_ip_routing_rule_set_fwmark(self.to_glib_none().0, fwmark, fwmask);
426        }
427    }
428
429    /// The name supports C backslash escaping for non-UTF-8 characters.
430    /// Note that nm_ip_routing_rule_from_string() too uses backslash
431    /// escaping when tokenizing the words by whitespace. So, in string
432    /// representation you'd get double backslashes.
433    /// ## `iifname`
434    /// the iifname to set or [`None`] to unset.
435    #[cfg(feature = "v1_18")]
436    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
437    #[doc(alias = "nm_ip_routing_rule_set_iifname")]
438    pub fn set_iifname(&self, iifname: Option<&str>) {
439        unsafe {
440            ffi::nm_ip_routing_rule_set_iifname(self.to_glib_none().0, iifname.to_glib_none().0);
441        }
442    }
443
444    /// ## `invert`
445    /// the new value to set
446    #[cfg(feature = "v1_18")]
447    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
448    #[doc(alias = "nm_ip_routing_rule_set_invert")]
449    pub fn set_invert(&self, invert: bool) {
450        unsafe {
451            ffi::nm_ip_routing_rule_set_invert(self.to_glib_none().0, invert.into_glib());
452        }
453    }
454
455    /// ## `ipproto`
456    /// the ipproto to set
457    #[cfg(feature = "v1_18")]
458    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
459    #[doc(alias = "nm_ip_routing_rule_set_ipproto")]
460    pub fn set_ipproto(&self, ipproto: u8) {
461        unsafe {
462            ffi::nm_ip_routing_rule_set_ipproto(self.to_glib_none().0, ipproto);
463        }
464    }
465
466    /// The name supports C backslash escaping for non-UTF-8 characters.
467    /// Note that nm_ip_routing_rule_from_string() too uses backslash
468    /// escaping when tokenizing the words by whitespace. So, in string
469    /// representation you'd get double backslashes.
470    /// ## `oifname`
471    /// the oifname to set or [`None`] to unset.
472    #[cfg(feature = "v1_18")]
473    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
474    #[doc(alias = "nm_ip_routing_rule_set_oifname")]
475    pub fn set_oifname(&self, oifname: Option<&str>) {
476        unsafe {
477            ffi::nm_ip_routing_rule_set_oifname(self.to_glib_none().0, oifname.to_glib_none().0);
478        }
479    }
480
481    /// A valid priority ranges from 0 to `G_MAXUINT32`. "-1" is also allowed
482    /// to reset the priority. It is a bug calling this function with any
483    /// other value.
484    /// ## `priority`
485    /// the priority to set
486    #[cfg(feature = "v1_18")]
487    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
488    #[doc(alias = "nm_ip_routing_rule_set_priority")]
489    pub fn set_priority(&self, priority: i64) {
490        unsafe {
491            ffi::nm_ip_routing_rule_set_priority(self.to_glib_none().0, priority);
492        }
493    }
494
495    /// ## `start`
496    /// the start port to set.
497    /// ## `end`
498    /// the end port to set.
499    #[cfg(feature = "v1_18")]
500    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
501    #[doc(alias = "nm_ip_routing_rule_set_source_port")]
502    pub fn set_source_port(&self, start: u16, end: u16) {
503        unsafe {
504            ffi::nm_ip_routing_rule_set_source_port(self.to_glib_none().0, start, end);
505        }
506    }
507
508    /// ## `suppress_prefixlength`
509    /// the suppress_prefixlength to set. The value -1 means
510    ///   unset.
511    #[cfg(feature = "v1_20")]
512    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
513    #[doc(alias = "nm_ip_routing_rule_set_suppress_prefixlength")]
514    pub fn set_suppress_prefixlength(&self, suppress_prefixlength: i32) {
515        unsafe {
516            ffi::nm_ip_routing_rule_set_suppress_prefixlength(
517                self.to_glib_none().0,
518                suppress_prefixlength,
519            );
520        }
521    }
522
523    /// ## `table`
524    /// the table to set
525    #[cfg(feature = "v1_18")]
526    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
527    #[doc(alias = "nm_ip_routing_rule_set_table")]
528    pub fn set_table(&self, table: u32) {
529        unsafe {
530            ffi::nm_ip_routing_rule_set_table(self.to_glib_none().0, table);
531        }
532    }
533
534    /// Setting invalid values is accepted, but will later fail
535    /// during nm_ip_routing_rule_validate().
536    /// ## `to`
537    /// the to/dst address to set.
538    ///   The address family must match.
539    /// ## `len`
540    /// the corresponding prefix length of the address.
541    ///   If @to is [`None`], this valid is ignored.
542    #[cfg(feature = "v1_18")]
543    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
544    #[doc(alias = "nm_ip_routing_rule_set_to")]
545    pub fn set_to(&self, to: Option<&str>) {
546        if let Some(s) = to {
547            let len = s.len() as _;
548            unsafe {
549                ffi::nm_ip_routing_rule_set_to(self.to_glib_none().0, s.to_glib_none().0, len);
550            }
551        }
552    }
553
554    /// ## `tos`
555    /// the tos to set
556    #[cfg(feature = "v1_18")]
557    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
558    #[doc(alias = "nm_ip_routing_rule_set_tos")]
559    pub fn set_tos(&self, tos: u8) {
560        unsafe {
561            ffi::nm_ip_routing_rule_set_tos(self.to_glib_none().0, tos);
562        }
563    }
564
565    /// For a valid range, start must be less or equal to end.
566    /// If set to an invalid range, the range gets unset.
567    ///
568    /// This API was wrongly introduced in the header files for 1.32, but the
569    /// symbols were not exported. The API only works since 1.34 and newer.
570    /// ## `uid_range_start`
571    /// the uid_range start to set.
572    /// ## `uid_range_end`
573    /// the uid_range start to set.
574    #[cfg(feature = "v1_34")]
575    #[cfg_attr(docsrs, doc(cfg(feature = "v1_34")))]
576    #[doc(alias = "nm_ip_routing_rule_set_uid_range")]
577    pub fn set_uid_range(&self, uid_range_start: u32, uid_range_end: u32) {
578        unsafe {
579            ffi::nm_ip_routing_rule_set_uid_range(
580                self.to_glib_none().0,
581                uid_range_start,
582                uid_range_end,
583            );
584        }
585    }
586
587    //#[cfg(feature = "v1_18")]
588    //#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
589    //#[doc(alias = "nm_ip_routing_rule_to_string")]
590    //pub fn to_string(&self, to_string_flags: IPRoutingRuleAsStringFlags, extra_args: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }) -> Result<glib::GString, glib::Error> {
591    //    unsafe { TODO: call ffi:nm_ip_routing_rule_to_string() }
592    //}
593
594    ///
595    /// # Returns
596    ///
597    /// [`true`] if the rule validates.
598    #[cfg(feature = "v1_18")]
599    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
600    #[doc(alias = "nm_ip_routing_rule_validate")]
601    pub fn validate(&self) -> Result<(), glib::Error> {
602        unsafe {
603            let mut error = std::ptr::null_mut();
604            let is_ok = ffi::nm_ip_routing_rule_validate(self.to_glib_none().0, &mut error);
605            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
606            if error.is_null() {
607                Ok(())
608            } else {
609                Err(from_glib_full(error))
610            }
611        }
612    }
613
614    //#[cfg(feature = "v1_18")]
615    //#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
616    //#[doc(alias = "nm_ip_routing_rule_from_string")]
617    //pub fn from_string(str: &str, to_string_flags: IPRoutingRuleAsStringFlags, extra_args: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }) -> Result<IPRoutingRule, glib::Error> {
618    //    unsafe { TODO: call ffi:nm_ip_routing_rule_from_string() }
619    //}
620}