soup3-0.7.0/.cargo_vcs_info.json0000644000000001360000000000100121110ustar { "git": { "sha1": "f8a683cd58a72f2e0912255f87e57453b0684cbe" }, "path_in_vcs": "" }soup3-0.7.0/.gitignore000064400000000000000000000000221046102023000126630ustar 00000000000000target Cargo.lock soup3-0.7.0/.gitlab-ci.yml000064400000000000000000000034421046102023000133400ustar 00000000000000variables: # format is = # the name is used in the URL # latest release must be at the top # (only relevant on main branch) RELEASES: | v0.6=0.6 image: "debian:testing" before_script: - apt update; apt install -y --no-install-recommends git build-essential libsoup-3.0-dev libglib2.0-dev ca-certificates meson cmake libnghttp2-dev libsqlite3-dev libpsl-dev glib-networking curl # compile libsoup3 - git clone --recursive https://gitlab.gnome.org/GNOME/libsoup - cd libsoup - meson build -Dprefix=/usr -Dbrotli=enabled -Ddocs=disabled -Dinstalled_tests=false -Dvapi=disabled - cd build - ninja install - cd ../../ - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y - source $HOME/.cargo/env - rustup toolchain install nightly --profile minimal --allow-downgrade -c rustfmt - git submodule update --init - curl --proto '=https' --tlsv1.2 -sSf -o gir-rustdoc.py https://gitlab.gnome.org/World/Rust/gir-rustdoc/-/raw/main/gir-rustdoc.py - chmod +x gir-rustdoc.py build: script: - cargo build --all-features --examples - cargo test docs: stage: test variables: GIT_SUBMODULE_STRATEGY: recursive RUSTFLAGS: --cfg docsrs script: # generate the docs - cargo install rustdoc-stripper - ./generator.py --embed-docs - rustup default nightly - eval $(./gir-rustdoc.py pre-docs) - cargo doc --all-features --no-deps - mv target/doc/ docs artifacts: paths: - docs pages: stage: deploy script: - ./gir-rustdoc.py html-index # main docs - mkdir public/git - mv docs public/git/docs # stable docs # - ./gir-rustdoc.py docs-from-artifacts artifacts: paths: - public rules: - if: $CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH soup3-0.7.0/.gitmodules000064400000000000000000000002301046102023000130510ustar 00000000000000[submodule "gir-files"] path = gir-files url = https://github.com/gtk-rs/gir-files [submodule "gir"] path = gir url = https://github.com/gtk-rs/gir soup3-0.7.0/Cargo.toml0000644000000027100000000000100101070ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2021" rust-version = "1.70" name = "soup3" version = "0.7.0" exclude = [ "gir", "gir-files", "generator.py", "Soup-3.0.gir", ] description = "Soup crate for Rust" readme = "README.md" keywords = [ "soup", "gtk-rs", "gnome", ] license = "MIT" repository = "https://gitlab.gnome.org/World/Rust/soup3-rs" [package.metadata.docs.rs] all-features = true rustc-args = [ "--cfg", "docsrs", ] rustdoc-args = [ "--cfg", "docsrs", ] [lib] name = "soup" [dependencies.ffi] version = "0.7" package = "soup3-sys" [dependencies.futures-channel] version = "0.3" [dependencies.gio] version = "0.20" features = ["v2_70"] [dependencies.glib] version = "0.20" features = ["v2_66"] [dependencies.libc] version = "0.2" [dev-dependencies.gir-format-check] version = "^0.1" [dev-dependencies.rustdoc-stripper] version = "^0.1.5" [features] default = ["ffi/v3_0"] v3_2 = ["ffi/v3_2"] v3_4 = [ "v3_2", "ffi/v3_4", ] v3_6 = [ "v3_4", "ffi/v3_6", ] soup3-0.7.0/Cargo.toml.orig000064400000000000000000000017331046102023000135740ustar 00000000000000[package] name = "soup3" version = "0.7.0" edition = "2021" rust-version = "1.70" description = "Soup crate for Rust" repository = "https://gitlab.gnome.org/World/Rust/soup3-rs" license = "MIT" keywords = ["soup", "gtk-rs", "gnome"] exclude = ["gir", "gir-files", "generator.py", "Soup-3.0.gir"] [package.metadata.docs.rs] all-features = true rustc-args = ["--cfg", "docsrs"] rustdoc-args = ["--cfg", "docsrs"] [lib] name = "soup" [dependencies] libc = "0.2" futures-channel = "0.3" [dependencies.ffi] package = "soup3-sys" path = "sys" version = "0.7" [dependencies.glib] git = "https://github.com/gtk-rs/gtk-rs-core" branch = "0.20" version = "0.20" features = [ "v2_66" ] [dependencies.gio] git = "https://github.com/gtk-rs/gtk-rs-core" branch = "0.20" version = "0.20" features = [ "v2_70" ] [features] default = ["ffi/v3_0"] v3_2 = ["ffi/v3_2"] v3_4 = ["v3_2", "ffi/v3_4"] v3_6 = ["v3_4", "ffi/v3_6"] [dev-dependencies] rustdoc-stripper = "^0.1.5" gir-format-check = "^0.1" soup3-0.7.0/Gir.toml000064400000000000000000000150011046102023000123140ustar 00000000000000[external_libraries] Gio = {min_version = "2.66"} [options] girs_directories = [".", "./gir-files"] library = "Soup" version = "3.0" min_cfg_version = "3.0" target_path = "." work_mode = "normal" generate_safety_asserts = true deprecate_by_min_version = true single_version_file = true use_gi_docgen = true generate_builder = true external_libraries = [ "GLib", "GObject", ] generate = [ # "Soup.*", "Soup.Auth", "Soup.AuthBasic", "Soup.AuthDigest", "Soup.AuthDomainBasicAuthCallback", "Soup.AuthDomainFilter", "Soup.AuthDomainGenericAuthCallback", "Soup.AuthManager", "Soup.AuthNegotiate", "Soup.AuthNTLM", "Soup.Cache", "Soup.Cacheability", "Soup.CacheType", "Soup.ContentDecoder", "Soup.ContentSniffer", "Soup.CookieJarAcceptPolicy", "Soup.CookieJarDB", "Soup.CookieJarText", "Soup.DateFormat", "Soup.Encoding", "Soup.Expectation", "Soup.HSTSEnforcer", "Soup.HSTSEnforcerDB", # "Soup.HSTSPolicy", "Soup.HTTPVersion", # "Soup.Logger", "Soup.LoggerFilter", "Soup.LoggerLogLevel", "Soup.LoggerPrinter", "Soup.MemoryUse", # "Soup.Message", # "Soup.MessageBody", "Soup.MessageFlags", # "Soup.MessageHeadersIter", "Soup.MessageHeadersType", "Soup.MessageMetrics", "Soup.MessagePriority", "Soup.Multipart", # "Soup.MultipartInputStream", # "Soup.Range", "Soup.SameSitePolicy", "Soup.ServerMessage", "Soup.ServerListenOptions", "Soup.SessionError", "Soup.SessionFeature", "Soup.Status", "Soup.TLDError", "Soup.URIComponent", "Soup.WebsocketCloseCode", # "Soup.WebsocketConnection", "Soup.WebsocketConnectionType", "Soup.WebsocketDataType", "Soup.WebsocketError", "Soup.WebsocketExtension", # "Soup.WebsocketExtensionDeflate", "Soup.WebsocketExtensionManager", "Soup.WebsocketState", ] manual = [ "Gio.AsyncResult", "Gio.Cancellable", "Gio.File", "Gio.FilterInputStream", "Gio.InputStream", "Gio.IOStream", "Gio.InetSocketAddress", "Gio.OutputStream", "Gio.OutputStreamSpliceFlags", "Gio.PollableInputStream", "Gio.ProxyResolver", "Gio.Socket", "Gio.SocketAddress", "Gio.SocketClientEvent", "Gio.SocketConnectable", "Gio.TlsCertificate", "Gio.TlsCertificateFlags", "Gio.TlsClientConnection", "Gio.TlsDatabase", "Gio.TlsInteraction", "Gio.TlsAuthenticationMode", "Gio.TlsPassword", "Gio.TlsProtocolVersion", "GLib.Bytes", "GLib.DateTime", "GLib.DestroyNotify", "GLib.Error", "GLib.HashTable", "GLib.IOChannel", "GLib.IOCondition", "GLib.IOFunc", "GLib.List", "GLib.MainContext", "GLib.Priority", "GLib.PtrArray", "GLib.Quark", "GLib.SList", "GLib.Source", "GLib.SourceFunc", "GLib.Uri", # "GLib.Value", # "GLib.ValueArray", "GLib.Variant", "GObject.Object" # "GLib.Data", # "GLib.TimeVal", ] [[object]] name="Soup.Cookie" status = "generate" [[object.function]] name = "equal" [[object.function.parameter]] name = "cookie1" const = true [[object.function.parameter]] name = "cookie2" const = true [[object]] name="Soup.CookieJar" status = "generate" manual_traits = ["CookieJarExtManual"] [[object.function]] name = "add_cookie" manual = true [[object.function]] name = "add_cookie_full" manual = true [[object.function]] name = "add_cookie_with_first_party" manual = true [[object.function]] name = "delete_cookie" manual = true [[object]] name="Soup.AuthDomain" status="generate" [[object.property]] name="filter" ignore=true [[object.property]] name="generic-auth-callback" ignore=true [[object]] name="Soup.AuthDomainBasic" status="generate" [[object.property]] name="auth-callback" ignore=true [[object]] name="Soup.AuthDomainDigest" status="generate" [[object.property]] name="auth-callback" ignore=true [[object]] name="Soup.Server" manual_traits = ["ServerExtManual"] status="generate" [[object.function]] name="add_early_handler" manual = true [[object.function]] name="add_handler" manual = true [[object.function]] name="add_websocket_handler" manual = true [[object]] name = "Soup.Session" status = "generate" manual_traits = ["SessionExtManual"] [[object.function]] name = "websocket_connect_async" ignore = true [[object]] name="Soup.Logger" status = "generate" [[object.function]] name = "set_printer" manual = true [[object]] name="Soup.MessageBody" status = "generate" [[object.function]] name = "append" ignore = true # [[object]] # name="Soup.CookieJar" # status = "generate" # [[object.function]] # name = "add_cookie" # ignore= true # [[object.function]] # name = "add_cookie_with_first_party" # ignore= true # [[object.function]] # name = "add_cookie_full" # ignore= true # [[object.function]] # name = "get_cookie_list_with_same_site_info" # ignore= true [[object]] name="Soup.WebsocketConnection" manual_traits = ["WebsocketConnectionExtManual"] status="generate" [[object.function]] name = "new" manual = true [[object.function]] name = "send_binary" ignore = true [[object.function]] name = "send_message" ignore = true [[object]] name="Soup.WebsocketExtensionDeflate" version="2.68" status="generate" [[object]] name="Soup.MultipartInputStream" status="generate" [[object.function]] name="next_part_async" ignore=true [[object]] name="Soup.Message" status="generate" [[object.function]] name="new" [object.function.return] nullable_return_is_error = "Invalid URL" [[object.function]] name="new_from_encoded_form" [object.function.return] nullable_return_is_error = "Invalid URL" [[object.function]] name="new_from_multipart" [object.function.return] nullable_return_is_error = "Invalid URL" [[object.function]] name = "get_site_for_cookies" ignore = true [[object.function]] name = "set_site_for_cookies" ignore = true [[object.function]] name="set_chunk_allocator" ignore=true [[object]] name="Soup.MessageHeaders" status="generate" [[object.function]] name = "get_content_disposition" manual = true [[object.function]] name = "set_content_disposition" manual = true [[object.function]] name = "get_content_type" manual = true [[object.function]] name = "set_content_type" manual = true [[object]] name="Soup.HSTSPolicy" status="generate" [[object.function]] name="equal" ignore=true [[object]] name="Soup.*" status="generate" [[object.function]] name = "(header_g_string_append_param|soup_header_g_string_append_param_quoted)" manual = true [[object.function]] name = "cookies_free" ignore = true [[object.function]] name = "cookies_to_cookie_header" ignore = true [[object.function]] name = "cookies_to_request" ignore = true [[object.function]] name = "cookies_to_response" ignore = true soup3-0.7.0/LICENSE000064400000000000000000000021201046102023000117010ustar 00000000000000The MIT License (MIT) Copyright (c) 2013-2017, The Gtk-rs Project Developers. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. soup3-0.7.0/README.md000064400000000000000000000016741046102023000121700ustar 00000000000000# Soup3-rs [Project site](https://gitlab.gnome.org/World/Rust/soup3-rs) | [Online documentation](https://world.pages.gitlab.gnome.org/Rust/soup3-rs/git/docs/soup/) __Rust__ bindings and wrappers for __libsoup__ v3. ## Using We recommend using [crates from crates.io](https://crates.io/crates/soup3). If you want to track the bleeding edge, use the git dependency instead: ```toml [dependencies] soup3 = { git = "https://gitlab.gnome.org/World/Rust/soup3-rs" } ``` Avoid mixing versioned and git crates like this: ```toml # This will not compile [dependencies] gtk3 = "0.15" soup3 = { git = "https://gitlab.gnome.org/World/Rust/soup3-rs" } ``` ## Minimum supported Rust version Currently, the minimum supported Rust version is `1.56.0`. ## Documentation https://world.pages.gitlab.gnome.org/Rust/soup3-rs/git/docs/soup ## Contribute Contributor you're welcome! ## License __soup3-rs__ is available under the MIT License, please refer to it. soup3-0.7.0/src/auto/auth.rs000064400000000000000000000253341046102023000137560ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, Message}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "SoupAuth")] pub struct Auth(Object); match fn { type_ => || ffi::soup_auth_get_type(), } } impl Auth { pub const NONE: Option<&'static Auth> = None; #[doc(alias = "soup_auth_new")] pub fn new(type_: glib::types::Type, msg: &Message, auth_header: &str) -> Option { skip_assert_initialized!(); unsafe { from_glib_full(ffi::soup_auth_new( type_.into_glib(), msg.to_glib_none().0, auth_header.to_glib_none().0, )) } } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait AuthExt: IsA + sealed::Sealed + 'static { #[doc(alias = "soup_auth_authenticate")] fn authenticate(&self, username: &str, password: &str) { unsafe { ffi::soup_auth_authenticate( self.as_ref().to_glib_none().0, username.to_glib_none().0, password.to_glib_none().0, ); } } #[doc(alias = "soup_auth_can_authenticate")] fn can_authenticate(&self) -> bool { unsafe { from_glib(ffi::soup_auth_can_authenticate( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_auth_cancel")] fn cancel(&self) { unsafe { ffi::soup_auth_cancel(self.as_ref().to_glib_none().0); } } //#[doc(alias = "soup_auth_free_protection_space")] //fn free_protection_space(&self, space: /*Unimplemented*/&[&Basic: Pointer]) { // unsafe { TODO: call ffi:soup_auth_free_protection_space() } //} #[doc(alias = "soup_auth_get_authority")] #[doc(alias = "get_authority")] fn authority(&self) -> Option { unsafe { from_glib_none(ffi::soup_auth_get_authority(self.as_ref().to_glib_none().0)) } } #[doc(alias = "soup_auth_get_authorization")] #[doc(alias = "get_authorization")] fn authorization(&self, msg: &Message) -> Option { unsafe { from_glib_full(ffi::soup_auth_get_authorization( self.as_ref().to_glib_none().0, msg.to_glib_none().0, )) } } #[doc(alias = "soup_auth_get_info")] #[doc(alias = "get_info")] fn info(&self) -> Option { unsafe { from_glib_full(ffi::soup_auth_get_info(self.as_ref().to_glib_none().0)) } } #[doc(alias = "soup_auth_get_protection_space")] #[doc(alias = "get_protection_space")] fn protection_space(&self, source_uri: &glib::Uri) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::soup_auth_get_protection_space( self.as_ref().to_glib_none().0, source_uri.to_glib_none().0, )) } } #[doc(alias = "soup_auth_get_realm")] #[doc(alias = "get_realm")] fn realm(&self) -> Option { unsafe { from_glib_none(ffi::soup_auth_get_realm(self.as_ref().to_glib_none().0)) } } #[doc(alias = "soup_auth_get_scheme_name")] #[doc(alias = "get_scheme_name")] #[doc(alias = "scheme-name")] fn scheme_name(&self) -> Option { unsafe { from_glib_none(ffi::soup_auth_get_scheme_name( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_auth_is_authenticated")] #[doc(alias = "is-authenticated")] fn is_authenticated(&self) -> bool { unsafe { from_glib(ffi::soup_auth_is_authenticated( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_auth_is_cancelled")] #[doc(alias = "is-cancelled")] fn is_cancelled(&self) -> bool { unsafe { from_glib(ffi::soup_auth_is_cancelled(self.as_ref().to_glib_none().0)) } } #[doc(alias = "soup_auth_is_for_proxy")] #[doc(alias = "is-for-proxy")] fn is_for_proxy(&self) -> bool { unsafe { from_glib(ffi::soup_auth_is_for_proxy(self.as_ref().to_glib_none().0)) } } #[doc(alias = "soup_auth_is_ready")] fn is_ready(&self, msg: &Message) -> bool { unsafe { from_glib(ffi::soup_auth_is_ready( self.as_ref().to_glib_none().0, msg.to_glib_none().0, )) } } #[doc(alias = "soup_auth_update")] fn update(&self, msg: &Message, auth_header: &str) -> bool { unsafe { from_glib(ffi::soup_auth_update( self.as_ref().to_glib_none().0, msg.to_glib_none().0, auth_header.to_glib_none().0, )) } } fn set_authority(&self, authority: Option<&str>) { ObjectExt::set_property(self.as_ref(), "authority", authority) } #[doc(alias = "is-for-proxy")] fn set_is_for_proxy(&self, is_for_proxy: bool) { ObjectExt::set_property(self.as_ref(), "is-for-proxy", is_for_proxy) } fn set_realm(&self, realm: Option<&str>) { ObjectExt::set_property(self.as_ref(), "realm", realm) } #[doc(alias = "authority")] fn connect_authority_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_authority_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::SoupAuth, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Auth::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::authority\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_authority_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "is-authenticated")] fn connect_is_authenticated_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_is_authenticated_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::SoupAuth, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Auth::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::is-authenticated\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_is_authenticated_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "is-cancelled")] fn connect_is_cancelled_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_is_cancelled_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::SoupAuth, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Auth::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::is-cancelled\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_is_cancelled_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "is-for-proxy")] fn connect_is_for_proxy_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_is_for_proxy_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::SoupAuth, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Auth::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::is-for-proxy\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_is_for_proxy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "realm")] fn connect_realm_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_realm_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::SoupAuth, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Auth::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::realm\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_realm_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "scheme-name")] fn connect_scheme_name_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_scheme_name_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::SoupAuth, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Auth::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::scheme-name\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_scheme_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> AuthExt for O {} soup3-0.7.0/src/auto/auth_basic.rs000064400000000000000000000037431046102023000151170ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, Auth}; use glib::prelude::*; glib::wrapper! { #[doc(alias = "SoupAuthBasic")] pub struct AuthBasic(Object) @extends Auth; match fn { type_ => || ffi::soup_auth_basic_get_type(), } } impl AuthBasic { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`AuthBasic`] objects. /// /// This method returns an instance of [`AuthBasicBuilder`](crate::builders::AuthBasicBuilder) which can be used to create [`AuthBasic`] objects. pub fn builder() -> AuthBasicBuilder { AuthBasicBuilder::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`AuthBasic`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct AuthBasicBuilder { builder: glib::object::ObjectBuilder<'static, AuthBasic>, } impl AuthBasicBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn authority(self, authority: impl Into) -> Self { Self { builder: self.builder.property("authority", authority.into()), } } pub fn is_for_proxy(self, is_for_proxy: bool) -> Self { Self { builder: self.builder.property("is-for-proxy", is_for_proxy), } } pub fn realm(self, realm: impl Into) -> Self { Self { builder: self.builder.property("realm", realm.into()), } } // rustdoc-stripper-ignore-next /// Build the [`AuthBasic`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> AuthBasic { self.builder.build() } } soup3-0.7.0/src/auto/auth_digest.rs000064400000000000000000000037641046102023000153200ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, Auth}; use glib::prelude::*; glib::wrapper! { #[doc(alias = "SoupAuthDigest")] pub struct AuthDigest(Object) @extends Auth; match fn { type_ => || ffi::soup_auth_digest_get_type(), } } impl AuthDigest { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`AuthDigest`] objects. /// /// This method returns an instance of [`AuthDigestBuilder`](crate::builders::AuthDigestBuilder) which can be used to create [`AuthDigest`] objects. pub fn builder() -> AuthDigestBuilder { AuthDigestBuilder::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`AuthDigest`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct AuthDigestBuilder { builder: glib::object::ObjectBuilder<'static, AuthDigest>, } impl AuthDigestBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn authority(self, authority: impl Into) -> Self { Self { builder: self.builder.property("authority", authority.into()), } } pub fn is_for_proxy(self, is_for_proxy: bool) -> Self { Self { builder: self.builder.property("is-for-proxy", is_for_proxy), } } pub fn realm(self, realm: impl Into) -> Self { Self { builder: self.builder.property("realm", realm.into()), } } // rustdoc-stripper-ignore-next /// Build the [`AuthDigest`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> AuthDigest { self.builder.build() } } soup3-0.7.0/src/auto/auth_domain.rs000064400000000000000000000207361046102023000153060ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, ServerMessage}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "SoupAuthDomain")] pub struct AuthDomain(Object); match fn { type_ => || ffi::soup_auth_domain_get_type(), } } impl AuthDomain { pub const NONE: Option<&'static AuthDomain> = None; } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait AuthDomainExt: IsA + sealed::Sealed + 'static { #[doc(alias = "soup_auth_domain_accepts")] fn accepts(&self, msg: &ServerMessage) -> Option { unsafe { from_glib_full(ffi::soup_auth_domain_accepts( self.as_ref().to_glib_none().0, msg.to_glib_none().0, )) } } #[doc(alias = "soup_auth_domain_add_path")] fn add_path(&self, path: &str) { unsafe { ffi::soup_auth_domain_add_path(self.as_ref().to_glib_none().0, path.to_glib_none().0); } } #[doc(alias = "soup_auth_domain_challenge")] fn challenge(&self, msg: &ServerMessage) { unsafe { ffi::soup_auth_domain_challenge(self.as_ref().to_glib_none().0, msg.to_glib_none().0); } } #[doc(alias = "soup_auth_domain_check_password")] fn check_password(&self, msg: &ServerMessage, username: &str, password: &str) -> bool { unsafe { from_glib(ffi::soup_auth_domain_check_password( self.as_ref().to_glib_none().0, msg.to_glib_none().0, username.to_glib_none().0, password.to_glib_none().0, )) } } #[doc(alias = "soup_auth_domain_covers")] fn covers(&self, msg: &ServerMessage) -> bool { unsafe { from_glib(ffi::soup_auth_domain_covers( self.as_ref().to_glib_none().0, msg.to_glib_none().0, )) } } #[doc(alias = "soup_auth_domain_get_realm")] #[doc(alias = "get_realm")] fn realm(&self) -> Option { unsafe { from_glib_none(ffi::soup_auth_domain_get_realm( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_auth_domain_remove_path")] fn remove_path(&self, path: &str) { unsafe { ffi::soup_auth_domain_remove_path( self.as_ref().to_glib_none().0, path.to_glib_none().0, ); } } #[doc(alias = "soup_auth_domain_set_filter")] #[doc(alias = "filter")] fn set_filter bool + 'static>(&self, filter: P) { let filter_data: Box_

= Box_::new(filter); unsafe extern "C" fn filter_func bool + 'static>( domain: *mut ffi::SoupAuthDomain, msg: *mut ffi::SoupServerMessage, user_data: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let domain = from_glib_borrow(domain); let msg = from_glib_borrow(msg); let callback = &*(user_data as *mut P); (*callback)(&domain, &msg).into_glib() } let filter = Some(filter_func::

as _); unsafe extern "C" fn dnotify_func bool + 'static>( data: glib::ffi::gpointer, ) { let _callback = Box_::from_raw(data as *mut P); } let destroy_call3 = Some(dnotify_func::

as _); let super_callback0: Box_

= filter_data; unsafe { ffi::soup_auth_domain_set_filter( self.as_ref().to_glib_none().0, filter, Box_::into_raw(super_callback0) as *mut _, destroy_call3, ); } } #[doc(alias = "soup_auth_domain_set_generic_auth_callback")] #[doc(alias = "generic-auth-callback")] fn set_generic_auth_callback bool + 'static>( &self, auth_callback: P, ) { let auth_callback_data: Box_

= Box_::new(auth_callback); unsafe extern "C" fn auth_callback_func< P: Fn(&AuthDomain, &ServerMessage, &str) -> bool + 'static, >( domain: *mut ffi::SoupAuthDomain, msg: *mut ffi::SoupServerMessage, username: *const libc::c_char, user_data: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let domain = from_glib_borrow(domain); let msg = from_glib_borrow(msg); let username: Borrowed = from_glib_borrow(username); let callback = &*(user_data as *mut P); (*callback)(&domain, &msg, username.as_str()).into_glib() } let auth_callback = Some(auth_callback_func::

as _); unsafe extern "C" fn dnotify_func< P: Fn(&AuthDomain, &ServerMessage, &str) -> bool + 'static, >( data: glib::ffi::gpointer, ) { let _callback = Box_::from_raw(data as *mut P); } let destroy_call3 = Some(dnotify_func::

as _); let super_callback0: Box_

= auth_callback_data; unsafe { ffi::soup_auth_domain_set_generic_auth_callback( self.as_ref().to_glib_none().0, auth_callback, Box_::into_raw(super_callback0) as *mut _, destroy_call3, ); } } //#[doc(alias = "filter-data")] //fn filter_data(&self) -> /*Unimplemented*/Basic: Pointer { // ObjectExt::property(self.as_ref(), "filter-data") //} //#[doc(alias = "filter-data")] //fn set_filter_data(&self, filter_data: /*Unimplemented*/Basic: Pointer) { // ObjectExt::set_property(self.as_ref(),"filter-data", filter_data) //} //#[doc(alias = "generic-auth-data")] //fn generic_auth_data(&self) -> /*Unimplemented*/Basic: Pointer { // ObjectExt::property(self.as_ref(), "generic-auth-data") //} //#[doc(alias = "generic-auth-data")] //fn set_generic_auth_data(&self, generic_auth_data: /*Unimplemented*/Basic: Pointer) { // ObjectExt::set_property(self.as_ref(),"generic-auth-data", generic_auth_data) //} fn is_proxy(&self) -> bool { ObjectExt::property(self.as_ref(), "proxy") } #[doc(alias = "filter-data")] fn connect_filter_data_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_filter_data_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::SoupAuthDomain, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AuthDomain::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::filter-data\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_filter_data_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "generic-auth-data")] fn connect_generic_auth_data_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_generic_auth_data_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::SoupAuthDomain, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(AuthDomain::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::generic-auth-data\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_generic_auth_data_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> AuthDomainExt for O {} soup3-0.7.0/src/auto/auth_domain_basic.rs000064400000000000000000000135501046102023000164430ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, AuthDomain, ServerMessage}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "SoupAuthDomainBasic")] pub struct AuthDomainBasic(Object) @extends AuthDomain; match fn { type_ => || ffi::soup_auth_domain_basic_get_type(), } } impl AuthDomainBasic { //#[doc(alias = "soup_auth_domain_basic_new")] //pub fn new(optname1: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> AuthDomainBasic { // unsafe { TODO: call ffi:soup_auth_domain_basic_new() } //} // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`AuthDomainBasic`] objects. /// /// This method returns an instance of [`AuthDomainBasicBuilder`](crate::builders::AuthDomainBasicBuilder) which can be used to create [`AuthDomainBasic`] objects. pub fn builder() -> AuthDomainBasicBuilder { AuthDomainBasicBuilder::new() } #[doc(alias = "soup_auth_domain_basic_set_auth_callback")] #[doc(alias = "auth-callback")] pub fn set_auth_callback< P: Fn(&AuthDomainBasic, &ServerMessage, &str, &str) -> bool + 'static, >( &self, callback: P, ) { let callback_data: Box_

= Box_::new(callback); unsafe extern "C" fn callback_func< P: Fn(&AuthDomainBasic, &ServerMessage, &str, &str) -> bool + 'static, >( domain: *mut ffi::SoupAuthDomainBasic, msg: *mut ffi::SoupServerMessage, username: *const libc::c_char, password: *const libc::c_char, user_data: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let domain = from_glib_borrow(domain); let msg = from_glib_borrow(msg); let username: Borrowed = from_glib_borrow(username); let password: Borrowed = from_glib_borrow(password); let callback = &*(user_data as *mut P); (*callback)(&domain, &msg, username.as_str(), password.as_str()).into_glib() } let callback = Some(callback_func::

as _); unsafe extern "C" fn dnotify_func< P: Fn(&AuthDomainBasic, &ServerMessage, &str, &str) -> bool + 'static, >( data: glib::ffi::gpointer, ) { let _callback = Box_::from_raw(data as *mut P); } let destroy_call3 = Some(dnotify_func::

as _); let super_callback0: Box_

= callback_data; unsafe { ffi::soup_auth_domain_basic_set_auth_callback( self.to_glib_none().0, callback, Box_::into_raw(super_callback0) as *mut _, destroy_call3, ); } } //#[doc(alias = "auth-data")] //pub fn auth_data(&self) -> /*Unimplemented*/Basic: Pointer { // ObjectExt::property(self, "auth-data") //} //#[doc(alias = "auth-data")] //pub fn set_auth_data(&self, auth_data: /*Unimplemented*/Basic: Pointer) { // ObjectExt::set_property(self,"auth-data", auth_data) //} #[doc(alias = "auth-data")] pub fn connect_auth_data_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_auth_data_trampoline( this: *mut ffi::SoupAuthDomainBasic, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::auth-data\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_auth_data_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for AuthDomainBasic { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`AuthDomainBasic`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct AuthDomainBasicBuilder { builder: glib::object::ObjectBuilder<'static, AuthDomainBasic>, } impl AuthDomainBasicBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } //pub fn auth_data(self, auth_data: /*Unimplemented*/Basic: Pointer) -> Self { // Self { builder: self.builder.property("auth-data", auth_data), } //} //pub fn filter_data(self, filter_data: /*Unimplemented*/Basic: Pointer) -> Self { // Self { builder: self.builder.property("filter-data", filter_data), } //} //pub fn generic_auth_data(self, generic_auth_data: /*Unimplemented*/Basic: Pointer) -> Self { // Self { builder: self.builder.property("generic-auth-data", generic_auth_data), } //} pub fn proxy(self, proxy: bool) -> Self { Self { builder: self.builder.property("proxy", proxy), } } pub fn realm(self, realm: impl Into) -> Self { Self { builder: self.builder.property("realm", realm.into()), } } // rustdoc-stripper-ignore-next /// Build the [`AuthDomainBasic`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> AuthDomainBasic { self.builder.build() } } soup3-0.7.0/src/auto/auth_domain_digest.rs000064400000000000000000000143111046102023000166350ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, AuthDomain, ServerMessage}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "SoupAuthDomainDigest")] pub struct AuthDomainDigest(Object) @extends AuthDomain; match fn { type_ => || ffi::soup_auth_domain_digest_get_type(), } } impl AuthDomainDigest { //#[doc(alias = "soup_auth_domain_digest_new")] //pub fn new(optname1: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> AuthDomainDigest { // unsafe { TODO: call ffi:soup_auth_domain_digest_new() } //} // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`AuthDomainDigest`] objects. /// /// This method returns an instance of [`AuthDomainDigestBuilder`](crate::builders::AuthDomainDigestBuilder) which can be used to create [`AuthDomainDigest`] objects. pub fn builder() -> AuthDomainDigestBuilder { AuthDomainDigestBuilder::new() } #[doc(alias = "soup_auth_domain_digest_set_auth_callback")] #[doc(alias = "auth-callback")] pub fn set_auth_callback< P: Fn(&AuthDomainDigest, &ServerMessage, &str) -> Option + 'static, >( &self, callback: P, ) { let callback_data: Box_

