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
use glib::translate::*;
glib::wrapper! {
/// An opaque datatype.
///
/// Ignore all its fields and initialize the iter with [`RegionExt::start_region_iter()`][crate::prelude::RegionExt::start_region_iter()].
#[doc(alias = "GtkSourceRegionIter")]
pub struct RegionIter(BoxedInline<ffi::GtkSourceRegionIter>);
}
impl RegionIter {
/// Gets the subregion at this iterator.
///
/// # Returns
///
/// [`true`] if @start and @end have been set successfully (if non-[`None`]),
/// or [`false`] if @self is the end iterator or if the region is empty.
///
/// ## `start`
/// iterator to initialize with the subregion start, or [`None`].
///
/// ## `end`
/// iterator to initialize with the subregion end, or [`None`].
#[doc(alias = "gtk_source_region_iter_get_subregion")]
#[doc(alias = "get_subregion")]
pub fn subregion(&mut self, start: &mut gtk::TextIter, end: &mut gtk::TextIter) -> bool {
unsafe {
from_glib(ffi::gtk_source_region_iter_get_subregion(
self.to_glib_none_mut().0,
start.to_glib_none_mut().0,
end.to_glib_none_mut().0,
))
}
}
///
/// # Returns
///
/// whether @self is the end iterator.
#[doc(alias = "gtk_source_region_iter_is_end")]
pub fn is_end(&self) -> bool {
unsafe {
from_glib(ffi::gtk_source_region_iter_is_end(mut_override(
self.to_glib_none().0,
)))
}
}
/// Moves @self to the next subregion.
///
/// # Returns
///
/// [`true`] if @self moved and is dereferenceable, or [`false`] if @self has
/// been set to the end iterator.
#[allow(clippy::should_implement_trait)]
#[doc(alias = "gtk_source_region_iter_next")]
pub fn next(&mut self) -> bool {
unsafe { from_glib(ffi::gtk_source_region_iter_next(self.to_glib_none_mut().0)) }
}
}