Skip to content

Commit 8a8eb65

Browse files
committed
pango: manual impl for some functions
Functions `itemize()` & `itemize_with_base_dir` now use Into<Option<&_>> for the `cached_dir` argument. Because of this new signature, the lifetime for the inner type `AttrIterator<'_>>` must be specified.
1 parent 55cb2c1 commit 8a8eb65

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

pango/src/functions.rs

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,51 @@ use glib::translate::*;
55
pub use crate::auto::functions::*;
66
#[cfg(feature = "v1_44")]
77
use crate::ShapeFlags;
8-
use crate::{ffi, Analysis, GlyphString, Item};
8+
use crate::{ffi, Analysis, AttrIterator, AttrList, Context, Direction, GlyphString, Item};
9+
10+
#[doc(alias = "pango_itemize")]
11+
pub fn itemize<'a>(
12+
context: &Context,
13+
text: &str,
14+
start_index: i32,
15+
length: i32,
16+
attrs: &AttrList,
17+
cached_iter: impl Into<Option<&'a AttrIterator<'a>>>,
18+
) -> Vec<Item> {
19+
unsafe {
20+
FromGlibPtrContainer::from_glib_full(ffi::pango_itemize(
21+
context.to_glib_none().0,
22+
text.to_glib_none().0,
23+
start_index,
24+
length,
25+
attrs.to_glib_none().0,
26+
mut_override(cached_iter.into().to_glib_none().0),
27+
))
28+
}
29+
}
30+
31+
#[doc(alias = "pango_itemize_with_base_dir")]
32+
pub fn itemize_with_base_dir<'a>(
33+
context: &Context,
34+
base_dir: Direction,
35+
text: &str,
36+
start_index: i32,
37+
length: i32,
38+
attrs: &AttrList,
39+
cached_iter: impl Into<Option<&'a AttrIterator<'a>>>,
40+
) -> Vec<Item> {
41+
unsafe {
42+
FromGlibPtrContainer::from_glib_full(ffi::pango_itemize_with_base_dir(
43+
context.to_glib_none().0,
44+
base_dir.into_glib(),
45+
text.to_glib_none().0,
46+
start_index,
47+
length,
48+
attrs.to_glib_none().0,
49+
mut_override(cached_iter.into().to_glib_none().0),
50+
))
51+
}
52+
}
953

1054
#[doc(alias = "pango_reorder_items")]
1155
pub fn reorder_items(logical_items: &glib::List<Item>) -> glib::List<Item> {

0 commit comments

Comments
 (0)