= Box_::new(callback); unsafe extern "C" fn callback_func< P: Fn(&AuthDomainDigest, &ServerMessage, &str) -> Option + 'static, >( domain: *mut ffi::SoupAuthDomainDigest, msg: *mut ffi::SoupServerMessage, username: *const libc::c_char, user_data: glib::ffi::gpointer, ) -> *mut libc::c_char { let domain = from_glib_borrow(domain); let msg = from_glib_borrow(msg); let username: Borrowed = from_glib_borrow(username); let callback = &*(user_data as *mut P); (*callback)(&domain, &msg, username.as_str()).to_glib_full() } let callback = Some(callback_func::

as _); unsafe extern "C" fn dnotify_func< P: Fn(&AuthDomainDigest, &ServerMessage, &str) -> Option + 'static, >( data: glib::ffi::gpointer, ) { let _callback = Box_::from_raw(data as *mut P); } let destroy_call3 = Some(dnotify_func::

as _); let super_callback0: Box_

= callback_data; unsafe { ffi::soup_auth_domain_digest_set_auth_callback( self.to_glib_none().0, callback, Box_::into_raw(super_callback0) as *mut _, destroy_call3, ); } } //#[doc(alias = "auth-data")] //pub fn auth_data(&self) -> /*Unimplemented*/Basic: Pointer { // ObjectExt::property(self, "auth-data") //} //#[doc(alias = "auth-data")] //pub fn set_auth_data(&self, auth_data: /*Unimplemented*/Basic: Pointer) { // ObjectExt::set_property(self,"auth-data", auth_data) //} #[doc(alias = "soup_auth_domain_digest_encode_password")] pub fn encode_password(username: &str, realm: &str, password: &str) -> Option { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_auth_domain_digest_encode_password( username.to_glib_none().0, realm.to_glib_none().0, password.to_glib_none().0, )) } } #[doc(alias = "auth-data")] pub fn connect_auth_data_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_auth_data_trampoline( this: *mut ffi::SoupAuthDomainDigest, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::auth-data\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_auth_data_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for AuthDomainDigest { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`AuthDomainDigest`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct AuthDomainDigestBuilder { builder: glib::object::ObjectBuilder<'static, AuthDomainDigest>, } impl AuthDomainDigestBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } //pub fn auth_data(self, auth_data: /*Unimplemented*/Basic: Pointer) -> Self { // Self { builder: self.builder.property("auth-data", auth_data), } //} //pub fn filter_data(self, filter_data: /*Unimplemented*/Basic: Pointer) -> Self { // Self { builder: self.builder.property("filter-data", filter_data), } //} //pub fn generic_auth_data(self, generic_auth_data: /*Unimplemented*/Basic: Pointer) -> Self { // Self { builder: self.builder.property("generic-auth-data", generic_auth_data), } //} pub fn proxy(self, proxy: bool) -> Self { Self { builder: self.builder.property("proxy", proxy), } } pub fn realm(self, realm: impl Into) -> Self { Self { builder: self.builder.property("realm", realm.into()), } } // rustdoc-stripper-ignore-next /// Build the [`AuthDomainDigest`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> AuthDomainDigest { self.builder.build() } } soup3-0.7.0/src/auto/auth_manager.rs000064400000000000000000000020411046102023000154360ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, Auth, SessionFeature}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "SoupAuthManager")] pub struct AuthManager(Object) @implements SessionFeature; match fn { type_ => || ffi::soup_auth_manager_get_type(), } } impl AuthManager { #[doc(alias = "soup_auth_manager_clear_cached_credentials")] pub fn clear_cached_credentials(&self) { unsafe { ffi::soup_auth_manager_clear_cached_credentials(self.to_glib_none().0); } } #[doc(alias = "soup_auth_manager_use_auth")] pub fn use_auth(&self, uri: &glib::Uri, auth: &impl IsA) { unsafe { ffi::soup_auth_manager_use_auth( self.to_glib_none().0, uri.to_glib_none().0, auth.as_ref().to_glib_none().0, ); } } } soup3-0.7.0/src/auto/auth_negotiate.rs000064400000000000000000000044011046102023000160050ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, Auth}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "SoupAuthNegotiate")] pub struct AuthNegotiate(Object) @extends Auth; match fn { type_ => || ffi::soup_auth_negotiate_get_type(), } } impl AuthNegotiate { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`AuthNegotiate`] objects. /// /// This method returns an instance of [`AuthNegotiateBuilder`](crate::builders::AuthNegotiateBuilder) which can be used to create [`AuthNegotiate`] objects. pub fn builder() -> AuthNegotiateBuilder { AuthNegotiateBuilder::new() } #[doc(alias = "soup_auth_negotiate_supported")] pub fn supported() -> bool { assert_initialized_main_thread!(); unsafe { from_glib(ffi::soup_auth_negotiate_supported()) } } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`AuthNegotiate`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct AuthNegotiateBuilder { builder: glib::object::ObjectBuilder<'static, AuthNegotiate>, } impl AuthNegotiateBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn authority(self, authority: impl Into) -> Self { Self { builder: self.builder.property("authority", authority.into()), } } pub fn is_for_proxy(self, is_for_proxy: bool) -> Self { Self { builder: self.builder.property("is-for-proxy", is_for_proxy), } } pub fn realm(self, realm: impl Into) -> Self { Self { builder: self.builder.property("realm", realm.into()), } } // rustdoc-stripper-ignore-next /// Build the [`AuthNegotiate`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> AuthNegotiate { self.builder.build() } } soup3-0.7.0/src/auto/auth_ntlm.rs000064400000000000000000000037221046102023000150050ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, Auth}; use glib::prelude::*; glib::wrapper! { #[doc(alias = "SoupAuthNTLM")] pub struct AuthNTLM(Object) @extends Auth; match fn { type_ => || ffi::soup_auth_ntlm_get_type(), } } impl AuthNTLM { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`AuthNTLM`] objects. /// /// This method returns an instance of [`AuthNTLMBuilder`](crate::builders::AuthNTLMBuilder) which can be used to create [`AuthNTLM`] objects. pub fn builder() -> AuthNTLMBuilder { AuthNTLMBuilder::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`AuthNTLM`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct AuthNTLMBuilder { builder: glib::object::ObjectBuilder<'static, AuthNTLM>, } impl AuthNTLMBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn authority(self, authority: impl Into) -> Self { Self { builder: self.builder.property("authority", authority.into()), } } pub fn is_for_proxy(self, is_for_proxy: bool) -> Self { Self { builder: self.builder.property("is-for-proxy", is_for_proxy), } } pub fn realm(self, realm: impl Into) -> Self { Self { builder: self.builder.property("realm", realm.into()), } } // rustdoc-stripper-ignore-next /// Build the [`AuthNTLM`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> AuthNTLM { self.builder.build() } } soup3-0.7.0/src/auto/cache.rs000064400000000000000000000074411046102023000140570ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, CacheType, SessionFeature}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "SoupCache")] pub struct Cache(Object) @implements SessionFeature; match fn { type_ => || ffi::soup_cache_get_type(), } } impl Cache { pub const NONE: Option<&'static Cache> = None; #[doc(alias = "soup_cache_new")] pub fn new(cache_dir: Option<&str>, cache_type: CacheType) -> Cache { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_cache_new( cache_dir.to_glib_none().0, cache_type.into_glib(), )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Cache`] objects. /// /// This method returns an instance of [`CacheBuilder`](crate::builders::CacheBuilder) which can be used to create [`Cache`] objects. pub fn builder() -> CacheBuilder { CacheBuilder::new() } } impl Default for Cache { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Cache`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct CacheBuilder { builder: glib::object::ObjectBuilder<'static, Cache>, } impl CacheBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn cache_dir(self, cache_dir: impl Into) -> Self { Self { builder: self.builder.property("cache-dir", cache_dir.into()), } } pub fn cache_type(self, cache_type: CacheType) -> Self { Self { builder: self.builder.property("cache-type", cache_type), } } // rustdoc-stripper-ignore-next /// Build the [`Cache`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Cache { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait CacheExt: IsA + sealed::Sealed + 'static { #[doc(alias = "soup_cache_clear")] fn clear(&self) { unsafe { ffi::soup_cache_clear(self.as_ref().to_glib_none().0); } } #[doc(alias = "soup_cache_dump")] fn dump(&self) { unsafe { ffi::soup_cache_dump(self.as_ref().to_glib_none().0); } } #[doc(alias = "soup_cache_flush")] fn flush(&self) { unsafe { ffi::soup_cache_flush(self.as_ref().to_glib_none().0); } } #[doc(alias = "soup_cache_get_max_size")] #[doc(alias = "get_max_size")] fn max_size(&self) -> u32 { unsafe { ffi::soup_cache_get_max_size(self.as_ref().to_glib_none().0) } } #[doc(alias = "soup_cache_load")] fn load(&self) { unsafe { ffi::soup_cache_load(self.as_ref().to_glib_none().0); } } #[doc(alias = "soup_cache_set_max_size")] fn set_max_size(&self, max_size: u32) { unsafe { ffi::soup_cache_set_max_size(self.as_ref().to_glib_none().0, max_size); } } #[doc(alias = "cache-dir")] fn cache_dir(&self) -> Option { ObjectExt::property(self.as_ref(), "cache-dir") } #[doc(alias = "cache-type")] fn cache_type(&self) -> CacheType { ObjectExt::property(self.as_ref(), "cache-type") } } impl> CacheExt for O {} soup3-0.7.0/src/auto/constants.rs000064400000000000000000000010361046102023000150220ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::ffi; use glib::GStr; #[doc(alias = "SOUP_FORM_MIME_TYPE_MULTIPART")] pub static FORM_MIME_TYPE_MULTIPART: &GStr = unsafe { GStr::from_utf8_with_nul_unchecked(ffi::SOUP_FORM_MIME_TYPE_MULTIPART) }; #[doc(alias = "SOUP_FORM_MIME_TYPE_URLENCODED")] pub static FORM_MIME_TYPE_URLENCODED: &GStr = unsafe { GStr::from_utf8_with_nul_unchecked(ffi::SOUP_FORM_MIME_TYPE_URLENCODED) }; soup3-0.7.0/src/auto/content_decoder.rs000064400000000000000000000007221046102023000161460ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, SessionFeature}; glib::wrapper! { #[doc(alias = "SoupContentDecoder")] pub struct ContentDecoder(Object) @implements SessionFeature; match fn { type_ => || ffi::soup_content_decoder_get_type(), } } impl ContentDecoder {} soup3-0.7.0/src/auto/content_sniffer.rs000064400000000000000000000021261046102023000161750ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, SessionFeature}; use glib::translate::*; glib::wrapper! { #[doc(alias = "SoupContentSniffer")] pub struct ContentSniffer(Object) @implements SessionFeature; match fn { type_ => || ffi::soup_content_sniffer_get_type(), } } impl ContentSniffer { #[doc(alias = "soup_content_sniffer_new")] pub fn new() -> ContentSniffer { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_content_sniffer_new()) } } //#[doc(alias = "soup_content_sniffer_sniff")] //pub fn sniff(&self, msg: &Message, buffer: &glib::Bytes, params: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }) -> Option { // unsafe { TODO: call ffi:soup_content_sniffer_sniff() } //} } impl Default for ContentSniffer { fn default() -> Self { Self::new() } } soup3-0.7.0/src/auto/cookie.rs000064400000000000000000000151201046102023000142560ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, SameSitePolicy}; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialOrd, Ord, Hash)] pub struct Cookie(Boxed); match fn { copy => |ptr| ffi::soup_cookie_copy(mut_override(ptr)), free => |ptr| ffi::soup_cookie_free(ptr), type_ => || ffi::soup_cookie_get_type(), } } impl Cookie { #[doc(alias = "soup_cookie_new")] pub fn new(name: &str, value: &str, domain: &str, path: &str, max_age: i32) -> Cookie { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_cookie_new( name.to_glib_none().0, value.to_glib_none().0, domain.to_glib_none().0, path.to_glib_none().0, max_age, )) } } #[doc(alias = "soup_cookie_applies_to_uri")] pub fn applies_to_uri(&mut self, uri: &glib::Uri) -> bool { unsafe { from_glib(ffi::soup_cookie_applies_to_uri( self.to_glib_none_mut().0, uri.to_glib_none().0, )) } } #[doc(alias = "soup_cookie_domain_matches")] pub fn domain_matches(&mut self, host: &str) -> bool { unsafe { from_glib(ffi::soup_cookie_domain_matches( self.to_glib_none_mut().0, host.to_glib_none().0, )) } } #[doc(alias = "soup_cookie_equal")] fn equal(&self, cookie2: &Cookie) -> bool { unsafe { from_glib(ffi::soup_cookie_equal( mut_override(self.to_glib_none().0), mut_override(cookie2.to_glib_none().0), )) } } #[doc(alias = "soup_cookie_get_domain")] #[doc(alias = "get_domain")] pub fn domain(&mut self) -> Option { unsafe { from_glib_none(ffi::soup_cookie_get_domain(self.to_glib_none_mut().0)) } } #[doc(alias = "soup_cookie_get_expires")] #[doc(alias = "get_expires")] pub fn expires(&mut self) -> Option { unsafe { from_glib_none(ffi::soup_cookie_get_expires(self.to_glib_none_mut().0)) } } #[doc(alias = "soup_cookie_get_http_only")] #[doc(alias = "get_http_only")] pub fn is_http_only(&mut self) -> bool { unsafe { from_glib(ffi::soup_cookie_get_http_only(self.to_glib_none_mut().0)) } } #[doc(alias = "soup_cookie_get_name")] #[doc(alias = "get_name")] pub fn name(&mut self) -> Option { unsafe { from_glib_none(ffi::soup_cookie_get_name(self.to_glib_none_mut().0)) } } #[doc(alias = "soup_cookie_get_path")] #[doc(alias = "get_path")] pub fn path(&mut self) -> Option { unsafe { from_glib_none(ffi::soup_cookie_get_path(self.to_glib_none_mut().0)) } } #[doc(alias = "soup_cookie_get_same_site_policy")] #[doc(alias = "get_same_site_policy")] pub fn same_site_policy(&mut self) -> SameSitePolicy { unsafe { from_glib(ffi::soup_cookie_get_same_site_policy( self.to_glib_none_mut().0, )) } } #[doc(alias = "soup_cookie_get_secure")] #[doc(alias = "get_secure")] pub fn is_secure(&mut self) -> bool { unsafe { from_glib(ffi::soup_cookie_get_secure(self.to_glib_none_mut().0)) } } #[doc(alias = "soup_cookie_get_value")] #[doc(alias = "get_value")] pub fn value(&mut self) -> Option { unsafe { from_glib_none(ffi::soup_cookie_get_value(self.to_glib_none_mut().0)) } } #[doc(alias = "soup_cookie_set_domain")] pub fn set_domain(&mut self, domain: &str) { unsafe { ffi::soup_cookie_set_domain(self.to_glib_none_mut().0, domain.to_glib_none().0); } } #[doc(alias = "soup_cookie_set_expires")] pub fn set_expires(&mut self, expires: &glib::DateTime) { unsafe { ffi::soup_cookie_set_expires(self.to_glib_none_mut().0, expires.to_glib_none().0); } } #[doc(alias = "soup_cookie_set_http_only")] pub fn set_http_only(&mut self, http_only: bool) { unsafe { ffi::soup_cookie_set_http_only(self.to_glib_none_mut().0, http_only.into_glib()); } } #[doc(alias = "soup_cookie_set_max_age")] pub fn set_max_age(&mut self, max_age: i32) { unsafe { ffi::soup_cookie_set_max_age(self.to_glib_none_mut().0, max_age); } } #[doc(alias = "soup_cookie_set_name")] pub fn set_name(&mut self, name: &str) { unsafe { ffi::soup_cookie_set_name(self.to_glib_none_mut().0, name.to_glib_none().0); } } #[doc(alias = "soup_cookie_set_path")] pub fn set_path(&mut self, path: &str) { unsafe { ffi::soup_cookie_set_path(self.to_glib_none_mut().0, path.to_glib_none().0); } } #[doc(alias = "soup_cookie_set_same_site_policy")] pub fn set_same_site_policy(&mut self, policy: SameSitePolicy) { unsafe { ffi::soup_cookie_set_same_site_policy(self.to_glib_none_mut().0, policy.into_glib()); } } #[doc(alias = "soup_cookie_set_secure")] pub fn set_secure(&mut self, secure: bool) { unsafe { ffi::soup_cookie_set_secure(self.to_glib_none_mut().0, secure.into_glib()); } } #[doc(alias = "soup_cookie_set_value")] pub fn set_value(&mut self, value: &str) { unsafe { ffi::soup_cookie_set_value(self.to_glib_none_mut().0, value.to_glib_none().0); } } #[doc(alias = "soup_cookie_to_cookie_header")] pub fn to_cookie_header(&mut self) -> Option { unsafe { from_glib_full(ffi::soup_cookie_to_cookie_header(self.to_glib_none_mut().0)) } } #[doc(alias = "soup_cookie_to_set_cookie_header")] pub fn to_set_cookie_header(&mut self) -> Option { unsafe { from_glib_full(ffi::soup_cookie_to_set_cookie_header( self.to_glib_none_mut().0, )) } } #[doc(alias = "soup_cookie_parse")] pub fn parse(header: &str, origin: Option<&glib::Uri>) -> Option { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_cookie_parse( header.to_glib_none().0, origin.to_glib_none().0, )) } } } impl PartialEq for Cookie { #[inline] fn eq(&self, other: &Self) -> bool { self.equal(other) } } impl Eq for Cookie {} soup3-0.7.0/src/auto/cookie_jar.rs000064400000000000000000000205131046102023000151140ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, Cookie, CookieJarAcceptPolicy, SessionFeature}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "SoupCookieJar")] pub struct CookieJar(Object) @implements SessionFeature; match fn { type_ => || ffi::soup_cookie_jar_get_type(), } } impl CookieJar { pub const NONE: Option<&'static CookieJar> = None; #[doc(alias = "soup_cookie_jar_new")] pub fn new() -> CookieJar { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_cookie_jar_new()) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`CookieJar`] objects. /// /// This method returns an instance of [`CookieJarBuilder`](crate::builders::CookieJarBuilder) which can be used to create [`CookieJar`] objects. pub fn builder() -> CookieJarBuilder { CookieJarBuilder::new() } } impl Default for CookieJar { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`CookieJar`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct CookieJarBuilder { builder: glib::object::ObjectBuilder<'static, CookieJar>, } impl CookieJarBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn accept_policy(self, accept_policy: CookieJarAcceptPolicy) -> Self { Self { builder: self.builder.property("accept-policy", accept_policy), } } pub fn read_only(self, read_only: bool) -> Self { Self { builder: self.builder.property("read-only", read_only), } } // rustdoc-stripper-ignore-next /// Build the [`CookieJar`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> CookieJar { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait CookieJarExt: IsA + sealed::Sealed + 'static { #[doc(alias = "soup_cookie_jar_all_cookies")] fn all_cookies(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::soup_cookie_jar_all_cookies( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_cookie_jar_get_accept_policy")] #[doc(alias = "get_accept_policy")] #[doc(alias = "accept-policy")] fn accept_policy(&self) -> CookieJarAcceptPolicy { unsafe { from_glib(ffi::soup_cookie_jar_get_accept_policy( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_cookie_jar_get_cookie_list")] #[doc(alias = "get_cookie_list")] fn cookie_list(&self, uri: &glib::Uri, for_http: bool) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::soup_cookie_jar_get_cookie_list( self.as_ref().to_glib_none().0, uri.to_glib_none().0, for_http.into_glib(), )) } } #[doc(alias = "soup_cookie_jar_get_cookie_list_with_same_site_info")] #[doc(alias = "get_cookie_list_with_same_site_info")] fn cookie_list_with_same_site_info( &self, uri: &glib::Uri, top_level: Option<&glib::Uri>, site_for_cookies: Option<&glib::Uri>, for_http: bool, is_safe_method: bool, is_top_level_navigation: bool, ) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full( ffi::soup_cookie_jar_get_cookie_list_with_same_site_info( self.as_ref().to_glib_none().0, uri.to_glib_none().0, top_level.to_glib_none().0, site_for_cookies.to_glib_none().0, for_http.into_glib(), is_safe_method.into_glib(), is_top_level_navigation.into_glib(), ), ) } } #[doc(alias = "soup_cookie_jar_get_cookies")] #[doc(alias = "get_cookies")] fn cookies(&self, uri: &glib::Uri, for_http: bool) -> Option { unsafe { from_glib_full(ffi::soup_cookie_jar_get_cookies( self.as_ref().to_glib_none().0, uri.to_glib_none().0, for_http.into_glib(), )) } } #[doc(alias = "soup_cookie_jar_is_persistent")] fn is_persistent(&self) -> bool { unsafe { from_glib(ffi::soup_cookie_jar_is_persistent( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_cookie_jar_set_accept_policy")] #[doc(alias = "accept-policy")] fn set_accept_policy(&self, policy: CookieJarAcceptPolicy) { unsafe { ffi::soup_cookie_jar_set_accept_policy( self.as_ref().to_glib_none().0, policy.into_glib(), ); } } #[doc(alias = "soup_cookie_jar_set_cookie")] fn set_cookie(&self, uri: &glib::Uri, cookie: &str) { unsafe { ffi::soup_cookie_jar_set_cookie( self.as_ref().to_glib_none().0, uri.to_glib_none().0, cookie.to_glib_none().0, ); } } #[doc(alias = "soup_cookie_jar_set_cookie_with_first_party")] fn set_cookie_with_first_party(&self, uri: &glib::Uri, first_party: &glib::Uri, cookie: &str) { unsafe { ffi::soup_cookie_jar_set_cookie_with_first_party( self.as_ref().to_glib_none().0, uri.to_glib_none().0, first_party.to_glib_none().0, cookie.to_glib_none().0, ); } } #[doc(alias = "read-only")] fn is_read_only(&self) -> bool { ObjectExt::property(self.as_ref(), "read-only") } #[doc(alias = "changed")] fn connect_changed(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn changed_trampoline< P: IsA, F: Fn(&P, &Cookie, &Cookie) + 'static, >( this: *mut ffi::SoupCookieJar, old_cookie: *mut ffi::SoupCookie, new_cookie: *mut ffi::SoupCookie, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( CookieJar::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(old_cookie), &from_glib_borrow(new_cookie), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"changed\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( changed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "accept-policy")] fn connect_accept_policy_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_accept_policy_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::SoupCookieJar, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(CookieJar::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::accept-policy\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_accept_policy_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> CookieJarExt for O {} soup3-0.7.0/src/auto/cookie_jar_db.rs000064400000000000000000000053301046102023000155610ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, CookieJar, CookieJarAcceptPolicy, SessionFeature}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "SoupCookieJarDB")] pub struct CookieJarDB(Object) @extends CookieJar, @implements SessionFeature; match fn { type_ => || ffi::soup_cookie_jar_db_get_type(), } } impl CookieJarDB { #[doc(alias = "soup_cookie_jar_db_new")] pub fn new(filename: &str, read_only: bool) -> CookieJarDB { assert_initialized_main_thread!(); unsafe { CookieJar::from_glib_full(ffi::soup_cookie_jar_db_new( filename.to_glib_none().0, read_only.into_glib(), )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`CookieJarDB`] objects. /// /// This method returns an instance of [`CookieJarDBBuilder`](crate::builders::CookieJarDBBuilder) which can be used to create [`CookieJarDB`] objects. pub fn builder() -> CookieJarDBBuilder { CookieJarDBBuilder::new() } pub fn filename(&self) -> Option { ObjectExt::property(self, "filename") } } impl Default for CookieJarDB { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`CookieJarDB`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct CookieJarDBBuilder { builder: glib::object::ObjectBuilder<'static, CookieJarDB>, } impl CookieJarDBBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn filename(self, filename: impl Into) -> Self { Self { builder: self.builder.property("filename", filename.into()), } } pub fn accept_policy(self, accept_policy: CookieJarAcceptPolicy) -> Self { Self { builder: self.builder.property("accept-policy", accept_policy), } } pub fn read_only(self, read_only: bool) -> Self { Self { builder: self.builder.property("read-only", read_only), } } // rustdoc-stripper-ignore-next /// Build the [`CookieJarDB`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> CookieJarDB { self.builder.build() } } soup3-0.7.0/src/auto/cookie_jar_text.rs000064400000000000000000000054041046102023000161620ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, CookieJar, CookieJarAcceptPolicy, SessionFeature}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "SoupCookieJarText")] pub struct CookieJarText(Object) @extends CookieJar, @implements SessionFeature; match fn { type_ => || ffi::soup_cookie_jar_text_get_type(), } } impl CookieJarText { #[doc(alias = "soup_cookie_jar_text_new")] pub fn new(filename: &str, read_only: bool) -> CookieJarText { assert_initialized_main_thread!(); unsafe { CookieJar::from_glib_full(ffi::soup_cookie_jar_text_new( filename.to_glib_none().0, read_only.into_glib(), )) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`CookieJarText`] objects. /// /// This method returns an instance of [`CookieJarTextBuilder`](crate::builders::CookieJarTextBuilder) which can be used to create [`CookieJarText`] objects. pub fn builder() -> CookieJarTextBuilder { CookieJarTextBuilder::new() } pub fn filename(&self) -> Option { ObjectExt::property(self, "filename") } } impl Default for CookieJarText { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`CookieJarText`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct CookieJarTextBuilder { builder: glib::object::ObjectBuilder<'static, CookieJarText>, } impl CookieJarTextBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn filename(self, filename: impl Into) -> Self { Self { builder: self.builder.property("filename", filename.into()), } } pub fn accept_policy(self, accept_policy: CookieJarAcceptPolicy) -> Self { Self { builder: self.builder.property("accept-policy", accept_policy), } } pub fn read_only(self, read_only: bool) -> Self { Self { builder: self.builder.property("read-only", read_only), } } // rustdoc-stripper-ignore-next /// Build the [`CookieJarText`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> CookieJarText { self.builder.build() } } soup3-0.7.0/src/auto/enums.rs000064400000000000000000002071761046102023000141520ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::ffi; use glib::{prelude::*, translate::*}; #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupCacheType")] pub enum CacheType { #[doc(alias = "SOUP_CACHE_SINGLE_USER")] SingleUser, #[doc(alias = "SOUP_CACHE_SHARED")] Shared, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for CacheType { type GlibType = ffi::SoupCacheType; #[inline] fn into_glib(self) -> ffi::SoupCacheType { match self { Self::SingleUser => ffi::SOUP_CACHE_SINGLE_USER, Self::Shared => ffi::SOUP_CACHE_SHARED, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for CacheType { #[inline] unsafe fn from_glib(value: ffi::SoupCacheType) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_CACHE_SINGLE_USER => Self::SingleUser, ffi::SOUP_CACHE_SHARED => Self::Shared, value => Self::__Unknown(value), } } } impl StaticType for CacheType { #[inline] #[doc(alias = "soup_cache_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_cache_type_get_type()) } } } impl glib::HasParamSpec for CacheType { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for CacheType { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for CacheType { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for CacheType { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: CacheType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupCookieJarAcceptPolicy")] pub enum CookieJarAcceptPolicy { #[doc(alias = "SOUP_COOKIE_JAR_ACCEPT_ALWAYS")] Always, #[doc(alias = "SOUP_COOKIE_JAR_ACCEPT_NEVER")] Never, #[doc(alias = "SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY")] NoThirdParty, #[doc(alias = "SOUP_COOKIE_JAR_ACCEPT_GRANDFATHERED_THIRD_PARTY")] GrandfatheredThirdParty, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for CookieJarAcceptPolicy { type GlibType = ffi::SoupCookieJarAcceptPolicy; #[inline] fn into_glib(self) -> ffi::SoupCookieJarAcceptPolicy { match self { Self::Always => ffi::SOUP_COOKIE_JAR_ACCEPT_ALWAYS, Self::Never => ffi::SOUP_COOKIE_JAR_ACCEPT_NEVER, Self::NoThirdParty => ffi::SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY, Self::GrandfatheredThirdParty => ffi::SOUP_COOKIE_JAR_ACCEPT_GRANDFATHERED_THIRD_PARTY, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for CookieJarAcceptPolicy { #[inline] unsafe fn from_glib(value: ffi::SoupCookieJarAcceptPolicy) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_COOKIE_JAR_ACCEPT_ALWAYS => Self::Always, ffi::SOUP_COOKIE_JAR_ACCEPT_NEVER => Self::Never, ffi::SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY => Self::NoThirdParty, ffi::SOUP_COOKIE_JAR_ACCEPT_GRANDFATHERED_THIRD_PARTY => Self::GrandfatheredThirdParty, value => Self::__Unknown(value), } } } impl StaticType for CookieJarAcceptPolicy { #[inline] #[doc(alias = "soup_cookie_jar_accept_policy_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_cookie_jar_accept_policy_get_type()) } } } impl glib::HasParamSpec for CookieJarAcceptPolicy { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for CookieJarAcceptPolicy { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for CookieJarAcceptPolicy { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for CookieJarAcceptPolicy { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: CookieJarAcceptPolicy) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupDateFormat")] pub enum DateFormat { #[doc(alias = "SOUP_DATE_HTTP")] Http, #[doc(alias = "SOUP_DATE_COOKIE")] Cookie, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for DateFormat { type GlibType = ffi::SoupDateFormat; #[inline] fn into_glib(self) -> ffi::SoupDateFormat { match self { Self::Http => ffi::SOUP_DATE_HTTP, Self::Cookie => ffi::SOUP_DATE_COOKIE, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for DateFormat { #[inline] unsafe fn from_glib(value: ffi::SoupDateFormat) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_DATE_HTTP => Self::Http, ffi::SOUP_DATE_COOKIE => Self::Cookie, value => Self::__Unknown(value), } } } impl StaticType for DateFormat { #[inline] #[doc(alias = "soup_date_format_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_date_format_get_type()) } } } impl glib::HasParamSpec for DateFormat { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for DateFormat { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for DateFormat { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for DateFormat { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: DateFormat) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupEncoding")] pub enum Encoding { #[doc(alias = "SOUP_ENCODING_UNRECOGNIZED")] Unrecognized, #[doc(alias = "SOUP_ENCODING_NONE")] None, #[doc(alias = "SOUP_ENCODING_CONTENT_LENGTH")] ContentLength, #[doc(alias = "SOUP_ENCODING_EOF")] Eof, #[doc(alias = "SOUP_ENCODING_CHUNKED")] Chunked, #[doc(alias = "SOUP_ENCODING_BYTERANGES")] Byteranges, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for Encoding { type GlibType = ffi::SoupEncoding; #[inline] fn into_glib(self) -> ffi::SoupEncoding { match self { Self::Unrecognized => ffi::SOUP_ENCODING_UNRECOGNIZED, Self::None => ffi::SOUP_ENCODING_NONE, Self::ContentLength => ffi::SOUP_ENCODING_CONTENT_LENGTH, Self::Eof => ffi::SOUP_ENCODING_EOF, Self::Chunked => ffi::SOUP_ENCODING_CHUNKED, Self::Byteranges => ffi::SOUP_ENCODING_BYTERANGES, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for Encoding { #[inline] unsafe fn from_glib(value: ffi::SoupEncoding) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_ENCODING_UNRECOGNIZED => Self::Unrecognized, ffi::SOUP_ENCODING_NONE => Self::None, ffi::SOUP_ENCODING_CONTENT_LENGTH => Self::ContentLength, ffi::SOUP_ENCODING_EOF => Self::Eof, ffi::SOUP_ENCODING_CHUNKED => Self::Chunked, ffi::SOUP_ENCODING_BYTERANGES => Self::Byteranges, value => Self::__Unknown(value), } } } impl StaticType for Encoding { #[inline] #[doc(alias = "soup_encoding_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_encoding_get_type()) } } } impl glib::HasParamSpec for Encoding { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for Encoding { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for Encoding { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for Encoding { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: Encoding) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupHTTPVersion")] pub enum HTTPVersion { #[doc(alias = "SOUP_HTTP_1_0")] Http10, #[doc(alias = "SOUP_HTTP_1_1")] Http11, #[doc(alias = "SOUP_HTTP_2_0")] Http20, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for HTTPVersion { type GlibType = ffi::SoupHTTPVersion; #[inline] fn into_glib(self) -> ffi::SoupHTTPVersion { match self { Self::Http10 => ffi::SOUP_HTTP_1_0, Self::Http11 => ffi::SOUP_HTTP_1_1, Self::Http20 => ffi::SOUP_HTTP_2_0, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for HTTPVersion { #[inline] unsafe fn from_glib(value: ffi::SoupHTTPVersion) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_HTTP_1_0 => Self::Http10, ffi::SOUP_HTTP_1_1 => Self::Http11, ffi::SOUP_HTTP_2_0 => Self::Http20, value => Self::__Unknown(value), } } } impl StaticType for HTTPVersion { #[inline] #[doc(alias = "soup_http_version_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_http_version_get_type()) } } } impl glib::HasParamSpec for HTTPVersion { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for HTTPVersion { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for HTTPVersion { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for HTTPVersion { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: HTTPVersion) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupLoggerLogLevel")] pub enum LoggerLogLevel { #[doc(alias = "SOUP_LOGGER_LOG_NONE")] None, #[doc(alias = "SOUP_LOGGER_LOG_MINIMAL")] Minimal, #[doc(alias = "SOUP_LOGGER_LOG_HEADERS")] Headers, #[doc(alias = "SOUP_LOGGER_LOG_BODY")] Body, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for LoggerLogLevel { type GlibType = ffi::SoupLoggerLogLevel; #[inline] fn into_glib(self) -> ffi::SoupLoggerLogLevel { match self { Self::None => ffi::SOUP_LOGGER_LOG_NONE, Self::Minimal => ffi::SOUP_LOGGER_LOG_MINIMAL, Self::Headers => ffi::SOUP_LOGGER_LOG_HEADERS, Self::Body => ffi::SOUP_LOGGER_LOG_BODY, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for LoggerLogLevel { #[inline] unsafe fn from_glib(value: ffi::SoupLoggerLogLevel) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_LOGGER_LOG_NONE => Self::None, ffi::SOUP_LOGGER_LOG_MINIMAL => Self::Minimal, ffi::SOUP_LOGGER_LOG_HEADERS => Self::Headers, ffi::SOUP_LOGGER_LOG_BODY => Self::Body, value => Self::__Unknown(value), } } } impl StaticType for LoggerLogLevel { #[inline] #[doc(alias = "soup_logger_log_level_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_logger_log_level_get_type()) } } } impl glib::HasParamSpec for LoggerLogLevel { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for LoggerLogLevel { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for LoggerLogLevel { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for LoggerLogLevel { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: LoggerLogLevel) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupMemoryUse")] pub enum MemoryUse { #[doc(alias = "SOUP_MEMORY_STATIC")] Static, #[doc(alias = "SOUP_MEMORY_TAKE")] Take, #[doc(alias = "SOUP_MEMORY_COPY")] Copy, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for MemoryUse { type GlibType = ffi::SoupMemoryUse; #[inline] fn into_glib(self) -> ffi::SoupMemoryUse { match self { Self::Static => ffi::SOUP_MEMORY_STATIC, Self::Take => ffi::SOUP_MEMORY_TAKE, Self::Copy => ffi::SOUP_MEMORY_COPY, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for MemoryUse { #[inline] unsafe fn from_glib(value: ffi::SoupMemoryUse) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_MEMORY_STATIC => Self::Static, ffi::SOUP_MEMORY_TAKE => Self::Take, ffi::SOUP_MEMORY_COPY => Self::Copy, value => Self::__Unknown(value), } } } impl StaticType for MemoryUse { #[inline] #[doc(alias = "soup_memory_use_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_memory_use_get_type()) } } } impl glib::HasParamSpec for MemoryUse { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for MemoryUse { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for MemoryUse { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for MemoryUse { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: MemoryUse) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupMessageHeadersType")] pub enum MessageHeadersType { #[doc(alias = "SOUP_MESSAGE_HEADERS_REQUEST")] Request, #[doc(alias = "SOUP_MESSAGE_HEADERS_RESPONSE")] Response, #[doc(alias = "SOUP_MESSAGE_HEADERS_MULTIPART")] Multipart, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for MessageHeadersType { type GlibType = ffi::SoupMessageHeadersType; #[inline] fn into_glib(self) -> ffi::SoupMessageHeadersType { match self { Self::Request => ffi::SOUP_MESSAGE_HEADERS_REQUEST, Self::Response => ffi::SOUP_MESSAGE_HEADERS_RESPONSE, Self::Multipart => ffi::SOUP_MESSAGE_HEADERS_MULTIPART, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for MessageHeadersType { #[inline] unsafe fn from_glib(value: ffi::SoupMessageHeadersType) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_MESSAGE_HEADERS_REQUEST => Self::Request, ffi::SOUP_MESSAGE_HEADERS_RESPONSE => Self::Response, ffi::SOUP_MESSAGE_HEADERS_MULTIPART => Self::Multipart, value => Self::__Unknown(value), } } } impl StaticType for MessageHeadersType { #[inline] #[doc(alias = "soup_message_headers_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_message_headers_type_get_type()) } } } impl glib::HasParamSpec for MessageHeadersType { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for MessageHeadersType { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for MessageHeadersType { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for MessageHeadersType { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: MessageHeadersType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupMessagePriority")] pub enum MessagePriority { #[doc(alias = "SOUP_MESSAGE_PRIORITY_VERY_LOW")] VeryLow, #[doc(alias = "SOUP_MESSAGE_PRIORITY_LOW")] Low, #[doc(alias = "SOUP_MESSAGE_PRIORITY_NORMAL")] Normal, #[doc(alias = "SOUP_MESSAGE_PRIORITY_HIGH")] High, #[doc(alias = "SOUP_MESSAGE_PRIORITY_VERY_HIGH")] VeryHigh, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for MessagePriority { type GlibType = ffi::SoupMessagePriority; #[inline] fn into_glib(self) -> ffi::SoupMessagePriority { match self { Self::VeryLow => ffi::SOUP_MESSAGE_PRIORITY_VERY_LOW, Self::Low => ffi::SOUP_MESSAGE_PRIORITY_LOW, Self::Normal => ffi::SOUP_MESSAGE_PRIORITY_NORMAL, Self::High => ffi::SOUP_MESSAGE_PRIORITY_HIGH, Self::VeryHigh => ffi::SOUP_MESSAGE_PRIORITY_VERY_HIGH, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for MessagePriority { #[inline] unsafe fn from_glib(value: ffi::SoupMessagePriority) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_MESSAGE_PRIORITY_VERY_LOW => Self::VeryLow, ffi::SOUP_MESSAGE_PRIORITY_LOW => Self::Low, ffi::SOUP_MESSAGE_PRIORITY_NORMAL => Self::Normal, ffi::SOUP_MESSAGE_PRIORITY_HIGH => Self::High, ffi::SOUP_MESSAGE_PRIORITY_VERY_HIGH => Self::VeryHigh, value => Self::__Unknown(value), } } } impl StaticType for MessagePriority { #[inline] #[doc(alias = "soup_message_priority_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_message_priority_get_type()) } } } impl glib::HasParamSpec for MessagePriority { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for MessagePriority { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for MessagePriority { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for MessagePriority { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: MessagePriority) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupSameSitePolicy")] pub enum SameSitePolicy { #[doc(alias = "SOUP_SAME_SITE_POLICY_NONE")] None, #[doc(alias = "SOUP_SAME_SITE_POLICY_LAX")] Lax, #[doc(alias = "SOUP_SAME_SITE_POLICY_STRICT")] Strict, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for SameSitePolicy { type GlibType = ffi::SoupSameSitePolicy; #[inline] fn into_glib(self) -> ffi::SoupSameSitePolicy { match self { Self::None => ffi::SOUP_SAME_SITE_POLICY_NONE, Self::Lax => ffi::SOUP_SAME_SITE_POLICY_LAX, Self::Strict => ffi::SOUP_SAME_SITE_POLICY_STRICT, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for SameSitePolicy { #[inline] unsafe fn from_glib(value: ffi::SoupSameSitePolicy) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_SAME_SITE_POLICY_NONE => Self::None, ffi::SOUP_SAME_SITE_POLICY_LAX => Self::Lax, ffi::SOUP_SAME_SITE_POLICY_STRICT => Self::Strict, value => Self::__Unknown(value), } } } impl StaticType for SameSitePolicy { #[inline] #[doc(alias = "soup_same_site_policy_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_same_site_policy_get_type()) } } } impl glib::HasParamSpec for SameSitePolicy { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for SameSitePolicy { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for SameSitePolicy { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for SameSitePolicy { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: SameSitePolicy) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupSessionError")] pub enum SessionError { #[doc(alias = "SOUP_SESSION_ERROR_PARSING")] Parsing, #[doc(alias = "SOUP_SESSION_ERROR_ENCODING")] Encoding, #[doc(alias = "SOUP_SESSION_ERROR_TOO_MANY_REDIRECTS")] TooManyRedirects, #[doc(alias = "SOUP_SESSION_ERROR_TOO_MANY_RESTARTS")] TooManyRestarts, #[doc(alias = "SOUP_SESSION_ERROR_REDIRECT_NO_LOCATION")] RedirectNoLocation, #[doc(alias = "SOUP_SESSION_ERROR_REDIRECT_BAD_URI")] RedirectBadUri, #[doc(alias = "SOUP_SESSION_ERROR_MESSAGE_ALREADY_IN_QUEUE")] MessageAlreadyInQueue, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for SessionError { type GlibType = ffi::SoupSessionError; #[inline] fn into_glib(self) -> ffi::SoupSessionError { match self { Self::Parsing => ffi::SOUP_SESSION_ERROR_PARSING, Self::Encoding => ffi::SOUP_SESSION_ERROR_ENCODING, Self::TooManyRedirects => ffi::SOUP_SESSION_ERROR_TOO_MANY_REDIRECTS, Self::TooManyRestarts => ffi::SOUP_SESSION_ERROR_TOO_MANY_RESTARTS, Self::RedirectNoLocation => ffi::SOUP_SESSION_ERROR_REDIRECT_NO_LOCATION, Self::RedirectBadUri => ffi::SOUP_SESSION_ERROR_REDIRECT_BAD_URI, Self::MessageAlreadyInQueue => ffi::SOUP_SESSION_ERROR_MESSAGE_ALREADY_IN_QUEUE, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for SessionError { #[inline] unsafe fn from_glib(value: ffi::SoupSessionError) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_SESSION_ERROR_PARSING => Self::Parsing, ffi::SOUP_SESSION_ERROR_ENCODING => Self::Encoding, ffi::SOUP_SESSION_ERROR_TOO_MANY_REDIRECTS => Self::TooManyRedirects, ffi::SOUP_SESSION_ERROR_TOO_MANY_RESTARTS => Self::TooManyRestarts, ffi::SOUP_SESSION_ERROR_REDIRECT_NO_LOCATION => Self::RedirectNoLocation, ffi::SOUP_SESSION_ERROR_REDIRECT_BAD_URI => Self::RedirectBadUri, ffi::SOUP_SESSION_ERROR_MESSAGE_ALREADY_IN_QUEUE => Self::MessageAlreadyInQueue, value => Self::__Unknown(value), } } } impl glib::error::ErrorDomain for SessionError { #[inline] fn domain() -> glib::Quark { skip_assert_initialized!(); unsafe { from_glib(ffi::soup_session_error_quark()) } } #[inline] fn code(self) -> i32 { self.into_glib() } #[inline] #[allow(clippy::match_single_binding)] fn from(code: i32) -> Option { skip_assert_initialized!(); match unsafe { from_glib(code) } { value => Some(value), } } } impl StaticType for SessionError { #[inline] #[doc(alias = "soup_session_error_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_session_error_get_type()) } } } impl glib::HasParamSpec for SessionError { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for SessionError { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for SessionError { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for SessionError { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: SessionError) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupStatus")] pub enum Status { #[doc(alias = "SOUP_STATUS_NONE")] None, #[doc(alias = "SOUP_STATUS_CONTINUE")] Continue, #[doc(alias = "SOUP_STATUS_SWITCHING_PROTOCOLS")] SwitchingProtocols, #[doc(alias = "SOUP_STATUS_PROCESSING")] Processing, #[doc(alias = "SOUP_STATUS_OK")] Ok, #[doc(alias = "SOUP_STATUS_CREATED")] Created, #[doc(alias = "SOUP_STATUS_ACCEPTED")] Accepted, #[doc(alias = "SOUP_STATUS_NON_AUTHORITATIVE")] NonAuthoritative, #[doc(alias = "SOUP_STATUS_NO_CONTENT")] NoContent, #[doc(alias = "SOUP_STATUS_RESET_CONTENT")] ResetContent, #[doc(alias = "SOUP_STATUS_PARTIAL_CONTENT")] PartialContent, #[doc(alias = "SOUP_STATUS_MULTI_STATUS")] MultiStatus, #[doc(alias = "SOUP_STATUS_MULTIPLE_CHOICES")] MultipleChoices, #[doc(alias = "SOUP_STATUS_MOVED_PERMANENTLY")] MovedPermanently, #[doc(alias = "SOUP_STATUS_FOUND")] Found, #[doc(alias = "SOUP_STATUS_SEE_OTHER")] SeeOther, #[doc(alias = "SOUP_STATUS_NOT_MODIFIED")] NotModified, #[doc(alias = "SOUP_STATUS_USE_PROXY")] UseProxy, #[doc(alias = "SOUP_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL")] NotAppearingInThisProtocol, #[doc(alias = "SOUP_STATUS_TEMPORARY_REDIRECT")] TemporaryRedirect, #[doc(alias = "SOUP_STATUS_PERMANENT_REDIRECT")] PermanentRedirect, #[doc(alias = "SOUP_STATUS_BAD_REQUEST")] BadRequest, #[doc(alias = "SOUP_STATUS_UNAUTHORIZED")] Unauthorized, #[doc(alias = "SOUP_STATUS_PAYMENT_REQUIRED")] PaymentRequired, #[doc(alias = "SOUP_STATUS_FORBIDDEN")] Forbidden, #[doc(alias = "SOUP_STATUS_NOT_FOUND")] NotFound, #[doc(alias = "SOUP_STATUS_METHOD_NOT_ALLOWED")] MethodNotAllowed, #[doc(alias = "SOUP_STATUS_NOT_ACCEPTABLE")] NotAcceptable, #[doc(alias = "SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED")] ProxyAuthenticationRequired, #[doc(alias = "SOUP_STATUS_REQUEST_TIMEOUT")] RequestTimeout, #[doc(alias = "SOUP_STATUS_CONFLICT")] Conflict, #[doc(alias = "SOUP_STATUS_GONE")] Gone, #[doc(alias = "SOUP_STATUS_LENGTH_REQUIRED")] LengthRequired, #[doc(alias = "SOUP_STATUS_PRECONDITION_FAILED")] PreconditionFailed, #[doc(alias = "SOUP_STATUS_REQUEST_ENTITY_TOO_LARGE")] RequestEntityTooLarge, #[doc(alias = "SOUP_STATUS_REQUEST_URI_TOO_LONG")] RequestUriTooLong, #[doc(alias = "SOUP_STATUS_UNSUPPORTED_MEDIA_TYPE")] UnsupportedMediaType, #[doc(alias = "SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE")] RequestedRangeNotSatisfiable, #[doc(alias = "SOUP_STATUS_EXPECTATION_FAILED")] ExpectationFailed, #[doc(alias = "SOUP_STATUS_MISDIRECTED_REQUEST")] MisdirectedRequest, #[doc(alias = "SOUP_STATUS_UNPROCESSABLE_ENTITY")] UnprocessableEntity, #[doc(alias = "SOUP_STATUS_LOCKED")] Locked, #[doc(alias = "SOUP_STATUS_FAILED_DEPENDENCY")] FailedDependency, #[doc(alias = "SOUP_STATUS_INTERNAL_SERVER_ERROR")] InternalServerError, #[doc(alias = "SOUP_STATUS_NOT_IMPLEMENTED")] NotImplemented, #[doc(alias = "SOUP_STATUS_BAD_GATEWAY")] BadGateway, #[doc(alias = "SOUP_STATUS_SERVICE_UNAVAILABLE")] ServiceUnavailable, #[doc(alias = "SOUP_STATUS_GATEWAY_TIMEOUT")] GatewayTimeout, #[doc(alias = "SOUP_STATUS_HTTP_VERSION_NOT_SUPPORTED")] HttpVersionNotSupported, #[doc(alias = "SOUP_STATUS_INSUFFICIENT_STORAGE")] InsufficientStorage, #[doc(alias = "SOUP_STATUS_NOT_EXTENDED")] NotExtended, #[doc(hidden)] __Unknown(i32), } impl Status { #[doc(alias = "soup_status_get_phrase")] #[doc(alias = "get_phrase")] pub fn phrase(status_code: u32) -> Option { assert_initialized_main_thread!(); unsafe { from_glib_none(ffi::soup_status_get_phrase(status_code)) } } } #[doc(hidden)] impl IntoGlib for Status { type GlibType = ffi::SoupStatus; fn into_glib(self) -> ffi::SoupStatus { match self { Self::None => ffi::SOUP_STATUS_NONE, Self::Continue => ffi::SOUP_STATUS_CONTINUE, Self::SwitchingProtocols => ffi::SOUP_STATUS_SWITCHING_PROTOCOLS, Self::Processing => ffi::SOUP_STATUS_PROCESSING, Self::Ok => ffi::SOUP_STATUS_OK, Self::Created => ffi::SOUP_STATUS_CREATED, Self::Accepted => ffi::SOUP_STATUS_ACCEPTED, Self::NonAuthoritative => ffi::SOUP_STATUS_NON_AUTHORITATIVE, Self::NoContent => ffi::SOUP_STATUS_NO_CONTENT, Self::ResetContent => ffi::SOUP_STATUS_RESET_CONTENT, Self::PartialContent => ffi::SOUP_STATUS_PARTIAL_CONTENT, Self::MultiStatus => ffi::SOUP_STATUS_MULTI_STATUS, Self::MultipleChoices => ffi::SOUP_STATUS_MULTIPLE_CHOICES, Self::MovedPermanently => ffi::SOUP_STATUS_MOVED_PERMANENTLY, Self::Found => ffi::SOUP_STATUS_FOUND, Self::SeeOther => ffi::SOUP_STATUS_SEE_OTHER, Self::NotModified => ffi::SOUP_STATUS_NOT_MODIFIED, Self::UseProxy => ffi::SOUP_STATUS_USE_PROXY, Self::NotAppearingInThisProtocol => ffi::SOUP_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL, Self::TemporaryRedirect => ffi::SOUP_STATUS_TEMPORARY_REDIRECT, Self::PermanentRedirect => ffi::SOUP_STATUS_PERMANENT_REDIRECT, Self::BadRequest => ffi::SOUP_STATUS_BAD_REQUEST, Self::Unauthorized => ffi::SOUP_STATUS_UNAUTHORIZED, Self::PaymentRequired => ffi::SOUP_STATUS_PAYMENT_REQUIRED, Self::Forbidden => ffi::SOUP_STATUS_FORBIDDEN, Self::NotFound => ffi::SOUP_STATUS_NOT_FOUND, Self::MethodNotAllowed => ffi::SOUP_STATUS_METHOD_NOT_ALLOWED, Self::NotAcceptable => ffi::SOUP_STATUS_NOT_ACCEPTABLE, Self::ProxyAuthenticationRequired => ffi::SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED, Self::RequestTimeout => ffi::SOUP_STATUS_REQUEST_TIMEOUT, Self::Conflict => ffi::SOUP_STATUS_CONFLICT, Self::Gone => ffi::SOUP_STATUS_GONE, Self::LengthRequired => ffi::SOUP_STATUS_LENGTH_REQUIRED, Self::PreconditionFailed => ffi::SOUP_STATUS_PRECONDITION_FAILED, Self::RequestEntityTooLarge => ffi::SOUP_STATUS_REQUEST_ENTITY_TOO_LARGE, Self::RequestUriTooLong => ffi::SOUP_STATUS_REQUEST_URI_TOO_LONG, Self::UnsupportedMediaType => ffi::SOUP_STATUS_UNSUPPORTED_MEDIA_TYPE, Self::RequestedRangeNotSatisfiable => ffi::SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE, Self::ExpectationFailed => ffi::SOUP_STATUS_EXPECTATION_FAILED, Self::MisdirectedRequest => ffi::SOUP_STATUS_MISDIRECTED_REQUEST, Self::UnprocessableEntity => ffi::SOUP_STATUS_UNPROCESSABLE_ENTITY, Self::Locked => ffi::SOUP_STATUS_LOCKED, Self::FailedDependency => ffi::SOUP_STATUS_FAILED_DEPENDENCY, Self::InternalServerError => ffi::SOUP_STATUS_INTERNAL_SERVER_ERROR, Self::NotImplemented => ffi::SOUP_STATUS_NOT_IMPLEMENTED, Self::BadGateway => ffi::SOUP_STATUS_BAD_GATEWAY, Self::ServiceUnavailable => ffi::SOUP_STATUS_SERVICE_UNAVAILABLE, Self::GatewayTimeout => ffi::SOUP_STATUS_GATEWAY_TIMEOUT, Self::HttpVersionNotSupported => ffi::SOUP_STATUS_HTTP_VERSION_NOT_SUPPORTED, Self::InsufficientStorage => ffi::SOUP_STATUS_INSUFFICIENT_STORAGE, Self::NotExtended => ffi::SOUP_STATUS_NOT_EXTENDED, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for Status { unsafe fn from_glib(value: ffi::SoupStatus) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_STATUS_NONE => Self::None, ffi::SOUP_STATUS_CONTINUE => Self::Continue, ffi::SOUP_STATUS_SWITCHING_PROTOCOLS => Self::SwitchingProtocols, ffi::SOUP_STATUS_PROCESSING => Self::Processing, ffi::SOUP_STATUS_OK => Self::Ok, ffi::SOUP_STATUS_CREATED => Self::Created, ffi::SOUP_STATUS_ACCEPTED => Self::Accepted, ffi::SOUP_STATUS_NON_AUTHORITATIVE => Self::NonAuthoritative, ffi::SOUP_STATUS_NO_CONTENT => Self::NoContent, ffi::SOUP_STATUS_RESET_CONTENT => Self::ResetContent, ffi::SOUP_STATUS_PARTIAL_CONTENT => Self::PartialContent, ffi::SOUP_STATUS_MULTI_STATUS => Self::MultiStatus, ffi::SOUP_STATUS_MULTIPLE_CHOICES => Self::MultipleChoices, ffi::SOUP_STATUS_MOVED_PERMANENTLY => Self::MovedPermanently, ffi::SOUP_STATUS_FOUND => Self::Found, ffi::SOUP_STATUS_SEE_OTHER => Self::SeeOther, ffi::SOUP_STATUS_NOT_MODIFIED => Self::NotModified, ffi::SOUP_STATUS_USE_PROXY => Self::UseProxy, ffi::SOUP_STATUS_NOT_APPEARING_IN_THIS_PROTOCOL => Self::NotAppearingInThisProtocol, ffi::SOUP_STATUS_TEMPORARY_REDIRECT => Self::TemporaryRedirect, ffi::SOUP_STATUS_PERMANENT_REDIRECT => Self::PermanentRedirect, ffi::SOUP_STATUS_BAD_REQUEST => Self::BadRequest, ffi::SOUP_STATUS_UNAUTHORIZED => Self::Unauthorized, ffi::SOUP_STATUS_PAYMENT_REQUIRED => Self::PaymentRequired, ffi::SOUP_STATUS_FORBIDDEN => Self::Forbidden, ffi::SOUP_STATUS_NOT_FOUND => Self::NotFound, ffi::SOUP_STATUS_METHOD_NOT_ALLOWED => Self::MethodNotAllowed, ffi::SOUP_STATUS_NOT_ACCEPTABLE => Self::NotAcceptable, ffi::SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED => Self::ProxyAuthenticationRequired, ffi::SOUP_STATUS_REQUEST_TIMEOUT => Self::RequestTimeout, ffi::SOUP_STATUS_CONFLICT => Self::Conflict, ffi::SOUP_STATUS_GONE => Self::Gone, ffi::SOUP_STATUS_LENGTH_REQUIRED => Self::LengthRequired, ffi::SOUP_STATUS_PRECONDITION_FAILED => Self::PreconditionFailed, ffi::SOUP_STATUS_REQUEST_ENTITY_TOO_LARGE => Self::RequestEntityTooLarge, ffi::SOUP_STATUS_REQUEST_URI_TOO_LONG => Self::RequestUriTooLong, ffi::SOUP_STATUS_UNSUPPORTED_MEDIA_TYPE => Self::UnsupportedMediaType, ffi::SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE => Self::RequestedRangeNotSatisfiable, ffi::SOUP_STATUS_EXPECTATION_FAILED => Self::ExpectationFailed, ffi::SOUP_STATUS_MISDIRECTED_REQUEST => Self::MisdirectedRequest, ffi::SOUP_STATUS_UNPROCESSABLE_ENTITY => Self::UnprocessableEntity, ffi::SOUP_STATUS_LOCKED => Self::Locked, ffi::SOUP_STATUS_FAILED_DEPENDENCY => Self::FailedDependency, ffi::SOUP_STATUS_INTERNAL_SERVER_ERROR => Self::InternalServerError, ffi::SOUP_STATUS_NOT_IMPLEMENTED => Self::NotImplemented, ffi::SOUP_STATUS_BAD_GATEWAY => Self::BadGateway, ffi::SOUP_STATUS_SERVICE_UNAVAILABLE => Self::ServiceUnavailable, ffi::SOUP_STATUS_GATEWAY_TIMEOUT => Self::GatewayTimeout, ffi::SOUP_STATUS_HTTP_VERSION_NOT_SUPPORTED => Self::HttpVersionNotSupported, ffi::SOUP_STATUS_INSUFFICIENT_STORAGE => Self::InsufficientStorage, ffi::SOUP_STATUS_NOT_EXTENDED => Self::NotExtended, value => Self::__Unknown(value), } } } impl StaticType for Status { #[inline] #[doc(alias = "soup_status_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_status_get_type()) } } } impl glib::HasParamSpec for Status { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for Status { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for Status { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for Status { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: Status) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupTLDError")] pub enum TLDError { #[doc(alias = "SOUP_TLD_ERROR_INVALID_HOSTNAME")] InvalidHostname, #[doc(alias = "SOUP_TLD_ERROR_IS_IP_ADDRESS")] IsIpAddress, #[doc(alias = "SOUP_TLD_ERROR_NOT_ENOUGH_DOMAINS")] NotEnoughDomains, #[doc(alias = "SOUP_TLD_ERROR_NO_BASE_DOMAIN")] NoBaseDomain, #[doc(alias = "SOUP_TLD_ERROR_NO_PSL_DATA")] NoPslData, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for TLDError { type GlibType = ffi::SoupTLDError; #[inline] fn into_glib(self) -> ffi::SoupTLDError { match self { Self::InvalidHostname => ffi::SOUP_TLD_ERROR_INVALID_HOSTNAME, Self::IsIpAddress => ffi::SOUP_TLD_ERROR_IS_IP_ADDRESS, Self::NotEnoughDomains => ffi::SOUP_TLD_ERROR_NOT_ENOUGH_DOMAINS, Self::NoBaseDomain => ffi::SOUP_TLD_ERROR_NO_BASE_DOMAIN, Self::NoPslData => ffi::SOUP_TLD_ERROR_NO_PSL_DATA, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for TLDError { #[inline] unsafe fn from_glib(value: ffi::SoupTLDError) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_TLD_ERROR_INVALID_HOSTNAME => Self::InvalidHostname, ffi::SOUP_TLD_ERROR_IS_IP_ADDRESS => Self::IsIpAddress, ffi::SOUP_TLD_ERROR_NOT_ENOUGH_DOMAINS => Self::NotEnoughDomains, ffi::SOUP_TLD_ERROR_NO_BASE_DOMAIN => Self::NoBaseDomain, ffi::SOUP_TLD_ERROR_NO_PSL_DATA => Self::NoPslData, value => Self::__Unknown(value), } } } impl glib::error::ErrorDomain for TLDError { #[inline] fn domain() -> glib::Quark { skip_assert_initialized!(); unsafe { from_glib(ffi::soup_tld_error_quark()) } } #[inline] fn code(self) -> i32 { self.into_glib() } #[inline] #[allow(clippy::match_single_binding)] fn from(code: i32) -> Option { skip_assert_initialized!(); match unsafe { from_glib(code) } { value => Some(value), } } } impl StaticType for TLDError { #[inline] #[doc(alias = "soup_tld_error_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_tld_error_get_type()) } } } impl glib::HasParamSpec for TLDError { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for TLDError { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for TLDError { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for TLDError { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: TLDError) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupURIComponent")] pub enum URIComponent { #[doc(alias = "SOUP_URI_NONE")] None, #[doc(alias = "SOUP_URI_SCHEME")] Scheme, #[doc(alias = "SOUP_URI_USER")] User, #[doc(alias = "SOUP_URI_PASSWORD")] Password, #[doc(alias = "SOUP_URI_AUTH_PARAMS")] AuthParams, #[doc(alias = "SOUP_URI_HOST")] Host, #[doc(alias = "SOUP_URI_PORT")] Port, #[doc(alias = "SOUP_URI_PATH")] Path, #[doc(alias = "SOUP_URI_QUERY")] Query, #[doc(alias = "SOUP_URI_FRAGMENT")] Fragment, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for URIComponent { type GlibType = ffi::SoupURIComponent; #[inline] fn into_glib(self) -> ffi::SoupURIComponent { match self { Self::None => ffi::SOUP_URI_NONE, Self::Scheme => ffi::SOUP_URI_SCHEME, Self::User => ffi::SOUP_URI_USER, Self::Password => ffi::SOUP_URI_PASSWORD, Self::AuthParams => ffi::SOUP_URI_AUTH_PARAMS, Self::Host => ffi::SOUP_URI_HOST, Self::Port => ffi::SOUP_URI_PORT, Self::Path => ffi::SOUP_URI_PATH, Self::Query => ffi::SOUP_URI_QUERY, Self::Fragment => ffi::SOUP_URI_FRAGMENT, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for URIComponent { #[inline] unsafe fn from_glib(value: ffi::SoupURIComponent) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_URI_NONE => Self::None, ffi::SOUP_URI_SCHEME => Self::Scheme, ffi::SOUP_URI_USER => Self::User, ffi::SOUP_URI_PASSWORD => Self::Password, ffi::SOUP_URI_AUTH_PARAMS => Self::AuthParams, ffi::SOUP_URI_HOST => Self::Host, ffi::SOUP_URI_PORT => Self::Port, ffi::SOUP_URI_PATH => Self::Path, ffi::SOUP_URI_QUERY => Self::Query, ffi::SOUP_URI_FRAGMENT => Self::Fragment, value => Self::__Unknown(value), } } } impl StaticType for URIComponent { #[inline] #[doc(alias = "soup_uri_component_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_uri_component_get_type()) } } } impl glib::HasParamSpec for URIComponent { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for URIComponent { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for URIComponent { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for URIComponent { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: URIComponent) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupWebsocketCloseCode")] pub enum WebsocketCloseCode { #[doc(alias = "SOUP_WEBSOCKET_CLOSE_NORMAL")] Normal, #[doc(alias = "SOUP_WEBSOCKET_CLOSE_GOING_AWAY")] GoingAway, #[doc(alias = "SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR")] ProtocolError, #[doc(alias = "SOUP_WEBSOCKET_CLOSE_UNSUPPORTED_DATA")] UnsupportedData, #[doc(alias = "SOUP_WEBSOCKET_CLOSE_NO_STATUS")] NoStatus, #[doc(alias = "SOUP_WEBSOCKET_CLOSE_ABNORMAL")] Abnormal, #[doc(alias = "SOUP_WEBSOCKET_CLOSE_BAD_DATA")] BadData, #[doc(alias = "SOUP_WEBSOCKET_CLOSE_POLICY_VIOLATION")] PolicyViolation, #[doc(alias = "SOUP_WEBSOCKET_CLOSE_TOO_BIG")] TooBig, #[doc(alias = "SOUP_WEBSOCKET_CLOSE_NO_EXTENSION")] NoExtension, #[doc(alias = "SOUP_WEBSOCKET_CLOSE_SERVER_ERROR")] ServerError, #[doc(alias = "SOUP_WEBSOCKET_CLOSE_TLS_HANDSHAKE")] TlsHandshake, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for WebsocketCloseCode { type GlibType = ffi::SoupWebsocketCloseCode; #[inline] fn into_glib(self) -> ffi::SoupWebsocketCloseCode { match self { Self::Normal => ffi::SOUP_WEBSOCKET_CLOSE_NORMAL, Self::GoingAway => ffi::SOUP_WEBSOCKET_CLOSE_GOING_AWAY, Self::ProtocolError => ffi::SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR, Self::UnsupportedData => ffi::SOUP_WEBSOCKET_CLOSE_UNSUPPORTED_DATA, Self::NoStatus => ffi::SOUP_WEBSOCKET_CLOSE_NO_STATUS, Self::Abnormal => ffi::SOUP_WEBSOCKET_CLOSE_ABNORMAL, Self::BadData => ffi::SOUP_WEBSOCKET_CLOSE_BAD_DATA, Self::PolicyViolation => ffi::SOUP_WEBSOCKET_CLOSE_POLICY_VIOLATION, Self::TooBig => ffi::SOUP_WEBSOCKET_CLOSE_TOO_BIG, Self::NoExtension => ffi::SOUP_WEBSOCKET_CLOSE_NO_EXTENSION, Self::ServerError => ffi::SOUP_WEBSOCKET_CLOSE_SERVER_ERROR, Self::TlsHandshake => ffi::SOUP_WEBSOCKET_CLOSE_TLS_HANDSHAKE, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for WebsocketCloseCode { #[inline] unsafe fn from_glib(value: ffi::SoupWebsocketCloseCode) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_WEBSOCKET_CLOSE_NORMAL => Self::Normal, ffi::SOUP_WEBSOCKET_CLOSE_GOING_AWAY => Self::GoingAway, ffi::SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR => Self::ProtocolError, ffi::SOUP_WEBSOCKET_CLOSE_UNSUPPORTED_DATA => Self::UnsupportedData, ffi::SOUP_WEBSOCKET_CLOSE_NO_STATUS => Self::NoStatus, ffi::SOUP_WEBSOCKET_CLOSE_ABNORMAL => Self::Abnormal, ffi::SOUP_WEBSOCKET_CLOSE_BAD_DATA => Self::BadData, ffi::SOUP_WEBSOCKET_CLOSE_POLICY_VIOLATION => Self::PolicyViolation, ffi::SOUP_WEBSOCKET_CLOSE_TOO_BIG => Self::TooBig, ffi::SOUP_WEBSOCKET_CLOSE_NO_EXTENSION => Self::NoExtension, ffi::SOUP_WEBSOCKET_CLOSE_SERVER_ERROR => Self::ServerError, ffi::SOUP_WEBSOCKET_CLOSE_TLS_HANDSHAKE => Self::TlsHandshake, value => Self::__Unknown(value), } } } impl StaticType for WebsocketCloseCode { #[inline] #[doc(alias = "soup_websocket_close_code_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_websocket_close_code_get_type()) } } } impl glib::HasParamSpec for WebsocketCloseCode { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for WebsocketCloseCode { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for WebsocketCloseCode { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for WebsocketCloseCode { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: WebsocketCloseCode) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupWebsocketConnectionType")] pub enum WebsocketConnectionType { #[doc(alias = "SOUP_WEBSOCKET_CONNECTION_UNKNOWN")] Unknown, #[doc(alias = "SOUP_WEBSOCKET_CONNECTION_CLIENT")] Client, #[doc(alias = "SOUP_WEBSOCKET_CONNECTION_SERVER")] Server, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for WebsocketConnectionType { type GlibType = ffi::SoupWebsocketConnectionType; #[inline] fn into_glib(self) -> ffi::SoupWebsocketConnectionType { match self { Self::Unknown => ffi::SOUP_WEBSOCKET_CONNECTION_UNKNOWN, Self::Client => ffi::SOUP_WEBSOCKET_CONNECTION_CLIENT, Self::Server => ffi::SOUP_WEBSOCKET_CONNECTION_SERVER, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for WebsocketConnectionType { #[inline] unsafe fn from_glib(value: ffi::SoupWebsocketConnectionType) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_WEBSOCKET_CONNECTION_UNKNOWN => Self::Unknown, ffi::SOUP_WEBSOCKET_CONNECTION_CLIENT => Self::Client, ffi::SOUP_WEBSOCKET_CONNECTION_SERVER => Self::Server, value => Self::__Unknown(value), } } } impl StaticType for WebsocketConnectionType { #[inline] #[doc(alias = "soup_websocket_connection_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_websocket_connection_type_get_type()) } } } impl glib::HasParamSpec for WebsocketConnectionType { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for WebsocketConnectionType { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for WebsocketConnectionType { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for WebsocketConnectionType { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: WebsocketConnectionType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupWebsocketDataType")] pub enum WebsocketDataType { #[doc(alias = "SOUP_WEBSOCKET_DATA_TEXT")] Text, #[doc(alias = "SOUP_WEBSOCKET_DATA_BINARY")] Binary, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for WebsocketDataType { type GlibType = ffi::SoupWebsocketDataType; #[inline] fn into_glib(self) -> ffi::SoupWebsocketDataType { match self { Self::Text => ffi::SOUP_WEBSOCKET_DATA_TEXT, Self::Binary => ffi::SOUP_WEBSOCKET_DATA_BINARY, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for WebsocketDataType { #[inline] unsafe fn from_glib(value: ffi::SoupWebsocketDataType) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_WEBSOCKET_DATA_TEXT => Self::Text, ffi::SOUP_WEBSOCKET_DATA_BINARY => Self::Binary, value => Self::__Unknown(value), } } } impl StaticType for WebsocketDataType { #[inline] #[doc(alias = "soup_websocket_data_type_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_websocket_data_type_get_type()) } } } impl glib::HasParamSpec for WebsocketDataType { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for WebsocketDataType { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for WebsocketDataType { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for WebsocketDataType { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: WebsocketDataType) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupWebsocketError")] pub enum WebsocketError { #[doc(alias = "SOUP_WEBSOCKET_ERROR_FAILED")] Failed, #[doc(alias = "SOUP_WEBSOCKET_ERROR_NOT_WEBSOCKET")] NotWebsocket, #[doc(alias = "SOUP_WEBSOCKET_ERROR_BAD_HANDSHAKE")] BadHandshake, #[doc(alias = "SOUP_WEBSOCKET_ERROR_BAD_ORIGIN")] BadOrigin, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for WebsocketError { type GlibType = ffi::SoupWebsocketError; #[inline] fn into_glib(self) -> ffi::SoupWebsocketError { match self { Self::Failed => ffi::SOUP_WEBSOCKET_ERROR_FAILED, Self::NotWebsocket => ffi::SOUP_WEBSOCKET_ERROR_NOT_WEBSOCKET, Self::BadHandshake => ffi::SOUP_WEBSOCKET_ERROR_BAD_HANDSHAKE, Self::BadOrigin => ffi::SOUP_WEBSOCKET_ERROR_BAD_ORIGIN, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for WebsocketError { #[inline] unsafe fn from_glib(value: ffi::SoupWebsocketError) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_WEBSOCKET_ERROR_FAILED => Self::Failed, ffi::SOUP_WEBSOCKET_ERROR_NOT_WEBSOCKET => Self::NotWebsocket, ffi::SOUP_WEBSOCKET_ERROR_BAD_HANDSHAKE => Self::BadHandshake, ffi::SOUP_WEBSOCKET_ERROR_BAD_ORIGIN => Self::BadOrigin, value => Self::__Unknown(value), } } } impl glib::error::ErrorDomain for WebsocketError { #[inline] fn domain() -> glib::Quark { skip_assert_initialized!(); unsafe { from_glib(ffi::soup_websocket_error_quark()) } } #[inline] fn code(self) -> i32 { self.into_glib() } #[inline] #[allow(clippy::match_single_binding)] fn from(code: i32) -> Option { skip_assert_initialized!(); match unsafe { from_glib(code) } { Self::__Unknown(_) => Some(Self::Failed), value => Some(value), } } } impl StaticType for WebsocketError { #[inline] #[doc(alias = "soup_websocket_error_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_websocket_error_get_type()) } } } impl glib::HasParamSpec for WebsocketError { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for WebsocketError { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for WebsocketError { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for WebsocketError { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: WebsocketError) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "SoupWebsocketState")] pub enum WebsocketState { #[doc(alias = "SOUP_WEBSOCKET_STATE_OPEN")] Open, #[doc(alias = "SOUP_WEBSOCKET_STATE_CLOSING")] Closing, #[doc(alias = "SOUP_WEBSOCKET_STATE_CLOSED")] Closed, #[doc(hidden)] __Unknown(i32), } #[doc(hidden)] impl IntoGlib for WebsocketState { type GlibType = ffi::SoupWebsocketState; #[inline] fn into_glib(self) -> ffi::SoupWebsocketState { match self { Self::Open => ffi::SOUP_WEBSOCKET_STATE_OPEN, Self::Closing => ffi::SOUP_WEBSOCKET_STATE_CLOSING, Self::Closed => ffi::SOUP_WEBSOCKET_STATE_CLOSED, Self::__Unknown(value) => value, } } } #[doc(hidden)] impl FromGlib for WebsocketState { #[inline] unsafe fn from_glib(value: ffi::SoupWebsocketState) -> Self { skip_assert_initialized!(); match value { ffi::SOUP_WEBSOCKET_STATE_OPEN => Self::Open, ffi::SOUP_WEBSOCKET_STATE_CLOSING => Self::Closing, ffi::SOUP_WEBSOCKET_STATE_CLOSED => Self::Closed, value => Self::__Unknown(value), } } } impl StaticType for WebsocketState { #[inline] #[doc(alias = "soup_websocket_state_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_websocket_state_get_type()) } } } impl glib::HasParamSpec for WebsocketState { type ParamSpec = glib::ParamSpecEnum; type SetValue = Self; type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder_with_default } } impl glib::value::ValueType for WebsocketState { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for WebsocketState { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) } } impl ToValue for WebsocketState { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: WebsocketState) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } soup3-0.7.0/src/auto/flags.rs000064400000000000000000000233661046102023000141140ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::ffi; use glib::{bitflags::bitflags, prelude::*, translate::*}; bitflags! { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[doc(alias = "SoupCacheability")] pub struct Cacheability: u32 { #[doc(alias = "SOUP_CACHE_CACHEABLE")] const CACHEABLE = ffi::SOUP_CACHE_CACHEABLE as _; #[doc(alias = "SOUP_CACHE_UNCACHEABLE")] const UNCACHEABLE = ffi::SOUP_CACHE_UNCACHEABLE as _; #[doc(alias = "SOUP_CACHE_INVALIDATES")] const INVALIDATES = ffi::SOUP_CACHE_INVALIDATES as _; #[doc(alias = "SOUP_CACHE_VALIDATES")] const VALIDATES = ffi::SOUP_CACHE_VALIDATES as _; } } #[doc(hidden)] impl IntoGlib for Cacheability { type GlibType = ffi::SoupCacheability; #[inline] fn into_glib(self) -> ffi::SoupCacheability { self.bits() } } #[doc(hidden)] impl FromGlib for Cacheability { #[inline] unsafe fn from_glib(value: ffi::SoupCacheability) -> Self { skip_assert_initialized!(); Self::from_bits_truncate(value) } } impl StaticType for Cacheability { #[inline] #[doc(alias = "soup_cacheability_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_cacheability_get_type()) } } } impl glib::HasParamSpec for Cacheability { type ParamSpec = glib::ParamSpecFlags; type SetValue = Self; type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder } } impl glib::value::ValueType for Cacheability { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for Cacheability { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) } } impl ToValue for Cacheability { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: Cacheability) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } bitflags! { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[doc(alias = "SoupExpectation")] pub struct Expectation: u32 { #[doc(alias = "SOUP_EXPECTATION_UNRECOGNIZED")] const UNRECOGNIZED = ffi::SOUP_EXPECTATION_UNRECOGNIZED as _; #[doc(alias = "SOUP_EXPECTATION_CONTINUE")] const CONTINUE = ffi::SOUP_EXPECTATION_CONTINUE as _; } } #[doc(hidden)] impl IntoGlib for Expectation { type GlibType = ffi::SoupExpectation; #[inline] fn into_glib(self) -> ffi::SoupExpectation { self.bits() } } #[doc(hidden)] impl FromGlib for Expectation { #[inline] unsafe fn from_glib(value: ffi::SoupExpectation) -> Self { skip_assert_initialized!(); Self::from_bits_truncate(value) } } impl StaticType for Expectation { #[inline] #[doc(alias = "soup_expectation_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_expectation_get_type()) } } } impl glib::HasParamSpec for Expectation { type ParamSpec = glib::ParamSpecFlags; type SetValue = Self; type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder } } impl glib::value::ValueType for Expectation { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for Expectation { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) } } impl ToValue for Expectation { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: Expectation) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } bitflags! { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[doc(alias = "SoupMessageFlags")] pub struct MessageFlags: u32 { #[doc(alias = "SOUP_MESSAGE_NO_REDIRECT")] const NO_REDIRECT = ffi::SOUP_MESSAGE_NO_REDIRECT as _; #[doc(alias = "SOUP_MESSAGE_NEW_CONNECTION")] const NEW_CONNECTION = ffi::SOUP_MESSAGE_NEW_CONNECTION as _; #[doc(alias = "SOUP_MESSAGE_IDEMPOTENT")] const IDEMPOTENT = ffi::SOUP_MESSAGE_IDEMPOTENT as _; #[doc(alias = "SOUP_MESSAGE_DO_NOT_USE_AUTH_CACHE")] const DO_NOT_USE_AUTH_CACHE = ffi::SOUP_MESSAGE_DO_NOT_USE_AUTH_CACHE as _; #[doc(alias = "SOUP_MESSAGE_COLLECT_METRICS")] const COLLECT_METRICS = ffi::SOUP_MESSAGE_COLLECT_METRICS as _; } } #[doc(hidden)] impl IntoGlib for MessageFlags { type GlibType = ffi::SoupMessageFlags; #[inline] fn into_glib(self) -> ffi::SoupMessageFlags { self.bits() } } #[doc(hidden)] impl FromGlib for MessageFlags { #[inline] unsafe fn from_glib(value: ffi::SoupMessageFlags) -> Self { skip_assert_initialized!(); Self::from_bits_truncate(value) } } impl StaticType for MessageFlags { #[inline] #[doc(alias = "soup_message_flags_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_message_flags_get_type()) } } } impl glib::HasParamSpec for MessageFlags { type ParamSpec = glib::ParamSpecFlags; type SetValue = Self; type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder } } impl glib::value::ValueType for MessageFlags { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for MessageFlags { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) } } impl ToValue for MessageFlags { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: MessageFlags) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } bitflags! { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[doc(alias = "SoupServerListenOptions")] pub struct ServerListenOptions: u32 { #[doc(alias = "SOUP_SERVER_LISTEN_HTTPS")] const HTTPS = ffi::SOUP_SERVER_LISTEN_HTTPS as _; #[doc(alias = "SOUP_SERVER_LISTEN_IPV4_ONLY")] const IPV4_ONLY = ffi::SOUP_SERVER_LISTEN_IPV4_ONLY as _; #[doc(alias = "SOUP_SERVER_LISTEN_IPV6_ONLY")] const IPV6_ONLY = ffi::SOUP_SERVER_LISTEN_IPV6_ONLY as _; } } #[doc(hidden)] impl IntoGlib for ServerListenOptions { type GlibType = ffi::SoupServerListenOptions; #[inline] fn into_glib(self) -> ffi::SoupServerListenOptions { self.bits() } } #[doc(hidden)] impl FromGlib for ServerListenOptions { #[inline] unsafe fn from_glib(value: ffi::SoupServerListenOptions) -> Self { skip_assert_initialized!(); Self::from_bits_truncate(value) } } impl StaticType for ServerListenOptions { #[inline] #[doc(alias = "soup_server_listen_options_get_type")] fn static_type() -> glib::Type { unsafe { from_glib(ffi::soup_server_listen_options_get_type()) } } } impl glib::HasParamSpec for ServerListenOptions { type ParamSpec = glib::ParamSpecFlags; type SetValue = Self; type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder; fn param_spec_builder() -> Self::BuilderFn { Self::ParamSpec::builder } } impl glib::value::ValueType for ServerListenOptions { type Type = Self; } unsafe impl<'a> glib::value::FromValue<'a> for ServerListenOptions { type Checker = glib::value::GenericValueTypeChecker; #[inline] unsafe fn from_value(value: &'a glib::Value) -> Self { skip_assert_initialized!(); from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) } } impl ToValue for ServerListenOptions { #[inline] fn to_value(&self) -> glib::Value { let mut value = glib::Value::for_value_type::(); unsafe { glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); } value } #[inline] fn value_type(&self) -> glib::Type { Self::static_type() } } impl From for glib::Value { #[inline] fn from(v: ServerListenOptions) -> Self { skip_assert_initialized!(); ToValue::to_value(&v) } } soup3-0.7.0/src/auto/functions.rs000064400000000000000000000304441046102023000150230ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, Cookie, DateFormat, HTTPVersion, Message, MessageHeaders}; use glib::translate::*; #[doc(alias = "soup_check_version")] pub fn check_version(major: u32, minor: u32, micro: u32) -> bool { assert_initialized_main_thread!(); unsafe { from_glib(ffi::soup_check_version(major, minor, micro)) } } #[doc(alias = "soup_cookies_from_request")] pub fn cookies_from_request(msg: &Message) -> Vec { skip_assert_initialized!(); unsafe { FromGlibPtrContainer::from_glib_full(ffi::soup_cookies_from_request(msg.to_glib_none().0)) } } #[doc(alias = "soup_cookies_from_response")] pub fn cookies_from_response(msg: &Message) -> Vec { skip_assert_initialized!(); unsafe { FromGlibPtrContainer::from_glib_full(ffi::soup_cookies_from_response(msg.to_glib_none().0)) } } #[doc(alias = "soup_date_time_new_from_http_string")] pub fn date_time_new_from_http_string(date_string: &str) -> Option { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_date_time_new_from_http_string( date_string.to_glib_none().0, )) } } #[doc(alias = "soup_date_time_to_string")] pub fn date_time_to_string(date: &glib::DateTime, format: DateFormat) -> Option { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_date_time_to_string( date.to_glib_none().0, format.into_glib(), )) } } //#[doc(alias = "soup_form_decode")] //pub fn form_decode(encoded_form: &str) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } { // unsafe { TODO: call ffi:soup_form_decode() } //} //#[doc(alias = "soup_form_decode_multipart")] //pub fn form_decode_multipart(multipart: &mut Multipart, file_control_name: Option<&str>) -> (/*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, glib::GString, glib::GString, glib::Bytes) { // unsafe { TODO: call ffi:soup_form_decode_multipart() } //} //#[doc(alias = "soup_form_encode")] //pub fn form_encode(first_field: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> Option { // unsafe { TODO: call ffi:soup_form_encode() } //} //#[doc(alias = "soup_form_encode_datalist")] //pub fn form_encode_datalist(form_data_set: /*Ignored*/&mut glib::Data) -> Option { // unsafe { TODO: call ffi:soup_form_encode_datalist() } //} //#[doc(alias = "soup_form_encode_hash")] //pub fn form_encode_hash(form_data_set: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }) -> Option { // unsafe { TODO: call ffi:soup_form_encode_hash() } //} //#[doc(alias = "soup_form_encode_valist")] //pub fn form_encode_valist(first_field: &str, args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> Option { // unsafe { TODO: call ffi:soup_form_encode_valist() } //} #[doc(alias = "soup_get_major_version")] #[doc(alias = "get_major_version")] pub fn major_version() -> u32 { assert_initialized_main_thread!(); unsafe { ffi::soup_get_major_version() } } #[doc(alias = "soup_get_micro_version")] #[doc(alias = "get_micro_version")] pub fn micro_version() -> u32 { assert_initialized_main_thread!(); unsafe { ffi::soup_get_micro_version() } } #[doc(alias = "soup_get_minor_version")] #[doc(alias = "get_minor_version")] pub fn minor_version() -> u32 { assert_initialized_main_thread!(); unsafe { ffi::soup_get_minor_version() } } #[doc(alias = "soup_header_contains")] pub fn header_contains(header: &str, token: &str) -> bool { assert_initialized_main_thread!(); unsafe { from_glib(ffi::soup_header_contains( header.to_glib_none().0, token.to_glib_none().0, )) } } //#[doc(alias = "soup_header_free_list")] //pub fn header_free_list(list: /*Unimplemented*/&[&Basic: Pointer]) { // unsafe { TODO: call ffi:soup_header_free_list() } //} //#[doc(alias = "soup_header_free_param_list")] //pub fn header_free_param_list(param_list: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }) { // unsafe { TODO: call ffi:soup_header_free_param_list() } //} //#[doc(alias = "soup_header_g_string_append_param")] //pub fn header_g_string_append_param(string: /*Ignored*/&mut glib::String, name: &str, value: Option<&str>) { // unsafe { TODO: call ffi:soup_header_g_string_append_param() } //} //#[doc(alias = "soup_header_g_string_append_param_quoted")] //pub fn header_g_string_append_param_quoted(string: /*Ignored*/&mut glib::String, name: &str, value: &str) { // unsafe { TODO: call ffi:soup_header_g_string_append_param_quoted() } //} #[doc(alias = "soup_header_parse_list")] pub fn header_parse_list(header: &str) -> Vec { assert_initialized_main_thread!(); unsafe { FromGlibPtrContainer::from_glib_full(ffi::soup_header_parse_list(header.to_glib_none().0)) } } //#[doc(alias = "soup_header_parse_param_list")] //pub fn header_parse_param_list(header: &str) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } { // unsafe { TODO: call ffi:soup_header_parse_param_list() } //} //#[doc(alias = "soup_header_parse_param_list_strict")] //pub fn header_parse_param_list_strict(header: &str) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } { // unsafe { TODO: call ffi:soup_header_parse_param_list_strict() } //} //#[doc(alias = "soup_header_parse_quality_list")] //pub fn header_parse_quality_list(header: &str, unacceptable: /*Unimplemented*/Vec) -> Vec { // unsafe { TODO: call ffi:soup_header_parse_quality_list() } //} //#[doc(alias = "soup_header_parse_semi_param_list")] //pub fn header_parse_semi_param_list(header: &str) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } { // unsafe { TODO: call ffi:soup_header_parse_semi_param_list() } //} //#[doc(alias = "soup_header_parse_semi_param_list_strict")] //pub fn header_parse_semi_param_list_strict(header: &str) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } { // unsafe { TODO: call ffi:soup_header_parse_semi_param_list_strict() } //} #[doc(alias = "soup_headers_parse")] pub fn headers_parse(str: &str, dest: &MessageHeaders) -> bool { assert_initialized_main_thread!(); let len = str.len() as _; unsafe { from_glib(ffi::soup_headers_parse( str.to_glib_none().0, len, dest.to_glib_none().0, )) } } #[doc(alias = "soup_headers_parse_request")] pub fn headers_parse_request( str: &str, req_headers: &MessageHeaders, ) -> (u32, glib::GString, glib::GString, HTTPVersion) { assert_initialized_main_thread!(); let len = str.len() as _; unsafe { let mut req_method = std::ptr::null_mut(); let mut req_path = std::ptr::null_mut(); let mut ver = std::mem::MaybeUninit::uninit(); let ret = ffi::soup_headers_parse_request( str.to_glib_none().0, len, req_headers.to_glib_none().0, &mut req_method, &mut req_path, ver.as_mut_ptr(), ); ( ret, from_glib_full(req_method), from_glib_full(req_path), from_glib(ver.assume_init()), ) } } #[doc(alias = "soup_headers_parse_response")] pub fn headers_parse_response( str: &str, headers: &MessageHeaders, ) -> Option<(HTTPVersion, u32, glib::GString)> { assert_initialized_main_thread!(); let len = str.len() as _; unsafe { let mut ver = std::mem::MaybeUninit::uninit(); let mut status_code = std::mem::MaybeUninit::uninit(); let mut reason_phrase = std::ptr::null_mut(); let ret = from_glib(ffi::soup_headers_parse_response( str.to_glib_none().0, len, headers.to_glib_none().0, ver.as_mut_ptr(), status_code.as_mut_ptr(), &mut reason_phrase, )); if ret { Some(( from_glib(ver.assume_init()), status_code.assume_init(), from_glib_full(reason_phrase), )) } else { None } } } #[doc(alias = "soup_headers_parse_status_line")] pub fn headers_parse_status_line(status_line: &str) -> Option<(HTTPVersion, u32, glib::GString)> { assert_initialized_main_thread!(); unsafe { let mut ver = std::mem::MaybeUninit::uninit(); let mut status_code = std::mem::MaybeUninit::uninit(); let mut reason_phrase = std::ptr::null_mut(); let ret = from_glib(ffi::soup_headers_parse_status_line( status_line.to_glib_none().0, ver.as_mut_ptr(), status_code.as_mut_ptr(), &mut reason_phrase, )); if ret { Some(( from_glib(ver.assume_init()), status_code.assume_init(), from_glib_full(reason_phrase), )) } else { None } } } #[doc(alias = "soup_tld_domain_is_public_suffix")] pub fn tld_domain_is_public_suffix(domain: &str) -> bool { assert_initialized_main_thread!(); unsafe { from_glib(ffi::soup_tld_domain_is_public_suffix( domain.to_glib_none().0, )) } } #[doc(alias = "soup_tld_get_base_domain")] pub fn tld_get_base_domain(hostname: &str) -> Result { assert_initialized_main_thread!(); unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::soup_tld_get_base_domain(hostname.to_glib_none().0, &mut error); if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) } } } //#[doc(alias = "soup_uri_copy")] //pub fn uri_copy(uri: &glib::Uri, first_component: URIComponent, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> Option { // unsafe { TODO: call ffi:soup_uri_copy() } //} #[doc(alias = "soup_uri_decode_data_uri")] pub fn uri_decode_data_uri(uri: &str) -> (glib::Bytes, Option) { assert_initialized_main_thread!(); unsafe { let mut content_type = std::ptr::null_mut(); let ret = from_glib_full(ffi::soup_uri_decode_data_uri( uri.to_glib_none().0, &mut content_type, )); (ret, from_glib_full(content_type)) } } #[doc(alias = "soup_uri_equal")] pub fn uri_equal(uri1: &glib::Uri, uri2: &glib::Uri) -> bool { assert_initialized_main_thread!(); unsafe { from_glib(ffi::soup_uri_equal( uri1.to_glib_none().0, uri2.to_glib_none().0, )) } } //#[doc(alias = "soup_websocket_client_prepare_handshake")] //pub fn websocket_client_prepare_handshake(msg: &Message, origin: Option<&str>, protocols: &[&str], supported_extensions: /*Ignored*/&[&glib::TypeClass]) { // unsafe { TODO: call ffi:soup_websocket_client_prepare_handshake() } //} //#[doc(alias = "soup_websocket_client_verify_handshake")] //pub fn websocket_client_verify_handshake(msg: &Message, supported_extensions: /*Ignored*/&[&glib::TypeClass], accepted_extensions: /*Unimplemented*/Vec) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:soup_websocket_client_verify_handshake() } //} //#[doc(alias = "soup_websocket_server_check_handshake")] //pub fn websocket_server_check_handshake(msg: &ServerMessage, origin: Option<&str>, protocols: &[&str], supported_extensions: /*Ignored*/&[&glib::TypeClass]) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:soup_websocket_server_check_handshake() } //} //#[doc(alias = "soup_websocket_server_process_handshake")] //pub fn websocket_server_process_handshake(msg: &ServerMessage, expected_origin: Option<&str>, protocols: &[&str], supported_extensions: /*Ignored*/&[&glib::TypeClass], accepted_extensions: /*Unimplemented*/Vec) -> bool { // unsafe { TODO: call ffi:soup_websocket_server_process_handshake() } //} soup3-0.7.0/src/auto/hsts_enforcer.rs000064400000000000000000000103531046102023000156540ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, HSTSPolicy, SessionFeature}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "SoupHSTSEnforcer")] pub struct HSTSEnforcer(Object) @implements SessionFeature; match fn { type_ => || ffi::soup_hsts_enforcer_get_type(), } } impl HSTSEnforcer { pub const NONE: Option<&'static HSTSEnforcer> = None; #[doc(alias = "soup_hsts_enforcer_new")] pub fn new() -> HSTSEnforcer { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_hsts_enforcer_new()) } } } impl Default for HSTSEnforcer { fn default() -> Self { Self::new() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait HSTSEnforcerExt: IsA + sealed::Sealed + 'static { #[doc(alias = "soup_hsts_enforcer_get_domains")] #[doc(alias = "get_domains")] fn domains(&self, session_policies: bool) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::soup_hsts_enforcer_get_domains( self.as_ref().to_glib_none().0, session_policies.into_glib(), )) } } #[doc(alias = "soup_hsts_enforcer_get_policies")] #[doc(alias = "get_policies")] fn policies(&self, session_policies: bool) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::soup_hsts_enforcer_get_policies( self.as_ref().to_glib_none().0, session_policies.into_glib(), )) } } #[doc(alias = "soup_hsts_enforcer_has_valid_policy")] fn has_valid_policy(&self, domain: &str) -> bool { unsafe { from_glib(ffi::soup_hsts_enforcer_has_valid_policy( self.as_ref().to_glib_none().0, domain.to_glib_none().0, )) } } #[doc(alias = "soup_hsts_enforcer_is_persistent")] fn is_persistent(&self) -> bool { unsafe { from_glib(ffi::soup_hsts_enforcer_is_persistent( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_hsts_enforcer_set_policy")] fn set_policy(&self, policy: &mut HSTSPolicy) { unsafe { ffi::soup_hsts_enforcer_set_policy( self.as_ref().to_glib_none().0, policy.to_glib_none_mut().0, ); } } #[doc(alias = "soup_hsts_enforcer_set_session_policy")] fn set_session_policy(&self, domain: &str, include_subdomains: bool) { unsafe { ffi::soup_hsts_enforcer_set_session_policy( self.as_ref().to_glib_none().0, domain.to_glib_none().0, include_subdomains.into_glib(), ); } } #[doc(alias = "changed")] fn connect_changed( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn changed_trampoline< P: IsA, F: Fn(&P, &HSTSPolicy, &HSTSPolicy) + 'static, >( this: *mut ffi::SoupHSTSEnforcer, old_policy: *mut ffi::SoupHSTSPolicy, new_policy: *mut ffi::SoupHSTSPolicy, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( HSTSEnforcer::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(old_policy), &from_glib_borrow(new_policy), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"changed\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( changed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> HSTSEnforcerExt for O {} soup3-0.7.0/src/auto/hsts_enforcer_db.rs000064400000000000000000000045441046102023000163260ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, HSTSEnforcer, SessionFeature}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "SoupHSTSEnforcerDB")] pub struct HSTSEnforcerDB(Object) @extends HSTSEnforcer, @implements SessionFeature; match fn { type_ => || ffi::soup_hsts_enforcer_db_get_type(), } } impl HSTSEnforcerDB { #[doc(alias = "soup_hsts_enforcer_db_new")] pub fn new(filename: &str) -> HSTSEnforcerDB { assert_initialized_main_thread!(); unsafe { HSTSEnforcer::from_glib_full(ffi::soup_hsts_enforcer_db_new(filename.to_glib_none().0)) .unsafe_cast() } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`HSTSEnforcerDB`] objects. /// /// This method returns an instance of [`HSTSEnforcerDBBuilder`](crate::builders::HSTSEnforcerDBBuilder) which can be used to create [`HSTSEnforcerDB`] objects. pub fn builder() -> HSTSEnforcerDBBuilder { HSTSEnforcerDBBuilder::new() } pub fn filename(&self) -> Option { ObjectExt::property(self, "filename") } } impl Default for HSTSEnforcerDB { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`HSTSEnforcerDB`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct HSTSEnforcerDBBuilder { builder: glib::object::ObjectBuilder<'static, HSTSEnforcerDB>, } impl HSTSEnforcerDBBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn filename(self, filename: impl Into) -> Self { Self { builder: self.builder.property("filename", filename.into()), } } // rustdoc-stripper-ignore-next /// Build the [`HSTSEnforcerDB`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> HSTSEnforcerDB { self.builder.build() } } soup3-0.7.0/src/auto/hsts_policy.rs000064400000000000000000000070731046102023000153550ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, Message}; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct HSTSPolicy(Boxed); match fn { copy => |ptr| ffi::soup_hsts_policy_copy(mut_override(ptr)), free => |ptr| ffi::soup_hsts_policy_free(ptr), type_ => || ffi::soup_hsts_policy_get_type(), } } impl HSTSPolicy { #[doc(alias = "soup_hsts_policy_new")] pub fn new(domain: &str, max_age: libc::c_ulong, include_subdomains: bool) -> HSTSPolicy { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_hsts_policy_new( domain.to_glib_none().0, max_age, include_subdomains.into_glib(), )) } } #[doc(alias = "soup_hsts_policy_new_from_response")] #[doc(alias = "new_from_response")] pub fn from_response(msg: &Message) -> Option { skip_assert_initialized!(); unsafe { from_glib_full(ffi::soup_hsts_policy_new_from_response( msg.to_glib_none().0, )) } } #[doc(alias = "soup_hsts_policy_new_full")] pub fn new_full( domain: &str, max_age: libc::c_ulong, expires: &glib::DateTime, include_subdomains: bool, ) -> HSTSPolicy { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_hsts_policy_new_full( domain.to_glib_none().0, max_age, expires.to_glib_none().0, include_subdomains.into_glib(), )) } } #[doc(alias = "soup_hsts_policy_new_session_policy")] pub fn new_session_policy(domain: &str, include_subdomains: bool) -> HSTSPolicy { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_hsts_policy_new_session_policy( domain.to_glib_none().0, include_subdomains.into_glib(), )) } } #[doc(alias = "soup_hsts_policy_get_domain")] #[doc(alias = "get_domain")] pub fn domain(&mut self) -> Option { unsafe { from_glib_none(ffi::soup_hsts_policy_get_domain(self.to_glib_none_mut().0)) } } #[doc(alias = "soup_hsts_policy_get_expires")] #[doc(alias = "get_expires")] pub fn expires(&mut self) -> Option { unsafe { from_glib_full(ffi::soup_hsts_policy_get_expires(self.to_glib_none_mut().0)) } } #[doc(alias = "soup_hsts_policy_get_max_age")] #[doc(alias = "get_max_age")] pub fn max_age(&mut self) -> libc::c_ulong { unsafe { ffi::soup_hsts_policy_get_max_age(self.to_glib_none_mut().0) } } #[doc(alias = "soup_hsts_policy_includes_subdomains")] pub fn includes_subdomains(&mut self) -> bool { unsafe { from_glib(ffi::soup_hsts_policy_includes_subdomains( self.to_glib_none_mut().0, )) } } #[doc(alias = "soup_hsts_policy_is_expired")] pub fn is_expired(&mut self) -> bool { unsafe { from_glib(ffi::soup_hsts_policy_is_expired(self.to_glib_none_mut().0)) } } #[doc(alias = "soup_hsts_policy_is_session_policy")] pub fn is_session_policy(&mut self) -> bool { unsafe { from_glib(ffi::soup_hsts_policy_is_session_policy( self.to_glib_none_mut().0, )) } } } soup3-0.7.0/src/auto/logger.rs000064400000000000000000000165751046102023000143030ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, LoggerLogLevel, Message, SessionFeature}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "SoupLogger")] pub struct Logger(Object) @implements SessionFeature; match fn { type_ => || ffi::soup_logger_get_type(), } } impl Logger { #[doc(alias = "soup_logger_new")] pub fn new(level: LoggerLogLevel) -> Logger { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_logger_new(level.into_glib())) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Logger`] objects. /// /// This method returns an instance of [`LoggerBuilder`](crate::builders::LoggerBuilder) which can be used to create [`Logger`] objects. pub fn builder() -> LoggerBuilder { LoggerBuilder::new() } #[doc(alias = "soup_logger_get_max_body_size")] #[doc(alias = "get_max_body_size")] #[doc(alias = "max-body-size")] pub fn max_body_size(&self) -> i32 { unsafe { ffi::soup_logger_get_max_body_size(self.to_glib_none().0) } } #[doc(alias = "soup_logger_set_max_body_size")] #[doc(alias = "max-body-size")] pub fn set_max_body_size(&self, max_body_size: i32) { unsafe { ffi::soup_logger_set_max_body_size(self.to_glib_none().0, max_body_size); } } #[doc(alias = "soup_logger_set_request_filter")] pub fn set_request_filter LoggerLogLevel + 'static>( &self, request_filter: P, ) { let request_filter_data: Box_

