pango/
attr_list.rs

1// Copyright 2017, The Gtk-rs Project Developers.
2// See the COPYRIGHT file at the top-level directory of this distribution.
3// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
4
5use glib::translate::*;
6use pango_sys;
7use std::mem;
8use AttrList;
9use Attribute;
10
11impl AttrList {
12    pub fn change(&self, attr: Attribute) {
13        unsafe {
14            pango_sys::pango_attr_list_change(
15                self.to_glib_none().0,
16                attr.to_glib_none().0 as *mut _,
17            );
18            mem::forget(attr); //As attr transferred fully
19        }
20    }
21
22    pub fn insert(&self, attr: Attribute) {
23        unsafe {
24            pango_sys::pango_attr_list_insert(
25                self.to_glib_none().0,
26                attr.to_glib_none().0 as *mut _,
27            );
28            mem::forget(attr); //As attr transferred fully
29        }
30    }
31
32    pub fn insert_before(&self, attr: Attribute) {
33        unsafe {
34            pango_sys::pango_attr_list_insert_before(
35                self.to_glib_none().0,
36                attr.to_glib_none().0 as *mut _,
37            );
38            mem::forget(attr); //As attr transferred fully
39        }
40    }
41}