pango/auto/
item.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use glib::translate::*;
6use pango_sys;
7
8glib_wrapper! {
9    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
10    pub struct Item(Boxed<pango_sys::PangoItem>);
11
12    match fn {
13        copy => |ptr| pango_sys::pango_item_copy(mut_override(ptr)),
14        free => |ptr| pango_sys::pango_item_free(ptr),
15        get_type => || pango_sys::pango_item_get_type(),
16    }
17}
18
19impl Item {
20    pub fn new() -> Item {
21        unsafe { from_glib_full(pango_sys::pango_item_new()) }
22    }
23
24    pub fn split(&mut self, split_index: i32, split_offset: i32) -> Option<Item> {
25        unsafe {
26            from_glib_full(pango_sys::pango_item_split(
27                self.to_glib_none_mut().0,
28                split_index,
29                split_offset,
30            ))
31        }
32    }
33}
34
35impl Default for Item {
36    fn default() -> Self {
37        Self::new()
38    }
39}