= Box_::new(request_filter); unsafe extern "C" fn request_filter_func< P: Fn(&Logger, &Message) -> LoggerLogLevel + 'static, >( logger: *mut ffi::SoupLogger, msg: *mut ffi::SoupMessage, user_data: glib::ffi::gpointer, ) -> ffi::SoupLoggerLogLevel { let logger = from_glib_borrow(logger); let msg = from_glib_borrow(msg); let callback = &*(user_data as *mut P); (*callback)(&logger, &msg).into_glib() } let request_filter = Some(request_filter_func::

as _); unsafe extern "C" fn destroy_func LoggerLogLevel + 'static>( data: glib::ffi::gpointer, ) { let _callback = Box_::from_raw(data as *mut P); } let destroy_call3 = Some(destroy_func::

as _); let super_callback0: Box_

= request_filter_data; unsafe { ffi::soup_logger_set_request_filter( self.to_glib_none().0, request_filter, Box_::into_raw(super_callback0) as *mut _, destroy_call3, ); } } #[doc(alias = "soup_logger_set_response_filter")] pub fn set_response_filter LoggerLogLevel + 'static>( &self, response_filter: P, ) { let response_filter_data: Box_

= Box_::new(response_filter); unsafe extern "C" fn response_filter_func< P: Fn(&Logger, &Message) -> LoggerLogLevel + 'static, >( logger: *mut ffi::SoupLogger, msg: *mut ffi::SoupMessage, user_data: glib::ffi::gpointer, ) -> ffi::SoupLoggerLogLevel { let logger = from_glib_borrow(logger); let msg = from_glib_borrow(msg); let callback = &*(user_data as *mut P); (*callback)(&logger, &msg).into_glib() } let response_filter = Some(response_filter_func::

