From b20f1958c3ff8c66d867ec9713a604e8cfbcfce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Sun, 1 Dec 2024 19:48:49 +0100 Subject: [PATCH] pango: manual impl for some functions Functions `itemize()` & `itemize_with_base_dir` now use Into> for the `cached_dir` argument. Because of this new signature, the lifetime for the inner type `AttrIterator<'_>>` must be specified. --- pango/src/functions.rs | 46 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/pango/src/functions.rs b/pango/src/functions.rs index 6f2aec065596..1272c8a9cfef 100644 --- a/pango/src/functions.rs +++ b/pango/src/functions.rs @@ -5,7 +5,51 @@ use glib::translate::*; pub use crate::auto::functions::*; #[cfg(feature = "v1_44")] use crate::ShapeFlags; -use crate::{ffi, Analysis, GlyphString, Item}; +use crate::{ffi, Analysis, AttrIterator, AttrList, Context, Direction, GlyphString, Item}; + +#[doc(alias = "pango_itemize")] +pub fn itemize<'a>( + context: &Context, + text: &str, + start_index: i32, + length: i32, + attrs: &AttrList, + cached_iter: impl Into>>, +) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::pango_itemize( + context.to_glib_none().0, + text.to_glib_none().0, + start_index, + length, + attrs.to_glib_none().0, + mut_override(cached_iter.into().to_glib_none().0), + )) + } +} + +#[doc(alias = "pango_itemize_with_base_dir")] +pub fn itemize_with_base_dir<'a>( + context: &Context, + base_dir: Direction, + text: &str, + start_index: i32, + length: i32, + attrs: &AttrList, + cached_iter: impl Into>>, +) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::pango_itemize_with_base_dir( + context.to_glib_none().0, + base_dir.into_glib(), + text.to_glib_none().0, + start_index, + length, + attrs.to_glib_none().0, + mut_override(cached_iter.into().to_glib_none().0), + )) + } +} #[doc(alias = "pango_reorder_items")] pub fn reorder_items(logical_items: &glib::List) -> glib::List {