gtk/entry_completion.rs
1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::Entry;
4use crate::EntryCompletion;
5use crate::Widget;
6use glib::object::IsA;
7use glib::translate::*;
8use glib::Cast;
9
10mod sealed {
11 pub trait Sealed {}
12 impl<T: glib::IsA<crate::EntryCompletion>> Sealed for T {}
13}
14
15pub trait EntryCompletionExtManual: IsA<EntryCompletion> + sealed::Sealed + 'static {
16 /// Gets the entry `self` has been attached to.
17 ///
18 /// # Returns
19 ///
20 /// The entry `self` has been attached to
21 #[doc(alias = "gtk_entry_completion_get_entry")]
22 #[doc(alias = "get_entry")]
23 fn entry(&self) -> Option<Entry> {
24 unsafe {
25 Option::<Widget>::from_glib_none(ffi::gtk_entry_completion_get_entry(
26 self.as_ref().to_glib_none().0,
27 ))
28 .map(|widget| {
29 widget
30 .downcast()
31 .expect("Non-Entry widget received from get_entry method")
32 })
33 }
34 }
35}
36
37impl<O: IsA<EntryCompletion>> EntryCompletionExtManual for O {}