as _); unsafe extern "C" fn destroy_func LoggerLogLevel + 'static>( data: glib::ffi::gpointer, ) { let _callback = Box_::from_raw(data as *mut P); } let destroy_call3 = Some(destroy_func::

as _); let super_callback0: Box_

= response_filter_data; unsafe { ffi::soup_logger_set_response_filter( self.to_glib_none().0, response_filter, Box_::into_raw(super_callback0) as *mut _, destroy_call3, ); } } pub fn level(&self) -> LoggerLogLevel { ObjectExt::property(self, "level") } pub fn set_level(&self, level: LoggerLogLevel) { ObjectExt::set_property(self, "level", level) } #[doc(alias = "level")] pub fn connect_level_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_level_trampoline( this: *mut ffi::SoupLogger, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::level\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_level_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "max-body-size")] pub fn connect_max_body_size_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_max_body_size_trampoline( this: *mut ffi::SoupLogger, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::max-body-size\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_max_body_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl Default for Logger { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Logger`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct LoggerBuilder { builder: glib::object::ObjectBuilder<'static, Logger>, } impl LoggerBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn level(self, level: LoggerLogLevel) -> Self { Self { builder: self.builder.property("level", level), } } pub fn max_body_size(self, max_body_size: i32) -> Self { Self { builder: self.builder.property("max-body-size", max_body_size), } } // rustdoc-stripper-ignore-next /// Build the [`Logger`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Logger { self.builder.build() } } soup3-0.7.0/src/auto/message.rs000064400000000000000000001371701046102023000144430ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ ffi, Auth, HTTPVersion, MessageFlags, MessageHeaders, MessageMetrics, MessagePriority, Multipart, Status, }; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "SoupMessage")] pub struct Message(Object); match fn { type_ => || ffi::soup_message_get_type(), } } impl Message { #[doc(alias = "soup_message_new")] pub fn new(method: &str, uri_string: &str) -> Result { assert_initialized_main_thread!(); unsafe { Option::<_>::from_glib_full(ffi::soup_message_new( method.to_glib_none().0, uri_string.to_glib_none().0, )) .ok_or_else(|| glib::bool_error!("Invalid URL")) } } #[doc(alias = "soup_message_new_from_encoded_form")] #[doc(alias = "new_from_encoded_form")] pub fn from_encoded_form( method: &str, uri_string: &str, encoded_form: glib::GString, ) -> Result { assert_initialized_main_thread!(); unsafe { Option::<_>::from_glib_full(ffi::soup_message_new_from_encoded_form( method.to_glib_none().0, uri_string.to_glib_none().0, encoded_form.into_glib_ptr(), )) .ok_or_else(|| glib::bool_error!("Invalid URL")) } } #[doc(alias = "soup_message_new_from_multipart")] #[doc(alias = "new_from_multipart")] pub fn from_multipart( uri_string: &str, multipart: &mut Multipart, ) -> Result { assert_initialized_main_thread!(); unsafe { Option::<_>::from_glib_full(ffi::soup_message_new_from_multipart( uri_string.to_glib_none().0, multipart.to_glib_none_mut().0, )) .ok_or_else(|| glib::bool_error!("Invalid URL")) } } #[doc(alias = "soup_message_new_from_uri")] #[doc(alias = "new_from_uri")] pub fn from_uri(method: &str, uri: &glib::Uri) -> Message { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_message_new_from_uri( method.to_glib_none().0, uri.to_glib_none().0, )) } } #[doc(alias = "soup_message_new_options_ping")] pub fn new_options_ping(base_uri: &glib::Uri) -> Message { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_message_new_options_ping( base_uri.to_glib_none().0, )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Message`] objects. /// /// This method returns an instance of [`MessageBuilder`](crate::builders::MessageBuilder) which can be used to create [`Message`] objects. pub fn builder() -> MessageBuilder { MessageBuilder::new() } #[doc(alias = "soup_message_add_flags")] pub fn add_flags(&self, flags: MessageFlags) { unsafe { ffi::soup_message_add_flags(self.to_glib_none().0, flags.into_glib()); } } //#[doc(alias = "soup_message_add_header_handler")] //pub fn add_header_handler(&self, signal: &str, header: &str, callback: P, user_data: /*Unimplemented*/Option) -> u32 { // unsafe { TODO: call ffi:soup_message_add_header_handler() } //} //#[doc(alias = "soup_message_add_status_code_handler")] //pub fn add_status_code_handler(&self, signal: &str, status_code: u32, callback: P, user_data: /*Unimplemented*/Option) -> u32 { // unsafe { TODO: call ffi:soup_message_add_status_code_handler() } //} #[doc(alias = "soup_message_disable_feature")] pub fn disable_feature(&self, feature_type: glib::types::Type) { unsafe { ffi::soup_message_disable_feature(self.to_glib_none().0, feature_type.into_glib()); } } #[doc(alias = "soup_message_get_connection_id")] #[doc(alias = "get_connection_id")] pub fn connection_id(&self) -> u64 { unsafe { ffi::soup_message_get_connection_id(self.to_glib_none().0) } } #[doc(alias = "soup_message_get_first_party")] #[doc(alias = "get_first_party")] #[doc(alias = "first-party")] pub fn first_party(&self) -> Option { unsafe { from_glib_none(ffi::soup_message_get_first_party(self.to_glib_none().0)) } } #[doc(alias = "soup_message_get_flags")] #[doc(alias = "get_flags")] pub fn flags(&self) -> MessageFlags { unsafe { from_glib(ffi::soup_message_get_flags(self.to_glib_none().0)) } } #[cfg(feature = "v3_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v3_4")))] #[doc(alias = "soup_message_get_force_http1")] #[doc(alias = "get_force_http1")] pub fn is_force_http1(&self) -> bool { unsafe { from_glib(ffi::soup_message_get_force_http1(self.to_glib_none().0)) } } #[doc(alias = "soup_message_get_http_version")] #[doc(alias = "get_http_version")] #[doc(alias = "http-version")] pub fn http_version(&self) -> HTTPVersion { unsafe { from_glib(ffi::soup_message_get_http_version(self.to_glib_none().0)) } } #[doc(alias = "soup_message_get_is_options_ping")] #[doc(alias = "get_is_options_ping")] #[doc(alias = "is-options-ping")] pub fn is_options_ping(&self) -> bool { unsafe { from_glib(ffi::soup_message_get_is_options_ping(self.to_glib_none().0)) } } #[doc(alias = "soup_message_get_is_top_level_navigation")] #[doc(alias = "get_is_top_level_navigation")] #[doc(alias = "is-top-level-navigation")] pub fn is_top_level_navigation(&self) -> bool { unsafe { from_glib(ffi::soup_message_get_is_top_level_navigation( self.to_glib_none().0, )) } } #[doc(alias = "soup_message_get_method")] #[doc(alias = "get_method")] pub fn method(&self) -> Option { unsafe { from_glib_none(ffi::soup_message_get_method(self.to_glib_none().0)) } } #[doc(alias = "soup_message_get_metrics")] #[doc(alias = "get_metrics")] pub fn metrics(&self) -> Option { unsafe { from_glib_none(ffi::soup_message_get_metrics(self.to_glib_none().0)) } } #[doc(alias = "soup_message_get_priority")] #[doc(alias = "get_priority")] pub fn priority(&self) -> MessagePriority { unsafe { from_glib(ffi::soup_message_get_priority(self.to_glib_none().0)) } } #[doc(alias = "soup_message_get_reason_phrase")] #[doc(alias = "get_reason_phrase")] #[doc(alias = "reason-phrase")] pub fn reason_phrase(&self) -> Option { unsafe { from_glib_none(ffi::soup_message_get_reason_phrase(self.to_glib_none().0)) } } #[doc(alias = "soup_message_get_remote_address")] #[doc(alias = "get_remote_address")] #[doc(alias = "remote-address")] pub fn remote_address(&self) -> Option { unsafe { from_glib_none(ffi::soup_message_get_remote_address(self.to_glib_none().0)) } } #[doc(alias = "soup_message_get_request_headers")] #[doc(alias = "get_request_headers")] #[doc(alias = "request-headers")] pub fn request_headers(&self) -> Option { unsafe { from_glib_none(ffi::soup_message_get_request_headers(self.to_glib_none().0)) } } #[doc(alias = "soup_message_get_response_headers")] #[doc(alias = "get_response_headers")] #[doc(alias = "response-headers")] pub fn response_headers(&self) -> Option { unsafe { from_glib_none(ffi::soup_message_get_response_headers( self.to_glib_none().0, )) } } #[doc(alias = "soup_message_get_status")] #[doc(alias = "get_status")] pub fn status(&self) -> Status { unsafe { from_glib(ffi::soup_message_get_status(self.to_glib_none().0)) } } #[doc(alias = "soup_message_get_tls_ciphersuite_name")] #[doc(alias = "get_tls_ciphersuite_name")] #[doc(alias = "tls-ciphersuite-name")] pub fn tls_ciphersuite_name(&self) -> Option { unsafe { from_glib_none(ffi::soup_message_get_tls_ciphersuite_name( self.to_glib_none().0, )) } } #[doc(alias = "soup_message_get_tls_peer_certificate")] #[doc(alias = "get_tls_peer_certificate")] #[doc(alias = "tls-peer-certificate")] pub fn tls_peer_certificate(&self) -> Option { unsafe { from_glib_none(ffi::soup_message_get_tls_peer_certificate( self.to_glib_none().0, )) } } #[doc(alias = "soup_message_get_tls_peer_certificate_errors")] #[doc(alias = "get_tls_peer_certificate_errors")] #[doc(alias = "tls-peer-certificate-errors")] pub fn tls_peer_certificate_errors(&self) -> gio::TlsCertificateFlags { unsafe { from_glib(ffi::soup_message_get_tls_peer_certificate_errors( self.to_glib_none().0, )) } } #[doc(alias = "soup_message_get_tls_protocol_version")] #[doc(alias = "get_tls_protocol_version")] #[doc(alias = "tls-protocol-version")] pub fn tls_protocol_version(&self) -> gio::TlsProtocolVersion { unsafe { from_glib(ffi::soup_message_get_tls_protocol_version( self.to_glib_none().0, )) } } #[doc(alias = "soup_message_get_uri")] #[doc(alias = "get_uri")] #[doc(alias = "method")] pub fn uri(&self) -> Option { unsafe { from_glib_none(ffi::soup_message_get_uri(self.to_glib_none().0)) } } #[doc(alias = "soup_message_is_feature_disabled")] pub fn is_feature_disabled(&self, feature_type: glib::types::Type) -> bool { unsafe { from_glib(ffi::soup_message_is_feature_disabled( self.to_glib_none().0, feature_type.into_glib(), )) } } #[doc(alias = "soup_message_is_keepalive")] pub fn is_keepalive(&self) -> bool { unsafe { from_glib(ffi::soup_message_is_keepalive(self.to_glib_none().0)) } } #[doc(alias = "soup_message_query_flags")] pub fn query_flags(&self, flags: MessageFlags) -> bool { unsafe { from_glib(ffi::soup_message_query_flags( self.to_glib_none().0, flags.into_glib(), )) } } #[doc(alias = "soup_message_remove_flags")] pub fn remove_flags(&self, flags: MessageFlags) { unsafe { ffi::soup_message_remove_flags(self.to_glib_none().0, flags.into_glib()); } } #[doc(alias = "soup_message_set_first_party")] #[doc(alias = "first-party")] pub fn set_first_party(&self, first_party: &glib::Uri) { unsafe { ffi::soup_message_set_first_party(self.to_glib_none().0, first_party.to_glib_none().0); } } #[doc(alias = "soup_message_set_flags")] #[doc(alias = "flags")] pub fn set_flags(&self, flags: MessageFlags) { unsafe { ffi::soup_message_set_flags(self.to_glib_none().0, flags.into_glib()); } } #[cfg(feature = "v3_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v3_4")))] #[doc(alias = "soup_message_set_force_http1")] pub fn set_force_http1(&self, value: bool) { unsafe { ffi::soup_message_set_force_http1(self.to_glib_none().0, value.into_glib()); } } #[doc(alias = "soup_message_set_is_options_ping")] #[doc(alias = "is-options-ping")] pub fn set_is_options_ping(&self, is_options_ping: bool) { unsafe { ffi::soup_message_set_is_options_ping( self.to_glib_none().0, is_options_ping.into_glib(), ); } } #[doc(alias = "soup_message_set_is_top_level_navigation")] #[doc(alias = "is-top-level-navigation")] pub fn set_is_top_level_navigation(&self, is_top_level_navigation: bool) { unsafe { ffi::soup_message_set_is_top_level_navigation( self.to_glib_none().0, is_top_level_navigation.into_glib(), ); } } #[doc(alias = "soup_message_set_method")] #[doc(alias = "method")] pub fn set_method(&self, method: &str) { unsafe { ffi::soup_message_set_method(self.to_glib_none().0, method.to_glib_none().0); } } #[doc(alias = "soup_message_set_priority")] #[doc(alias = "priority")] pub fn set_priority(&self, priority: MessagePriority) { unsafe { ffi::soup_message_set_priority(self.to_glib_none().0, priority.into_glib()); } } #[doc(alias = "soup_message_set_request_body")] pub fn set_request_body( &self, content_type: Option<&str>, stream: Option<&impl IsA>, content_length: isize, ) { unsafe { ffi::soup_message_set_request_body( self.to_glib_none().0, content_type.to_glib_none().0, stream.map(|p| p.as_ref()).to_glib_none().0, content_length, ); } } #[doc(alias = "soup_message_set_request_body_from_bytes")] pub fn set_request_body_from_bytes( &self, content_type: Option<&str>, bytes: Option<&glib::Bytes>, ) { unsafe { ffi::soup_message_set_request_body_from_bytes( self.to_glib_none().0, content_type.to_glib_none().0, bytes.to_glib_none().0, ); } } #[doc(alias = "soup_message_set_tls_client_certificate")] pub fn set_tls_client_certificate(&self, certificate: Option<&impl IsA>) { unsafe { ffi::soup_message_set_tls_client_certificate( self.to_glib_none().0, certificate.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "soup_message_set_uri")] #[doc(alias = "method")] pub fn set_uri(&self, uri: &glib::Uri) { unsafe { ffi::soup_message_set_uri(self.to_glib_none().0, uri.to_glib_none().0); } } #[doc(alias = "soup_message_tls_client_certificate_password_request_complete")] pub fn tls_client_certificate_password_request_complete(&self) { unsafe { ffi::soup_message_tls_client_certificate_password_request_complete( self.to_glib_none().0, ); } } #[doc(alias = "site-for-cookies")] pub fn site_for_cookies(&self) -> Option { ObjectExt::property(self, "site-for-cookies") } #[doc(alias = "site-for-cookies")] pub fn set_site_for_cookies(&self, site_for_cookies: Option<&glib::Uri>) { ObjectExt::set_property(self, "site-for-cookies", site_for_cookies) } #[doc(alias = "status-code")] pub fn status_code(&self) -> u32 { ObjectExt::property(self, "status-code") } #[doc(alias = "accept-certificate")] pub fn connect_accept_certificate< F: Fn(&Self, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + 'static, >( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn accept_certificate_trampoline< F: Fn(&Message, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + 'static, >( this: *mut ffi::SoupMessage, tls_peer_certificate: *mut gio::ffi::GTlsCertificate, tls_peer_errors: gio::ffi::GTlsCertificateFlags, f: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), &from_glib_borrow(tls_peer_certificate), from_glib(tls_peer_errors), ) .into_glib() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"accept-certificate\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( accept_certificate_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "authenticate")] pub fn connect_authenticate bool + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn authenticate_trampoline< F: Fn(&Message, &Auth, bool) -> bool + 'static, >( this: *mut ffi::SoupMessage, auth: *mut ffi::SoupAuth, retrying: glib::ffi::gboolean, f: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), &from_glib_borrow(auth), from_glib(retrying), ) .into_glib() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"authenticate\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( authenticate_trampoline:: as *const (), )), Box_::into_raw(f), ) } } //#[doc(alias = "content-sniffed")] //pub fn connect_content_sniffed(&self, f: F) -> SignalHandlerId { // Empty ctype params: *.HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } //} #[doc(alias = "finished")] pub fn connect_finished(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn finished_trampoline( this: *mut ffi::SoupMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"finished\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( finished_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "got-body")] pub fn connect_got_body(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn got_body_trampoline( this: *mut ffi::SoupMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"got-body\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( got_body_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v3_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v3_4")))] #[doc(alias = "got-body-data")] pub fn connect_got_body_data(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn got_body_data_trampoline( this: *mut ffi::SoupMessage, chunk_size: libc::c_uint, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), chunk_size) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"got-body-data\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( got_body_data_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "got-headers")] pub fn connect_got_headers(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn got_headers_trampoline( this: *mut ffi::SoupMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"got-headers\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( got_headers_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "got-informational")] pub fn connect_got_informational(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn got_informational_trampoline( this: *mut ffi::SoupMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"got-informational\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( got_informational_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "hsts-enforced")] pub fn connect_hsts_enforced(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn hsts_enforced_trampoline( this: *mut ffi::SoupMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"hsts-enforced\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( hsts_enforced_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "network-event")] pub fn connect_network_event( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn network_event_trampoline< F: Fn(&Message, gio::SocketClientEvent, &gio::IOStream) + 'static, >( this: *mut ffi::SoupMessage, event: gio::ffi::GSocketClientEvent, connection: *mut gio::ffi::GIOStream, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), from_glib(event), &from_glib_borrow(connection), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"network-event\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( network_event_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "request-certificate")] pub fn connect_request_certificate< F: Fn(&Self, &gio::TlsClientConnection) -> bool + 'static, >( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn request_certificate_trampoline< F: Fn(&Message, &gio::TlsClientConnection) -> bool + 'static, >( this: *mut ffi::SoupMessage, tls_connection: *mut gio::ffi::GTlsClientConnection, f: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(tls_connection)).into_glib() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"request-certificate\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( request_certificate_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "request-certificate-password")] pub fn connect_request_certificate_password< F: Fn(&Self, &gio::TlsPassword) -> bool + 'static, >( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn request_certificate_password_trampoline< F: Fn(&Message, &gio::TlsPassword) -> bool + 'static, >( this: *mut ffi::SoupMessage, tls_password: *mut gio::ffi::GTlsPassword, f: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(tls_password)).into_glib() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"request-certificate-password\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( request_certificate_password_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "restarted")] pub fn connect_restarted(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn restarted_trampoline( this: *mut ffi::SoupMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"restarted\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( restarted_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "starting")] pub fn connect_starting(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn starting_trampoline( this: *mut ffi::SoupMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"starting\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( starting_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "wrote-body")] pub fn connect_wrote_body(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn wrote_body_trampoline( this: *mut ffi::SoupMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"wrote-body\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( wrote_body_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "wrote-body-data")] pub fn connect_wrote_body_data(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn wrote_body_data_trampoline( this: *mut ffi::SoupMessage, chunk_size: libc::c_uint, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), chunk_size) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"wrote-body-data\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( wrote_body_data_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "wrote-headers")] pub fn connect_wrote_headers(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn wrote_headers_trampoline( this: *mut ffi::SoupMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"wrote-headers\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( wrote_headers_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "first-party")] pub fn connect_first_party_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_first_party_trampoline( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::first-party\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_first_party_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "flags")] pub fn connect_flags_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_flags_trampoline( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::flags\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_flags_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "http-version")] pub fn connect_http_version_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_http_version_trampoline( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::http-version\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_http_version_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "is-options-ping")] pub fn connect_is_options_ping_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_is_options_ping_trampoline( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::is-options-ping\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_is_options_ping_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "is-top-level-navigation")] pub fn connect_is_top_level_navigation_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_is_top_level_navigation_trampoline< F: Fn(&Message) + 'static, >( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::is-top-level-navigation\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_is_top_level_navigation_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "method")] pub fn connect_method_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_method_trampoline( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::method\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_method_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "priority")] pub fn connect_priority_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_priority_trampoline( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::priority\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_priority_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "reason-phrase")] pub fn connect_reason_phrase_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_reason_phrase_trampoline( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::reason-phrase\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_reason_phrase_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "remote-address")] pub fn connect_remote_address_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_remote_address_trampoline( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::remote-address\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_remote_address_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "request-headers")] pub fn connect_request_headers_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_request_headers_trampoline( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::request-headers\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_request_headers_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "response-headers")] pub fn connect_response_headers_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_response_headers_trampoline( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::response-headers\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_response_headers_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "site-for-cookies")] pub fn connect_site_for_cookies_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_site_for_cookies_trampoline( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::site-for-cookies\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_site_for_cookies_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "status-code")] pub fn connect_status_code_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_status_code_trampoline( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::status-code\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_status_code_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tls-ciphersuite-name")] pub fn connect_tls_ciphersuite_name_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_tls_ciphersuite_name_trampoline( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tls-ciphersuite-name\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tls_ciphersuite_name_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tls-peer-certificate")] pub fn connect_tls_peer_certificate_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_tls_peer_certificate_trampoline( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tls-peer-certificate\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tls_peer_certificate_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tls-peer-certificate-errors")] pub fn connect_tls_peer_certificate_errors_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_tls_peer_certificate_errors_trampoline< F: Fn(&Message) + 'static, >( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tls-peer-certificate-errors\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tls_peer_certificate_errors_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tls-protocol-version")] pub fn connect_tls_protocol_version_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_tls_protocol_version_trampoline( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tls-protocol-version\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tls_protocol_version_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "uri")] pub fn connect_uri_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_uri_trampoline( this: *mut ffi::SoupMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::uri\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_uri_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Message`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct MessageBuilder { builder: glib::object::ObjectBuilder<'static, Message>, } impl MessageBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn first_party(self, first_party: &glib::Uri) -> Self { Self { builder: self.builder.property("first-party", first_party.clone()), } } pub fn flags(self, flags: MessageFlags) -> Self { Self { builder: self.builder.property("flags", flags), } } pub fn is_options_ping(self, is_options_ping: bool) -> Self { Self { builder: self.builder.property("is-options-ping", is_options_ping), } } pub fn is_top_level_navigation(self, is_top_level_navigation: bool) -> Self { Self { builder: self .builder .property("is-top-level-navigation", is_top_level_navigation), } } pub fn method(self, method: impl Into) -> Self { Self { builder: self.builder.property("method", method.into()), } } pub fn priority(self, priority: MessagePriority) -> Self { Self { builder: self.builder.property("priority", priority), } } pub fn site_for_cookies(self, site_for_cookies: &glib::Uri) -> Self { Self { builder: self .builder .property("site-for-cookies", site_for_cookies.clone()), } } pub fn uri(self, uri: &glib::Uri) -> Self { Self { builder: self.builder.property("uri", uri.clone()), } } // rustdoc-stripper-ignore-next /// Build the [`Message`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Message { self.builder.build() } } soup3-0.7.0/src/auto/message_body.rs000064400000000000000000000060661046102023000154570ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::ffi; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct MessageBody(Shared); match fn { ref => |ptr| ffi::soup_message_body_ref(ptr), unref => |ptr| ffi::soup_message_body_unref(ptr), type_ => || ffi::soup_message_body_get_type(), } } impl MessageBody { #[doc(alias = "soup_message_body_new")] pub fn new() -> MessageBody { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_message_body_new()) } } #[doc(alias = "soup_message_body_append_bytes")] pub fn append_bytes(&self, buffer: &glib::Bytes) { unsafe { ffi::soup_message_body_append_bytes(self.to_glib_none().0, buffer.to_glib_none().0); } } #[doc(alias = "soup_message_body_append_take")] pub fn append_take(&self, data: &[u8]) { let length = data.len() as _; unsafe { ffi::soup_message_body_append_take(self.to_glib_none().0, data.to_glib_full(), length); } } #[doc(alias = "soup_message_body_complete")] pub fn complete(&self) { unsafe { ffi::soup_message_body_complete(self.to_glib_none().0); } } #[doc(alias = "soup_message_body_flatten")] pub fn flatten(&self) -> Option { unsafe { from_glib_full(ffi::soup_message_body_flatten(self.to_glib_none().0)) } } #[doc(alias = "soup_message_body_get_accumulate")] #[doc(alias = "get_accumulate")] pub fn is_accumulate(&self) -> bool { unsafe { from_glib(ffi::soup_message_body_get_accumulate(self.to_glib_none().0)) } } #[doc(alias = "soup_message_body_get_chunk")] #[doc(alias = "get_chunk")] pub fn chunk(&self, offset: i64) -> Option { unsafe { from_glib_full(ffi::soup_message_body_get_chunk( self.to_glib_none().0, offset, )) } } #[doc(alias = "soup_message_body_got_chunk")] pub fn got_chunk(&self, chunk: &glib::Bytes) { unsafe { ffi::soup_message_body_got_chunk(self.to_glib_none().0, chunk.to_glib_none().0); } } #[doc(alias = "soup_message_body_set_accumulate")] pub fn set_accumulate(&self, accumulate: bool) { unsafe { ffi::soup_message_body_set_accumulate(self.to_glib_none().0, accumulate.into_glib()); } } #[doc(alias = "soup_message_body_truncate")] pub fn truncate(&self) { unsafe { ffi::soup_message_body_truncate(self.to_glib_none().0); } } #[doc(alias = "soup_message_body_wrote_chunk")] pub fn wrote_chunk(&self, chunk: &glib::Bytes) { unsafe { ffi::soup_message_body_wrote_chunk(self.to_glib_none().0, chunk.to_glib_none().0); } } } impl Default for MessageBody { fn default() -> Self { Self::new() } } soup3-0.7.0/src/auto/message_headers.rs000064400000000000000000000204021046102023000161230ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, Encoding, Expectation, MessageHeadersType}; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct MessageHeaders(Shared); match fn { ref => |ptr| ffi::soup_message_headers_ref(ptr), unref => |ptr| ffi::soup_message_headers_unref(ptr), type_ => || ffi::soup_message_headers_get_type(), } } impl MessageHeaders { #[doc(alias = "soup_message_headers_new")] pub fn new(type_: MessageHeadersType) -> MessageHeaders { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_message_headers_new(type_.into_glib())) } } #[doc(alias = "soup_message_headers_append")] pub fn append(&self, name: &str, value: &str) { unsafe { ffi::soup_message_headers_append( self.to_glib_none().0, name.to_glib_none().0, value.to_glib_none().0, ); } } #[doc(alias = "soup_message_headers_clean_connection_headers")] pub fn clean_connection_headers(&self) { unsafe { ffi::soup_message_headers_clean_connection_headers(self.to_glib_none().0); } } #[doc(alias = "soup_message_headers_clear")] pub fn clear(&self) { unsafe { ffi::soup_message_headers_clear(self.to_glib_none().0); } } #[doc(alias = "soup_message_headers_foreach")] pub fn foreach(&self, func: P) { let func_data: P = func; unsafe extern "C" fn func_func( name: *const libc::c_char, value: *const libc::c_char, user_data: glib::ffi::gpointer, ) { let name: Borrowed = from_glib_borrow(name); let value: Borrowed = from_glib_borrow(value); let callback = user_data as *mut P; (*callback)(name.as_str(), value.as_str()) } let func = Some(func_func::

