1 // This file was generated by gir (https://github.com/gtk-rs/gir) 2 // from gir-files (https://github.com/gtk-rs/gir-files) 3 // DO NOT EDIT 4 5 use gio_sys; 6 use glib::translate::*; 7 use glib::GString; 8 use std::fmt; 9 10 glib_wrapper! { 11 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 12 pub struct FileAttributeMatcher(Shared<gio_sys::GFileAttributeMatcher>); 13 14 match fn { 15 ref => |ptr| gio_sys::g_file_attribute_matcher_ref(ptr), 16 unref => |ptr| gio_sys::g_file_attribute_matcher_unref(ptr), 17 get_type => || gio_sys::g_file_attribute_matcher_get_type(), 18 } 19 } 20 21 impl FileAttributeMatcher { new(attributes: &str) -> FileAttributeMatcher22 pub fn new(attributes: &str) -> FileAttributeMatcher { 23 unsafe { 24 from_glib_full(gio_sys::g_file_attribute_matcher_new( 25 attributes.to_glib_none().0, 26 )) 27 } 28 } 29 enumerate_namespace(&self, ns: &str) -> bool30 pub fn enumerate_namespace(&self, ns: &str) -> bool { 31 unsafe { 32 from_glib(gio_sys::g_file_attribute_matcher_enumerate_namespace( 33 self.to_glib_none().0, 34 ns.to_glib_none().0, 35 )) 36 } 37 } 38 matches(&self, attribute: &str) -> bool39 pub fn matches(&self, attribute: &str) -> bool { 40 unsafe { 41 from_glib(gio_sys::g_file_attribute_matcher_matches( 42 self.to_glib_none().0, 43 attribute.to_glib_none().0, 44 )) 45 } 46 } 47 matches_only(&self, attribute: &str) -> bool48 pub fn matches_only(&self, attribute: &str) -> bool { 49 unsafe { 50 from_glib(gio_sys::g_file_attribute_matcher_matches_only( 51 self.to_glib_none().0, 52 attribute.to_glib_none().0, 53 )) 54 } 55 } 56 subtract( &self, subtract: Option<&FileAttributeMatcher>, ) -> Option<FileAttributeMatcher>57 pub fn subtract( 58 &self, 59 subtract: Option<&FileAttributeMatcher>, 60 ) -> Option<FileAttributeMatcher> { 61 unsafe { 62 from_glib_full(gio_sys::g_file_attribute_matcher_subtract( 63 self.to_glib_none().0, 64 subtract.to_glib_none().0, 65 )) 66 } 67 } 68 to_string(&self) -> GString69 fn to_string(&self) -> GString { 70 unsafe { 71 from_glib_full(gio_sys::g_file_attribute_matcher_to_string( 72 self.to_glib_none().0, 73 )) 74 } 75 } 76 } 77 78 impl fmt::Display for FileAttributeMatcher { 79 #[inline] fmt(&self, f: &mut fmt::Formatter) -> fmt::Result80 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 81 write!(f, "{}", self.to_string()) 82 } 83 } 84