Skip to main content

gtk4/auto/
builder.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::{BuilderClosureFlags, BuilderScope, ffi};
6use glib::{
7    prelude::*,
8    signal::{SignalHandlerId, connect_raw},
9    translate::*,
10};
11use std::boxed::Box as Box_;
12
13glib::wrapper! {
14    /// ` tag to
15    /// describe a UI bound to a specific widget type. GTK will automatically load
16    /// the UI definition when instantiating the type, and bind children and
17    /// signal handlers to instance fields and function symbols.
18    ///
19    /// For more information, see the [[`Widget`][crate::Widget] documentation](class.Widget.html#building-composite-widgets-from-template-xml)
20    /// for details.
21    ///
22    /// ## Properties
23    ///
24    ///
25    /// #### `current-object`
26    ///  The object the builder is evaluating for.
27    ///
28    /// Readable | Writable
29    ///
30    ///
31    /// #### `scope`
32    ///  The scope the builder is operating in
33    ///
34    /// Readable | Writable | Construct
35    ///
36    ///
37    /// #### `translation-domain`
38    ///  The translation domain used when translating property values that
39    /// have been marked as translatable.
40    ///
41    /// If the translation domain is [`None`], [`Builder`][crate::Builder] uses gettext(),
42    /// otherwise g_dgettext().
43    ///
44    /// Readable | Writable
45    ///
46    /// # Implements
47    ///
48    /// [`trait@glib::ObjectExt`]
49    #[doc(alias = "GtkBuilder")]
50    pub struct Builder(Object<ffi::GtkBuilder, ffi::GtkBuilderClass>);
51
52    match fn {
53        type_ => || ffi::gtk_builder_get_type(),
54    }
55}
56
57impl Builder {
58    /// Creates a new empty builder object.
59    ///
60    /// This function is only useful if you intend to make multiple calls
61    /// to [`add_from_file()`][Self::add_from_file()], [`add_from_resource()`][Self::add_from_resource()]
62    /// or [`add_from_string()`][Self::add_from_string()] in order to merge multiple UI
63    /// descriptions into a single builder.
64    ///
65    /// # Returns
66    ///
67    /// a new (empty) [`Builder`][crate::Builder] object
68    #[doc(alias = "gtk_builder_new")]
69    pub fn new() -> Builder {
70        assert_initialized_main_thread!();
71        unsafe { from_glib_full(ffi::gtk_builder_new()) }
72    }
73
74    /// Parses the UI definition at @resource_path.
75    ///
76    /// If there is an error locating the resource or parsing the
77    /// description, then the program will be aborted.
78    /// ## `resource_path`
79    /// a `GResource` resource path
80    ///
81    /// # Returns
82    ///
83    /// a [`Builder`][crate::Builder] containing the described interface
84    #[doc(alias = "gtk_builder_new_from_resource")]
85    #[doc(alias = "new_from_resource")]
86    pub fn from_resource(resource_path: &str) -> Builder {
87        assert_initialized_main_thread!();
88        unsafe {
89            from_glib_full(ffi::gtk_builder_new_from_resource(
90                resource_path.to_glib_none().0,
91            ))
92        }
93    }
94
95    /// Parses the UI definition in @string.
96    ///
97    /// If @string is [`None`]-terminated, then @length should be -1.
98    /// If @length is not -1, then it is the length of @string.
99    ///
100    /// If there is an error parsing @string then the program will be
101    /// aborted. You should not attempt to parse user interface description
102    /// from untrusted sources.
103    /// ## `string`
104    /// a user interface (XML) description
105    /// ## `length`
106    /// the length of @string, or -1
107    ///
108    /// # Returns
109    ///
110    /// a [`Builder`][crate::Builder] containing the interface described by @string
111    #[doc(alias = "gtk_builder_new_from_string")]
112    #[doc(alias = "new_from_string")]
113    pub fn from_string(string: &str) -> Builder {
114        assert_initialized_main_thread!();
115        let length = string.len() as _;
116        unsafe {
117            from_glib_full(ffi::gtk_builder_new_from_string(
118                string.to_glib_none().0,
119                length,
120            ))
121        }
122    }
123
124    /// s not really reasonable to attempt to handle failures of this
125    /// call.  The only reasonable thing to do when an error is detected is
126    /// to call g_error().
127    /// ## `resource_path`
128    /// the path of the resource file to parse
129    ///
130    /// # Returns
131    ///
132    /// [`true`] on success, [`false`] if an error occurred
133    #[doc(alias = "gtk_builder_add_from_resource")]
134    pub fn add_from_resource(&self, resource_path: &str) -> Result<(), glib::Error> {
135        unsafe {
136            let mut error = std::ptr::null_mut();
137            let is_ok = ffi::gtk_builder_add_from_resource(
138                self.to_glib_none().0,
139                resource_path.to_glib_none().0,
140                &mut error,
141            );
142            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
143            if error.is_null() {
144                Ok(())
145            } else {
146                Err(from_glib_full(error))
147            }
148        }
149    }
150
151    /// s not really reasonable to attempt to handle failures of this
152    /// call.  The only reasonable thing to do when an error is detected is
153    /// to call g_error().
154    /// ## `buffer`
155    /// the string to parse
156    /// ## `length`
157    /// the length of @buffer (may be -1 if @buffer is nul-terminated)
158    ///
159    /// # Returns
160    ///
161    /// [`true`] on success, [`false`] if an error occurred
162    #[doc(alias = "gtk_builder_add_from_string")]
163    pub fn add_from_string(&self, buffer: &str) -> Result<(), glib::Error> {
164        let length = buffer.len() as _;
165        unsafe {
166            let mut error = std::ptr::null_mut();
167            let is_ok = ffi::gtk_builder_add_from_string(
168                self.to_glib_none().0,
169                buffer.to_glib_none().0,
170                length,
171                &mut error,
172            );
173            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
174            if error.is_null() {
175                Ok(())
176            } else {
177                Err(from_glib_full(error))
178            }
179        }
180    }
181
182    /// Parses a file containing a UI definition building only the
183    /// requested objects and merges them with the current contents
184    /// of @self.
185    ///
186    /// Upon errors, 0 will be returned and @error will be assigned a
187    /// `GError` from the `GTK_BUILDER_ERROR`, `G_MARKUP_ERROR` or `G_FILE_ERROR`
188    /// domain.
189    ///
190    /// If you are adding an object that depends on an object that is not
191    /// its child (for instance a [`TreeView`][crate::TreeView] that depends on its
192    /// [`TreeModel`][crate::TreeModel]), you have to explicitly list all of them in @object_ids.
193    /// ## `filename`
194    /// the name of the file to parse
195    /// ## `object_ids`
196    /// nul-terminated array of objects to build
197    ///
198    /// # Returns
199    ///
200    /// [`true`] on success, [`false`] if an error occurred
201    #[doc(alias = "gtk_builder_add_objects_from_file")]
202    pub fn add_objects_from_file(
203        &self,
204        filename: impl AsRef<std::path::Path>,
205        object_ids: &[&str],
206    ) -> Result<(), glib::Error> {
207        unsafe {
208            let mut error = std::ptr::null_mut();
209            let is_ok = ffi::gtk_builder_add_objects_from_file(
210                self.to_glib_none().0,
211                filename.as_ref().to_glib_none().0,
212                object_ids.to_glib_none().0,
213                &mut error,
214            );
215            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
216            if error.is_null() {
217                Ok(())
218            } else {
219                Err(from_glib_full(error))
220            }
221        }
222    }
223
224    /// Parses a resource file containing a UI definition, building
225    /// only the requested objects and merges them with the current
226    /// contents of @self.
227    ///
228    /// Upon errors, 0 will be returned and @error will be assigned a
229    /// `GError` from the `GTK_BUILDER_ERROR`, `G_MARKUP_ERROR` or `G_RESOURCE_ERROR`
230    /// domain.
231    ///
232    /// If you are adding an object that depends on an object that is not
233    /// its child (for instance a [`TreeView`][crate::TreeView] that depends on its
234    /// [`TreeModel`][crate::TreeModel]), you have to explicitly list all of them in @object_ids.
235    /// ## `resource_path`
236    /// the path of the resource file to parse
237    /// ## `object_ids`
238    /// nul-terminated array of objects to build
239    ///
240    /// # Returns
241    ///
242    /// [`true`] on success, [`false`] if an error occurred
243    #[doc(alias = "gtk_builder_add_objects_from_resource")]
244    pub fn add_objects_from_resource(
245        &self,
246        resource_path: &str,
247        object_ids: &[&str],
248    ) -> Result<(), glib::Error> {
249        unsafe {
250            let mut error = std::ptr::null_mut();
251            let is_ok = ffi::gtk_builder_add_objects_from_resource(
252                self.to_glib_none().0,
253                resource_path.to_glib_none().0,
254                object_ids.to_glib_none().0,
255                &mut error,
256            );
257            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
258            if error.is_null() {
259                Ok(())
260            } else {
261                Err(from_glib_full(error))
262            }
263        }
264    }
265
266    /// Parses a string containing a UI definition, building only the
267    /// requested objects and merges them with the current contents of
268    /// @self.
269    ///
270    /// Upon errors [`false`] will be returned and @error will be assigned a
271    /// `GError` from the `GTK_BUILDER_ERROR` or `G_MARKUP_ERROR` domain.
272    ///
273    /// If you are adding an object that depends on an object that is not
274    /// its child (for instance a [`TreeView`][crate::TreeView] that depends on its
275    /// [`TreeModel`][crate::TreeModel]), you have to explicitly list all of them in @object_ids.
276    /// ## `buffer`
277    /// the string to parse
278    /// ## `length`
279    /// the length of @buffer (may be -1 if @buffer is nul-terminated)
280    /// ## `object_ids`
281    /// nul-terminated array of objects to build
282    ///
283    /// # Returns
284    ///
285    /// [`true`] on success, [`false`] if an error occurred
286    #[doc(alias = "gtk_builder_add_objects_from_string")]
287    pub fn add_objects_from_string(
288        &self,
289        buffer: &str,
290        object_ids: &[&str],
291    ) -> Result<(), glib::Error> {
292        let length = buffer.len() as _;
293        unsafe {
294            let mut error = std::ptr::null_mut();
295            let is_ok = ffi::gtk_builder_add_objects_from_string(
296                self.to_glib_none().0,
297                buffer.to_glib_none().0,
298                length,
299                object_ids.to_glib_none().0,
300                &mut error,
301            );
302            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
303            if error.is_null() {
304                Ok(())
305            } else {
306                Err(from_glib_full(error))
307            }
308        }
309    }
310
311    /// Creates a closure to invoke the function called @function_name.
312    ///
313    /// This is using the create_closure() implementation of @self's
314    /// [`BuilderScope`][crate::BuilderScope].
315    ///
316    /// If no closure could be created, [`None`] will be returned and @error
317    /// will be set.
318    /// ## `function_name`
319    /// name of the function to look up
320    /// ## `flags`
321    /// closure creation flags
322    /// ## `object`
323    /// Object to create the closure with
324    ///
325    /// # Returns
326    ///
327    /// A new closure for invoking @function_name
328    #[doc(alias = "gtk_builder_create_closure")]
329    pub fn create_closure(
330        &self,
331        function_name: &str,
332        flags: BuilderClosureFlags,
333        object: Option<&impl IsA<glib::Object>>,
334    ) -> Result<Option<glib::Closure>, glib::Error> {
335        unsafe {
336            let mut error = std::ptr::null_mut();
337            let ret = ffi::gtk_builder_create_closure(
338                self.to_glib_none().0,
339                function_name.to_glib_none().0,
340                flags.into_glib(),
341                object.map(|p| p.as_ref()).to_glib_none().0,
342                &mut error,
343            );
344            if error.is_null() {
345                Ok(from_glib_none(ret))
346            } else {
347                Err(from_glib_full(error))
348            }
349        }
350    }
351
352    /// Add @object to the @self object pool so it can be
353    /// referenced just like any other object built by builder.
354    ///
355    /// Only a single object may be added using @name. However,
356    /// it is not an error to expose the same object under multiple
357    /// names. `gtk_builder_get_object()` may be used to determine
358    /// if an object has already been added with @name.
359    /// ## `name`
360    /// the name of the object exposed to the builder
361    /// ## `object`
362    /// the object to expose
363    #[doc(alias = "gtk_builder_expose_object")]
364    pub fn expose_object(&self, name: &str, object: &impl IsA<glib::Object>) {
365        unsafe {
366            ffi::gtk_builder_expose_object(
367                self.to_glib_none().0,
368                name.to_glib_none().0,
369                object.as_ref().to_glib_none().0,
370            );
371        }
372    }
373
374    /// Main private entry point for building composite components
375    /// from template XML.
376    ///
377    /// Most likely you do not need to call this function in applications as
378    /// templates are handled by [`Widget`][crate::Widget].
379    /// ## `object`
380    /// the object that is being extended
381    /// ## `template_type`
382    /// the type that the template is for
383    /// ## `buffer`
384    /// the string to parse
385    /// ## `length`
386    /// the length of @buffer (may be -1 if @buffer is nul-terminated)
387    ///
388    /// # Returns
389    ///
390    /// A positive value on success, 0 if an error occurred
391    #[doc(alias = "gtk_builder_extend_with_template")]
392    pub fn extend_with_template(
393        &self,
394        object: &impl IsA<glib::Object>,
395        template_type: glib::types::Type,
396        buffer: &str,
397    ) -> Result<(), glib::Error> {
398        let length = buffer.len() as _;
399        unsafe {
400            let mut error = std::ptr::null_mut();
401            let is_ok = ffi::gtk_builder_extend_with_template(
402                self.to_glib_none().0,
403                object.as_ref().to_glib_none().0,
404                template_type.into_glib(),
405                buffer.to_glib_none().0,
406                length,
407                &mut error,
408            );
409            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
410            if error.is_null() {
411                Ok(())
412            } else {
413                Err(from_glib_full(error))
414            }
415        }
416    }
417
418    /// Gets all objects that have been constructed by @self.
419    ///
420    /// Note that this function does not increment the reference
421    /// counts of the returned objects.
422    ///
423    /// # Returns
424    ///
425    /// a
426    ///   newly-allocated `GSList` containing all the objects
427    ///   constructed by the `GtkBuilder instance`. It should be
428    ///   freed by g_slist_free()
429    #[doc(alias = "gtk_builder_get_objects")]
430    #[doc(alias = "get_objects")]
431    pub fn objects(&self) -> Vec<glib::Object> {
432        unsafe {
433            FromGlibPtrContainer::from_glib_container(ffi::gtk_builder_get_objects(
434                self.to_glib_none().0,
435            ))
436        }
437    }
438
439    /// Gets the scope in use that was set via gtk_builder_set_scope().
440    ///
441    /// # Returns
442    ///
443    /// the current scope
444    #[doc(alias = "gtk_builder_get_scope")]
445    #[doc(alias = "get_scope")]
446    pub fn scope(&self) -> BuilderScope {
447        unsafe { from_glib_none(ffi::gtk_builder_get_scope(self.to_glib_none().0)) }
448    }
449
450    /// Gets the translation domain of @self.
451    ///
452    /// # Returns
453    ///
454    /// the translation domain
455    #[doc(alias = "gtk_builder_get_translation_domain")]
456    #[doc(alias = "get_translation_domain")]
457    #[doc(alias = "translation-domain")]
458    pub fn translation_domain(&self) -> Option<glib::GString> {
459        unsafe {
460            from_glib_none(ffi::gtk_builder_get_translation_domain(
461                self.to_glib_none().0,
462            ))
463        }
464    }
465
466    /// Looks up a type by name.
467    ///
468    /// This is using the virtual function that [`Builder`][crate::Builder] has
469    /// for that purpose. This is mainly used when implementing
470    /// the [`Buildable`][crate::Buildable] interface on a type.
471    /// ## `type_name`
472    /// type name to lookup
473    ///
474    /// # Returns
475    ///
476    /// the `GType` found for @type_name or `G_TYPE_INVALID`
477    ///   if no type was found
478    #[doc(alias = "gtk_builder_get_type_from_name")]
479    #[doc(alias = "get_type_from_name")]
480    pub fn type_from_name(&self, type_name: &str) -> glib::types::Type {
481        unsafe {
482            from_glib(ffi::gtk_builder_get_type_from_name(
483                self.to_glib_none().0,
484                type_name.to_glib_none().0,
485            ))
486        }
487    }
488
489    /// Sets the current object for the @self.
490    ///
491    /// The current object can be thought of as the `this` object that the
492    /// builder is working for and will often be used as the default object
493    /// when an object is optional.
494    ///
495    /// `Gtk::Widget::init_template()` for example will set the current
496    /// object to the widget the template is inited for. For functions like
497    /// [`from_resource()`][Self::from_resource()], the current object will be [`None`].
498    /// ## `current_object`
499    /// the new current object
500    #[doc(alias = "gtk_builder_set_current_object")]
501    #[doc(alias = "current-object")]
502    pub fn set_current_object(&self, current_object: Option<&impl IsA<glib::Object>>) {
503        unsafe {
504            ffi::gtk_builder_set_current_object(
505                self.to_glib_none().0,
506                current_object.map(|p| p.as_ref()).to_glib_none().0,
507            );
508        }
509    }
510
511    /// Sets the scope the builder should operate in.
512    ///
513    /// If @scope is [`None`], a new `Gtk::BuilderCScope` will be created.
514    /// ## `scope`
515    /// the scope to use
516    #[doc(alias = "gtk_builder_set_scope")]
517    #[doc(alias = "scope")]
518    pub fn set_scope(&self, scope: Option<&impl IsA<BuilderScope>>) {
519        unsafe {
520            ffi::gtk_builder_set_scope(
521                self.to_glib_none().0,
522                scope.map(|p| p.as_ref()).to_glib_none().0,
523            );
524        }
525    }
526
527    /// Sets the translation domain of @self.
528    /// ## `domain`
529    /// the translation domain
530    #[doc(alias = "gtk_builder_set_translation_domain")]
531    #[doc(alias = "translation-domain")]
532    pub fn set_translation_domain(&self, domain: Option<&str>) {
533        unsafe {
534            ffi::gtk_builder_set_translation_domain(self.to_glib_none().0, domain.to_glib_none().0);
535        }
536    }
537
538    /// Demarshals a value from a string.
539    ///
540    /// This function calls g_value_init() on the @value argument,
541    /// so it need not be initialised beforehand.
542    ///
543    /// Can handle char, uchar, boolean, int, uint, long,
544    /// ulong, enum, flags, float, double, string, [`gdk::RGBA`][crate::gdk::RGBA] and
545    /// [`Adjustment`][crate::Adjustment] type values.
546    ///
547    /// Upon errors [`false`] will be returned and @error will be
548    /// assigned a `GError` from the `GTK_BUILDER_ERROR` domain.
549    /// ## `pspec`
550    /// the `GParamSpec` for the property
551    /// ## `string`
552    /// the string representation of the value
553    ///
554    /// # Returns
555    ///
556    /// [`true`] on success
557    ///
558    /// ## `value`
559    /// the `GValue` to store the result in
560    #[doc(alias = "gtk_builder_value_from_string")]
561    pub fn value_from_string(
562        &self,
563        pspec: impl AsRef<glib::ParamSpec>,
564        string: &str,
565    ) -> Result<glib::Value, glib::Error> {
566        unsafe {
567            let mut value = glib::Value::uninitialized();
568            let mut error = std::ptr::null_mut();
569            let is_ok = ffi::gtk_builder_value_from_string(
570                self.to_glib_none().0,
571                pspec.as_ref().to_glib_none().0,
572                string.to_glib_none().0,
573                value.to_glib_none_mut().0,
574                &mut error,
575            );
576            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
577            if error.is_null() {
578                Ok(value)
579            } else {
580                Err(from_glib_full(error))
581            }
582        }
583    }
584
585    /// Demarshals a value from a string.
586    ///
587    /// Unlike [`value_from_string()`][Self::value_from_string()], this function
588    /// takes a `GType` instead of `GParamSpec`.
589    ///
590    /// Calls g_value_init() on the @value argument, so it
591    /// need not be initialised beforehand.
592    ///
593    /// Upon errors [`false`] will be returned and @error will be
594    /// assigned a `GError` from the `GTK_BUILDER_ERROR` domain.
595    /// ## `type_`
596    /// the `GType` of the value
597    /// ## `string`
598    /// the string representation of the value
599    ///
600    /// # Returns
601    ///
602    /// [`true`] on success
603    ///
604    /// ## `value`
605    /// the `GValue` to store the result in
606    #[doc(alias = "gtk_builder_value_from_string_type")]
607    pub fn value_from_string_type(
608        &self,
609        type_: glib::types::Type,
610        string: &str,
611    ) -> Result<glib::Value, glib::Error> {
612        unsafe {
613            let mut value = glib::Value::uninitialized();
614            let mut error = std::ptr::null_mut();
615            let is_ok = ffi::gtk_builder_value_from_string_type(
616                self.to_glib_none().0,
617                type_.into_glib(),
618                string.to_glib_none().0,
619                value.to_glib_none_mut().0,
620                &mut error,
621            );
622            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
623            if error.is_null() {
624                Ok(value)
625            } else {
626                Err(from_glib_full(error))
627            }
628        }
629    }
630
631    #[doc(alias = "current-object")]
632    pub fn connect_current_object_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
633        unsafe extern "C" fn notify_current_object_trampoline<F: Fn(&Builder) + 'static>(
634            this: *mut ffi::GtkBuilder,
635            _param_spec: glib::ffi::gpointer,
636            f: glib::ffi::gpointer,
637        ) {
638            unsafe {
639                let f: &F = &*(f as *const F);
640                f(&from_glib_borrow(this))
641            }
642        }
643        unsafe {
644            let f: Box_<F> = Box_::new(f);
645            connect_raw(
646                self.as_ptr() as *mut _,
647                c"notify::current-object".as_ptr(),
648                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
649                    notify_current_object_trampoline::<F> as *const (),
650                )),
651                Box_::into_raw(f),
652            )
653        }
654    }
655
656    #[doc(alias = "scope")]
657    pub fn connect_scope_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
658        unsafe extern "C" fn notify_scope_trampoline<F: Fn(&Builder) + 'static>(
659            this: *mut ffi::GtkBuilder,
660            _param_spec: glib::ffi::gpointer,
661            f: glib::ffi::gpointer,
662        ) {
663            unsafe {
664                let f: &F = &*(f as *const F);
665                f(&from_glib_borrow(this))
666            }
667        }
668        unsafe {
669            let f: Box_<F> = Box_::new(f);
670            connect_raw(
671                self.as_ptr() as *mut _,
672                c"notify::scope".as_ptr(),
673                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
674                    notify_scope_trampoline::<F> as *const (),
675                )),
676                Box_::into_raw(f),
677            )
678        }
679    }
680
681    #[doc(alias = "translation-domain")]
682    pub fn connect_translation_domain_notify<F: Fn(&Self) + 'static>(
683        &self,
684        f: F,
685    ) -> SignalHandlerId {
686        unsafe extern "C" fn notify_translation_domain_trampoline<F: Fn(&Builder) + 'static>(
687            this: *mut ffi::GtkBuilder,
688            _param_spec: glib::ffi::gpointer,
689            f: glib::ffi::gpointer,
690        ) {
691            unsafe {
692                let f: &F = &*(f as *const F);
693                f(&from_glib_borrow(this))
694            }
695        }
696        unsafe {
697            let f: Box_<F> = Box_::new(f);
698            connect_raw(
699                self.as_ptr() as *mut _,
700                c"notify::translation-domain".as_ptr(),
701                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
702                    notify_translation_domain_trampoline::<F> as *const (),
703                )),
704                Box_::into_raw(f),
705            )
706        }
707    }
708}
709
710impl Default for Builder {
711    fn default() -> Self {
712        Self::new()
713    }
714}