as _); let super_callback0: &P = &func_data; unsafe { ffi::soup_message_headers_foreach( self.to_glib_none().0, func, super_callback0 as *const _ as *mut _, ); } } //#[doc(alias = "soup_message_headers_free_ranges")] //pub fn free_ranges(&self, ranges: /*Ignored*/&mut Range) { // unsafe { TODO: call ffi:soup_message_headers_free_ranges() } //} #[doc(alias = "soup_message_headers_get_content_length")] #[doc(alias = "get_content_length")] pub fn content_length(&self) -> i64 { unsafe { ffi::soup_message_headers_get_content_length(self.to_glib_none().0) } } #[doc(alias = "soup_message_headers_get_content_range")] #[doc(alias = "get_content_range")] pub fn content_range(&self) -> Option<(i64, i64, i64)> { unsafe { let mut start = std::mem::MaybeUninit::uninit(); let mut end = std::mem::MaybeUninit::uninit(); let mut total_length = std::mem::MaybeUninit::uninit(); let ret = from_glib(ffi::soup_message_headers_get_content_range( self.to_glib_none().0, start.as_mut_ptr(), end.as_mut_ptr(), total_length.as_mut_ptr(), )); if ret { Some(( start.assume_init(), end.assume_init(), total_length.assume_init(), )) } else { None } } } #[doc(alias = "soup_message_headers_get_encoding")] #[doc(alias = "get_encoding")] pub fn encoding(&self) -> Encoding { unsafe { from_glib(ffi::soup_message_headers_get_encoding( self.to_glib_none().0, )) } } #[doc(alias = "soup_message_headers_get_expectations")] #[doc(alias = "get_expectations")] pub fn expectations(&self) -> Expectation { unsafe { from_glib(ffi::soup_message_headers_get_expectations( self.to_glib_none().0, )) } } #[doc(alias = "soup_message_headers_get_headers_type")] #[doc(alias = "get_headers_type")] pub fn headers_type(&self) -> MessageHeadersType { unsafe { from_glib(ffi::soup_message_headers_get_headers_type( self.to_glib_none().0, )) } } #[doc(alias = "soup_message_headers_get_list")] #[doc(alias = "get_list")] pub fn list(&self, name: &str) -> Option { unsafe { from_glib_none(ffi::soup_message_headers_get_list( self.to_glib_none().0, name.to_glib_none().0, )) } } #[doc(alias = "soup_message_headers_get_one")] #[doc(alias = "get_one")] pub fn one(&self, name: &str) -> Option { unsafe { from_glib_none(ffi::soup_message_headers_get_one( self.to_glib_none().0, name.to_glib_none().0, )) } } //#[doc(alias = "soup_message_headers_get_ranges")] //#[doc(alias = "get_ranges")] //pub fn ranges(&self, total_length: i64, ranges: /*Ignored*/Vec) -> Option { // unsafe { TODO: call ffi:soup_message_headers_get_ranges() } //} #[doc(alias = "soup_message_headers_header_contains")] pub fn header_contains(&self, name: &str, token: &str) -> bool { unsafe { from_glib(ffi::soup_message_headers_header_contains( self.to_glib_none().0, name.to_glib_none().0, token.to_glib_none().0, )) } } #[doc(alias = "soup_message_headers_header_equals")] pub fn header_equals(&self, name: &str, value: &str) -> bool { unsafe { from_glib(ffi::soup_message_headers_header_equals( self.to_glib_none().0, name.to_glib_none().0, value.to_glib_none().0, )) } } #[doc(alias = "soup_message_headers_remove")] pub fn remove(&self, name: &str) { unsafe { ffi::soup_message_headers_remove(self.to_glib_none().0, name.to_glib_none().0); } } #[doc(alias = "soup_message_headers_replace")] pub fn replace(&self, name: &str, value: &str) { unsafe { ffi::soup_message_headers_replace( self.to_glib_none().0, name.to_glib_none().0, value.to_glib_none().0, ); } } #[doc(alias = "soup_message_headers_set_content_length")] pub fn set_content_length(&self, content_length: i64) { unsafe { ffi::soup_message_headers_set_content_length(self.to_glib_none().0, content_length); } } #[doc(alias = "soup_message_headers_set_content_range")] pub fn set_content_range(&self, start: i64, end: i64, total_length: i64) { unsafe { ffi::soup_message_headers_set_content_range( self.to_glib_none().0, start, end, total_length, ); } } #[doc(alias = "soup_message_headers_set_encoding")] pub fn set_encoding(&self, encoding: Encoding) { unsafe { ffi::soup_message_headers_set_encoding(self.to_glib_none().0, encoding.into_glib()); } } #[doc(alias = "soup_message_headers_set_expectations")] pub fn set_expectations(&self, expectations: Expectation) { unsafe { ffi::soup_message_headers_set_expectations( self.to_glib_none().0, expectations.into_glib(), ); } } #[doc(alias = "soup_message_headers_set_range")] pub fn set_range(&self, start: i64, end: i64) { unsafe { ffi::soup_message_headers_set_range(self.to_glib_none().0, start, end); } } //#[doc(alias = "soup_message_headers_set_ranges")] //pub fn set_ranges(&self, ranges: /*Ignored*/&mut Range, length: i32) { // unsafe { TODO: call ffi:soup_message_headers_set_ranges() } //} } soup3-0.7.0/src/auto/message_metrics.rs000064400000000000000000000105411046102023000161610ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::ffi; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct MessageMetrics(Boxed); match fn { copy => |ptr| ffi::soup_message_metrics_copy(mut_override(ptr)), free => |ptr| ffi::soup_message_metrics_free(ptr), type_ => || ffi::soup_message_metrics_get_type(), } } impl MessageMetrics { #[doc(alias = "soup_message_metrics_get_connect_end")] #[doc(alias = "get_connect_end")] pub fn connect_end(&mut self) -> u64 { unsafe { ffi::soup_message_metrics_get_connect_end(self.to_glib_none_mut().0) } } #[doc(alias = "soup_message_metrics_get_connect_start")] #[doc(alias = "get_connect_start")] pub fn connect_start(&mut self) -> u64 { unsafe { ffi::soup_message_metrics_get_connect_start(self.to_glib_none_mut().0) } } #[doc(alias = "soup_message_metrics_get_dns_end")] #[doc(alias = "get_dns_end")] pub fn dns_end(&mut self) -> u64 { unsafe { ffi::soup_message_metrics_get_dns_end(self.to_glib_none_mut().0) } } #[doc(alias = "soup_message_metrics_get_dns_start")] #[doc(alias = "get_dns_start")] pub fn dns_start(&mut self) -> u64 { unsafe { ffi::soup_message_metrics_get_dns_start(self.to_glib_none_mut().0) } } #[doc(alias = "soup_message_metrics_get_fetch_start")] #[doc(alias = "get_fetch_start")] pub fn fetch_start(&mut self) -> u64 { unsafe { ffi::soup_message_metrics_get_fetch_start(self.to_glib_none_mut().0) } } #[doc(alias = "soup_message_metrics_get_request_body_bytes_sent")] #[doc(alias = "get_request_body_bytes_sent")] pub fn request_body_bytes_sent(&mut self) -> u64 { unsafe { ffi::soup_message_metrics_get_request_body_bytes_sent(self.to_glib_none_mut().0) } } #[doc(alias = "soup_message_metrics_get_request_body_size")] #[doc(alias = "get_request_body_size")] pub fn request_body_size(&mut self) -> u64 { unsafe { ffi::soup_message_metrics_get_request_body_size(self.to_glib_none_mut().0) } } #[doc(alias = "soup_message_metrics_get_request_header_bytes_sent")] #[doc(alias = "get_request_header_bytes_sent")] pub fn request_header_bytes_sent(&mut self) -> u64 { unsafe { ffi::soup_message_metrics_get_request_header_bytes_sent(self.to_glib_none_mut().0) } } #[doc(alias = "soup_message_metrics_get_request_start")] #[doc(alias = "get_request_start")] pub fn request_start(&mut self) -> u64 { unsafe { ffi::soup_message_metrics_get_request_start(self.to_glib_none_mut().0) } } #[doc(alias = "soup_message_metrics_get_response_body_bytes_received")] #[doc(alias = "get_response_body_bytes_received")] pub fn response_body_bytes_received(&mut self) -> u64 { unsafe { ffi::soup_message_metrics_get_response_body_bytes_received(self.to_glib_none_mut().0) } } #[doc(alias = "soup_message_metrics_get_response_body_size")] #[doc(alias = "get_response_body_size")] pub fn response_body_size(&mut self) -> u64 { unsafe { ffi::soup_message_metrics_get_response_body_size(self.to_glib_none_mut().0) } } #[doc(alias = "soup_message_metrics_get_response_end")] #[doc(alias = "get_response_end")] pub fn response_end(&mut self) -> u64 { unsafe { ffi::soup_message_metrics_get_response_end(self.to_glib_none_mut().0) } } #[doc(alias = "soup_message_metrics_get_response_header_bytes_received")] #[doc(alias = "get_response_header_bytes_received")] pub fn response_header_bytes_received(&mut self) -> u64 { unsafe { ffi::soup_message_metrics_get_response_header_bytes_received(self.to_glib_none_mut().0) } } #[doc(alias = "soup_message_metrics_get_response_start")] #[doc(alias = "get_response_start")] pub fn response_start(&mut self) -> u64 { unsafe { ffi::soup_message_metrics_get_response_start(self.to_glib_none_mut().0) } } #[doc(alias = "soup_message_metrics_get_tls_start")] #[doc(alias = "get_tls_start")] pub fn tls_start(&mut self) -> u64 { unsafe { ffi::soup_message_metrics_get_tls_start(self.to_glib_none_mut().0) } } } soup3-0.7.0/src/auto/mod.rs000064400000000000000000000111011046102023000135570ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT mod auth; pub use self::auth::Auth; mod auth_basic; pub use self::auth_basic::AuthBasic; mod auth_digest; pub use self::auth_digest::AuthDigest; mod auth_domain; pub use self::auth_domain::AuthDomain; mod auth_domain_basic; pub use self::auth_domain_basic::AuthDomainBasic; mod auth_domain_digest; pub use self::auth_domain_digest::AuthDomainDigest; mod auth_manager; pub use self::auth_manager::AuthManager; mod auth_ntlm; pub use self::auth_ntlm::AuthNTLM; mod auth_negotiate; pub use self::auth_negotiate::AuthNegotiate; mod cache; pub use self::cache::Cache; mod content_decoder; pub use self::content_decoder::ContentDecoder; mod content_sniffer; pub use self::content_sniffer::ContentSniffer; mod cookie_jar; pub use self::cookie_jar::CookieJar; mod cookie_jar_db; pub use self::cookie_jar_db::CookieJarDB; mod cookie_jar_text; pub use self::cookie_jar_text::CookieJarText; mod hsts_enforcer; pub use self::hsts_enforcer::HSTSEnforcer; mod hsts_enforcer_db; pub use self::hsts_enforcer_db::HSTSEnforcerDB; mod logger; pub use self::logger::Logger; mod message; pub use self::message::Message; mod multipart_input_stream; pub use self::multipart_input_stream::MultipartInputStream; mod server; pub use self::server::Server; mod server_message; pub use self::server_message::ServerMessage; mod session; pub use self::session::Session; mod session_feature; pub use self::session_feature::SessionFeature; mod websocket_connection; pub use self::websocket_connection::WebsocketConnection; mod websocket_extension; pub use self::websocket_extension::WebsocketExtension; mod websocket_extension_deflate; pub use self::websocket_extension_deflate::WebsocketExtensionDeflate; mod websocket_extension_manager; pub use self::websocket_extension_manager::WebsocketExtensionManager; mod cookie; pub use self::cookie::Cookie; mod hsts_policy; pub use self::hsts_policy::HSTSPolicy; mod message_body; pub use self::message_body::MessageBody; mod message_headers; pub use self::message_headers::MessageHeaders; mod message_metrics; pub use self::message_metrics::MessageMetrics; mod multipart; pub use self::multipart::Multipart; mod enums; pub use self::enums::CacheType; pub use self::enums::CookieJarAcceptPolicy; pub use self::enums::DateFormat; pub use self::enums::Encoding; pub use self::enums::HTTPVersion; pub use self::enums::LoggerLogLevel; pub use self::enums::MemoryUse; pub use self::enums::MessageHeadersType; pub use self::enums::MessagePriority; pub use self::enums::SameSitePolicy; pub use self::enums::SessionError; pub use self::enums::Status; pub use self::enums::TLDError; pub use self::enums::URIComponent; pub use self::enums::WebsocketCloseCode; pub use self::enums::WebsocketConnectionType; pub use self::enums::WebsocketDataType; pub use self::enums::WebsocketError; pub use self::enums::WebsocketState; mod flags; pub use self::flags::Cacheability; pub use self::flags::Expectation; pub use self::flags::MessageFlags; pub use self::flags::ServerListenOptions; pub(crate) mod functions; mod constants; pub use self::constants::FORM_MIME_TYPE_MULTIPART; pub use self::constants::FORM_MIME_TYPE_URLENCODED; pub(crate) mod traits { pub use super::auth::AuthExt; pub use super::auth_domain::AuthDomainExt; pub use super::cache::CacheExt; pub use super::cookie_jar::CookieJarExt; pub use super::hsts_enforcer::HSTSEnforcerExt; pub use super::server::ServerExt; pub use super::session::SessionExt; pub use super::session_feature::SessionFeatureExt; pub use super::websocket_extension::WebsocketExtensionExt; } pub(crate) mod builders { pub use super::auth_basic::AuthBasicBuilder; pub use super::auth_digest::AuthDigestBuilder; pub use super::auth_domain_basic::AuthDomainBasicBuilder; pub use super::auth_domain_digest::AuthDomainDigestBuilder; pub use super::auth_negotiate::AuthNegotiateBuilder; pub use super::auth_ntlm::AuthNTLMBuilder; pub use super::cache::CacheBuilder; pub use super::cookie_jar::CookieJarBuilder; pub use super::cookie_jar_db::CookieJarDBBuilder; pub use super::cookie_jar_text::CookieJarTextBuilder; pub use super::hsts_enforcer_db::HSTSEnforcerDBBuilder; pub use super::logger::LoggerBuilder; pub use super::message::MessageBuilder; pub use super::multipart_input_stream::MultipartInputStreamBuilder; pub use super::server::ServerBuilder; pub use super::session::SessionBuilder; pub use super::websocket_connection::WebsocketConnectionBuilder; } soup3-0.7.0/src/auto/multipart.rs000064400000000000000000000074121046102023000150330ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, MessageHeaders}; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Multipart(Boxed); match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::soup_multipart_get_type(), ptr as *mut _) as *mut ffi::SoupMultipart, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::soup_multipart_get_type(), ptr as *mut _), type_ => || ffi::soup_multipart_get_type(), } } impl Multipart { #[doc(alias = "soup_multipart_new")] pub fn new(mime_type: &str) -> Multipart { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_multipart_new(mime_type.to_glib_none().0)) } } #[doc(alias = "soup_multipart_new_from_message")] #[doc(alias = "new_from_message")] pub fn from_message(headers: &MessageHeaders, body: &glib::Bytes) -> Option { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_multipart_new_from_message( headers.to_glib_none().0, body.to_glib_none().0, )) } } #[doc(alias = "soup_multipart_append_form_file")] pub fn append_form_file( &mut self, control_name: &str, filename: Option<&str>, content_type: Option<&str>, body: &glib::Bytes, ) { unsafe { ffi::soup_multipart_append_form_file( self.to_glib_none_mut().0, control_name.to_glib_none().0, filename.to_glib_none().0, content_type.to_glib_none().0, body.to_glib_none().0, ); } } #[doc(alias = "soup_multipart_append_form_string")] pub fn append_form_string(&mut self, control_name: &str, data: &str) { unsafe { ffi::soup_multipart_append_form_string( self.to_glib_none_mut().0, control_name.to_glib_none().0, data.to_glib_none().0, ); } } #[doc(alias = "soup_multipart_append_part")] pub fn append_part(&mut self, headers: &MessageHeaders, body: &glib::Bytes) { unsafe { ffi::soup_multipart_append_part( self.to_glib_none_mut().0, headers.to_glib_none().0, body.to_glib_none().0, ); } } #[doc(alias = "soup_multipart_get_length")] #[doc(alias = "get_length")] pub fn length(&mut self) -> i32 { unsafe { ffi::soup_multipart_get_length(self.to_glib_none_mut().0) } } #[doc(alias = "soup_multipart_get_part")] #[doc(alias = "get_part")] pub fn part(&mut self, part: i32) -> Option<(MessageHeaders, glib::Bytes)> { unsafe { let mut headers = std::ptr::null_mut(); let mut body = std::ptr::null_mut(); let ret = from_glib(ffi::soup_multipart_get_part( self.to_glib_none_mut().0, part, &mut headers, &mut body, )); if ret { Some((from_glib_none(headers), from_glib_none(body))) } else { None } } } #[doc(alias = "soup_multipart_to_message")] pub fn to_message(&mut self, dest_headers: &MessageHeaders) -> glib::Bytes { unsafe { let mut dest_body = std::ptr::null_mut(); ffi::soup_multipart_to_message( self.to_glib_none_mut().0, dest_headers.to_glib_none().0, &mut dest_body, ); from_glib_full(dest_body) } } } soup3-0.7.0/src/auto/multipart_input_stream.rs000064400000000000000000000077101046102023000176260ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, Message, MessageHeaders}; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "SoupMultipartInputStream")] pub struct MultipartInputStream(Object) @extends gio::FilterInputStream, gio::InputStream, @implements gio::PollableInputStream; match fn { type_ => || ffi::soup_multipart_input_stream_get_type(), } } impl MultipartInputStream { #[doc(alias = "soup_multipart_input_stream_new")] pub fn new(msg: &Message, base_stream: &impl IsA) -> MultipartInputStream { skip_assert_initialized!(); unsafe { from_glib_full(ffi::soup_multipart_input_stream_new( msg.to_glib_none().0, base_stream.as_ref().to_glib_none().0, )) } } // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`MultipartInputStream`] objects. /// /// This method returns an instance of [`MultipartInputStreamBuilder`](crate::builders::MultipartInputStreamBuilder) which can be used to create [`MultipartInputStream`] objects. pub fn builder() -> MultipartInputStreamBuilder { MultipartInputStreamBuilder::new() } #[doc(alias = "soup_multipart_input_stream_get_headers")] #[doc(alias = "get_headers")] pub fn headers(&self) -> Option { unsafe { from_glib_none(ffi::soup_multipart_input_stream_get_headers( self.to_glib_none().0, )) } } #[doc(alias = "soup_multipart_input_stream_next_part")] pub fn next_part( &self, cancellable: Option<&impl IsA>, ) -> Result, glib::Error> { unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::soup_multipart_input_stream_next_part( self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } pub fn message(&self) -> Option { ObjectExt::property(self, "message") } } impl Default for MultipartInputStream { fn default() -> Self { glib::object::Object::new::() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`MultipartInputStream`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct MultipartInputStreamBuilder { builder: glib::object::ObjectBuilder<'static, MultipartInputStream>, } impl MultipartInputStreamBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn message(self, message: &Message) -> Self { Self { builder: self.builder.property("message", message.clone()), } } pub fn base_stream(self, base_stream: &impl IsA) -> Self { Self { builder: self .builder .property("base-stream", base_stream.clone().upcast()), } } pub fn close_base_stream(self, close_base_stream: bool) -> Self { Self { builder: self .builder .property("close-base-stream", close_base_stream), } } // rustdoc-stripper-ignore-next /// Build the [`MultipartInputStream`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> MultipartInputStream { self.builder.build() } } soup3-0.7.0/src/auto/server.rs000064400000000000000000000477121046102023000143270ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT #![allow(deprecated)] use crate::{ffi, AuthDomain, ServerListenOptions, ServerMessage}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "SoupServer")] pub struct Server(Object); match fn { type_ => || ffi::soup_server_get_type(), } } impl Server { pub const NONE: Option<&'static Server> = None; //#[doc(alias = "soup_server_new")] //pub fn new(optname1: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> Option { // unsafe { TODO: call ffi:soup_server_new() } //} // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Server`] objects. /// /// This method returns an instance of [`ServerBuilder`](crate::builders::ServerBuilder) which can be used to create [`Server`] objects. pub fn builder() -> ServerBuilder { ServerBuilder::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Server`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct ServerBuilder { builder: glib::object::ObjectBuilder<'static, Server>, } impl ServerBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn raw_paths(self, raw_paths: bool) -> Self { Self { builder: self.builder.property("raw-paths", raw_paths), } } pub fn server_header(self, server_header: impl Into) -> Self { Self { builder: self.builder.property("server-header", server_header.into()), } } pub fn tls_auth_mode(self, tls_auth_mode: gio::TlsAuthenticationMode) -> Self { Self { builder: self.builder.property("tls-auth-mode", tls_auth_mode), } } pub fn tls_certificate(self, tls_certificate: &impl IsA) -> Self { Self { builder: self .builder .property("tls-certificate", tls_certificate.clone().upcast()), } } pub fn tls_database(self, tls_database: &impl IsA) -> Self { Self { builder: self .builder .property("tls-database", tls_database.clone().upcast()), } } // rustdoc-stripper-ignore-next /// Build the [`Server`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Server { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait ServerExt: IsA + sealed::Sealed + 'static { #[doc(alias = "soup_server_accept_iostream")] fn accept_iostream( &self, stream: &impl IsA, local_addr: Option<&impl IsA>, remote_addr: Option<&impl IsA>, ) -> Result<(), glib::Error> { unsafe { let mut error = std::ptr::null_mut(); let is_ok = ffi::soup_server_accept_iostream( self.as_ref().to_glib_none().0, stream.as_ref().to_glib_none().0, local_addr.map(|p| p.as_ref()).to_glib_none().0, remote_addr.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "soup_server_add_auth_domain")] fn add_auth_domain(&self, auth_domain: &impl IsA) { unsafe { ffi::soup_server_add_auth_domain( self.as_ref().to_glib_none().0, auth_domain.as_ref().to_glib_none().0, ); } } #[doc(alias = "soup_server_add_websocket_extension")] fn add_websocket_extension(&self, extension_type: glib::types::Type) { unsafe { ffi::soup_server_add_websocket_extension( self.as_ref().to_glib_none().0, extension_type.into_glib(), ); } } #[doc(alias = "soup_server_disconnect")] fn disconnect(&self) { unsafe { ffi::soup_server_disconnect(self.as_ref().to_glib_none().0); } } #[doc(alias = "soup_server_get_listeners")] #[doc(alias = "get_listeners")] fn listeners(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_container(ffi::soup_server_get_listeners( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_server_get_tls_auth_mode")] #[doc(alias = "get_tls_auth_mode")] #[doc(alias = "tls-auth-mode")] fn tls_auth_mode(&self) -> gio::TlsAuthenticationMode { unsafe { from_glib(ffi::soup_server_get_tls_auth_mode( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_server_get_tls_certificate")] #[doc(alias = "get_tls_certificate")] #[doc(alias = "tls-certificate")] fn tls_certificate(&self) -> Option { unsafe { from_glib_none(ffi::soup_server_get_tls_certificate( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_server_get_tls_database")] #[doc(alias = "get_tls_database")] #[doc(alias = "tls-database")] fn tls_database(&self) -> Option { unsafe { from_glib_none(ffi::soup_server_get_tls_database( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_server_get_uris")] #[doc(alias = "get_uris")] fn uris(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_full(ffi::soup_server_get_uris( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_server_is_https")] fn is_https(&self) -> bool { unsafe { from_glib(ffi::soup_server_is_https(self.as_ref().to_glib_none().0)) } } #[doc(alias = "soup_server_listen")] fn listen( &self, address: &impl IsA, options: ServerListenOptions, ) -> Result<(), glib::Error> { unsafe { let mut error = std::ptr::null_mut(); let is_ok = ffi::soup_server_listen( self.as_ref().to_glib_none().0, address.as_ref().to_glib_none().0, options.into_glib(), &mut error, ); debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "soup_server_listen_all")] fn listen_all(&self, port: u32, options: ServerListenOptions) -> Result<(), glib::Error> { unsafe { let mut error = std::ptr::null_mut(); let is_ok = ffi::soup_server_listen_all( self.as_ref().to_glib_none().0, port, options.into_glib(), &mut error, ); debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "soup_server_listen_local")] fn listen_local(&self, port: u32, options: ServerListenOptions) -> Result<(), glib::Error> { unsafe { let mut error = std::ptr::null_mut(); let is_ok = ffi::soup_server_listen_local( self.as_ref().to_glib_none().0, port, options.into_glib(), &mut error, ); debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "soup_server_listen_socket")] fn listen_socket( &self, socket: &impl IsA, options: ServerListenOptions, ) -> Result<(), glib::Error> { unsafe { let mut error = std::ptr::null_mut(); let is_ok = ffi::soup_server_listen_socket( self.as_ref().to_glib_none().0, socket.as_ref().to_glib_none().0, options.into_glib(), &mut error, ); debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg_attr(feature = "v3_2", deprecated = "Since 3.2")] #[allow(deprecated)] #[doc(alias = "soup_server_pause_message")] fn pause_message(&self, msg: &ServerMessage) { unsafe { ffi::soup_server_pause_message(self.as_ref().to_glib_none().0, msg.to_glib_none().0); } } #[doc(alias = "soup_server_remove_auth_domain")] fn remove_auth_domain(&self, auth_domain: &impl IsA) { unsafe { ffi::soup_server_remove_auth_domain( self.as_ref().to_glib_none().0, auth_domain.as_ref().to_glib_none().0, ); } } #[doc(alias = "soup_server_remove_handler")] fn remove_handler(&self, path: &str) { unsafe { ffi::soup_server_remove_handler(self.as_ref().to_glib_none().0, path.to_glib_none().0); } } #[doc(alias = "soup_server_remove_websocket_extension")] fn remove_websocket_extension(&self, extension_type: glib::types::Type) { unsafe { ffi::soup_server_remove_websocket_extension( self.as_ref().to_glib_none().0, extension_type.into_glib(), ); } } #[doc(alias = "soup_server_set_tls_auth_mode")] #[doc(alias = "tls-auth-mode")] fn set_tls_auth_mode(&self, mode: gio::TlsAuthenticationMode) { unsafe { ffi::soup_server_set_tls_auth_mode(self.as_ref().to_glib_none().0, mode.into_glib()); } } #[doc(alias = "soup_server_set_tls_certificate")] #[doc(alias = "tls-certificate")] fn set_tls_certificate(&self, certificate: &impl IsA) { unsafe { ffi::soup_server_set_tls_certificate( self.as_ref().to_glib_none().0, certificate.as_ref().to_glib_none().0, ); } } #[doc(alias = "soup_server_set_tls_database")] #[doc(alias = "tls-database")] fn set_tls_database(&self, tls_database: &impl IsA) { unsafe { ffi::soup_server_set_tls_database( self.as_ref().to_glib_none().0, tls_database.as_ref().to_glib_none().0, ); } } #[cfg_attr(feature = "v3_2", deprecated = "Since 3.2")] #[allow(deprecated)] #[doc(alias = "soup_server_unpause_message")] fn unpause_message(&self, msg: &ServerMessage) { unsafe { ffi::soup_server_unpause_message(self.as_ref().to_glib_none().0, msg.to_glib_none().0); } } #[doc(alias = "raw-paths")] fn is_raw_paths(&self) -> bool { ObjectExt::property(self.as_ref(), "raw-paths") } #[doc(alias = "server-header")] fn server_header(&self) -> Option { ObjectExt::property(self.as_ref(), "server-header") } #[doc(alias = "server-header")] fn set_server_header(&self, server_header: Option<&str>) { ObjectExt::set_property(self.as_ref(), "server-header", server_header) } #[doc(alias = "request-aborted")] fn connect_request_aborted( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn request_aborted_trampoline< P: IsA, F: Fn(&P, &ServerMessage) + 'static, >( this: *mut ffi::SoupServer, message: *mut ffi::SoupServerMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( Server::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(message), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"request-aborted\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( request_aborted_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "request-finished")] fn connect_request_finished( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn request_finished_trampoline< P: IsA, F: Fn(&P, &ServerMessage) + 'static, >( this: *mut ffi::SoupServer, message: *mut ffi::SoupServerMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( Server::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(message), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"request-finished\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( request_finished_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "request-read")] fn connect_request_read( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn request_read_trampoline< P: IsA, F: Fn(&P, &ServerMessage) + 'static, >( this: *mut ffi::SoupServer, message: *mut ffi::SoupServerMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( Server::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(message), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"request-read\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( request_read_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "request-started")] fn connect_request_started( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn request_started_trampoline< P: IsA, F: Fn(&P, &ServerMessage) + 'static, >( this: *mut ffi::SoupServer, message: *mut ffi::SoupServerMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( Server::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(message), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"request-started\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( request_started_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "server-header")] fn connect_server_header_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_server_header_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::SoupServer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Server::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::server-header\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_server_header_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tls-auth-mode")] fn connect_tls_auth_mode_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_tls_auth_mode_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::SoupServer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Server::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tls-auth-mode\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tls_auth_mode_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tls-certificate")] fn connect_tls_certificate_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_tls_certificate_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::SoupServer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Server::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tls-certificate\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tls_certificate_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tls-database")] fn connect_tls_database_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_tls_database_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::SoupServer, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Server::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tls-database\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tls_database_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> ServerExt for O {} soup3-0.7.0/src/auto/server_message.rs000064400000000000000000000475171046102023000160360ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, HTTPVersion, MemoryUse, MessageBody, MessageHeaders}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "SoupServerMessage")] pub struct ServerMessage(Object); match fn { type_ => || ffi::soup_server_message_get_type(), } } impl ServerMessage { #[doc(alias = "soup_server_message_get_http_version")] #[doc(alias = "get_http_version")] pub fn http_version(&self) -> HTTPVersion { unsafe { from_glib(ffi::soup_server_message_get_http_version( self.to_glib_none().0, )) } } #[doc(alias = "soup_server_message_get_local_address")] #[doc(alias = "get_local_address")] pub fn local_address(&self) -> Option { unsafe { from_glib_none(ffi::soup_server_message_get_local_address( self.to_glib_none().0, )) } } #[doc(alias = "soup_server_message_get_method")] #[doc(alias = "get_method")] pub fn method(&self) -> Option { unsafe { from_glib_none(ffi::soup_server_message_get_method(self.to_glib_none().0)) } } #[doc(alias = "soup_server_message_get_reason_phrase")] #[doc(alias = "get_reason_phrase")] pub fn reason_phrase(&self) -> Option { unsafe { from_glib_none(ffi::soup_server_message_get_reason_phrase( self.to_glib_none().0, )) } } #[doc(alias = "soup_server_message_get_remote_address")] #[doc(alias = "get_remote_address")] pub fn remote_address(&self) -> Option { unsafe { from_glib_none(ffi::soup_server_message_get_remote_address( self.to_glib_none().0, )) } } #[doc(alias = "soup_server_message_get_remote_host")] #[doc(alias = "get_remote_host")] pub fn remote_host(&self) -> Option { unsafe { from_glib_none(ffi::soup_server_message_get_remote_host( self.to_glib_none().0, )) } } #[doc(alias = "soup_server_message_get_request_body")] #[doc(alias = "get_request_body")] pub fn request_body(&self) -> Option { unsafe { from_glib_none(ffi::soup_server_message_get_request_body( self.to_glib_none().0, )) } } #[doc(alias = "soup_server_message_get_request_headers")] #[doc(alias = "get_request_headers")] pub fn request_headers(&self) -> Option { unsafe { from_glib_none(ffi::soup_server_message_get_request_headers( self.to_glib_none().0, )) } } #[doc(alias = "soup_server_message_get_response_body")] #[doc(alias = "get_response_body")] pub fn response_body(&self) -> Option { unsafe { from_glib_none(ffi::soup_server_message_get_response_body( self.to_glib_none().0, )) } } #[doc(alias = "soup_server_message_get_response_headers")] #[doc(alias = "get_response_headers")] pub fn response_headers(&self) -> Option { unsafe { from_glib_none(ffi::soup_server_message_get_response_headers( self.to_glib_none().0, )) } } #[doc(alias = "soup_server_message_get_socket")] #[doc(alias = "get_socket")] pub fn socket(&self) -> Option { unsafe { from_glib_none(ffi::soup_server_message_get_socket(self.to_glib_none().0)) } } #[doc(alias = "soup_server_message_get_status")] #[doc(alias = "get_status")] pub fn status(&self) -> u32 { unsafe { ffi::soup_server_message_get_status(self.to_glib_none().0) } } #[cfg(feature = "v3_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v3_2")))] #[doc(alias = "soup_server_message_get_tls_peer_certificate")] #[doc(alias = "get_tls_peer_certificate")] #[doc(alias = "tls-peer-certificate")] pub fn tls_peer_certificate(&self) -> Option { unsafe { from_glib_none(ffi::soup_server_message_get_tls_peer_certificate( self.to_glib_none().0, )) } } #[cfg(feature = "v3_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v3_2")))] #[doc(alias = "soup_server_message_get_tls_peer_certificate_errors")] #[doc(alias = "get_tls_peer_certificate_errors")] #[doc(alias = "tls-peer-certificate-errors")] pub fn tls_peer_certificate_errors(&self) -> gio::TlsCertificateFlags { unsafe { from_glib(ffi::soup_server_message_get_tls_peer_certificate_errors( self.to_glib_none().0, )) } } #[doc(alias = "soup_server_message_get_uri")] #[doc(alias = "get_uri")] pub fn uri(&self) -> Option { unsafe { from_glib_none(ffi::soup_server_message_get_uri(self.to_glib_none().0)) } } #[doc(alias = "soup_server_message_is_options_ping")] pub fn is_options_ping(&self) -> bool { unsafe { from_glib(ffi::soup_server_message_is_options_ping( self.to_glib_none().0, )) } } #[cfg(feature = "v3_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v3_2")))] #[doc(alias = "soup_server_message_pause")] pub fn pause(&self) { unsafe { ffi::soup_server_message_pause(self.to_glib_none().0); } } #[doc(alias = "soup_server_message_set_http_version")] pub fn set_http_version(&self, version: HTTPVersion) { unsafe { ffi::soup_server_message_set_http_version(self.to_glib_none().0, version.into_glib()); } } #[doc(alias = "soup_server_message_set_redirect")] pub fn set_redirect(&self, status_code: u32, redirect_uri: &str) { unsafe { ffi::soup_server_message_set_redirect( self.to_glib_none().0, status_code, redirect_uri.to_glib_none().0, ); } } #[doc(alias = "soup_server_message_set_response")] pub fn set_response(&self, content_type: Option<&str>, resp_use: MemoryUse, resp_body: &[u8]) { let resp_length = resp_body.len() as _; unsafe { ffi::soup_server_message_set_response( self.to_glib_none().0, content_type.to_glib_none().0, resp_use.into_glib(), resp_body.to_glib_none().0, resp_length, ); } } #[doc(alias = "soup_server_message_set_status")] pub fn set_status(&self, status_code: u32, reason_phrase: Option<&str>) { unsafe { ffi::soup_server_message_set_status( self.to_glib_none().0, status_code, reason_phrase.to_glib_none().0, ); } } #[doc(alias = "soup_server_message_steal_connection")] pub fn steal_connection(&self) -> Option { unsafe { from_glib_full(ffi::soup_server_message_steal_connection( self.to_glib_none().0, )) } } #[cfg(feature = "v3_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v3_2")))] #[doc(alias = "soup_server_message_unpause")] pub fn unpause(&self) { unsafe { ffi::soup_server_message_unpause(self.to_glib_none().0); } } #[doc(alias = "accept-certificate")] pub fn connect_accept_certificate< F: Fn(&Self, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + 'static, >( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn accept_certificate_trampoline< F: Fn(&ServerMessage, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + 'static, >( this: *mut ffi::SoupServerMessage, tls_peer_certificate: *mut gio::ffi::GTlsCertificate, tls_peer_errors: gio::ffi::GTlsCertificateFlags, f: glib::ffi::gpointer, ) -> glib::ffi::gboolean { let f: &F = &*(f as *const F); f( &from_glib_borrow(this), &from_glib_borrow(tls_peer_certificate), from_glib(tls_peer_errors), ) .into_glib() } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"accept-certificate\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( accept_certificate_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "connected")] pub fn connect_connected(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn connected_trampoline( this: *mut ffi::SoupServerMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"connected\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( connected_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "disconnected")] pub fn connect_disconnected(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn disconnected_trampoline( this: *mut ffi::SoupServerMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"disconnected\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( disconnected_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "finished")] pub fn connect_finished(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn finished_trampoline( this: *mut ffi::SoupServerMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"finished\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( finished_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "got-body")] pub fn connect_got_body(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn got_body_trampoline( this: *mut ffi::SoupServerMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"got-body\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( got_body_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "got-chunk")] pub fn connect_got_chunk(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn got_chunk_trampoline( this: *mut ffi::SoupServerMessage, chunk: *mut glib::ffi::GBytes, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(chunk)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"got-chunk\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( got_chunk_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "got-headers")] pub fn connect_got_headers(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn got_headers_trampoline( this: *mut ffi::SoupServerMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"got-headers\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( got_headers_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "wrote-body")] pub fn connect_wrote_body(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn wrote_body_trampoline( this: *mut ffi::SoupServerMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"wrote-body\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( wrote_body_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "wrote-body-data")] pub fn connect_wrote_body_data(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn wrote_body_data_trampoline( this: *mut ffi::SoupServerMessage, chunk_size: libc::c_uint, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), chunk_size) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"wrote-body-data\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( wrote_body_data_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "wrote-chunk")] pub fn connect_wrote_chunk(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn wrote_chunk_trampoline( this: *mut ffi::SoupServerMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"wrote-chunk\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( wrote_chunk_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "wrote-headers")] pub fn connect_wrote_headers(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn wrote_headers_trampoline( this: *mut ffi::SoupServerMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"wrote-headers\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( wrote_headers_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "wrote-informational")] pub fn connect_wrote_informational(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn wrote_informational_trampoline( this: *mut ffi::SoupServerMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"wrote-informational\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( wrote_informational_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v3_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v3_2")))] #[doc(alias = "tls-peer-certificate")] pub fn connect_tls_peer_certificate_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_tls_peer_certificate_trampoline< F: Fn(&ServerMessage) + 'static, >( this: *mut ffi::SoupServerMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tls-peer-certificate\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tls_peer_certificate_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v3_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v3_2")))] #[doc(alias = "tls-peer-certificate-errors")] pub fn connect_tls_peer_certificate_errors_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_tls_peer_certificate_errors_trampoline< F: Fn(&ServerMessage) + 'static, >( this: *mut ffi::SoupServerMessage, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tls-peer-certificate-errors\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tls_peer_certificate_errors_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } soup3-0.7.0/src/auto/session.rs000064400000000000000000001112531046102023000144740ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, Message, SessionFeature, WebsocketConnection}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::{boxed::Box as Box_, pin::Pin}; glib::wrapper! { #[doc(alias = "SoupSession")] pub struct Session(Object); match fn { type_ => || ffi::soup_session_get_type(), } } impl Session { pub const NONE: Option<&'static Session> = None; #[doc(alias = "soup_session_new")] pub fn new() -> Session { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_session_new()) } } //#[doc(alias = "soup_session_new_with_options")] //#[doc(alias = "new_with_options")] //pub fn with_options(optname1: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> Session { // unsafe { TODO: call ffi:soup_session_new_with_options() } //} // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`Session`] objects. /// /// This method returns an instance of [`SessionBuilder`](crate::builders::SessionBuilder) which can be used to create [`Session`] objects. pub fn builder() -> SessionBuilder { SessionBuilder::new() } } impl Default for Session { fn default() -> Self { Self::new() } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`Session`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct SessionBuilder { builder: glib::object::ObjectBuilder<'static, Session>, } impl SessionBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn accept_language(self, accept_language: impl Into) -> Self { Self { builder: self .builder .property("accept-language", accept_language.into()), } } pub fn accept_language_auto(self, accept_language_auto: bool) -> Self { Self { builder: self .builder .property("accept-language-auto", accept_language_auto), } } pub fn idle_timeout(self, idle_timeout: u32) -> Self { Self { builder: self.builder.property("idle-timeout", idle_timeout), } } pub fn local_address(self, local_address: &impl IsA) -> Self { Self { builder: self .builder .property("local-address", local_address.clone().upcast()), } } pub fn max_conns(self, max_conns: i32) -> Self { Self { builder: self.builder.property("max-conns", max_conns), } } pub fn max_conns_per_host(self, max_conns_per_host: i32) -> Self { Self { builder: self .builder .property("max-conns-per-host", max_conns_per_host), } } pub fn proxy_resolver(self, proxy_resolver: &impl IsA) -> Self { Self { builder: self .builder .property("proxy-resolver", proxy_resolver.clone().upcast()), } } pub fn remote_connectable(self, remote_connectable: &impl IsA) -> Self { Self { builder: self .builder .property("remote-connectable", remote_connectable.clone().upcast()), } } pub fn timeout(self, timeout: u32) -> Self { Self { builder: self.builder.property("timeout", timeout), } } pub fn tls_database(self, tls_database: &impl IsA) -> Self { Self { builder: self .builder .property("tls-database", tls_database.clone().upcast()), } } pub fn tls_interaction(self, tls_interaction: &impl IsA) -> Self { Self { builder: self .builder .property("tls-interaction", tls_interaction.clone().upcast()), } } pub fn user_agent(self, user_agent: impl Into) -> Self { Self { builder: self.builder.property("user-agent", user_agent.into()), } } // rustdoc-stripper-ignore-next /// Build the [`Session`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Session { self.builder.build() } } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait SessionExt: IsA + sealed::Sealed + 'static { #[doc(alias = "soup_session_abort")] fn abort(&self) { unsafe { ffi::soup_session_abort(self.as_ref().to_glib_none().0); } } #[doc(alias = "soup_session_add_feature")] fn add_feature(&self, feature: &impl IsA) { unsafe { ffi::soup_session_add_feature( self.as_ref().to_glib_none().0, feature.as_ref().to_glib_none().0, ); } } #[doc(alias = "soup_session_add_feature_by_type")] fn add_feature_by_type(&self, feature_type: glib::types::Type) { unsafe { ffi::soup_session_add_feature_by_type( self.as_ref().to_glib_none().0, feature_type.into_glib(), ); } } #[doc(alias = "soup_session_get_accept_language")] #[doc(alias = "get_accept_language")] #[doc(alias = "accept-language")] fn accept_language(&self) -> Option { unsafe { from_glib_none(ffi::soup_session_get_accept_language( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_session_get_accept_language_auto")] #[doc(alias = "get_accept_language_auto")] #[doc(alias = "accept-language-auto")] fn accepts_language_auto(&self) -> bool { unsafe { from_glib(ffi::soup_session_get_accept_language_auto( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_session_get_async_result_message")] #[doc(alias = "get_async_result_message")] fn async_result_message(&self, result: &impl IsA) -> Option { unsafe { from_glib_none(ffi::soup_session_get_async_result_message( self.as_ref().to_glib_none().0, result.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_session_get_feature")] #[doc(alias = "get_feature")] fn feature(&self, feature_type: glib::types::Type) -> Option { unsafe { from_glib_none(ffi::soup_session_get_feature( self.as_ref().to_glib_none().0, feature_type.into_glib(), )) } } #[doc(alias = "soup_session_get_feature_for_message")] #[doc(alias = "get_feature_for_message")] fn feature_for_message( &self, feature_type: glib::types::Type, msg: &Message, ) -> Option { unsafe { from_glib_none(ffi::soup_session_get_feature_for_message( self.as_ref().to_glib_none().0, feature_type.into_glib(), msg.to_glib_none().0, )) } } #[doc(alias = "soup_session_get_idle_timeout")] #[doc(alias = "get_idle_timeout")] #[doc(alias = "idle-timeout")] fn idle_timeout(&self) -> u32 { unsafe { ffi::soup_session_get_idle_timeout(self.as_ref().to_glib_none().0) } } #[doc(alias = "soup_session_get_local_address")] #[doc(alias = "get_local_address")] #[doc(alias = "local-address")] fn local_address(&self) -> Option { unsafe { from_glib_none(ffi::soup_session_get_local_address( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_session_get_max_conns")] #[doc(alias = "get_max_conns")] #[doc(alias = "max-conns")] fn max_conns(&self) -> u32 { unsafe { ffi::soup_session_get_max_conns(self.as_ref().to_glib_none().0) } } #[doc(alias = "soup_session_get_max_conns_per_host")] #[doc(alias = "get_max_conns_per_host")] #[doc(alias = "max-conns-per-host")] fn max_conns_per_host(&self) -> u32 { unsafe { ffi::soup_session_get_max_conns_per_host(self.as_ref().to_glib_none().0) } } #[doc(alias = "soup_session_get_proxy_resolver")] #[doc(alias = "get_proxy_resolver")] #[doc(alias = "proxy-resolver")] fn proxy_resolver(&self) -> Option { unsafe { from_glib_none(ffi::soup_session_get_proxy_resolver( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_session_get_remote_connectable")] #[doc(alias = "get_remote_connectable")] #[doc(alias = "remote-connectable")] fn remote_connectable(&self) -> Option { unsafe { from_glib_none(ffi::soup_session_get_remote_connectable( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_session_get_timeout")] #[doc(alias = "get_timeout")] fn timeout(&self) -> u32 { unsafe { ffi::soup_session_get_timeout(self.as_ref().to_glib_none().0) } } #[doc(alias = "soup_session_get_tls_database")] #[doc(alias = "get_tls_database")] #[doc(alias = "tls-database")] fn tls_database(&self) -> Option { unsafe { from_glib_none(ffi::soup_session_get_tls_database( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_session_get_tls_interaction")] #[doc(alias = "get_tls_interaction")] #[doc(alias = "tls-interaction")] fn tls_interaction(&self) -> Option { unsafe { from_glib_none(ffi::soup_session_get_tls_interaction( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_session_get_user_agent")] #[doc(alias = "get_user_agent")] #[doc(alias = "user-agent")] fn user_agent(&self) -> Option { unsafe { from_glib_none(ffi::soup_session_get_user_agent( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_session_has_feature")] fn has_feature(&self, feature_type: glib::types::Type) -> bool { unsafe { from_glib(ffi::soup_session_has_feature( self.as_ref().to_glib_none().0, feature_type.into_glib(), )) } } #[doc(alias = "soup_session_preconnect_async")] fn preconnect_async) + 'static>( &self, msg: &Message, io_priority: glib::Priority, cancellable: Option<&impl IsA>, callback: P, ) { let main_context = glib::MainContext::ref_thread_default(); let is_main_context_owner = main_context.is_owner(); let has_acquired_main_context = (!is_main_context_owner) .then(|| main_context.acquire().ok()) .flatten(); assert!( is_main_context_owner || has_acquired_main_context.is_some(), "Async operations only allowed if the thread is owning the MainContext" ); let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); unsafe extern "C" fn preconnect_async_trampoline< P: FnOnce(Result<(), glib::Error>) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let mut error = std::ptr::null_mut(); let _ = ffi::soup_session_preconnect_finish(_source_object as *mut _, res, &mut error); let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }; let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); } let callback = preconnect_async_trampoline::

