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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT
use crate::ffi;
use glib::prelude::*;
#[cfg(feature = "v5_6")]
#[cfg_attr(docsrs, doc(cfg(feature = "v5_6")))]
use glib::translate::*;
glib::wrapper! {
/// Interface for completion proposals.
///
/// This interface is used to denote that an object is capable of being
/// a completion proposal for [`Completion`][crate::Completion].
///
/// Currently, no method or functions are required but additional methods
/// may be added in the future. Proposals created by
/// #GtkSourceCompletionProvider can use `IMPLEMENT_INTERFACE()` to
/// implement this with [`None`] for the interface init function.
///
/// # Implements
///
/// [`CompletionProposalExt`][trait@crate::prelude::CompletionProposalExt]
#[doc(alias = "GtkSourceCompletionProposal")]
pub struct CompletionProposal(Interface<ffi::GtkSourceCompletionProposal, ffi::GtkSourceCompletionProposalInterface>);
match fn {
type_ => || ffi::gtk_source_completion_proposal_get_type(),
}
}
impl CompletionProposal {
pub const NONE: Option<&'static CompletionProposal> = None;
}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::CompletionProposal>> Sealed for T {}
}
/// Trait containing all [`struct@CompletionProposal`] methods.
///
/// # Implementors
///
/// [`CompletionProposal`][struct@crate::CompletionProposal]
pub trait CompletionProposalExt: IsA<CompletionProposal> + sealed::Sealed + 'static {
/// Gets the typed-text for the proposal, if supported by the implementation.
///
/// Implementing this virtual-function is optional, but can be useful to allow
/// external tooling to compare results.
///
/// # Returns
///
/// a newly allocated string, or [`None`]
#[cfg(feature = "v5_6")]
#[cfg_attr(docsrs, doc(cfg(feature = "v5_6")))]
#[doc(alias = "gtk_source_completion_proposal_get_typed_text")]
#[doc(alias = "get_typed_text")]
fn typed_text(&self) -> Option<glib::GString> {
unsafe {
from_glib_full(ffi::gtk_source_completion_proposal_get_typed_text(
self.as_ref().to_glib_none().0,
))
}
}
}
impl<O: IsA<CompletionProposal>> CompletionProposalExt for O {}