gtk/
entry.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::object::IsA;
4use glib::translate::ToGlibPtr;
5use std::convert::TryFrom;
6
7use crate::Entry;
8
9mod sealed {
10    pub trait Sealed {}
11    impl<T: glib::IsA<crate::Entry>> Sealed for T {}
12}
13
14pub trait EntryExtManual: IsA<Entry> + sealed::Sealed + 'static {
15    #[doc(alias = "gtk_entry_get_invisible_char")]
16    #[doc(alias = "get_invisible_char")]
17    fn invisible_char(&self) -> Option<char> {
18        let ret = unsafe { ffi::gtk_entry_get_invisible_char(self.as_ref().to_glib_none().0) };
19
20        if ret == 0 {
21            return None;
22        }
23
24        Some(TryFrom::try_from(ret).expect("conversion from an invalid Unicode value attempted"))
25    }
26}
27
28impl<O: IsA<Entry>> EntryExtManual for O {}