; unsafe { ffi::soup_session_preconnect_async( self.as_ref().to_glib_none().0, msg.to_glib_none().0, io_priority.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } fn preconnect_future( &self, msg: &Message, io_priority: glib::Priority, ) -> Pin> + 'static>> { let msg = msg.clone(); Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { obj.preconnect_async(&msg, io_priority, Some(cancellable), move |res| { send.resolve(res); }); })) } #[doc(alias = "soup_session_remove_feature")] fn remove_feature(&self, feature: &impl IsA) { unsafe { ffi::soup_session_remove_feature( self.as_ref().to_glib_none().0, feature.as_ref().to_glib_none().0, ); } } #[doc(alias = "soup_session_remove_feature_by_type")] fn remove_feature_by_type(&self, feature_type: glib::types::Type) { unsafe { ffi::soup_session_remove_feature_by_type( self.as_ref().to_glib_none().0, feature_type.into_glib(), ); } } #[doc(alias = "soup_session_send")] fn send( &self, msg: &Message, cancellable: Option<&impl IsA>, ) -> Result { unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::soup_session_send( self.as_ref().to_glib_none().0, msg.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "soup_session_send_and_read")] fn send_and_read( &self, msg: &Message, cancellable: Option<&impl IsA>, ) -> Result { unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::soup_session_send_and_read( self.as_ref().to_glib_none().0, msg.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "soup_session_send_and_read_async")] fn send_and_read_async) + 'static>( &self, msg: &Message, io_priority: glib::Priority, cancellable: Option<&impl IsA>, callback: P, ) { let main_context = glib::MainContext::ref_thread_default(); let is_main_context_owner = main_context.is_owner(); let has_acquired_main_context = (!is_main_context_owner) .then(|| main_context.acquire().ok()) .flatten(); assert!( is_main_context_owner || has_acquired_main_context.is_some(), "Async operations only allowed if the thread is owning the MainContext" ); let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); unsafe extern "C" fn send_and_read_async_trampoline< P: FnOnce(Result) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let mut error = std::ptr::null_mut(); let ret = ffi::soup_session_send_and_read_finish(_source_object as *mut _, res, &mut error); let result = if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }; let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); } let callback = send_and_read_async_trampoline::

