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
// This file was generated by gir (https://github.com/gtk-rs/gir @ fe7a6ff+) // from gir-files (https://github.com/gtk-rs/gir-files @ b215ee8) // DO NOT EDIT use Filter; use ffi; use glib::object::Downcast; use glib::object::IsA; use glib::translate::*; use glib_ffi; use gobject_ffi; use std::mem; use std::ptr; glib_wrapper! { /// A filter for detecting whether or not a text stream claimed to be /// iso-8859-X is really that charset or if it is really a /// Windows-CP125x charset. /// /// # Implements /// /// [`FilterWindowsExt`](trait.FilterWindowsExt.html), [`FilterExt`](trait.FilterExt.html) pub struct FilterWindows(Object<ffi::GMimeFilterWindows, ffi::GMimeFilterWindowsClass>): Filter; match fn { get_type => || ffi::g_mime_filter_windows_get_type(), } } impl FilterWindows { /// Creates a new GMimeFilterWindows filter. When a stream of text has /// been filtered, it can be determined whether or not said text stream /// was in `claimed_charset` or the equivalent Windows-CP125# charset. /// ## `claimed_charset` /// charset that a text stream claims to be /// /// # Returns /// /// a new windows filter. pub fn new(claimed_charset: &str) -> FilterWindows { unsafe { Filter::from_glib_full(ffi::g_mime_filter_windows_new(claimed_charset.to_glib_none().0)).downcast_unchecked() } } } /// Trait containing all `FilterWindows` methods. /// /// # Implementors /// /// [`FilterWindows`](struct.FilterWindows.html) pub trait FilterWindowsExt { /// Determines whether or not a Windows-CP125# charset has been /// detected so far. /// /// # Returns /// /// `true` if the filtered stream has been detected to contain /// Windows-CP125# characters or `false` otherwise. fn is_windows_charset(&self) -> bool; /// Figures out the real charset that the text is encoded in based on whether or not Windows-CP125# characters were found. /// /// # Returns /// /// a const string pointer to the claimed charset if filtered /// text stream was found not to contain any Windows-CP125# characters /// or the proper Windows-CP125# charset. fn real_charset(&self) -> Option<String>; } impl<O: IsA<FilterWindows>> FilterWindowsExt for O { fn is_windows_charset(&self) -> bool { unsafe { from_glib(ffi::g_mime_filter_windows_is_windows_charset(self.to_glib_none().0)) } } fn real_charset(&self) -> Option<String> { unsafe { from_glib_none(ffi::g_mime_filter_windows_real_charset(self.to_glib_none().0)) } } }