1use std::mem;
4
5use glib::translate::*;
6
7use crate::{ffi, AttrList, Attribute};
8
9impl AttrList {
10 #[doc(alias = "pango_attr_list_change")]
25 pub fn change(&self, attr: impl Into<Attribute>) {
26 unsafe {
27 let attr = attr.into();
28 ffi::pango_attr_list_change(self.to_glib_none().0, attr.to_glib_none().0);
29 mem::forget(attr); }
31 }
32
33 #[cfg(feature = "v1_46")]
34 #[cfg_attr(docsrs, doc(cfg(feature = "v1_46")))]
35 #[doc(alias = "pango_attr_list_equal")]
36 fn equal(&self, other_list: &AttrList) -> bool {
37 unsafe {
38 from_glib(ffi::pango_attr_list_equal(
39 self.to_glib_none().0,
40 other_list.to_glib_none().0,
41 ))
42 }
43 }
44
45 #[doc(alias = "pango_attr_list_insert")]
52 pub fn insert(&self, attr: impl Into<Attribute>) {
53 unsafe {
54 let attr = attr.into();
55 ffi::pango_attr_list_insert(self.to_glib_none().0, attr.to_glib_none().0);
56 mem::forget(attr); }
58 }
59
60 #[doc(alias = "pango_attr_list_insert_before")]
67 pub fn insert_before(&self, attr: impl Into<Attribute>) {
68 unsafe {
69 let attr = attr.into();
70 ffi::pango_attr_list_insert_before(self.to_glib_none().0, attr.to_glib_none().0);
71 mem::forget(attr); }
73 }
74}
75
76#[cfg(feature = "v1_46")]
77#[cfg_attr(docsrs, doc(cfg(feature = "v1_46")))]
78impl PartialEq for AttrList {
79 #[inline]
80 fn eq(&self, other: &Self) -> bool {
81 self.equal(other)
82 }
83}
84
85#[cfg(feature = "v1_46")]
86#[cfg_attr(docsrs, doc(cfg(feature = "v1_46")))]
87impl Eq for AttrList {}
88
89#[cfg(feature = "v1_50")]
90#[cfg_attr(docsrs, doc(cfg(feature = "v1_50")))]
91impl std::str::FromStr for AttrList {
92 type Err = glib::BoolError;
93
94 fn from_str(s: &str) -> Result<Self, Self::Err> {
95 Self::from_string(s)
96 }
97}