gtk4/
entry_completion.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4
5use crate::{prelude::*, Entry, EntryCompletion, Widget};
6
7impl EntryCompletion {
8    /// Gets the entry @self has been attached to.
9    ///
10    /// # Deprecated since 4.10
11    ///
12    /// GtkEntryCompletion will be removed in GTK 5.
13    ///
14    /// # Returns
15    ///
16    /// The entry @self has been attached to
17    #[doc(alias = "gtk_entry_completion_get_entry")]
18    #[doc(alias = "get_entry")]
19    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
20    #[allow(deprecated)]
21    pub fn entry(&self) -> Option<Entry> {
22        unsafe {
23            Option::<Widget>::from_glib_none(crate::ffi::gtk_entry_completion_get_entry(
24                self.to_glib_none().0,
25            ))
26            .map(|widget| {
27                widget
28                    .downcast()
29                    .expect("Non-Entry widget received from get_entry method")
30            })
31        }
32    }
33}