; unsafe { ffi::soup_session_send_and_read_async( self.as_ref().to_glib_none().0, msg.to_glib_none().0, io_priority.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } fn send_and_read_future( &self, msg: &Message, io_priority: glib::Priority, ) -> Pin> + 'static>> { let msg = msg.clone(); Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { obj.send_and_read_async(&msg, io_priority, Some(cancellable), move |res| { send.resolve(res); }); })) } #[cfg(feature = "v3_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v3_4")))] #[doc(alias = "soup_session_send_and_splice")] fn send_and_splice( &self, msg: &Message, out_stream: &impl IsA, flags: gio::OutputStreamSpliceFlags, cancellable: Option<&impl IsA>, ) -> Result { unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::soup_session_send_and_splice( self.as_ref().to_glib_none().0, msg.to_glib_none().0, out_stream.as_ref().to_glib_none().0, flags.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error, ); if error.is_null() { Ok(ret) } else { Err(from_glib_full(error)) } } } #[cfg(feature = "v3_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v3_4")))] #[doc(alias = "soup_session_send_and_splice_async")] fn send_and_splice_async) + 'static>( &self, msg: &Message, out_stream: &impl IsA, flags: gio::OutputStreamSpliceFlags, io_priority: glib::Priority, cancellable: Option<&impl IsA>, callback: P, ) { let main_context = glib::MainContext::ref_thread_default(); let is_main_context_owner = main_context.is_owner(); let has_acquired_main_context = (!is_main_context_owner) .then(|| main_context.acquire().ok()) .flatten(); assert!( is_main_context_owner || has_acquired_main_context.is_some(), "Async operations only allowed if the thread is owning the MainContext" ); let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); unsafe extern "C" fn send_and_splice_async_trampoline< P: FnOnce(Result) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let mut error = std::ptr::null_mut(); let ret = ffi::soup_session_send_and_splice_finish(_source_object as *mut _, res, &mut error); let result = if error.is_null() { Ok(ret) } else { Err(from_glib_full(error)) }; let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); } let callback = send_and_splice_async_trampoline::

