gdk4/
content_formats_builder.rs1use glib::translate::*;
4
5use crate::{ffi, ContentFormats, ContentFormatsBuilder};
6
7impl ContentFormatsBuilder {
8 #[doc(alias = "gdk_content_formats_builder_add_formats")]
9 #[must_use]
10 pub fn add_formats(self, formats: &ContentFormats) -> Self {
11 unsafe {
12 ffi::gdk_content_formats_builder_add_formats(
13 self.to_glib_none().0,
14 formats.to_glib_none().0,
15 );
16 }
17
18 self
19 }
20
21 #[doc(alias = "gdk_content_formats_builder_add_gtype")]
22 #[must_use]
23 pub fn add_type(self, type_: glib::types::Type) -> Self {
24 unsafe {
25 ffi::gdk_content_formats_builder_add_gtype(self.to_glib_none().0, type_.into_glib());
26 }
27
28 self
29 }
30
31 #[doc(alias = "gdk_content_formats_builder_add_mime_type")]
32 #[must_use]
33 pub fn add_mime_type(self, mime_type: impl IntoGStr) -> Self {
34 unsafe {
35 mime_type.run_with_gstr(|mime_type| {
36 ffi::gdk_content_formats_builder_add_mime_type(
37 self.to_glib_none().0,
38 mime_type.as_ptr(),
39 );
40 });
41 }
42
43 self
44 }
45
46 #[doc(alias = "gdk_content_formats_builder_to_formats")]
47 #[must_use = "The builder must be built to be used"]
48 pub fn build(self) -> ContentFormats {
49 unsafe {
50 from_glib_full(ffi::gdk_content_formats_builder_to_formats(
51 self.to_glib_none().0,
52 ))
53 }
54 }
55}