pango/auto/
color.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 crate::ffi;
6use glib::translate::*;
7
8glib::wrapper! {
9    pub struct Color(BoxedInline<ffi::PangoColor>);
10
11    match fn {
12        copy => |ptr| ffi::pango_color_copy(ptr),
13        free => |ptr| ffi::pango_color_free(ptr),
14        type_ => || ffi::pango_color_get_type(),
15    }
16}
17
18impl Color {
19    #[doc(alias = "pango_color_to_string")]
20    #[doc(alias = "to_string")]
21    pub fn to_str(&self) -> glib::GString {
22        unsafe { from_glib_full(ffi::pango_color_to_string(self.to_glib_none().0)) }
23    }
24}
25
26impl std::fmt::Display for Color {
27    #[inline]
28    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
29        f.write_str(&self.to_str())
30    }
31}