; unsafe { ffi::soup_session_send_and_splice_async( self.as_ref().to_glib_none().0, msg.to_glib_none().0, out_stream.as_ref().to_glib_none().0, flags.into_glib(), io_priority.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } #[cfg(feature = "v3_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v3_4")))] fn send_and_splice_future( &self, msg: &Message, out_stream: &(impl IsA + Clone + 'static), flags: gio::OutputStreamSpliceFlags, io_priority: glib::Priority, ) -> Pin> + 'static>> { let msg = msg.clone(); let out_stream = out_stream.clone(); Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { obj.send_and_splice_async( &msg, &out_stream, flags, io_priority, Some(cancellable), move |res| { send.resolve(res); }, ); })) } #[doc(alias = "soup_session_send_async")] fn send_async) + 'static>( &self, msg: &Message, io_priority: glib::Priority, cancellable: Option<&impl IsA>, callback: P, ) { let main_context = glib::MainContext::ref_thread_default(); let is_main_context_owner = main_context.is_owner(); let has_acquired_main_context = (!is_main_context_owner) .then(|| main_context.acquire().ok()) .flatten(); assert!( is_main_context_owner || has_acquired_main_context.is_some(), "Async operations only allowed if the thread is owning the MainContext" ); let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); unsafe extern "C" fn send_async_trampoline< P: FnOnce(Result) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let mut error = std::ptr::null_mut(); let ret = ffi::soup_session_send_finish(_source_object as *mut _, res, &mut error); let result = if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }; let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); } let callback = send_async_trampoline::

; unsafe { ffi::soup_session_send_async( self.as_ref().to_glib_none().0, msg.to_glib_none().0, io_priority.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } fn send_future( &self, msg: &Message, io_priority: glib::Priority, ) -> Pin> + 'static>> { let msg = msg.clone(); Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { obj.send_async(&msg, io_priority, Some(cancellable), move |res| { send.resolve(res); }); })) } #[doc(alias = "soup_session_set_accept_language")] #[doc(alias = "accept-language")] fn set_accept_language(&self, accept_language: &str) { unsafe { ffi::soup_session_set_accept_language( self.as_ref().to_glib_none().0, accept_language.to_glib_none().0, ); } } #[doc(alias = "soup_session_set_accept_language_auto")] #[doc(alias = "accept-language-auto")] fn set_accept_language_auto(&self, accept_language_auto: bool) { unsafe { ffi::soup_session_set_accept_language_auto( self.as_ref().to_glib_none().0, accept_language_auto.into_glib(), ); } } #[doc(alias = "soup_session_set_idle_timeout")] #[doc(alias = "idle-timeout")] fn set_idle_timeout(&self, timeout: u32) { unsafe { ffi::soup_session_set_idle_timeout(self.as_ref().to_glib_none().0, timeout); } } #[doc(alias = "soup_session_set_proxy_resolver")] #[doc(alias = "proxy-resolver")] fn set_proxy_resolver(&self, proxy_resolver: Option<&impl IsA>) { unsafe { ffi::soup_session_set_proxy_resolver( self.as_ref().to_glib_none().0, proxy_resolver.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "soup_session_set_timeout")] #[doc(alias = "timeout")] fn set_timeout(&self, timeout: u32) { unsafe { ffi::soup_session_set_timeout(self.as_ref().to_glib_none().0, timeout); } } #[doc(alias = "soup_session_set_tls_database")] #[doc(alias = "tls-database")] fn set_tls_database(&self, tls_database: Option<&impl IsA>) { unsafe { ffi::soup_session_set_tls_database( self.as_ref().to_glib_none().0, tls_database.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "soup_session_set_tls_interaction")] #[doc(alias = "tls-interaction")] fn set_tls_interaction(&self, tls_interaction: Option<&impl IsA>) { unsafe { ffi::soup_session_set_tls_interaction( self.as_ref().to_glib_none().0, tls_interaction.map(|p| p.as_ref()).to_glib_none().0, ); } } #[doc(alias = "soup_session_set_user_agent")] #[doc(alias = "user-agent")] fn set_user_agent(&self, user_agent: &str) { unsafe { ffi::soup_session_set_user_agent( self.as_ref().to_glib_none().0, user_agent.to_glib_none().0, ); } } #[doc(alias = "request-queued")] fn connect_request_queued(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn request_queued_trampoline< P: IsA, F: Fn(&P, &Message) + 'static, >( this: *mut ffi::SoupSession, msg: *mut ffi::SoupMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( Session::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(msg), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"request-queued\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( request_queued_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "request-unqueued")] fn connect_request_unqueued(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn request_unqueued_trampoline< P: IsA, F: Fn(&P, &Message) + 'static, >( this: *mut ffi::SoupSession, msg: *mut ffi::SoupMessage, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f( Session::from_glib_borrow(this).unsafe_cast_ref(), &from_glib_borrow(msg), ) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"request-unqueued\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( request_unqueued_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "accept-language")] fn connect_accept_language_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_accept_language_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::SoupSession, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Session::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::accept-language\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_accept_language_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "accept-language-auto")] fn connect_accept_language_auto_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_accept_language_auto_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::SoupSession, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Session::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::accept-language-auto\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_accept_language_auto_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "idle-timeout")] fn connect_idle_timeout_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_idle_timeout_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::SoupSession, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Session::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::idle-timeout\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_idle_timeout_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "proxy-resolver")] fn connect_proxy_resolver_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_proxy_resolver_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::SoupSession, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Session::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::proxy-resolver\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_proxy_resolver_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "timeout")] fn connect_timeout_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_timeout_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::SoupSession, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Session::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::timeout\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_timeout_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tls-database")] fn connect_tls_database_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_tls_database_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::SoupSession, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Session::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tls-database\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tls_database_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tls-interaction")] fn connect_tls_interaction_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_tls_interaction_trampoline< P: IsA, F: Fn(&P) + 'static, >( this: *mut ffi::SoupSession, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Session::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tls-interaction\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_tls_interaction_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "user-agent")] fn connect_user_agent_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_user_agent_trampoline, F: Fn(&P) + 'static>( this: *mut ffi::SoupSession, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(Session::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::user-agent\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_user_agent_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } impl> SessionExt for O {} soup3-0.7.0/src/auto/session_feature.rs000064400000000000000000000013571046102023000162120ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::ffi; use glib::prelude::*; glib::wrapper! { #[doc(alias = "SoupSessionFeature")] pub struct SessionFeature(Interface); match fn { type_ => || ffi::soup_session_feature_get_type(), } } impl SessionFeature { pub const NONE: Option<&'static SessionFeature> = None; } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait SessionFeatureExt: IsA + sealed::Sealed + 'static {} impl> SessionFeatureExt for O {} soup3-0.7.0/src/auto/versions.txt000064400000000000000000000002121046102023000150440ustar 00000000000000Generated by gir (https://github.com/gtk-rs/gir @ d7c0763cacbc) from from gir-files (https://github.com/gtk-rs/gir-files @ 4d1189172a70) soup3-0.7.0/src/auto/websocket_connection.rs000064400000000000000000000423521046102023000172210ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, WebsocketConnectionType, WebsocketExtension, WebsocketState}; use glib::{ prelude::*, signal::{connect_raw, SignalHandlerId}, translate::*, }; use std::boxed::Box as Box_; glib::wrapper! { #[doc(alias = "SoupWebsocketConnection")] pub struct WebsocketConnection(Object); match fn { type_ => || ffi::soup_websocket_connection_get_type(), } } impl WebsocketConnection { // rustdoc-stripper-ignore-next /// Creates a new builder-pattern struct instance to construct [`WebsocketConnection`] objects. /// /// This method returns an instance of [`WebsocketConnectionBuilder`](crate::builders::WebsocketConnectionBuilder) which can be used to create [`WebsocketConnection`] objects. pub fn builder() -> WebsocketConnectionBuilder { WebsocketConnectionBuilder::new() } #[doc(alias = "soup_websocket_connection_close")] pub fn close(&self, code: libc::c_ushort, data: Option<&str>) { unsafe { ffi::soup_websocket_connection_close( self.to_glib_none().0, code, data.to_glib_none().0, ); } } #[doc(alias = "soup_websocket_connection_get_close_code")] #[doc(alias = "get_close_code")] pub fn close_code(&self) -> libc::c_ushort { unsafe { ffi::soup_websocket_connection_get_close_code(self.to_glib_none().0) } } #[doc(alias = "soup_websocket_connection_get_close_data")] #[doc(alias = "get_close_data")] pub fn close_data(&self) -> Option { unsafe { from_glib_none(ffi::soup_websocket_connection_get_close_data( self.to_glib_none().0, )) } } #[doc(alias = "soup_websocket_connection_get_connection_type")] #[doc(alias = "get_connection_type")] #[doc(alias = "connection-type")] pub fn connection_type(&self) -> WebsocketConnectionType { unsafe { from_glib(ffi::soup_websocket_connection_get_connection_type( self.to_glib_none().0, )) } } #[doc(alias = "soup_websocket_connection_get_extensions")] #[doc(alias = "get_extensions")] pub fn extensions(&self) -> Vec { unsafe { FromGlibPtrContainer::from_glib_none(ffi::soup_websocket_connection_get_extensions( self.to_glib_none().0, )) } } #[doc(alias = "soup_websocket_connection_get_io_stream")] #[doc(alias = "get_io_stream")] #[doc(alias = "io-stream")] pub fn io_stream(&self) -> Option { unsafe { from_glib_none(ffi::soup_websocket_connection_get_io_stream( self.to_glib_none().0, )) } } #[doc(alias = "soup_websocket_connection_get_keepalive_interval")] #[doc(alias = "get_keepalive_interval")] #[doc(alias = "keepalive-interval")] pub fn keepalive_interval(&self) -> u32 { unsafe { ffi::soup_websocket_connection_get_keepalive_interval(self.to_glib_none().0) } } #[cfg(feature = "v3_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v3_6")))] #[doc(alias = "soup_websocket_connection_get_keepalive_pong_timeout")] #[doc(alias = "get_keepalive_pong_timeout")] #[doc(alias = "keepalive-pong-timeout")] pub fn keepalive_pong_timeout(&self) -> u32 { unsafe { ffi::soup_websocket_connection_get_keepalive_pong_timeout(self.to_glib_none().0) } } #[doc(alias = "soup_websocket_connection_get_max_incoming_payload_size")] #[doc(alias = "get_max_incoming_payload_size")] #[doc(alias = "max-incoming-payload-size")] pub fn max_incoming_payload_size(&self) -> u64 { unsafe { ffi::soup_websocket_connection_get_max_incoming_payload_size(self.to_glib_none().0) } } #[doc(alias = "soup_websocket_connection_get_origin")] #[doc(alias = "get_origin")] pub fn origin(&self) -> Option { unsafe { from_glib_none(ffi::soup_websocket_connection_get_origin( self.to_glib_none().0, )) } } #[doc(alias = "soup_websocket_connection_get_protocol")] #[doc(alias = "get_protocol")] pub fn protocol(&self) -> Option { unsafe { from_glib_none(ffi::soup_websocket_connection_get_protocol( self.to_glib_none().0, )) } } #[doc(alias = "soup_websocket_connection_get_state")] #[doc(alias = "get_state")] pub fn state(&self) -> WebsocketState { unsafe { from_glib(ffi::soup_websocket_connection_get_state( self.to_glib_none().0, )) } } #[doc(alias = "soup_websocket_connection_get_uri")] #[doc(alias = "get_uri")] pub fn uri(&self) -> Option { unsafe { from_glib_none(ffi::soup_websocket_connection_get_uri( self.to_glib_none().0, )) } } #[doc(alias = "soup_websocket_connection_send_text")] pub fn send_text(&self, text: &str) { unsafe { ffi::soup_websocket_connection_send_text(self.to_glib_none().0, text.to_glib_none().0); } } #[doc(alias = "soup_websocket_connection_set_keepalive_interval")] #[doc(alias = "keepalive-interval")] pub fn set_keepalive_interval(&self, interval: u32) { unsafe { ffi::soup_websocket_connection_set_keepalive_interval(self.to_glib_none().0, interval); } } #[cfg(feature = "v3_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v3_6")))] #[doc(alias = "soup_websocket_connection_set_keepalive_pong_timeout")] #[doc(alias = "keepalive-pong-timeout")] pub fn set_keepalive_pong_timeout(&self, pong_timeout: u32) { unsafe { ffi::soup_websocket_connection_set_keepalive_pong_timeout( self.to_glib_none().0, pong_timeout, ); } } #[doc(alias = "soup_websocket_connection_set_max_incoming_payload_size")] #[doc(alias = "max-incoming-payload-size")] pub fn set_max_incoming_payload_size(&self, max_incoming_payload_size: u64) { unsafe { ffi::soup_websocket_connection_set_max_incoming_payload_size( self.to_glib_none().0, max_incoming_payload_size, ); } } #[doc(alias = "closed")] pub fn connect_closed(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn closed_trampoline( this: *mut ffi::SoupWebsocketConnection, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"closed\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( closed_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "closing")] pub fn connect_closing(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn closing_trampoline( this: *mut ffi::SoupWebsocketConnection, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"closing\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( closing_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "error")] pub fn connect_error(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn error_trampoline< F: Fn(&WebsocketConnection, &glib::Error) + 'static, >( this: *mut ffi::SoupWebsocketConnection, error: *mut glib::ffi::GError, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(error)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"error\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( error_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "message")] pub fn connect_message( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn message_trampoline< F: Fn(&WebsocketConnection, i32, &glib::Bytes) + 'static, >( this: *mut ffi::SoupWebsocketConnection, type_: libc::c_int, message: *mut glib::ffi::GBytes, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), type_, &from_glib_borrow(message)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"message\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( message_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "pong")] pub fn connect_pong(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn pong_trampoline< F: Fn(&WebsocketConnection, &glib::Bytes) + 'static, >( this: *mut ffi::SoupWebsocketConnection, message: *mut glib::ffi::GBytes, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this), &from_glib_borrow(message)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"pong\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( pong_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "keepalive-interval")] pub fn connect_keepalive_interval_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_keepalive_interval_trampoline< F: Fn(&WebsocketConnection) + 'static, >( this: *mut ffi::SoupWebsocketConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::keepalive-interval\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_keepalive_interval_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[cfg(feature = "v3_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v3_6")))] #[doc(alias = "keepalive-pong-timeout")] pub fn connect_keepalive_pong_timeout_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_keepalive_pong_timeout_trampoline< F: Fn(&WebsocketConnection) + 'static, >( this: *mut ffi::SoupWebsocketConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::keepalive-pong-timeout\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_keepalive_pong_timeout_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "max-incoming-payload-size")] pub fn connect_max_incoming_payload_size_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_max_incoming_payload_size_trampoline< F: Fn(&WebsocketConnection) + 'static, >( this: *mut ffi::SoupWebsocketConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::max-incoming-payload-size\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_max_incoming_payload_size_trampoline:: as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "state")] pub fn connect_state_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_state_trampoline( this: *mut ffi::SoupWebsocketConnection, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::state\0".as_ptr() as *const _, Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( notify_state_trampoline:: as *const (), )), Box_::into_raw(f), ) } } } // rustdoc-stripper-ignore-next /// A [builder-pattern] type to construct [`WebsocketConnection`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html #[must_use = "The builder must be built to be used"] pub struct WebsocketConnectionBuilder { builder: glib::object::ObjectBuilder<'static, WebsocketConnection>, } impl WebsocketConnectionBuilder { fn new() -> Self { Self { builder: glib::object::Object::builder(), } } pub fn connection_type(self, connection_type: WebsocketConnectionType) -> Self { Self { builder: self.builder.property("connection-type", connection_type), } } //pub fn extensions(self, extensions: /*Unimplemented*/Basic: Pointer) -> Self { // Self { builder: self.builder.property("extensions", extensions), } //} pub fn io_stream(self, io_stream: &impl IsA) -> Self { Self { builder: self .builder .property("io-stream", io_stream.clone().upcast()), } } pub fn keepalive_interval(self, keepalive_interval: u32) -> Self { Self { builder: self .builder .property("keepalive-interval", keepalive_interval), } } #[cfg(feature = "v3_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v3_6")))] pub fn keepalive_pong_timeout(self, keepalive_pong_timeout: u32) -> Self { Self { builder: self .builder .property("keepalive-pong-timeout", keepalive_pong_timeout), } } pub fn max_incoming_payload_size(self, max_incoming_payload_size: u64) -> Self { Self { builder: self .builder .property("max-incoming-payload-size", max_incoming_payload_size), } } pub fn origin(self, origin: impl Into) -> Self { Self { builder: self.builder.property("origin", origin.into()), } } pub fn protocol(self, protocol: impl Into) -> Self { Self { builder: self.builder.property("protocol", protocol.into()), } } pub fn uri(self, uri: &glib::Uri) -> Self { Self { builder: self.builder.property("uri", uri.clone()), } } // rustdoc-stripper-ignore-next /// Build the [`WebsocketConnection`]. #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> WebsocketConnection { self.builder.build() } } soup3-0.7.0/src/auto/websocket_extension.rs000064400000000000000000000062161046102023000170750ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::ffi; use glib::{prelude::*, translate::*}; glib::wrapper! { #[doc(alias = "SoupWebsocketExtension")] pub struct WebsocketExtension(Object); match fn { type_ => || ffi::soup_websocket_extension_get_type(), } } impl WebsocketExtension { pub const NONE: Option<&'static WebsocketExtension> = None; } mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait WebsocketExtensionExt: IsA + sealed::Sealed + 'static { //#[doc(alias = "soup_websocket_extension_configure")] //fn configure(&self, connection_type: WebsocketConnectionType, params: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:soup_websocket_extension_configure() } //} #[doc(alias = "soup_websocket_extension_get_request_params")] #[doc(alias = "get_request_params")] fn request_params(&self) -> Option { unsafe { from_glib_full(ffi::soup_websocket_extension_get_request_params( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_websocket_extension_get_response_params")] #[doc(alias = "get_response_params")] fn response_params(&self) -> Option { unsafe { from_glib_full(ffi::soup_websocket_extension_get_response_params( self.as_ref().to_glib_none().0, )) } } #[doc(alias = "soup_websocket_extension_process_incoming_message")] fn process_incoming_message( &self, header: &mut u8, payload: glib::Bytes, ) -> Result { unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::soup_websocket_extension_process_incoming_message( self.as_ref().to_glib_none().0, header, payload.into_glib_ptr(), &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "soup_websocket_extension_process_outgoing_message")] fn process_outgoing_message( &self, header: &mut u8, payload: glib::Bytes, ) -> Result { unsafe { let mut error = std::ptr::null_mut(); let ret = ffi::soup_websocket_extension_process_outgoing_message( self.as_ref().to_glib_none().0, header, payload.into_glib_ptr(), &mut error, ); if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } } impl> WebsocketExtensionExt for O {} soup3-0.7.0/src/auto/websocket_extension_deflate.rs000064400000000000000000000010321046102023000205500ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, WebsocketExtension}; glib::wrapper! { #[doc(alias = "SoupWebsocketExtensionDeflate")] pub struct WebsocketExtensionDeflate(Object) @extends WebsocketExtension; match fn { type_ => || ffi::soup_websocket_extension_deflate_get_type(), } } impl WebsocketExtensionDeflate {} soup3-0.7.0/src/auto/websocket_extension_manager.rs000064400000000000000000000010251046102023000205600ustar 00000000000000// This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::{ffi, SessionFeature}; glib::wrapper! { #[doc(alias = "SoupWebsocketExtensionManager")] pub struct WebsocketExtensionManager(Object) @implements SessionFeature; match fn { type_ => || ffi::soup_websocket_extension_manager_get_type(), } } impl WebsocketExtensionManager {} soup3-0.7.0/src/cookie_jar.rs000064400000000000000000000033661046102023000141530ustar 00000000000000use crate::{prelude::*, Cookie, CookieJar}; use glib::translate::*; mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait CookieJarExtManual: IsA + sealed::Sealed + 'static { #[doc(alias = "soup_cookie_jar_add_cookie")] fn add_cookie(&self, cookie: &mut Cookie) { unsafe { ffi::soup_cookie_jar_add_cookie( self.as_ref().to_glib_none().0, mut_override(cookie.to_glib_full()), ); } } #[doc(alias = "soup_cookie_jar_add_cookie_full")] fn add_cookie_full( &self, cookie: &mut Cookie, uri: Option<&glib::Uri>, first_party: Option<&glib::Uri>, ) { unsafe { ffi::soup_cookie_jar_add_cookie_full( self.as_ref().to_glib_none().0, mut_override(cookie.to_glib_full()), uri.to_glib_none().0, first_party.to_glib_none().0, ); } } #[doc(alias = "soup_cookie_jar_add_cookie_with_first_party")] fn add_cookie_with_first_party(&self, first_party: &glib::Uri, cookie: &mut Cookie) { unsafe { ffi::soup_cookie_jar_add_cookie_with_first_party( self.as_ref().to_glib_none().0, first_party.to_glib_none().0, mut_override(cookie.to_glib_full()), ); } } #[doc(alias = "soup_cookie_jar_delete_cookie")] fn delete_cookie(&self, cookie: &mut Cookie) { unsafe { ffi::soup_cookie_jar_delete_cookie( self.as_ref().to_glib_none().0, cookie.to_glib_none_mut().0, ); } } } impl> CookieJarExtManual for O {} soup3-0.7.0/src/functions.rs000064400000000000000000000044621046102023000140540ustar 00000000000000use glib::translate::*; #[doc(alias = "soup_header_g_string_append_param")] pub fn header_g_string_append_param(header: &mut String, name: &str, value: &str) { unsafe { let hdr = glib::ffi::g_string_new_len(header.as_ptr() as *const _, header.len() as isize); ffi::soup_header_g_string_append_param(hdr, name.to_glib_none().0, value.to_glib_none().0); let s: glib::GString = from_glib_full(glib::ffi::g_string_free(hdr, glib::ffi::GFALSE)); header.clone_from(&s.as_str().to_owned()) } } #[doc(alias = "soup_header_g_string_append_param_quoted")] pub fn header_g_string_append_param_quoted(header: &mut String, name: &str, value: &str) { unsafe { let hdr = glib::ffi::g_string_new_len(header.as_ptr() as *const _, header.len() as isize); ffi::soup_header_g_string_append_param_quoted( hdr, name.to_glib_none().0, value.to_glib_none().0, ); let s: glib::GString = from_glib_full(glib::ffi::g_string_free(hdr, glib::ffi::GFALSE)); header.clone_from(&s.as_str().to_owned()) } } // #[doc(alias = "soup_cookies_free")] // pub fn cookies_free(cookies: &[&Cookie]) { // assert_initialized_main_thread!(); // unsafe { // let cookie_list: *mut glib::ffi::GSList = ToGlibContainerFromSlice::to_glib_none_from_slice(cookies).0; // ffi::soup_cookies_free(cookie_list); // } // } // #[doc(alias = "soup_cookies_to_cookie_header")] // pub fn cookies_to_cookie_header(cookies: &[Cookie]) -> Option { // assert_initialized_main_thread!(); // unsafe { // let cookie_list: *mut glib::ffi::GSList = ToGlibContainerFromSlice::to_glib_none_from_slice(cookies).0; // from_glib_full(ffi::soup_cookies_to_cookie_header(cookie_list)) // } // } // #[doc(alias = "soup_cookies_to_request")] // pub fn cookies_to_request(cookies: &[&Cookie], msg: &Message) { // skip_assert_initialized!(); // unsafe { // ffi::soup_cookies_to_request(cookies.to_glib_none().0, msg.to_glib_none().0); // } // } // #[doc(alias = "soup_cookies_to_response")] // pub fn cookies_to_response(cookies: &[Cookie], msg: &Message) { // skip_assert_initialized!(); // unsafe { // ffi::soup_cookies_to_response(cookies.to_glib_none().0, msg.to_glib_none().0); // } // } soup3-0.7.0/src/lib.rs000064400000000000000000000011001046102023000125740ustar 00000000000000// // Copyright 2013-2017, The Gtk-rs Project Developers. // // See the COPYRIGHT file at the top-level directory of this distribution. // // Licensed under the MIT license, see the LICENSE file or #![cfg_attr(docsrs, feature(doc_cfg))] pub use ffi; pub use gio; pub use glib; #[macro_use] mod rt; pub mod prelude; #[allow(unused_imports)] mod auto; pub use auto::*; mod functions; pub use auto::functions::*; pub use functions::*; mod cookie_jar; mod logger; mod message_headers; mod server; mod session; mod websocket_connection; soup3-0.7.0/src/logger.rs000064400000000000000000000033641046102023000133230ustar 00000000000000use crate::{prelude::*, Logger, LoggerLogLevel}; use glib::translate::*; use glib::GStr; use std::boxed::Box as Box_; mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait LoggerExtManual: IsA + sealed::Sealed + 'static { #[doc(alias = "soup_logger_set_printer")] fn set_printer( &self, printer: P, ) { let printer_data: Box_

= Box_::new(printer); unsafe extern "C" fn printer_func< P: Fn(&Logger, LoggerLogLevel, char, &GStr) + Send + Sync + 'static, >( logger: *mut ffi::SoupLogger, level: ffi::SoupLoggerLogLevel, direction: libc::c_char, data: *const libc::c_char, user_data: glib::ffi::gpointer, ) { let logger = from_glib_borrow(logger); let direction: glib::Char = from_glib(direction); let data: &GStr = GStr::from_ptr(data); let callback: &P = &*(user_data as *mut _); (*callback)(&logger, from_glib(level), char::from(direction), data); } unsafe extern "C" fn destroy_func< P: Fn(&Logger, LoggerLogLevel, char, &GStr) + Send + Sync + 'static, >( data: glib::ffi::gpointer, ) { let _callback: Box_

= Box_::from_raw(data as *mut _); } unsafe { ffi::soup_logger_set_printer( self.as_ref().to_glib_none().0, Some(printer_func::

as _), Box_::into_raw(printer_data) as *mut _, Some(destroy_func::

as _), ) } } } impl> LoggerExtManual for O {} soup3-0.7.0/src/message_headers.rs000064400000000000000000000052021046102023000151540ustar 00000000000000use glib::translate::*; use glib::{GString, IntoGStr, IntoOptionalGStr}; use std::collections::HashMap; use std::ptr; use crate::MessageHeaders; impl MessageHeaders { #[doc(alias = "soup_message_headers_get_content_disposition")] pub fn content_disposition(&self) -> Option<(GString, HashMap)> { let mut disposition = ptr::null_mut(); let mut params = ptr::null_mut(); unsafe { if bool::from_glib(ffi::soup_message_headers_get_content_disposition( mut_override(self.to_glib_none().0), &mut disposition, &mut params, )) { let params = if !params.is_null() { HashMap::from_glib_full(params) } else { HashMap::new() }; Some((GString::from_glib_full(disposition), params)) } else { None } } } #[doc(alias = "soup_message_headers_set_content_disposition")] pub fn set_content_disposition( &self, disposition: Option, params: Option>, ) { disposition.run_with_gstr(|disposition| unsafe { ffi::soup_message_headers_set_content_disposition( self.to_glib_none().0, disposition.to_glib_none().0, params.to_glib_none().0, ) }) } #[doc(alias = "soup_message_headers_get_content_type")] pub fn content_type(&self) -> Option<(GString, HashMap)> { let mut params = ptr::null_mut(); unsafe { let content_type = ffi::soup_message_headers_get_content_type( mut_override(self.to_glib_none().0), &mut params, ); if !content_type.is_null() { let params = if !params.is_null() { HashMap::from_glib_full(params) } else { HashMap::new() }; Some((GString::from_glib_full(content_type), params)) } else { None } } } #[doc(alias = "soup_message_headers_set_content_type")] pub fn set_content_type( &self, content_type: Option, params: Option>, ) { content_type.run_with_gstr(|content_type| unsafe { ffi::soup_message_headers_set_content_disposition( self.to_glib_none().0, content_type.to_glib_none().0, params.to_glib_none().0, ) }) } } soup3-0.7.0/src/prelude.rs000064400000000000000000000004661046102023000135040ustar 00000000000000#[doc(hidden)] pub use gio::prelude::*; pub use crate::auto::traits::*; pub use crate::cookie_jar::CookieJarExtManual; pub use crate::logger::LoggerExtManual; pub use crate::server::ServerExtManual; pub use crate::session::SessionExtManual; pub use crate::websocket_connection::WebsocketConnectionExtManual; soup3-0.7.0/src/rt.rs000064400000000000000000000003351046102023000124640ustar 00000000000000// Take a look at the license at the top of the repository in the LICENSE file. /// No-op. macro_rules! assert_initialized_main_thread { () => {}; } /// No-op. macro_rules! skip_assert_initialized { () => {}; } soup3-0.7.0/src/server.rs000064400000000000000000000151731046102023000133530ustar 00000000000000use crate::{prelude::*, Server, ServerMessage, WebsocketConnection}; use glib::translate::*; use std::boxed::Box as Box_; use std::collections::HashMap; mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait ServerExtManual: IsA + sealed::Sealed + 'static { #[doc(alias = "soup_server_add_early_handler")] fn add_early_handler) + 'static>( &self, path: Option<&str>, callback: P, ) { let callback_data: Box_

= Box_::new(callback); unsafe extern "C" fn callback_func< P: Fn(&Server, &ServerMessage, &str, HashMap<&str, &str>) + 'static, >( server: *mut ffi::SoupServer, msg: *mut ffi::SoupServerMessage, path: *const libc::c_char, query: *mut glib::ffi::GHashTable, user_data: glib::ffi::gpointer, ) { let server = from_glib_borrow(server); let msg: Borrowed = from_glib_borrow(msg); let path: Borrowed = from_glib_borrow(path); let query_map = query_map_from_hash_table(query); let callback: &P = &*(user_data as *mut _); (*callback)(&server, &msg, path.as_str(), query_map); } let callback = Some(callback_func::

as _); unsafe extern "C" fn destroy_func< P: Fn(&Server, &ServerMessage, &str, HashMap<&str, &str>) + 'static, >( data: glib::ffi::gpointer, ) { let _callback: Box_

= Box_::from_raw(data as *mut _); } let destroy_call6 = Some(destroy_func::

as _); let super_callback0: Box_

= callback_data; unsafe { ffi::soup_server_add_early_handler( self.as_ref().to_glib_none().0, path.to_glib_none().0, callback, Box_::into_raw(super_callback0) as *mut _, destroy_call6, ); } } #[doc(alias = "soup_server_add_handler")] fn add_handler) + 'static>( &self, path: Option<&str>, callback: P, ) { let callback_data: Box_

= Box_::new(callback); unsafe extern "C" fn callback_func< P: Fn(&Server, &ServerMessage, &str, HashMap<&str, &str>) + 'static, >( server: *mut ffi::SoupServer, msg: *mut ffi::SoupServerMessage, path: *const libc::c_char, query: *mut glib::ffi::GHashTable, user_data: glib::ffi::gpointer, ) { let server = from_glib_borrow(server); let msg: Borrowed = from_glib_borrow(msg); let path: Borrowed = from_glib_borrow(path); let query_map = query_map_from_hash_table(query); let callback: &P = &*(user_data as *mut _); (*callback)(&server, &msg, path.as_str(), query_map); } let callback = Some(callback_func::

as _); unsafe extern "C" fn destroy_func< P: Fn(&Server, &ServerMessage, &str, HashMap<&str, &str>) + 'static, >( data: glib::ffi::gpointer, ) { let _callback: Box_

= Box_::from_raw(data as *mut _); } let destroy_call6 = Some(destroy_func::

as _); let super_callback0: Box_

= callback_data; unsafe { ffi::soup_server_add_handler( self.as_ref().to_glib_none().0, path.to_glib_none().0, callback, Box_::into_raw(super_callback0) as *mut _, destroy_call6, ); } } #[doc(alias = "soup_server_add_websocket_handler")] fn add_websocket_handler< P: Fn(&Server, &ServerMessage, &str, &WebsocketConnection) + 'static, >( &self, path: Option<&str>, origin: Option<&str>, protocols: &[&str], callback: P, ) { let callback_data: Box_

= Box_::new(callback); unsafe extern "C" fn callback_func< P: Fn(&Server, &ServerMessage, &str, &WebsocketConnection) + 'static, >( server: *mut ffi::SoupServer, msg: *mut ffi::SoupServerMessage, path: *const libc::c_char, connection: *mut ffi::SoupWebsocketConnection, user_data: glib::ffi::gpointer, ) { let server = from_glib_borrow(server); let msg: Borrowed = from_glib_borrow(msg); let path: Borrowed = from_glib_borrow(path); let connection = from_glib_borrow(connection); let callback: &P = &*(user_data as *mut _); (*callback)(&server, &msg, path.as_str(), &connection); } let callback = Some(callback_func::

as _); unsafe extern "C" fn destroy_func< P: Fn(&Server, &ServerMessage, &str, &WebsocketConnection) + 'static, >( data: glib::ffi::gpointer, ) { let _callback: Box_

= Box_::from_raw(data as *mut _); } let destroy_call6 = Some(destroy_func::

as _); let super_callback0: Box_

= callback_data; unsafe { ffi::soup_server_add_websocket_handler( self.as_ref().to_glib_none().0, path.to_glib_none().0, origin.to_glib_none().0, protocols.to_glib_none().0, callback, Box_::into_raw(super_callback0) as *mut _, destroy_call6, ); } } } impl> ServerExtManual for O {} unsafe fn query_map_from_hash_table<'a>( query: *mut glib::ffi::GHashTable, ) -> HashMap<&'a str, &'a str> { unsafe extern "C" fn read_query_hash_table( key: glib::ffi::gpointer, value: glib::ffi::gpointer, hash_map: glib::ffi::gpointer, ) { let key = glib::GStr::from_ptr_checked(key as *const libc::c_char); let value = glib::GStr::from_ptr_checked(value as *const libc::c_char); let hash_map: &mut HashMap<&str, &str> = &mut *(hash_map as *mut HashMap<&str, &str>); if let (Some(k), Some(v)) = (key, value) { hash_map.insert(k.as_str(), v.as_str()); } } unsafe { let mut query_map = HashMap::with_capacity(glib::ffi::g_hash_table_size(query) as usize); glib::ffi::g_hash_table_foreach( query, Some(read_query_hash_table), &mut query_map as *mut HashMap<&str, &str> as *mut _, ); query_map } } soup3-0.7.0/src/session.rs000064400000000000000000000073241046102023000135270ustar 00000000000000use crate::{prelude::*, Message, Session, WebsocketConnection}; use glib::translate::*; use std::boxed::Box as Box_; use std::pin::Pin; use std::ptr; mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait SessionExtManual: IsA + sealed::Sealed + 'static { #[doc(alias = "soup_session_websocket_connect_async")] fn websocket_connect_async) + 'static>( &self, msg: &Message, origin: Option<&str>, protocols: &[&str], io_priority: glib::Priority, cancellable: Option<&impl IsA>, callback: P, ) { let main_context = glib::MainContext::ref_thread_default(); let is_main_context_owner = main_context.is_owner(); let has_acquired_main_context = (!is_main_context_owner) .then(|| main_context.acquire().ok()) .flatten(); assert!( is_main_context_owner || has_acquired_main_context.is_some(), "Async operations only allowed if the thread is owning the MainContext" ); let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); unsafe extern "C" fn websocket_connect_async_trampoline< P: FnOnce(Result) + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer, ) { let mut error = ptr::null_mut(); let ret = ffi::soup_session_websocket_connect_finish( _source_object as *mut _, res, &mut error, ); let result = if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }; let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback = callback.into_inner(); callback(result); } let callback = websocket_connect_async_trampoline::

; unsafe { ffi::soup_session_websocket_connect_async( self.as_ref().to_glib_none().0, msg.to_glib_none().0, origin.to_glib_none().0, protocols.to_glib_none().0, io_priority.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _, ); } } fn websocket_connect_async_future( &self, msg: &Message, origin: Option<&str>, protocols: &[&str], io_priority: glib::Priority, ) -> Pin< Box_> + 'static>, > { let msg = msg.clone(); let origin = origin.map(ToOwned::to_owned); let protocols = protocols .iter() .copied() .map(String::from) .collect::>(); Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { let protocols = protocols.iter().map(|s| s.as_str()).collect::>(); obj.websocket_connect_async( &msg, origin.as_ref().map(::std::borrow::Borrow::borrow), &protocols, io_priority, Some(cancellable), move |res| { send.resolve(res); }, ); })) } } impl> SessionExtManual for O {} soup3-0.7.0/src/websocket_connection.rs000064400000000000000000000021241046102023000162420ustar 00000000000000use crate::{prelude::*, WebsocketConnection, WebsocketConnectionType, WebsocketExtension}; use glib::translate::*; mod sealed { pub trait Sealed {} impl> Sealed for T {} } pub trait WebsocketConnectionExtManual: IsA + sealed::Sealed + 'static { #[doc(alias = "soup_websocket_connection_new")] fn new( stream: &impl IsA, uri: &glib::Uri, type_: WebsocketConnectionType, origin: Option<&str>, protocol: Option<&str>, extensions: &[WebsocketExtension], ) -> WebsocketConnection { assert_initialized_main_thread!(); unsafe { from_glib_full(ffi::soup_websocket_connection_new( stream.as_ref().to_glib_none().0, uri.to_glib_none().0, type_.into_glib(), origin.to_glib_none().0, protocol.to_glib_none().0, extensions.to_glib_full(), )) } } } impl> WebsocketConnectionExtManual for O {}