soup/auto/
auth_negotiate.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5
6use crate::{ffi, Auth};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    #[doc(alias = "SoupAuthNegotiate")]
11    pub struct AuthNegotiate(Object<ffi::SoupAuthNegotiate>) @extends Auth;
12
13    match fn {
14        type_ => || ffi::soup_auth_negotiate_get_type(),
15    }
16}
17
18impl AuthNegotiate {
19    // rustdoc-stripper-ignore-next
20    /// Creates a new builder-pattern struct instance to construct [`AuthNegotiate`] objects.
21    ///
22    /// This method returns an instance of [`AuthNegotiateBuilder`](crate::builders::AuthNegotiateBuilder) which can be used to create [`AuthNegotiate`] objects.
23    pub fn builder() -> AuthNegotiateBuilder {
24        AuthNegotiateBuilder::new()
25    }
26
27    #[doc(alias = "soup_auth_negotiate_supported")]
28    pub fn supported() -> bool {
29        assert_initialized_main_thread!();
30        unsafe { from_glib(ffi::soup_auth_negotiate_supported()) }
31    }
32}
33
34// rustdoc-stripper-ignore-next
35/// A [builder-pattern] type to construct [`AuthNegotiate`] objects.
36///
37/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
38#[must_use = "The builder must be built to be used"]
39pub struct AuthNegotiateBuilder {
40    builder: glib::object::ObjectBuilder<'static, AuthNegotiate>,
41}
42
43impl AuthNegotiateBuilder {
44    fn new() -> Self {
45        Self {
46            builder: glib::object::Object::builder(),
47        }
48    }
49
50    pub fn authority(self, authority: impl Into<glib::GString>) -> Self {
51        Self {
52            builder: self.builder.property("authority", authority.into()),
53        }
54    }
55
56    pub fn is_for_proxy(self, is_for_proxy: bool) -> Self {
57        Self {
58            builder: self.builder.property("is-for-proxy", is_for_proxy),
59        }
60    }
61
62    pub fn realm(self, realm: impl Into<glib::GString>) -> Self {
63        Self {
64            builder: self.builder.property("realm", realm.into()),
65        }
66    }
67
68    // rustdoc-stripper-ignore-next
69    /// Build the [`AuthNegotiate`].
70    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
71    pub fn build(self) -> AuthNegotiate {
72        self.builder.build()
73    }
74}