text
stringlengths
8
4.13M
// Copyright 2020 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { crate::blob::{Blob, BlobDataFactory, Compressibility, CreationError}, crate::io::Directory, crate::utils::BLOCK_SIZE, log::{debug, error}, rand::{rngs::SmallRng, seq::SliceRandom, Rng, SeedableRng}, }; #[derive(Debug)] enum BlobfsOperation { CreateReasonableBlobs, DeleteSomeBlobs, FillDiskWithSmallBlobs, DeleteAllBlobs, NewHandle, CloseAllHandles, VerifyBlobs, } impl BlobfsOperation { fn random(rng: &mut SmallRng) -> BlobfsOperation { match rng.gen_range(0, 7) { 0 => BlobfsOperation::CreateReasonableBlobs, 1 => BlobfsOperation::DeleteSomeBlobs, 2 => BlobfsOperation::FillDiskWithSmallBlobs, 3 => BlobfsOperation::DeleteAllBlobs, 4 => BlobfsOperation::NewHandle, 5 => BlobfsOperation::CloseAllHandles, _ => BlobfsOperation::VerifyBlobs, } } } // In-memory state of blobfs. Stores information about blobs expected to exist on disk. pub struct BlobfsState { // The path to the blobfs root root_dir: Directory, // In-memory representations of all blobs as they exist on disk blobs: Vec<Blob>, // Random number generator used for selecting operations and blobs rng: SmallRng, // Factory for creating blob data that meets certain specifications factory: BlobDataFactory, } impl BlobfsState { pub fn new(root_dir: Directory, mut initial_rng: SmallRng) -> BlobfsState { // Setup the RNGs let factory_rng = SmallRng::from_seed(initial_rng.gen()); let state_rng = SmallRng::from_seed(initial_rng.gen()); let factory = BlobDataFactory::new(factory_rng); BlobfsState { root_dir, blobs: vec![], rng: state_rng, factory } } // Deletes blob at [index] from the filesystem and from the list of known blobs. async fn delete_blob(&mut self, index: usize) -> Blob { let blob = self.blobs.remove(index); self.root_dir.remove(blob.merkle_root_hash()).await; blob } fn hashes(&self) -> Vec<String> { self.blobs.iter().map(|b| b.merkle_root_hash().to_string()).collect() } // Reads in all blobs stored on the filesystem and compares them to our in-memory // model to ensure that everything is as expected. async fn verify_blobs(&self) { let on_disk_hashes = self.root_dir.entries().await.sort_unstable(); let in_memory_hashes = self.hashes().sort_unstable(); assert_eq!(on_disk_hashes, in_memory_hashes); for blob in &self.blobs { blob.verify_from_disk(&self.root_dir).await; } } // Creates reasonable-sized blobs to fill a percentage of the free space // available on disk. async fn create_reasonable_blobs(&mut self) { let num_blobs_to_create: u64 = self.rng.gen_range(1, 200); debug!("Creating {} blobs...", num_blobs_to_create); // Start filling the space with blobs for _ in 0..num_blobs_to_create { // Create a blob whose uncompressed size is reasonable, or exactly the requested size // if the requested size is too small. let data = self.factory.create_with_reasonable_size(Compressibility::Compressible); let result = Blob::create(data, &self.root_dir).await; match result { Ok(blob) => { // Another blob was created self.blobs.push(blob); } Err(CreationError::OutOfSpace) => { error!("Ran out of space creating blob"); break; } } } } // Deletes a random number of blobs from the disk async fn delete_some_blobs(&mut self) { // Do nothing if there are no blobs. if self.num_blobs() == 0 { return; } // Decide how many blobs to delete let num_blobs_to_delete = self.rng.gen_range(0, self.num_blobs()); debug!("Deleting {} blobs", num_blobs_to_delete); // Randomly select blobs from the list and remove them for _ in 0..num_blobs_to_delete { let index = self.rng.gen_range(0, self.num_blobs()); self.delete_blob(index).await; } } // Selects a random blob and creates an open handle for it. async fn new_handle(&mut self) { if self.num_blobs() == 0 { return; } // Choose a random blob and open a handle to it let blob = self.blobs.choose_mut(&mut self.rng).unwrap(); let handle = self.root_dir.open(blob.merkle_root_hash()).await; blob.handles().push(handle); debug!("Opened blob {} [handles:{}]", blob.merkle_root_hash(), blob.num_handles()); } // Closes all open handles to all blobs. // Note that handles do not call `close()` when they are dropped. // This is intentional because it offers a way to inelegantly close a file. async fn close_all_handles(&mut self) { let mut count = 0; for blob in &mut self.blobs { for handle in blob.handles().drain(..) { handle.close().await; count += 1; } } debug!("Closed {} handles to blobs", count); } // Fills the disk with blobs that are |BLOCK_SIZE| bytes in size (when uncompressed) // until the filesystem reports an error. async fn fill_disk_with_small_blobs(&mut self) { let mut blob_count = 0; loop { // Keep making |BLOCK_SIZE| uncompressible blobs let data = self .factory .create_with_exact_uncompressed_size(BLOCK_SIZE, Compressibility::Uncompressible); let result = Blob::create(data, &self.root_dir).await; match result { Ok(blob) => { // Another blob was created self.blobs.push(blob); blob_count += 1; } Err(CreationError::OutOfSpace) => { error!("Ran out of space creating blob"); break; } } } debug!("Created {} blobs", blob_count); } // Removes all blobs from the filesystem async fn delete_all_blobs(&mut self) { while self.num_blobs() > 0 { self.delete_blob(0).await; } } pub async fn do_random_operation(&mut self) { let operation = BlobfsOperation::random(&mut self.rng); debug!("-------> [OPERATION] {:?}", operation); debug!("Number of blobs = {}", self.num_blobs()); match operation { BlobfsOperation::CreateReasonableBlobs => { self.create_reasonable_blobs().await; } BlobfsOperation::DeleteSomeBlobs => { self.delete_some_blobs().await; } BlobfsOperation::FillDiskWithSmallBlobs => { self.fill_disk_with_small_blobs().await; } BlobfsOperation::DeleteAllBlobs => { self.delete_all_blobs().await; } BlobfsOperation::NewHandle => { self.new_handle().await; } BlobfsOperation::CloseAllHandles => { self.close_all_handles().await; } BlobfsOperation::VerifyBlobs => { self.verify_blobs().await; } } debug!("<------- [OPERATION] {:?}", operation); } fn num_blobs(&self) -> usize { self.blobs.len() } }
use libm::{fabs, modf}; use crate::{scales, utils::f64_eq, BaseUnit, FormatSizeOptions, Kilo, ToF64, Unsigned}; pub struct ISizeFormatter<T: ToF64, O: AsRef<FormatSizeOptions>> { value: T, options: O, } impl<V: ToF64, O: AsRef<FormatSizeOptions>> ISizeFormatter<V, O> { pub fn new(value: V, options: O) -> Self { ISizeFormatter { value, options } } } impl<T: ToF64, O: AsRef<FormatSizeOptions>> core::fmt::Display for ISizeFormatter<T, O> { fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { let opts = self.options.as_ref(); let divider = opts.kilo.value(); let mut size: f64 = self.value.to_f64(); let mut scale_idx = 0; if let Some(val) = opts.fixed_at { while scale_idx != val as usize { size /= divider; scale_idx += 1; } } else { while fabs(size) >= divider { size /= divider; scale_idx += 1; } } let mut scale = match (opts.units, opts.long_units, opts.base_unit) { (Kilo::Decimal, false, BaseUnit::Byte) => scales::SCALE_DECIMAL[scale_idx], (Kilo::Decimal, true, BaseUnit::Byte) => scales::SCALE_DECIMAL_LONG[scale_idx], (Kilo::Binary, false, BaseUnit::Byte) => scales::SCALE_BINARY[scale_idx], (Kilo::Binary, true, BaseUnit::Byte) => scales::SCALE_BINARY_LONG[scale_idx], (Kilo::Decimal, false, BaseUnit::Bit) => scales::SCALE_DECIMAL_BIT[scale_idx], (Kilo::Decimal, true, BaseUnit::Bit) => scales::SCALE_DECIMAL_BIT_LONG[scale_idx], (Kilo::Binary, false, BaseUnit::Bit) => scales::SCALE_BINARY_BIT[scale_idx], (Kilo::Binary, true, BaseUnit::Bit) => scales::SCALE_BINARY_BIT_LONG[scale_idx], }; // Remove "s" from the scale if the size is 1.x let (fpart, ipart) = modf(size); if f64_eq(ipart, 1.0) && (opts.long_units || (opts.base_unit == BaseUnit::Bit && scale_idx == 0)) { scale = &scale[0..scale.len() - 1]; } let places = if f64_eq(fpart, 0.0) { opts.decimal_zeroes } else { opts.decimal_places }; let space = if opts.space_after_value { " " } else { "" }; write!(f, "{:.*}{}{}{}", places, size, space, scale, opts.suffix) } } impl<'a, U: ToF64 + Unsigned + Copy, O: AsRef<FormatSizeOptions>> From<&'a SizeFormatter<U, O>> for ISizeFormatter<U, &'a O> { fn from(source: &'a SizeFormatter<U, O>) -> Self { ISizeFormatter { value: source.value, options: &source.options, } } } pub struct SizeFormatter<T: ToF64 + Unsigned, O: AsRef<FormatSizeOptions>> { value: T, options: O, } impl<V: ToF64 + Unsigned, O: AsRef<FormatSizeOptions>> SizeFormatter<V, O> { pub fn new(value: V, options: O) -> Self { SizeFormatter { value, options } } } impl<T: ToF64 + Unsigned + Copy, O: AsRef<FormatSizeOptions> + Copy> core::fmt::Display for SizeFormatter<T, O> { fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!(f, "{}", ISizeFormatter::from(self)) } }
//! Some common code used by both the event and reply modules. use std::collections::HashMap; use serde_json as json; use reply; /// Recursively build the tree of containers from the given json value. pub fn build_tree(val: &json::Value) -> reply::Node { reply::Node { nodes: match val.find("nodes") { Some(nds) => nds.as_array() .unwrap() .iter() .map(|n| build_tree(n)) .collect::<Vec<_>>(), None => vec![] }, id: val.find("id").unwrap().as_i64().unwrap(), name: match val.find("name") { Some(n) => match n.as_string() { Some(s) => Some(s.to_owned()), None => None }, None => None }, nodetype: match val.find("type").unwrap().as_string().unwrap().as_ref() { "root" => reply::NodeType::Root, "output" => reply::NodeType::Output, "con" => reply::NodeType::Con, "floating_con" => reply::NodeType::FloatingCon, "workspace" => reply::NodeType::Workspace, "dockarea" => reply::NodeType::DockArea, other => { warn!(target: "i3ipc", "Unknown NodeType {}", other); reply::NodeType::Unknown } }, border: match val.find("border").unwrap().as_string().unwrap().as_ref() { "normal" => reply::NodeBorder::Normal, "none" => reply::NodeBorder::None, "pixel" => reply::NodeBorder::Pixel, other => { warn!(target: "i3ipc", "Unknown NodeBorder {}", other); reply::NodeBorder::Unknown } }, current_border_width: val.find("current_border_width").unwrap().as_i64().unwrap() as i32, layout: match val.find("layout").unwrap().as_string().unwrap().as_ref() { "splith" => reply::NodeLayout::SplitH, "splitv" => reply::NodeLayout::SplitV, "stacked" => reply::NodeLayout::Stacked, "tabbed" => reply::NodeLayout::Tabbed, "dockarea" => reply::NodeLayout::DockArea, "output" => reply::NodeLayout::Output, other => { warn!(target: "i3ipc", "Unknown NodeLayout {}", other); reply::NodeLayout::Unknown } }, percent: match *val.find("percent").unwrap() { json::Value::F64(f) => Some(f), json::Value::Null => None, _ => unreachable!() }, rect: build_rect(val.find("rect").unwrap()), window_rect: build_rect(val.find("window_rect").unwrap()), deco_rect: build_rect(val.find("deco_rect").unwrap()), geometry: build_rect(val.find("geometry").unwrap()), window: match val.find("window").unwrap().clone() { json::Value::I64(i) => Some(i as i32), json::Value::U64(u) => Some(u as i32), json::Value::Null => None, _ => unreachable!() }, urgent: val.find("urgent").unwrap().as_boolean().unwrap(), focused: val.find("focused").unwrap().as_boolean().unwrap() } } pub fn build_rect(jrect: &json::Value) -> (i32, i32, i32, i32) { let x = jrect.find("x").unwrap().as_i64().unwrap() as i32; let y = jrect.find("y").unwrap().as_i64().unwrap() as i32; let width = jrect.find("width").unwrap().as_i64().unwrap() as i32; let height = jrect.find("height").unwrap().as_i64().unwrap() as i32; (x, y, width, height) } pub fn build_bar_config(j: &json::Value) -> reply::BarConfig { reply::BarConfig { id: j.find("id").unwrap().as_string().unwrap().to_owned(), mode: j.find("mode").unwrap().as_string().unwrap().to_owned(), position: j.find("position").unwrap().as_string().unwrap().to_owned(), status_command: j.find("status_command").unwrap().as_string().unwrap().to_owned(), font: j.find("font").unwrap().as_string().unwrap().to_owned(), workspace_buttons: j.find("workspace_buttons").unwrap().as_boolean().unwrap(), binding_mode_indicator: j.find("binding_mode_indicator").unwrap().as_boolean().unwrap(), verbose: j.find("verbose").unwrap().as_boolean().unwrap(), colors: { let colors = j.find("colors").unwrap().as_object().unwrap(); let mut map = HashMap::new(); for c in colors.keys() { let enum_key = match c.as_ref() { "background" => reply::ColorableBarPart::Background, "statusline" => reply::ColorableBarPart::Statusline, "separator" => reply::ColorableBarPart::Separator, "focused_workspace_text" => reply::ColorableBarPart::FocusedWorkspaceText, "focused_workspace_bg" => reply::ColorableBarPart::FocusedWorkspaceBg, "focused_workspace_border" => reply::ColorableBarPart::FocusedWorkspaceBorder, "active_workspace_text" => reply::ColorableBarPart::ActiveWorkspaceText, "active_workspace_bg" => reply::ColorableBarPart::ActiveWorkspaceBg, "active_workspace_border" => reply::ColorableBarPart::ActiveWorkspaceBorder, "inactive_workspace_text" => reply::ColorableBarPart::InactiveWorkspaceText, "inactive_workspace_bg" => reply::ColorableBarPart::InactiveWorkspaceBg, "inactive_workspace_border" => reply::ColorableBarPart::InactiveWorkspaceBorder, "urgent_workspace_text" => reply::ColorableBarPart::UrgentWorkspaceText, "urgent_workspace_bg" => reply::ColorableBarPart::UrgentWorkspaceBg, "urgent_workspace_border" => reply::ColorableBarPart::UrgentWorkspaceBorder, "binding_mode_text" => reply::ColorableBarPart::BindingModeText, "binding_mode_bg" => reply::ColorableBarPart::BindingModeBg, "binding_mode_border" => reply::ColorableBarPart::BindingModeBorder, other => { warn!(target: "i3ipc", "Unknown ColorableBarPart {}", other); reply::ColorableBarPart::Unknown } }; let hex = colors.get(c).unwrap().as_string().unwrap().to_owned(); map.insert(enum_key, hex); } map } } }
//! This crate helps with cache directories creation in a system-agnostic way. //! //! The [`CacheDirConfig`] type helps define the desired location(s) where attempts to create //! the cache directory should be made and also helps with the creation itself. //! //! The [`CacheDir`] type holds the path to the created cache directory, obtained with the help of //! [`CacheDirConfig`], if it succeeded to create the directory. //! //! [`CacheDir`] derefs to [`PathBuf`] and implements most of the same traits that [`PathBuf`] does. //! //! Code examples: //! //! - [`Creating an application cache with app_cache_path(custom path)`] //! //! - [`Creating an application cache without app_cache_path`] //! //! - [`Creating a user cache(the default)`] //! //! - [`Creating a system-wide cache`] //! //! - [`Creating a tmp cache`] //! //! - [`Creating a memory cache`] //! //! - [`Using all default fallbacks(without creating an application cache)`] //! //! - [`Using all default fallbacks(with automatic creation of the application cache)`] //! //! [`Jump to the list of structs`] //! //! [`CacheDir`]: struct.CacheDir.html //! [`CacheDirConfig`]: struct.CacheDirConfig.html //! [`PathBuf`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html //! [`Creating an application cache with app_cache_path(custom path)`]: index.html#creating-an-application-cache-with-app_cache_pathcustom-path //! [`Creating an application cache without app_cache_path`]: index.html#creating-an-application-cache-without-app_cache_path //! [`Creating a user cache(the default)`]: index.html#creating-a-user-cachethe-default //! [`Creating a system-wide cache`]: index.html#creating-a-system-wide-cache //! [`Creating a tmp cache`]: index.html#creating-a-tmp-cache //! [`Creating a memory cache`]: index.html#creating-a-memory-cache //! [`Using all default fallbacks(without creating an application cache)`]: index.html#using-all-default-fallbackswithout-creating-an-application-cache //! [`Using all default fallbacks(with automatic creation of the application cache)`]: index.html#using-all-default-fallbackswith-automatic-creation-of-the-application-cache //! [`Jump to the list of structs`]: index.html#structs //! [`To the top ⤴`]: index.html //! //! # Examples //! //! ### Creating an `application cache` **with** `app_cache_path`(custom path) //! [`To the top ⤴`] //! //! ``` //! use cachedir::CacheDirConfig; //! use std::path::PathBuf; //! use std::env::current_dir; //! //! let current_dir = current_dir().unwrap(); //! let app_cache = CacheDirConfig::new("example/path") //! .app_cache_path(current_dir.as_path()) //! .get_cache_dir().unwrap(); //! //! assert_eq!(current_dir.join("example/path"), //! app_cache.into_path_buf()); //! ``` //! //! ### Creating an `application cache` **without** `app_cache_path` //! [`To the top ⤴`] //! //! ``` //! use cachedir::CacheDirConfig; //! use std::path::PathBuf; //! use std::env::current_dir; //! //! let app_cache = CacheDirConfig::new("example") //! .app_cache(true) //! .get_cache_dir().unwrap(); //! //! let current_dir = current_dir().unwrap(); //! if cfg!(not(windows)) { //! assert_eq!(current_dir.join(".cache").join("example"), //! app_cache.into_path_buf()); //! } else { //! assert_eq!(current_dir.join("Cache").join("example"), //! app_cache.into_path_buf()); //! } //! ``` //! //! ### Creating a `user cache`(the default) //! [`To the top ⤴`] //! //! ``` //! use cachedir::CacheDirConfig; //! use std::path::PathBuf; //! use std::env; //! //! // User cache is the default //! let user_cache: PathBuf = CacheDirConfig::new("example") //! .get_cache_dir().unwrap() //! .into(); // `CacheDir` implements `Into<PathBuf>` //! //! let assert_user_cache = CacheDirConfig::new("example") //! .user_cache(true) //! .get_cache_dir().unwrap() //! .into_path_buf(); // -> PathBuf //! //! assert_eq!(assert_user_cache, user_cache); //! //! let expected_cache_dir: PathBuf; //! #[cfg(any(unix, target_os = "redox"))] //! { //! let home_dir = env::home_dir(); //! //! #[cfg(not(any(target_os = "emscripten", target_os = "macos")))] //! { //! expected_cache_dir = home_dir.unwrap().join(".cache").join("example"); //! } //! //! #[cfg(target_os = "emscripten")] //! { //! expected_cache_dir = if home_dir.is_none() { //! PathBuf::from("/var/cache").join("example") //! } else { //! home_dir.unwrap().join(".cache").join("example") //! }; //! } //! //! #[cfg(target_os = "macos")] //! { //! expected_cache_dir = home_dir.unwrap().join("Library/Caches").join("example"); //! } //! } //! //! #[cfg(windows)] //! { //! let local_app_data = PathBuf::from(env::var_os("LOCALAPPDATA").unwrap()); //! expected_cache_dir = local_app_data.join("example"); //! } //! //! assert_eq!(expected_cache_dir, user_cache); //! ``` //! //! ### Creating a `system-wide cache` //! [`To the top ⤴`] //! //! ```no_run //! use cachedir::CacheDirConfig; //! use std::path::PathBuf; //! //! let cache_dir = CacheDirConfig::new("example") //! .sys_cache(true) //! .get_cache_dir().unwrap(); //! //! let expected_cache_dir: PathBuf; //! #[cfg(unix)] //! { //! #[cfg(not(target_os = "macos"))] //! { expected_cache_dir = PathBuf::from("/var/cache").join("example"); } //! //! #[cfg(target_os = "macos")] //! { expected_cache_dir = PathBuf::from("/Library/Caches").join("example"); } //! } //! //! #[cfg(windows)] //! { //! use std::env; //! let program_data = PathBuf::from(env::var_os("ProgramData").unwrap()); //! expected_cache_dir = program_data.join("example"); //! } //! //! assert_eq!(expected_cache_dir, cache_dir.into_path_buf()); //! ``` //! //! ### Creating a `tmp cache` //! [`To the top ⤴`] //! //! ``` //! use cachedir::CacheDirConfig; //! use std::path::PathBuf; //! //! let cache_dir = CacheDirConfig::new("example") //! .tmp_cache(true) //! .get_cache_dir().unwrap(); //! //! let expected_cache_dir: PathBuf; //! #[cfg(unix)] //! { //! // On Unix, we try `/var/tmp` first, because it is more persistent than `/tmp` //! expected_cache_dir = PathBuf::from("/var/tmp").join("example"); //! } //! //! #[cfg(windows)] //! { //! use std::env::temp_dir; //! expected_cache_dir = temp_dir().join("example"); //! } //! //! assert_eq!(expected_cache_dir, cache_dir.into_path_buf()); //! ``` //! //! ### Creating a `memory cache` //! [`To the top ⤴`] //! //! ```no_run //! use cachedir::CacheDirConfig; //! use std::path::PathBuf; //! //! let cache_dir = CacheDirConfig::new("example/path") //! .mem_cache(true) //! .get_cache_dir().unwrap(); //! //! // In-memory caches are supported only on Linux //! if cfg!(target_os = "linux") { //! // We try `/dev/shm` before `/run/shm` //! assert_eq!(PathBuf::from("/dev/shm").join("example/path"), //! cache_dir.into_path_buf()); //! } //! ``` //! //! ### Using all default fallbacks(without creating an application cache) //! [`To the top ⤴`] //! //! ``` //! use cachedir::CacheDirConfig; //! use std::path::PathBuf; //! //! let short_version = CacheDirConfig::new("example/path") //! .try_all_caches() //! .get_cache_dir().unwrap(); //! //! let verbose_version = CacheDirConfig::new("example/path") //! .user_cache(true) // Order here //! .sys_cache(true) // does //! .tmp_cache(true) // not //! .mem_cache(true) // matter //! .get_cache_dir().unwrap(); // This still is the last call //! //! assert_eq!(short_version, verbose_version); // `CacheDir` implements `Eq` and `PartialEq` //! ``` //! This will try to create the cache directory using these options(listed below).<br/> //! It falls back to the next option if it fails:<br/> //! //! 1. User cache(**persistent** and **doesn't require** elevated rights) //! //! 2. System-wide cache(**persistent** and **requires** elevated rights) //! //! 3. Tmp cache(**somewhat persistent in /var/tmp** on Unix, **doesn't require** elevated rights) //! //! 4. Memory cache(**not persistent** between system restarts, **doesn't require** elevated rights) //! //! ### Using all default fallbacks(with automatic creation of the application cache) //! [`To the top ⤴`] //! //! ``` //! use cachedir::CacheDirConfig; //! use std::path::{ Path, PathBuf }; //! use std::env::current_dir; //! //! let one_way = CacheDirConfig::new("example/path") //! .app_cache(true) //! .try_all_caches() //! .get_cache_dir().unwrap(); //! //! let autocreated_dir = if cfg!(not(windows)) { //! Path::new(".cache") //! } else { //! Path::new("Cache") //! }; //! //! let app_cache_path = current_dir().unwrap().join(autocreated_dir); //! //! // It's OK to use `app_cache(true)` here too //! let another_way = CacheDirConfig::new("example/path") //! .app_cache_path(app_cache_path.as_path()) //! .try_all_caches() //! .get_cache_dir().unwrap(); //! //! assert_eq!(one_way, another_way); //! //! // `app_cache_path` overwrites the default that was set in `app_cache(true)` //! let yet_another_way = CacheDirConfig::new("example/path") //! .app_cache(true) //! .app_cache_path("/tmp/other/path") //! .try_all_caches() //! .get_cache_dir().unwrap(); //! //! assert!(another_way != yet_another_way); //! //! // `app_cache(true)` does not overwrite the path of `app_cache_path` if it was set //! let or_this_way = CacheDirConfig::new("example/path") //! .app_cache_path("/tmp/other/path") //! .app_cache(true) //! .try_all_caches() //! .get_cache_dir().unwrap(); //! //! assert_eq!(yet_another_way, or_this_way); //! ``` //! This will try to create the cache directory using these options(listed below).<br/> //! It falls back to the next option if it fails:<br/> //! //! 1. Application cache //! //! 2. User cache(**persistent** and **doesn't require** elevated rights) //! //! 3. System-wide cache(**persistent** and **requires** elevated rights) //! //! 4. Tmp cache(**somewhat persistent in /var/tmp** on Unix, **doesn't require** elevated rights) //! //! 5. Memory cache(**not persistent** between system restarts, **doesn't require** elevated rights) //! //! [`To the top ⤴`] use std::path; use std::io; use std::ffi::OsStr; // Contains the os-agnostic `create_cache_dir` function mod sys_cache; // Traits implementations for `CacheDir` mod traits_impls; /// This structure holds the [`PathBuf`] returned from [`CacheDirConfig`]. /// /// It derefs to [`PathBuf`] and implements most of the same traits as [`PathBuf`]. /// /// # Examples /// ``` /// # use cachedir::{ CacheDir, CacheDirConfig }; /// # use std::path::{ Path, PathBuf }; /// # use std::ffi::OsStr; /// let cache_dir: CacheDir = CacheDirConfig::new("example").get_cache_dir().unwrap(); /// /// fn as_path(path: &Path) {} /// /// fn into_path_buf<P: Into<PathBuf>>(path: P) { /// let _path_buf: PathBuf = path.into(); /// } /// /// fn as_ref<P: AsRef<OsStr>>(path: P) { /// let _os_str: &OsStr = path.as_ref(); /// } /// /// as_path(cache_dir.as_path()); /// into_path_buf(cache_dir.clone()); /// as_ref(cache_dir.clone()); /// /// println!("{}", cache_dir.display()); /// ``` /// /// [`CacheDirConfig`]: struct.CacheDirConfig.html /// [`PathBuf`]: https://doc.rust-lang.org/std/path/struct.PathBuf.html #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct CacheDir { path: path::PathBuf } impl CacheDir { /// ``` /// # use cachedir::CacheDirConfig; /// # use std::path::PathBuf; /// let path: PathBuf = CacheDirConfig::new("example") /// .get_cache_dir().unwrap() /// .into_path_buf(); /// ``` pub fn into_path_buf(self) -> path::PathBuf { self.path } } /// This structure helps configure the desired behavior when attempting to create /// a cache directory and also creates the directory based on that behavior. /// /// `CacheDirConfig` prioritizes the most persistent destinations first and then the locations /// that require the least user rights, when attempting to create a cache directory.<br/><br/> /// /// The default behavior is to create a `user cache`(won't attempt other cache options). /// /// If another cache option is passed, then the `user cache` default won't be used any more. /// /// If only [`app_cache_path`] and/or [`app_cache(true)`] is passed, then only the application cache /// will be created(there won't be attempts to fallback to other cache options). /// /// Multiple fallbacks can be used by using the [`app_cache_path`], [`app_cache`], [`user_cache`], /// [`sys_cache`], [`tmp_cache`], [`mem_cache`] and [`try_all_caches`] functions to configure /// the behavior. /// /// The order of attempts looks like this(note that unset cache options are skipped): /// /// 1. Application cache /// /// 2. User cache(**persistent** and **doesn't require** elevated rights) /// /// 3. System-wide cache(**persistent** and **requires** elevated rights) /// /// 4. Tmp cache(**somewhat persistent in /var/tmp** on Unix, **doesn't require** elevated rights) /// /// 5. Memory cache(**not persistent** between system restarts, **doesn't require** elevated rights) /// /// Example: If a user sets [`user_cache(true)`], [`sys_cache(true)`] and [`mem_cache(true)`] /// than `CaheDirConfig` will attempt to create a cache directory in the `user_cache`, than, if it /// fails(ex: cache directory not found, missing rights, a file with the same name exists, etc...), /// it will fall-back to the `sys_cache`, in which case, if this also fails, it will attempt as a /// last resort to create a cache directory in the `mem_cache`. /// /// [`app_cache_path`]: struct.CacheDirConfig.html#method.app_cache_path /// [`app_cache(true)`]: struct.CacheDirConfig.html#method.app_cache /// [`app_cache`]: struct.CacheDirConfig.html#method.app_cache /// [`user_cache`]: struct.CacheDirConfig.html#method.user_cache /// [`user_cache(true)`]: struct.CacheDirConfig.html#method.user_cache /// [`sys_cache`]: struct.CacheDirConfig.html#method.sys_cache /// [`sys_cache(true)`]: struct.CacheDirConfig.html#method.sys_cache /// [`tmp_cache`]: struct.CacheDirConfig.html#method.tmp_cache /// [`mem_cache`]: struct.CacheDirConfig.html#method.mem_cache /// [`mem_cache(true)`]: struct.CacheDirConfig.html#method.mem_cache /// [`try_all_caches`]: struct.CacheDirConfig.html#method.try_all_caches /// /// # Examples /// ``` /// # use cachedir::CacheDirConfig; /// let cache_dir = CacheDirConfig::new("example").get_cache_dir().unwrap(); /// ``` /// This will attempt to create the cache directory `example` in the `User Cache`.<br/> /// Read [`user_cache`] documentation if you want to find more about the paths used for `User Cache`. pub struct CacheDirConfig<'a, 'b> { cache_name: &'a path::Path, app_cache_path: Option<&'b path::Path>, app_cache: bool, // wasted an hour on this, obsessing about "user" not being 3 characters aligned, // but "usr" is not very clear(for non-Unix users) and does not sound as well when pronouncing it user_cache: bool, sys_cache: bool, tmp_cache: bool, mem_cache: bool } impl<'a, 'b> CacheDirConfig<'a, 'b> { /// `cache_name` accepts a path - used to create the cache directory. /// /// If it *does not exist* at the desired location, `CacheDirConfig` will create it when /// calling `get_cache_dir()`, before returning the path to the final cache destination. /// /// If it *already exists* and it is a directory, `get_cache_dir()` will /// return the path to the final cache destination(**note:** in this situation, `CacheDirConfig` /// cannot guarantee that you have access to write in the final destination, it just confirms /// that the cache directory already exists). /// /// # Examples /// ``` /// use cachedir::CacheDirConfig; /// let cache_config = CacheDirConfig::new("some/path"); /// ``` pub fn new<S: AsRef<OsStr> + ?Sized>(cache_name: &'a S) -> CacheDirConfig<'a, 'b> { CacheDirConfig { cache_name: path::Path::new(cache_name), app_cache_path: None, app_cache: false, user_cache: false, sys_cache: false, tmp_cache: false, mem_cache: false } } /// This function allows to choose a custom path where the cache directory should be created. /// /// If it *does not exist*, `CacheDirConfig` will attempt to create it. /// /// If none of the other cache options are selected, this will be the only directory /// where `CacheDirConfig` will attempt to create the cache directory. /// /// Using this function automatically switches `app_cache` to `true`. It can manually be /// disabled later by calling `app_cache(false)` on this `CacheDirConfig` object. /// /// # Examples /// ```no_run /// use cachedir::CacheDirConfig; /// let cache_dir = CacheDirConfig::new("some/path") /// .app_cache_path("/application/cache") /// .get_cache_dir(); /// ``` pub fn app_cache_path<S: AsRef<OsStr> + ?Sized>(&mut self, path: &'b S) -> &mut CacheDirConfig<'a, 'b> { self.app_cache_path = Some(path::Path::new(path)); self.app_cache = true; self } /// This function tells `CacheDirConfig` if it should attempt to create /// an application cache directory. /// /// ### Non-Windows /// If `app_cache_path` is not passed, `CacheDirConfig` will attempt to create the /// application cache based on the *current directory + ".cache"* /// /// If the directory *does not exist*, `CacheDirConfig` will attempt to create it. /// /// ### Windows /// If `app_cache_path` is not passed, `CacheDirConfig` will attempt to create the /// application cache based on the *current directory + "Cache"* /// /// If the directory *does not exist*, `CacheDirConfig` will attempt to create it. /// /// # Examples /// ``` /// use cachedir::CacheDirConfig; /// let cache_dir = CacheDirConfig::new("some/path") /// .app_cache(true) /// .get_cache_dir(); /// ``` pub fn app_cache(&mut self, value: bool) -> &mut CacheDirConfig<'a, 'b> { self.app_cache = value; if self.app_cache_path.is_none() && self.app_cache { self.app_cache_path = if cfg!(not(windows)) { Some(path::Path::new(".cache")) } else { Some(path::Path::new("Cache")) }; } self } /// This function tells `CacheDirConfig` if it should attempt to create /// a user cache directory. /// /// Note that if none of the cache options are passed, than the default /// is to use the `User Cache`. /// /// ### Unix /// `CacheDirConfig` will attempt to obtain the `HOME` directory of the user. /// If it fails, it will try the next fallback. If a fallback was not configured, it will /// return an `std::io::Error` when calling `get_cache_dir`.<br/> /// An exception is made for `Emscripten` - in this case it will attempt to create `/var/cache` /// as a parent directory for the final cache destination. /// /// If `HOME` was found, than `CacheDirConfig` will attempt to return or /// create(if it is missing) the `.cache` directory from inside the `HOME` directory /// on `non-macOS` systems and `Library/Caches` on `macOS`. /// /// ### Windows /// `CacheDirConfig` will attempt to create the cache directory inside these paths(and /// fallback to the next if it fails): /// /// 1. Windows environment variable: `%LOCALAPPDATA%` /// /// 2. `%APPDATA%` /// /// 3. Rust's `home_dir` which returns `%HOME%` --ifndef--> `%USERPROFILE%` /// --ifndef--> `OS syscall`.<br/> /// Since the user's home directory is not a dedicated cache directory, `CacheDirConfig` /// will attempt to create the `Cache` directory inside it. /// /// If it fails, it will try the next fallback. If a fallback was not configured, it will /// return an `std::io::Error` when calling `get_cache_dir`. /// /// ### Redox /// `CacheDirConfig` will attempt to obtain the `HOME` directory of the user. /// If it fails, it will try the next fallback. If a fallback was not configured, it will /// return an `std::io::Error` when calling `get_cache_dir`. /// /// If `HOME` was found, than `CacheDirConfig` will attempt to return or /// create(if it is missing) the `.cache` directory from inside the `HOME` directory. /// /// # Examples /// ``` /// use cachedir::CacheDirConfig; /// let cache_dir = CacheDirConfig::new("some/path") /// .user_cache(true) /// .get_cache_dir(); /// ``` pub fn user_cache(&mut self, value: bool) -> &mut CacheDirConfig<'a, 'b> { self.user_cache = value; self } /// This function tells `CacheDirConfig` if it should attempt to create /// a system-wide cache directory.<br/> /// **Note:** This might require elevated rights(ex: `superuser`, `Admin`...) in the system. /// /// ### Unix(non-macOS) /// `CacheDirConfig` will attempt to create the cache directory inside `/var/cache` /// when calling `get_cache_dir`. /// /// If it fails, it will try the next fallback. If a fallback was not configured, it will /// return an `std::io::Error` when calling `get_cache_dir`. /// /// ### Unix(macOS) /// `CacheDirConfig` will attempt to create the cache directory inside `/Library/Caches` /// when calling `get_cache_dir`. /// /// If it fails, it will try the next fallback. If a fallback was not configured, it will /// return an `std::io::Error` when calling `get_cache_dir`. /// /// ### Windows /// `CacheDirConfig` will attempt to create the cache directory inside `%ProgramData%` /// when calling `get_cache_dir`. /// /// If it fails, it will try the next fallback. If a fallback was not configured, it will /// return an `std::io::Error` when calling `get_cache_dir`. /// /// ### Redox /// Currently not supported /// /// # Examples /// ```no_run /// use cachedir::CacheDirConfig; /// let cache_dir = CacheDirConfig::new("some/path") /// .sys_cache(true) /// .get_cache_dir(); /// ``` pub fn sys_cache(&mut self, value: bool) -> &mut CacheDirConfig<'a, 'b> { self.sys_cache = value; self } /// This function tells `CacheDirConfig` if it should attempt to create /// a cache directory inside one of the system's temporary directories. /// /// ### Unix /// `CacheDirConfig` will attempt to create the cache directory in /// 2 locations(will use the second location only if the first one fails): /// /// 1. `/var/tmp` /// /// 2. Rust's `temp_dir` which is usually(not on Android) `/tmp` /// /// `/var/tmp` is preferred because it is more persistent between system restarts.<br/> /// It is usually automatically cleaned every 30 days by the system. /// /// If these fail, `CacheDirConfig` will try the next fallback. /// If a fallback was not configured, it will return an `std::io::Error` when calling /// `get_cache_dir`. /// /// ### Windows and Redox /// `CacheDirConfig` will attempt to create the cache directory inside the `TMP/TEMP` directory. /// /// The `TMP/TEMP` directory is obtained internally by calling Rust's `temp_dir`. /// /// If it fails, it will try the next fallback. If a fallback was not configured, it /// will return `std::io::Error` when calling `get_cache_dir`. /// /// # Examples /// ``` /// use cachedir::CacheDirConfig; /// let cache_dir = CacheDirConfig::new("some/path") /// .tmp_cache(true) /// .get_cache_dir(); /// ``` pub fn tmp_cache(&mut self, value: bool) -> &mut CacheDirConfig<'a, 'b> { self.tmp_cache = value; self } /// **Linux and Emscripten only(although, it is OK to call the function on any system)** /// /// This function tells `CacheDirConfig` if it should attempt to create a cache directory /// inside one of these paths: /// /// 1. `/dev/shm` /// /// 2. `/run/shm` /// /// If these fail, when calling `get_cache_dir`, it will return an `std::io::Error`. /// /// # Examples /// ```no_run /// use cachedir::CacheDirConfig; /// let cache_dir = CacheDirConfig::new("some/path") /// .mem_cache(true) /// .get_cache_dir(); /// ``` pub fn mem_cache(&mut self, value: bool) -> &mut CacheDirConfig<'a, 'b> { self.mem_cache = value; self } /// This function tells `CacheDirConfig` if it should try to use all the cache fallbacks /// when attempting to create the cache directory. /// /// This does not activate `app_cache` if a path for it was not set. /// /// # Examples /// ```no_run /// use cachedir::CacheDirConfig; /// /// // This will not activate the `app_cache` /// let cache_dir1 = CacheDirConfig::new("some/path") /// .try_all_caches() /// .get_cache_dir(); /// /// // This will activate `app_cache` /// let cache_dir2 = CacheDirConfig::new("some/path") /// .app_cache_path("/path/to/app/cache") /// .app_cache(false) // try_all_caches will activate it back /// .try_all_caches() /// .get_cache_dir(); /// ``` pub fn try_all_caches(&mut self) -> &mut CacheDirConfig<'a, 'b> { // We don't use the `app_cache`(with its fallback to ".cache" and "Cache") function // for this one because we assume that the user prefers system-wide directories and because // he might not expect to use an application cache by default, if he didn't ask for it if self.app_cache_path.is_some() { self.app_cache = true }; self.user_cache = true; self.sys_cache = true; self.tmp_cache = true; self.mem_cache = true; self } /// This creates the cache directory based on the `CacheDirConfig` configurations. /// /// The returned `CacheDir` contains the path to the cache directory. /// /// # Errors /// If the directory could not be created, `std::io::Error` is returned.</br> /// Calling `.kind()` on it will return the last `std::io::ErrorKind`.<br/> /// Calling `.description()` will return the description of all the `CacheDirConfig` /// attempts that failed. /// /// # Examples /// ```no_run /// use cachedir::CacheDirConfig; /// let cache_dir = CacheDirConfig::new("some/path") /// .get_cache_dir(); /// ``` pub fn get_cache_dir(&self) -> io::Result<CacheDir> { match sys_cache::create_cache_dir(&self) { Ok(path_buf) => Ok( CacheDir { path: path_buf } ), Err(err) => Err(err) } } }
//! Brotli Compression/Decompression for Rust //! //! This crate is a binding to the [official brotli implementation][brotli] and //! provides in-memory and I/O streams for Rust wrappers. //! //! [brotli]: https://github.com/google/brotli //! //! # Examples //! //! ``` //! use std::io::prelude::*; //! use brotli2::read::{BrotliEncoder, BrotliDecoder}; //! //! // Round trip some bytes from a byte source, into a compressor, into a //! // decompressor, and finally into a vector. //! let data = "Hello, World!".as_bytes(); //! let compressor = BrotliEncoder::new(data, 9); //! let mut decompressor = BrotliDecoder::new(compressor); //! //! let mut contents = String::new(); //! decompressor.read_to_string(&mut contents).unwrap(); //! assert_eq!(contents, "Hello, World!"); //! ``` #![deny(missing_docs)] #![doc(html_root_url = "https://docs.rs/brotli2/0.2")] extern crate brotli_sys; extern crate libc; #[cfg(test)] extern crate rand; #[cfg(test)] extern crate quickcheck; pub mod raw; pub mod bufread; pub mod read; pub mod write; /// Possible choices for modes of compression #[repr(isize)] #[derive(Copy,Clone,Debug,PartialEq,Eq)] pub enum CompressMode { /// Default compression mode, the compressor does not know anything in /// advance about the properties of the input. Generic = brotli_sys::BROTLI_MODE_GENERIC as isize, /// Compression mode for utf-8 formatted text input. Text = brotli_sys::BROTLI_MODE_TEXT as isize, /// Compression mode in WOFF 2.0. Font = brotli_sys::BROTLI_MODE_FONT as isize, } /// Parameters passed to various compression routines. #[derive(Clone,Debug)] pub struct CompressParams { /// Compression mode. mode: u32, /// Controls the compression-speed vs compression-density tradeoffs. The higher the `quality`, /// the slower the compression. Range is 0 to 11. quality: u32, /// Base 2 logarithm of the sliding window size. Range is 10 to 24. lgwin: u32, /// Base 2 logarithm of the maximum input block size. Range is 16 to 24. If set to 0, the value /// will be set based on the quality. lgblock: u32, } impl CompressParams { /// Creates a new default set of compression parameters. pub fn new() -> CompressParams { CompressParams { mode: brotli_sys::BROTLI_DEFAULT_MODE, quality: brotli_sys::BROTLI_DEFAULT_QUALITY, lgwin: brotli_sys::BROTLI_DEFAULT_WINDOW, lgblock: 0, } } /// Set the mode of this compression. pub fn mode(&mut self, mode: CompressMode) -> &mut CompressParams { self.mode = mode as u32; self } /// Controls the compression-speed vs compression-density tradeoffs. /// /// The higher the quality, the slower the compression. Currently the range /// for the quality is 0 to 11. pub fn quality(&mut self, quality: u32) -> &mut CompressParams { self.quality = quality; self } /// Sets the base 2 logarithm of the sliding window size. /// /// Currently the range is 10 to 24. pub fn lgwin(&mut self, lgwin: u32) -> &mut CompressParams { self.lgwin = lgwin; self } /// Sets the base 2 logarithm of the maximum input block size. /// /// Currently the range is 16 to 24, and if set to 0 the value will be set /// based on the quality. pub fn lgblock(&mut self, lgblock: u32) -> &mut CompressParams { self.lgblock = lgblock; self } /// Get the current block size #[inline] pub fn get_lgblock_readable(&self) -> usize { 1usize << self.lgblock } /// Get the native lgblock size #[inline] pub fn get_lgblock(&self) -> u32 { self.lgblock.clone() } /// Get the current window size #[inline] pub fn get_lgwin_readable(&self) -> usize { 1usize << self.lgwin } /// Get the native lgwin value #[inline] pub fn get_lgwin(&self) -> u32 { self.lgwin.clone() } }
#![warn(clippy::all)] #![warn(clippy::pedantic)] fn main() { run(); } fn run() { let start = std::time::Instant::now(); // code goes here let res: u64 = primes_under(2_000_000).iter().sum(); let span = start.elapsed().as_nanos(); println!("{} {}", res, span); } /// iterative implementation of Sieve of Eratosthenes #[allow(clippy::cast_possible_truncation)] #[allow(clippy::cast_sign_loss)] #[allow(clippy::cast_precision_loss)] fn primes_under(n: u64) -> Vec<u64> { let mut is_prime = vec![true; (n + 1) as usize]; is_prime[0] = false; is_prime[1] = false; let sqrt = (n as f64).sqrt() as usize; for i in 2..=sqrt { if is_prime[i] { for j in (i * i..=n as usize).step_by(i) { is_prime[j] = false; } } } is_prime .into_iter() .enumerate() .filter(|(_, v)| *v) .map(|(i, _)| i as u64) .collect() }
use std::process::Command; use super::transpile::*; use crate::text_io::*; use std::io::Write; use std::fs::File; use std::str; pub fn repl() { let mut leave = String::from("#include \"engppstd.hpp\"\n"); let mut lines :Vec<String> = Vec::new(); let mut stack :Vec<char> = Vec::new(); let mut leave_main = String::new(); let mut header = String::new(); let mut in_string = false; let mut escaped = false; let mut indents = 0; loop { if stack.is_empty() && lines.is_empty() { print!("\n >> "); std::io::stdout().flush().expect("Error to flush stdout"); } else { print!("{} .. ", " ".repeat(indents)); std::io::stdout().flush().expect("Error to flush stdout"); } let mut buff :String = read!("{}\n"); for elem in buff.chars() { match elem { '\\' => { escaped = in_string && !escaped }, '"' => { if !escaped { in_string = !in_string; } escaped=false; }, '(' => if !in_string { stack.push('(') }, ')' => if !in_string { if stack.is_empty() { eprintln!("bracker pair does not matches"); continue; } else if *stack.last().unwrap() == '(' { stack.pop(); } else { eprintln!("bracker pair does not matches"); continue; } }, '{' => if !in_string { stack.push('{') }, '}' => if !in_string { if stack.is_empty() { eprintln!("bracker pair does not matches"); continue; } else if *stack.last().unwrap() == '{' { stack.pop(); } else { eprintln!("bracker pair does not matches"); continue; } }, _ => { escaped=false; } }; } let mut will_evaluated = false; if !stack.is_empty() { lines.push(String::from(&buff)); } else if buff.trim().is_empty() { if indents > 0 { indents -= 1; } else { will_evaluated = true; } } else if regi(&buff, r"^([\s\t]*([Ii]f|else|[Ww]hile|[Ff]or|[Rr]epeat|[Uu]nless|[Ww]hen|[Uu]se|public|protected|[Cc]lass|private).*)$") { if header.is_empty() { header = keyword(&buff); } buff = format!("{}{}", " ".repeat(indents), buff); lines.push(String::from(&buff)); indents += 1; } else if indents > 0 { if header.is_empty() { header = keyword(&buff); } buff = format!("{}{}", " ".repeat(indents), buff); lines.push(String::from(&buff)); } else { lines.push(String::from(&buff)); if header.is_empty() { header = keyword(&buff); } will_evaluated = true; } if will_evaluated { if regi(&header, "^(class|when|make|have|lib(rary)?|import)$") { leave += &transpile(&tree::CodeTree::treeify(&lines.join("\n")), 0); } else if regi(&header, "^(let|set)$") { leave_main += &transpile(&tree::CodeTree::treeify(&lines.join("\n")), 0); } else { let file = File::create("engppstd.hpp"); file.unwrap().write_all(&blocks::stdlib::STDLIB[..]) .expect("Failed to write standard library file."); let mut file = File::create("enpprtpl.cpp").unwrap(); file.write_all(format!("{}int main(){{{}{}}}", leave, leave_main, &transpile(&tree::CodeTree::treeify(&lines.join("\n")), 0) ).as_bytes()).expect("Failed to make output"); drop(file); if cfg!(target_os = "windows") { Command::new("cmd").args(&["/C", "g++ -o out enpprtpl.cpp -std=c++20 -lpthread"]).spawn() .expect("failed to execute process").wait() .expect("failed to wait"); Command::new("cmd").args(&["/C", ".\\out"]).spawn() .expect("failed to execute process").wait() .expect("failed to wait"); } else { Command::new("sh").args(&["-c", "g++ -o out enpprtpl.cpp -std=c++17 -pthread"]).spawn() .expect("failed to execute process").wait() .expect("failed to wait"); Command::new("sh").args(&["-c", "./out"]).spawn() .expect("failed to execute process").wait() .expect("failed to wait"); } } indents = 0; stack.clear(); lines.clear(); header.clear(); } }; }
extern crate chrono; use chrono::Local; use std::string::ToString; /// Get the current timestamp formated to apply to the ISO 8601. /// # Return Value /// /// A String containing the current timestamp. pub fn get_timestamp() -> String { let now = Local::now(); return now.format("%Y-%m-%dT%H:%M:%S%z").to_string(); }
#![deny(clippy::all)] mod error; pub mod aws; pub mod nomad; pub mod vault; pub use crate::error::Error; use std::fmt; use std::ops::Deref; use futures::future::Future; use rusoto_core::credential::AwsCredentials; use rusoto_core::{DefaultCredentialsProvider, ProvideAwsCredentials, Region}; use serde::{Deserialize, Serialize}; /// A wrapper around a String with custom implementation of Display and Debug to not leak /// secrets during logging. #[derive(Serialize, Deserialize, Clone, Eq, PartialEq)] pub struct Secret(pub String); impl Deref for Secret { type Target = String; fn deref(&self) -> &Self::Target { &self.0 } } impl fmt::Debug for Secret { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "***") } } impl fmt::Display for Secret { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "***") } } impl AsRef<str> for Secret { fn as_ref(&self) -> &str { &self.0 } } impl From<String> for Secret { fn from(s: String) -> Self { Secret(s) } } /// Use AWS credentials to obtain a token from Vault /// /// If the Vault AWS Authentication method has the /// [`iam_server_id_header_value`](https://www.vaultproject.io/api/auth/aws/index.html#iam_server_id_header_value) /// configured, you *must* provide the configured value in the `header_value` parameter. /// /// If `region` is `None`, we will infer the Region using the behaviour documented /// [here](https://rusoto.github.io/rusoto/rusoto_core/region/enum.Region.html#default). pub fn login_to_vault( vault_address: &str, vault_auth_path: &str, vault_auth_role: &str, aws_credentials: &AwsCredentials, header_value: Option<&str>, region: Option<Region>, ) -> Result<vault::Client, Error> { let aws_payload = aws::VaultAwsAuthIamPayload::new(aws_credentials, header_value, region); vault::Client::login_aws_iam( &vault_address, vault_auth_path, vault_auth_role, &aws_payload, None, ) } /// Use the priority documented /// [here](https://rusoto.github.io/rusoto/rusoto_credential/struct.ChainProvider.html) /// obtain AWS credentials pub fn get_aws_credentials() -> Result<AwsCredentials, Error> { let provider = DefaultCredentialsProvider::new()?; Ok(provider.credentials().wait()?) } #[cfg(test)] mod tests { use super::*; use std::env; #[test] fn expcted_aws_credentials() -> Result<(), crate::Error> { let access_key = "test_key"; let secret_key = "test_secret"; env::set_var("AWS_ACCESS_KEY_ID", access_key); env::set_var("AWS_SECRET_ACCESS_KEY", secret_key); let credentials = get_aws_credentials()?; assert_eq!(credentials.aws_access_key_id(), access_key); assert_eq!(credentials.aws_secret_access_key(), secret_key); Ok(()) } /// Requires Mock server for this test #[test] fn login_to_vault_is_successful() -> Result<(), crate::Error> { let credentials = rusoto_core::credential::StaticProvider::new_minimal( "test_key".to_string(), "test_secret".to_string(), ); let credentials = credentials.credentials().wait()?; let client = login_to_vault( &crate::vault::tests::vault_address(), "aws", "default", &credentials, Some("vault.example.com"), None, )?; assert!(!client.token().is_empty()); Ok(()) } }
//! NDSP (Audio) service. //! //! The NDSP service is used to handle communications to the DSP processor present on the console's motherboard. //! Thanks to the DSP processor the program can play sound effects and music on the console's built-in speakers or to any audio device //! connected via the audio jack. #![doc(alias = "audio")] pub mod wave; use wave::{Status, Wave}; use crate::error::ResultCode; use crate::services::ServiceReference; use std::cell::{RefCell, RefMut}; use std::default::Default; use std::error; use std::fmt; use std::sync::Mutex; const NUMBER_OF_CHANNELS: u8 = 24; /// Audio output mode. #[doc(alias = "ndspOutputMode")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum OutputMode { /// Single-Channel. Mono = ctru_sys::NDSP_OUTPUT_MONO, /// Dual-Channel. Stereo = ctru_sys::NDSP_OUTPUT_STEREO, /// Surround. Surround = ctru_sys::NDSP_OUTPUT_SURROUND, } /// PCM formats supported by the audio engine. #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum AudioFormat { /// PCM 8bit single-channel. PCM8Mono = ctru_sys::NDSP_FORMAT_MONO_PCM8, /// PCM 16bit single-channel. PCM16Mono = ctru_sys::NDSP_FORMAT_MONO_PCM16, /// PCM 8bit interleaved dual-channel. PCM8Stereo = ctru_sys::NDSP_FORMAT_STEREO_PCM8, /// PCM 16bit interleaved dual-channel. PCM16Stereo = ctru_sys::NDSP_FORMAT_STEREO_PCM16, } /// Representation of the volume mix for a channel. #[derive(Copy, Clone, Debug, PartialEq)] pub struct AudioMix { raw: [f32; 12], } /// Interpolation used between audio frames. #[doc(alias = "ndspInterpType")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u32)] pub enum InterpolationType { /// Polyphase interpolation. Polyphase = ctru_sys::NDSP_INTERP_POLYPHASE, /// Linear interpolation. Linear = ctru_sys::NDSP_INTERP_LINEAR, /// No interpolation. None = ctru_sys::NDSP_INTERP_NONE, } /// Errors returned by [`ndsp`](self) functions. #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum NdspError { /// Channel with the specified ID does not exist. InvalidChannel(u8), /// Channel with the specified ID is already being used. ChannelAlreadyInUse(u8), /// The wave is already busy playing in the channel with the specified ID. WaveBusy(u8), /// The sample amount requested was larger than the maximum. SampleCountOutOfBounds(usize, usize), } /// NDSP Channel representation. /// /// There are 24 individual channels in total and each can play a different audio [`Wave`] simultaneuosly. /// /// # Default /// /// NDSP initialises all channels with default values on initialization, but the developer is supposed to change these values to correctly work with the service. /// /// In particular: /// - Default audio format is set to [`AudioFormat::PCM16Mono`]. /// - Default sample rate is set to 1 Hz. /// - Default interpolation type is set to [`InterpolationType::Polyphase`]. /// - Default mix is set to [`AudioMix::default()`] /// /// The handle to a channel can be retrieved with [`Ndsp::channel()`] pub struct Channel<'ndsp> { id: u8, _rf: RefMut<'ndsp, ()>, // we don't need to hold any data } static NDSP_ACTIVE: Mutex<usize> = Mutex::new(0); /// Handle to the DSP service. /// /// Only one handle for this service can exist at a time. pub struct Ndsp { _service_handler: ServiceReference, channel_flags: [RefCell<()>; NUMBER_OF_CHANNELS as usize], } impl Ndsp { /// Initialize the DSP service and audio units. /// /// # Errors /// /// This function will return an error if an instance of the [`Ndsp`] struct already exists /// or if there are any issues during initialization. /// /// # Example /// /// ```no_run /// # use std::error::Error; /// # fn main() -> Result<(), Box<dyn Error>> { /// # /// use ctru::services::ndsp::Ndsp; /// /// let ndsp = Ndsp::new()?; /// # /// # Ok(()) /// # } /// ``` #[doc(alias = "ndspInit")] pub fn new() -> crate::Result<Self> { let _service_handler = ServiceReference::new( &NDSP_ACTIVE, false, || { ResultCode(unsafe { ctru_sys::ndspInit() })?; Ok(()) }, || unsafe { ctru_sys::ndspExit(); }, )?; Ok(Self { _service_handler, channel_flags: Default::default(), }) } /// Return a representation of the specified channel. /// /// # Errors /// /// An error will be returned if the channel ID is not between 0 and 23 or if the specified channel is already being used. /// /// # Example /// /// ```no_run /// # use std::error::Error; /// # fn main() -> Result<(), Box<dyn Error>> { /// # /// use ctru::services::ndsp::Ndsp; /// let ndsp = Ndsp::new()?; /// /// let channel_0 = ndsp.channel(0)?; /// # /// # Ok(()) /// # } /// ``` pub fn channel(&self, id: u8) -> std::result::Result<Channel, NdspError> { let in_bounds = self.channel_flags.get(id as usize); match in_bounds { Some(ref_cell) => { let flag = ref_cell.try_borrow_mut(); match flag { Ok(_rf) => Ok(Channel { id, _rf }), Err(_) => Err(NdspError::ChannelAlreadyInUse(id)), } } None => Err(NdspError::InvalidChannel(id)), } } /// Set the audio output mode. Defaults to [`OutputMode::Stereo`]. /// /// # Example /// /// ```no_run /// # use std::error::Error; /// # fn main() -> Result<(), Box<dyn Error>> { /// # /// use ctru::services::ndsp::{Ndsp, OutputMode}; /// let mut ndsp = Ndsp::new()?; /// /// // Use dual-channel output. /// ndsp.set_output_mode(OutputMode::Stereo); /// # /// # Ok(()) /// # } /// ``` #[doc(alias = "ndspSetOutputMode")] pub fn set_output_mode(&mut self, mode: OutputMode) { unsafe { ctru_sys::ndspSetOutputMode(mode.into()) }; } } impl Channel<'_> { /// Reset the channel (clear the queue and reset parameters). /// /// # Example /// /// ```no_run /// # use std::error::Error; /// # fn main() -> Result<(), Box<dyn Error>> { /// # /// use ctru::services::ndsp::Ndsp; /// let ndsp = Ndsp::new()?; /// let mut channel_0 = ndsp.channel(0)?; /// /// channel_0.reset(); /// # /// # Ok(()) /// # } /// ``` #[doc(alias = "ndspChnReset")] pub fn reset(&mut self) { unsafe { ctru_sys::ndspChnReset(self.id.into()) }; } /// Initialize the channel's parameters with default values. /// /// # Example /// /// ```no_run /// # use std::error::Error; /// # fn main() -> Result<(), Box<dyn Error>> { /// # /// use ctru::services::ndsp::Ndsp; /// let ndsp = Ndsp::new()?; /// let mut channel_0 = ndsp.channel(0)?; /// /// channel_0.init_parameters(); /// # /// # Ok(()) /// # } /// ``` #[doc(alias = "ndspChnInitParams")] pub fn init_parameters(&mut self) { unsafe { ctru_sys::ndspChnInitParams(self.id.into()) }; } /// Returns whether the channel is playing any audio. /// /// # Example /// /// ```no_run /// # use std::error::Error; /// # fn main() -> Result<(), Box<dyn Error>> { /// # /// use ctru::services::ndsp::Ndsp; /// let ndsp = Ndsp::new()?; /// let mut channel_0 = ndsp.channel(0)?; /// /// // The channel is not playing any audio. /// assert!(!channel_0.is_playing()); /// # /// # Ok(()) /// # } /// ``` #[doc(alias = "ndspChnIsPlaying")] pub fn is_playing(&self) -> bool { unsafe { ctru_sys::ndspChnIsPlaying(self.id.into()) } } /// Returns whether the channel's playback is currently paused. /// /// # Example /// /// ```no_run /// # use std::error::Error; /// # fn main() -> Result<(), Box<dyn Error>> { /// # /// use ctru::services::ndsp::Ndsp; /// let ndsp = Ndsp::new()?; /// let mut channel_0 = ndsp.channel(0)?; /// /// // The channel is not paused. /// assert!(!channel_0.is_paused()); /// # /// # Ok(()) /// # } /// ``` #[doc(alias = "ndspChnIsPaused")] pub fn is_paused(&self) -> bool { unsafe { ctru_sys::ndspChnIsPaused(self.id.into()) } } /// Returns the channel's index. /// /// # Example /// /// ```no_run /// # use std::error::Error; /// # fn main() -> Result<(), Box<dyn Error>> { /// # /// use ctru::services::ndsp::Ndsp; /// let ndsp = Ndsp::new()?; /// let mut channel_0 = ndsp.channel(0)?; /// /// // The channel's index is 0. /// assert_eq!(channel_0.id(), 0); /// # /// # Ok(()) /// # } /// ``` pub fn id(&self) -> u8 { self.id } /// Returns the index of the currently played sample. /// /// Because of how fast this value changes, it should only be used as a rough estimate of the current progress. #[doc(alias = "ndspChnGetSamplePos")] pub fn sample_position(&self) -> usize { (unsafe { ctru_sys::ndspChnGetSamplePos(self.id.into()) }) as usize } /// Returns the channel's current wave sequence's id. #[doc(alias = "ndspChnGetWaveBufSeq")] pub fn wave_sequence_id(&self) -> u16 { unsafe { ctru_sys::ndspChnGetWaveBufSeq(self.id.into()) } } /// Pause or un-pause the channel's playback. /// /// # Example /// /// ```no_run /// # use std::error::Error; /// # fn main() -> Result<(), Box<dyn Error>> { /// # /// use ctru::services::ndsp::Ndsp; /// let ndsp = Ndsp::new()?; /// let mut channel_0 = ndsp.channel(0)?; /// /// channel_0.set_paused(true); /// /// // The channel is paused. /// assert!(channel_0.is_paused()); /// # /// # Ok(()) /// # } /// ``` #[doc(alias = "ndspChnSetPaused")] pub fn set_paused(&mut self, state: bool) { unsafe { ctru_sys::ndspChnSetPaused(self.id.into(), state) }; } /// Set the channel's output format. /// /// Change this setting based on the used wave's format. /// /// # Example /// /// ```no_run /// # use std::error::Error; /// # fn main() -> Result<(), Box<dyn Error>> { /// # /// use ctru::services::ndsp::{AudioFormat, Ndsp}; /// let ndsp = Ndsp::new()?; /// let mut channel_0 = ndsp.channel(0)?; /// /// // Use the PCM16 interleaved dual-channel audio format. /// channel_0.set_format(AudioFormat::PCM16Stereo); /// # /// # Ok(()) /// # } /// ``` // TODO: Channels treat all waves as equal and do not read their format when playing them. Another good reason to re-write the service. #[doc(alias = "ndspChnSetFormat")] pub fn set_format(&mut self, format: AudioFormat) { unsafe { ctru_sys::ndspChnSetFormat(self.id.into(), format.into()) }; } /// Set the channel's interpolation mode. /// /// # Example /// /// ```no_run /// # use std::error::Error; /// # fn main() -> Result<(), Box<dyn Error>> { /// # /// use ctru::services::ndsp::{InterpolationType, Ndsp}; /// let ndsp = Ndsp::new()?; /// let mut channel_0 = ndsp.channel(0)?; /// /// // Use linear interpolation within frames. /// channel_0.set_interpolation(InterpolationType::Linear); /// # /// # Ok(()) /// # } /// ``` #[doc(alias = "ndspChnSetInterp")] pub fn set_interpolation(&mut self, interp_type: InterpolationType) { unsafe { ctru_sys::ndspChnSetInterp(self.id.into(), interp_type.into()) }; } /// Set the channel's volume mix. /// /// Look at [`AudioMix`] for more information on the volume mix. /// /// # Example /// /// ```no_run /// # use std::error::Error; /// # use std::default::Default; /// # fn main() -> Result<(), Box<dyn Error>> { /// # /// use ctru::services::ndsp::{AudioMix, Ndsp}; /// let ndsp = Ndsp::new()?; /// let mut channel_0 = ndsp.channel(0)?; /// /// // Front-left and front-right channel maxed. /// channel_0.set_mix(&AudioMix::default()); /// # /// # Ok(()) /// # } /// ``` #[doc(alias = "ndspChnSetMix")] pub fn set_mix(&mut self, mix: &AudioMix) { unsafe { ctru_sys::ndspChnSetMix(self.id.into(), mix.as_raw().as_ptr().cast_mut()) } } /// Set the channel's rate of sampling in hertz. /// /// # Example /// /// ```no_run /// # use std::error::Error; /// # fn main() -> Result<(), Box<dyn Error>> { /// # /// use ctru::services::ndsp::Ndsp; /// let ndsp = Ndsp::new()?; /// let mut channel_0 = ndsp.channel(0)?; /// /// // Standard CD sample rate. (44100 Hz) /// channel_0.set_sample_rate(44100.); /// # /// # Ok(()) /// # } /// ``` #[doc(alias = "ndspChnSetRate")] pub fn set_sample_rate(&mut self, rate: f32) { unsafe { ctru_sys::ndspChnSetRate(self.id.into(), rate) }; } // TODO: wrap ADPCM format helpers. /// Clear the wave buffer queue and stop playback. /// /// # Example /// /// ```no_run /// # use std::error::Error; /// # fn main() -> Result<(), Box<dyn Error>> { /// # /// use ctru::services::ndsp::Ndsp; /// let ndsp = Ndsp::new()?; /// let mut channel_0 = ndsp.channel(0)?; /// /// // Clear the audio queue and stop playback. /// channel_0.clear_queue(); /// # /// # Ok(()) /// # } /// ``` #[doc(alias = "ndspChnWaveBufClear")] pub fn clear_queue(&mut self) { unsafe { ctru_sys::ndspChnWaveBufClear(self.id.into()) }; } /// Add a wave buffer to the channel's queue. /// If there are no other buffers in queue, playback for this buffer will start. /// /// # Warning /// /// `libctru` expects the user to manually keep the info data (in this case [`Wave`]) alive during playback. /// To ensure safety, checks within [`Wave`] will clear the whole channel queue if any queued [`Wave`] is dropped prematurely. /// /// # Example /// /// ```no_run /// # #![feature(allocator_api)] /// # use std::error::Error; /// # fn main() -> Result<(), Box<dyn Error>> { /// # /// # use ctru::linear::LinearAllocator; /// use ctru::services::ndsp::{AudioFormat, Ndsp, wave::Wave}; /// let ndsp = Ndsp::new()?; /// let mut channel_0 = ndsp.channel(0)?; /// /// # let _audio_data = Box::new_in([0u8; 96], LinearAllocator); /// /// // Provide your own audio data. /// let mut wave = Wave::new(_audio_data, AudioFormat::PCM16Stereo, false); /// /// // Clear the audio queue and stop playback. /// channel_0.queue_wave(&mut wave); /// # /// # Ok(()) /// # } /// ``` // TODO: Find a better way to handle the wave lifetime problem. // These "alive wave" shenanigans are the most substantial reason why I'd like to fully re-write this service in Rust. #[doc(alias = "ndspChnWaveBufAdd")] pub fn queue_wave(&mut self, wave: &mut Wave) -> std::result::Result<(), NdspError> { match wave.status() { Status::Playing | Status::Queued => return Err(NdspError::WaveBusy(self.id)), _ => (), } wave.set_channel(self.id); unsafe { ctru_sys::ndspChnWaveBufAdd(self.id.into(), &mut wave.raw_data) }; Ok(()) } } /// Functions to handle audio filtering. /// /// Refer to [`libctru`](https://libctru.devkitpro.org/channel_8h.html#a1da3b363c2edfd318c92276b527daae6) for more info. impl Channel<'_> { /// Enables/disables monopole filters. #[doc(alias = "ndspChnIirMonoSetEnable")] pub fn iir_mono_set_enabled(&mut self, enable: bool) { unsafe { ctru_sys::ndspChnIirMonoSetEnable(self.id.into(), enable) }; } /// Set the monopole to be a high pass filter. /// /// # Notes /// /// This is a lower quality filter than the Biquad alternative. #[doc(alias = "ndspChnIirMonoSetParamsHighPassFilter")] pub fn iir_mono_set_params_high_pass_filter(&mut self, cut_off_freq: f32) { unsafe { ctru_sys::ndspChnIirMonoSetParamsHighPassFilter(self.id.into(), cut_off_freq) }; } /// Set the monopole to be a low pass filter. /// /// # Notes /// /// This is a lower quality filter than the Biquad alternative. #[doc(alias = "ndspChnIirMonoSetParamsLowPassFilter")] pub fn iir_mono_set_params_low_pass_filter(&mut self, cut_off_freq: f32) { unsafe { ctru_sys::ndspChnIirMonoSetParamsLowPassFilter(self.id.into(), cut_off_freq) }; } /// Enables/disables biquad filters. #[doc(alias = "ndspChnIirBiquadSetEnable")] pub fn iir_biquad_set_enabled(&mut self, enable: bool) { unsafe { ctru_sys::ndspChnIirBiquadSetEnable(self.id.into(), enable) }; } /// Set the biquad to be a high pass filter. #[doc(alias = "ndspChnIirBiquadSetParamsHighPassFilter")] pub fn iir_biquad_set_params_high_pass_filter(&mut self, cut_off_freq: f32, quality: f32) { unsafe { ctru_sys::ndspChnIirBiquadSetParamsHighPassFilter(self.id.into(), cut_off_freq, quality) }; } /// Set the biquad to be a low pass filter. #[doc(alias = "ndspChnIirBiquadSetParamsLowPassFilter")] pub fn iir_biquad_set_params_low_pass_filter(&mut self, cut_off_freq: f32, quality: f32) { unsafe { ctru_sys::ndspChnIirBiquadSetParamsLowPassFilter(self.id.into(), cut_off_freq, quality) }; } /// Set the biquad to be a notch filter. #[doc(alias = "ndspChnIirBiquadSetParamsNotchFilter")] pub fn iir_biquad_set_params_notch_filter(&mut self, notch_freq: f32, quality: f32) { unsafe { ctru_sys::ndspChnIirBiquadSetParamsNotchFilter(self.id.into(), notch_freq, quality) }; } /// Set the biquad to be a band pass filter. #[doc(alias = "ndspChnIirBiquadSetParamsBandPassFilter")] pub fn iir_biquad_set_params_band_pass_filter(&mut self, mid_freq: f32, quality: f32) { unsafe { ctru_sys::ndspChnIirBiquadSetParamsBandPassFilter(self.id.into(), mid_freq, quality) }; } /// Set the biquad to be a peaking equalizer. #[doc(alias = "ndspChnIirBiquadSetParamsPeakingEqualizer")] pub fn iir_biquad_set_params_peaking_equalizer( &mut self, central_freq: f32, quality: f32, gain: f32, ) { unsafe { ctru_sys::ndspChnIirBiquadSetParamsPeakingEqualizer( self.id.into(), central_freq, quality, gain, ) }; } } impl AudioFormat { /// Returns the amount of bytes needed to store one sample /// /// # Example /// /// - 8 bit mono formats return 1 (byte) /// - 16 bit stereo (dual-channel) formats return 4 (bytes) pub const fn size(self) -> usize { match self { Self::PCM8Mono => 1, Self::PCM16Mono | Self::PCM8Stereo => 2, Self::PCM16Stereo => 4, } } } impl AudioMix { /// Creates a new [`AudioMix`] with all volumes set to 0. pub fn zeroed() -> Self { Self { raw: [0.; 12] } } /// Returns a reference to the raw data. pub fn as_raw(&self) -> &[f32; 12] { &self.raw } /// Returns a mutable reference to the raw data. pub fn as_raw_mut(&mut self) -> &mut [f32; 12] { &mut self.raw } /// Returns the values set for the "front" volume mix (left and right channel). pub fn front(&self) -> (f32, f32) { (self.raw[0], self.raw[1]) } /// Returns the values set for the "back" volume mix (left and right channel). pub fn back(&self) -> (f32, f32) { (self.raw[2], self.raw[3]) } /// Returns the values set for the "front" volume mix (left and right channel) for the specified auxiliary output device (either 0 or 1). pub fn aux_front(&self, id: usize) -> (f32, f32) { if id > 1 { panic!("invalid auxiliary output device index") } let index = 4 + id * 4; (self.raw[index], self.raw[index + 1]) } /// Returns the values set for the "back" volume mix (left and right channel) for the specified auxiliary output device (either 0 or 1). pub fn aux_back(&self, id: usize) -> (f32, f32) { if id > 1 { panic!("invalid auxiliary output device index") } let index = 6 + id * 4; (self.raw[index], self.raw[index + 1]) } /// Set the values for the "front" volume mix (left and right channel). /// /// # Notes /// /// [`Channel`] will normalize the mix values to be within 0 and 1. /// However, an [`AudioMix`] instance with larger/smaller values is valid. pub fn set_front(&mut self, left: f32, right: f32) { self.raw[0] = left; self.raw[1] = right; } /// Set the values for the "back" volume mix (left and right channel). /// /// # Notes /// /// [`Channel`] will normalize the mix values to be within 0 and 1. /// However, an [`AudioMix`] instance with larger/smaller values is valid. pub fn set_back(&mut self, left: f32, right: f32) { self.raw[2] = left; self.raw[3] = right; } /// Set the values for the "front" volume mix (left and right channel) for the specified auxiliary output device (either 0 or 1). /// /// # Notes /// /// [`Channel`] will normalize the mix values to be within 0 and 1. /// However, an [`AudioMix`] instance with larger/smaller values is valid. pub fn set_aux_front(&mut self, left: f32, right: f32, id: usize) { if id > 1 { panic!("invalid auxiliary output device index") } let index = 4 + id * 4; self.raw[index] = left; self.raw[index + 1] = right; } /// Set the values for the "back" volume mix (left and right channel) for the specified auxiliary output device (either 0 or 1). /// /// # Notes /// /// [`Channel`] will normalize the mix values to be within 0 and 1. /// However, an [`AudioMix`] instance with larger/smaller values is valid. pub fn set_aux_back(&mut self, left: f32, right: f32, id: usize) { if id > 1 { panic!("invalid auxiliary output device index") } let index = 6 + id * 4; self.raw[index] = left; self.raw[index + 1] = right; } } impl Default for AudioMix { /// Returns an [`AudioMix`] object with "front left" and "front right" volumes set to 100%, and all other volumes set to 0%. fn default() -> Self { let mut mix = AudioMix::zeroed(); mix.set_front(1.0, 1.0); mix } } impl From<[f32; 12]> for AudioMix { fn from(value: [f32; 12]) -> Self { Self { raw: value } } } impl fmt::Display for NdspError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Self::InvalidChannel(id) => write!(f, "audio Channel with ID {id} doesn't exist. Valid channels have an ID between 0 and 23"), Self::ChannelAlreadyInUse(id) => write!(f, "audio Channel with ID {id} is already being used. Drop the other instance if you want to use it here"), Self::WaveBusy(id) => write!(f, "the selected Wave is busy playing on channel {id}"), Self::SampleCountOutOfBounds(samples_requested, max_samples) => write!(f, "the sample count requested is too big (requested = {samples_requested}, maximum = {max_samples})"), } } } impl error::Error for NdspError {} impl Drop for Ndsp { #[doc(alias = "ndspExit")] fn drop(&mut self) { for i in 0..NUMBER_OF_CHANNELS { self.channel(i).unwrap().reset(); } } } from_impl!(InterpolationType, ctru_sys::ndspInterpType); from_impl!(OutputMode, ctru_sys::ndspOutputMode); from_impl!(AudioFormat, u16);
#[macro_use] extern crate nickel; extern crate rustc_serialize; use nickel::Nickel; use std::env; mod fakedb; mod router; mod customer; mod eligibility; /// Simple function to get the "PORT" environment variable, or default to 6767. /// The method will panic if the variable exists but is not an unsigned int. fn get_server_port() -> u16 { match env::var("PORT") { Ok(s) => s.parse().unwrap(), Err(_) => 6767 } } fn main() { // initialize server let mut server = Nickel::new(); // use the routes provided by the router module server.utilize(router::get_router()); // start listening for connections server.listen(("0.0.0.0", get_server_port())); }
use std::error::Error; use crate::command::exec; use crate::commands::Command; use crate::show_info; pub struct InitOpt { git: String, } // init repo with git (optional) impl InitOpt { pub fn new(git: String) -> InitOpt { InitOpt { git } } } impl Command for InitOpt { fn run(&self) -> Result<(), Box<dyn Error>> { let git = self.git.trim(); show_info!("Initializing with git repository => {}", git); if git.len() > 0 { let args = vec![String::from("remote"), String::from("-v")]; let output = exec(String::from("git"), args).unwrap(); let lines = String::from_utf8(output.stdout)?; show_info!("Output: {}", lines); } Ok(()) } }
use input_i_scanner::InputIScanner; fn main() { let stdin = std::io::stdin(); let mut _i_i = InputIScanner::from(stdin.lock()); macro_rules! scan { (($($t: ty),+)) => { ($(scan!($t)),+) }; ($t: ty) => { _i_i.scan::<$t>() as $t }; (($($t: ty),+); $n: expr) => { std::iter::repeat_with(|| scan!(($($t),+))).take($n).collect::<Vec<_>>() }; ($t: ty; $n: expr) => { std::iter::repeat_with(|| scan!($t)).take($n).collect::<Vec<_>>() }; } let t = scan!(usize); for _ in 0..t { let n = scan!(usize); solve(n); } } fn solve(n: usize) { // n 0 // n-1 1*0 // n-2 2*1 // n-3 3*2 // ... // 1 (n-1)*(n-2) // n (n-1)*(n-2) // n-1 (n-2)*(n-3) // ... // 2 1*0 // 1 0 // let ans = (1..n).map(|i| i * (i - 1)).sum::<usize>() * 2; let ans = ((n - 1) * ((n - 1) + 1) * ((n - 1) * 2 + 1) / 6 - (n - 1) * n / 2) * 2; println!("{}", ans); }
pub struct Solution; impl Solution { pub fn search(nums: Vec<i32>, target: i32) -> i32 { let n = nums.len(); if n == 0 { return -1; } let (mut a, mut b) = if nums[0] > nums[n - 1] { let mut a = 0; let mut b = n - 1; while a + 1 < b { let c = (a + b) / 2; if nums[c] > nums[a] { a = c; } else { b = c; } } if nums[0] <= target { (0, a) } else { (b, n - 1) } } else { (0, n - 1) }; if nums[a] == target { return a as i32; } if nums[b] == target { return b as i32; } if nums[a] > target { return -1; } if nums[b] < target { return -1; } while a + 1 < b { let c = (a + b) / 2; if nums[c] == target { return c as i32; } if nums[c] < target { a = c; } else { b = c; } } return -1; } } #[test] fn test0033() { assert_eq!(Solution::search(vec![4, 5, 6, 7, 0, 1, 2], 0), 4); assert_eq!(Solution::search(vec![4, 5, 6, 7, 0, 1, 2], 3), -1); assert_eq!(Solution::search(vec![1, 3, 5], 3), 1); }
#[allow(unused_imports)] use proconio::{marker::*, *}; #[allow(unused_imports)] use std::{cmp::Ordering, convert::TryInto}; #[fastout] fn main() { input! { t: i32, n: i32, range: [(i32, i32); n], } // diff[0] = 0 // diff[i] = 時刻 i-1 から時刻 i の従業員の増減 (i > 0) let mut diff = vec![0; (t + 2).try_into().unwrap()]; for (l, r) in range { diff[l as usize] += 1; diff[r as usize] -= 1; } let mut w = 0; for t in 0..t { w += diff[t as usize]; println!("{}", w); } }
extern crate prometheus_exposition_format_rs; use prometheus_exposition_format_rs::parse_complete; use prometheus_exposition_format_rs::types::{Err, Metric}; use std::fs; const PATH: &str = "fixtures"; fn read_fixture(s: &str) -> Result<Vec<Metric>, Err> { parse_complete(&fs::read_to_string(s).unwrap()) } fn assert_file_ok(s: &str) -> Vec<Metric> { let res = read_fixture(s); assert!(res.is_ok(), "Failed to read file '{}' got: \n{:?}", s, res); res.unwrap() } fn assert_file_nok(s: &str) -> Err { let res = read_fixture(s); assert!( res.is_err(), "Succeeded to read file '{}' when we shouldn't got: \n{:?}", s, res ); res.unwrap_err() } fn files_with_prefix(prefix: &str) -> Vec<String> { // This should look simpler // It looks inside the fixture folder and filters files that ends with *.prom and start with a prefix fs::read_dir(PATH) .unwrap() .into_iter() .map(|p| p.unwrap().path()) .filter(|p| p.extension().map_or(false, |s| s == "prom")) .filter(|f| { f.file_name() .map(|s| s.to_str()) .flatten() .unwrap() .starts_with(prefix) }) .map(|f| f.to_str().unwrap().to_string()) .collect() } #[test] fn test_ok_fixture_files() { for file_name in files_with_prefix("ok_") { assert_file_ok(&file_name); } } #[test] fn test_nok_fixture_files() { for file_name in files_with_prefix("nok_") { assert_file_nok(&file_name); } }
use failure::Fail; #[derive(Debug, Fail)] pub enum ErrorKind { #[fail(display = "TraceNotFound")] TraceNotFound, }
extern crate nalgebra_glm as glm; use std::fs::File; use std::io::Read; use std::sync::{Arc, Mutex, RwLock}; use std::thread; use std::{f32::consts, mem, os::raw::c_void, ptr}; // New import for Exercise 3 mod mesh; mod scene_graph; mod toolbox; mod shader; mod util; use glutin::event::{ DeviceEvent, ElementState::{Pressed, Released}, Event, KeyboardInput, VirtualKeyCode::{self, *}, WindowEvent, }; use glutin::event_loop::ControlFlow; use scene_graph::SceneNode; const SCREEN_W: u32 = 800; const SCREEN_H: u32 = 600; // == // Helper functions to make interacting with OpenGL a little bit prettier. You *WILL* need these! // == // // The names should be pretty self explanatory fn byte_size_of_array<T>(val: &[T]) -> isize { std::mem::size_of_val(&val[..]) as isize } // Get the OpenGL-compatible pointer to an arbitrary array of numbers fn pointer_to_array<T>(val: &[T]) -> *const c_void { &val[0] as *const T as *const c_void } // Get the size of the given type in bytes fn size_of<T>() -> i32 { mem::size_of::<T>() as i32 } // Get an offset in bytes for n units of type T fn offset<T>(n: u32) -> *const c_void { (n * mem::size_of::<T>() as u32) as *const T as *const c_void } fn read_triangles_from_file() -> Result<Vec<f32>, ()> { // Takes in an arbitraray amount of trinagles from a file let mut vertices: Vec<f32>; match File::open(".\\src\\triangles.txt") { Ok(mut file) => { let mut content = String::new(); // Read all the file content into a variable file.read_to_string(&mut content).unwrap(); vertices = content .split(" ") .map(|x| x.parse::<f32>().unwrap()) .collect(); println!("{}", content); Ok(vertices) } // Error handling Err(error) => { println!("Error message: {}", error); std::process::exit(1); } } } // Get a null pointer (equivalent to an offset of 0) // ptr::null() // let p = 0 as *const c_void // == // Modify and complete the function below for the first task unsafe fn init_vao( vertices: &Vec<f32>, indices: &Vec<u32>, colors: &Vec<f32>, normals: &Vec<f32>, ) -> u32 { // Returns the ID of the newly instantiated vertex array object upon its creation // VAO - way to bind vbo with spesification let mut vao: u32 = 0; // Create gl::GenVertexArrays(1, &mut vao); // Generate gl::BindVertexArray(vao); // Bind // VBO - buffer for the vertices/positions let mut vbo: u32 = 0; gl::GenBuffers(1, &mut vbo); // creates buffer, generates an id for the vertex buffer - stored on vram gl::BindBuffer(gl::ARRAY_BUFFER, vbo); // Binding is sort of like creating layers in photoshop gl::BufferData( gl::ARRAY_BUFFER, byte_size_of_array(&vertices), pointer_to_array(&vertices), gl::STATIC_DRAW, ); // Vaa = Vertex attrib array gl::VertexAttribPointer(0, 3, gl::FLOAT, gl::FALSE, 0, 0 as *const c_void); gl::EnableVertexAttribArray(0); // CBO - vbo for the color buffer, RGBA let mut cbo: u32 = 1; gl::GenBuffers(1, &mut cbo); gl::BindBuffer(gl::ARRAY_BUFFER, cbo); gl::BufferData( gl::ARRAY_BUFFER, byte_size_of_array(&colors), pointer_to_array(&colors), gl::STATIC_DRAW, ); // 2nd attribute buffer is for colors gl::VertexAttribPointer( 1, 4, gl::FLOAT, gl::FALSE, size_of::<f32>() * 4, 0 as *const c_void, ); gl::EnableVertexAttribArray(1); // NBO - vbo for the normal buffer let mut nbo: u32 = 1; gl::GenBuffers(1, &mut nbo); gl::BindBuffer(gl::ARRAY_BUFFER, nbo); gl::BufferData( gl::ARRAY_BUFFER, byte_size_of_array(&normals), pointer_to_array(&normals), gl::STATIC_DRAW, ); // 3rd attribute buffer is for normals gl::VertexAttribPointer( 2, 3, gl::FLOAT, gl::FALSE, size_of::<f32>() * 3, 0 as *const c_void, ); gl::EnableVertexAttribArray(2); // Index buffer object = connect the dots, multiple usecases for same vertices. let mut ibo: u32 = 0; gl::GenBuffers(1, &mut ibo); gl::BindBuffer(gl::ELEMENT_ARRAY_BUFFER, ibo); gl::BufferData( gl::ELEMENT_ARRAY_BUFFER, byte_size_of_array(&indices), pointer_to_array(&indices), gl::STATIC_DRAW, ); vao } unsafe fn draw_scene( node: &SceneNode, view_projection_matrix: &glm::Mat4, mvp_loc: i32, model_mat_loc: i32, ) { // Check if node is drawable, Set uniforms, Draw // Check that we have a vao attached to the node if node.index_count > 0 { let new_trans_mat = view_projection_matrix * node.current_transformation_matrix; gl::UniformMatrix4fv(mvp_loc, 1, gl::FALSE, new_trans_mat.as_ptr()); gl::UniformMatrix4fv( model_mat_loc, 1, gl::FALSE, node.current_transformation_matrix.as_ptr(), ); gl::BindVertexArray(node.vao_id); gl::DrawElements( gl::TRIANGLES, node.index_count, // Here we get the amount of indices we need gl::UNSIGNED_INT, ptr::null(), ); } for &child in &node.children { draw_scene(&*child, view_projection_matrix, mvp_loc, model_mat_loc); } } unsafe fn update_node_transformations(node: &mut SceneNode, transformation_so_far: &glm::Mat4) { // Construct the correct transformation matrix // TODO: Find out what to do here? let mut trans: glm::Mat4 = glm::identity(); let pos = glm::translation(&node.position); let scale = glm::scaling(&node.scale); let rot_x = glm::rotation(node.rotation.x, &glm::vec3(1.0, 0.0, 0.0)); let rot_y = glm::rotation(node.rotation.y, &glm::vec3(0.0, 1.0, 0.0)); let rot_z = glm::rotation(node.rotation.z, &glm::vec3(0.0, 0.0, 1.0)); let ref_point_pos = glm::translation(&node.reference_point); let rev_ref_point_pos = glm::translation(&(glm::diagonal3x3(&glm::vec3(-1.0, -1.0, -1.0)) * node.reference_point)); // 1: set ref point to origo trans = rev_ref_point_pos * trans; // 2. rotate trans = rot_x * rot_y * rot_z * trans; // 3. scale trans = scale * trans; // 4. set back to ref point trans = ref_point_pos * trans; // 5. set back to position trans = pos * trans; // Task 3d) node.current_transformation_matrix = transformation_so_far * trans; // Recurse for &child in &node.children { update_node_transformations(&mut *child, &node.current_transformation_matrix); } } fn main() { // Set up the necessary objects to deal with windows and event handling let el = glutin::event_loop::EventLoop::new(); let wb = glutin::window::WindowBuilder::new() .with_title("Gloom-rs") .with_resizable(false) .with_inner_size(glutin::dpi::LogicalSize::new(SCREEN_W, SCREEN_H)); let cb = glutin::ContextBuilder::new().with_vsync(true); let windowed_context = cb.build_windowed(wb, &el).unwrap(); // Uncomment these if you want to use the mouse for controls, but want it to be confined to the screen and/or invisible. // windowed_context.window().set_cursor_grab(true).expect("failed to grab cursor"); // windowed_context.window().set_cursor_visible(false); // Set up a shared vector for keeping track of currently pressed keys let arc_pressed_keys = Arc::new(Mutex::new(Vec::<VirtualKeyCode>::with_capacity(10))); // Make a reference of this vector to send to the render thread let pressed_keys = Arc::clone(&arc_pressed_keys); // Set up shared tuple for tracking mouse movement between frames let arc_mouse_delta = Arc::new(Mutex::new((0f32, 0f32))); // Make a reference of this tuple to send to the render thread let mouse_delta = Arc::clone(&arc_mouse_delta); // Spawn a separate thread for rendering, so event handling doesn't block rendering let render_thread = thread::spawn(move || { // Acquire the OpenGL Context and load the function pointers. This has to be done inside of the rendering thread, because // an active OpenGL context cannot safely traverse a thread boundary let context = unsafe { let c = windowed_context.make_current().unwrap(); gl::load_with(|symbol| c.get_proc_address(symbol) as *const _); c }; // Set up openGL unsafe { gl::Enable(gl::DEPTH_TEST); gl::DepthFunc(gl::LESS); gl::Enable(gl::CULL_FACE); gl::Disable(gl::MULTISAMPLE); gl::Enable(gl::BLEND); gl::BlendFunc(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA); gl::Enable(gl::DEBUG_OUTPUT_SYNCHRONOUS); gl::DebugMessageCallback(Some(util::debug_callback), ptr::null()); // Print some diagnostics println!( "{}: {}", util::get_gl_string(gl::VENDOR), util::get_gl_string(gl::RENDERER) ); println!("OpenGL\t: {}", util::get_gl_string(gl::VERSION)); println!( "GLSL\t: {}", util::get_gl_string(gl::SHADING_LANGUAGE_VERSION) ); } let num_of_helicopters = 5; // VAO IDs let terrain_vao: u32; // task 2a) let mut helicopter_body_vao: Vec<u32> = vec![]; let mut helicopter_door_vao: Vec<u32> = vec![]; let mut helicopter_main_rotor_vao: Vec<u32> = vec![]; let mut helicopter_tail_rotor_vao: Vec<u32> = vec![]; // Models let terrain_mesh = mesh::Terrain::load(".\\resources\\lunarsurface.obj"); let helicopter_mesh = mesh::Helicopter::load(".\\resources\\helicopter.obj"); // == // Set up your VAO here unsafe { terrain_vao = init_vao( &terrain_mesh.vertices, &terrain_mesh.indices, &terrain_mesh.colors, &terrain_mesh.normals, ); // task 6 for i in 0..num_of_helicopters { helicopter_body_vao.push(init_vao( &helicopter_mesh.body.vertices, &helicopter_mesh.body.indices, &helicopter_mesh.body.colors, &helicopter_mesh.body.normals, )); helicopter_main_rotor_vao.push(init_vao( &helicopter_mesh.main_rotor.vertices, &helicopter_mesh.main_rotor.indices, &helicopter_mesh.main_rotor.colors, &helicopter_mesh.main_rotor.normals, )); helicopter_tail_rotor_vao.push(init_vao( &helicopter_mesh.tail_rotor.vertices, &helicopter_mesh.tail_rotor.indices, &helicopter_mesh.tail_rotor.colors, &helicopter_mesh.tail_rotor.normals, )); helicopter_door_vao.push(init_vao( &helicopter_mesh.door.vertices, &helicopter_mesh.door.indices, &helicopter_mesh.door.colors, &helicopter_mesh.door.normals, )); } } // Set up scene graph: task 2b) let mut root_node = SceneNode::new(); let mut terrain_node = SceneNode::from_vao(terrain_vao, terrain_mesh.index_count); let mut helicopter_nodes: Vec<scene_graph::Node> = vec![]; for i in 0..num_of_helicopters { let mut helicopter_body_node = SceneNode::from_vao( helicopter_body_vao[i as usize], helicopter_mesh.body.index_count, ); let mut helicopter_door_node = SceneNode::from_vao( helicopter_door_vao[i as usize], helicopter_mesh.door.index_count, ); let mut helicopter_main_rotor_node = SceneNode::from_vao( helicopter_main_rotor_vao[i as usize], helicopter_mesh.main_rotor.index_count, ); let mut helicopter_tail_rotor_node = SceneNode::from_vao( helicopter_tail_rotor_vao[i as usize], helicopter_mesh.tail_rotor.index_count, ); // 3b) Reference points helicopter_main_rotor_node.reference_point = glm::vec3(0.0, 0.0, 0.0); helicopter_tail_rotor_node.reference_point = glm::vec3(0.35, 2.3, 10.4); // For now I say that every part of the helicopter is dependent of where the body is helicopter_body_node.add_child(&helicopter_door_node); helicopter_body_node.add_child(&helicopter_main_rotor_node); helicopter_body_node.add_child(&helicopter_tail_rotor_node); root_node.add_child(&helicopter_body_node); // add main node of ach helicopter ot the vector of all of them helicopter_nodes.push(helicopter_body_node); } // Connect to parent root_node.add_child(&terrain_node); // Setup uniform locations let shdr: shader::Shader; let mvp_loc: i32; let model_mat_loc: i32; let camera_pos_loc: i32; unsafe { // Creates shader. using multiple attaches since they return self, and link them all together at the end shdr = shader::ShaderBuilder::new() .attach_file(".\\shaders\\simple.vert") .attach_file(".\\shaders\\simple.frag") .link(); // Get uniform locations mvp_loc = shdr.get_uniform_location("MVP"); model_mat_loc = shdr.get_uniform_location("modelMatrix"); camera_pos_loc = shdr.get_uniform_location("cameraPosition"); shdr.activate(); } // Used to demonstrate keyboard handling -- feel free to remove let mut _arbitrary_number = 0.0; let first_frame_time = std::time::Instant::now(); let mut last_frame_time = first_frame_time; // The main rendering loop let persp_mat: glm::Mat4 = glm::perspective((SCREEN_H as f32) / (SCREEN_W as f32), 90.0, 1.0, 1000.0); // let persp_trans: glm::Mat4 = glm::translation(&glm::vec3(0.0, 0.0, -2.0)); let mut proj: glm::Mat4 = persp_mat; let model: glm::Mat4 = glm::identity(); let mut camera_pos: Vec<f32> = vec![0.0, 0.0, 0.0]; let mut rot_x = 0.0; let mut rot_y = 0.0; let mut trans_x = 0.0; let mut trans_y = 0.0; let mut trans_z = -4.0; let rot_step: f32 = 2.0; let trans_step: f32 = 0.1; let mut view: glm::Mat4 = glm::identity(); loop { let now = std::time::Instant::now(); let elapsed = now.duration_since(first_frame_time).as_secs_f32(); let delta_time = now.duration_since(last_frame_time).as_secs_f32(); last_frame_time = now; // Handle keyboard input if let Ok(keys) = pressed_keys.lock() { for key in keys.iter() { // I'm using WASDEQ to handle inputs // Also use arrowkeys for rotation match key { VirtualKeyCode::W => { trans_z += trans_step; } VirtualKeyCode::A => { trans_x += trans_step; } VirtualKeyCode::S => { trans_z -= trans_step; } VirtualKeyCode::D => { trans_x -= trans_step; } VirtualKeyCode::E => { trans_y -= trans_step; } VirtualKeyCode::Q => { trans_y += trans_step; } VirtualKeyCode::R => { // Reset camera view = glm::identity(); } VirtualKeyCode::Up => { rot_x -= rot_step; } VirtualKeyCode::Down => { rot_x += rot_step; } VirtualKeyCode::Left => { rot_y -= rot_step; } VirtualKeyCode::Right => { rot_y += rot_step; } _ => {} } } } // Handle mouse movement. delta contains the x and y movement of the mouse since last frame in pixels if let Ok(mut delta) = mouse_delta.lock() { *delta = (0.0, 0.0); } let trans: glm::Mat4 = glm::translation(&glm::vec3(trans_x, trans_y, trans_z)); let rot: glm::Mat4 = glm::rotation(rot_x.to_radians(), &glm::vec3(1.0, 0.0, 0.0)) * glm::rotation(rot_y.to_radians(), &glm::vec3(0.0, 1.0, 0.0)); let scale: glm::Mat4 = glm::identity(); view = rot * trans * view; camera_pos = vec![view[3], view[7], view[11]]; let mut mod_view = view * model; // Transmat here becomes MVP matrix after getting built up by model, // view ( rotation, translation ), and projection let view_proj_mat = proj * view; // Reset values rot_x = 0.0; rot_y = 0.0; trans_x = 0.0; trans_y = 0.0; trans_z = 0.0; // Heading for animation let heading = toolbox::simple_heading_animation(elapsed); // Description on how to rotate each helicopter through its path for i in 0..num_of_helicopters { let mut curr_helicopter = &mut helicopter_nodes[i as usize]; curr_helicopter.rotation.y = 180.0; curr_helicopter.position = glm::vec3(heading.x + (i as f32) * 30.0, 0.0, heading.z); curr_helicopter.rotation = glm::vec3(heading.roll, heading.yaw, heading.pitch); // Now the order that we pushed the nodes in matters! let mut tail_rotor = curr_helicopter.get_child(2); // tail rotor is last one to be pushed tail_rotor.rotation.x = 15.0 * elapsed; let mut main_rotor = curr_helicopter.get_child(1); main_rotor.rotation.y = 10.0 * elapsed; let mut door = curr_helicopter.get_child(0); } unsafe { gl::ClearColor(0.76862745, 0.71372549, 0.94901961, 1.0); // moon raker, full opacity gl::Clear(gl::COLOR_BUFFER_BIT | gl::DEPTH_BUFFER_BIT); shdr.activate(); gl::Uniform3f(camera_pos_loc, camera_pos[0], camera_pos[1], camera_pos[2]); // Remember to update before we draw! update_node_transformations(&mut root_node, &glm::identity()); draw_scene(&root_node, &view_proj_mat, mvp_loc, model_mat_loc); } context.swap_buffers().unwrap(); } }); // Keep track of the health of the rendering thread let render_thread_healthy = Arc::new(RwLock::new(true)); let render_thread_watchdog = Arc::clone(&render_thread_healthy); thread::spawn(move || { if !render_thread.join().is_ok() { if let Ok(mut health) = render_thread_watchdog.write() { println!("Render thread panicked!"); *health = false; } } }); // Start the event loop -- This is where window events get handled el.run(move |event, _, control_flow| { *control_flow = ControlFlow::Wait; // Terminate program if render thread panics if let Ok(health) = render_thread_healthy.read() { if *health == false { *control_flow = ControlFlow::Exit; } } match event { Event::WindowEvent { event: WindowEvent::CloseRequested, .. } => { *control_flow = ControlFlow::Exit; } // Keep track of currently pressed keys to send to the rendering thread Event::WindowEvent { event: WindowEvent::KeyboardInput { input: KeyboardInput { state: key_state, virtual_keycode: Some(keycode), .. }, .. }, .. } => { if let Ok(mut keys) = arc_pressed_keys.lock() { match key_state { Released => { if keys.contains(&keycode) { let i = keys.iter().position(|&k| k == keycode).unwrap(); keys.remove(i); } } Pressed => { if !keys.contains(&keycode) { keys.push(keycode); } } } } // Handle escape separately match keycode { Escape => { *control_flow = ControlFlow::Exit; } _ => {} } } Event::DeviceEvent { event: DeviceEvent::MouseMotion { delta }, .. } => { // Accumulate mouse movement if let Ok(mut position) = arc_mouse_delta.lock() { *position = (position.0 + delta.0 as f32, position.1 + delta.1 as f32); } } _ => {} } }); }
// cargo-deps: boolinator="=0.1.0" // You can also leave off the version number, in which case, it's assumed // to be "*". Also, the `cargo-deps` comment *must* be a single-line // comment, and it *must* be the first thing in the file, after the // hashbang. extern crate boolinator; use boolinator::Boolinator; fn main() { println!("--output--"); println!("{:?}", true.as_some(1)); }
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtCore/qpoint.h // dst-file: /src/core/qpoint.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block begin => // <= main block end // use block begin => use std::ops::Deref; // use super::qpoint::QPoint; // 773 // <= use block end // ext block begin => // #[link(name = "Qt5Core")] // #[link(name = "Qt5Gui")] // #[link(name = "Qt5Widgets")] // #[link(name = "QtInline")] extern { fn QPoint_Class_Size() -> c_int; // proto: int & QPoint::ry(); fn C_ZN6QPoint2ryEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: static int QPoint::dotProduct(const QPoint & p1, const QPoint & p2); fn C_ZN6QPoint10dotProductERKS_S1_(arg0: *mut c_void, arg1: *mut c_void) -> c_int; // proto: int QPoint::x(); fn C_ZNK6QPoint1xEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QPoint::QPoint(int xpos, int ypos); fn C_ZN6QPointC2Eii(arg0: c_int, arg1: c_int) -> u64; // proto: int QPoint::y(); fn C_ZNK6QPoint1yEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QPoint::setX(int x); fn C_ZN6QPoint4setXEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: bool QPoint::isNull(); fn C_ZNK6QPoint6isNullEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: void QPoint::QPoint(); fn C_ZN6QPointC2Ev() -> u64; // proto: void QPoint::setY(int y); fn C_ZN6QPoint4setYEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: int & QPoint::rx(); fn C_ZN6QPoint2rxEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: int QPoint::manhattanLength(); fn C_ZNK6QPoint15manhattanLengthEv(qthis: u64 /* *mut c_void*/) -> c_int; fn QPointF_Class_Size() -> c_int; // proto: void QPointF::QPointF(qreal xpos, qreal ypos); fn C_ZN7QPointFC2Edd(arg0: c_double, arg1: c_double) -> u64; // proto: void QPointF::QPointF(); fn C_ZN7QPointFC2Ev() -> u64; // proto: qreal QPointF::manhattanLength(); fn C_ZNK7QPointF15manhattanLengthEv(qthis: u64 /* *mut c_void*/) -> c_double; // proto: QPoint QPointF::toPoint(); fn C_ZNK7QPointF7toPointEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: qreal & QPointF::rx(); fn C_ZN7QPointF2rxEv(qthis: u64 /* *mut c_void*/) -> c_double; // proto: qreal QPointF::y(); fn C_ZNK7QPointF1yEv(qthis: u64 /* *mut c_void*/) -> c_double; // proto: bool QPointF::isNull(); fn C_ZNK7QPointF6isNullEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: qreal QPointF::x(); fn C_ZNK7QPointF1xEv(qthis: u64 /* *mut c_void*/) -> c_double; // proto: void QPointF::QPointF(const QPoint & p); fn C_ZN7QPointFC2ERK6QPoint(arg0: *mut c_void) -> u64; // proto: void QPointF::setX(qreal x); fn C_ZN7QPointF4setXEd(qthis: u64 /* *mut c_void*/, arg0: c_double); // proto: qreal & QPointF::ry(); fn C_ZN7QPointF2ryEv(qthis: u64 /* *mut c_void*/) -> c_double; // proto: static qreal QPointF::dotProduct(const QPointF & p1, const QPointF & p2); fn C_ZN7QPointF10dotProductERKS_S1_(arg0: *mut c_void, arg1: *mut c_void) -> c_double; // proto: void QPointF::setY(qreal y); fn C_ZN7QPointF4setYEd(qthis: u64 /* *mut c_void*/, arg0: c_double); } // <= ext block end // body block begin => // class sizeof(QPoint)=8 #[derive(Default)] pub struct QPoint { // qbase: None, pub qclsinst: u64 /* *mut c_void*/, } // class sizeof(QPointF)=16 #[derive(Default)] pub struct QPointF { // qbase: None, pub qclsinst: u64 /* *mut c_void*/, } impl /*struct*/ QPoint { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QPoint { return QPoint{qclsinst: qthis, ..Default::default()}; } } // proto: int & QPoint::ry(); impl /*struct*/ QPoint { pub fn ry<RetType, T: QPoint_ry<RetType>>(& self, overload_args: T) -> RetType { return overload_args.ry(self); // return 1; } } pub trait QPoint_ry<RetType> { fn ry(self , rsthis: & QPoint) -> RetType; } // proto: int & QPoint::ry(); impl<'a> /*trait*/ QPoint_ry<i32> for () { fn ry(self , rsthis: & QPoint) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN6QPoint2ryEv()}; let mut ret = unsafe {C_ZN6QPoint2ryEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: static int QPoint::dotProduct(const QPoint & p1, const QPoint & p2); impl /*struct*/ QPoint { pub fn dotProduct_s<RetType, T: QPoint_dotProduct_s<RetType>>( overload_args: T) -> RetType { return overload_args.dotProduct_s(); // return 1; } } pub trait QPoint_dotProduct_s<RetType> { fn dotProduct_s(self ) -> RetType; } // proto: static int QPoint::dotProduct(const QPoint & p1, const QPoint & p2); impl<'a> /*trait*/ QPoint_dotProduct_s<i32> for (&'a QPoint, &'a QPoint) { fn dotProduct_s(self ) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN6QPoint10dotProductERKS_S1_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN6QPoint10dotProductERKS_S1_(arg0, arg1)}; return ret as i32; // 1 // return 1; } } // proto: int QPoint::x(); impl /*struct*/ QPoint { pub fn x<RetType, T: QPoint_x<RetType>>(& self, overload_args: T) -> RetType { return overload_args.x(self); // return 1; } } pub trait QPoint_x<RetType> { fn x(self , rsthis: & QPoint) -> RetType; } // proto: int QPoint::x(); impl<'a> /*trait*/ QPoint_x<i32> for () { fn x(self , rsthis: & QPoint) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK6QPoint1xEv()}; let mut ret = unsafe {C_ZNK6QPoint1xEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QPoint::QPoint(int xpos, int ypos); impl /*struct*/ QPoint { pub fn new<T: QPoint_new>(value: T) -> QPoint { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QPoint_new { fn new(self) -> QPoint; } // proto: void QPoint::QPoint(int xpos, int ypos); impl<'a> /*trait*/ QPoint_new for (i32, i32) { fn new(self) -> QPoint { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN6QPointC2Eii()}; let ctysz: c_int = unsafe{QPoint_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let qthis: u64 = unsafe {C_ZN6QPointC2Eii(arg0, arg1)}; let rsthis = QPoint{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: int QPoint::y(); impl /*struct*/ QPoint { pub fn y<RetType, T: QPoint_y<RetType>>(& self, overload_args: T) -> RetType { return overload_args.y(self); // return 1; } } pub trait QPoint_y<RetType> { fn y(self , rsthis: & QPoint) -> RetType; } // proto: int QPoint::y(); impl<'a> /*trait*/ QPoint_y<i32> for () { fn y(self , rsthis: & QPoint) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK6QPoint1yEv()}; let mut ret = unsafe {C_ZNK6QPoint1yEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QPoint::setX(int x); impl /*struct*/ QPoint { pub fn setX<RetType, T: QPoint_setX<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setX(self); // return 1; } } pub trait QPoint_setX<RetType> { fn setX(self , rsthis: & QPoint) -> RetType; } // proto: void QPoint::setX(int x); impl<'a> /*trait*/ QPoint_setX<()> for (i32) { fn setX(self , rsthis: & QPoint) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN6QPoint4setXEi()}; let arg0 = self as c_int; unsafe {C_ZN6QPoint4setXEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QPoint::isNull(); impl /*struct*/ QPoint { pub fn isNull<RetType, T: QPoint_isNull<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isNull(self); // return 1; } } pub trait QPoint_isNull<RetType> { fn isNull(self , rsthis: & QPoint) -> RetType; } // proto: bool QPoint::isNull(); impl<'a> /*trait*/ QPoint_isNull<i8> for () { fn isNull(self , rsthis: & QPoint) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK6QPoint6isNullEv()}; let mut ret = unsafe {C_ZNK6QPoint6isNullEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QPoint::QPoint(); impl<'a> /*trait*/ QPoint_new for () { fn new(self) -> QPoint { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN6QPointC2Ev()}; let ctysz: c_int = unsafe{QPoint_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let qthis: u64 = unsafe {C_ZN6QPointC2Ev()}; let rsthis = QPoint{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QPoint::setY(int y); impl /*struct*/ QPoint { pub fn setY<RetType, T: QPoint_setY<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setY(self); // return 1; } } pub trait QPoint_setY<RetType> { fn setY(self , rsthis: & QPoint) -> RetType; } // proto: void QPoint::setY(int y); impl<'a> /*trait*/ QPoint_setY<()> for (i32) { fn setY(self , rsthis: & QPoint) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN6QPoint4setYEi()}; let arg0 = self as c_int; unsafe {C_ZN6QPoint4setYEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int & QPoint::rx(); impl /*struct*/ QPoint { pub fn rx<RetType, T: QPoint_rx<RetType>>(& self, overload_args: T) -> RetType { return overload_args.rx(self); // return 1; } } pub trait QPoint_rx<RetType> { fn rx(self , rsthis: & QPoint) -> RetType; } // proto: int & QPoint::rx(); impl<'a> /*trait*/ QPoint_rx<i32> for () { fn rx(self , rsthis: & QPoint) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN6QPoint2rxEv()}; let mut ret = unsafe {C_ZN6QPoint2rxEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: int QPoint::manhattanLength(); impl /*struct*/ QPoint { pub fn manhattanLength<RetType, T: QPoint_manhattanLength<RetType>>(& self, overload_args: T) -> RetType { return overload_args.manhattanLength(self); // return 1; } } pub trait QPoint_manhattanLength<RetType> { fn manhattanLength(self , rsthis: & QPoint) -> RetType; } // proto: int QPoint::manhattanLength(); impl<'a> /*trait*/ QPoint_manhattanLength<i32> for () { fn manhattanLength(self , rsthis: & QPoint) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK6QPoint15manhattanLengthEv()}; let mut ret = unsafe {C_ZNK6QPoint15manhattanLengthEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } impl /*struct*/ QPointF { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QPointF { return QPointF{qclsinst: qthis, ..Default::default()}; } } // proto: void QPointF::QPointF(qreal xpos, qreal ypos); impl /*struct*/ QPointF { pub fn new<T: QPointF_new>(value: T) -> QPointF { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QPointF_new { fn new(self) -> QPointF; } // proto: void QPointF::QPointF(qreal xpos, qreal ypos); impl<'a> /*trait*/ QPointF_new for (f64, f64) { fn new(self) -> QPointF { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QPointFC2Edd()}; let ctysz: c_int = unsafe{QPointF_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.0 as c_double; let arg1 = self.1 as c_double; let qthis: u64 = unsafe {C_ZN7QPointFC2Edd(arg0, arg1)}; let rsthis = QPointF{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QPointF::QPointF(); impl<'a> /*trait*/ QPointF_new for () { fn new(self) -> QPointF { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QPointFC2Ev()}; let ctysz: c_int = unsafe{QPointF_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let qthis: u64 = unsafe {C_ZN7QPointFC2Ev()}; let rsthis = QPointF{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: qreal QPointF::manhattanLength(); impl /*struct*/ QPointF { pub fn manhattanLength<RetType, T: QPointF_manhattanLength<RetType>>(& self, overload_args: T) -> RetType { return overload_args.manhattanLength(self); // return 1; } } pub trait QPointF_manhattanLength<RetType> { fn manhattanLength(self , rsthis: & QPointF) -> RetType; } // proto: qreal QPointF::manhattanLength(); impl<'a> /*trait*/ QPointF_manhattanLength<f64> for () { fn manhattanLength(self , rsthis: & QPointF) -> f64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QPointF15manhattanLengthEv()}; let mut ret = unsafe {C_ZNK7QPointF15manhattanLengthEv(rsthis.qclsinst)}; return ret as f64; // 1 // return 1; } } // proto: QPoint QPointF::toPoint(); impl /*struct*/ QPointF { pub fn toPoint<RetType, T: QPointF_toPoint<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toPoint(self); // return 1; } } pub trait QPointF_toPoint<RetType> { fn toPoint(self , rsthis: & QPointF) -> RetType; } // proto: QPoint QPointF::toPoint(); impl<'a> /*trait*/ QPointF_toPoint<QPoint> for () { fn toPoint(self , rsthis: & QPointF) -> QPoint { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QPointF7toPointEv()}; let mut ret = unsafe {C_ZNK7QPointF7toPointEv(rsthis.qclsinst)}; let mut ret1 = QPoint::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: qreal & QPointF::rx(); impl /*struct*/ QPointF { pub fn rx<RetType, T: QPointF_rx<RetType>>(& self, overload_args: T) -> RetType { return overload_args.rx(self); // return 1; } } pub trait QPointF_rx<RetType> { fn rx(self , rsthis: & QPointF) -> RetType; } // proto: qreal & QPointF::rx(); impl<'a> /*trait*/ QPointF_rx<f64> for () { fn rx(self , rsthis: & QPointF) -> f64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QPointF2rxEv()}; let mut ret = unsafe {C_ZN7QPointF2rxEv(rsthis.qclsinst)}; return ret as f64; // 1 // return 1; } } // proto: qreal QPointF::y(); impl /*struct*/ QPointF { pub fn y<RetType, T: QPointF_y<RetType>>(& self, overload_args: T) -> RetType { return overload_args.y(self); // return 1; } } pub trait QPointF_y<RetType> { fn y(self , rsthis: & QPointF) -> RetType; } // proto: qreal QPointF::y(); impl<'a> /*trait*/ QPointF_y<f64> for () { fn y(self , rsthis: & QPointF) -> f64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QPointF1yEv()}; let mut ret = unsafe {C_ZNK7QPointF1yEv(rsthis.qclsinst)}; return ret as f64; // 1 // return 1; } } // proto: bool QPointF::isNull(); impl /*struct*/ QPointF { pub fn isNull<RetType, T: QPointF_isNull<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isNull(self); // return 1; } } pub trait QPointF_isNull<RetType> { fn isNull(self , rsthis: & QPointF) -> RetType; } // proto: bool QPointF::isNull(); impl<'a> /*trait*/ QPointF_isNull<i8> for () { fn isNull(self , rsthis: & QPointF) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QPointF6isNullEv()}; let mut ret = unsafe {C_ZNK7QPointF6isNullEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: qreal QPointF::x(); impl /*struct*/ QPointF { pub fn x<RetType, T: QPointF_x<RetType>>(& self, overload_args: T) -> RetType { return overload_args.x(self); // return 1; } } pub trait QPointF_x<RetType> { fn x(self , rsthis: & QPointF) -> RetType; } // proto: qreal QPointF::x(); impl<'a> /*trait*/ QPointF_x<f64> for () { fn x(self , rsthis: & QPointF) -> f64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QPointF1xEv()}; let mut ret = unsafe {C_ZNK7QPointF1xEv(rsthis.qclsinst)}; return ret as f64; // 1 // return 1; } } // proto: void QPointF::QPointF(const QPoint & p); impl<'a> /*trait*/ QPointF_new for (&'a QPoint) { fn new(self) -> QPointF { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QPointFC2ERK6QPoint()}; let ctysz: c_int = unsafe{QPointF_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.qclsinst as *mut c_void; let qthis: u64 = unsafe {C_ZN7QPointFC2ERK6QPoint(arg0)}; let rsthis = QPointF{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QPointF::setX(qreal x); impl /*struct*/ QPointF { pub fn setX<RetType, T: QPointF_setX<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setX(self); // return 1; } } pub trait QPointF_setX<RetType> { fn setX(self , rsthis: & QPointF) -> RetType; } // proto: void QPointF::setX(qreal x); impl<'a> /*trait*/ QPointF_setX<()> for (f64) { fn setX(self , rsthis: & QPointF) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QPointF4setXEd()}; let arg0 = self as c_double; unsafe {C_ZN7QPointF4setXEd(rsthis.qclsinst, arg0)}; // return 1; } } // proto: qreal & QPointF::ry(); impl /*struct*/ QPointF { pub fn ry<RetType, T: QPointF_ry<RetType>>(& self, overload_args: T) -> RetType { return overload_args.ry(self); // return 1; } } pub trait QPointF_ry<RetType> { fn ry(self , rsthis: & QPointF) -> RetType; } // proto: qreal & QPointF::ry(); impl<'a> /*trait*/ QPointF_ry<f64> for () { fn ry(self , rsthis: & QPointF) -> f64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QPointF2ryEv()}; let mut ret = unsafe {C_ZN7QPointF2ryEv(rsthis.qclsinst)}; return ret as f64; // 1 // return 1; } } // proto: static qreal QPointF::dotProduct(const QPointF & p1, const QPointF & p2); impl /*struct*/ QPointF { pub fn dotProduct_s<RetType, T: QPointF_dotProduct_s<RetType>>( overload_args: T) -> RetType { return overload_args.dotProduct_s(); // return 1; } } pub trait QPointF_dotProduct_s<RetType> { fn dotProduct_s(self ) -> RetType; } // proto: static qreal QPointF::dotProduct(const QPointF & p1, const QPointF & p2); impl<'a> /*trait*/ QPointF_dotProduct_s<f64> for (&'a QPointF, &'a QPointF) { fn dotProduct_s(self ) -> f64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QPointF10dotProductERKS_S1_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN7QPointF10dotProductERKS_S1_(arg0, arg1)}; return ret as f64; // 1 // return 1; } } // proto: void QPointF::setY(qreal y); impl /*struct*/ QPointF { pub fn setY<RetType, T: QPointF_setY<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setY(self); // return 1; } } pub trait QPointF_setY<RetType> { fn setY(self , rsthis: & QPointF) -> RetType; } // proto: void QPointF::setY(qreal y); impl<'a> /*trait*/ QPointF_setY<()> for (f64) { fn setY(self , rsthis: & QPointF) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QPointF4setYEd()}; let arg0 = self as c_double; unsafe {C_ZN7QPointF4setYEd(rsthis.qclsinst, arg0)}; // return 1; } } // <= body block end
use crate::{ mock::{ Extrinsic, Origin, ProviderMembers, Test, TestAuth, TestEvent, TestProvider, Tokens, USD_ASSET, }, Call, OffchainPairPricesPayload, PairPrices, OFFCHAIN_KEY_TYPE, }; use frame_support::{assert_noop, assert_ok, storage::StorageValue}; use frame_system::offchain::{SignedPayload, SigningTypes}; use once_cell::sync::Lazy; use orml_traits::{MultiCurrency, MultiReservableCurrency}; use parity_scale_codec::{Decode, Encode}; use parking_lot::RwLock; use sp_core::{ offchain::{testing, OffchainExt, TransactionPoolExt}, testing::KeyStore, traits::{BareCryptoStore, KeystoreExt}, H256, }; use sp_io::TestExternalities; use sp_runtime::{traits::BadOrigin, RuntimeAppPublic}; use std::sync::Arc; use vln_commons::{ runtime::{AccountId, Signature}, AccountRate, Asset, Collateral, Destination, OfferRate, PairPrice, }; const SEED: Option<&str> = Some("news slush supreme milk chapter athlete soap sausage put clutch what kitten/foo"); const USDC_ASSET: Asset = Asset::Collateral(USDC_COLLATERAL); const USDC_COLLATERAL: Collateral = Collateral::Usdc; const USDV_ASSET: Asset = Asset::Usdv; static KEYSTORE: Lazy<Arc<RwLock<dyn BareCryptoStore>>> = Lazy::new(|| KeyStore::new()); type System = frame_system::Module<Test>; #[test] fn attest_increases_usdv() { new_test_ext().execute_with(|| { let alice = alice(); assert_ok!(ProviderMembers::add_member(Origin::root(), alice)); assert_ok!(TestProvider::attest( Origin::signed(alice), USDC_ASSET, 123, Default::default() )); assert_eq!(Tokens::free_balance(USDC_ASSET, &alice), 0); assert_eq!(Tokens::reserved_balance(USDC_ASSET, &alice), 123); assert_eq!(Tokens::free_balance(USDV_ASSET, &alice), 123); assert_eq!(Tokens::total_issuance(USDC_ASSET), 123); }); } #[test] fn members_return_an_event_with_the_list_of_inserted_members() { new_test_ext().execute_with(|| { System::set_block_number(1); let alice = alice(); assert_ok!(ProviderMembers::add_member(Origin::root(), alice)); assert_ok!(TestProvider::members(Origin::signed(alice))); let event = TestEvent::pallet_liquidity_provider(crate::RawEvent::Members(vec![alice])); assert!(System::events().iter().any(|e| e.event == event)); }); } #[test] fn must_be_provider_to_attest() { new_test_ext().execute_with(|| { let alice = alice(); assert_noop!( ProviderMembers::add_member(Origin::signed(alice), alice), BadOrigin ); let _ = TestProvider::attest(Origin::signed(alice), USDC_ASSET, 123, Default::default()); assert_noop!( TestProvider::attest(Origin::signed(alice), USDC_ASSET, 123, Default::default()), pallet_membership::Error::<Test, crate::LiquidityMembers>::NotMember ); assert_ok!(ProviderMembers::add_member(Origin::root(), alice)); assert_ok!(TestProvider::attest( Origin::signed(alice), USDC_ASSET, 123, Default::default() )); }); } #[test] fn offchain_worker_submits_unsigned_transaction_on_chain() { new_test_ext().execute_with(|| { let (offchain, offchain_state) = testing::TestOffchainExt::new(); let (pool, pool_state) = testing::TestTransactionPoolExt::new(); let keystore = KeyStore::new(); let public_key = keystore .write() .sr25519_generate_new(crate::Public::ID, SEED) .unwrap(); let mut t = TestExternalities::default(); t.register_extension(OffchainExt::new(offchain)); t.register_extension(TransactionPoolExt::new(pool)); t.register_extension(KeystoreExt(keystore)); offchain_state .write() .expect_request(testing::PendingRequest { method: "GET".into(), uri: "https://min-api.cryptocompare.com/data/pricemulti?fsyms=BTC,USD&tsyms=BTC,USD" .into(), response: Some(br#"{"BTC":{"BTC":1,"USD":200},"USD":{"BTC":2,"USD":1}}"#.to_vec()), sent: true, ..Default::default() }); offchain_state .write() .expect_request(testing::PendingRequest { method: "GET".into(), uri: "https://www.trmhoy.co/".into(), response: Some( br#"<div id="banner">Te Compran <h3>$ 120</h3> Te Venden <h3>$ 12</h3></div>"# .to_vec(), ), sent: true, ..Default::default() }); let payload = OffchainPairPricesPayload { pair_prices: vec![ PairPrice::new([Asset::Btc, Asset::Collateral(Collateral::Usd)], 200, 2), PairPrice::new([Asset::Collateral(Collateral::Usd), Asset::Cop], 120, 12), ], public: <Test as SigningTypes>::Public::from(public_key), }; t.execute_with(|| { // when TestProvider::fetch_pair_prices_and_submit_tx(1).unwrap(); // then let raw_tx = pool_state.write().transactions.pop().unwrap(); let tx = Extrinsic::decode(&mut &*raw_tx).unwrap(); assert_eq!(tx.signature, None); if let Call::submit_pair_prices(body, signature) = tx.call { assert_eq!(body, payload.pair_prices); let signature_valid = <OffchainPairPricesPayload< <Test as frame_system::Trait>::BlockNumber, <Test as SigningTypes>::Public, > as SignedPayload<Test>>::verify::<TestAuth>( &payload, signature ); assert!(signature_valid); } }); }) } #[test] fn rate_offers_are_modified_when_attesting_or_updating() { new_test_ext().execute_with(|| { let alice = alice(); assert_ok!(ProviderMembers::add_member(Origin::root(), alice)); let mut offers = vec![OfferRate::new(USDC_ASSET, 123)]; assert_ok!(TestProvider::attest( Origin::signed(alice), USD_ASSET, 123, offers.clone() )); assert_eq!( TestProvider::account_rates(&USD_ASSET, &USDC_ASSET), vec![AccountRate::new(alice, 123)] ); offers[0] = OfferRate::new(USDC_ASSET, 100); assert_ok!(TestProvider::update_offer_rates( Origin::signed(alice), USD_ASSET, offers )); assert_eq!( TestProvider::account_rates(&USD_ASSET, &USDC_ASSET), vec![AccountRate::new(alice, 100)] ); }); } #[test] fn update_offer_rates_overwrites_prices() { new_test_ext().execute_with(|| { assert_eq!(<PairPrices<Test>>::get(), vec![]); let key = KEYSTORE .write() .sr25519_generate_new(crate::Public::ID, None) .unwrap() .into(); let first = vec![ PairPrice::new([Asset::Btc, Asset::Collateral(Collateral::Usd)], 1, 2), PairPrice::new([Asset::Btc, Asset::Ves], 3, 4), PairPrice::new([Asset::Collateral(Collateral::Usd), Asset::Cop], 5, 6), ]; let first_sig = Signature::from_slice( &KEYSTORE .read() .sign_with(OFFCHAIN_KEY_TYPE, &key, &first.encode()) .unwrap(), ); assert_ok!(TestProvider::submit_pair_prices( Origin::none(), first.clone(), first_sig )); assert_eq!(<PairPrices<Test>>::get(), first); let second = vec![ PairPrice::new([Asset::Btc, Asset::Collateral(Collateral::Usd)], 7, 8), PairPrice::new([Asset::Btc, Asset::Ves], 9, 10), PairPrice::new([Asset::Collateral(Collateral::Usd), Asset::Cop], 11, 12), ]; let second_sig = Signature::from_slice( &KEYSTORE .read() .sign_with(OFFCHAIN_KEY_TYPE, &key, &second.encode()) .unwrap(), ); assert_ok!(TestProvider::submit_pair_prices( Origin::none(), second.clone(), second_sig )); assert_eq!(<PairPrices<Test>>::get(), second); }); } #[test] fn usdv_transfer_also_transfers_collaterals() { new_test_ext().execute_with(|| { let alice = alice(); let bob = bob(); assert_ok!(ProviderMembers::add_member(Origin::root(), alice)); assert_ok!(ProviderMembers::add_member(Origin::root(), bob)); assert_ok!(TestProvider::attest( Origin::signed(alice), USD_ASSET, 60, Default::default() )); assert_ok!(TestProvider::attest( Origin::signed(alice), USDC_ASSET, 40, Default::default() )); assert_ok!(TestProvider::transfer( Origin::signed(alice), Destination::Vln(bob), 30 )); assert_eq!(Tokens::free_balance(USDV_ASSET, &alice), 70); assert_eq!(Tokens::free_balance(USDV_ASSET, &bob), 30); assert_eq!(Tokens::reserved_balance(USD_ASSET, &alice), 42); assert_eq!(Tokens::reserved_balance(USDC_ASSET, &alice), 28); assert_eq!(Tokens::reserved_balance(USD_ASSET, &bob), 18); assert_eq!(Tokens::reserved_balance(USDC_ASSET, &bob), 12); assert_eq!(Tokens::total_issuance(USD_ASSET), 60); assert_eq!(Tokens::total_issuance(USDC_ASSET), 40); assert_eq!(Tokens::total_issuance(USDV_ASSET), 100); }); } #[test] fn parse_btc_usd_has_correct_behavior() { assert_eq!( TestProvider::parse_btc_usd(r#"{"BTC":{"BTC":1,"USD":200},"USD":{"BTC":2,"USD":1}}"#), Some(PairPrice::new( [Asset::Btc, Asset::Collateral(Collateral::Usd)], 200, 2, )) ); assert!(TestProvider::parse_btc_usd( r#"{"BTC":{"BTC":1,"USD":"foo"},"USD":{"BTC":2,"USD":1}}"# ) .is_none()); assert!( TestProvider::parse_btc_usd(r#"{"btc":{"btc":1,"usd":200},"usd":{"btc":2,"usd":1}}"#) .is_none() ); } #[test] fn parse_usd_cop_has_correct_behavior() { assert_eq!( TestProvider::parse_usd_cop( r#" Stuff before <div id="banner"> Te Compran <h3>$ 8</h3> Te Venden <h3>$ 123</h3> </div> Stuff after "# ), Some(PairPrice::new( [Asset::Collateral(Collateral::Usd), Asset::Cop], 8, 123, )) ); assert!( TestProvider::parse_usd_cop(r#"Te Compran <h3>$ 8</h3> Te Venden <h3>$ 123</h3>"#) .is_none() ); assert!(TestProvider::parse_usd_cop(r#"Te Compran $ 8 Te Venden $ 123"#).is_none()); } #[test] fn transfer_must_be_greater_than_zero() { new_test_ext().execute_with(|| { assert_noop!( TestProvider::transfer(Origin::signed(alice()), Destination::Vln(bob()), 0), crate::Error::<Test>::TransferMustBeGreaterThanZero ); }); } #[test] fn transfer_destinations_work_as_expected() { new_test_ext().execute_with(|| { // transfer to vln address should work - this has been tested above - skip here // transfer to bank destination should reject with error let bank_dest = Destination::Bank(H256(Default::default())); assert_noop!( TestProvider::transfer(Origin::signed(alice()), bank_dest, 0), crate::Error::<Test>::DestinationNotSupported ); }); } pub fn new_test_ext() -> TestExternalities { let mut t: TestExternalities = frame_system::GenesisConfig::default() .build_storage::<Test>() .unwrap() .into(); t.register_extension(KeystoreExt(Arc::clone(&KEYSTORE))); t } fn alice() -> AccountId { <AccountId>::from_raw({ let mut array = [0; 32]; array[31] = 2; array }) } fn bob() -> AccountId { <AccountId>::from_raw({ let mut array = [0; 32]; array[31] = 1; array }) }
#[doc = "Reader of register TAFCR"] pub type R = crate::R<u32, super::TAFCR>; #[doc = "Writer for register TAFCR"] pub type W = crate::W<u32, super::TAFCR>; #[doc = "Register TAFCR `reset()`'s with value 0"] impl crate::ResetValue for super::TAFCR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Tamper 1 detection enable\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum TAMP1E_A { #[doc = "0: RTC_TAMPx input detection disabled"] DISABLED = 0, #[doc = "1: RTC_TAMPx input detection enabled"] ENABLED = 1, } impl From<TAMP1E_A> for bool { #[inline(always)] fn from(variant: TAMP1E_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `TAMP1E`"] pub type TAMP1E_R = crate::R<bool, TAMP1E_A>; impl TAMP1E_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> TAMP1E_A { match self.bits { false => TAMP1E_A::DISABLED, true => TAMP1E_A::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline(always)] pub fn is_disabled(&self) -> bool { *self == TAMP1E_A::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline(always)] pub fn is_enabled(&self) -> bool { *self == TAMP1E_A::ENABLED } } #[doc = "Write proxy for field `TAMP1E`"] pub struct TAMP1E_W<'a> { w: &'a mut W, } impl<'a> TAMP1E_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: TAMP1E_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "RTC_TAMPx input detection disabled"] #[inline(always)] pub fn disabled(self) -> &'a mut W { self.variant(TAMP1E_A::DISABLED) } #[doc = "RTC_TAMPx input detection enabled"] #[inline(always)] pub fn enabled(self) -> &'a mut W { self.variant(TAMP1E_A::ENABLED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01); self.w } } #[doc = "Active level for tamper 1\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum TAMP1TRG_A { #[doc = "0: If TAMPFLT = 00: RTC_TAMPx input rising edge triggers a tamper detection event. If TAMPFLT =\u{338} 00: RTC_TAMPx input staying low triggers a tamper detection event."] RISINGEDGE = 0, #[doc = "1: If TAMPFLT = 00: RTC_TAMPx input staying high triggers a tamper detection event. If TAMPFLT =\u{338} 00: RTC_TAMPx input falling edge triggers a tamper detection event"] FALLINGEDGE = 1, } impl From<TAMP1TRG_A> for bool { #[inline(always)] fn from(variant: TAMP1TRG_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `TAMP1TRG`"] pub type TAMP1TRG_R = crate::R<bool, TAMP1TRG_A>; impl TAMP1TRG_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> TAMP1TRG_A { match self.bits { false => TAMP1TRG_A::RISINGEDGE, true => TAMP1TRG_A::FALLINGEDGE, } } #[doc = "Checks if the value of the field is `RISINGEDGE`"] #[inline(always)] pub fn is_rising_edge(&self) -> bool { *self == TAMP1TRG_A::RISINGEDGE } #[doc = "Checks if the value of the field is `FALLINGEDGE`"] #[inline(always)] pub fn is_falling_edge(&self) -> bool { *self == TAMP1TRG_A::FALLINGEDGE } } #[doc = "Write proxy for field `TAMP1TRG`"] pub struct TAMP1TRG_W<'a> { w: &'a mut W, } impl<'a> TAMP1TRG_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: TAMP1TRG_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "If TAMPFLT = 00: RTC_TAMPx input rising edge triggers a tamper detection event. If TAMPFLT =\u{338} 00: RTC_TAMPx input staying low triggers a tamper detection event."] #[inline(always)] pub fn rising_edge(self) -> &'a mut W { self.variant(TAMP1TRG_A::RISINGEDGE) } #[doc = "If TAMPFLT = 00: RTC_TAMPx input staying high triggers a tamper detection event. If TAMPFLT =\u{338} 00: RTC_TAMPx input falling edge triggers a tamper detection event"] #[inline(always)] pub fn falling_edge(self) -> &'a mut W { self.variant(TAMP1TRG_A::FALLINGEDGE) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1); self.w } } #[doc = "Tamper interrupt enable\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum TAMPIE_A { #[doc = "0: Tamper interrupt disabled"] DISABLED = 0, #[doc = "1: Tamper interrupt enabled"] ENABLED = 1, } impl From<TAMPIE_A> for bool { #[inline(always)] fn from(variant: TAMPIE_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `TAMPIE`"] pub type TAMPIE_R = crate::R<bool, TAMPIE_A>; impl TAMPIE_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> TAMPIE_A { match self.bits { false => TAMPIE_A::DISABLED, true => TAMPIE_A::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline(always)] pub fn is_disabled(&self) -> bool { *self == TAMPIE_A::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline(always)] pub fn is_enabled(&self) -> bool { *self == TAMPIE_A::ENABLED } } #[doc = "Write proxy for field `TAMPIE`"] pub struct TAMPIE_W<'a> { w: &'a mut W, } impl<'a> TAMPIE_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: TAMPIE_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Tamper interrupt disabled"] #[inline(always)] pub fn disabled(self) -> &'a mut W { self.variant(TAMPIE_A::DISABLED) } #[doc = "Tamper interrupt enabled"] #[inline(always)] pub fn enabled(self) -> &'a mut W { self.variant(TAMPIE_A::ENABLED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2); self.w } } #[doc = "Tamper 2 detection enable"] pub type TAMP2E_A = TAMP1E_A; #[doc = "Reader of field `TAMP2E`"] pub type TAMP2E_R = crate::R<bool, TAMP1E_A>; #[doc = "Write proxy for field `TAMP2E`"] pub struct TAMP2E_W<'a> { w: &'a mut W, } impl<'a> TAMP2E_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: TAMP2E_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "RTC_TAMPx input detection disabled"] #[inline(always)] pub fn disabled(self) -> &'a mut W { self.variant(TAMP1E_A::DISABLED) } #[doc = "RTC_TAMPx input detection enabled"] #[inline(always)] pub fn enabled(self) -> &'a mut W { self.variant(TAMP1E_A::ENABLED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3); self.w } } #[doc = "Active level for tamper 2"] pub type TAMP2TRG_A = TAMP1TRG_A; #[doc = "Reader of field `TAMP2TRG`"] pub type TAMP2TRG_R = crate::R<bool, TAMP1TRG_A>; #[doc = "Write proxy for field `TAMP2TRG`"] pub struct TAMP2TRG_W<'a> { w: &'a mut W, } impl<'a> TAMP2TRG_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: TAMP2TRG_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "If TAMPFLT = 00: RTC_TAMPx input rising edge triggers a tamper detection event. If TAMPFLT =\u{338} 00: RTC_TAMPx input staying low triggers a tamper detection event."] #[inline(always)] pub fn rising_edge(self) -> &'a mut W { self.variant(TAMP1TRG_A::RISINGEDGE) } #[doc = "If TAMPFLT = 00: RTC_TAMPx input staying high triggers a tamper detection event. If TAMPFLT =\u{338} 00: RTC_TAMPx input falling edge triggers a tamper detection event"] #[inline(always)] pub fn falling_edge(self) -> &'a mut W { self.variant(TAMP1TRG_A::FALLINGEDGE) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4); self.w } } #[doc = "Activate timestamp on tamper detection event\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum TAMPTS_A { #[doc = "0: Tamper detection event does not cause a timestamp to be saved"] NOSAVE = 0, #[doc = "1: Save timestamp on tamper detection event"] SAVE = 1, } impl From<TAMPTS_A> for bool { #[inline(always)] fn from(variant: TAMPTS_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `TAMPTS`"] pub type TAMPTS_R = crate::R<bool, TAMPTS_A>; impl TAMPTS_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> TAMPTS_A { match self.bits { false => TAMPTS_A::NOSAVE, true => TAMPTS_A::SAVE, } } #[doc = "Checks if the value of the field is `NOSAVE`"] #[inline(always)] pub fn is_no_save(&self) -> bool { *self == TAMPTS_A::NOSAVE } #[doc = "Checks if the value of the field is `SAVE`"] #[inline(always)] pub fn is_save(&self) -> bool { *self == TAMPTS_A::SAVE } } #[doc = "Write proxy for field `TAMPTS`"] pub struct TAMPTS_W<'a> { w: &'a mut W, } impl<'a> TAMPTS_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: TAMPTS_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Tamper detection event does not cause a timestamp to be saved"] #[inline(always)] pub fn no_save(self) -> &'a mut W { self.variant(TAMPTS_A::NOSAVE) } #[doc = "Save timestamp on tamper detection event"] #[inline(always)] pub fn save(self) -> &'a mut W { self.variant(TAMPTS_A::SAVE) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7); self.w } } #[doc = "Tamper sampling frequency\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum TAMPFREQ_A { #[doc = "0: RTCCLK / 32768 (1 Hz when RTCCLK = 32768 Hz)"] DIV32768 = 0, #[doc = "1: RTCCLK / 16384 (2 Hz when RTCCLK = 32768 Hz)"] DIV16384 = 1, #[doc = "2: RTCCLK / 8192 (4 Hz when RTCCLK = 32768 Hz)"] DIV8192 = 2, #[doc = "3: RTCCLK / 4096 (8 Hz when RTCCLK = 32768 Hz)"] DIV4096 = 3, #[doc = "4: RTCCLK / 2048 (16 Hz when RTCCLK = 32768 Hz)"] DIV2048 = 4, #[doc = "5: RTCCLK / 1024 (32 Hz when RTCCLK = 32768 Hz)"] DIV1024 = 5, #[doc = "6: RTCCLK / 512 (64 Hz when RTCCLK = 32768 Hz)"] DIV512 = 6, #[doc = "7: RTCCLK / 256 (128 Hz when RTCCLK = 32768 Hz)"] DIV256 = 7, } impl From<TAMPFREQ_A> for u8 { #[inline(always)] fn from(variant: TAMPFREQ_A) -> Self { variant as _ } } #[doc = "Reader of field `TAMPFREQ`"] pub type TAMPFREQ_R = crate::R<u8, TAMPFREQ_A>; impl TAMPFREQ_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> TAMPFREQ_A { match self.bits { 0 => TAMPFREQ_A::DIV32768, 1 => TAMPFREQ_A::DIV16384, 2 => TAMPFREQ_A::DIV8192, 3 => TAMPFREQ_A::DIV4096, 4 => TAMPFREQ_A::DIV2048, 5 => TAMPFREQ_A::DIV1024, 6 => TAMPFREQ_A::DIV512, 7 => TAMPFREQ_A::DIV256, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `DIV32768`"] #[inline(always)] pub fn is_div32768(&self) -> bool { *self == TAMPFREQ_A::DIV32768 } #[doc = "Checks if the value of the field is `DIV16384`"] #[inline(always)] pub fn is_div16384(&self) -> bool { *self == TAMPFREQ_A::DIV16384 } #[doc = "Checks if the value of the field is `DIV8192`"] #[inline(always)] pub fn is_div8192(&self) -> bool { *self == TAMPFREQ_A::DIV8192 } #[doc = "Checks if the value of the field is `DIV4096`"] #[inline(always)] pub fn is_div4096(&self) -> bool { *self == TAMPFREQ_A::DIV4096 } #[doc = "Checks if the value of the field is `DIV2048`"] #[inline(always)] pub fn is_div2048(&self) -> bool { *self == TAMPFREQ_A::DIV2048 } #[doc = "Checks if the value of the field is `DIV1024`"] #[inline(always)] pub fn is_div1024(&self) -> bool { *self == TAMPFREQ_A::DIV1024 } #[doc = "Checks if the value of the field is `DIV512`"] #[inline(always)] pub fn is_div512(&self) -> bool { *self == TAMPFREQ_A::DIV512 } #[doc = "Checks if the value of the field is `DIV256`"] #[inline(always)] pub fn is_div256(&self) -> bool { *self == TAMPFREQ_A::DIV256 } } #[doc = "Write proxy for field `TAMPFREQ`"] pub struct TAMPFREQ_W<'a> { w: &'a mut W, } impl<'a> TAMPFREQ_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: TAMPFREQ_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "RTCCLK / 32768 (1 Hz when RTCCLK = 32768 Hz)"] #[inline(always)] pub fn div32768(self) -> &'a mut W { self.variant(TAMPFREQ_A::DIV32768) } #[doc = "RTCCLK / 16384 (2 Hz when RTCCLK = 32768 Hz)"] #[inline(always)] pub fn div16384(self) -> &'a mut W { self.variant(TAMPFREQ_A::DIV16384) } #[doc = "RTCCLK / 8192 (4 Hz when RTCCLK = 32768 Hz)"] #[inline(always)] pub fn div8192(self) -> &'a mut W { self.variant(TAMPFREQ_A::DIV8192) } #[doc = "RTCCLK / 4096 (8 Hz when RTCCLK = 32768 Hz)"] #[inline(always)] pub fn div4096(self) -> &'a mut W { self.variant(TAMPFREQ_A::DIV4096) } #[doc = "RTCCLK / 2048 (16 Hz when RTCCLK = 32768 Hz)"] #[inline(always)] pub fn div2048(self) -> &'a mut W { self.variant(TAMPFREQ_A::DIV2048) } #[doc = "RTCCLK / 1024 (32 Hz when RTCCLK = 32768 Hz)"] #[inline(always)] pub fn div1024(self) -> &'a mut W { self.variant(TAMPFREQ_A::DIV1024) } #[doc = "RTCCLK / 512 (64 Hz when RTCCLK = 32768 Hz)"] #[inline(always)] pub fn div512(self) -> &'a mut W { self.variant(TAMPFREQ_A::DIV512) } #[doc = "RTCCLK / 256 (128 Hz when RTCCLK = 32768 Hz)"] #[inline(always)] pub fn div256(self) -> &'a mut W { self.variant(TAMPFREQ_A::DIV256) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x07 << 8)) | (((value as u32) & 0x07) << 8); self.w } } #[doc = "Tamper filter count\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum TAMPFLT_A { #[doc = "0: Tamper event is activated on edge of RTC_TAMPx input transitions to the active level (no internal pull-up on RTC_TAMPx input)"] IMMEDIATE = 0, #[doc = "1: Tamper event is activated after 2 consecutive samples at the active level"] SAMPLES2 = 1, #[doc = "2: Tamper event is activated after 4 consecutive samples at the active level"] SAMPLES4 = 2, #[doc = "3: Tamper event is activated after 8 consecutive samples at the active level"] SAMPLES8 = 3, } impl From<TAMPFLT_A> for u8 { #[inline(always)] fn from(variant: TAMPFLT_A) -> Self { variant as _ } } #[doc = "Reader of field `TAMPFLT`"] pub type TAMPFLT_R = crate::R<u8, TAMPFLT_A>; impl TAMPFLT_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> TAMPFLT_A { match self.bits { 0 => TAMPFLT_A::IMMEDIATE, 1 => TAMPFLT_A::SAMPLES2, 2 => TAMPFLT_A::SAMPLES4, 3 => TAMPFLT_A::SAMPLES8, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `IMMEDIATE`"] #[inline(always)] pub fn is_immediate(&self) -> bool { *self == TAMPFLT_A::IMMEDIATE } #[doc = "Checks if the value of the field is `SAMPLES2`"] #[inline(always)] pub fn is_samples2(&self) -> bool { *self == TAMPFLT_A::SAMPLES2 } #[doc = "Checks if the value of the field is `SAMPLES4`"] #[inline(always)] pub fn is_samples4(&self) -> bool { *self == TAMPFLT_A::SAMPLES4 } #[doc = "Checks if the value of the field is `SAMPLES8`"] #[inline(always)] pub fn is_samples8(&self) -> bool { *self == TAMPFLT_A::SAMPLES8 } } #[doc = "Write proxy for field `TAMPFLT`"] pub struct TAMPFLT_W<'a> { w: &'a mut W, } impl<'a> TAMPFLT_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: TAMPFLT_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "Tamper event is activated on edge of RTC_TAMPx input transitions to the active level (no internal pull-up on RTC_TAMPx input)"] #[inline(always)] pub fn immediate(self) -> &'a mut W { self.variant(TAMPFLT_A::IMMEDIATE) } #[doc = "Tamper event is activated after 2 consecutive samples at the active level"] #[inline(always)] pub fn samples2(self) -> &'a mut W { self.variant(TAMPFLT_A::SAMPLES2) } #[doc = "Tamper event is activated after 4 consecutive samples at the active level"] #[inline(always)] pub fn samples4(self) -> &'a mut W { self.variant(TAMPFLT_A::SAMPLES4) } #[doc = "Tamper event is activated after 8 consecutive samples at the active level"] #[inline(always)] pub fn samples8(self) -> &'a mut W { self.variant(TAMPFLT_A::SAMPLES8) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x03 << 11)) | (((value as u32) & 0x03) << 11); self.w } } #[doc = "Tamper precharge duration\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum TAMPPRCH_A { #[doc = "0: 1 RTCCLK cycle"] CYCLES1 = 0, #[doc = "1: 2 RTCCLK cycles"] CYCLES2 = 1, #[doc = "2: 4 RTCCLK cycles"] CYCLES4 = 2, #[doc = "3: 8 RTCCLK cycles"] CYCLES8 = 3, } impl From<TAMPPRCH_A> for u8 { #[inline(always)] fn from(variant: TAMPPRCH_A) -> Self { variant as _ } } #[doc = "Reader of field `TAMPPRCH`"] pub type TAMPPRCH_R = crate::R<u8, TAMPPRCH_A>; impl TAMPPRCH_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> TAMPPRCH_A { match self.bits { 0 => TAMPPRCH_A::CYCLES1, 1 => TAMPPRCH_A::CYCLES2, 2 => TAMPPRCH_A::CYCLES4, 3 => TAMPPRCH_A::CYCLES8, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `CYCLES1`"] #[inline(always)] pub fn is_cycles1(&self) -> bool { *self == TAMPPRCH_A::CYCLES1 } #[doc = "Checks if the value of the field is `CYCLES2`"] #[inline(always)] pub fn is_cycles2(&self) -> bool { *self == TAMPPRCH_A::CYCLES2 } #[doc = "Checks if the value of the field is `CYCLES4`"] #[inline(always)] pub fn is_cycles4(&self) -> bool { *self == TAMPPRCH_A::CYCLES4 } #[doc = "Checks if the value of the field is `CYCLES8`"] #[inline(always)] pub fn is_cycles8(&self) -> bool { *self == TAMPPRCH_A::CYCLES8 } } #[doc = "Write proxy for field `TAMPPRCH`"] pub struct TAMPPRCH_W<'a> { w: &'a mut W, } impl<'a> TAMPPRCH_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: TAMPPRCH_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "1 RTCCLK cycle"] #[inline(always)] pub fn cycles1(self) -> &'a mut W { self.variant(TAMPPRCH_A::CYCLES1) } #[doc = "2 RTCCLK cycles"] #[inline(always)] pub fn cycles2(self) -> &'a mut W { self.variant(TAMPPRCH_A::CYCLES2) } #[doc = "4 RTCCLK cycles"] #[inline(always)] pub fn cycles4(self) -> &'a mut W { self.variant(TAMPPRCH_A::CYCLES4) } #[doc = "8 RTCCLK cycles"] #[inline(always)] pub fn cycles8(self) -> &'a mut W { self.variant(TAMPPRCH_A::CYCLES8) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x03 << 13)) | (((value as u32) & 0x03) << 13); self.w } } #[doc = "TAMPER pull-up disable\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum TAMPPUDIS_A { #[doc = "0: Precharge RTC_TAMPx pins before sampling (enable internal pull-up)"] ENABLED = 0, #[doc = "1: Disable precharge of RTC_TAMPx pins"] DISABLED = 1, } impl From<TAMPPUDIS_A> for bool { #[inline(always)] fn from(variant: TAMPPUDIS_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `TAMPPUDIS`"] pub type TAMPPUDIS_R = crate::R<bool, TAMPPUDIS_A>; impl TAMPPUDIS_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> TAMPPUDIS_A { match self.bits { false => TAMPPUDIS_A::ENABLED, true => TAMPPUDIS_A::DISABLED, } } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline(always)] pub fn is_enabled(&self) -> bool { *self == TAMPPUDIS_A::ENABLED } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline(always)] pub fn is_disabled(&self) -> bool { *self == TAMPPUDIS_A::DISABLED } } #[doc = "Write proxy for field `TAMPPUDIS`"] pub struct TAMPPUDIS_W<'a> { w: &'a mut W, } impl<'a> TAMPPUDIS_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: TAMPPUDIS_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Precharge RTC_TAMPx pins before sampling (enable internal pull-up)"] #[inline(always)] pub fn enabled(self) -> &'a mut W { self.variant(TAMPPUDIS_A::ENABLED) } #[doc = "Disable precharge of RTC_TAMPx pins"] #[inline(always)] pub fn disabled(self) -> &'a mut W { self.variant(TAMPPUDIS_A::DISABLED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 15)) | (((value as u32) & 0x01) << 15); self.w } } #[doc = "PC13 value\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum PC13VALUE_A { #[doc = "1: If the LSE is disabled and PCxMODE = 1, set PCxVALUE to logic high"] HIGH = 1, #[doc = "0: If the LSE is disabled and PCxMODE = 1, set PCxVALUE to logic low"] LOW = 0, } impl From<PC13VALUE_A> for bool { #[inline(always)] fn from(variant: PC13VALUE_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `PC13VALUE`"] pub type PC13VALUE_R = crate::R<bool, PC13VALUE_A>; impl PC13VALUE_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> PC13VALUE_A { match self.bits { true => PC13VALUE_A::HIGH, false => PC13VALUE_A::LOW, } } #[doc = "Checks if the value of the field is `HIGH`"] #[inline(always)] pub fn is_high(&self) -> bool { *self == PC13VALUE_A::HIGH } #[doc = "Checks if the value of the field is `LOW`"] #[inline(always)] pub fn is_low(&self) -> bool { *self == PC13VALUE_A::LOW } } #[doc = "Write proxy for field `PC13VALUE`"] pub struct PC13VALUE_W<'a> { w: &'a mut W, } impl<'a> PC13VALUE_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: PC13VALUE_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "If the LSE is disabled and PCxMODE = 1, set PCxVALUE to logic high"] #[inline(always)] pub fn high(self) -> &'a mut W { self.variant(PC13VALUE_A::HIGH) } #[doc = "If the LSE is disabled and PCxMODE = 1, set PCxVALUE to logic low"] #[inline(always)] pub fn low(self) -> &'a mut W { self.variant(PC13VALUE_A::LOW) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 18)) | (((value as u32) & 0x01) << 18); self.w } } #[doc = "PC13 mode\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum PC13MODE_A { #[doc = "0: PCx is controlled by the GPIO configuration Register. Consequently PC15 is floating in Standby mode"] FLOATING = 0, #[doc = "1: PCx is forced to push-pull output if LSE is disabled"] PUSHPULL = 1, } impl From<PC13MODE_A> for bool { #[inline(always)] fn from(variant: PC13MODE_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `PC13MODE`"] pub type PC13MODE_R = crate::R<bool, PC13MODE_A>; impl PC13MODE_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> PC13MODE_A { match self.bits { false => PC13MODE_A::FLOATING, true => PC13MODE_A::PUSHPULL, } } #[doc = "Checks if the value of the field is `FLOATING`"] #[inline(always)] pub fn is_floating(&self) -> bool { *self == PC13MODE_A::FLOATING } #[doc = "Checks if the value of the field is `PUSHPULL`"] #[inline(always)] pub fn is_push_pull(&self) -> bool { *self == PC13MODE_A::PUSHPULL } } #[doc = "Write proxy for field `PC13MODE`"] pub struct PC13MODE_W<'a> { w: &'a mut W, } impl<'a> PC13MODE_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: PC13MODE_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "PCx is controlled by the GPIO configuration Register. Consequently PC15 is floating in Standby mode"] #[inline(always)] pub fn floating(self) -> &'a mut W { self.variant(PC13MODE_A::FLOATING) } #[doc = "PCx is forced to push-pull output if LSE is disabled"] #[inline(always)] pub fn push_pull(self) -> &'a mut W { self.variant(PC13MODE_A::PUSHPULL) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 19)) | (((value as u32) & 0x01) << 19); self.w } } #[doc = "PC14 value"] pub type PC14VALUE_A = PC13VALUE_A; #[doc = "Reader of field `PC14VALUE`"] pub type PC14VALUE_R = crate::R<bool, PC13VALUE_A>; #[doc = "Write proxy for field `PC14VALUE`"] pub struct PC14VALUE_W<'a> { w: &'a mut W, } impl<'a> PC14VALUE_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: PC14VALUE_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "If the LSE is disabled and PCxMODE = 1, set PCxVALUE to logic high"] #[inline(always)] pub fn high(self) -> &'a mut W { self.variant(PC13VALUE_A::HIGH) } #[doc = "If the LSE is disabled and PCxMODE = 1, set PCxVALUE to logic low"] #[inline(always)] pub fn low(self) -> &'a mut W { self.variant(PC13VALUE_A::LOW) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 20)) | (((value as u32) & 0x01) << 20); self.w } } #[doc = "PC 14 mode"] pub type PC14MODE_A = PC13MODE_A; #[doc = "Reader of field `PC14MODE`"] pub type PC14MODE_R = crate::R<bool, PC13MODE_A>; #[doc = "Write proxy for field `PC14MODE`"] pub struct PC14MODE_W<'a> { w: &'a mut W, } impl<'a> PC14MODE_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: PC14MODE_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "PCx is controlled by the GPIO configuration Register. Consequently PC15 is floating in Standby mode"] #[inline(always)] pub fn floating(self) -> &'a mut W { self.variant(PC13MODE_A::FLOATING) } #[doc = "PCx is forced to push-pull output if LSE is disabled"] #[inline(always)] pub fn push_pull(self) -> &'a mut W { self.variant(PC13MODE_A::PUSHPULL) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 21)) | (((value as u32) & 0x01) << 21); self.w } } #[doc = "PC15 value"] pub type PC15VALUE_A = PC13VALUE_A; #[doc = "Reader of field `PC15VALUE`"] pub type PC15VALUE_R = crate::R<bool, PC13VALUE_A>; #[doc = "Write proxy for field `PC15VALUE`"] pub struct PC15VALUE_W<'a> { w: &'a mut W, } impl<'a> PC15VALUE_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: PC15VALUE_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "If the LSE is disabled and PCxMODE = 1, set PCxVALUE to logic high"] #[inline(always)] pub fn high(self) -> &'a mut W { self.variant(PC13VALUE_A::HIGH) } #[doc = "If the LSE is disabled and PCxMODE = 1, set PCxVALUE to logic low"] #[inline(always)] pub fn low(self) -> &'a mut W { self.variant(PC13VALUE_A::LOW) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 22)) | (((value as u32) & 0x01) << 22); self.w } } #[doc = "PC15 mode"] pub type PC15MODE_A = PC13MODE_A; #[doc = "Reader of field `PC15MODE`"] pub type PC15MODE_R = crate::R<bool, PC13MODE_A>; #[doc = "Write proxy for field `PC15MODE`"] pub struct PC15MODE_W<'a> { w: &'a mut W, } impl<'a> PC15MODE_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: PC15MODE_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "PCx is controlled by the GPIO configuration Register. Consequently PC15 is floating in Standby mode"] #[inline(always)] pub fn floating(self) -> &'a mut W { self.variant(PC13MODE_A::FLOATING) } #[doc = "PCx is forced to push-pull output if LSE is disabled"] #[inline(always)] pub fn push_pull(self) -> &'a mut W { self.variant(PC13MODE_A::PUSHPULL) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 23)) | (((value as u32) & 0x01) << 23); self.w } } impl R { #[doc = "Bit 0 - Tamper 1 detection enable"] #[inline(always)] pub fn tamp1e(&self) -> TAMP1E_R { TAMP1E_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - Active level for tamper 1"] #[inline(always)] pub fn tamp1trg(&self) -> TAMP1TRG_R { TAMP1TRG_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 2 - Tamper interrupt enable"] #[inline(always)] pub fn tampie(&self) -> TAMPIE_R { TAMPIE_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 3 - Tamper 2 detection enable"] #[inline(always)] pub fn tamp2e(&self) -> TAMP2E_R { TAMP2E_R::new(((self.bits >> 3) & 0x01) != 0) } #[doc = "Bit 4 - Active level for tamper 2"] #[inline(always)] pub fn tamp2trg(&self) -> TAMP2TRG_R { TAMP2TRG_R::new(((self.bits >> 4) & 0x01) != 0) } #[doc = "Bit 7 - Activate timestamp on tamper detection event"] #[inline(always)] pub fn tampts(&self) -> TAMPTS_R { TAMPTS_R::new(((self.bits >> 7) & 0x01) != 0) } #[doc = "Bits 8:10 - Tamper sampling frequency"] #[inline(always)] pub fn tampfreq(&self) -> TAMPFREQ_R { TAMPFREQ_R::new(((self.bits >> 8) & 0x07) as u8) } #[doc = "Bits 11:12 - Tamper filter count"] #[inline(always)] pub fn tampflt(&self) -> TAMPFLT_R { TAMPFLT_R::new(((self.bits >> 11) & 0x03) as u8) } #[doc = "Bits 13:14 - Tamper precharge duration"] #[inline(always)] pub fn tampprch(&self) -> TAMPPRCH_R { TAMPPRCH_R::new(((self.bits >> 13) & 0x03) as u8) } #[doc = "Bit 15 - TAMPER pull-up disable"] #[inline(always)] pub fn tamppudis(&self) -> TAMPPUDIS_R { TAMPPUDIS_R::new(((self.bits >> 15) & 0x01) != 0) } #[doc = "Bit 18 - PC13 value"] #[inline(always)] pub fn pc13value(&self) -> PC13VALUE_R { PC13VALUE_R::new(((self.bits >> 18) & 0x01) != 0) } #[doc = "Bit 19 - PC13 mode"] #[inline(always)] pub fn pc13mode(&self) -> PC13MODE_R { PC13MODE_R::new(((self.bits >> 19) & 0x01) != 0) } #[doc = "Bit 20 - PC14 value"] #[inline(always)] pub fn pc14value(&self) -> PC14VALUE_R { PC14VALUE_R::new(((self.bits >> 20) & 0x01) != 0) } #[doc = "Bit 21 - PC 14 mode"] #[inline(always)] pub fn pc14mode(&self) -> PC14MODE_R { PC14MODE_R::new(((self.bits >> 21) & 0x01) != 0) } #[doc = "Bit 22 - PC15 value"] #[inline(always)] pub fn pc15value(&self) -> PC15VALUE_R { PC15VALUE_R::new(((self.bits >> 22) & 0x01) != 0) } #[doc = "Bit 23 - PC15 mode"] #[inline(always)] pub fn pc15mode(&self) -> PC15MODE_R { PC15MODE_R::new(((self.bits >> 23) & 0x01) != 0) } } impl W { #[doc = "Bit 0 - Tamper 1 detection enable"] #[inline(always)] pub fn tamp1e(&mut self) -> TAMP1E_W { TAMP1E_W { w: self } } #[doc = "Bit 1 - Active level for tamper 1"] #[inline(always)] pub fn tamp1trg(&mut self) -> TAMP1TRG_W { TAMP1TRG_W { w: self } } #[doc = "Bit 2 - Tamper interrupt enable"] #[inline(always)] pub fn tampie(&mut self) -> TAMPIE_W { TAMPIE_W { w: self } } #[doc = "Bit 3 - Tamper 2 detection enable"] #[inline(always)] pub fn tamp2e(&mut self) -> TAMP2E_W { TAMP2E_W { w: self } } #[doc = "Bit 4 - Active level for tamper 2"] #[inline(always)] pub fn tamp2trg(&mut self) -> TAMP2TRG_W { TAMP2TRG_W { w: self } } #[doc = "Bit 7 - Activate timestamp on tamper detection event"] #[inline(always)] pub fn tampts(&mut self) -> TAMPTS_W { TAMPTS_W { w: self } } #[doc = "Bits 8:10 - Tamper sampling frequency"] #[inline(always)] pub fn tampfreq(&mut self) -> TAMPFREQ_W { TAMPFREQ_W { w: self } } #[doc = "Bits 11:12 - Tamper filter count"] #[inline(always)] pub fn tampflt(&mut self) -> TAMPFLT_W { TAMPFLT_W { w: self } } #[doc = "Bits 13:14 - Tamper precharge duration"] #[inline(always)] pub fn tampprch(&mut self) -> TAMPPRCH_W { TAMPPRCH_W { w: self } } #[doc = "Bit 15 - TAMPER pull-up disable"] #[inline(always)] pub fn tamppudis(&mut self) -> TAMPPUDIS_W { TAMPPUDIS_W { w: self } } #[doc = "Bit 18 - PC13 value"] #[inline(always)] pub fn pc13value(&mut self) -> PC13VALUE_W { PC13VALUE_W { w: self } } #[doc = "Bit 19 - PC13 mode"] #[inline(always)] pub fn pc13mode(&mut self) -> PC13MODE_W { PC13MODE_W { w: self } } #[doc = "Bit 20 - PC14 value"] #[inline(always)] pub fn pc14value(&mut self) -> PC14VALUE_W { PC14VALUE_W { w: self } } #[doc = "Bit 21 - PC 14 mode"] #[inline(always)] pub fn pc14mode(&mut self) -> PC14MODE_W { PC14MODE_W { w: self } } #[doc = "Bit 22 - PC15 value"] #[inline(always)] pub fn pc15value(&mut self) -> PC15VALUE_W { PC15VALUE_W { w: self } } #[doc = "Bit 23 - PC15 mode"] #[inline(always)] pub fn pc15mode(&mut self) -> PC15MODE_W { PC15MODE_W { w: self } } }
// This file is adapted from async_std use core::cell::UnsafeCell; use crate::prelude::*; #[derive(Debug)] pub struct LocalKey<T: Send + 'static> { init: fn() -> T, key: AtomicU32, } impl<T: Send + 'static> LocalKey<T> { pub const fn new(init: fn() -> T) -> Self { let key = AtomicU32::new(0); Self { init, key } } } impl<T: Send + 'static> LocalKey<T> { /// Attempts to get a reference to the task-local value with this key. /// /// This method will panic if not called within the context of a task. pub fn with<F, R>(&'static self, f: F) -> R where F: FnOnce(&T) -> R, { self.try_with(f).unwrap() } /// Attempts to get a reference to the task-local value with this key. /// /// This method will not invoke the closure and return an `None` if not /// called within the context of a task. pub fn try_with<F, R>(&'static self, f: F) -> Option<R> where F: FnOnce(&T) -> R, { let current = match crate::task::current::try_get() { Some(current) => current, None => return None, }; // Prepare the numeric key, initialization function, and the map of task-locals. let key = self.key(); let init = || Box::new((self.init)()) as Box<dyn Send>; // Get the value in the map of task-locals, or initialize and insert one. let value: *const dyn Send = current.locals().get_or_insert(key, init); // Call the closure with the value passed as an argument. let retval = unsafe { f(&*(value as *const T)) }; Some(retval) } /// Returns the numeric key associated with this task-local. #[inline] pub fn key(&self) -> u32 { #[cold] fn init(key: &AtomicU32) -> u32 { static COUNTER: AtomicU32 = AtomicU32::new(1); let counter = COUNTER.fetch_add(1, Ordering::Relaxed); if counter > u32::max_value() / 2 { panic!("counter overflow"); } match key.compare_and_swap(0, counter, Ordering::AcqRel) { 0 => counter, k => k, } } match self.key.load(Ordering::Acquire) { 0 => init(&self.key), k => k, } } } // A map that holds task-locals. pub(crate) struct LocalsMap { /// A list of key-value entries sorted by the key. entries: UnsafeCell<Option<Vec<Entry>>>, } unsafe impl Send for LocalsMap {} impl LocalsMap { /// Creates an empty map of task-locals. pub fn new() -> LocalsMap { LocalsMap { entries: UnsafeCell::new(Some(Vec::new())), } } /// Returns a task-local value associated with `key` or inserts one constructed by `init`. #[inline] pub fn get_or_insert(&self, key: u32, init: impl FnOnce() -> Box<dyn Send>) -> &dyn Send { match unsafe { (*self.entries.get()).as_mut() } { None => panic!("can't access task-locals while the task is being dropped"), Some(entries) => { let index = match entries.binary_search_by_key(&key, |e| e.key) { Ok(i) => i, Err(i) => { let value = init(); entries.insert(i, Entry { key, value }); i } }; &*entries[index].value } } } /// Clears the map and drops all task-locals. /// /// This method is only safe to call at the end of the task. pub unsafe fn clear(&self) { // Since destructors may attempt to access task-locals, we musnt't hold a mutable reference // to the `Vec` while dropping them. Instead, we first take the `Vec` out and then drop it. let entries = (*self.entries.get()).take(); drop(entries); } } /// A key-value entry in a map of task-locals. struct Entry { /// Key identifying the task-local variable. key: u32, /// Value stored in this entry. value: Box<dyn Send>, }
use std::sync::Arc; use data_types::{NamespaceId, ParquetFileParams, PartitionKey, TableId, TransitionPartitionId}; use observability_deps::tracing::*; use parking_lot::Mutex; use schema::sort::SortKey; use thiserror::Error; use tokio::{ sync::{oneshot, OwnedSemaphorePermit}, time::Instant, }; use uuid::Uuid; use crate::{ buffer_tree::{ namespace::NamespaceName, partition::{persisting::PersistingData, PartitionData, SortKeyState}, table::TableMetadata, }, deferred_load::DeferredLoad, persist::completion_observer::CompletedPersist, }; use super::completion_observer::PersistCompletionObserver; /// Errors a persist can experience. #[derive(Debug, Error)] pub(super) enum PersistError { /// A concurrent sort key update was observed and the sort key update was /// aborted. The newly observed sort key is returned. #[error("detected concurrent sort key update")] ConcurrentSortKeyUpdate(SortKey), } /// An internal type that contains all necessary information to run a persist /// task. #[derive(Debug)] pub(super) struct PersistRequest { complete: oneshot::Sender<()>, partition: Arc<Mutex<PartitionData>>, data: PersistingData, enqueued_at: Instant, permit: OwnedSemaphorePermit, } impl PersistRequest { /// Construct a [`PersistRequest`] for `data` from `partition`, recording /// the current timestamp as the "enqueued at" point. pub(super) fn new( partition: Arc<Mutex<PartitionData>>, data: PersistingData, permit: OwnedSemaphorePermit, enqueued_at: Instant, ) -> (Self, oneshot::Receiver<()>) { let (tx, rx) = oneshot::channel(); ( Self { complete: tx, partition, data, enqueued_at, permit, }, rx, ) } /// Return the partition identifier of the persisting data. pub(super) fn partition_id(&self) -> &TransitionPartitionId { self.data.partition_id() } } /// The context of a persist job, containing the data to be persisted and /// associated metadata. /// /// This type caches various read-only (or read-mostly) fields on the /// [`PartitionData`] itself, avoiding unnecessary lock contention. It also /// carries timing metadata, and the completion notification channel for the /// enqueuer notification. pub(super) struct Context { partition: Arc<Mutex<PartitionData>>, data: PersistingData, /// IDs loaded from the partition at construction time. namespace_id: NamespaceId, table_id: TableId, partition_id: TransitionPartitionId, // The partition key for this partition partition_key: PartitionKey, /// Deferred data needed for persistence. /// /// These [`DeferredLoad`] are given a pre-fetch hint when this [`Context`] /// is constructed to load them in the background (if not already resolved) /// in order to avoid incurring the query latency when the values are /// needed. namespace_name: Arc<DeferredLoad<NamespaceName>>, table: Arc<DeferredLoad<TableMetadata>>, /// The [`SortKey`] for the [`PartitionData`] at the time of [`Context`] /// construction. /// /// The [`SortKey`] MUST NOT change during persistence, as updates to the /// sort key are not commutative and thus require serialising. This /// precludes parallel persists of partitions, unless they can be proven not /// to need to update the sort key. sort_key: SortKeyState, /// A notification signal to indicate to the caller that this partition has /// persisted. complete: oneshot::Sender<()>, /// Timing statistics tracking the timestamp this persist job was first /// enqueued, and the timestamp this [`Context`] was constructed (signifying /// the start of active persist work, as opposed to passive time spent in /// the queue). enqueued_at: Instant, dequeued_at: Instant, /// The persistence permit for this work. /// /// This permit MUST be retained for the entire duration of the persistence /// work, and MUST be released at the end of the persistence AFTER any /// references to the persisted data are released. permit: OwnedSemaphorePermit, } impl Context { /// Construct a persistence job [`Context`] from `req`. /// /// Locks the [`PartitionData`] in `req` to read various properties which /// are then cached in the [`Context`]. pub(super) fn new(req: PersistRequest) -> Self { let partition_id = req.data.partition_id().clone(); // Obtain the partition lock and load the immutable values that will be // used during this persistence. let s = { let PersistRequest { complete, partition, data, enqueued_at, permit, } = req; let p = Arc::clone(&partition); let guard = p.lock(); assert_eq!(&partition_id, guard.partition_id()); Self { partition, data, namespace_id: guard.namespace_id(), table_id: guard.table_id(), partition_id, partition_key: guard.partition_key().clone(), namespace_name: Arc::clone(guard.namespace_name()), table: Arc::clone(guard.table()), // Technically the sort key isn't immutable, but MUST NOT be // changed by an external actor (by something other than code in // this Context) during the execution of this persist, otherwise // sort key update serialisation is violated. sort_key: guard.sort_key().clone(), complete, enqueued_at, dequeued_at: Instant::now(), permit, } }; // Pre-fetch the deferred values in a background thread (if not already // resolved) s.namespace_name.prefetch_now(); s.table.prefetch_now(); if let SortKeyState::Deferred(ref d) = s.sort_key { d.prefetch_now(); } s } /// Replace the cached sort key in the [`PartitionData`] with the specified /// new sort key. /// /// # Panics /// /// This method panics if the cached sort key in the [`PartitionData`] has /// diverged from the cached sort key in `self`, indicating concurrent /// persist jobs that update the sort key for the same [`PartitionData`] /// running in this ingester process. pub(super) async fn set_partition_sort_key(&mut self, new_sort_key: SortKey) { // Invalidate the sort key in the partition. let old_key; { let mut guard = self.partition.lock(); old_key = guard.sort_key().clone(); guard.update_sort_key(Some(new_sort_key.clone())); }; // Assert the internal (to this ingester instance) serialisation of // sort key updates. // // Both of these get() should not block due to both of the values having // been previously resolved / used in the Context constructor. assert_eq!(old_key.get().await, self.sort_key.get().await); // Update the cached copy of the sort key in this Context. self.sort_key = SortKeyState::Provided(Some(new_sort_key)); } // Call [`PartitionData::mark_complete`] to finalise the persistence job, // emit a log for the user, and notify the observer of this persistence // task, if any. pub(super) async fn mark_complete<O>( self, object_store_id: Uuid, metadata: ParquetFileParams, completion_observer: &O, ) where O: PersistCompletionObserver, { // Mark the partition as having completed persistence, causing it to // release the reference to the in-flight persistence data it is // holding. // // This SHOULD cause the data to be dropped, but there MAY be ongoing // queries that currently hold a reference to the data. In either case, // the persisted data will be dropped "shortly". let sequence_numbers = self.partition.lock().mark_persisted(self.data); let n_writes = sequence_numbers.len(); // Dispatch the completion notification into the observer chain before // completing the persist operation. completion_observer .persist_complete(Arc::new(CompletedPersist::new(metadata, sequence_numbers))) .await; let now = Instant::now(); info!( %object_store_id, namespace_id = %self.namespace_id, namespace_name = %self.namespace_name, table_id = %self.table_id, table = %self.table, partition_id = %self.partition_id, partition_key = %self.partition_key, total_persist_duration = ?now.duration_since(self.enqueued_at), active_persist_duration = ?now.duration_since(self.dequeued_at), queued_persist_duration = ?self.dequeued_at.duration_since(self.enqueued_at), n_writes, "persisted partition" ); // Explicitly drop the permit before notifying the caller, so that if // there's no headroom in the queue, the caller that is woken by the // notification is able to push into the queue immediately. drop(self.permit); // Notify the observer of this persistence task, if any. let _ = self.complete.send(()); } pub(super) fn enqueued_at(&self) -> Instant { self.enqueued_at } pub(super) fn sort_key(&self) -> &SortKeyState { &self.sort_key } pub(super) fn data(&self) -> &PersistingData { &self.data } pub(super) fn namespace_id(&self) -> NamespaceId { self.namespace_id } pub(super) fn table_id(&self) -> TableId { self.table_id } pub(super) fn partition_id(&self) -> &TransitionPartitionId { &self.partition_id } pub(super) fn partition_key(&self) -> &PartitionKey { &self.partition_key } pub(super) fn namespace_name(&self) -> &DeferredLoad<NamespaceName> { self.namespace_name.as_ref() } pub(super) fn table(&self) -> &DeferredLoad<TableMetadata> { self.table.as_ref() } }
mod common; use common::exe; use duct::cmd; #[test] fn no_args() { // Implicitly checks that exit code is zero. let stdout = cmd!(exe(), "yes") .pipe(cmd!("head", "-n", "5")) .read() .unwrap(); assert_eq!(stdout, ["y"].repeat(5).join("\n")); } #[test] fn one_arg() { let stdout = cmd!(exe(), "yes", "foo") .pipe(cmd!("head", "-n", "5")) .read() .unwrap(); assert_eq!(stdout, ["foo"].repeat(5).join("\n")); } #[test] fn multiple_args() { let stdout = cmd!(exe(), "yes", "foo", "bar") .pipe(cmd!("head", "-n", "5")) .read() .unwrap(); assert_eq!(stdout, ["foo bar"].repeat(5).join("\n")); }
use stm32f1::stm32f103::{RCC, GPIOB}; pub fn init(rcc: &mut RCC, gpiob: &mut GPIOB) { // enable gpiob rcc.apb2enr.write(|w| w.iopben().enabled()); // configurate PB12 as push-pull output gpiob.crh.write(|w| w.mode12().output50().cnf12().push_pull()); } pub fn set(on: bool) { let gpiob = unsafe { &*GPIOB::ptr() }; if on { gpiob.bsrr.write(|w| w.br12().reset()); } else { gpiob.bsrr.write(|w| w.bs12().set()); } }
const INPUT: &str = include_str!("./input"); fn parse_policy(policy: &str) -> (usize, usize, char) { let mut iter = policy.split_whitespace(); let range = iter.next().unwrap(); let c = iter.next().unwrap(); let mut iter = range.split('-'); let min = iter.next().map(|v| v.parse().unwrap()); let max = iter.next().map(|v| v.parse().unwrap()); (min.unwrap(), max.unwrap(), c.parse().unwrap()) } fn is_valid(policy: &str, password: &str) -> bool { let (min, max, c) = parse_policy(policy); let count = password.chars().filter(|v| *v == c).count(); count >= min && count <= max } fn is_valid_2(policy: &str, password: &str) -> bool { let (min, max, c) = parse_policy(policy); let mut iter = password.chars(); let first_match = iter.nth(min - 1).unwrap() == c; let second_match = iter.nth(max - min - 1).unwrap() == c; first_match ^ second_match } fn get_valid_count<F>(check: F) -> usize where F: Fn(&str, &str) -> bool, { INPUT .trim_end() .lines() .filter(|line| { let mut iter = line.split(':'); let policy = iter.next().unwrap(); let password = iter.next().unwrap().trim(); check(policy, password) }) .count() } fn part_1() -> usize { get_valid_count(is_valid) } fn part_2() -> usize { get_valid_count(is_valid_2) } #[test] fn test_part_1() { assert!(is_valid("1-3 a", "abcde")); assert!(!is_valid("1-3 b", "cdefg")); assert!(is_valid("2-9 c", "ccccccccc")); assert_eq!(part_1(), 396); } #[test] fn test_part_2() { assert!(is_valid_2("1-3 a", "abcde")); assert!(!is_valid_2("1-3 b", "cdefg")); assert!(!is_valid_2("2-9 c", "ccccccccc")); assert_eq!(part_2(), 428); }
pub fn sort(arr: &mut [isize]) { for i in 0..arr.len() { for j in (0..i).rev() { if arr[j] >= arr[j + 1] { arr.swap(j, j + 1); } else { break } } } } #[cfg(test)] pub mod test { use super::sort; #[test] fn basics() { let mut nums = [7, 2, 4, 6]; sort(&mut nums); assert_eq!(nums, [2, 4, 6, 7]); } }
pub mod search; use reason_othello::game::{self, GameState}; /// Solve the game, trying to determine the exact score. /// Takes longer, but can be valuable for debugging or winning by a margin. pub fn solve_exact(state: GameState) -> i8 { search::window(state, -game::MAX_SCORE, game::MAX_SCORE) } // Solve the game, caring only about solving for a win, loss, or draw. // Faster, but provides less information. pub fn solve_win_loss_draw(state: GameState) -> i8 { search::window(state, -1, 1) }
extern crate image; extern crate proc_macro; extern crate rusttype; pub mod prelude; use crate::prelude::*; use std::fs; use std::io::prelude::*; #[repr(align(32))] pub struct AlignedData<T>(pub T); pub struct GCNFont { pub width: u32, pub height: u32, pub size: f32, pub space_advance: f32, pub data: Vec<u8>, pub glyphs: Vec<Glyph>, } pub fn work(params: Params) -> GCNFont { let (width, height) = params .resolution .map(|r| (r.width, r.height)) .unwrap_or((256, 256)); let size = params.size.map(|s| s.size).unwrap_or(50.0); let scale = Scale::uniform(size); let font_data = fs::read(params.path).unwrap(); let font = Font::from_bytes(&font_data).expect("Error constructing Font"); let mut atlas = GrayImage::new(width, height); let mut cache = CacheBuilder { width, height, ..CacheBuilder::default() } .build(); let space_advance = font.glyph(' ').scaled(scale).h_metrics().advance_width; let glyphs = font .glyphs_for((0x21..=0x7E).map(|i: u8| i as char)) .map(|g| g.scaled(scale).positioned(Point { x: 0.0, y: 0.0 })) .collect::<Vec<_>>(); for glyph in &glyphs { cache.queue_glyph(0, glyph.clone()); } cache .cache_queued(|rect, data| { let glyph = GrayImage::from_raw(rect.width(), rect.height(), data.to_vec()) .expect("Bad GrayImage"); overlay(&mut atlas, &glyph, rect.min.x, rect.min.y); }) .expect("cache queue"); let rects = glyphs .iter() .map(|glyph| { Glyph { descender: glyph.pixel_bounding_box().unwrap().max.y as f32, bounds: cache .rect_for(0, glyph) .unwrap() //expect("Failed to get rect.") .unwrap() //expect("Failed to unwrap TextureCoords") .0, } }) .collect::<Vec<_>>(); let mut buffer = Vec::with_capacity(width as usize * height as usize); { for row in 0..(height as usize / I8_BLOCK_HEIGHT) { let row_y = row * I8_BLOCK_HEIGHT; for column in 0..(width as usize / I8_BLOCK_WIDTH) { let column_x = column * I8_BLOCK_WIDTH; for y in 0..I8_BLOCK_HEIGHT { let y = row_y + y; let x = column_x; let pixel_index = y * width as usize + x; let src = &(*atlas)[pixel_index..][..I8_BLOCK_WIDTH]; buffer.write_all(src).unwrap(); } } } } GCNFont { width, height, size, space_advance, data: buffer, glyphs: rects, } }
fn main (){type V=[f32; 3 ]; let mut t=0f32; let dot=|[x,y,z] :V,[a,b,c]:V|x*a +y*b+z*c;let dot2= |a|dot(a,a);let cross =|[x,y,z]:V,[a,b,c]:V |[y*c-z*b,z*a-x*c,x*b-y* a];let smul=|[x,y,z]:V,a|[ x*a,y*a,z*a];let m=|[x,y,z]: V,[a,b,c]:V|[x-a,y-b,z-c];let n2=|[x,y,z]:V|(x*x+y*y+z*z);let triangle_sdf=|p,a,b,c|{let[pa, pb, pc,ba,cb,ac]=[m(p,a),m(p,b),m(p,c),m( b,a),m(c,b),m(a,c)];let nor=cross(ba, ac);let o=|p,q|dot(cross(p,nor),q).signum ();if o(ba,pa)+o(cb,pb)+o(ac,pc)<2.{let s= |p,q|dot2(m(smul(p,(dot(p,q)/dot2(p)).min(1. ).max(0.)),q));s(ba,pa).min(s(cb,pb)).min(s(ac ,pc))}else{dot(nor,pa)*dot(nor,pa)/dot2(nor)}. sqrt()};let mut output=vec![vec![b' '; 64]; 36];let q=|l|move|s|(s,2.*(s as f32)/l-1.);loop{for(i,u)in(0 ..64).map(q(64.)){for(j,v)in(0..36).map(q(36.)){for(_, z)in(0..32).map(q(32.)){let[p,a,b,c]=[[u,v,z],[t.sin(),( t*2.).cos(),(t+3.).sin()],[(3.*t).cos(),(4.*t).sin(),(2.*t +0.5).cos()],[(5.*t).sin(),(6.*t).cos(),(2.5*t+1.4).sin()]]; if triangle_sdf(p,a,b,c)<0.05{let n=cross(m(a,b),m(a,c));let l =m(p,[0.;3]);let al=dot(n,l).max(dot(smul(n,-1.),l))/(n2(n)*n2( l)).sqrt();output[j][i]=b".,-~:;=!*#$@"[(al*11.).max(0.).round()as usize];break;}}}}print!("\x1b[H");for r in output.iter_mut(){print! ("{}\n",std::str::from_utf8(r).unwrap());r.fill(b' ');}t += 0.001;}}//
extern crate libc; pub use ffi::{ zmq_msg_t, zmq_free_fn, zmq_event_t, zmq_pollitem_t, zmq_version, zmq_errno, zmq_strerror, zmq_ctx_new, zmq_ctx_term, zmq_ctx_shutdown, zmq_ctx_set, zmq_ctx_get, zmq_init, zmq_term, zmq_ctx_destroy, zmq_msg_init, zmq_msg_init_size, zmq_msg_init_data, zmq_msg_send, zmq_msg_recv, zmq_msg_close, zmq_msg_move, zmq_msg_copy, zmq_msg_data, zmq_msg_size, zmq_msg_more, zmq_msg_get, zmq_msg_set, zmq_socket, zmq_close, zmq_setsockopt, zmq_getsockopt, zmq_bind, zmq_connect, zmq_unbind, zmq_disconnect, zmq_send, zmq_send_const, zmq_recv, zmq_socket_monitor, zmq_sendmsg, zmq_recvmsg, zmq_sendiov, zmq_recviov, zmq_poll, zmq_proxy, zmq_proxy_steerable, zmq_z85_encode, zmq_z85_decode, zmq_device, }; #[allow(non_camel_case_types)] mod ffi { use libc::{ uint8_t, uint16_t, int32_t, size_t, }; include!("ffi.rs"); }
use core::f32; use super::sqrtf; #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] pub fn hypotf(mut x: f32, mut y: f32) -> f32 { let x1p90 = f32::from_bits(0x6c800000); // 0x1p90f === 2 ^ 90 let x1p_90 = f32::from_bits(0x12800000); // 0x1p-90f === 2 ^ -90 let mut uxi = x.to_bits(); let mut uyi = y.to_bits(); let uti; let mut z: f32; uxi &= -1i32 as u32 >> 1; uyi &= -1i32 as u32 >> 1; if uxi < uyi { uti = uxi; uxi = uyi; uyi = uti; } x = f32::from_bits(uxi); y = f32::from_bits(uyi); if uyi == 0xff << 23 { return y; } if uxi >= 0xff << 23 || uyi == 0 || uxi - uyi >= 25 << 23 { return x + y; } z = 1.; if uxi >= (0x7f + 60) << 23 { z = x1p90; x *= x1p_90; y *= x1p_90; } else if uyi < (0x7f - 60) << 23 { z = x1p_90; x *= x1p90; y *= x1p90; } z * sqrtf((x as f64 * x as f64 + y as f64 * y as f64) as f32) }
/// Plugin architecture /// /// We do not want "spooky action at a distance" (Spukhafte Fernwirkung) (A. Einstein) /// /// Plugin::draw() -> VectorBackend::draw(Primitive::Variant) -> Primite::draw pub trait Plugin : Flex { fn min_size(&self, pagewidth) -> Size; // covered by Flex // fn height_for_width(&self, width: Distance); } pub type Real = f64; enum SampleHint { Continuous, } pub enum Bound { Open(Real), Closed(Real) }; pub struct Domain(Bound, Bound); impl Display for Domain { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { &Domain(Bound::Open(low), Bound::Open(high)) => write!("({}, {})", low, high), &Domain(Bound::Open(low), Bound::Closed(high)) => write!("({}, {}]", low, high), &Domain(Bound::Closed(low), Bound::Open(high)) => write!("[{}, {})", low, high), &Domain(Bound::Closed(low), Bound::Closed(high)) => write!("[{}, {}]", low, high) } } } pub trait Sampler { fn sample(&self, &mut rand::ThreadRng) -> Point; fn hints(&self, Range) -> Option<SampleHint> { None } fn domain(&self) -> (Real, Real); } pub enum Primitive { Point(Point), Line(Point, Point), Function(&Sampler) } /// Implemented by every Vector Output pub trait VectorBackend { fn line(&mut self, a: Point, b: Point); //fn bezir3(a: Point, b: Point, c: Point, d: Point) fn curve(&Fn) } pub trait VectorDraw { fn draw(&self, &mut VectorBackend); }
/* 135. Candy Hard Share There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings. You are giving candies to these children subjected to the following requirements: Each child must have at least one candy. Children with a higher rating get more candies than their neighbors. Return the minimum number of candies you need to have to distribute the candies to the children. Example 1: Input: ratings = [1,0,2] Output: 5 Explanation: You can allocate to the first, second and third child with 2, 1, 2 candies respectively. Example 2: Input: ratings = [1,2,2] Output: 4 Explanation: You can allocate to the first, second and third child with 1, 2, 1 candies respectively. The third child gets 1 candy because it satisfies the above two conditions. Constraints: n == ratings.length 1 <= n <= 2 * 104 0 <= ratings[i] <= 2 * 104 */ extern crate json; use std::cell::RefCell; use algo_tools::load_json_tests; struct Solution; impl Solution { pub fn _candy(ratings: Vec<i32>) -> i32 { let mut parts = ratings.clone(); let (mut rating0, mut part0) = (ratings[0]-1, 0); for r in 0..ratings.len() { if ratings[r] < rating0 { //println!("ratings[{}]({}) < rating0({}) and part0 is {}", r, ratings[r], rating0, part0); parts[r] = 1; for i in (0..r).rev() { if ratings[i] > ratings[i+1] && parts[i] <= parts[i+1] { //println!("Add a candy to child {} to compensate", i); parts[i] = parts[i+1] + 1; } else { break; } } } else { parts[r] = 1; if ratings[r] > rating0 { parts[r] += part0; } } part0 = parts[r]; rating0 = ratings[r]; } parts.iter().sum() } pub fn candy(ratings: Vec<i32>) -> i32 { // 2 pass implementation let mut candies = vec![1; ratings.len()]; for r in 1..ratings.len() { if ratings[r] > ratings[r-1] { candies[r] = candies[r-1] + 1; } } let mut sum = *candies.last().unwrap(); for r in (0..ratings.len()-1).rev() { if ratings[r+1] < ratings[r] { candies[r] = candies[r].max(candies[r+1]+1); } sum += candies[r]; } sum } } fn run_test_case(test_case: &json::JsonValue) -> i32 { let _ratings = &test_case["in"]; let expected = test_case["expected"].as_i32().unwrap(); let ratings : RefCell<Vec<i32>> = RefCell::new(_ratings.members().map(|rating| rating.as_i32().unwrap()).collect()); let result = Solution::candy(ratings.borrow().to_vec()); if result == expected { return 0; } println!("candy({:?}) returned {:?} but expected {:?}\n", ratings.borrow(), result, expected); 1 } fn main() { let (tests, test_idx) = load_json_tests(); let (mut successes, mut failures) = (0, 0); if test_idx >= tests.len() as i32 { println!("Wrong index {}, only {} tests available!!", test_idx, tests.len()); return } if test_idx != -1 { let rc = run_test_case(&tests[test_idx as usize]); if rc == 0 { successes += 1; } else { failures += 1; } } else { println!("{} tests specified", tests.len()); for i in 0..tests.len() { let rc = run_test_case(&tests[i]); if rc == 0 { successes += 1; } else { failures += 1; } } } if failures > 0 { println!("{} tests succeeded and {} tests failed!!", successes, failures); } else { println!("All {} tests succeeded!!", successes); } }
#[derive(Clone, Copy, Debug, PartialEq)] pub struct SearchHostile { pub search_range: f32, pub is_active: bool, }
use std::process::Command; use glob::glob; use parser::{expand_string, ExpanderFunctions}; use parser::peg::RedirectFrom; #[derive(Debug, PartialEq, Clone, Copy)] pub enum JobKind { And, Background, Last, Or, Pipe(RedirectFrom) } #[derive(Debug, PartialEq, Clone)] pub struct Job { pub command: String, pub args: Vec<String>, pub kind: JobKind, } impl Job { pub fn new(args: Vec<String>, kind: JobKind) -> Self { let command = args[0].clone(); Job { command: command, args: args, kind: kind, } } /// Takes the current job's arguments and expands them, one argument at a /// time, returning a new `Job` with the expanded arguments. pub fn expand(&mut self, expanders: &ExpanderFunctions) { let mut expanded: Vec<String> = Vec::with_capacity(self.args.len()); { let mut iterator = self.args.drain(..); expanded.push(iterator.next().unwrap()); for arg in iterator.flat_map(|argument| expand_string(&argument, expanders, false)) { if arg.contains(|chr| chr == '?' || chr == '*' || chr == '[') { if let Ok(glob) = glob(&arg) { for path in glob.filter_map(Result::ok) { expanded.push(path.to_string_lossy().into_owned()); continue } } } expanded.push(arg); } } self.args = expanded; } pub fn build_command(&mut self) -> Command { let mut command = Command::new(&self.command); for arg in self.args.drain(..).skip(1) { command.arg(arg); } command } }
pub fn verification_email(token: &String) -> String { let template = format!( " <h1>Welcome to Spaces</h1> Click the link to verify account<br/> <a href='http://localhost:5000/user/verify?token={}'>click</a> ", token ); template } pub fn forgot_password_email(password: &String) -> String { let template = format!( "<h1>Password Reset</h1> Your new password has been set to <b>{}</b> Do well to change the password as soon as possible ", password ); template } pub fn invite_user(name: &String, token: &String) -> String { let template = format!( " <h1>You have been invited to {} Space</h1> Follow the link to complete registration<br/> <a href='http://localhost:5000/spacies/invitepage?token={}'>click</a> ", name, token ); template } pub fn added_user(name: &String) -> String { let template = format!( " <h1>You have been added to {} space</h1> ", name ); template } pub fn notify_folder(title: &String, body: &String) -> String { let template = format!( " <h3>Notification to {}</h3> <p>{}</p> ", title, body ); template } pub fn send_reminder(title: &String, name: &String, body: &String) -> String { let template = format!( " <h3>Reminder for {}</h3> <p>This is to remind membrs of {} Space of the follwing event today:</p> <p> {}</p> ", title, name, body ); template }
//! This crate defines the `C99Display` trait which should be used to display constructs in //! a C99-compatible syntax, and implements it for the various `llir` constructs. //! //! In the future, it should define additional shared constructs for C-based backends such as the //! x86 and MPPA backends. use std::fmt; use telamon::codegen::llir; use telamon::ir; /// Formatting trait for C99 values. /// /// This is similar to the standard library's `Display` trait, except that it prints values in a /// syntax compatible with the C99 standard. pub trait C99Display { /// Formats the value using the given formatter. fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result; /// Helper function to wrap `self` into a `Display` implementation which will call back into /// `C99Display::fmt`. /// /// # Examples /// /// ```ignore /// use std::fmt; /// /// impl C99Display for String { /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { /// write!(fmt, "\"{}\"", self.escape_default()) /// } /// } /// /// assert_eq!(r#"x"y"#.c99().to_string(), r#""x\"y""#); /// ``` fn c99(&self) -> DisplayC99<'_, Self> { DisplayC99 { inner: self } } } /// Helper struct for printing values in C99 syntax. /// /// This `struct` implements the `Display` trait by using a `C99Display` implementation. It is /// created by the `c99` method on `C99Display` instances. pub struct DisplayC99<'a, T: ?Sized> { inner: &'a T, } impl<T: fmt::Debug + ?Sized> fmt::Debug for DisplayC99<'_, T> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(self.inner, fmt) } } impl<T: C99Display + ?Sized> fmt::Display for DisplayC99<'_, T> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { C99Display::fmt(self.inner, fmt) } } impl C99Display for llir::Register<'_> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.write_str(self.name()) } } impl C99Display for llir::Operand<'_> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { use llir::Operand::*; match self { Register(register) => C99Display::fmt(register, fmt), &IntLiteral(ref val, bits) => { assert!(bits <= 64); fmt::Display::fmt(val, fmt) } &FloatLiteral(ref val, bits) => { use num::{Float, ToPrimitive}; assert!(bits <= 64); let f = val.numer().to_f64().unwrap() / val.denom().to_f64().unwrap(); // Print in C99 hexadecimal floating point representation let (mantissa, exponent, sign) = f.integer_decode(); let signchar = if sign < 0 { "-" } else { "" }; // Assume that floats and doubles in the C implementation have // 32 and 64 bits, respectively let floating_suffix = match bits { 32 => "f", 64 => "", _ => panic!("Cannot print floating point value with {} bits", bits), }; write!( fmt, "{}0x{:x}p{}{}", signchar, mantissa, exponent, floating_suffix ) } } } } impl<T: C99Display> C99Display for llir::ScalarOrVector<T> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { match self { llir::ScalarOrVector::Scalar(scalar) => C99Display::fmt(scalar, fmt), llir::ScalarOrVector::Vector(..) => { panic!("x86 backend does not support vectors.") } } } } impl C99Display for llir::UnOp { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { use llir::UnOp; match self { UnOp::Move { .. } => Ok(()), UnOp::Cast { dst_t, .. } => write!(fmt, "({})", dst_t.c99()), UnOp::Exp { t: ir::Type::F(32) } => write!(fmt, "expf"), UnOp::Exp { .. } => panic!("{}: non-atomic C99 instruction", self), } } } fn is_infix(binop: llir::BinOp) -> bool { use llir::BinOp::*; match binop { // Integer Arithmetic Instructions IAdd { .. } | ISub { .. } | IDiv { .. } | IMul { spec: llir::MulSpec::Low, .. } | FAdd { .. } | FSub { .. } | FMul { .. } | FDiv { .. } | Set { .. } | And { .. } | Or { .. } | Xor { .. } => true, _ => false, } } impl C99Display for llir::BinOp { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { use llir::BinOp::*; match self { // Integer Arithmetic Instructions IAdd { .. } => write!(fmt, "+"), ISub { .. } => write!(fmt, "-"), IDiv { .. } => write!(fmt, "/"), IMul { spec: llir::MulSpec::Low, .. } => write!(fmt, "*"), IMul { spec, arg_t } => { write!(fmt, "__mul{}{}", arg_t.bitwidth().unwrap(), spec.c99()) } IMax { .. } => write!(fmt, "__max"), // Floating-Point Instructions FAdd { .. } => write!(fmt, "+"), FSub { .. } => write!(fmt, "-"), FMul { .. } => write!(fmt, "*"), FDiv { .. } => write!(fmt, "/"), FMax { .. } => write!(fmt, "__max"), FMin { .. } => write!(fmt, "__min"), // Comparison and Selection Instructions Set { op, .. } => write!(fmt, "{}", op.c99()), // Logic and Shift Instructions And { .. } => write!(fmt, "&"), Or { .. } => write!(fmt, "|"), Xor { .. } => write!(fmt, "^"), } } } impl C99Display for llir::TernOp { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { use llir::TernOp::*; match self { IMad { spec, arg_t } => { write!(fmt, "__mad{}{}", arg_t.bitwidth().unwrap(), spec.c99()) } FFma { .. } => write!(fmt, "__fma"), } } } impl C99Display for llir::CmpOp { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.write_str(match self { llir::CmpOp::Eq => "==", llir::CmpOp::Ne => "!=", llir::CmpOp::Lt => "<", llir::CmpOp::Le => "<=", llir::CmpOp::Gt => ">", llir::CmpOp::Ge => ">=", }) } } impl C99Display for llir::MulSpec { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.write_str(match self { llir::MulSpec::Low => "", llir::MulSpec::High => "Hi", llir::MulSpec::Wide => "Wide", }) } } impl C99Display for llir::Address<'_> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { use llir::Address; match *self { Address::Register(reg, offset) if offset == 0 => write!(fmt, "{}", reg), Address::Register(reg, offset) => write!(fmt, "{}{:+#x}", reg, offset), } } } impl C99Display for llir::Label<'_> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!(fmt, "{}:", self.name()) } } impl C99Display for llir::LoadSpec { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!(fmt, "({}*)", self.t().c99()) } } impl C99Display for llir::StoreSpec { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { write!(fmt, "({}*)", self.t().c99()) } } impl C99Display for llir::PredicatedInstruction<'_> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { if let Some(predicate) = self.predicate { write!(fmt, "if ({}) ", predicate.c99())?; } write!(fmt, "{};", self.instruction.c99()) } } impl C99Display for llir::Instruction<'_> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { use llir::Instruction::*; match self { Unary(op, d, [a]) => write!( fmt, "{d} = {op}({a})", op = op.c99(), d = d.c99(), a = a.c99() ), Binary(op, d, [a, b]) if is_infix(*op) => write!( fmt, "{d} = {a} {op} {b}", op = op.c99(), d = d.c99(), a = a.c99(), b = b.c99() ), Binary(op, d, [a, b]) => write!( fmt, "{d} = {op}({a}, {b})", op = op.c99(), d = d.c99(), a = a.c99(), b = b.c99() ), Ternary(op, d, [a, b, c]) => write!( fmt, "{d} = {op}({a}, {b}, {c})", op = op.c99(), d = d.c99(), a = a.c99(), b = b.c99(), c = c.c99() ), Load(spec, d, a) => write!( fmt, "{d} = *{spec}({a})", spec = spec.c99(), d = d.c99(), a = a.c99() ), Store(spec, a, [b]) => write!( fmt, "*{spec}({a}) = {b}", spec = spec.c99(), a = a.c99(), b = b.c99() ), Jump(label) => write!(fmt, "goto {label}", label = label.name()), Sync => write!(fmt, "__sync()"), } } } impl C99Display for ir::Type { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.write_str(match self { ir::Type::PtrTo(..) => "intptr_t", ir::Type::F(32) => "float", ir::Type::F(64) => "double", ir::Type::I(1) => "int8_t", ir::Type::I(8) => "int8_t", ir::Type::I(16) => "int16_t", ir::Type::I(32) => "int32_t", ir::Type::I(64) => "int64_t", _ => panic!("invalid C99 type: {}", self), }) } }
use bevy::{prelude::Mesh, render::mesh::Indices, render::mesh::VertexAttribute, render::pipeline::PrimitiveTopology}; pub struct MeshMaker { pub vert_pos: Vec<[f32; 3]>, pub vert_norm: Vec<[f32; 3]>, pub vert_uvs: Vec<[f32; 2]>, // pub vert_colors: Vec<[f32; 4]>, // pub vert_textures: Vec<f32>, pub indices: Vec<u32>, } impl MeshMaker { pub fn new() -> Self { MeshMaker { vert_pos: Vec::new(), vert_norm: Vec::new(), vert_uvs: Vec::new(), // vert_colors: Vec::new(), // vert_textures: Vec::new(), indices: Vec::new(), } } pub fn generate_mesh(&self) -> Mesh { let mut mesh = Mesh::new(PrimitiveTopology::TriangleList); mesh.indices = Some(Indices::U32(self.indices.clone())); mesh.attributes .push(VertexAttribute::position(self.vert_pos.clone())); mesh.attributes .push(VertexAttribute::normal(self.vert_norm.clone())); mesh.attributes .push(VertexAttribute::uv(self.vert_uvs.clone())); // mesh.attributes // .push(VertexAttribute::color(self.vert_colors.clone())); // mesh.attributes // .push(VertexAttribute::texture(self.vert_textures.clone())); mesh } } pub trait EditableMesh { fn get_vertex_positions(&self) -> Option<Vec<[f32; 3]>>; fn get_vertex_normals(&self) -> Option<Vec<[f32; 3]>>; fn get_vertex_uvs(&self) -> Option<Vec<[f32; 2]>>; // fn get_vertex_colors(&self) -> Option<Vec<[f32; 4]>>; // fn get_vertex_textures(&self) -> Option<Vec<f32>>; // fn get_vertices(&self) -> Option<Vec<Vertex>>; fn get_mut_vertex_positions(&mut self) -> Option<&mut Vec<[f32; 3]>>; fn get_mut_vertex_normals(&mut self) -> Option<&mut Vec<[f32; 3]>>; fn get_mut_vertex_uvs(&mut self) -> Option<&mut Vec<[f32; 2]>>; fn add_mesh(&mut self, _other: &Mesh) {} } impl EditableMesh for Mesh { fn get_vertex_positions(&self) -> Option<Vec<[f32; 3]>> { match self.attributes[0].values { bevy::render::mesh::VertexAttributeValues::Float3(ref vertices) => { Some(vertices.clone()) } _ => None, } } fn get_vertex_normals(&self) -> Option<Vec<[f32; 3]>> { match self.attributes[1].values { bevy::render::mesh::VertexAttributeValues::Float3(ref vertices) => { Some(vertices.clone()) } _ => None, } } fn get_vertex_uvs(&self) -> Option<Vec<[f32; 2]>> { match self.attributes[2].values { bevy::render::mesh::VertexAttributeValues::Float2(ref vertices) => { Some(vertices.clone()) } _ => None, } } // fn get_vertex_colors(&self) -> Option<Vec<[f32; 4]>> { // match self.attributes[3].values { // bevy::render::mesh::VertexAttributeValues::Float4(ref vertices) => { // Some(vertices.clone()) // } // _ => None, // } // } // fn get_vertex_textures(&self) -> Option<Vec<f32>> { // match self.attributes[4].values { // bevy::render::mesh::VertexAttributeValues::Float(ref vertices) => { // Some(vertices.clone()) // } // _ => None, // } // } fn get_mut_vertex_positions(&mut self) -> Option<&mut Vec<[f32; 3]>> { match self.attributes[0].values { bevy::render::mesh::VertexAttributeValues::Float3(ref mut vertices) => Some(vertices), _ => None, } } fn get_mut_vertex_normals(&mut self) -> Option<&mut Vec<[f32; 3]>> { match self.attributes[1].values { bevy::render::mesh::VertexAttributeValues::Float3(ref mut vertices) => Some(vertices), _ => None, } } fn get_mut_vertex_uvs(&mut self) -> Option<&mut Vec<[f32; 2]>> { match self.attributes[2].values { bevy::render::mesh::VertexAttributeValues::Float2(ref mut vertices) => Some(vertices), _ => None, } } } // pub trait NewVertexAttributes { // fn color(colors: Vec<[f32; 4]>) -> VertexAttribute; // fn texture(textures: Vec<f32>) -> VertexAttribute; // } // impl NewVertexAttributes for VertexAttribute { // fn color(colors: Vec<[f32; 4]>) -> VertexAttribute { // VertexAttribute { // name: "Vertex_Color".into(), // values: VertexAttributeValues::Float4(colors), // } // } // fn texture(textures: Vec<f32>) -> VertexAttribute { // VertexAttribute { // name: "Vertex_Texture".into(), // values: VertexAttributeValues::Float(textures), // } // } // }
use super::WordSelection; use yew::prelude::*; #[derive(PartialEq)] pub struct SingleWordSelection(Option<String>); impl WordSelection for SingleWordSelection { type Properties = Option<Callback<Option<String>>>; fn create(_properties: &Self::Properties) -> Self { Self(None) } fn select(&mut self, properties: &Self::Properties, word: &str) -> ShouldRender { self.0 = Some(word.to_string()); if let Some(ref onclick) = properties { onclick.emit(self.0.clone()); } true } fn render_label(&self, _properties: &Self::Properties, word: &str, color: &str) -> Html { // color.as_ref().map(String::as_ref).unwrap_or("hidden"), if self.0.as_ref().map(|s| s.as_ref()) == Some(word) { html! { <div class=("ui", color, "empty", "circular", "horizontal", "label") /> } } else { html! {} } } fn remove<'a, I: Iterator<Item = &'a str>>( &mut self, properties: &Self::Properties, words: I, ) -> ShouldRender { let mut result = false; for word in words { if self.0.as_ref().map(|s| s.as_ref()) == Some(word) { self.0 = None; result = true; } } if result { if let Some(ref onclick) = properties { onclick.emit(self.0.clone()); } } result } } impl SingleWordSelection { pub fn properties(onclick: Callback<Option<String>>) -> Option<Callback<Option<String>>> { Some(onclick) } }
// xfail-boot // xfail-stage0 use std; import std._task; fn main() -> () { test00(); } fn start(int task_number) { log "Started / Finished Task."; } fn test00() { let int i = 0; let task t = spawn thread "child" start(i); // Sleep long enough for the task to finish. _task.sleep(10000u); // Try joining tasks that have already finished. join t; log "Joined Task."; }
use libengine::engine::*; #[allow(unused_imports)] use std::io::prelude::*; use std::iter::Iterator; use std::sync::{Arc, Mutex}; #[derive(Default)] pub struct FaceFactory; impl IFaceFactory for FaceFactory { fn spawn(&mut self) -> Arc<Mutex<dyn IFace>> { Arc::new(Mutex::new(InterfaceMercury { guid: String::new(), suspended: true, state: StateLink::Unknown, counters: vec![], })) } fn spawn_with_uuid(&mut self, uuid: IGUID) -> Arc<Mutex<dyn IFace>> { Arc::new(Mutex::new(InterfaceMercury { guid: uuid, suspended: true, state: StateLink::Unknown, counters: vec![], })) } } #[allow(dead_code)] pub struct InterfaceMercury { // Состояние объекта guid: IGUID, suspended: bool, state: StateLink, counters: Vec<Box<Mutex<dyn ICounter + Send>>>, } impl IFace for InterfaceMercury { // Производим обмен со всеми счётчиками fn processing(&mut self) { let _ = self.counters.iter_mut().map(|counter| { if let Ok(mut counter_borrowed) = counter.lock() { counter_borrowed.communicate(); } }); } fn type_name() -> &'static str where Self: Sized, { "IFaceMercury230" } fn description() -> &'static str where Self: Sized, { "Меркурий 230" } }
use std::cell::Cell; pub struct Gamepad { pub a: bool, pub b: bool, pub select: bool, pub start: bool, pub up: bool, pub down: bool, pub left: bool, pub right: bool, byte: Cell<u8>, polling: bool, } impl Default for Gamepad { fn default() -> Self { Gamepad::new() } } impl Gamepad { pub fn new() -> Gamepad { Gamepad { a: false, b: false, select: false, start: false, up: false, down: false, left: false, right: false, byte: Cell::new(0), polling: false, } } pub fn dump_buttons(&self) { println!( "{} {} {}", if self.a { "A" } else { "a" }, if self.b { "B" } else { "b" }, if self.start { "START" } else { "start" } ); } pub fn start_poll(&mut self) { self.polling = true; } pub fn stop_poll(&mut self) { self.polling = false; let mut b = 0; if self.a { b |= 0x01; } if self.b { b |= 0x02; } if self.select { b |= 0x04; } if self.start { b |= 0x08; } if self.up { b |= 0x10; } if self.down { b |= 0x20; } if self.left { b |= 0x40; } if self.right { b |= 0x80; } self.byte.set(b); } pub fn read(&self) -> u8 { if self.polling { 1 } else { let res = 0x01 & self.byte.get(); self.byte.set(self.byte.get() >> 1); res } } } #[cfg(test)] mod tests { use super::*; #[test] #[ignore] fn one_is_default() { let gamepad = Gamepad::new(); assert_eq!(1, gamepad.read()); } #[test] fn one_is_returned_during_polling() { let mut gamepad = Gamepad::new(); gamepad.start_poll(); assert_eq!(1, gamepad.read()); } #[test] fn unpressed_is_zero() { let mut gamepad = Gamepad::new(); gamepad.start_poll(); gamepad.stop_poll(); assert_eq!(0, gamepad.read()); } #[test] fn order_is_correct() { let mut gamepad = Gamepad::new(); gamepad.a = true; gamepad.select = true; gamepad.up = true; gamepad.left = true; gamepad.start_poll(); gamepad.stop_poll(); assert_eq!(1, gamepad.read()); assert_eq!(0, gamepad.read()); assert_eq!(1, gamepad.read()); assert_eq!(0, gamepad.read()); assert_eq!(1, gamepad.read()); assert_eq!(0, gamepad.read()); assert_eq!(1, gamepad.read()); assert_eq!(0, gamepad.read()); gamepad = Gamepad::new(); gamepad.b = true; gamepad.start = true; gamepad.down = true; gamepad.right = true; gamepad.start_poll(); gamepad.stop_poll(); assert_eq!(0, gamepad.read()); assert_eq!(1, gamepad.read()); assert_eq!(0, gamepad.read()); assert_eq!(1, gamepad.read()); assert_eq!(0, gamepad.read()); assert_eq!(1, gamepad.read()); assert_eq!(0, gamepad.read()); assert_eq!(1, gamepad.read()); } #[test] fn reading_beyond_input_return_one() { let mut gamepad = Gamepad::new(); gamepad.start_poll(); gamepad.stop_poll(); for _i in 0..8 { gamepad.read(); } assert_eq!(0, gamepad.read()); } }
#[doc = "Writer for register SICR"] pub type W = crate::W<u32, super::SICR>; #[doc = "Register SICR `reset()`'s with value 0"] impl crate::ResetValue for super::SICR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Write proxy for field `DATAIC`"] pub struct DATAIC_W<'a> { w: &'a mut W, } impl<'a> DATAIC_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01); self.w } } #[doc = "Write proxy for field `STARTIC`"] pub struct STARTIC_W<'a> { w: &'a mut W, } impl<'a> STARTIC_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1); self.w } } #[doc = "Write proxy for field `STOPIC`"] pub struct STOPIC_W<'a> { w: &'a mut W, } impl<'a> STOPIC_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2); self.w } } #[doc = "Write proxy for field `DMARXIC`"] pub struct DMARXIC_W<'a> { w: &'a mut W, } impl<'a> DMARXIC_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3); self.w } } #[doc = "Write proxy for field `DMATXIC`"] pub struct DMATXIC_W<'a> { w: &'a mut W, } impl<'a> DMATXIC_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4); self.w } } #[doc = "Write proxy for field `TXIC`"] pub struct TXIC_W<'a> { w: &'a mut W, } impl<'a> TXIC_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5); self.w } } #[doc = "Write proxy for field `RXIC`"] pub struct RXIC_W<'a> { w: &'a mut W, } impl<'a> RXIC_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6); self.w } } #[doc = "Write proxy for field `TXFEIC`"] pub struct TXFEIC_W<'a> { w: &'a mut W, } impl<'a> TXFEIC_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7); self.w } } #[doc = "Write proxy for field `RXFFIC`"] pub struct RXFFIC_W<'a> { w: &'a mut W, } impl<'a> RXFFIC_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8); self.w } } impl W { #[doc = "Bit 0 - Data Interrupt Clear"] #[inline(always)] pub fn dataic(&mut self) -> DATAIC_W { DATAIC_W { w: self } } #[doc = "Bit 1 - Start Condition Interrupt Clear"] #[inline(always)] pub fn startic(&mut self) -> STARTIC_W { STARTIC_W { w: self } } #[doc = "Bit 2 - Stop Condition Interrupt Clear"] #[inline(always)] pub fn stopic(&mut self) -> STOPIC_W { STOPIC_W { w: self } } #[doc = "Bit 3 - Receive DMA Interrupt Clear"] #[inline(always)] pub fn dmarxic(&mut self) -> DMARXIC_W { DMARXIC_W { w: self } } #[doc = "Bit 4 - Transmit DMA Interrupt Clear"] #[inline(always)] pub fn dmatxic(&mut self) -> DMATXIC_W { DMATXIC_W { w: self } } #[doc = "Bit 5 - Transmit Request Interrupt Mask"] #[inline(always)] pub fn txic(&mut self) -> TXIC_W { TXIC_W { w: self } } #[doc = "Bit 6 - Receive Request Interrupt Mask"] #[inline(always)] pub fn rxic(&mut self) -> RXIC_W { RXIC_W { w: self } } #[doc = "Bit 7 - Transmit FIFO Empty Interrupt Mask"] #[inline(always)] pub fn txfeic(&mut self) -> TXFEIC_W { TXFEIC_W { w: self } } #[doc = "Bit 8 - Receive FIFO Full Interrupt Mask"] #[inline(always)] pub fn rxffic(&mut self) -> RXFFIC_W { RXFFIC_W { w: self } } }
use crate::state::Shared; use super::peer::Peer; use super::protocol::Protocol; use futures::SinkExt; use std::error::Error; use std::sync::Arc; // use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::TcpListener; use tokio_stream::StreamExt; // use tokio::sync::Mutex; use std::net::SocketAddr; use tokio::net::TcpStream; use tokio::sync::RwLock; use tokio_util::codec::Framed; pub async fn start_tcp_server(state: Arc<RwLock<Shared>>) -> Result<(), Box<dyn Error>> { let listener = TcpListener::bind("127.0.0.1:2345").await?; loop { // Asynchronously wait for an inbound socket. let (socket, addr) = listener.accept().await?; println!("{}", addr); // And this is where much of the magic of this server happens. We // crucially want all clients to make progress concurrently, rather than // blocking one on completion of another. To achieve this we use the // `tokio::spawn` function to execute the work in the background. // // Essentially here we're executing a new task to run concurrently, // which will allow all of our clients to be processed concurrently. let state = state.clone(); tokio::spawn(async move { if let Err(e) = process(state, socket, addr).await { eprintln!("an error occurred; error = {:?}", e); } }); } // loop { // // Asynchronously wait for an inbound TcpStream. // let (stream, addr) = listener.accept().await?; // // Clone a handle to the `Shared` state for the new connection. // let state = Arc::clone(&state); // // Spawn our handler to be run asynchronously. // tokio::spawn(async move { // tracing::debug!("accepted connection"); // if let Err(e) = process(state, stream, addr).await { // tracing::info!("an error occurred; error = {:?}", e); // } // }); // } } async fn process( state: Arc<RwLock<Shared>>, stream: TcpStream, addr: SocketAddr, ) -> Result<(), Box<dyn Error>> { let mut transport = Framed::new(stream, Protocol); let mut peer = Peer::new(state.clone(), transport).await?; // A client has connected, let's let everyone know. { let mut state = state.write().await; // let msg = format!("{} has joined the chat", username); // tracing::info!("{}", msg); // state.broadcast(addr, &msg).await; } // Process incoming messages until our stream is exhausted by a disconnect. loop { tokio::select! { Some(msg) = peer.rx.recv() => { peer.transport.send(msg).await?; } result = peer.transport.next() => match result { // A message was received from the current user, we should // broadcast this message to the other users. Some(Ok(msg)) => { println!("msg {:?}", msg); // let mut state = state.read().await; // let msg = format!("{}: {}", username, msg); peer.transport.send(msg).await?; // state.broadcast(addr, &msg).await; } // An error occurred. Some(Err(e)) => { // tracing::error!( // "an error occurred while processing messages for {}; error = {:?}", // username, // e // ); } // The stream has been exhausted. None => break, }, } } // If this section is reached it means that the client was disconnected! // Let's let everyone still connected know about it. { let mut state = state.write().await; state.peers.remove(&addr); let msg = format!("{} has left", addr); println!("{}", msg) // state.broadcast(addr, &msg).await; } Ok(()) }
use std::mem; use std::ops::DerefMut; use neon::prelude::*; use manifest::{Manifest, format}; use ::MANIFEST; /// Creates a new manifest. /// /// # Arguments /// None /// /// # Return /// None /// /// # Exceptions /// None pub fn create_manifest(mut cx: FunctionContext) -> JsResult<JsNull> { info!("Creating new manifest"); mem::replace(MANIFEST.write().deref_mut(), Some(Default::default())); Ok(cx.null()) } fn parse_serialization_options( cx: &mut FunctionContext, obj: Handle<JsObject> ) -> NeonResult<Option<format::ManifestSerializationOptions>> { Ok(Some(format::ManifestSerializationOptions { passphrase: { let js_passphrase = obj.get(cx, "passphrase")?; if js_passphrase.is_a::<JsNull>() { None } else { Some(js_passphrase.downcast_or_throw::<JsString, _>(cx)?.value()) } }, compressed: obj.get(cx, "compressed")?.downcast_or_throw::<JsBoolean, _>(cx)?.value(), format: match obj.get(cx, "format")?.downcast_or_throw::<JsString, _>(cx)?.value().as_ref() { "Json" => format::ManifestFormat::Json, "JsonPretty" => format::ManifestFormat::JsonPretty, "Cbor" => format::ManifestFormat::Cbor, "Yaml" => format::ManifestFormat::Yaml, _ => return Ok(None), } })) } /// Saves the current manifest in a file. /// /// # Arguments /// [ /// path: String, /// { /// passphrase: null or string, /// compressed: boolean, /// format: string (one of "Json", "JsonPretty", "Cbor", or "Yaml") /// } /// ] /// /// # Returns /// True if saving succeeded; false if it failed. /// /// # Exceptions /// Throws if no manifest is loaded. pub fn save_manifest(mut cx: FunctionContext) -> JsResult<JsBoolean> { info!("Saving manifest"); let manifest = MANIFEST.read(); if manifest.is_none() { error!("Tried to save manifest while no manifest loaded!"); return cx.throw_error("no manifest loaded"); } let path: String = cx.argument::<JsString>(0)?.value(); let serialziation_arg = cx.argument::<JsObject>(1)?; if let Some(options) = parse_serialization_options(&mut cx, serialziation_arg)? { match manifest.as_ref().unwrap().save_to_file(path, &options) { Ok(_) => Ok(cx.boolean(true)), Err(e) => { error!("Failed to save manifest: {}", e); Ok(cx.boolean(false)) } } } else { error!("Could not parse serialization options!"); Ok(cx.boolean(false)) } } /// Attempts to load a manifest from a file. /// /// # Arguments /// [ /// path: String, /// { /// passphrase: null or string, /// compressed: boolean, /// format: string (one of "Json", "JsonPretty", "Cbor", or "Yaml") /// } /// ] /// /// # Returns /// True if loading succeeded; false if it failed. /// /// # Exceptions /// None. pub fn load_manifest(mut cx: FunctionContext) -> JsResult<JsBoolean> { info!("Loading manifest"); let path: String = cx.argument::<JsString>(0)?.value(); let serialization_arg = cx.argument::<JsObject>(1)?; if let Some(options) = parse_serialization_options(&mut cx, serialization_arg)? { debug!("Loading manifest from {} with options {:?}", path, options); match Manifest::load_from_file(path, &options) { Ok(manifest) => { mem::replace(MANIFEST.write().deref_mut(), Some(manifest)); Ok(cx.boolean(true)) } Err(e) => { error!("Failed to load manifest: {}", e); Ok(cx.boolean(false)) } } } else { error!("Could not parse serialization options!"); Ok(cx.boolean(false)) } } /// Closes the open manifest. /// /// # Arguments /// None. /// /// # Returns /// True if there was a manifest loaded; false otherwise. /// /// # Exceptions /// None. pub fn close_manifest(mut cx: FunctionContext) -> JsResult<JsBoolean> { info!("Closing manifest"); Ok(cx.boolean(MANIFEST.write().take().is_some())) }
//! Hardware checksum engine use bl602_pac::CKS; /// Checksum engine abstraction /// /// # Examples /// /// ```no_run /// use bl602_hal::pac; /// use bl602_hal::checksum::{Checksum, Endianness}; /// /// fn main() -> ! { /// let dp = pac::Peripherals::take().unwrap(); /// let checksum = Checksum::new(dp.CKS, Endianness::Little); /// /// checksum.write(&[ /// 0x45, 0x00, 0x00, 0x73, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11, 0x00, 0x00, 0xc0, 0xa8, 0x00, /// 0x01, 0xc0, 0xa8, 0x00, 0xc7, /// ]); /// /// assert_eq!(checksum.result(), u16::from_be_bytes([0xb8, 0x61])); /// /// loop {} /// } /// ``` pub struct Checksum { cks: CKS, } /// The endianness used when computing checksums. pub enum Endianness { /// Big endian Big, /// Little endian Little, } impl Checksum { /// Resets the CKS state and returns a new `Checksum` instance that is configured to compute /// checksums with the given `endianness`. /// /// This takes ownership of the `CKS` peripheral to ensure that the state won't be modified or /// reset somewhere else pub fn new(cks: CKS, endianness: Endianness) -> Self { let checksum = Self { cks }; checksum.reset(endianness); checksum } /// Resets the CKS peripheral while setting the `endianness`. #[inline(always)] pub fn reset(&self, endianness: Endianness) { self.cks.cks_config.write(|w| { // Set `cr_cks_clr` to `1` in order to clear the checksum engine state w.cr_cks_clr() .set_bit() // Set the `cr_cks_byte_swap` bit to 1 when big endian, 0 when little endian. .cr_cks_byte_swap() .bit(match endianness { Endianness::Big => true, Endianness::Little => false, }) }); } /// Sets the `endianness` of the checksum engine. #[inline(always)] pub fn set_endianness(&self, endianness: Endianness) { // Set the `cr_cks_byte_swap` bit to 1 when big endian, 0 when little endian. self.cks.cks_config.write(|w| { w.cr_cks_byte_swap().bit(match endianness { Endianness::Big => true, Endianness::Little => false, }) }); } /// Writes the given slice of `bytes` to the checksum engine, one at a time. #[inline(always)] pub fn write(&self, bytes: &[u8]) { for byte in bytes { self.cks.data_in.write(|w| unsafe { w.bits(*byte as u32) }); } } /// Reads the computed 16-bit result from the checksum engine. #[inline(always)] pub fn result(&self) -> u16 { self.cks.cks_out.read().bits() as u16 } /// Releases the checksum (`CKS`) peripheral. pub fn free(self) -> CKS { self.cks } }
fn str_ref( s: &str ) { println!("{}", &s[0..4]); } fn str_append( s: &mut String ) { s.push_str("TTTT"); } fn iter_ex() { let names = vec!["Bob", "Frank", "Ferris"]; // borrowing iterator: iter for name in names.iter() { match name { &"Ferris" => println!("There is a rustacean among us...{}", name), _ => println!("Hello {}", name), } } } fn opt_iter_ex() { let names = vec![Some("Bob"), Some("Frank"), Some("Ferris")]; // borrowing iterator: iter for name in names.iter() { match name { Some("Ferris") => println!("There is a rustacean among us...{}", name.unwrap() ), Some(_) => println!("Hello {}", name.unwrap()), None => println!("NONE"), } } println!("names len {}", names.len()); } fn into_iter_ex() { let names = vec!['a', 'b', 'c']; // consuming iterator: into_iter for name in names.into_iter() { match name { 'b' => println!("There is a Char B among us!"), _ => println!("Hello {}", name), } } //println!("the resulting names vec{:?}", names); } fn iter_mut_ex() { let mut names = vec!["Bob", "Frank", "Ferris"]; // mutable borrow iter_mut: for name in names.iter_mut() { match name { &mut "Ferris" => println!("There is a rustacean among us!"), _ => println!("Hello {}", name), } } } fn main() { // string literals are string slices let hello = "hello world"; // String slice range indices must occur at valid UTF-8 character boundaries. If you attempt // to create a string slice in the middle of a multibyte character, your program will exit with an error let ptr = &hello[0..3]; // parsing strings let one_hundred: &str = "-100"; let p100: i32 = one_hundred.parse().unwrap(); println!("parsed 100 to {}",p100); let four = "4".parse::<u32>(); // using turbofish let s1: &str = "this is a string slice, it is part of rust core"; // creates a String type from a string literal let s2: String = String::from("'String' is a growable, mutable, owned, UTF-8 encoded string type"); // converting a string slice to a String type let mut data: String = s1.to_string(); str_ref(s1); str_append(&mut data); println!("{}", data); opt_iter_ex(); }
use std::fmt; use super::lexer::{Token, Keyword}; #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum TyKind { U8, U16, U32, U64, I8, I16, I32, I64, Void, } #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct Ty { kind: TyKind, indirection: usize, } impl Ty { pub const U8: Ty = Ty { kind: TyKind::U8, indirection: 0 }; pub const U16: Ty = Ty { kind: TyKind::U16, indirection: 0 }; pub const U32: Ty = Ty { kind: TyKind::U32, indirection: 0 }; pub const U64: Ty = Ty { kind: TyKind::U64, indirection: 0 }; pub const I8: Ty = Ty { kind: TyKind::I8, indirection: 0 }; pub const I16: Ty = Ty { kind: TyKind::I16, indirection: 0 }; pub const I32: Ty = Ty { kind: TyKind::I32, indirection: 0 }; pub const I64: Ty = Ty { kind: TyKind::I64, indirection: 0 }; #[allow(non_upper_case_globals)] pub const Void: Ty = Ty { kind: TyKind::Void, indirection: 0 }; pub(super) fn from_token(token: &Token) -> Option<Self> { Some(match token { Token::Keyword(Keyword::U8) => Ty::U8, Token::Keyword(Keyword::U16) => Ty::U16, Token::Keyword(Keyword::U32) => Ty::U32, Token::Keyword(Keyword::U64) => Ty::U64, Token::Keyword(Keyword::I8) => Ty::I8, Token::Keyword(Keyword::I16) => Ty::I16, Token::Keyword(Keyword::I32) => Ty::I32, Token::Keyword(Keyword::I64) => Ty::I64, Token::Keyword(Keyword::Void) => Ty::Void, _ => return None, }) } pub fn conversion_rank(&self) -> u32 { assert!(!self.is_pointer(), "Cannot get conversion rank of pointer types."); match self.kind { TyKind::U8 => 1, TyKind::U16 => 2, TyKind::U32 => 3, TyKind::U64 => 4, TyKind::I8 => 1, TyKind::I16 => 2, TyKind::I32 => 3, TyKind::I64 => 4, _ => unreachable!(), } } pub fn ptr(&self) -> Ty { Ty { kind: self.kind, indirection: self.indirection + 1, } } pub fn strip_pointer(&self) -> Option<Ty> { Some(Ty { kind: self.kind, indirection: self.indirection.checked_sub(1)?, }) } pub fn is_arithmetic_type(&self) -> bool { self.indirection == 0 && self.kind != TyKind::Void } pub fn is_pointer(&self) -> bool { self.indirection > 0 } pub fn is_signed(&self) -> bool { if self.is_pointer() { return false; } matches!(self.kind, TyKind::I8 | TyKind::I16 | TyKind::I32 | TyKind::I64) } pub fn is_nonvoid_ptr(&self) -> bool { if !self.is_pointer() { return false; } if self.indirection == 1 && self.kind == TyKind::Void { return false; } true } pub fn size(&self) -> usize { if self.is_pointer() { return 8; } match self.kind { TyKind::I8 | TyKind::U8 => 1, TyKind::I16 | TyKind::U16 => 2, TyKind::I32 | TyKind::U32 => 4, TyKind::I64 | TyKind::U64 => 8, TyKind::Void => panic!("Cannot get size of void."), } } pub fn destructure(&self) -> (TyKind, usize) { (self.kind, self.indirection) } } impl fmt::Display for Ty { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.kind { TyKind::U8 => write!(f, "u8")?, TyKind::U16 => write!(f, "u16")?, TyKind::U32 => write!(f, "u32")?, TyKind::U64 => write!(f, "u64")?, TyKind::I8 => write!(f, "i8")?, TyKind::I16 => write!(f, "i16")?, TyKind::I32 => write!(f, "i32")?, TyKind::I64 => write!(f, "i64")?, TyKind::Void => write!(f, "void")?, } for _ in 0..self.indirection { write!(f, "*")?; } Ok(()) } }
use {IsZero, Dot, Lerp, Point}; use std::ops::*; use std::fmt::{self, Debug, Formatter}; use std::slice; // VECTOR 3 // ================================================================================================ #[derive(Clone, Copy, PartialEq)] #[repr(C)] pub struct Vector3 { pub x: f32, pub y: f32, pub z: f32 } impl Vector3 { pub fn new(x: f32, y: f32, z: f32) -> Vector3 { Vector3 { x: x, y: y, z: z } } pub fn from_vector2(from: Vector2, z: f32) -> Vector3 { Vector3 { x: from.x, y: from.y, z: z, } } pub fn zero() -> Vector3 { Vector3::new(0.0, 0.0, 0.0) } pub fn one() -> Vector3 { Vector3::new(1.0, 1.0, 1.0) } pub fn right() -> Vector3 { Vector3::new(1.0, 0.0, 0.0) } pub fn left() -> Vector3 { Vector3::new(-1.0, 0.0, 0.0) } pub fn up() -> Vector3 { Vector3::new(0.0, 1.0, 0.0) } pub fn down() -> Vector3 { Vector3::new(0.0, -1.0, 0.0) } pub fn forward() -> Vector3 { Vector3::new(0.0, 0.0, -1.0) } pub fn back() -> Vector3 { Vector3::new(0.0, 0.0, 1.0) } pub fn cross(first: Vector3, second: Vector3) -> Vector3 { Vector3 { x: first.y * second.z - first.z * second.y, y: first.z * second.x - first.x * second.z, z: first.x * second.y - first.y * second.x, } } pub fn set_x(mut self, x: f32) -> Vector3 { self.x = x; self } pub fn set_y(mut self, y: f32) -> Vector3 { self.y = y; self } pub fn set_z(mut self, z: f32) -> Vector3 { self.z = z; self } /// Normalizes the vector, returning the old length. /// /// If the vector is the zero vector it is not altered. pub fn normalize(&mut self) -> f32 { if self.is_zero() { 0.0 } else { let magnitude = self.magnitude(); let one_over_magnitude = 1.0 / magnitude; self.x *= one_over_magnitude; self.y *= one_over_magnitude; self.z *= one_over_magnitude; magnitude } } /// Returns the normalized version of the vector. /// /// If the vector is the zero vector a copy is returned. pub fn normalized(&self) -> Vector3 { if self.is_zero() { *self } else { let mut copy = *self; copy.normalize(); copy } } pub fn is_normalized(&self) -> bool { (self.dot(self) - 1.0).is_zero() } pub fn magnitude(&self) -> f32 { self.magnitude_squared().sqrt() } pub fn magnitude_squared(&self) -> f32 { self.x * self.x + self.y * self.y + self.z * self.z } /// Safely reinterprets a slice of Vector3s to a slice of f32s. This is a cheap operation and /// does not copy any data. pub fn as_ref(vectors: &[Vector3]) -> &[f32] { unsafe { ::std::slice::from_raw_parts( vectors.as_ptr() as *const f32, vectors.len() * 3) } } pub fn as_slice_of_arrays(vecs: &[Vector3]) -> &[[f32; 3]] { let ptr = vecs.as_ptr() as *const _; unsafe { slice::from_raw_parts(ptr, vecs.len()) } } /// Converts the `Vector3` into a 3 element array. /// /// In the returned array, the `x` coordinate is at index 0, the `y` coordinate is at index 1, /// and the `z` coordinate is at index 2. pub fn into_array(self) -> [f32; 3] { let Vector3 { x, y, z } = self; [x, y, z] } // pub fn cross(&self, rhs: Vector3) -> Vector3 { // Vector3::new( // self.y * rhs.z - self.z * rhs.y, // self.z * rhs.x - self.x * rhs.z, // self.x * rhs.y - self.y * rhs.x) // } } impl Default for Vector3 { fn default() -> Vector3 { Vector3 { x: 0.0, y: 0.0, z: 0.0, } } } impl Debug for Vector3 { fn fmt(&self, fmt: &mut Formatter) -> Result<(), fmt::Error> { if let Some(precision) = fmt.precision() { write!( fmt, "Vector3 {{ x: {:+.3$}, y: {:+.3$}, z: {:+.3$} }}", self.x, self.y, self.z, precision, ) } else { write!(fmt, "Vector3 {{ x: {}, y: {}, z: {} }}", self.x, self.y, self.z) } } } impl Dot for Vector3 { type Output = f32; fn dot(self, rhs: Vector3) -> f32 { self.x * rhs.x + self.y * rhs.y + self.z * rhs.z } } impl Dot<[f32; 3]> for Vector3 { type Output = f32; fn dot(self, rhs: [f32; 3]) -> f32 { self.x * rhs[0] + self.y * rhs[1] + self.z * rhs[2] } } impl Dot<Vector3> for [f32; 3] { type Output = f32; fn dot(self, rhs: Vector3) -> f32 { rhs.dot(self) } } // impl<'a> Dot<&'a [f32; 3]> for Vector3 { // type Output = f32; // // fn dot(self, rhs: &[f32; 3]) -> f32 { // self.dot(*rhs) // } // } impl AddAssign for Vector3 { fn add_assign(&mut self, rhs: Vector3) { self.x += rhs.x; self.y += rhs.y; self.z += rhs.z; } } impl Add for Vector3 { type Output = Vector3; fn add(mut self, rhs: Vector3) -> Vector3 { self += rhs; self } } impl SubAssign for Vector3 { fn sub_assign(&mut self, rhs: Vector3) { self.x -= rhs.x; self.y -= rhs.y; self.z -= rhs.z; } } impl Sub for Vector3 { type Output = Vector3; fn sub(mut self, rhs: Vector3) -> Vector3 { self -= rhs; self } } impl MulAssign for Vector3 { fn mul_assign(&mut self, rhs: Vector3) { self.x *= rhs.x; self.y *= rhs.y; self.z *= rhs.z; } } impl Mul for Vector3 { type Output = Vector3; fn mul(mut self, rhs: Vector3) -> Vector3 { self *= rhs; self } } impl MulAssign<f32> for Vector3 { fn mul_assign(&mut self, rhs: f32) { self.x *= rhs; self.y *= rhs; self.z *= rhs; } } impl Mul<f32> for Vector3 { type Output = Vector3; fn mul(mut self, rhs: f32) -> Vector3 { self *= rhs; self } } impl Mul<Vector3> for f32 { type Output = Vector3; fn mul(self, rhs: Vector3) -> Vector3 { rhs * self } } impl Neg for Vector3 { type Output = Vector3; fn neg(self) -> Vector3 { Vector3::new(-self.x, -self.y, -self.z) } } impl DivAssign<f32> for Vector3 { fn div_assign(&mut self, rhs: f32) { self.x /= rhs; self.y /= rhs; self.z /= rhs; } } impl Div<f32> for Vector3 { type Output = Vector3; fn div(mut self, rhs: f32) -> Vector3 { self /= rhs; self } } impl Div<Vector3> for f32 { type Output = Vector3; fn div(self, rhs: Vector3) -> Vector3 { rhs / self } } impl IsZero for Vector3 { fn is_zero(self) -> bool { self.dot(self).is_zero() } } // TODO: Is `usize` an appropriate index? Especially considering the valid values are 0..3? impl Index<usize> for Vector3 { type Output = f32; fn index(&self, index: usize) -> &f32 { match index { 0 => &self.x, 1 => &self.y, 2 => &self.z, // TODO: Use `unreachable()` intrinsic in release mode. _ => panic!("Index {} is out of bounds for Vector3", index), } } } impl IndexMut<usize> for Vector3 { fn index_mut(&mut self, index: usize) -> &mut f32 { match index { 0 => &mut self.x, 1 => &mut self.y, 2 => &mut self.z, // TODO: Use `unreachable()` intrinsic in release mode. _ => panic!("Index {} is out of bounds for Vector3", index), } } } impl<'a> From<&'a [f32]> for Vector3 { fn from(from: &[f32]) -> Vector3 { assert!(from.len() == 3); Vector3 { x: from[0], y: from[1], z: from[2], } } } impl <'a> From<[f32; 3]> for Vector3 { fn from(from: [f32; 3]) -> Vector3 { Vector3 { x: from[0], y: from[1], z: from[2], } } } impl From<Point> for Vector3 { /// Creates a new `Vector3` from a `Point`. /// /// This behaves as if the point had been subtracted from the origin, yielding a `Vector3` with /// the same x, y, and z coordinates as the original point. The conversion can be expressed as /// `(x, y, z, 1.0) => <x, y, z>`. fn from(from: Point) -> Vector3 { Vector3 { x: from.x, y: from.y, z: from.z, } } } impl From<(f32, f32, f32)> for Vector3 { fn from(from: (f32, f32, f32)) -> Vector3 { Vector3 { x: from.0, y: from.1, z: from.2, } } } impl Into<[f32; 3]> for Vector3 { fn into(self) -> [f32; 3] { [self.x, self.y, self.z] } } impl Into<(f32, f32, f32)> for Vector3 { fn into(self) -> (f32, f32, f32) { (self.x, self.y, self.z) } } // VECTOR 2 // ================================================================================================ #[derive(Debug, Copy, Clone, PartialEq, PartialOrd)] pub struct Vector2 { pub x: f32, pub y: f32, } impl Vector2 { pub fn new(x: f32, y: f32) -> Vector2 { Vector2 { x: x, y: y, } } pub fn right() -> Vector2 { Vector2::new(1.0, 0.0) } pub fn left() -> Vector2 { Vector2::new(-1.0, 0.0) } pub fn up() -> Vector2 { Vector2::new(0.0, 1.0) } pub fn down() -> Vector2 { Vector2::new(0.0, -1.0) } pub fn as_ref(vectors: &[Vector2]) -> &[f32] { use std::slice; unsafe { slice::from_raw_parts( vectors.as_ptr() as *const f32, vectors.len() * 2) } } pub fn slice_from_f32_slice(data: &[f32]) -> &[Vector2] { use std::slice; assert!(data.len() % 2 == 0, "Slice must have an even number of elements to be converted to a slice of Vector2"); unsafe { slice::from_raw_parts( data.as_ptr() as *const Vector2, data.len() / 2, ) } } } impl Default for Vector2 { fn default() -> Vector2 { Vector2 { x: 0.0, y: 0.0, } } } impl Lerp for Vector2 { fn lerp(t: f32, from: Vector2, to: Vector2) -> Vector2 { from + (to - from) * t } } impl Add for Vector2 { type Output = Vector2; fn add(self, rhs: Vector2) -> Vector2 { Vector2 { x: self.x + rhs.x, y: self.y + rhs.y, } } } impl Sub for Vector2 { type Output = Vector2; fn sub(self, rhs: Vector2) -> Vector2 { Vector2 { x: self.x - rhs.x, y: self.y - rhs.y, } } } impl Mul for Vector2 { type Output = Vector2; fn mul(self, rhs: Vector2) -> Vector2 { Vector2 { x: self.x * rhs.x, y: self.y * rhs.y, } } } impl Mul<f32> for Vector2 { type Output = Vector2; fn mul(self, rhs: f32) -> Vector2 { Vector2 { x: self.x * rhs, y: self.y * rhs, } } } impl Mul<Vector2> for f32 { type Output = Vector2; fn mul(self, rhs: Vector2) -> Vector2 { rhs * self } }
use std::path::Path; use amiga_hunk_parser::{Hunk, HunkParser, SourceLine}; pub struct DebugInfo { pub hunks: Vec<Hunk>, } impl DebugInfo { pub fn new() -> DebugInfo { DebugInfo { hunks: Vec::new(), } } pub fn load_info(&mut self, uae_path: &str, amiga_exe: &str) { // TODO: Not assume dhx: path let path = Path::new(uae_path).join(&amiga_exe[4..]); println!("Trying debug data from {:?}", path); if let Ok(hunks) = HunkParser::parse_file(path.to_str().unwrap()) { println!("Loading ok!"); self.hunks = hunks; } } fn try_find_line(filename: &str, lines: &Vec<SourceLine>, offset: u32) -> Option<(String, u32)> { let mut source_line = 0u32; let mut was_over = false; for line in lines { if line.offset == offset { //println!("Matching source {} line {}", filename, line.line); return Some((filename.to_owned(), line.line)); } if line.offset <= offset { source_line = line.line; } else if line.offset > offset { was_over = true; } } if was_over { //println!("Partial Matching source {} line {}", filename, source_line); Some((filename.to_owned(), source_line)) } else { None } } pub fn resolve_file_line(&self, offset: u32, seg_id: u32) -> Option<(String, u32)> { if seg_id >= self.hunks.len() as u32 { return None; } let hunk = &self.hunks[seg_id as usize]; if let Some(ref source_files) = hunk.line_debug_info { for src_file in source_files { //if offset > src_file.base_offset { // continue; //} if let Some(data) = Self::try_find_line(&src_file.name, &src_file.lines, offset) { return Some(data); } } } None } pub fn get_address_seg(&self, filename: &str, file_line: u32) -> Option<(u32, u32)> { for (i, hunk) in self.hunks.iter().enumerate() { if let Some(ref source_files) = hunk.line_debug_info { for src_file in source_files { if src_file.name != filename { continue; } for line in &src_file.lines { if line.line == file_line { return Some((i as u32, line.offset)); } } } } } None } }
// Copyright 2022 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. use std::fmt::Display; use std::fmt::Formatter; use crate::ast::write_comma_separated_list; #[derive(Debug, Clone, PartialEq, Eq)] pub struct CallStmt { pub name: String, pub args: Vec<String>, } impl Display for CallStmt { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { write!(f, "CALL {}(", self.name)?; write_comma_separated_list(f, self.args.clone())?; write!(f, ")")?; Ok(()) } }
mod entry; mod error; mod node; mod rpc; mod tests; mod timer; pub use node::Node;
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ActivitySensorTrigger(pub ::windows::core::IInspectable); impl ActivitySensorTrigger { #[cfg(all(feature = "Devices_Sensors", feature = "Foundation_Collections"))] pub fn SubscribedActivities(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<super::super::Devices::Sensors::ActivityType>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<super::super::Devices::Sensors::ActivityType>>(result__) } } pub fn ReportInterval(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } #[cfg(all(feature = "Devices_Sensors", feature = "Foundation_Collections"))] pub fn SupportedActivities(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<super::super::Devices::Sensors::ActivityType>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVectorView<super::super::Devices::Sensors::ActivityType>>(result__) } } pub fn MinimumReportInterval(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn Create(reportintervalinmilliseconds: u32) -> ::windows::core::Result<ActivitySensorTrigger> { Self::IActivitySensorTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), reportintervalinmilliseconds, &mut result__).from_abi::<ActivitySensorTrigger>(result__) }) } pub fn IActivitySensorTriggerFactory<R, F: FnOnce(&IActivitySensorTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<ActivitySensorTrigger, IActivitySensorTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for ActivitySensorTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.ActivitySensorTrigger;{d0dd4342-e37b-4823-a5fe-6b31dfefdeb0})"); } unsafe impl ::windows::core::Interface for ActivitySensorTrigger { type Vtable = IActivitySensorTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd0dd4342_e37b_4823_a5fe_6b31dfefdeb0); } impl ::windows::core::RuntimeName for ActivitySensorTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.ActivitySensorTrigger"; } impl ::core::convert::From<ActivitySensorTrigger> for ::windows::core::IUnknown { fn from(value: ActivitySensorTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&ActivitySensorTrigger> for ::windows::core::IUnknown { fn from(value: &ActivitySensorTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ActivitySensorTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ActivitySensorTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ActivitySensorTrigger> for ::windows::core::IInspectable { fn from(value: ActivitySensorTrigger) -> Self { value.0 } } impl ::core::convert::From<&ActivitySensorTrigger> for ::windows::core::IInspectable { fn from(value: &ActivitySensorTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ActivitySensorTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a ActivitySensorTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<ActivitySensorTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: ActivitySensorTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&ActivitySensorTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &ActivitySensorTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for ActivitySensorTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &ActivitySensorTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for ActivitySensorTrigger {} unsafe impl ::core::marker::Sync for ActivitySensorTrigger {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct AlarmAccessStatus(pub i32); impl AlarmAccessStatus { pub const Unspecified: AlarmAccessStatus = AlarmAccessStatus(0i32); pub const AllowedWithWakeupCapability: AlarmAccessStatus = AlarmAccessStatus(1i32); pub const AllowedWithoutWakeupCapability: AlarmAccessStatus = AlarmAccessStatus(2i32); pub const Denied: AlarmAccessStatus = AlarmAccessStatus(3i32); } impl ::core::convert::From<i32> for AlarmAccessStatus { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for AlarmAccessStatus { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for AlarmAccessStatus { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.AlarmAccessStatus;i4)"); } impl ::windows::core::DefaultType for AlarmAccessStatus { type DefaultType = Self; } pub struct AlarmApplicationManager {} impl AlarmApplicationManager { #[cfg(feature = "Foundation")] pub fn RequestAccessAsync() -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<AlarmAccessStatus>> { Self::IAlarmApplicationManagerStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<AlarmAccessStatus>>(result__) }) } pub fn GetAccessStatus() -> ::windows::core::Result<AlarmAccessStatus> { Self::IAlarmApplicationManagerStatics(|this| unsafe { let mut result__: AlarmAccessStatus = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<AlarmAccessStatus>(result__) }) } pub fn IAlarmApplicationManagerStatics<R, F: FnOnce(&IAlarmApplicationManagerStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<AlarmApplicationManager, IAlarmApplicationManagerStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } impl ::windows::core::RuntimeName for AlarmApplicationManager { const NAME: &'static str = "Windows.ApplicationModel.Background.AlarmApplicationManager"; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AppBroadcastTrigger(pub ::windows::core::IInspectable); impl AppBroadcastTrigger { pub fn SetProviderInfo<'a, Param0: ::windows::core::IntoParam<'a, AppBroadcastTriggerProviderInfo>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn ProviderInfo(&self) -> ::windows::core::Result<AppBroadcastTriggerProviderInfo> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<AppBroadcastTriggerProviderInfo>(result__) } } pub fn CreateAppBroadcastTrigger<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(providerkey: Param0) -> ::windows::core::Result<AppBroadcastTrigger> { Self::IAppBroadcastTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), providerkey.into_param().abi(), &mut result__).from_abi::<AppBroadcastTrigger>(result__) }) } pub fn IAppBroadcastTriggerFactory<R, F: FnOnce(&IAppBroadcastTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<AppBroadcastTrigger, IAppBroadcastTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for AppBroadcastTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.AppBroadcastTrigger;{74d4f496-8d37-44ec-9481-2a0b9854eb48})"); } unsafe impl ::windows::core::Interface for AppBroadcastTrigger { type Vtable = IAppBroadcastTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x74d4f496_8d37_44ec_9481_2a0b9854eb48); } impl ::windows::core::RuntimeName for AppBroadcastTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.AppBroadcastTrigger"; } impl ::core::convert::From<AppBroadcastTrigger> for ::windows::core::IUnknown { fn from(value: AppBroadcastTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&AppBroadcastTrigger> for ::windows::core::IUnknown { fn from(value: &AppBroadcastTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AppBroadcastTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a AppBroadcastTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<AppBroadcastTrigger> for ::windows::core::IInspectable { fn from(value: AppBroadcastTrigger) -> Self { value.0 } } impl ::core::convert::From<&AppBroadcastTrigger> for ::windows::core::IInspectable { fn from(value: &AppBroadcastTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AppBroadcastTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a AppBroadcastTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<AppBroadcastTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: AppBroadcastTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&AppBroadcastTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &AppBroadcastTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for AppBroadcastTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &AppBroadcastTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for AppBroadcastTrigger {} unsafe impl ::core::marker::Sync for AppBroadcastTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AppBroadcastTriggerProviderInfo(pub ::windows::core::IInspectable); impl AppBroadcastTriggerProviderInfo { pub fn SetDisplayNameResource<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn DisplayNameResource(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetLogoResource<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn LogoResource(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn SetVideoKeyFrameInterval<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn VideoKeyFrameInterval(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } pub fn SetMaxVideoBitrate(&self, value: u32) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), value).ok() } } pub fn MaxVideoBitrate(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn SetMaxVideoWidth(&self, value: u32) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), value).ok() } } pub fn MaxVideoWidth(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn SetMaxVideoHeight(&self, value: u32) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), value).ok() } } pub fn MaxVideoHeight(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } } unsafe impl ::windows::core::RuntimeType for AppBroadcastTriggerProviderInfo { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.AppBroadcastTriggerProviderInfo;{f219352d-9de8-4420-9ce2-5eff8f17376b})"); } unsafe impl ::windows::core::Interface for AppBroadcastTriggerProviderInfo { type Vtable = IAppBroadcastTriggerProviderInfo_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf219352d_9de8_4420_9ce2_5eff8f17376b); } impl ::windows::core::RuntimeName for AppBroadcastTriggerProviderInfo { const NAME: &'static str = "Windows.ApplicationModel.Background.AppBroadcastTriggerProviderInfo"; } impl ::core::convert::From<AppBroadcastTriggerProviderInfo> for ::windows::core::IUnknown { fn from(value: AppBroadcastTriggerProviderInfo) -> Self { value.0 .0 } } impl ::core::convert::From<&AppBroadcastTriggerProviderInfo> for ::windows::core::IUnknown { fn from(value: &AppBroadcastTriggerProviderInfo) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AppBroadcastTriggerProviderInfo { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a AppBroadcastTriggerProviderInfo { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<AppBroadcastTriggerProviderInfo> for ::windows::core::IInspectable { fn from(value: AppBroadcastTriggerProviderInfo) -> Self { value.0 } } impl ::core::convert::From<&AppBroadcastTriggerProviderInfo> for ::windows::core::IInspectable { fn from(value: &AppBroadcastTriggerProviderInfo) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AppBroadcastTriggerProviderInfo { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a AppBroadcastTriggerProviderInfo { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for AppBroadcastTriggerProviderInfo {} unsafe impl ::core::marker::Sync for AppBroadcastTriggerProviderInfo {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ApplicationTrigger(pub ::windows::core::IInspectable); impl ApplicationTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<ApplicationTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Foundation")] pub fn RequestAsync(&self) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<ApplicationTriggerResult>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<ApplicationTriggerResult>>(result__) } } #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub fn RequestAsyncWithArguments<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Collections::ValueSet>>(&self, arguments: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<ApplicationTriggerResult>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), arguments.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<ApplicationTriggerResult>>(result__) } } } unsafe impl ::windows::core::RuntimeType for ApplicationTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.ApplicationTrigger;{0b468630-9574-492c-9e93-1a3ae6335fe9})"); } unsafe impl ::windows::core::Interface for ApplicationTrigger { type Vtable = IApplicationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0b468630_9574_492c_9e93_1a3ae6335fe9); } impl ::windows::core::RuntimeName for ApplicationTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.ApplicationTrigger"; } impl ::core::convert::From<ApplicationTrigger> for ::windows::core::IUnknown { fn from(value: ApplicationTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&ApplicationTrigger> for ::windows::core::IUnknown { fn from(value: &ApplicationTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ApplicationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ApplicationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ApplicationTrigger> for ::windows::core::IInspectable { fn from(value: ApplicationTrigger) -> Self { value.0 } } impl ::core::convert::From<&ApplicationTrigger> for ::windows::core::IInspectable { fn from(value: &ApplicationTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ApplicationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a ApplicationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<ApplicationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: ApplicationTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&ApplicationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &ApplicationTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for ApplicationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &ApplicationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for ApplicationTrigger {} unsafe impl ::core::marker::Sync for ApplicationTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ApplicationTriggerDetails(pub ::windows::core::IInspectable); impl ApplicationTriggerDetails { #[cfg(feature = "Foundation_Collections")] pub fn Arguments(&self) -> ::windows::core::Result<super::super::Foundation::Collections::ValueSet> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::ValueSet>(result__) } } } unsafe impl ::windows::core::RuntimeType for ApplicationTriggerDetails { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.ApplicationTriggerDetails;{97dc6ab2-2219-4a9e-9c5e-41d047f76e82})"); } unsafe impl ::windows::core::Interface for ApplicationTriggerDetails { type Vtable = IApplicationTriggerDetails_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x97dc6ab2_2219_4a9e_9c5e_41d047f76e82); } impl ::windows::core::RuntimeName for ApplicationTriggerDetails { const NAME: &'static str = "Windows.ApplicationModel.Background.ApplicationTriggerDetails"; } impl ::core::convert::From<ApplicationTriggerDetails> for ::windows::core::IUnknown { fn from(value: ApplicationTriggerDetails) -> Self { value.0 .0 } } impl ::core::convert::From<&ApplicationTriggerDetails> for ::windows::core::IUnknown { fn from(value: &ApplicationTriggerDetails) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ApplicationTriggerDetails { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ApplicationTriggerDetails { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ApplicationTriggerDetails> for ::windows::core::IInspectable { fn from(value: ApplicationTriggerDetails) -> Self { value.0 } } impl ::core::convert::From<&ApplicationTriggerDetails> for ::windows::core::IInspectable { fn from(value: &ApplicationTriggerDetails) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ApplicationTriggerDetails { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a ApplicationTriggerDetails { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for ApplicationTriggerDetails {} unsafe impl ::core::marker::Sync for ApplicationTriggerDetails {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct ApplicationTriggerResult(pub i32); impl ApplicationTriggerResult { pub const Allowed: ApplicationTriggerResult = ApplicationTriggerResult(0i32); pub const CurrentlyRunning: ApplicationTriggerResult = ApplicationTriggerResult(1i32); pub const DisabledByPolicy: ApplicationTriggerResult = ApplicationTriggerResult(2i32); pub const UnknownError: ApplicationTriggerResult = ApplicationTriggerResult(3i32); } impl ::core::convert::From<i32> for ApplicationTriggerResult { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for ApplicationTriggerResult { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for ApplicationTriggerResult { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.ApplicationTriggerResult;i4)"); } impl ::windows::core::DefaultType for ApplicationTriggerResult { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AppointmentStoreNotificationTrigger(pub ::windows::core::IInspectable); impl AppointmentStoreNotificationTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<AppointmentStoreNotificationTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for AppointmentStoreNotificationTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.AppointmentStoreNotificationTrigger;{64d4040c-c201-42ad-aa2a-e21ba3425b6d})"); } unsafe impl ::windows::core::Interface for AppointmentStoreNotificationTrigger { type Vtable = IAppointmentStoreNotificationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x64d4040c_c201_42ad_aa2a_e21ba3425b6d); } impl ::windows::core::RuntimeName for AppointmentStoreNotificationTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.AppointmentStoreNotificationTrigger"; } impl ::core::convert::From<AppointmentStoreNotificationTrigger> for ::windows::core::IUnknown { fn from(value: AppointmentStoreNotificationTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&AppointmentStoreNotificationTrigger> for ::windows::core::IUnknown { fn from(value: &AppointmentStoreNotificationTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AppointmentStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a AppointmentStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<AppointmentStoreNotificationTrigger> for ::windows::core::IInspectable { fn from(value: AppointmentStoreNotificationTrigger) -> Self { value.0 } } impl ::core::convert::From<&AppointmentStoreNotificationTrigger> for ::windows::core::IInspectable { fn from(value: &AppointmentStoreNotificationTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AppointmentStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a AppointmentStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<AppointmentStoreNotificationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: AppointmentStoreNotificationTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&AppointmentStoreNotificationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &AppointmentStoreNotificationTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for AppointmentStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &AppointmentStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for AppointmentStoreNotificationTrigger {} unsafe impl ::core::marker::Sync for AppointmentStoreNotificationTrigger {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct BackgroundAccessRequestKind(pub i32); impl BackgroundAccessRequestKind { pub const AlwaysAllowed: BackgroundAccessRequestKind = BackgroundAccessRequestKind(0i32); pub const AllowedSubjectToSystemPolicy: BackgroundAccessRequestKind = BackgroundAccessRequestKind(1i32); } impl ::core::convert::From<i32> for BackgroundAccessRequestKind { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for BackgroundAccessRequestKind { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for BackgroundAccessRequestKind { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.BackgroundAccessRequestKind;i4)"); } impl ::windows::core::DefaultType for BackgroundAccessRequestKind { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct BackgroundAccessStatus(pub i32); impl BackgroundAccessStatus { pub const Unspecified: BackgroundAccessStatus = BackgroundAccessStatus(0i32); pub const AllowedWithAlwaysOnRealTimeConnectivity: BackgroundAccessStatus = BackgroundAccessStatus(1i32); pub const AllowedMayUseActiveRealTimeConnectivity: BackgroundAccessStatus = BackgroundAccessStatus(2i32); pub const Denied: BackgroundAccessStatus = BackgroundAccessStatus(3i32); pub const AlwaysAllowed: BackgroundAccessStatus = BackgroundAccessStatus(4i32); pub const AllowedSubjectToSystemPolicy: BackgroundAccessStatus = BackgroundAccessStatus(5i32); pub const DeniedBySystemPolicy: BackgroundAccessStatus = BackgroundAccessStatus(6i32); pub const DeniedByUser: BackgroundAccessStatus = BackgroundAccessStatus(7i32); } impl ::core::convert::From<i32> for BackgroundAccessStatus { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for BackgroundAccessStatus { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for BackgroundAccessStatus { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.BackgroundAccessStatus;i4)"); } impl ::windows::core::DefaultType for BackgroundAccessStatus { type DefaultType = Self; } pub struct BackgroundExecutionManager {} impl BackgroundExecutionManager { #[cfg(feature = "Foundation")] pub fn RequestAccessAsync() -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<BackgroundAccessStatus>> { Self::IBackgroundExecutionManagerStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<BackgroundAccessStatus>>(result__) }) } #[cfg(feature = "Foundation")] pub fn RequestAccessForApplicationAsync<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(applicationid: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<BackgroundAccessStatus>> { Self::IBackgroundExecutionManagerStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), applicationid.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<BackgroundAccessStatus>>(result__) }) } pub fn RemoveAccess() -> ::windows::core::Result<()> { Self::IBackgroundExecutionManagerStatics(|this| unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this)).ok() }) } pub fn RemoveAccessForApplication<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(applicationid: Param0) -> ::windows::core::Result<()> { Self::IBackgroundExecutionManagerStatics(|this| unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), applicationid.into_param().abi()).ok() }) } pub fn GetAccessStatus() -> ::windows::core::Result<BackgroundAccessStatus> { Self::IBackgroundExecutionManagerStatics(|this| unsafe { let mut result__: BackgroundAccessStatus = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BackgroundAccessStatus>(result__) }) } pub fn GetAccessStatusForApplication<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(applicationid: Param0) -> ::windows::core::Result<BackgroundAccessStatus> { Self::IBackgroundExecutionManagerStatics(|this| unsafe { let mut result__: BackgroundAccessStatus = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), applicationid.into_param().abi(), &mut result__).from_abi::<BackgroundAccessStatus>(result__) }) } #[cfg(feature = "Foundation")] pub fn RequestAccessKindAsync<'a, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(requestedaccess: BackgroundAccessRequestKind, reason: Param1) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<bool>> { Self::IBackgroundExecutionManagerStatics2(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), requestedaccess, reason.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<bool>>(result__) }) } #[cfg(feature = "Foundation")] pub fn RequestAccessKindForModernStandbyAsync<'a, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(requestedaccess: BackgroundAccessRequestKind, reason: Param1) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<bool>> { Self::IBackgroundExecutionManagerStatics3(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), requestedaccess, reason.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<bool>>(result__) }) } pub fn GetAccessStatusForModernStandby() -> ::windows::core::Result<BackgroundAccessStatus> { Self::IBackgroundExecutionManagerStatics3(|this| unsafe { let mut result__: BackgroundAccessStatus = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BackgroundAccessStatus>(result__) }) } pub fn GetAccessStatusForModernStandbyForApplication<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(applicationid: Param0) -> ::windows::core::Result<BackgroundAccessStatus> { Self::IBackgroundExecutionManagerStatics3(|this| unsafe { let mut result__: BackgroundAccessStatus = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), applicationid.into_param().abi(), &mut result__).from_abi::<BackgroundAccessStatus>(result__) }) } pub fn IBackgroundExecutionManagerStatics<R, F: FnOnce(&IBackgroundExecutionManagerStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<BackgroundExecutionManager, IBackgroundExecutionManagerStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn IBackgroundExecutionManagerStatics2<R, F: FnOnce(&IBackgroundExecutionManagerStatics2) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<BackgroundExecutionManager, IBackgroundExecutionManagerStatics2> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn IBackgroundExecutionManagerStatics3<R, F: FnOnce(&IBackgroundExecutionManagerStatics3) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<BackgroundExecutionManager, IBackgroundExecutionManagerStatics3> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } impl ::windows::core::RuntimeName for BackgroundExecutionManager { const NAME: &'static str = "Windows.ApplicationModel.Background.BackgroundExecutionManager"; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct BackgroundTaskBuilder(pub ::windows::core::IInspectable); impl BackgroundTaskBuilder { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<BackgroundTaskBuilder, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn SetTaskEntryPoint<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn TaskEntryPoint(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetTrigger<'a, Param0: ::windows::core::IntoParam<'a, IBackgroundTrigger>>(&self, trigger: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), trigger.into_param().abi()).ok() } } pub fn AddCondition<'a, Param0: ::windows::core::IntoParam<'a, IBackgroundCondition>>(&self, condition: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), condition.into_param().abi()).ok() } } pub fn SetName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Name(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn Register(&self) -> ::windows::core::Result<BackgroundTaskRegistration> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BackgroundTaskRegistration>(result__) } } pub fn SetCancelOnConditionLoss(&self, value: bool) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBackgroundTaskBuilder2>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value).ok() } } pub fn CancelOnConditionLoss(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<IBackgroundTaskBuilder2>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetIsNetworkRequested(&self, value: bool) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBackgroundTaskBuilder3>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value).ok() } } pub fn IsNetworkRequested(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<IBackgroundTaskBuilder3>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn TaskGroup(&self) -> ::windows::core::Result<BackgroundTaskRegistrationGroup> { let this = &::windows::core::Interface::cast::<IBackgroundTaskBuilder4>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BackgroundTaskRegistrationGroup>(result__) } } pub fn SetTaskGroup<'a, Param0: ::windows::core::IntoParam<'a, BackgroundTaskRegistrationGroup>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBackgroundTaskBuilder4>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn SetTaskEntryPointClsid<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(&self, taskentrypoint: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBackgroundTaskBuilder5>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), taskentrypoint.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for BackgroundTaskBuilder { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.BackgroundTaskBuilder;{0351550e-3e64-4572-a93a-84075a37c917})"); } unsafe impl ::windows::core::Interface for BackgroundTaskBuilder { type Vtable = IBackgroundTaskBuilder_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0351550e_3e64_4572_a93a_84075a37c917); } impl ::windows::core::RuntimeName for BackgroundTaskBuilder { const NAME: &'static str = "Windows.ApplicationModel.Background.BackgroundTaskBuilder"; } impl ::core::convert::From<BackgroundTaskBuilder> for ::windows::core::IUnknown { fn from(value: BackgroundTaskBuilder) -> Self { value.0 .0 } } impl ::core::convert::From<&BackgroundTaskBuilder> for ::windows::core::IUnknown { fn from(value: &BackgroundTaskBuilder) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for BackgroundTaskBuilder { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a BackgroundTaskBuilder { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<BackgroundTaskBuilder> for ::windows::core::IInspectable { fn from(value: BackgroundTaskBuilder) -> Self { value.0 } } impl ::core::convert::From<&BackgroundTaskBuilder> for ::windows::core::IInspectable { fn from(value: &BackgroundTaskBuilder) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for BackgroundTaskBuilder { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a BackgroundTaskBuilder { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct BackgroundTaskCanceledEventHandler(::windows::core::IUnknown); impl BackgroundTaskCanceledEventHandler { pub fn new<F: FnMut(&::core::option::Option<IBackgroundTaskInstance>, BackgroundTaskCancellationReason) -> ::windows::core::Result<()> + 'static>(invoke: F) -> Self { let com = BackgroundTaskCanceledEventHandler_box::<F> { vtable: &BackgroundTaskCanceledEventHandler_box::<F>::VTABLE, count: ::windows::core::RefCount::new(1), invoke, }; unsafe { core::mem::transmute(::windows::core::alloc::boxed::Box::new(com)) } } pub fn Invoke<'a, Param0: ::windows::core::IntoParam<'a, IBackgroundTaskInstance>>(&self, sender: Param0, reason: BackgroundTaskCancellationReason) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).3)(::core::mem::transmute_copy(this), sender.into_param().abi(), reason).ok() } } } unsafe impl ::windows::core::RuntimeType for BackgroundTaskCanceledEventHandler { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"delegate({a6c4bac0-51f8-4c57-ac3f-156dd1680c4f})"); } unsafe impl ::windows::core::Interface for BackgroundTaskCanceledEventHandler { type Vtable = BackgroundTaskCanceledEventHandler_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa6c4bac0_51f8_4c57_ac3f_156dd1680c4f); } #[repr(C)] #[doc(hidden)] pub struct BackgroundTaskCanceledEventHandler_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sender: ::windows::core::RawPtr, reason: BackgroundTaskCancellationReason) -> ::windows::core::HRESULT, ); #[repr(C)] struct BackgroundTaskCanceledEventHandler_box<F: FnMut(&::core::option::Option<IBackgroundTaskInstance>, BackgroundTaskCancellationReason) -> ::windows::core::Result<()> + 'static> { vtable: *const BackgroundTaskCanceledEventHandler_abi, invoke: F, count: ::windows::core::RefCount, } impl<F: FnMut(&::core::option::Option<IBackgroundTaskInstance>, BackgroundTaskCancellationReason) -> ::windows::core::Result<()> + 'static> BackgroundTaskCanceledEventHandler_box<F> { const VTABLE: BackgroundTaskCanceledEventHandler_abi = BackgroundTaskCanceledEventHandler_abi(Self::QueryInterface, Self::AddRef, Self::Release, Self::Invoke); unsafe extern "system" fn QueryInterface(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT { let this = this as *mut ::windows::core::RawPtr as *mut Self; *interface = if iid == &<BackgroundTaskCanceledEventHandler as ::windows::core::Interface>::IID || iid == &<::windows::core::IUnknown as ::windows::core::Interface>::IID || iid == &<::windows::core::IAgileObject as ::windows::core::Interface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows::core::HRESULT(0x8000_4002) } else { (*this).count.add_ref(); ::windows::core::HRESULT(0) } } unsafe extern "system" fn AddRef(this: ::windows::core::RawPtr) -> u32 { let this = this as *mut ::windows::core::RawPtr as *mut Self; (*this).count.add_ref() } unsafe extern "system" fn Release(this: ::windows::core::RawPtr) -> u32 { let this = this as *mut ::windows::core::RawPtr as *mut Self; let remaining = (*this).count.release(); if remaining == 0 { ::windows::core::alloc::boxed::Box::from_raw(this); } remaining } unsafe extern "system" fn Invoke(this: ::windows::core::RawPtr, sender: ::windows::core::RawPtr, reason: BackgroundTaskCancellationReason) -> ::windows::core::HRESULT { let this = this as *mut ::windows::core::RawPtr as *mut Self; ((*this).invoke)(&*(&sender as *const <IBackgroundTaskInstance as ::windows::core::Abi>::Abi as *const <IBackgroundTaskInstance as ::windows::core::DefaultType>::DefaultType), reason).into() } } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct BackgroundTaskCancellationReason(pub i32); impl BackgroundTaskCancellationReason { pub const Abort: BackgroundTaskCancellationReason = BackgroundTaskCancellationReason(0i32); pub const Terminating: BackgroundTaskCancellationReason = BackgroundTaskCancellationReason(1i32); pub const LoggingOff: BackgroundTaskCancellationReason = BackgroundTaskCancellationReason(2i32); pub const ServicingUpdate: BackgroundTaskCancellationReason = BackgroundTaskCancellationReason(3i32); pub const IdleTask: BackgroundTaskCancellationReason = BackgroundTaskCancellationReason(4i32); pub const Uninstall: BackgroundTaskCancellationReason = BackgroundTaskCancellationReason(5i32); pub const ConditionLoss: BackgroundTaskCancellationReason = BackgroundTaskCancellationReason(6i32); pub const SystemPolicy: BackgroundTaskCancellationReason = BackgroundTaskCancellationReason(7i32); pub const QuietHoursEntered: BackgroundTaskCancellationReason = BackgroundTaskCancellationReason(8i32); pub const ExecutionTimeExceeded: BackgroundTaskCancellationReason = BackgroundTaskCancellationReason(9i32); pub const ResourceRevocation: BackgroundTaskCancellationReason = BackgroundTaskCancellationReason(10i32); pub const EnergySaver: BackgroundTaskCancellationReason = BackgroundTaskCancellationReason(11i32); } impl ::core::convert::From<i32> for BackgroundTaskCancellationReason { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for BackgroundTaskCancellationReason { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for BackgroundTaskCancellationReason { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.BackgroundTaskCancellationReason;i4)"); } impl ::windows::core::DefaultType for BackgroundTaskCancellationReason { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct BackgroundTaskCompletedEventArgs(pub ::windows::core::IInspectable); impl BackgroundTaskCompletedEventArgs { pub fn InstanceId(&self) -> ::windows::core::Result<::windows::core::GUID> { let this = self; unsafe { let mut result__: ::windows::core::GUID = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::GUID>(result__) } } pub fn CheckResult(&self) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this)).ok() } } } unsafe impl ::windows::core::RuntimeType for BackgroundTaskCompletedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.BackgroundTaskCompletedEventArgs;{565d25cf-f209-48f4-9967-2b184f7bfbf0})"); } unsafe impl ::windows::core::Interface for BackgroundTaskCompletedEventArgs { type Vtable = IBackgroundTaskCompletedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x565d25cf_f209_48f4_9967_2b184f7bfbf0); } impl ::windows::core::RuntimeName for BackgroundTaskCompletedEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Background.BackgroundTaskCompletedEventArgs"; } impl ::core::convert::From<BackgroundTaskCompletedEventArgs> for ::windows::core::IUnknown { fn from(value: BackgroundTaskCompletedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&BackgroundTaskCompletedEventArgs> for ::windows::core::IUnknown { fn from(value: &BackgroundTaskCompletedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for BackgroundTaskCompletedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a BackgroundTaskCompletedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<BackgroundTaskCompletedEventArgs> for ::windows::core::IInspectable { fn from(value: BackgroundTaskCompletedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&BackgroundTaskCompletedEventArgs> for ::windows::core::IInspectable { fn from(value: &BackgroundTaskCompletedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for BackgroundTaskCompletedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a BackgroundTaskCompletedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for BackgroundTaskCompletedEventArgs {} unsafe impl ::core::marker::Sync for BackgroundTaskCompletedEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct BackgroundTaskCompletedEventHandler(::windows::core::IUnknown); impl BackgroundTaskCompletedEventHandler { pub fn new<F: FnMut(&::core::option::Option<BackgroundTaskRegistration>, &::core::option::Option<BackgroundTaskCompletedEventArgs>) -> ::windows::core::Result<()> + 'static>(invoke: F) -> Self { let com = BackgroundTaskCompletedEventHandler_box::<F> { vtable: &BackgroundTaskCompletedEventHandler_box::<F>::VTABLE, count: ::windows::core::RefCount::new(1), invoke, }; unsafe { core::mem::transmute(::windows::core::alloc::boxed::Box::new(com)) } } pub fn Invoke<'a, Param0: ::windows::core::IntoParam<'a, BackgroundTaskRegistration>, Param1: ::windows::core::IntoParam<'a, BackgroundTaskCompletedEventArgs>>(&self, sender: Param0, args: Param1) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).3)(::core::mem::transmute_copy(this), sender.into_param().abi(), args.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for BackgroundTaskCompletedEventHandler { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"delegate({5b38e929-a086-46a7-a678-439135822bcf})"); } unsafe impl ::windows::core::Interface for BackgroundTaskCompletedEventHandler { type Vtable = BackgroundTaskCompletedEventHandler_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5b38e929_a086_46a7_a678_439135822bcf); } #[repr(C)] #[doc(hidden)] pub struct BackgroundTaskCompletedEventHandler_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sender: ::windows::core::RawPtr, args: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(C)] struct BackgroundTaskCompletedEventHandler_box<F: FnMut(&::core::option::Option<BackgroundTaskRegistration>, &::core::option::Option<BackgroundTaskCompletedEventArgs>) -> ::windows::core::Result<()> + 'static> { vtable: *const BackgroundTaskCompletedEventHandler_abi, invoke: F, count: ::windows::core::RefCount, } impl<F: FnMut(&::core::option::Option<BackgroundTaskRegistration>, &::core::option::Option<BackgroundTaskCompletedEventArgs>) -> ::windows::core::Result<()> + 'static> BackgroundTaskCompletedEventHandler_box<F> { const VTABLE: BackgroundTaskCompletedEventHandler_abi = BackgroundTaskCompletedEventHandler_abi(Self::QueryInterface, Self::AddRef, Self::Release, Self::Invoke); unsafe extern "system" fn QueryInterface(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT { let this = this as *mut ::windows::core::RawPtr as *mut Self; *interface = if iid == &<BackgroundTaskCompletedEventHandler as ::windows::core::Interface>::IID || iid == &<::windows::core::IUnknown as ::windows::core::Interface>::IID || iid == &<::windows::core::IAgileObject as ::windows::core::Interface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows::core::HRESULT(0x8000_4002) } else { (*this).count.add_ref(); ::windows::core::HRESULT(0) } } unsafe extern "system" fn AddRef(this: ::windows::core::RawPtr) -> u32 { let this = this as *mut ::windows::core::RawPtr as *mut Self; (*this).count.add_ref() } unsafe extern "system" fn Release(this: ::windows::core::RawPtr) -> u32 { let this = this as *mut ::windows::core::RawPtr as *mut Self; let remaining = (*this).count.release(); if remaining == 0 { ::windows::core::alloc::boxed::Box::from_raw(this); } remaining } unsafe extern "system" fn Invoke(this: ::windows::core::RawPtr, sender: ::windows::core::RawPtr, args: ::windows::core::RawPtr) -> ::windows::core::HRESULT { let this = this as *mut ::windows::core::RawPtr as *mut Self; ((*this).invoke)( &*(&sender as *const <BackgroundTaskRegistration as ::windows::core::Abi>::Abi as *const <BackgroundTaskRegistration as ::windows::core::DefaultType>::DefaultType), &*(&args as *const <BackgroundTaskCompletedEventArgs as ::windows::core::Abi>::Abi as *const <BackgroundTaskCompletedEventArgs as ::windows::core::DefaultType>::DefaultType), ) .into() } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct BackgroundTaskDeferral(pub ::windows::core::IInspectable); impl BackgroundTaskDeferral { pub fn Complete(&self) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this)).ok() } } } unsafe impl ::windows::core::RuntimeType for BackgroundTaskDeferral { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.BackgroundTaskDeferral;{93cc156d-af27-4dd3-846e-24ee40cadd25})"); } unsafe impl ::windows::core::Interface for BackgroundTaskDeferral { type Vtable = IBackgroundTaskDeferral_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x93cc156d_af27_4dd3_846e_24ee40cadd25); } impl ::windows::core::RuntimeName for BackgroundTaskDeferral { const NAME: &'static str = "Windows.ApplicationModel.Background.BackgroundTaskDeferral"; } impl ::core::convert::From<BackgroundTaskDeferral> for ::windows::core::IUnknown { fn from(value: BackgroundTaskDeferral) -> Self { value.0 .0 } } impl ::core::convert::From<&BackgroundTaskDeferral> for ::windows::core::IUnknown { fn from(value: &BackgroundTaskDeferral) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for BackgroundTaskDeferral { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a BackgroundTaskDeferral { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<BackgroundTaskDeferral> for ::windows::core::IInspectable { fn from(value: BackgroundTaskDeferral) -> Self { value.0 } } impl ::core::convert::From<&BackgroundTaskDeferral> for ::windows::core::IInspectable { fn from(value: &BackgroundTaskDeferral) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for BackgroundTaskDeferral { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a BackgroundTaskDeferral { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for BackgroundTaskDeferral {} unsafe impl ::core::marker::Sync for BackgroundTaskDeferral {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct BackgroundTaskProgressEventArgs(pub ::windows::core::IInspectable); impl BackgroundTaskProgressEventArgs { pub fn InstanceId(&self) -> ::windows::core::Result<::windows::core::GUID> { let this = self; unsafe { let mut result__: ::windows::core::GUID = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::GUID>(result__) } } pub fn Progress(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } } unsafe impl ::windows::core::RuntimeType for BackgroundTaskProgressEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.BackgroundTaskProgressEventArgs;{fb1468ac-8332-4d0a-9532-03eae684da31})"); } unsafe impl ::windows::core::Interface for BackgroundTaskProgressEventArgs { type Vtable = IBackgroundTaskProgressEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfb1468ac_8332_4d0a_9532_03eae684da31); } impl ::windows::core::RuntimeName for BackgroundTaskProgressEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Background.BackgroundTaskProgressEventArgs"; } impl ::core::convert::From<BackgroundTaskProgressEventArgs> for ::windows::core::IUnknown { fn from(value: BackgroundTaskProgressEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&BackgroundTaskProgressEventArgs> for ::windows::core::IUnknown { fn from(value: &BackgroundTaskProgressEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for BackgroundTaskProgressEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a BackgroundTaskProgressEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<BackgroundTaskProgressEventArgs> for ::windows::core::IInspectable { fn from(value: BackgroundTaskProgressEventArgs) -> Self { value.0 } } impl ::core::convert::From<&BackgroundTaskProgressEventArgs> for ::windows::core::IInspectable { fn from(value: &BackgroundTaskProgressEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for BackgroundTaskProgressEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a BackgroundTaskProgressEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for BackgroundTaskProgressEventArgs {} unsafe impl ::core::marker::Sync for BackgroundTaskProgressEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct BackgroundTaskProgressEventHandler(::windows::core::IUnknown); impl BackgroundTaskProgressEventHandler { pub fn new<F: FnMut(&::core::option::Option<BackgroundTaskRegistration>, &::core::option::Option<BackgroundTaskProgressEventArgs>) -> ::windows::core::Result<()> + 'static>(invoke: F) -> Self { let com = BackgroundTaskProgressEventHandler_box::<F> { vtable: &BackgroundTaskProgressEventHandler_box::<F>::VTABLE, count: ::windows::core::RefCount::new(1), invoke, }; unsafe { core::mem::transmute(::windows::core::alloc::boxed::Box::new(com)) } } pub fn Invoke<'a, Param0: ::windows::core::IntoParam<'a, BackgroundTaskRegistration>, Param1: ::windows::core::IntoParam<'a, BackgroundTaskProgressEventArgs>>(&self, sender: Param0, args: Param1) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).3)(::core::mem::transmute_copy(this), sender.into_param().abi(), args.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for BackgroundTaskProgressEventHandler { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"delegate({46e0683c-8a88-4c99-804c-76897f6277a6})"); } unsafe impl ::windows::core::Interface for BackgroundTaskProgressEventHandler { type Vtable = BackgroundTaskProgressEventHandler_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x46e0683c_8a88_4c99_804c_76897f6277a6); } #[repr(C)] #[doc(hidden)] pub struct BackgroundTaskProgressEventHandler_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sender: ::windows::core::RawPtr, args: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(C)] struct BackgroundTaskProgressEventHandler_box<F: FnMut(&::core::option::Option<BackgroundTaskRegistration>, &::core::option::Option<BackgroundTaskProgressEventArgs>) -> ::windows::core::Result<()> + 'static> { vtable: *const BackgroundTaskProgressEventHandler_abi, invoke: F, count: ::windows::core::RefCount, } impl<F: FnMut(&::core::option::Option<BackgroundTaskRegistration>, &::core::option::Option<BackgroundTaskProgressEventArgs>) -> ::windows::core::Result<()> + 'static> BackgroundTaskProgressEventHandler_box<F> { const VTABLE: BackgroundTaskProgressEventHandler_abi = BackgroundTaskProgressEventHandler_abi(Self::QueryInterface, Self::AddRef, Self::Release, Self::Invoke); unsafe extern "system" fn QueryInterface(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT { let this = this as *mut ::windows::core::RawPtr as *mut Self; *interface = if iid == &<BackgroundTaskProgressEventHandler as ::windows::core::Interface>::IID || iid == &<::windows::core::IUnknown as ::windows::core::Interface>::IID || iid == &<::windows::core::IAgileObject as ::windows::core::Interface>::IID { &mut (*this).vtable as *mut _ as _ } else { ::core::ptr::null_mut() }; if (*interface).is_null() { ::windows::core::HRESULT(0x8000_4002) } else { (*this).count.add_ref(); ::windows::core::HRESULT(0) } } unsafe extern "system" fn AddRef(this: ::windows::core::RawPtr) -> u32 { let this = this as *mut ::windows::core::RawPtr as *mut Self; (*this).count.add_ref() } unsafe extern "system" fn Release(this: ::windows::core::RawPtr) -> u32 { let this = this as *mut ::windows::core::RawPtr as *mut Self; let remaining = (*this).count.release(); if remaining == 0 { ::windows::core::alloc::boxed::Box::from_raw(this); } remaining } unsafe extern "system" fn Invoke(this: ::windows::core::RawPtr, sender: ::windows::core::RawPtr, args: ::windows::core::RawPtr) -> ::windows::core::HRESULT { let this = this as *mut ::windows::core::RawPtr as *mut Self; ((*this).invoke)( &*(&sender as *const <BackgroundTaskRegistration as ::windows::core::Abi>::Abi as *const <BackgroundTaskRegistration as ::windows::core::DefaultType>::DefaultType), &*(&args as *const <BackgroundTaskProgressEventArgs as ::windows::core::Abi>::Abi as *const <BackgroundTaskProgressEventArgs as ::windows::core::DefaultType>::DefaultType), ) .into() } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct BackgroundTaskRegistration(pub ::windows::core::IInspectable); impl BackgroundTaskRegistration { pub fn TaskId(&self) -> ::windows::core::Result<::windows::core::GUID> { let this = self; unsafe { let mut result__: ::windows::core::GUID = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::GUID>(result__) } } pub fn Name(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn Progress<'a, Param0: ::windows::core::IntoParam<'a, BackgroundTaskProgressEventHandler>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveProgress<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, cookie: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), cookie.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Completed<'a, Param0: ::windows::core::IntoParam<'a, BackgroundTaskCompletedEventHandler>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveCompleted<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, cookie: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), cookie.into_param().abi()).ok() } } pub fn Unregister(&self, canceltask: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), canceltask).ok() } } pub fn Trigger(&self) -> ::windows::core::Result<IBackgroundTrigger> { let this = &::windows::core::Interface::cast::<IBackgroundTaskRegistration2>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<IBackgroundTrigger>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn AllTasks() -> ::windows::core::Result<super::super::Foundation::Collections::IMapView<::windows::core::GUID, IBackgroundTaskRegistration>> { Self::IBackgroundTaskRegistrationStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IMapView<::windows::core::GUID, IBackgroundTaskRegistration>>(result__) }) } pub fn TaskGroup(&self) -> ::windows::core::Result<BackgroundTaskRegistrationGroup> { let this = &::windows::core::Interface::cast::<IBackgroundTaskRegistration3>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BackgroundTaskRegistrationGroup>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn AllTaskGroups() -> ::windows::core::Result<super::super::Foundation::Collections::IMapView<::windows::core::HSTRING, BackgroundTaskRegistrationGroup>> { Self::IBackgroundTaskRegistrationStatics2(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IMapView<::windows::core::HSTRING, BackgroundTaskRegistrationGroup>>(result__) }) } pub fn GetTaskGroup<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(groupid: Param0) -> ::windows::core::Result<BackgroundTaskRegistrationGroup> { Self::IBackgroundTaskRegistrationStatics2(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), groupid.into_param().abi(), &mut result__).from_abi::<BackgroundTaskRegistrationGroup>(result__) }) } pub fn IBackgroundTaskRegistrationStatics<R, F: FnOnce(&IBackgroundTaskRegistrationStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<BackgroundTaskRegistration, IBackgroundTaskRegistrationStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn IBackgroundTaskRegistrationStatics2<R, F: FnOnce(&IBackgroundTaskRegistrationStatics2) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<BackgroundTaskRegistration, IBackgroundTaskRegistrationStatics2> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for BackgroundTaskRegistration { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.BackgroundTaskRegistration;{10654cc2-a26e-43bf-8c12-1fb40dbfbfa0})"); } unsafe impl ::windows::core::Interface for BackgroundTaskRegistration { type Vtable = IBackgroundTaskRegistration_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x10654cc2_a26e_43bf_8c12_1fb40dbfbfa0); } impl ::windows::core::RuntimeName for BackgroundTaskRegistration { const NAME: &'static str = "Windows.ApplicationModel.Background.BackgroundTaskRegistration"; } impl ::core::convert::From<BackgroundTaskRegistration> for ::windows::core::IUnknown { fn from(value: BackgroundTaskRegistration) -> Self { value.0 .0 } } impl ::core::convert::From<&BackgroundTaskRegistration> for ::windows::core::IUnknown { fn from(value: &BackgroundTaskRegistration) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for BackgroundTaskRegistration { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a BackgroundTaskRegistration { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<BackgroundTaskRegistration> for ::windows::core::IInspectable { fn from(value: BackgroundTaskRegistration) -> Self { value.0 } } impl ::core::convert::From<&BackgroundTaskRegistration> for ::windows::core::IInspectable { fn from(value: &BackgroundTaskRegistration) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for BackgroundTaskRegistration { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a BackgroundTaskRegistration { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<BackgroundTaskRegistration> for IBackgroundTaskRegistration { fn from(value: BackgroundTaskRegistration) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&BackgroundTaskRegistration> for IBackgroundTaskRegistration { fn from(value: &BackgroundTaskRegistration) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTaskRegistration> for BackgroundTaskRegistration { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTaskRegistration> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTaskRegistration> for &BackgroundTaskRegistration { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTaskRegistration> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } impl ::core::convert::TryFrom<BackgroundTaskRegistration> for IBackgroundTaskRegistration2 { type Error = ::windows::core::Error; fn try_from(value: BackgroundTaskRegistration) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&BackgroundTaskRegistration> for IBackgroundTaskRegistration2 { type Error = ::windows::core::Error; fn try_from(value: &BackgroundTaskRegistration) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTaskRegistration2> for BackgroundTaskRegistration { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTaskRegistration2> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTaskRegistration2> for &BackgroundTaskRegistration { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTaskRegistration2> { ::core::convert::TryInto::<IBackgroundTaskRegistration2>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } impl ::core::convert::TryFrom<BackgroundTaskRegistration> for IBackgroundTaskRegistration3 { type Error = ::windows::core::Error; fn try_from(value: BackgroundTaskRegistration) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&BackgroundTaskRegistration> for IBackgroundTaskRegistration3 { type Error = ::windows::core::Error; fn try_from(value: &BackgroundTaskRegistration) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTaskRegistration3> for BackgroundTaskRegistration { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTaskRegistration3> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTaskRegistration3> for &BackgroundTaskRegistration { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTaskRegistration3> { ::core::convert::TryInto::<IBackgroundTaskRegistration3>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for BackgroundTaskRegistration {} unsafe impl ::core::marker::Sync for BackgroundTaskRegistration {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct BackgroundTaskRegistrationGroup(pub ::windows::core::IInspectable); impl BackgroundTaskRegistrationGroup { pub fn Id(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn Name(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(all(feature = "ApplicationModel_Activation", feature = "Foundation"))] pub fn BackgroundActivated<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<BackgroundTaskRegistrationGroup, super::Activation::BackgroundActivatedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveBackgroundActivated<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn AllTasks(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IMapView<::windows::core::GUID, BackgroundTaskRegistration>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IMapView<::windows::core::GUID, BackgroundTaskRegistration>>(result__) } } pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(id: Param0) -> ::windows::core::Result<BackgroundTaskRegistrationGroup> { Self::IBackgroundTaskRegistrationGroupFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), id.into_param().abi(), &mut result__).from_abi::<BackgroundTaskRegistrationGroup>(result__) }) } pub fn CreateWithName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(id: Param0, name: Param1) -> ::windows::core::Result<BackgroundTaskRegistrationGroup> { Self::IBackgroundTaskRegistrationGroupFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), id.into_param().abi(), name.into_param().abi(), &mut result__).from_abi::<BackgroundTaskRegistrationGroup>(result__) }) } pub fn IBackgroundTaskRegistrationGroupFactory<R, F: FnOnce(&IBackgroundTaskRegistrationGroupFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<BackgroundTaskRegistrationGroup, IBackgroundTaskRegistrationGroupFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for BackgroundTaskRegistrationGroup { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.BackgroundTaskRegistrationGroup;{2ab1919a-871b-4167-8a76-055cd67b5b23})"); } unsafe impl ::windows::core::Interface for BackgroundTaskRegistrationGroup { type Vtable = IBackgroundTaskRegistrationGroup_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2ab1919a_871b_4167_8a76_055cd67b5b23); } impl ::windows::core::RuntimeName for BackgroundTaskRegistrationGroup { const NAME: &'static str = "Windows.ApplicationModel.Background.BackgroundTaskRegistrationGroup"; } impl ::core::convert::From<BackgroundTaskRegistrationGroup> for ::windows::core::IUnknown { fn from(value: BackgroundTaskRegistrationGroup) -> Self { value.0 .0 } } impl ::core::convert::From<&BackgroundTaskRegistrationGroup> for ::windows::core::IUnknown { fn from(value: &BackgroundTaskRegistrationGroup) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for BackgroundTaskRegistrationGroup { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a BackgroundTaskRegistrationGroup { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<BackgroundTaskRegistrationGroup> for ::windows::core::IInspectable { fn from(value: BackgroundTaskRegistrationGroup) -> Self { value.0 } } impl ::core::convert::From<&BackgroundTaskRegistrationGroup> for ::windows::core::IInspectable { fn from(value: &BackgroundTaskRegistrationGroup) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for BackgroundTaskRegistrationGroup { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a BackgroundTaskRegistrationGroup { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for BackgroundTaskRegistrationGroup {} unsafe impl ::core::marker::Sync for BackgroundTaskRegistrationGroup {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct BackgroundTaskThrottleCounter(pub i32); impl BackgroundTaskThrottleCounter { pub const All: BackgroundTaskThrottleCounter = BackgroundTaskThrottleCounter(0i32); pub const Cpu: BackgroundTaskThrottleCounter = BackgroundTaskThrottleCounter(1i32); pub const Network: BackgroundTaskThrottleCounter = BackgroundTaskThrottleCounter(2i32); } impl ::core::convert::From<i32> for BackgroundTaskThrottleCounter { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for BackgroundTaskThrottleCounter { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for BackgroundTaskThrottleCounter { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.BackgroundTaskThrottleCounter;i4)"); } impl ::windows::core::DefaultType for BackgroundTaskThrottleCounter { type DefaultType = Self; } pub struct BackgroundWorkCost {} impl BackgroundWorkCost { pub fn CurrentBackgroundWorkCost() -> ::windows::core::Result<BackgroundWorkCostValue> { Self::IBackgroundWorkCostStatics(|this| unsafe { let mut result__: BackgroundWorkCostValue = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BackgroundWorkCostValue>(result__) }) } pub fn IBackgroundWorkCostStatics<R, F: FnOnce(&IBackgroundWorkCostStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<BackgroundWorkCost, IBackgroundWorkCostStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } impl ::windows::core::RuntimeName for BackgroundWorkCost { const NAME: &'static str = "Windows.ApplicationModel.Background.BackgroundWorkCost"; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct BackgroundWorkCostValue(pub i32); impl BackgroundWorkCostValue { pub const Low: BackgroundWorkCostValue = BackgroundWorkCostValue(0i32); pub const Medium: BackgroundWorkCostValue = BackgroundWorkCostValue(1i32); pub const High: BackgroundWorkCostValue = BackgroundWorkCostValue(2i32); } impl ::core::convert::From<i32> for BackgroundWorkCostValue { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for BackgroundWorkCostValue { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for BackgroundWorkCostValue { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.BackgroundWorkCostValue;i4)"); } impl ::windows::core::DefaultType for BackgroundWorkCostValue { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct BluetoothLEAdvertisementPublisherTrigger(pub ::windows::core::IInspectable); impl BluetoothLEAdvertisementPublisherTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<BluetoothLEAdvertisementPublisherTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Devices_Bluetooth_Advertisement")] pub fn Advertisement(&self) -> ::windows::core::Result<super::super::Devices::Bluetooth::Advertisement::BluetoothLEAdvertisement> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Devices::Bluetooth::Advertisement::BluetoothLEAdvertisement>(result__) } } #[cfg(feature = "Foundation")] pub fn PreferredTransmitPowerLevelInDBm(&self) -> ::windows::core::Result<super::super::Foundation::IReference<i16>> { let this = &::windows::core::Interface::cast::<IBluetoothLEAdvertisementPublisherTrigger2>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IReference<i16>>(result__) } } #[cfg(feature = "Foundation")] pub fn SetPreferredTransmitPowerLevelInDBm<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<i16>>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBluetoothLEAdvertisementPublisherTrigger2>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn UseExtendedFormat(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<IBluetoothLEAdvertisementPublisherTrigger2>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetUseExtendedFormat(&self, value: bool) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBluetoothLEAdvertisementPublisherTrigger2>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value).ok() } } pub fn IsAnonymous(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<IBluetoothLEAdvertisementPublisherTrigger2>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetIsAnonymous(&self, value: bool) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBluetoothLEAdvertisementPublisherTrigger2>(self)?; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value).ok() } } pub fn IncludeTransmitPowerLevel(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<IBluetoothLEAdvertisementPublisherTrigger2>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetIncludeTransmitPowerLevel(&self, value: bool) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBluetoothLEAdvertisementPublisherTrigger2>(self)?; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value).ok() } } } unsafe impl ::windows::core::RuntimeType for BluetoothLEAdvertisementPublisherTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.BluetoothLEAdvertisementPublisherTrigger;{ab3e2612-25d3-48ae-8724-d81877ae6129})"); } unsafe impl ::windows::core::Interface for BluetoothLEAdvertisementPublisherTrigger { type Vtable = IBluetoothLEAdvertisementPublisherTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xab3e2612_25d3_48ae_8724_d81877ae6129); } impl ::windows::core::RuntimeName for BluetoothLEAdvertisementPublisherTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.BluetoothLEAdvertisementPublisherTrigger"; } impl ::core::convert::From<BluetoothLEAdvertisementPublisherTrigger> for ::windows::core::IUnknown { fn from(value: BluetoothLEAdvertisementPublisherTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&BluetoothLEAdvertisementPublisherTrigger> for ::windows::core::IUnknown { fn from(value: &BluetoothLEAdvertisementPublisherTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for BluetoothLEAdvertisementPublisherTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a BluetoothLEAdvertisementPublisherTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<BluetoothLEAdvertisementPublisherTrigger> for ::windows::core::IInspectable { fn from(value: BluetoothLEAdvertisementPublisherTrigger) -> Self { value.0 } } impl ::core::convert::From<&BluetoothLEAdvertisementPublisherTrigger> for ::windows::core::IInspectable { fn from(value: &BluetoothLEAdvertisementPublisherTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for BluetoothLEAdvertisementPublisherTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a BluetoothLEAdvertisementPublisherTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<BluetoothLEAdvertisementPublisherTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: BluetoothLEAdvertisementPublisherTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&BluetoothLEAdvertisementPublisherTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &BluetoothLEAdvertisementPublisherTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for BluetoothLEAdvertisementPublisherTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &BluetoothLEAdvertisementPublisherTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for BluetoothLEAdvertisementPublisherTrigger {} unsafe impl ::core::marker::Sync for BluetoothLEAdvertisementPublisherTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct BluetoothLEAdvertisementWatcherTrigger(pub ::windows::core::IInspectable); impl BluetoothLEAdvertisementWatcherTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<BluetoothLEAdvertisementWatcherTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Foundation")] pub fn MinSamplingInterval(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation")] pub fn MaxSamplingInterval(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation")] pub fn MinOutOfRangeTimeout(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation")] pub fn MaxOutOfRangeTimeout(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Devices_Bluetooth")] pub fn SignalStrengthFilter(&self) -> ::windows::core::Result<super::super::Devices::Bluetooth::BluetoothSignalStrengthFilter> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Devices::Bluetooth::BluetoothSignalStrengthFilter>(result__) } } #[cfg(feature = "Devices_Bluetooth")] pub fn SetSignalStrengthFilter<'a, Param0: ::windows::core::IntoParam<'a, super::super::Devices::Bluetooth::BluetoothSignalStrengthFilter>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Devices_Bluetooth_Advertisement")] pub fn AdvertisementFilter(&self) -> ::windows::core::Result<super::super::Devices::Bluetooth::Advertisement::BluetoothLEAdvertisementFilter> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Devices::Bluetooth::Advertisement::BluetoothLEAdvertisementFilter>(result__) } } #[cfg(feature = "Devices_Bluetooth_Advertisement")] pub fn SetAdvertisementFilter<'a, Param0: ::windows::core::IntoParam<'a, super::super::Devices::Bluetooth::Advertisement::BluetoothLEAdvertisementFilter>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn AllowExtendedAdvertisements(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<IBluetoothLEAdvertisementWatcherTrigger2>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetAllowExtendedAdvertisements(&self, value: bool) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBluetoothLEAdvertisementWatcherTrigger2>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value).ok() } } } unsafe impl ::windows::core::RuntimeType for BluetoothLEAdvertisementWatcherTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.BluetoothLEAdvertisementWatcherTrigger;{1aab1819-bce1-48eb-a827-59fb7cee52a6})"); } unsafe impl ::windows::core::Interface for BluetoothLEAdvertisementWatcherTrigger { type Vtable = IBluetoothLEAdvertisementWatcherTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1aab1819_bce1_48eb_a827_59fb7cee52a6); } impl ::windows::core::RuntimeName for BluetoothLEAdvertisementWatcherTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.BluetoothLEAdvertisementWatcherTrigger"; } impl ::core::convert::From<BluetoothLEAdvertisementWatcherTrigger> for ::windows::core::IUnknown { fn from(value: BluetoothLEAdvertisementWatcherTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&BluetoothLEAdvertisementWatcherTrigger> for ::windows::core::IUnknown { fn from(value: &BluetoothLEAdvertisementWatcherTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for BluetoothLEAdvertisementWatcherTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a BluetoothLEAdvertisementWatcherTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<BluetoothLEAdvertisementWatcherTrigger> for ::windows::core::IInspectable { fn from(value: BluetoothLEAdvertisementWatcherTrigger) -> Self { value.0 } } impl ::core::convert::From<&BluetoothLEAdvertisementWatcherTrigger> for ::windows::core::IInspectable { fn from(value: &BluetoothLEAdvertisementWatcherTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for BluetoothLEAdvertisementWatcherTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a BluetoothLEAdvertisementWatcherTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<BluetoothLEAdvertisementWatcherTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: BluetoothLEAdvertisementWatcherTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&BluetoothLEAdvertisementWatcherTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &BluetoothLEAdvertisementWatcherTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for BluetoothLEAdvertisementWatcherTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &BluetoothLEAdvertisementWatcherTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for BluetoothLEAdvertisementWatcherTrigger {} unsafe impl ::core::marker::Sync for BluetoothLEAdvertisementWatcherTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct CachedFileUpdaterTrigger(pub ::windows::core::IInspectable); impl CachedFileUpdaterTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<CachedFileUpdaterTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for CachedFileUpdaterTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.CachedFileUpdaterTrigger;{e21caeeb-32f2-4d31-b553-b9e01bde37e0})"); } unsafe impl ::windows::core::Interface for CachedFileUpdaterTrigger { type Vtable = ICachedFileUpdaterTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe21caeeb_32f2_4d31_b553_b9e01bde37e0); } impl ::windows::core::RuntimeName for CachedFileUpdaterTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.CachedFileUpdaterTrigger"; } impl ::core::convert::From<CachedFileUpdaterTrigger> for ::windows::core::IUnknown { fn from(value: CachedFileUpdaterTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&CachedFileUpdaterTrigger> for ::windows::core::IUnknown { fn from(value: &CachedFileUpdaterTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for CachedFileUpdaterTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a CachedFileUpdaterTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<CachedFileUpdaterTrigger> for ::windows::core::IInspectable { fn from(value: CachedFileUpdaterTrigger) -> Self { value.0 } } impl ::core::convert::From<&CachedFileUpdaterTrigger> for ::windows::core::IInspectable { fn from(value: &CachedFileUpdaterTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for CachedFileUpdaterTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a CachedFileUpdaterTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<CachedFileUpdaterTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: CachedFileUpdaterTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&CachedFileUpdaterTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &CachedFileUpdaterTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for CachedFileUpdaterTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &CachedFileUpdaterTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for CachedFileUpdaterTrigger {} unsafe impl ::core::marker::Sync for CachedFileUpdaterTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct CachedFileUpdaterTriggerDetails(pub ::windows::core::IInspectable); impl CachedFileUpdaterTriggerDetails { #[cfg(feature = "Storage_Provider")] pub fn UpdateTarget(&self) -> ::windows::core::Result<super::super::Storage::Provider::CachedFileTarget> { let this = self; unsafe { let mut result__: super::super::Storage::Provider::CachedFileTarget = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Storage::Provider::CachedFileTarget>(result__) } } #[cfg(feature = "Storage_Provider")] pub fn UpdateRequest(&self) -> ::windows::core::Result<super::super::Storage::Provider::FileUpdateRequest> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Storage::Provider::FileUpdateRequest>(result__) } } pub fn CanRequestUserInput(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } } unsafe impl ::windows::core::RuntimeType for CachedFileUpdaterTriggerDetails { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.CachedFileUpdaterTriggerDetails;{71838c13-1314-47b4-9597-dc7e248c17cc})"); } unsafe impl ::windows::core::Interface for CachedFileUpdaterTriggerDetails { type Vtable = ICachedFileUpdaterTriggerDetails_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x71838c13_1314_47b4_9597_dc7e248c17cc); } impl ::windows::core::RuntimeName for CachedFileUpdaterTriggerDetails { const NAME: &'static str = "Windows.ApplicationModel.Background.CachedFileUpdaterTriggerDetails"; } impl ::core::convert::From<CachedFileUpdaterTriggerDetails> for ::windows::core::IUnknown { fn from(value: CachedFileUpdaterTriggerDetails) -> Self { value.0 .0 } } impl ::core::convert::From<&CachedFileUpdaterTriggerDetails> for ::windows::core::IUnknown { fn from(value: &CachedFileUpdaterTriggerDetails) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for CachedFileUpdaterTriggerDetails { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a CachedFileUpdaterTriggerDetails { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<CachedFileUpdaterTriggerDetails> for ::windows::core::IInspectable { fn from(value: CachedFileUpdaterTriggerDetails) -> Self { value.0 } } impl ::core::convert::From<&CachedFileUpdaterTriggerDetails> for ::windows::core::IInspectable { fn from(value: &CachedFileUpdaterTriggerDetails) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for CachedFileUpdaterTriggerDetails { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a CachedFileUpdaterTriggerDetails { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for CachedFileUpdaterTriggerDetails {} unsafe impl ::core::marker::Sync for CachedFileUpdaterTriggerDetails {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ChatMessageNotificationTrigger(pub ::windows::core::IInspectable); impl ChatMessageNotificationTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<ChatMessageNotificationTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for ChatMessageNotificationTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.ChatMessageNotificationTrigger;{513b43bf-1d40-5c5d-78f5-c923fee3739e})"); } unsafe impl ::windows::core::Interface for ChatMessageNotificationTrigger { type Vtable = IChatMessageNotificationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x513b43bf_1d40_5c5d_78f5_c923fee3739e); } impl ::windows::core::RuntimeName for ChatMessageNotificationTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.ChatMessageNotificationTrigger"; } impl ::core::convert::From<ChatMessageNotificationTrigger> for ::windows::core::IUnknown { fn from(value: ChatMessageNotificationTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&ChatMessageNotificationTrigger> for ::windows::core::IUnknown { fn from(value: &ChatMessageNotificationTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ChatMessageNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ChatMessageNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ChatMessageNotificationTrigger> for ::windows::core::IInspectable { fn from(value: ChatMessageNotificationTrigger) -> Self { value.0 } } impl ::core::convert::From<&ChatMessageNotificationTrigger> for ::windows::core::IInspectable { fn from(value: &ChatMessageNotificationTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ChatMessageNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a ChatMessageNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<ChatMessageNotificationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: ChatMessageNotificationTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&ChatMessageNotificationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &ChatMessageNotificationTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for ChatMessageNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &ChatMessageNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for ChatMessageNotificationTrigger {} unsafe impl ::core::marker::Sync for ChatMessageNotificationTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ChatMessageReceivedNotificationTrigger(pub ::windows::core::IInspectable); impl ChatMessageReceivedNotificationTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<ChatMessageReceivedNotificationTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for ChatMessageReceivedNotificationTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.ChatMessageReceivedNotificationTrigger;{3ea3760e-baf5-4077-88e9-060cf6f0c6d5})"); } unsafe impl ::windows::core::Interface for ChatMessageReceivedNotificationTrigger { type Vtable = IChatMessageReceivedNotificationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3ea3760e_baf5_4077_88e9_060cf6f0c6d5); } impl ::windows::core::RuntimeName for ChatMessageReceivedNotificationTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.ChatMessageReceivedNotificationTrigger"; } impl ::core::convert::From<ChatMessageReceivedNotificationTrigger> for ::windows::core::IUnknown { fn from(value: ChatMessageReceivedNotificationTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&ChatMessageReceivedNotificationTrigger> for ::windows::core::IUnknown { fn from(value: &ChatMessageReceivedNotificationTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ChatMessageReceivedNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ChatMessageReceivedNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ChatMessageReceivedNotificationTrigger> for ::windows::core::IInspectable { fn from(value: ChatMessageReceivedNotificationTrigger) -> Self { value.0 } } impl ::core::convert::From<&ChatMessageReceivedNotificationTrigger> for ::windows::core::IInspectable { fn from(value: &ChatMessageReceivedNotificationTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ChatMessageReceivedNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a ChatMessageReceivedNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<ChatMessageReceivedNotificationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: ChatMessageReceivedNotificationTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&ChatMessageReceivedNotificationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &ChatMessageReceivedNotificationTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for ChatMessageReceivedNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &ChatMessageReceivedNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for ChatMessageReceivedNotificationTrigger {} unsafe impl ::core::marker::Sync for ChatMessageReceivedNotificationTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct CommunicationBlockingAppSetAsActiveTrigger(pub ::windows::core::IInspectable); impl CommunicationBlockingAppSetAsActiveTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<CommunicationBlockingAppSetAsActiveTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for CommunicationBlockingAppSetAsActiveTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.CommunicationBlockingAppSetAsActiveTrigger;{fb91f28a-16a5-486d-974c-7835a8477be2})"); } unsafe impl ::windows::core::Interface for CommunicationBlockingAppSetAsActiveTrigger { type Vtable = ICommunicationBlockingAppSetAsActiveTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfb91f28a_16a5_486d_974c_7835a8477be2); } impl ::windows::core::RuntimeName for CommunicationBlockingAppSetAsActiveTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.CommunicationBlockingAppSetAsActiveTrigger"; } impl ::core::convert::From<CommunicationBlockingAppSetAsActiveTrigger> for ::windows::core::IUnknown { fn from(value: CommunicationBlockingAppSetAsActiveTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&CommunicationBlockingAppSetAsActiveTrigger> for ::windows::core::IUnknown { fn from(value: &CommunicationBlockingAppSetAsActiveTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for CommunicationBlockingAppSetAsActiveTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a CommunicationBlockingAppSetAsActiveTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<CommunicationBlockingAppSetAsActiveTrigger> for ::windows::core::IInspectable { fn from(value: CommunicationBlockingAppSetAsActiveTrigger) -> Self { value.0 } } impl ::core::convert::From<&CommunicationBlockingAppSetAsActiveTrigger> for ::windows::core::IInspectable { fn from(value: &CommunicationBlockingAppSetAsActiveTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for CommunicationBlockingAppSetAsActiveTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a CommunicationBlockingAppSetAsActiveTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<CommunicationBlockingAppSetAsActiveTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: CommunicationBlockingAppSetAsActiveTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&CommunicationBlockingAppSetAsActiveTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &CommunicationBlockingAppSetAsActiveTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for CommunicationBlockingAppSetAsActiveTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &CommunicationBlockingAppSetAsActiveTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for CommunicationBlockingAppSetAsActiveTrigger {} unsafe impl ::core::marker::Sync for CommunicationBlockingAppSetAsActiveTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ContactStoreNotificationTrigger(pub ::windows::core::IInspectable); impl ContactStoreNotificationTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<ContactStoreNotificationTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for ContactStoreNotificationTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.ContactStoreNotificationTrigger;{c833419b-4705-4571-9a16-06b997bf9c96})"); } unsafe impl ::windows::core::Interface for ContactStoreNotificationTrigger { type Vtable = IContactStoreNotificationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc833419b_4705_4571_9a16_06b997bf9c96); } impl ::windows::core::RuntimeName for ContactStoreNotificationTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.ContactStoreNotificationTrigger"; } impl ::core::convert::From<ContactStoreNotificationTrigger> for ::windows::core::IUnknown { fn from(value: ContactStoreNotificationTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&ContactStoreNotificationTrigger> for ::windows::core::IUnknown { fn from(value: &ContactStoreNotificationTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ContactStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ContactStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ContactStoreNotificationTrigger> for ::windows::core::IInspectable { fn from(value: ContactStoreNotificationTrigger) -> Self { value.0 } } impl ::core::convert::From<&ContactStoreNotificationTrigger> for ::windows::core::IInspectable { fn from(value: &ContactStoreNotificationTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ContactStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a ContactStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<ContactStoreNotificationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: ContactStoreNotificationTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&ContactStoreNotificationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &ContactStoreNotificationTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for ContactStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &ContactStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for ContactStoreNotificationTrigger {} unsafe impl ::core::marker::Sync for ContactStoreNotificationTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ContentPrefetchTrigger(pub ::windows::core::IInspectable); impl ContentPrefetchTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<ContentPrefetchTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Foundation")] pub fn WaitInterval(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation")] pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(waitinterval: Param0) -> ::windows::core::Result<ContentPrefetchTrigger> { Self::IContentPrefetchTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), waitinterval.into_param().abi(), &mut result__).from_abi::<ContentPrefetchTrigger>(result__) }) } pub fn IContentPrefetchTriggerFactory<R, F: FnOnce(&IContentPrefetchTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<ContentPrefetchTrigger, IContentPrefetchTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for ContentPrefetchTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.ContentPrefetchTrigger;{710627ee-04fa-440b-80c0-173202199e5d})"); } unsafe impl ::windows::core::Interface for ContentPrefetchTrigger { type Vtable = IContentPrefetchTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x710627ee_04fa_440b_80c0_173202199e5d); } impl ::windows::core::RuntimeName for ContentPrefetchTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.ContentPrefetchTrigger"; } impl ::core::convert::From<ContentPrefetchTrigger> for ::windows::core::IUnknown { fn from(value: ContentPrefetchTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&ContentPrefetchTrigger> for ::windows::core::IUnknown { fn from(value: &ContentPrefetchTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ContentPrefetchTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ContentPrefetchTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ContentPrefetchTrigger> for ::windows::core::IInspectable { fn from(value: ContentPrefetchTrigger) -> Self { value.0 } } impl ::core::convert::From<&ContentPrefetchTrigger> for ::windows::core::IInspectable { fn from(value: &ContentPrefetchTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ContentPrefetchTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a ContentPrefetchTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<ContentPrefetchTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: ContentPrefetchTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&ContentPrefetchTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &ContentPrefetchTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for ContentPrefetchTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &ContentPrefetchTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ConversationalAgentTrigger(pub ::windows::core::IInspectable); impl ConversationalAgentTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<ConversationalAgentTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for ConversationalAgentTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.ConversationalAgentTrigger;{84b3a058-6027-4b87-9790-bdf3f757dbd7})"); } unsafe impl ::windows::core::Interface for ConversationalAgentTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl ::windows::core::RuntimeName for ConversationalAgentTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.ConversationalAgentTrigger"; } impl ::core::convert::From<ConversationalAgentTrigger> for ::windows::core::IUnknown { fn from(value: ConversationalAgentTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&ConversationalAgentTrigger> for ::windows::core::IUnknown { fn from(value: &ConversationalAgentTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ConversationalAgentTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ConversationalAgentTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ConversationalAgentTrigger> for ::windows::core::IInspectable { fn from(value: ConversationalAgentTrigger) -> Self { value.0 } } impl ::core::convert::From<&ConversationalAgentTrigger> for ::windows::core::IInspectable { fn from(value: &ConversationalAgentTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ConversationalAgentTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a ConversationalAgentTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<ConversationalAgentTrigger> for IBackgroundTrigger { fn from(value: ConversationalAgentTrigger) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&ConversationalAgentTrigger> for IBackgroundTrigger { fn from(value: &ConversationalAgentTrigger) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for ConversationalAgentTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &ConversationalAgentTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct CustomSystemEventTrigger(pub ::windows::core::IInspectable); impl CustomSystemEventTrigger { pub fn TriggerId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn Recurrence(&self) -> ::windows::core::Result<CustomSystemEventTriggerRecurrence> { let this = self; unsafe { let mut result__: CustomSystemEventTriggerRecurrence = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<CustomSystemEventTriggerRecurrence>(result__) } } pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(triggerid: Param0, recurrence: CustomSystemEventTriggerRecurrence) -> ::windows::core::Result<CustomSystemEventTrigger> { Self::ICustomSystemEventTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), triggerid.into_param().abi(), recurrence, &mut result__).from_abi::<CustomSystemEventTrigger>(result__) }) } pub fn ICustomSystemEventTriggerFactory<R, F: FnOnce(&ICustomSystemEventTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<CustomSystemEventTrigger, ICustomSystemEventTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for CustomSystemEventTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.CustomSystemEventTrigger;{f3596798-cf6b-4ef4-a0ca-29cf4a278c87})"); } unsafe impl ::windows::core::Interface for CustomSystemEventTrigger { type Vtable = ICustomSystemEventTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf3596798_cf6b_4ef4_a0ca_29cf4a278c87); } impl ::windows::core::RuntimeName for CustomSystemEventTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.CustomSystemEventTrigger"; } impl ::core::convert::From<CustomSystemEventTrigger> for ::windows::core::IUnknown { fn from(value: CustomSystemEventTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&CustomSystemEventTrigger> for ::windows::core::IUnknown { fn from(value: &CustomSystemEventTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for CustomSystemEventTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a CustomSystemEventTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<CustomSystemEventTrigger> for ::windows::core::IInspectable { fn from(value: CustomSystemEventTrigger) -> Self { value.0 } } impl ::core::convert::From<&CustomSystemEventTrigger> for ::windows::core::IInspectable { fn from(value: &CustomSystemEventTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for CustomSystemEventTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a CustomSystemEventTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<CustomSystemEventTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: CustomSystemEventTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&CustomSystemEventTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &CustomSystemEventTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for CustomSystemEventTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &CustomSystemEventTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct CustomSystemEventTriggerRecurrence(pub i32); impl CustomSystemEventTriggerRecurrence { pub const Once: CustomSystemEventTriggerRecurrence = CustomSystemEventTriggerRecurrence(0i32); pub const Always: CustomSystemEventTriggerRecurrence = CustomSystemEventTriggerRecurrence(1i32); } impl ::core::convert::From<i32> for CustomSystemEventTriggerRecurrence { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for CustomSystemEventTriggerRecurrence { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for CustomSystemEventTriggerRecurrence { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.CustomSystemEventTriggerRecurrence;i4)"); } impl ::windows::core::DefaultType for CustomSystemEventTriggerRecurrence { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct DeviceConnectionChangeTrigger(pub ::windows::core::IInspectable); impl DeviceConnectionChangeTrigger { pub fn DeviceId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn CanMaintainConnection(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn MaintainConnection(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetMaintainConnection(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value).ok() } } #[cfg(feature = "Foundation")] pub fn FromIdAsync<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(deviceid: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<DeviceConnectionChangeTrigger>> { Self::IDeviceConnectionChangeTriggerStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), deviceid.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<DeviceConnectionChangeTrigger>>(result__) }) } pub fn IDeviceConnectionChangeTriggerStatics<R, F: FnOnce(&IDeviceConnectionChangeTriggerStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<DeviceConnectionChangeTrigger, IDeviceConnectionChangeTriggerStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for DeviceConnectionChangeTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.DeviceConnectionChangeTrigger;{90875e64-3cdd-4efb-ab1c-5b3b6a60ce34})"); } unsafe impl ::windows::core::Interface for DeviceConnectionChangeTrigger { type Vtable = IDeviceConnectionChangeTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x90875e64_3cdd_4efb_ab1c_5b3b6a60ce34); } impl ::windows::core::RuntimeName for DeviceConnectionChangeTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.DeviceConnectionChangeTrigger"; } impl ::core::convert::From<DeviceConnectionChangeTrigger> for ::windows::core::IUnknown { fn from(value: DeviceConnectionChangeTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&DeviceConnectionChangeTrigger> for ::windows::core::IUnknown { fn from(value: &DeviceConnectionChangeTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for DeviceConnectionChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a DeviceConnectionChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<DeviceConnectionChangeTrigger> for ::windows::core::IInspectable { fn from(value: DeviceConnectionChangeTrigger) -> Self { value.0 } } impl ::core::convert::From<&DeviceConnectionChangeTrigger> for ::windows::core::IInspectable { fn from(value: &DeviceConnectionChangeTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for DeviceConnectionChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a DeviceConnectionChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<DeviceConnectionChangeTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: DeviceConnectionChangeTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&DeviceConnectionChangeTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &DeviceConnectionChangeTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for DeviceConnectionChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &DeviceConnectionChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for DeviceConnectionChangeTrigger {} unsafe impl ::core::marker::Sync for DeviceConnectionChangeTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct DeviceManufacturerNotificationTrigger(pub ::windows::core::IInspectable); impl DeviceManufacturerNotificationTrigger { #[cfg(feature = "deprecated")] pub fn TriggerQualifier(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "deprecated")] pub fn OneShot(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } #[cfg(feature = "deprecated")] pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(triggerqualifier: Param0, oneshot: bool) -> ::windows::core::Result<DeviceManufacturerNotificationTrigger> { Self::IDeviceManufacturerNotificationTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), triggerqualifier.into_param().abi(), oneshot, &mut result__).from_abi::<DeviceManufacturerNotificationTrigger>(result__) }) } pub fn IDeviceManufacturerNotificationTriggerFactory<R, F: FnOnce(&IDeviceManufacturerNotificationTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<DeviceManufacturerNotificationTrigger, IDeviceManufacturerNotificationTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for DeviceManufacturerNotificationTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.DeviceManufacturerNotificationTrigger;{81278ab5-41ab-16da-86c2-7f7bf0912f5b})"); } unsafe impl ::windows::core::Interface for DeviceManufacturerNotificationTrigger { type Vtable = IDeviceManufacturerNotificationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x81278ab5_41ab_16da_86c2_7f7bf0912f5b); } impl ::windows::core::RuntimeName for DeviceManufacturerNotificationTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.DeviceManufacturerNotificationTrigger"; } impl ::core::convert::From<DeviceManufacturerNotificationTrigger> for ::windows::core::IUnknown { fn from(value: DeviceManufacturerNotificationTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&DeviceManufacturerNotificationTrigger> for ::windows::core::IUnknown { fn from(value: &DeviceManufacturerNotificationTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for DeviceManufacturerNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a DeviceManufacturerNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<DeviceManufacturerNotificationTrigger> for ::windows::core::IInspectable { fn from(value: DeviceManufacturerNotificationTrigger) -> Self { value.0 } } impl ::core::convert::From<&DeviceManufacturerNotificationTrigger> for ::windows::core::IInspectable { fn from(value: &DeviceManufacturerNotificationTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for DeviceManufacturerNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a DeviceManufacturerNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<DeviceManufacturerNotificationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: DeviceManufacturerNotificationTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&DeviceManufacturerNotificationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &DeviceManufacturerNotificationTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for DeviceManufacturerNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &DeviceManufacturerNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct DeviceServicingTrigger(pub ::windows::core::IInspectable); impl DeviceServicingTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<DeviceServicingTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Foundation")] pub fn RequestAsyncSimple<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, deviceid: Param0, expectedduration: Param1) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<DeviceTriggerResult>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), deviceid.into_param().abi(), expectedduration.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<DeviceTriggerResult>>(result__) } } #[cfg(feature = "Foundation")] pub fn RequestAsyncWithArguments<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>, Param2: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, deviceid: Param0, expectedduration: Param1, arguments: Param2) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<DeviceTriggerResult>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), deviceid.into_param().abi(), expectedduration.into_param().abi(), arguments.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<DeviceTriggerResult>>(result__) } } } unsafe impl ::windows::core::RuntimeType for DeviceServicingTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.DeviceServicingTrigger;{1ab217ad-6e34-49d3-9e6f-17f1b6dfa881})"); } unsafe impl ::windows::core::Interface for DeviceServicingTrigger { type Vtable = IDeviceServicingTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1ab217ad_6e34_49d3_9e6f_17f1b6dfa881); } impl ::windows::core::RuntimeName for DeviceServicingTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.DeviceServicingTrigger"; } impl ::core::convert::From<DeviceServicingTrigger> for ::windows::core::IUnknown { fn from(value: DeviceServicingTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&DeviceServicingTrigger> for ::windows::core::IUnknown { fn from(value: &DeviceServicingTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for DeviceServicingTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a DeviceServicingTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<DeviceServicingTrigger> for ::windows::core::IInspectable { fn from(value: DeviceServicingTrigger) -> Self { value.0 } } impl ::core::convert::From<&DeviceServicingTrigger> for ::windows::core::IInspectable { fn from(value: &DeviceServicingTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for DeviceServicingTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a DeviceServicingTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<DeviceServicingTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: DeviceServicingTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&DeviceServicingTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &DeviceServicingTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for DeviceServicingTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &DeviceServicingTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for DeviceServicingTrigger {} unsafe impl ::core::marker::Sync for DeviceServicingTrigger {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DeviceTriggerResult(pub i32); impl DeviceTriggerResult { pub const Allowed: DeviceTriggerResult = DeviceTriggerResult(0i32); pub const DeniedByUser: DeviceTriggerResult = DeviceTriggerResult(1i32); pub const DeniedBySystem: DeviceTriggerResult = DeviceTriggerResult(2i32); pub const LowBattery: DeviceTriggerResult = DeviceTriggerResult(3i32); } impl ::core::convert::From<i32> for DeviceTriggerResult { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DeviceTriggerResult { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for DeviceTriggerResult { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.DeviceTriggerResult;i4)"); } impl ::windows::core::DefaultType for DeviceTriggerResult { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct DeviceUseTrigger(pub ::windows::core::IInspectable); impl DeviceUseTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<DeviceUseTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Foundation")] pub fn RequestAsyncSimple<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, deviceid: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<DeviceTriggerResult>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), deviceid.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<DeviceTriggerResult>>(result__) } } #[cfg(feature = "Foundation")] pub fn RequestAsyncWithArguments<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, deviceid: Param0, arguments: Param1) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<DeviceTriggerResult>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), deviceid.into_param().abi(), arguments.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<DeviceTriggerResult>>(result__) } } } unsafe impl ::windows::core::RuntimeType for DeviceUseTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.DeviceUseTrigger;{0da68011-334f-4d57-b6ec-6dca64b412e4})"); } unsafe impl ::windows::core::Interface for DeviceUseTrigger { type Vtable = IDeviceUseTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0da68011_334f_4d57_b6ec_6dca64b412e4); } impl ::windows::core::RuntimeName for DeviceUseTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.DeviceUseTrigger"; } impl ::core::convert::From<DeviceUseTrigger> for ::windows::core::IUnknown { fn from(value: DeviceUseTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&DeviceUseTrigger> for ::windows::core::IUnknown { fn from(value: &DeviceUseTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for DeviceUseTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a DeviceUseTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<DeviceUseTrigger> for ::windows::core::IInspectable { fn from(value: DeviceUseTrigger) -> Self { value.0 } } impl ::core::convert::From<&DeviceUseTrigger> for ::windows::core::IInspectable { fn from(value: &DeviceUseTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for DeviceUseTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a DeviceUseTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<DeviceUseTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: DeviceUseTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&DeviceUseTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &DeviceUseTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for DeviceUseTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &DeviceUseTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for DeviceUseTrigger {} unsafe impl ::core::marker::Sync for DeviceUseTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct DeviceWatcherTrigger(pub ::windows::core::IInspectable); impl DeviceWatcherTrigger {} unsafe impl ::windows::core::RuntimeType for DeviceWatcherTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.DeviceWatcherTrigger;{a4617fdd-8573-4260-befc-5bec89cb693d})"); } unsafe impl ::windows::core::Interface for DeviceWatcherTrigger { type Vtable = IDeviceWatcherTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa4617fdd_8573_4260_befc_5bec89cb693d); } impl ::windows::core::RuntimeName for DeviceWatcherTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.DeviceWatcherTrigger"; } impl ::core::convert::From<DeviceWatcherTrigger> for ::windows::core::IUnknown { fn from(value: DeviceWatcherTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&DeviceWatcherTrigger> for ::windows::core::IUnknown { fn from(value: &DeviceWatcherTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for DeviceWatcherTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a DeviceWatcherTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<DeviceWatcherTrigger> for ::windows::core::IInspectable { fn from(value: DeviceWatcherTrigger) -> Self { value.0 } } impl ::core::convert::From<&DeviceWatcherTrigger> for ::windows::core::IInspectable { fn from(value: &DeviceWatcherTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for DeviceWatcherTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a DeviceWatcherTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<DeviceWatcherTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: DeviceWatcherTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&DeviceWatcherTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &DeviceWatcherTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for DeviceWatcherTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &DeviceWatcherTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailStoreNotificationTrigger(pub ::windows::core::IInspectable); impl EmailStoreNotificationTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<EmailStoreNotificationTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for EmailStoreNotificationTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.EmailStoreNotificationTrigger;{986d06da-47eb-4268-a4f2-f3f77188388a})"); } unsafe impl ::windows::core::Interface for EmailStoreNotificationTrigger { type Vtable = IEmailStoreNotificationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x986d06da_47eb_4268_a4f2_f3f77188388a); } impl ::windows::core::RuntimeName for EmailStoreNotificationTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.EmailStoreNotificationTrigger"; } impl ::core::convert::From<EmailStoreNotificationTrigger> for ::windows::core::IUnknown { fn from(value: EmailStoreNotificationTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailStoreNotificationTrigger> for ::windows::core::IUnknown { fn from(value: &EmailStoreNotificationTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailStoreNotificationTrigger> for ::windows::core::IInspectable { fn from(value: EmailStoreNotificationTrigger) -> Self { value.0 } } impl ::core::convert::From<&EmailStoreNotificationTrigger> for ::windows::core::IInspectable { fn from(value: &EmailStoreNotificationTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<EmailStoreNotificationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: EmailStoreNotificationTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&EmailStoreNotificationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &EmailStoreNotificationTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for EmailStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &EmailStoreNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for EmailStoreNotificationTrigger {} unsafe impl ::core::marker::Sync for EmailStoreNotificationTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct GattCharacteristicNotificationTrigger(pub ::windows::core::IInspectable); impl GattCharacteristicNotificationTrigger { #[cfg(feature = "Devices_Bluetooth_GenericAttributeProfile")] pub fn Characteristic(&self) -> ::windows::core::Result<super::super::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic>(result__) } } #[cfg(feature = "Devices_Bluetooth_GenericAttributeProfile")] pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, super::super::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic>>(characteristic: Param0) -> ::windows::core::Result<GattCharacteristicNotificationTrigger> { Self::IGattCharacteristicNotificationTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), characteristic.into_param().abi(), &mut result__).from_abi::<GattCharacteristicNotificationTrigger>(result__) }) } #[cfg(feature = "Devices_Bluetooth_Background")] pub fn EventTriggeringMode(&self) -> ::windows::core::Result<super::super::Devices::Bluetooth::Background::BluetoothEventTriggeringMode> { let this = &::windows::core::Interface::cast::<IGattCharacteristicNotificationTrigger2>(self)?; unsafe { let mut result__: super::super::Devices::Bluetooth::Background::BluetoothEventTriggeringMode = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Devices::Bluetooth::Background::BluetoothEventTriggeringMode>(result__) } } #[cfg(all(feature = "Devices_Bluetooth_Background", feature = "Devices_Bluetooth_GenericAttributeProfile"))] pub fn CreateWithEventTriggeringMode<'a, Param0: ::windows::core::IntoParam<'a, super::super::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic>>(characteristic: Param0, eventtriggeringmode: super::super::Devices::Bluetooth::Background::BluetoothEventTriggeringMode) -> ::windows::core::Result<GattCharacteristicNotificationTrigger> { Self::IGattCharacteristicNotificationTriggerFactory2(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), characteristic.into_param().abi(), eventtriggeringmode, &mut result__).from_abi::<GattCharacteristicNotificationTrigger>(result__) }) } pub fn IGattCharacteristicNotificationTriggerFactory<R, F: FnOnce(&IGattCharacteristicNotificationTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<GattCharacteristicNotificationTrigger, IGattCharacteristicNotificationTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn IGattCharacteristicNotificationTriggerFactory2<R, F: FnOnce(&IGattCharacteristicNotificationTriggerFactory2) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<GattCharacteristicNotificationTrigger, IGattCharacteristicNotificationTriggerFactory2> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for GattCharacteristicNotificationTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.GattCharacteristicNotificationTrigger;{e25f8fc8-0696-474f-a732-f292b0cebc5d})"); } unsafe impl ::windows::core::Interface for GattCharacteristicNotificationTrigger { type Vtable = IGattCharacteristicNotificationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe25f8fc8_0696_474f_a732_f292b0cebc5d); } impl ::windows::core::RuntimeName for GattCharacteristicNotificationTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.GattCharacteristicNotificationTrigger"; } impl ::core::convert::From<GattCharacteristicNotificationTrigger> for ::windows::core::IUnknown { fn from(value: GattCharacteristicNotificationTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&GattCharacteristicNotificationTrigger> for ::windows::core::IUnknown { fn from(value: &GattCharacteristicNotificationTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for GattCharacteristicNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a GattCharacteristicNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<GattCharacteristicNotificationTrigger> for ::windows::core::IInspectable { fn from(value: GattCharacteristicNotificationTrigger) -> Self { value.0 } } impl ::core::convert::From<&GattCharacteristicNotificationTrigger> for ::windows::core::IInspectable { fn from(value: &GattCharacteristicNotificationTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for GattCharacteristicNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a GattCharacteristicNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<GattCharacteristicNotificationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: GattCharacteristicNotificationTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&GattCharacteristicNotificationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &GattCharacteristicNotificationTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for GattCharacteristicNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &GattCharacteristicNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for GattCharacteristicNotificationTrigger {} unsafe impl ::core::marker::Sync for GattCharacteristicNotificationTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct GattServiceProviderTrigger(pub ::windows::core::IInspectable); impl GattServiceProviderTrigger { pub fn TriggerId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Devices_Bluetooth_GenericAttributeProfile")] pub fn Service(&self) -> ::windows::core::Result<super::super::Devices::Bluetooth::GenericAttributeProfile::GattLocalService> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Devices::Bluetooth::GenericAttributeProfile::GattLocalService>(result__) } } #[cfg(feature = "Devices_Bluetooth_GenericAttributeProfile")] pub fn SetAdvertisingParameters<'a, Param0: ::windows::core::IntoParam<'a, super::super::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Devices_Bluetooth_GenericAttributeProfile")] pub fn AdvertisingParameters(&self) -> ::windows::core::Result<super::super::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters>(result__) } } #[cfg(feature = "Foundation")] pub fn CreateAsync<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param1: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(triggerid: Param0, serviceuuid: Param1) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<GattServiceProviderTriggerResult>> { Self::IGattServiceProviderTriggerStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), triggerid.into_param().abi(), serviceuuid.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<GattServiceProviderTriggerResult>>(result__) }) } pub fn IGattServiceProviderTriggerStatics<R, F: FnOnce(&IGattServiceProviderTriggerStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<GattServiceProviderTrigger, IGattServiceProviderTriggerStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for GattServiceProviderTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.GattServiceProviderTrigger;{ddc6a3e9-1557-4bd8-8542-468aa0c696f6})"); } unsafe impl ::windows::core::Interface for GattServiceProviderTrigger { type Vtable = IGattServiceProviderTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xddc6a3e9_1557_4bd8_8542_468aa0c696f6); } impl ::windows::core::RuntimeName for GattServiceProviderTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.GattServiceProviderTrigger"; } impl ::core::convert::From<GattServiceProviderTrigger> for ::windows::core::IUnknown { fn from(value: GattServiceProviderTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&GattServiceProviderTrigger> for ::windows::core::IUnknown { fn from(value: &GattServiceProviderTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for GattServiceProviderTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a GattServiceProviderTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<GattServiceProviderTrigger> for ::windows::core::IInspectable { fn from(value: GattServiceProviderTrigger) -> Self { value.0 } } impl ::core::convert::From<&GattServiceProviderTrigger> for ::windows::core::IInspectable { fn from(value: &GattServiceProviderTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for GattServiceProviderTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a GattServiceProviderTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<GattServiceProviderTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: GattServiceProviderTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&GattServiceProviderTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &GattServiceProviderTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for GattServiceProviderTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &GattServiceProviderTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for GattServiceProviderTrigger {} unsafe impl ::core::marker::Sync for GattServiceProviderTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct GattServiceProviderTriggerResult(pub ::windows::core::IInspectable); impl GattServiceProviderTriggerResult { pub fn Trigger(&self) -> ::windows::core::Result<GattServiceProviderTrigger> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<GattServiceProviderTrigger>(result__) } } #[cfg(feature = "Devices_Bluetooth")] pub fn Error(&self) -> ::windows::core::Result<super::super::Devices::Bluetooth::BluetoothError> { let this = self; unsafe { let mut result__: super::super::Devices::Bluetooth::BluetoothError = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Devices::Bluetooth::BluetoothError>(result__) } } } unsafe impl ::windows::core::RuntimeType for GattServiceProviderTriggerResult { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.GattServiceProviderTriggerResult;{3c4691b1-b198-4e84-bad4-cf4ad299ed3a})"); } unsafe impl ::windows::core::Interface for GattServiceProviderTriggerResult { type Vtable = IGattServiceProviderTriggerResult_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3c4691b1_b198_4e84_bad4_cf4ad299ed3a); } impl ::windows::core::RuntimeName for GattServiceProviderTriggerResult { const NAME: &'static str = "Windows.ApplicationModel.Background.GattServiceProviderTriggerResult"; } impl ::core::convert::From<GattServiceProviderTriggerResult> for ::windows::core::IUnknown { fn from(value: GattServiceProviderTriggerResult) -> Self { value.0 .0 } } impl ::core::convert::From<&GattServiceProviderTriggerResult> for ::windows::core::IUnknown { fn from(value: &GattServiceProviderTriggerResult) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for GattServiceProviderTriggerResult { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a GattServiceProviderTriggerResult { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<GattServiceProviderTriggerResult> for ::windows::core::IInspectable { fn from(value: GattServiceProviderTriggerResult) -> Self { value.0 } } impl ::core::convert::From<&GattServiceProviderTriggerResult> for ::windows::core::IInspectable { fn from(value: &GattServiceProviderTriggerResult) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for GattServiceProviderTriggerResult { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a GattServiceProviderTriggerResult { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for GattServiceProviderTriggerResult {} unsafe impl ::core::marker::Sync for GattServiceProviderTriggerResult {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct GeovisitTrigger(pub ::windows::core::IInspectable); impl GeovisitTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<GeovisitTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Devices_Geolocation")] pub fn MonitoringScope(&self) -> ::windows::core::Result<super::super::Devices::Geolocation::VisitMonitoringScope> { let this = self; unsafe { let mut result__: super::super::Devices::Geolocation::VisitMonitoringScope = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Devices::Geolocation::VisitMonitoringScope>(result__) } } #[cfg(feature = "Devices_Geolocation")] pub fn SetMonitoringScope(&self, value: super::super::Devices::Geolocation::VisitMonitoringScope) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value).ok() } } } unsafe impl ::windows::core::RuntimeType for GeovisitTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.GeovisitTrigger;{4818edaa-04e1-4127-9a4c-19351b8a80a4})"); } unsafe impl ::windows::core::Interface for GeovisitTrigger { type Vtable = IGeovisitTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4818edaa_04e1_4127_9a4c_19351b8a80a4); } impl ::windows::core::RuntimeName for GeovisitTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.GeovisitTrigger"; } impl ::core::convert::From<GeovisitTrigger> for ::windows::core::IUnknown { fn from(value: GeovisitTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&GeovisitTrigger> for ::windows::core::IUnknown { fn from(value: &GeovisitTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for GeovisitTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a GeovisitTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<GeovisitTrigger> for ::windows::core::IInspectable { fn from(value: GeovisitTrigger) -> Self { value.0 } } impl ::core::convert::From<&GeovisitTrigger> for ::windows::core::IInspectable { fn from(value: &GeovisitTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for GeovisitTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a GeovisitTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<GeovisitTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: GeovisitTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&GeovisitTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &GeovisitTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for GeovisitTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &GeovisitTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for GeovisitTrigger {} unsafe impl ::core::marker::Sync for GeovisitTrigger {} #[repr(transparent)] #[doc(hidden)] pub struct IActivitySensorTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IActivitySensorTrigger { type Vtable = IActivitySensorTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd0dd4342_e37b_4823_a5fe_6b31dfefdeb0); } #[repr(C)] #[doc(hidden)] pub struct IActivitySensorTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(all(feature = "Devices_Sensors", feature = "Foundation_Collections"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Devices_Sensors", feature = "Foundation_Collections")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u32) -> ::windows::core::HRESULT, #[cfg(all(feature = "Devices_Sensors", feature = "Foundation_Collections"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Devices_Sensors", feature = "Foundation_Collections")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IActivitySensorTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IActivitySensorTriggerFactory { type Vtable = IActivitySensorTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa72691c3_3837_44f7_831b_0132cc872bc3); } #[repr(C)] #[doc(hidden)] pub struct IActivitySensorTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, reportintervalinmilliseconds: u32, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IAlarmApplicationManagerStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAlarmApplicationManagerStatics { type Vtable = IAlarmApplicationManagerStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xca03fa3b_cce6_4de2_b09b_9628bd33bbbe); } #[repr(C)] #[doc(hidden)] pub struct IAlarmApplicationManagerStatics_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut AlarmAccessStatus) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IAppBroadcastTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAppBroadcastTrigger { type Vtable = IAppBroadcastTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x74d4f496_8d37_44ec_9481_2a0b9854eb48); } #[repr(C)] #[doc(hidden)] pub struct IAppBroadcastTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IAppBroadcastTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAppBroadcastTriggerFactory { type Vtable = IAppBroadcastTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x280b9f44_22f4_4618_a02e_e7e411eb7238); } #[repr(C)] #[doc(hidden)] pub struct IAppBroadcastTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, providerkey: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IAppBroadcastTriggerProviderInfo(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAppBroadcastTriggerProviderInfo { type Vtable = IAppBroadcastTriggerProviderInfo_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf219352d_9de8_4420_9ce2_5eff8f17376b); } #[repr(C)] #[doc(hidden)] pub struct IAppBroadcastTriggerProviderInfo_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IApplicationTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IApplicationTrigger { type Vtable = IApplicationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0b468630_9574_492c_9e93_1a3ae6335fe9); } #[repr(C)] #[doc(hidden)] pub struct IApplicationTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, arguments: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Foundation_Collections")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IApplicationTriggerDetails(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IApplicationTriggerDetails { type Vtable = IApplicationTriggerDetails_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x97dc6ab2_2219_4a9e_9c5e_41d047f76e82); } #[repr(C)] #[doc(hidden)] pub struct IApplicationTriggerDetails_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IAppointmentStoreNotificationTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAppointmentStoreNotificationTrigger { type Vtable = IAppointmentStoreNotificationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x64d4040c_c201_42ad_aa2a_e21ba3425b6d); } #[repr(C)] #[doc(hidden)] pub struct IAppointmentStoreNotificationTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IBackgroundCondition(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundCondition { type Vtable = IBackgroundCondition_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xae48a1ee_8951_400a_8302_9c9c9a2a3a3b); } impl IBackgroundCondition {} unsafe impl ::windows::core::RuntimeType for IBackgroundCondition { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{ae48a1ee-8951-400a-8302-9c9c9a2a3a3b}"); } impl ::core::convert::From<IBackgroundCondition> for ::windows::core::IUnknown { fn from(value: IBackgroundCondition) -> Self { value.0 .0 } } impl ::core::convert::From<&IBackgroundCondition> for ::windows::core::IUnknown { fn from(value: &IBackgroundCondition) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IBackgroundCondition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IBackgroundCondition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<IBackgroundCondition> for ::windows::core::IInspectable { fn from(value: IBackgroundCondition) -> Self { value.0 } } impl ::core::convert::From<&IBackgroundCondition> for ::windows::core::IInspectable { fn from(value: &IBackgroundCondition) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for IBackgroundCondition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a IBackgroundCondition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IBackgroundCondition_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IBackgroundExecutionManagerStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundExecutionManagerStatics { type Vtable = IBackgroundExecutionManagerStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe826ea58_66a9_4d41_83d4_b4c18c87b846); } #[repr(C)] #[doc(hidden)] pub struct IBackgroundExecutionManagerStatics_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, applicationid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, applicationid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut BackgroundAccessStatus) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, applicationid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut BackgroundAccessStatus) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IBackgroundExecutionManagerStatics2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundExecutionManagerStatics2 { type Vtable = IBackgroundExecutionManagerStatics2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x469b24ef_9bbb_4e18_999a_fd6512931be9); } #[repr(C)] #[doc(hidden)] pub struct IBackgroundExecutionManagerStatics2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, requestedaccess: BackgroundAccessRequestKind, reason: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IBackgroundExecutionManagerStatics3(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundExecutionManagerStatics3 { type Vtable = IBackgroundExecutionManagerStatics3_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x98a5d3f6_5a25_5b6c_9192_d77a43dfedc4); } #[repr(C)] #[doc(hidden)] pub struct IBackgroundExecutionManagerStatics3_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, requestedaccess: BackgroundAccessRequestKind, reason: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut BackgroundAccessStatus) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, applicationid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut BackgroundAccessStatus) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IBackgroundTask(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTask { type Vtable = IBackgroundTask_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7d13d534_fd12_43ce_8c22_ea1ff13c06df); } impl IBackgroundTask { pub fn Run<'a, Param0: ::windows::core::IntoParam<'a, IBackgroundTaskInstance>>(&self, taskinstance: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), taskinstance.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for IBackgroundTask { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{7d13d534-fd12-43ce-8c22-ea1ff13c06df}"); } impl ::core::convert::From<IBackgroundTask> for ::windows::core::IUnknown { fn from(value: IBackgroundTask) -> Self { value.0 .0 } } impl ::core::convert::From<&IBackgroundTask> for ::windows::core::IUnknown { fn from(value: &IBackgroundTask) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IBackgroundTask { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IBackgroundTask { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<IBackgroundTask> for ::windows::core::IInspectable { fn from(value: IBackgroundTask) -> Self { value.0 } } impl ::core::convert::From<&IBackgroundTask> for ::windows::core::IInspectable { fn from(value: &IBackgroundTask) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for IBackgroundTask { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a IBackgroundTask { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTask_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, taskinstance: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IBackgroundTaskBuilder(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskBuilder { type Vtable = IBackgroundTaskBuilder_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0351550e_3e64_4572_a93a_84075a37c917); } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskBuilder_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, trigger: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, condition: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IBackgroundTaskBuilder2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskBuilder2 { type Vtable = IBackgroundTaskBuilder2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6ae7cfb1_104f_406d_8db6_844a570f42bb); } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskBuilder2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IBackgroundTaskBuilder3(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskBuilder3 { type Vtable = IBackgroundTaskBuilder3_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x28c74f4a_8ba9_4c09_a24f_19683e2c924c); } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskBuilder3_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IBackgroundTaskBuilder4(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskBuilder4 { type Vtable = IBackgroundTaskBuilder4_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4755e522_cba2_4e35_bd16_a6da7f1c19aa); } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskBuilder4_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IBackgroundTaskBuilder5(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskBuilder5 { type Vtable = IBackgroundTaskBuilder5_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x077103f6_99f5_4af4_bcad_4731d0330d43); } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskBuilder5_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, taskentrypoint: ::windows::core::GUID) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IBackgroundTaskCompletedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskCompletedEventArgs { type Vtable = IBackgroundTaskCompletedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x565d25cf_f209_48f4_9967_2b184f7bfbf0); } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskCompletedEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IBackgroundTaskDeferral(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskDeferral { type Vtable = IBackgroundTaskDeferral_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x93cc156d_af27_4dd3_846e_24ee40cadd25); } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskDeferral_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IBackgroundTaskInstance(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskInstance { type Vtable = IBackgroundTaskInstance_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x865bda7a_21d8_4573_8f32_928a1b0641f6); } impl IBackgroundTaskInstance { pub fn InstanceId(&self) -> ::windows::core::Result<::windows::core::GUID> { let this = self; unsafe { let mut result__: ::windows::core::GUID = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::GUID>(result__) } } pub fn Task(&self) -> ::windows::core::Result<BackgroundTaskRegistration> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BackgroundTaskRegistration>(result__) } } pub fn Progress(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn SetProgress(&self, value: u32) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value).ok() } } pub fn TriggerDetails(&self) -> ::windows::core::Result<::windows::core::IInspectable> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::IInspectable>(result__) } } #[cfg(feature = "Foundation")] pub fn Canceled<'a, Param0: ::windows::core::IntoParam<'a, BackgroundTaskCanceledEventHandler>>(&self, cancelhandler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), cancelhandler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveCanceled<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, cookie: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), cookie.into_param().abi()).ok() } } pub fn SuspendedCount(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn GetDeferral(&self) -> ::windows::core::Result<BackgroundTaskDeferral> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BackgroundTaskDeferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for IBackgroundTaskInstance { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{865bda7a-21d8-4573-8f32-928a1b0641f6}"); } impl ::core::convert::From<IBackgroundTaskInstance> for ::windows::core::IUnknown { fn from(value: IBackgroundTaskInstance) -> Self { value.0 .0 } } impl ::core::convert::From<&IBackgroundTaskInstance> for ::windows::core::IUnknown { fn from(value: &IBackgroundTaskInstance) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IBackgroundTaskInstance { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IBackgroundTaskInstance { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<IBackgroundTaskInstance> for ::windows::core::IInspectable { fn from(value: IBackgroundTaskInstance) -> Self { value.0 } } impl ::core::convert::From<&IBackgroundTaskInstance> for ::windows::core::IInspectable { fn from(value: &IBackgroundTaskInstance) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for IBackgroundTaskInstance { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a IBackgroundTaskInstance { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskInstance_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, cancelhandler: ::windows::core::RawPtr, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, cookie: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IBackgroundTaskInstance2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskInstance2 { type Vtable = IBackgroundTaskInstance2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4f7d0176_0c76_4fb4_896d_5de1864122f6); } impl IBackgroundTaskInstance2 { pub fn GetThrottleCount(&self, counter: BackgroundTaskThrottleCounter) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), counter, &mut result__).from_abi::<u32>(result__) } } pub fn InstanceId(&self) -> ::windows::core::Result<::windows::core::GUID> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { let mut result__: ::windows::core::GUID = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::GUID>(result__) } } pub fn Task(&self) -> ::windows::core::Result<BackgroundTaskRegistration> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BackgroundTaskRegistration>(result__) } } pub fn Progress(&self) -> ::windows::core::Result<u32> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn SetProgress(&self, value: u32) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value).ok() } } pub fn TriggerDetails(&self) -> ::windows::core::Result<::windows::core::IInspectable> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::IInspectable>(result__) } } #[cfg(feature = "Foundation")] pub fn Canceled<'a, Param0: ::windows::core::IntoParam<'a, BackgroundTaskCanceledEventHandler>>(&self, cancelhandler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), cancelhandler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveCanceled<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, cookie: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), cookie.into_param().abi()).ok() } } pub fn SuspendedCount(&self) -> ::windows::core::Result<u32> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn GetDeferral(&self) -> ::windows::core::Result<BackgroundTaskDeferral> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BackgroundTaskDeferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for IBackgroundTaskInstance2 { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{4f7d0176-0c76-4fb4-896d-5de1864122f6}"); } impl ::core::convert::From<IBackgroundTaskInstance2> for ::windows::core::IUnknown { fn from(value: IBackgroundTaskInstance2) -> Self { value.0 .0 } } impl ::core::convert::From<&IBackgroundTaskInstance2> for ::windows::core::IUnknown { fn from(value: &IBackgroundTaskInstance2) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IBackgroundTaskInstance2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IBackgroundTaskInstance2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<IBackgroundTaskInstance2> for ::windows::core::IInspectable { fn from(value: IBackgroundTaskInstance2) -> Self { value.0 } } impl ::core::convert::From<&IBackgroundTaskInstance2> for ::windows::core::IInspectable { fn from(value: &IBackgroundTaskInstance2) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for IBackgroundTaskInstance2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a IBackgroundTaskInstance2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<IBackgroundTaskInstance2> for IBackgroundTaskInstance { type Error = ::windows::core::Error; fn try_from(value: IBackgroundTaskInstance2) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&IBackgroundTaskInstance2> for IBackgroundTaskInstance { type Error = ::windows::core::Error; fn try_from(value: &IBackgroundTaskInstance2) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTaskInstance> for IBackgroundTaskInstance2 { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTaskInstance> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTaskInstance> for &IBackgroundTaskInstance2 { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTaskInstance> { ::core::convert::TryInto::<IBackgroundTaskInstance>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskInstance2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, counter: BackgroundTaskThrottleCounter, result__: *mut u32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IBackgroundTaskInstance4(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskInstance4 { type Vtable = IBackgroundTaskInstance4_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7f29f23c_aa04_4b08_97b0_06d874cdabf5); } impl IBackgroundTaskInstance4 { pub fn InstanceId(&self) -> ::windows::core::Result<::windows::core::GUID> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { let mut result__: ::windows::core::GUID = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::GUID>(result__) } } pub fn Task(&self) -> ::windows::core::Result<BackgroundTaskRegistration> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BackgroundTaskRegistration>(result__) } } pub fn Progress(&self) -> ::windows::core::Result<u32> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn SetProgress(&self, value: u32) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value).ok() } } pub fn TriggerDetails(&self) -> ::windows::core::Result<::windows::core::IInspectable> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::IInspectable>(result__) } } #[cfg(feature = "Foundation")] pub fn Canceled<'a, Param0: ::windows::core::IntoParam<'a, BackgroundTaskCanceledEventHandler>>(&self, cancelhandler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), cancelhandler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveCanceled<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, cookie: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), cookie.into_param().abi()).ok() } } pub fn SuspendedCount(&self) -> ::windows::core::Result<u32> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn GetDeferral(&self) -> ::windows::core::Result<BackgroundTaskDeferral> { let this = &::windows::core::Interface::cast::<IBackgroundTaskInstance>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BackgroundTaskDeferral>(result__) } } #[cfg(feature = "System")] pub fn User(&self) -> ::windows::core::Result<super::super::System::User> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::System::User>(result__) } } } unsafe impl ::windows::core::RuntimeType for IBackgroundTaskInstance4 { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{7f29f23c-aa04-4b08-97b0-06d874cdabf5}"); } impl ::core::convert::From<IBackgroundTaskInstance4> for ::windows::core::IUnknown { fn from(value: IBackgroundTaskInstance4) -> Self { value.0 .0 } } impl ::core::convert::From<&IBackgroundTaskInstance4> for ::windows::core::IUnknown { fn from(value: &IBackgroundTaskInstance4) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IBackgroundTaskInstance4 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IBackgroundTaskInstance4 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<IBackgroundTaskInstance4> for ::windows::core::IInspectable { fn from(value: IBackgroundTaskInstance4) -> Self { value.0 } } impl ::core::convert::From<&IBackgroundTaskInstance4> for ::windows::core::IInspectable { fn from(value: &IBackgroundTaskInstance4) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for IBackgroundTaskInstance4 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a IBackgroundTaskInstance4 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<IBackgroundTaskInstance4> for IBackgroundTaskInstance { type Error = ::windows::core::Error; fn try_from(value: IBackgroundTaskInstance4) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&IBackgroundTaskInstance4> for IBackgroundTaskInstance { type Error = ::windows::core::Error; fn try_from(value: &IBackgroundTaskInstance4) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTaskInstance> for IBackgroundTaskInstance4 { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTaskInstance> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTaskInstance> for &IBackgroundTaskInstance4 { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTaskInstance> { ::core::convert::TryInto::<IBackgroundTaskInstance>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskInstance4_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "System")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "System"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IBackgroundTaskProgressEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskProgressEventArgs { type Vtable = IBackgroundTaskProgressEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfb1468ac_8332_4d0a_9532_03eae684da31); } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskProgressEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IBackgroundTaskRegistration(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskRegistration { type Vtable = IBackgroundTaskRegistration_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x10654cc2_a26e_43bf_8c12_1fb40dbfbfa0); } impl IBackgroundTaskRegistration { pub fn TaskId(&self) -> ::windows::core::Result<::windows::core::GUID> { let this = self; unsafe { let mut result__: ::windows::core::GUID = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::GUID>(result__) } } pub fn Name(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn Progress<'a, Param0: ::windows::core::IntoParam<'a, BackgroundTaskProgressEventHandler>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveProgress<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, cookie: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), cookie.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Completed<'a, Param0: ::windows::core::IntoParam<'a, BackgroundTaskCompletedEventHandler>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveCompleted<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, cookie: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), cookie.into_param().abi()).ok() } } pub fn Unregister(&self, canceltask: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), canceltask).ok() } } } unsafe impl ::windows::core::RuntimeType for IBackgroundTaskRegistration { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{10654cc2-a26e-43bf-8c12-1fb40dbfbfa0}"); } impl ::core::convert::From<IBackgroundTaskRegistration> for ::windows::core::IUnknown { fn from(value: IBackgroundTaskRegistration) -> Self { value.0 .0 } } impl ::core::convert::From<&IBackgroundTaskRegistration> for ::windows::core::IUnknown { fn from(value: &IBackgroundTaskRegistration) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IBackgroundTaskRegistration { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IBackgroundTaskRegistration { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<IBackgroundTaskRegistration> for ::windows::core::IInspectable { fn from(value: IBackgroundTaskRegistration) -> Self { value.0 } } impl ::core::convert::From<&IBackgroundTaskRegistration> for ::windows::core::IInspectable { fn from(value: &IBackgroundTaskRegistration) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for IBackgroundTaskRegistration { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a IBackgroundTaskRegistration { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskRegistration_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, cookie: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, cookie: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, canceltask: bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IBackgroundTaskRegistration2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskRegistration2 { type Vtable = IBackgroundTaskRegistration2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6138c703_bb86_4112_afc3_7f939b166e3b); } impl IBackgroundTaskRegistration2 { pub fn Trigger(&self) -> ::windows::core::Result<IBackgroundTrigger> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<IBackgroundTrigger>(result__) } } pub fn TaskId(&self) -> ::windows::core::Result<::windows::core::GUID> { let this = &::windows::core::Interface::cast::<IBackgroundTaskRegistration>(self)?; unsafe { let mut result__: ::windows::core::GUID = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::GUID>(result__) } } pub fn Name(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IBackgroundTaskRegistration>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn Progress<'a, Param0: ::windows::core::IntoParam<'a, BackgroundTaskProgressEventHandler>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = &::windows::core::Interface::cast::<IBackgroundTaskRegistration>(self)?; unsafe { let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveProgress<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, cookie: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBackgroundTaskRegistration>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), cookie.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Completed<'a, Param0: ::windows::core::IntoParam<'a, BackgroundTaskCompletedEventHandler>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = &::windows::core::Interface::cast::<IBackgroundTaskRegistration>(self)?; unsafe { let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveCompleted<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, cookie: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBackgroundTaskRegistration>(self)?; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), cookie.into_param().abi()).ok() } } pub fn Unregister(&self, canceltask: bool) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBackgroundTaskRegistration>(self)?; unsafe { (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), canceltask).ok() } } } unsafe impl ::windows::core::RuntimeType for IBackgroundTaskRegistration2 { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{6138c703-bb86-4112-afc3-7f939b166e3b}"); } impl ::core::convert::From<IBackgroundTaskRegistration2> for ::windows::core::IUnknown { fn from(value: IBackgroundTaskRegistration2) -> Self { value.0 .0 } } impl ::core::convert::From<&IBackgroundTaskRegistration2> for ::windows::core::IUnknown { fn from(value: &IBackgroundTaskRegistration2) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IBackgroundTaskRegistration2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IBackgroundTaskRegistration2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<IBackgroundTaskRegistration2> for ::windows::core::IInspectable { fn from(value: IBackgroundTaskRegistration2) -> Self { value.0 } } impl ::core::convert::From<&IBackgroundTaskRegistration2> for ::windows::core::IInspectable { fn from(value: &IBackgroundTaskRegistration2) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for IBackgroundTaskRegistration2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a IBackgroundTaskRegistration2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<IBackgroundTaskRegistration2> for IBackgroundTaskRegistration { type Error = ::windows::core::Error; fn try_from(value: IBackgroundTaskRegistration2) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&IBackgroundTaskRegistration2> for IBackgroundTaskRegistration { type Error = ::windows::core::Error; fn try_from(value: &IBackgroundTaskRegistration2) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTaskRegistration> for IBackgroundTaskRegistration2 { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTaskRegistration> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTaskRegistration> for &IBackgroundTaskRegistration2 { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTaskRegistration> { ::core::convert::TryInto::<IBackgroundTaskRegistration>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskRegistration2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IBackgroundTaskRegistration3(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskRegistration3 { type Vtable = IBackgroundTaskRegistration3_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfe338195_9423_4d8b_830d_b1dd2c7badd5); } impl IBackgroundTaskRegistration3 { pub fn TaskId(&self) -> ::windows::core::Result<::windows::core::GUID> { let this = &::windows::core::Interface::cast::<IBackgroundTaskRegistration>(self)?; unsafe { let mut result__: ::windows::core::GUID = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::GUID>(result__) } } pub fn Name(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IBackgroundTaskRegistration>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn Progress<'a, Param0: ::windows::core::IntoParam<'a, BackgroundTaskProgressEventHandler>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = &::windows::core::Interface::cast::<IBackgroundTaskRegistration>(self)?; unsafe { let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveProgress<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, cookie: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBackgroundTaskRegistration>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), cookie.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Completed<'a, Param0: ::windows::core::IntoParam<'a, BackgroundTaskCompletedEventHandler>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = &::windows::core::Interface::cast::<IBackgroundTaskRegistration>(self)?; unsafe { let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveCompleted<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, cookie: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBackgroundTaskRegistration>(self)?; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), cookie.into_param().abi()).ok() } } pub fn Unregister(&self, canceltask: bool) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IBackgroundTaskRegistration>(self)?; unsafe { (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), canceltask).ok() } } pub fn TaskGroup(&self) -> ::windows::core::Result<BackgroundTaskRegistrationGroup> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BackgroundTaskRegistrationGroup>(result__) } } } unsafe impl ::windows::core::RuntimeType for IBackgroundTaskRegistration3 { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{fe338195-9423-4d8b-830d-b1dd2c7badd5}"); } impl ::core::convert::From<IBackgroundTaskRegistration3> for ::windows::core::IUnknown { fn from(value: IBackgroundTaskRegistration3) -> Self { value.0 .0 } } impl ::core::convert::From<&IBackgroundTaskRegistration3> for ::windows::core::IUnknown { fn from(value: &IBackgroundTaskRegistration3) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IBackgroundTaskRegistration3 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IBackgroundTaskRegistration3 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<IBackgroundTaskRegistration3> for ::windows::core::IInspectable { fn from(value: IBackgroundTaskRegistration3) -> Self { value.0 } } impl ::core::convert::From<&IBackgroundTaskRegistration3> for ::windows::core::IInspectable { fn from(value: &IBackgroundTaskRegistration3) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for IBackgroundTaskRegistration3 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a IBackgroundTaskRegistration3 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<IBackgroundTaskRegistration3> for IBackgroundTaskRegistration { type Error = ::windows::core::Error; fn try_from(value: IBackgroundTaskRegistration3) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&IBackgroundTaskRegistration3> for IBackgroundTaskRegistration { type Error = ::windows::core::Error; fn try_from(value: &IBackgroundTaskRegistration3) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTaskRegistration> for IBackgroundTaskRegistration3 { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTaskRegistration> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTaskRegistration> for &IBackgroundTaskRegistration3 { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTaskRegistration> { ::core::convert::TryInto::<IBackgroundTaskRegistration>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskRegistration3_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IBackgroundTaskRegistrationGroup(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskRegistrationGroup { type Vtable = IBackgroundTaskRegistrationGroup_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2ab1919a_871b_4167_8a76_055cd67b5b23); } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskRegistrationGroup_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(all(feature = "ApplicationModel_Activation", feature = "Foundation"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "ApplicationModel_Activation", feature = "Foundation")))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IBackgroundTaskRegistrationGroupFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskRegistrationGroupFactory { type Vtable = IBackgroundTaskRegistrationGroupFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x83d92b69_44cf_4631_9740_03c7d8741bc5); } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskRegistrationGroupFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, id: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, id: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, name: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IBackgroundTaskRegistrationStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskRegistrationStatics { type Vtable = IBackgroundTaskRegistrationStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4c542f69_b000_42ba_a093_6a563c65e3f8); } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskRegistrationStatics_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IBackgroundTaskRegistrationStatics2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTaskRegistrationStatics2 { type Vtable = IBackgroundTaskRegistrationStatics2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x174b671e_b20d_4fa9_ad9a_e93ad6c71e01); } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTaskRegistrationStatics2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, groupid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IBackgroundTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl IBackgroundTrigger {} unsafe impl ::windows::core::RuntimeType for IBackgroundTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{84b3a058-6027-4b87-9790-bdf3f757dbd7}"); } impl ::core::convert::From<IBackgroundTrigger> for ::windows::core::IUnknown { fn from(value: IBackgroundTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&IBackgroundTrigger> for ::windows::core::IUnknown { fn from(value: &IBackgroundTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IBackgroundTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IBackgroundTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<IBackgroundTrigger> for ::windows::core::IInspectable { fn from(value: IBackgroundTrigger) -> Self { value.0 } } impl ::core::convert::From<&IBackgroundTrigger> for ::windows::core::IInspectable { fn from(value: &IBackgroundTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for IBackgroundTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a IBackgroundTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IBackgroundTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IBackgroundWorkCostStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBackgroundWorkCostStatics { type Vtable = IBackgroundWorkCostStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc740a662_c310_4b82_b3e3_3bcfb9e4c77d); } #[repr(C)] #[doc(hidden)] pub struct IBackgroundWorkCostStatics_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut BackgroundWorkCostValue) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IBluetoothLEAdvertisementPublisherTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBluetoothLEAdvertisementPublisherTrigger { type Vtable = IBluetoothLEAdvertisementPublisherTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xab3e2612_25d3_48ae_8724_d81877ae6129); } #[repr(C)] #[doc(hidden)] pub struct IBluetoothLEAdvertisementPublisherTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Devices_Bluetooth_Advertisement")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Bluetooth_Advertisement"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IBluetoothLEAdvertisementPublisherTrigger2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBluetoothLEAdvertisementPublisherTrigger2 { type Vtable = IBluetoothLEAdvertisementPublisherTrigger2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xaa28d064_38f4_597d_b597_4e55588c6503); } #[repr(C)] #[doc(hidden)] pub struct IBluetoothLEAdvertisementPublisherTrigger2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IBluetoothLEAdvertisementWatcherTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBluetoothLEAdvertisementWatcherTrigger { type Vtable = IBluetoothLEAdvertisementWatcherTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1aab1819_bce1_48eb_a827_59fb7cee52a6); } #[repr(C)] #[doc(hidden)] pub struct IBluetoothLEAdvertisementWatcherTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Devices_Bluetooth")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Bluetooth"))] usize, #[cfg(feature = "Devices_Bluetooth")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Bluetooth"))] usize, #[cfg(feature = "Devices_Bluetooth_Advertisement")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Bluetooth_Advertisement"))] usize, #[cfg(feature = "Devices_Bluetooth_Advertisement")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Bluetooth_Advertisement"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IBluetoothLEAdvertisementWatcherTrigger2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IBluetoothLEAdvertisementWatcherTrigger2 { type Vtable = IBluetoothLEAdvertisementWatcherTrigger2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x39b56799_eb39_5ab6_9932_aa9e4549604d); } #[repr(C)] #[doc(hidden)] pub struct IBluetoothLEAdvertisementWatcherTrigger2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ICachedFileUpdaterTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ICachedFileUpdaterTrigger { type Vtable = ICachedFileUpdaterTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe21caeeb_32f2_4d31_b553_b9e01bde37e0); } #[repr(C)] #[doc(hidden)] pub struct ICachedFileUpdaterTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ICachedFileUpdaterTriggerDetails(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ICachedFileUpdaterTriggerDetails { type Vtable = ICachedFileUpdaterTriggerDetails_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x71838c13_1314_47b4_9597_dc7e248c17cc); } #[repr(C)] #[doc(hidden)] pub struct ICachedFileUpdaterTriggerDetails_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Storage_Provider")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Storage::Provider::CachedFileTarget) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Provider"))] usize, #[cfg(feature = "Storage_Provider")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Provider"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IChatMessageNotificationTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IChatMessageNotificationTrigger { type Vtable = IChatMessageNotificationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x513b43bf_1d40_5c5d_78f5_c923fee3739e); } #[repr(C)] #[doc(hidden)] pub struct IChatMessageNotificationTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IChatMessageReceivedNotificationTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IChatMessageReceivedNotificationTrigger { type Vtable = IChatMessageReceivedNotificationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3ea3760e_baf5_4077_88e9_060cf6f0c6d5); } #[repr(C)] #[doc(hidden)] pub struct IChatMessageReceivedNotificationTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ICommunicationBlockingAppSetAsActiveTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ICommunicationBlockingAppSetAsActiveTrigger { type Vtable = ICommunicationBlockingAppSetAsActiveTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfb91f28a_16a5_486d_974c_7835a8477be2); } #[repr(C)] #[doc(hidden)] pub struct ICommunicationBlockingAppSetAsActiveTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IContactStoreNotificationTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IContactStoreNotificationTrigger { type Vtable = IContactStoreNotificationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc833419b_4705_4571_9a16_06b997bf9c96); } #[repr(C)] #[doc(hidden)] pub struct IContactStoreNotificationTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IContentPrefetchTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IContentPrefetchTrigger { type Vtable = IContentPrefetchTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x710627ee_04fa_440b_80c0_173202199e5d); } #[repr(C)] #[doc(hidden)] pub struct IContentPrefetchTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IContentPrefetchTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IContentPrefetchTriggerFactory { type Vtable = IContentPrefetchTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc2643eda_8a03_409e_b8c4_88814c28ccb6); } #[repr(C)] #[doc(hidden)] pub struct IContentPrefetchTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, waitinterval: super::super::Foundation::TimeSpan, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ICustomSystemEventTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ICustomSystemEventTrigger { type Vtable = ICustomSystemEventTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf3596798_cf6b_4ef4_a0ca_29cf4a278c87); } #[repr(C)] #[doc(hidden)] pub struct ICustomSystemEventTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut CustomSystemEventTriggerRecurrence) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ICustomSystemEventTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ICustomSystemEventTriggerFactory { type Vtable = ICustomSystemEventTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6bcb16c5_f2dc_41b2_9efd_b96bdcd13ced); } #[repr(C)] #[doc(hidden)] pub struct ICustomSystemEventTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, triggerid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, recurrence: CustomSystemEventTriggerRecurrence, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IDeviceConnectionChangeTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IDeviceConnectionChangeTrigger { type Vtable = IDeviceConnectionChangeTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x90875e64_3cdd_4efb_ab1c_5b3b6a60ce34); } #[repr(C)] #[doc(hidden)] pub struct IDeviceConnectionChangeTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IDeviceConnectionChangeTriggerStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IDeviceConnectionChangeTriggerStatics { type Vtable = IDeviceConnectionChangeTriggerStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc3ea246a_4efd_4498_aa60_a4e4e3b17ab9); } #[repr(C)] #[doc(hidden)] pub struct IDeviceConnectionChangeTriggerStatics_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, deviceid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IDeviceManufacturerNotificationTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IDeviceManufacturerNotificationTrigger { type Vtable = IDeviceManufacturerNotificationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x81278ab5_41ab_16da_86c2_7f7bf0912f5b); } #[repr(C)] #[doc(hidden)] pub struct IDeviceManufacturerNotificationTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IDeviceManufacturerNotificationTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IDeviceManufacturerNotificationTriggerFactory { type Vtable = IDeviceManufacturerNotificationTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7955de75_25bb_4153_a1a2_3029fcabb652); } #[repr(C)] #[doc(hidden)] pub struct IDeviceManufacturerNotificationTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, triggerqualifier: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, oneshot: bool, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IDeviceServicingTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IDeviceServicingTrigger { type Vtable = IDeviceServicingTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1ab217ad_6e34_49d3_9e6f_17f1b6dfa881); } #[repr(C)] #[doc(hidden)] pub struct IDeviceServicingTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, deviceid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, expectedduration: super::super::Foundation::TimeSpan, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, deviceid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, expectedduration: super::super::Foundation::TimeSpan, arguments: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IDeviceUseTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IDeviceUseTrigger { type Vtable = IDeviceUseTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0da68011_334f_4d57_b6ec_6dca64b412e4); } #[repr(C)] #[doc(hidden)] pub struct IDeviceUseTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, deviceid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, deviceid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, arguments: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IDeviceWatcherTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IDeviceWatcherTrigger { type Vtable = IDeviceWatcherTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa4617fdd_8573_4260_befc_5bec89cb693d); } #[repr(C)] #[doc(hidden)] pub struct IDeviceWatcherTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailStoreNotificationTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailStoreNotificationTrigger { type Vtable = IEmailStoreNotificationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x986d06da_47eb_4268_a4f2_f3f77188388a); } #[repr(C)] #[doc(hidden)] pub struct IEmailStoreNotificationTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IGattCharacteristicNotificationTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGattCharacteristicNotificationTrigger { type Vtable = IGattCharacteristicNotificationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe25f8fc8_0696_474f_a732_f292b0cebc5d); } #[repr(C)] #[doc(hidden)] pub struct IGattCharacteristicNotificationTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Devices_Bluetooth_GenericAttributeProfile")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Bluetooth_GenericAttributeProfile"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IGattCharacteristicNotificationTrigger2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGattCharacteristicNotificationTrigger2 { type Vtable = IGattCharacteristicNotificationTrigger2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9322a2c4_ae0e_42f2_b28c_f51372e69245); } #[repr(C)] #[doc(hidden)] pub struct IGattCharacteristicNotificationTrigger2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Devices_Bluetooth_Background")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Devices::Bluetooth::Background::BluetoothEventTriggeringMode) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Bluetooth_Background"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IGattCharacteristicNotificationTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGattCharacteristicNotificationTriggerFactory { type Vtable = IGattCharacteristicNotificationTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x57ba1995_b143_4575_9f6b_fd59d93ace1a); } #[repr(C)] #[doc(hidden)] pub struct IGattCharacteristicNotificationTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Devices_Bluetooth_GenericAttributeProfile")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, characteristic: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Bluetooth_GenericAttributeProfile"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IGattCharacteristicNotificationTriggerFactory2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGattCharacteristicNotificationTriggerFactory2 { type Vtable = IGattCharacteristicNotificationTriggerFactory2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5998e91f_8a53_4e9f_a32c_23cd33664cee); } #[repr(C)] #[doc(hidden)] pub struct IGattCharacteristicNotificationTriggerFactory2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(all(feature = "Devices_Bluetooth_Background", feature = "Devices_Bluetooth_GenericAttributeProfile"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, characteristic: ::windows::core::RawPtr, eventtriggeringmode: super::super::Devices::Bluetooth::Background::BluetoothEventTriggeringMode, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Devices_Bluetooth_Background", feature = "Devices_Bluetooth_GenericAttributeProfile")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IGattServiceProviderTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGattServiceProviderTrigger { type Vtable = IGattServiceProviderTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xddc6a3e9_1557_4bd8_8542_468aa0c696f6); } #[repr(C)] #[doc(hidden)] pub struct IGattServiceProviderTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Devices_Bluetooth_GenericAttributeProfile")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Bluetooth_GenericAttributeProfile"))] usize, #[cfg(feature = "Devices_Bluetooth_GenericAttributeProfile")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Bluetooth_GenericAttributeProfile"))] usize, #[cfg(feature = "Devices_Bluetooth_GenericAttributeProfile")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Bluetooth_GenericAttributeProfile"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IGattServiceProviderTriggerResult(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGattServiceProviderTriggerResult { type Vtable = IGattServiceProviderTriggerResult_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3c4691b1_b198_4e84_bad4_cf4ad299ed3a); } #[repr(C)] #[doc(hidden)] pub struct IGattServiceProviderTriggerResult_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Devices_Bluetooth")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Devices::Bluetooth::BluetoothError) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Bluetooth"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IGattServiceProviderTriggerStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGattServiceProviderTriggerStatics { type Vtable = IGattServiceProviderTriggerStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb413a36a_e294_4591_a5a6_64891a828153); } #[repr(C)] #[doc(hidden)] pub struct IGattServiceProviderTriggerStatics_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, triggerid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, serviceuuid: ::windows::core::GUID, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeovisitTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeovisitTrigger { type Vtable = IGeovisitTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4818edaa_04e1_4127_9a4c_19351b8a80a4); } #[repr(C)] #[doc(hidden)] pub struct IGeovisitTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Devices_Geolocation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Devices::Geolocation::VisitMonitoringScope) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Geolocation"))] usize, #[cfg(feature = "Devices_Geolocation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::Devices::Geolocation::VisitMonitoringScope) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Geolocation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ILocationTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ILocationTrigger { type Vtable = ILocationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x47666a1c_6877_481e_8026_ff7e14a811a0); } #[repr(C)] #[doc(hidden)] pub struct ILocationTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut LocationTriggerType) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ILocationTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ILocationTriggerFactory { type Vtable = ILocationTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1106bb07_ff69_4e09_aa8b_1384ea475e98); } #[repr(C)] #[doc(hidden)] pub struct ILocationTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, triggertype: LocationTriggerType, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMaintenanceTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMaintenanceTrigger { type Vtable = IMaintenanceTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x68184c83_fc22_4ce5_841a_7239a9810047); } #[repr(C)] #[doc(hidden)] pub struct IMaintenanceTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMaintenanceTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMaintenanceTriggerFactory { type Vtable = IMaintenanceTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4b3ddb2e_97dd_4629_88b0_b06cf9482ae5); } #[repr(C)] #[doc(hidden)] pub struct IMaintenanceTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, freshnesstime: u32, oneshot: bool, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaProcessingTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaProcessingTrigger { type Vtable = IMediaProcessingTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9a95be65_8a52_4b30_9011_cf38040ea8b0); } #[repr(C)] #[doc(hidden)] pub struct IMediaProcessingTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, arguments: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Foundation_Collections")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct INetworkOperatorHotspotAuthenticationTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for INetworkOperatorHotspotAuthenticationTrigger { type Vtable = INetworkOperatorHotspotAuthenticationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe756c791_3001_4de5_83c7_de61d88831d0); } #[repr(C)] #[doc(hidden)] pub struct INetworkOperatorHotspotAuthenticationTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct INetworkOperatorNotificationTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for INetworkOperatorNotificationTrigger { type Vtable = INetworkOperatorNotificationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x90089cc6_63cd_480c_95d1_6e6aef801e4a); } #[repr(C)] #[doc(hidden)] pub struct INetworkOperatorNotificationTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct INetworkOperatorNotificationTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for INetworkOperatorNotificationTriggerFactory { type Vtable = INetworkOperatorNotificationTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0a223e00_27d7_4353_adb9_9265aaea579d); } #[repr(C)] #[doc(hidden)] pub struct INetworkOperatorNotificationTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, networkaccountid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IPhoneTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IPhoneTrigger { type Vtable = IPhoneTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8dcfe99b_d4c5_49f1_b7d3_82e87a0e9dde); } #[repr(C)] #[doc(hidden)] pub struct IPhoneTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, #[cfg(feature = "ApplicationModel_Calls_Background")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::Calls::Background::PhoneTriggerType) -> ::windows::core::HRESULT, #[cfg(not(feature = "ApplicationModel_Calls_Background"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IPhoneTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IPhoneTriggerFactory { type Vtable = IPhoneTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa0d93cda_5fc1_48fb_a546_32262040157b); } #[repr(C)] #[doc(hidden)] pub struct IPhoneTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "ApplicationModel_Calls_Background")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, r#type: super::Calls::Background::PhoneTriggerType, oneshot: bool, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "ApplicationModel_Calls_Background"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IPushNotificationTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IPushNotificationTriggerFactory { type Vtable = IPushNotificationTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6dd8ed1b_458e_4fc2_bc2e_d5664f77ed19); } #[repr(C)] #[doc(hidden)] pub struct IPushNotificationTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, applicationid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IRcsEndUserMessageAvailableTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IRcsEndUserMessageAvailableTrigger { type Vtable = IRcsEndUserMessageAvailableTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x986d0d6a_b2f6_467f_a978_a44091c11a66); } #[repr(C)] #[doc(hidden)] pub struct IRcsEndUserMessageAvailableTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IRfcommConnectionTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IRfcommConnectionTrigger { type Vtable = IRfcommConnectionTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe8c4cae2_0b53_4464_9394_fd875654de64); } #[repr(C)] #[doc(hidden)] pub struct IRfcommConnectionTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Devices_Bluetooth_Background")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Bluetooth_Background"))] usize, #[cfg(feature = "Devices_Bluetooth_Background")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Bluetooth_Background"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, #[cfg(feature = "Networking_Sockets")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Networking::Sockets::SocketProtectionLevel) -> ::windows::core::HRESULT, #[cfg(not(feature = "Networking_Sockets"))] usize, #[cfg(feature = "Networking_Sockets")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::Networking::Sockets::SocketProtectionLevel) -> ::windows::core::HRESULT, #[cfg(not(feature = "Networking_Sockets"))] usize, #[cfg(feature = "Networking")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Networking"))] usize, #[cfg(feature = "Networking")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Networking"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISecondaryAuthenticationFactorAuthenticationTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISecondaryAuthenticationFactorAuthenticationTrigger { type Vtable = ISecondaryAuthenticationFactorAuthenticationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf237f327_5181_4f24_96a7_700a4e5fac62); } #[repr(C)] #[doc(hidden)] pub struct ISecondaryAuthenticationFactorAuthenticationTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISensorDataThresholdTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISensorDataThresholdTrigger { type Vtable = ISensorDataThresholdTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5bc0f372_d48b_4b7f_abec_15f9bacc12e2); } #[repr(C)] #[doc(hidden)] pub struct ISensorDataThresholdTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISensorDataThresholdTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISensorDataThresholdTriggerFactory { type Vtable = ISensorDataThresholdTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x921fe675_7df0_4da3_97b3_e544ee857fe6); } #[repr(C)] #[doc(hidden)] pub struct ISensorDataThresholdTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Devices_Sensors")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, threshold: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Sensors"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISmartCardTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISmartCardTrigger { type Vtable = ISmartCardTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf53bc5ac_84ca_4972_8ce9_e58f97b37a50); } #[repr(C)] #[doc(hidden)] pub struct ISmartCardTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Devices_SmartCards")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Devices::SmartCards::SmartCardTriggerType) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_SmartCards"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISmartCardTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISmartCardTriggerFactory { type Vtable = ISmartCardTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x63bf54c3_89c1_4e00_a9d3_97c629269dad); } #[repr(C)] #[doc(hidden)] pub struct ISmartCardTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Devices_SmartCards")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, triggertype: super::super::Devices::SmartCards::SmartCardTriggerType, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_SmartCards"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISmsMessageReceivedTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISmsMessageReceivedTriggerFactory { type Vtable = ISmsMessageReceivedTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xea3ad8c8_6ba4_4ab2_8d21_bc6b09c77564); } #[repr(C)] #[doc(hidden)] pub struct ISmsMessageReceivedTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Devices_Sms")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, filterrules: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Devices_Sms"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISocketActivityTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISocketActivityTrigger { type Vtable = ISocketActivityTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa9bbf810_9dde_4f8a_83e3_b0e0e7a50d70); } #[repr(C)] #[doc(hidden)] pub struct ISocketActivityTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IStorageLibraryChangeTrackerTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IStorageLibraryChangeTrackerTriggerFactory { type Vtable = IStorageLibraryChangeTrackerTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1eb0ffd0_5a85_499e_a888_824607124f50); } #[repr(C)] #[doc(hidden)] pub struct IStorageLibraryChangeTrackerTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Storage")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, tracker: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IStorageLibraryContentChangedTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IStorageLibraryContentChangedTrigger { type Vtable = IStorageLibraryContentChangedTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1637e0a7_829c_45bc_929b_a1e7ea78d89b); } #[repr(C)] #[doc(hidden)] pub struct IStorageLibraryContentChangedTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IStorageLibraryContentChangedTriggerStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IStorageLibraryContentChangedTriggerStatics { type Vtable = IStorageLibraryContentChangedTriggerStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7f9f1b39_5f90_4e12_914e_a7d8e0bbfb18); } #[repr(C)] #[doc(hidden)] pub struct IStorageLibraryContentChangedTriggerStatics_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Storage")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, storagelibrary: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage"))] usize, #[cfg(all(feature = "Foundation_Collections", feature = "Storage"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, storagelibraries: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation_Collections", feature = "Storage")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISystemCondition(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISystemCondition { type Vtable = ISystemCondition_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc15fb476_89c5_420b_abd3_fb3030472128); } #[repr(C)] #[doc(hidden)] pub struct ISystemCondition_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut SystemConditionType) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISystemConditionFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISystemConditionFactory { type Vtable = ISystemConditionFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd269d1f1_05a7_49ae_87d7_16b2b8b9a553); } #[repr(C)] #[doc(hidden)] pub struct ISystemConditionFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, conditiontype: SystemConditionType, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISystemTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISystemTrigger { type Vtable = ISystemTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1d80c776_3748_4463_8d7e_276dc139ac1c); } #[repr(C)] #[doc(hidden)] pub struct ISystemTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut SystemTriggerType) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISystemTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISystemTriggerFactory { type Vtable = ISystemTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe80423d4_8791_4579_8126_87ec8aaa407a); } #[repr(C)] #[doc(hidden)] pub struct ISystemTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, triggertype: SystemTriggerType, oneshot: bool, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimeTrigger(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimeTrigger { type Vtable = ITimeTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x656e5556_0b2a_4377_ba70_3b45a935547f); } #[repr(C)] #[doc(hidden)] pub struct ITimeTrigger_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimeTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimeTriggerFactory { type Vtable = ITimeTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x38c682fe_9b54_45e6_b2f3_269b87a6f734); } #[repr(C)] #[doc(hidden)] pub struct ITimeTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, freshnesstime: u32, oneshot: bool, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IToastNotificationActionTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IToastNotificationActionTriggerFactory { type Vtable = IToastNotificationActionTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb09dfc27_6480_4349_8125_97b3efaa0a3a); } #[repr(C)] #[doc(hidden)] pub struct IToastNotificationActionTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, applicationid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IToastNotificationHistoryChangedTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IToastNotificationHistoryChangedTriggerFactory { type Vtable = IToastNotificationHistoryChangedTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x81c6faad_8797_4785_81b4_b0cccb73d1d9); } #[repr(C)] #[doc(hidden)] pub struct IToastNotificationHistoryChangedTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, applicationid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IUserNotificationChangedTriggerFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IUserNotificationChangedTriggerFactory { type Vtable = IUserNotificationChangedTriggerFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcad4436c_69ab_4e18_a48a_5ed2ac435957); } #[repr(C)] #[doc(hidden)] pub struct IUserNotificationChangedTriggerFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "UI_Notifications")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, notificationkinds: super::super::UI::Notifications::NotificationKinds, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI_Notifications"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct LocationTrigger(pub ::windows::core::IInspectable); impl LocationTrigger { pub fn TriggerType(&self) -> ::windows::core::Result<LocationTriggerType> { let this = self; unsafe { let mut result__: LocationTriggerType = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<LocationTriggerType>(result__) } } pub fn Create(triggertype: LocationTriggerType) -> ::windows::core::Result<LocationTrigger> { Self::ILocationTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), triggertype, &mut result__).from_abi::<LocationTrigger>(result__) }) } pub fn ILocationTriggerFactory<R, F: FnOnce(&ILocationTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<LocationTrigger, ILocationTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for LocationTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.LocationTrigger;{47666a1c-6877-481e-8026-ff7e14a811a0})"); } unsafe impl ::windows::core::Interface for LocationTrigger { type Vtable = ILocationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x47666a1c_6877_481e_8026_ff7e14a811a0); } impl ::windows::core::RuntimeName for LocationTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.LocationTrigger"; } impl ::core::convert::From<LocationTrigger> for ::windows::core::IUnknown { fn from(value: LocationTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&LocationTrigger> for ::windows::core::IUnknown { fn from(value: &LocationTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for LocationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a LocationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<LocationTrigger> for ::windows::core::IInspectable { fn from(value: LocationTrigger) -> Self { value.0 } } impl ::core::convert::From<&LocationTrigger> for ::windows::core::IInspectable { fn from(value: &LocationTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for LocationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a LocationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<LocationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: LocationTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&LocationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &LocationTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for LocationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &LocationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for LocationTrigger {} unsafe impl ::core::marker::Sync for LocationTrigger {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct LocationTriggerType(pub i32); impl LocationTriggerType { pub const Geofence: LocationTriggerType = LocationTriggerType(0i32); } impl ::core::convert::From<i32> for LocationTriggerType { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for LocationTriggerType { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for LocationTriggerType { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.LocationTriggerType;i4)"); } impl ::windows::core::DefaultType for LocationTriggerType { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MaintenanceTrigger(pub ::windows::core::IInspectable); impl MaintenanceTrigger { pub fn FreshnessTime(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn OneShot(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn Create(freshnesstime: u32, oneshot: bool) -> ::windows::core::Result<MaintenanceTrigger> { Self::IMaintenanceTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), freshnesstime, oneshot, &mut result__).from_abi::<MaintenanceTrigger>(result__) }) } pub fn IMaintenanceTriggerFactory<R, F: FnOnce(&IMaintenanceTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MaintenanceTrigger, IMaintenanceTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for MaintenanceTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.MaintenanceTrigger;{68184c83-fc22-4ce5-841a-7239a9810047})"); } unsafe impl ::windows::core::Interface for MaintenanceTrigger { type Vtable = IMaintenanceTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x68184c83_fc22_4ce5_841a_7239a9810047); } impl ::windows::core::RuntimeName for MaintenanceTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.MaintenanceTrigger"; } impl ::core::convert::From<MaintenanceTrigger> for ::windows::core::IUnknown { fn from(value: MaintenanceTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&MaintenanceTrigger> for ::windows::core::IUnknown { fn from(value: &MaintenanceTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MaintenanceTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a MaintenanceTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MaintenanceTrigger> for ::windows::core::IInspectable { fn from(value: MaintenanceTrigger) -> Self { value.0 } } impl ::core::convert::From<&MaintenanceTrigger> for ::windows::core::IInspectable { fn from(value: &MaintenanceTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MaintenanceTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a MaintenanceTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<MaintenanceTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: MaintenanceTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&MaintenanceTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &MaintenanceTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for MaintenanceTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &MaintenanceTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaProcessingTrigger(pub ::windows::core::IInspectable); impl MediaProcessingTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MediaProcessingTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Foundation")] pub fn RequestAsync(&self) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<MediaProcessingTriggerResult>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<MediaProcessingTriggerResult>>(result__) } } #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub fn RequestAsyncWithArguments<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Collections::ValueSet>>(&self, arguments: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<MediaProcessingTriggerResult>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), arguments.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<MediaProcessingTriggerResult>>(result__) } } } unsafe impl ::windows::core::RuntimeType for MediaProcessingTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.MediaProcessingTrigger;{9a95be65-8a52-4b30-9011-cf38040ea8b0})"); } unsafe impl ::windows::core::Interface for MediaProcessingTrigger { type Vtable = IMediaProcessingTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9a95be65_8a52_4b30_9011_cf38040ea8b0); } impl ::windows::core::RuntimeName for MediaProcessingTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.MediaProcessingTrigger"; } impl ::core::convert::From<MediaProcessingTrigger> for ::windows::core::IUnknown { fn from(value: MediaProcessingTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaProcessingTrigger> for ::windows::core::IUnknown { fn from(value: &MediaProcessingTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaProcessingTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a MediaProcessingTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaProcessingTrigger> for ::windows::core::IInspectable { fn from(value: MediaProcessingTrigger) -> Self { value.0 } } impl ::core::convert::From<&MediaProcessingTrigger> for ::windows::core::IInspectable { fn from(value: &MediaProcessingTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaProcessingTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a MediaProcessingTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<MediaProcessingTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: MediaProcessingTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&MediaProcessingTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &MediaProcessingTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for MediaProcessingTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &MediaProcessingTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct MediaProcessingTriggerResult(pub i32); impl MediaProcessingTriggerResult { pub const Allowed: MediaProcessingTriggerResult = MediaProcessingTriggerResult(0i32); pub const CurrentlyRunning: MediaProcessingTriggerResult = MediaProcessingTriggerResult(1i32); pub const DisabledByPolicy: MediaProcessingTriggerResult = MediaProcessingTriggerResult(2i32); pub const UnknownError: MediaProcessingTriggerResult = MediaProcessingTriggerResult(3i32); } impl ::core::convert::From<i32> for MediaProcessingTriggerResult { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for MediaProcessingTriggerResult { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for MediaProcessingTriggerResult { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.MediaProcessingTriggerResult;i4)"); } impl ::windows::core::DefaultType for MediaProcessingTriggerResult { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MobileBroadbandDeviceServiceNotificationTrigger(pub ::windows::core::IInspectable); impl MobileBroadbandDeviceServiceNotificationTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MobileBroadbandDeviceServiceNotificationTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for MobileBroadbandDeviceServiceNotificationTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.MobileBroadbandDeviceServiceNotificationTrigger;{84b3a058-6027-4b87-9790-bdf3f757dbd7})"); } unsafe impl ::windows::core::Interface for MobileBroadbandDeviceServiceNotificationTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl ::windows::core::RuntimeName for MobileBroadbandDeviceServiceNotificationTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.MobileBroadbandDeviceServiceNotificationTrigger"; } impl ::core::convert::From<MobileBroadbandDeviceServiceNotificationTrigger> for ::windows::core::IUnknown { fn from(value: MobileBroadbandDeviceServiceNotificationTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&MobileBroadbandDeviceServiceNotificationTrigger> for ::windows::core::IUnknown { fn from(value: &MobileBroadbandDeviceServiceNotificationTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MobileBroadbandDeviceServiceNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a MobileBroadbandDeviceServiceNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MobileBroadbandDeviceServiceNotificationTrigger> for ::windows::core::IInspectable { fn from(value: MobileBroadbandDeviceServiceNotificationTrigger) -> Self { value.0 } } impl ::core::convert::From<&MobileBroadbandDeviceServiceNotificationTrigger> for ::windows::core::IInspectable { fn from(value: &MobileBroadbandDeviceServiceNotificationTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MobileBroadbandDeviceServiceNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a MobileBroadbandDeviceServiceNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<MobileBroadbandDeviceServiceNotificationTrigger> for IBackgroundTrigger { fn from(value: MobileBroadbandDeviceServiceNotificationTrigger) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&MobileBroadbandDeviceServiceNotificationTrigger> for IBackgroundTrigger { fn from(value: &MobileBroadbandDeviceServiceNotificationTrigger) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for MobileBroadbandDeviceServiceNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &MobileBroadbandDeviceServiceNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for MobileBroadbandDeviceServiceNotificationTrigger {} unsafe impl ::core::marker::Sync for MobileBroadbandDeviceServiceNotificationTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MobileBroadbandPcoDataChangeTrigger(pub ::windows::core::IInspectable); impl MobileBroadbandPcoDataChangeTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MobileBroadbandPcoDataChangeTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for MobileBroadbandPcoDataChangeTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.MobileBroadbandPcoDataChangeTrigger;{84b3a058-6027-4b87-9790-bdf3f757dbd7})"); } unsafe impl ::windows::core::Interface for MobileBroadbandPcoDataChangeTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl ::windows::core::RuntimeName for MobileBroadbandPcoDataChangeTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.MobileBroadbandPcoDataChangeTrigger"; } impl ::core::convert::From<MobileBroadbandPcoDataChangeTrigger> for ::windows::core::IUnknown { fn from(value: MobileBroadbandPcoDataChangeTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&MobileBroadbandPcoDataChangeTrigger> for ::windows::core::IUnknown { fn from(value: &MobileBroadbandPcoDataChangeTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MobileBroadbandPcoDataChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a MobileBroadbandPcoDataChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MobileBroadbandPcoDataChangeTrigger> for ::windows::core::IInspectable { fn from(value: MobileBroadbandPcoDataChangeTrigger) -> Self { value.0 } } impl ::core::convert::From<&MobileBroadbandPcoDataChangeTrigger> for ::windows::core::IInspectable { fn from(value: &MobileBroadbandPcoDataChangeTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MobileBroadbandPcoDataChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a MobileBroadbandPcoDataChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<MobileBroadbandPcoDataChangeTrigger> for IBackgroundTrigger { fn from(value: MobileBroadbandPcoDataChangeTrigger) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&MobileBroadbandPcoDataChangeTrigger> for IBackgroundTrigger { fn from(value: &MobileBroadbandPcoDataChangeTrigger) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for MobileBroadbandPcoDataChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &MobileBroadbandPcoDataChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for MobileBroadbandPcoDataChangeTrigger {} unsafe impl ::core::marker::Sync for MobileBroadbandPcoDataChangeTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MobileBroadbandPinLockStateChangeTrigger(pub ::windows::core::IInspectable); impl MobileBroadbandPinLockStateChangeTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MobileBroadbandPinLockStateChangeTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for MobileBroadbandPinLockStateChangeTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.MobileBroadbandPinLockStateChangeTrigger;{84b3a058-6027-4b87-9790-bdf3f757dbd7})"); } unsafe impl ::windows::core::Interface for MobileBroadbandPinLockStateChangeTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl ::windows::core::RuntimeName for MobileBroadbandPinLockStateChangeTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.MobileBroadbandPinLockStateChangeTrigger"; } impl ::core::convert::From<MobileBroadbandPinLockStateChangeTrigger> for ::windows::core::IUnknown { fn from(value: MobileBroadbandPinLockStateChangeTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&MobileBroadbandPinLockStateChangeTrigger> for ::windows::core::IUnknown { fn from(value: &MobileBroadbandPinLockStateChangeTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MobileBroadbandPinLockStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a MobileBroadbandPinLockStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MobileBroadbandPinLockStateChangeTrigger> for ::windows::core::IInspectable { fn from(value: MobileBroadbandPinLockStateChangeTrigger) -> Self { value.0 } } impl ::core::convert::From<&MobileBroadbandPinLockStateChangeTrigger> for ::windows::core::IInspectable { fn from(value: &MobileBroadbandPinLockStateChangeTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MobileBroadbandPinLockStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a MobileBroadbandPinLockStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<MobileBroadbandPinLockStateChangeTrigger> for IBackgroundTrigger { fn from(value: MobileBroadbandPinLockStateChangeTrigger) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&MobileBroadbandPinLockStateChangeTrigger> for IBackgroundTrigger { fn from(value: &MobileBroadbandPinLockStateChangeTrigger) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for MobileBroadbandPinLockStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &MobileBroadbandPinLockStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for MobileBroadbandPinLockStateChangeTrigger {} unsafe impl ::core::marker::Sync for MobileBroadbandPinLockStateChangeTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MobileBroadbandRadioStateChangeTrigger(pub ::windows::core::IInspectable); impl MobileBroadbandRadioStateChangeTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MobileBroadbandRadioStateChangeTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for MobileBroadbandRadioStateChangeTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.MobileBroadbandRadioStateChangeTrigger;{84b3a058-6027-4b87-9790-bdf3f757dbd7})"); } unsafe impl ::windows::core::Interface for MobileBroadbandRadioStateChangeTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl ::windows::core::RuntimeName for MobileBroadbandRadioStateChangeTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.MobileBroadbandRadioStateChangeTrigger"; } impl ::core::convert::From<MobileBroadbandRadioStateChangeTrigger> for ::windows::core::IUnknown { fn from(value: MobileBroadbandRadioStateChangeTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&MobileBroadbandRadioStateChangeTrigger> for ::windows::core::IUnknown { fn from(value: &MobileBroadbandRadioStateChangeTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MobileBroadbandRadioStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a MobileBroadbandRadioStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MobileBroadbandRadioStateChangeTrigger> for ::windows::core::IInspectable { fn from(value: MobileBroadbandRadioStateChangeTrigger) -> Self { value.0 } } impl ::core::convert::From<&MobileBroadbandRadioStateChangeTrigger> for ::windows::core::IInspectable { fn from(value: &MobileBroadbandRadioStateChangeTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MobileBroadbandRadioStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a MobileBroadbandRadioStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<MobileBroadbandRadioStateChangeTrigger> for IBackgroundTrigger { fn from(value: MobileBroadbandRadioStateChangeTrigger) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&MobileBroadbandRadioStateChangeTrigger> for IBackgroundTrigger { fn from(value: &MobileBroadbandRadioStateChangeTrigger) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for MobileBroadbandRadioStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &MobileBroadbandRadioStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for MobileBroadbandRadioStateChangeTrigger {} unsafe impl ::core::marker::Sync for MobileBroadbandRadioStateChangeTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MobileBroadbandRegistrationStateChangeTrigger(pub ::windows::core::IInspectable); impl MobileBroadbandRegistrationStateChangeTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MobileBroadbandRegistrationStateChangeTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for MobileBroadbandRegistrationStateChangeTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.MobileBroadbandRegistrationStateChangeTrigger;{84b3a058-6027-4b87-9790-bdf3f757dbd7})"); } unsafe impl ::windows::core::Interface for MobileBroadbandRegistrationStateChangeTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl ::windows::core::RuntimeName for MobileBroadbandRegistrationStateChangeTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.MobileBroadbandRegistrationStateChangeTrigger"; } impl ::core::convert::From<MobileBroadbandRegistrationStateChangeTrigger> for ::windows::core::IUnknown { fn from(value: MobileBroadbandRegistrationStateChangeTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&MobileBroadbandRegistrationStateChangeTrigger> for ::windows::core::IUnknown { fn from(value: &MobileBroadbandRegistrationStateChangeTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MobileBroadbandRegistrationStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a MobileBroadbandRegistrationStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MobileBroadbandRegistrationStateChangeTrigger> for ::windows::core::IInspectable { fn from(value: MobileBroadbandRegistrationStateChangeTrigger) -> Self { value.0 } } impl ::core::convert::From<&MobileBroadbandRegistrationStateChangeTrigger> for ::windows::core::IInspectable { fn from(value: &MobileBroadbandRegistrationStateChangeTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MobileBroadbandRegistrationStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a MobileBroadbandRegistrationStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<MobileBroadbandRegistrationStateChangeTrigger> for IBackgroundTrigger { fn from(value: MobileBroadbandRegistrationStateChangeTrigger) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&MobileBroadbandRegistrationStateChangeTrigger> for IBackgroundTrigger { fn from(value: &MobileBroadbandRegistrationStateChangeTrigger) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for MobileBroadbandRegistrationStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &MobileBroadbandRegistrationStateChangeTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for MobileBroadbandRegistrationStateChangeTrigger {} unsafe impl ::core::marker::Sync for MobileBroadbandRegistrationStateChangeTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct NetworkOperatorDataUsageTrigger(pub ::windows::core::IInspectable); impl NetworkOperatorDataUsageTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<NetworkOperatorDataUsageTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for NetworkOperatorDataUsageTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.NetworkOperatorDataUsageTrigger;{84b3a058-6027-4b87-9790-bdf3f757dbd7})"); } unsafe impl ::windows::core::Interface for NetworkOperatorDataUsageTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl ::windows::core::RuntimeName for NetworkOperatorDataUsageTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.NetworkOperatorDataUsageTrigger"; } impl ::core::convert::From<NetworkOperatorDataUsageTrigger> for ::windows::core::IUnknown { fn from(value: NetworkOperatorDataUsageTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&NetworkOperatorDataUsageTrigger> for ::windows::core::IUnknown { fn from(value: &NetworkOperatorDataUsageTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for NetworkOperatorDataUsageTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a NetworkOperatorDataUsageTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<NetworkOperatorDataUsageTrigger> for ::windows::core::IInspectable { fn from(value: NetworkOperatorDataUsageTrigger) -> Self { value.0 } } impl ::core::convert::From<&NetworkOperatorDataUsageTrigger> for ::windows::core::IInspectable { fn from(value: &NetworkOperatorDataUsageTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for NetworkOperatorDataUsageTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a NetworkOperatorDataUsageTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<NetworkOperatorDataUsageTrigger> for IBackgroundTrigger { fn from(value: NetworkOperatorDataUsageTrigger) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&NetworkOperatorDataUsageTrigger> for IBackgroundTrigger { fn from(value: &NetworkOperatorDataUsageTrigger) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for NetworkOperatorDataUsageTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &NetworkOperatorDataUsageTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for NetworkOperatorDataUsageTrigger {} unsafe impl ::core::marker::Sync for NetworkOperatorDataUsageTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct NetworkOperatorHotspotAuthenticationTrigger(pub ::windows::core::IInspectable); impl NetworkOperatorHotspotAuthenticationTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<NetworkOperatorHotspotAuthenticationTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for NetworkOperatorHotspotAuthenticationTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.NetworkOperatorHotspotAuthenticationTrigger;{e756c791-3001-4de5-83c7-de61d88831d0})"); } unsafe impl ::windows::core::Interface for NetworkOperatorHotspotAuthenticationTrigger { type Vtable = INetworkOperatorHotspotAuthenticationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe756c791_3001_4de5_83c7_de61d88831d0); } impl ::windows::core::RuntimeName for NetworkOperatorHotspotAuthenticationTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.NetworkOperatorHotspotAuthenticationTrigger"; } impl ::core::convert::From<NetworkOperatorHotspotAuthenticationTrigger> for ::windows::core::IUnknown { fn from(value: NetworkOperatorHotspotAuthenticationTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&NetworkOperatorHotspotAuthenticationTrigger> for ::windows::core::IUnknown { fn from(value: &NetworkOperatorHotspotAuthenticationTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for NetworkOperatorHotspotAuthenticationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a NetworkOperatorHotspotAuthenticationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<NetworkOperatorHotspotAuthenticationTrigger> for ::windows::core::IInspectable { fn from(value: NetworkOperatorHotspotAuthenticationTrigger) -> Self { value.0 } } impl ::core::convert::From<&NetworkOperatorHotspotAuthenticationTrigger> for ::windows::core::IInspectable { fn from(value: &NetworkOperatorHotspotAuthenticationTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for NetworkOperatorHotspotAuthenticationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a NetworkOperatorHotspotAuthenticationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<NetworkOperatorHotspotAuthenticationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: NetworkOperatorHotspotAuthenticationTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&NetworkOperatorHotspotAuthenticationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &NetworkOperatorHotspotAuthenticationTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for NetworkOperatorHotspotAuthenticationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &NetworkOperatorHotspotAuthenticationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct NetworkOperatorNotificationTrigger(pub ::windows::core::IInspectable); impl NetworkOperatorNotificationTrigger { pub fn NetworkAccountId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(networkaccountid: Param0) -> ::windows::core::Result<NetworkOperatorNotificationTrigger> { Self::INetworkOperatorNotificationTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), networkaccountid.into_param().abi(), &mut result__).from_abi::<NetworkOperatorNotificationTrigger>(result__) }) } pub fn INetworkOperatorNotificationTriggerFactory<R, F: FnOnce(&INetworkOperatorNotificationTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<NetworkOperatorNotificationTrigger, INetworkOperatorNotificationTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for NetworkOperatorNotificationTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.NetworkOperatorNotificationTrigger;{90089cc6-63cd-480c-95d1-6e6aef801e4a})"); } unsafe impl ::windows::core::Interface for NetworkOperatorNotificationTrigger { type Vtable = INetworkOperatorNotificationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x90089cc6_63cd_480c_95d1_6e6aef801e4a); } impl ::windows::core::RuntimeName for NetworkOperatorNotificationTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.NetworkOperatorNotificationTrigger"; } impl ::core::convert::From<NetworkOperatorNotificationTrigger> for ::windows::core::IUnknown { fn from(value: NetworkOperatorNotificationTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&NetworkOperatorNotificationTrigger> for ::windows::core::IUnknown { fn from(value: &NetworkOperatorNotificationTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for NetworkOperatorNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a NetworkOperatorNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<NetworkOperatorNotificationTrigger> for ::windows::core::IInspectable { fn from(value: NetworkOperatorNotificationTrigger) -> Self { value.0 } } impl ::core::convert::From<&NetworkOperatorNotificationTrigger> for ::windows::core::IInspectable { fn from(value: &NetworkOperatorNotificationTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for NetworkOperatorNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a NetworkOperatorNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<NetworkOperatorNotificationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: NetworkOperatorNotificationTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&NetworkOperatorNotificationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &NetworkOperatorNotificationTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for NetworkOperatorNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &NetworkOperatorNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct PaymentAppCanMakePaymentTrigger(pub ::windows::core::IInspectable); impl PaymentAppCanMakePaymentTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<PaymentAppCanMakePaymentTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for PaymentAppCanMakePaymentTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.PaymentAppCanMakePaymentTrigger;{84b3a058-6027-4b87-9790-bdf3f757dbd7})"); } unsafe impl ::windows::core::Interface for PaymentAppCanMakePaymentTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl ::windows::core::RuntimeName for PaymentAppCanMakePaymentTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.PaymentAppCanMakePaymentTrigger"; } impl ::core::convert::From<PaymentAppCanMakePaymentTrigger> for ::windows::core::IUnknown { fn from(value: PaymentAppCanMakePaymentTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&PaymentAppCanMakePaymentTrigger> for ::windows::core::IUnknown { fn from(value: &PaymentAppCanMakePaymentTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for PaymentAppCanMakePaymentTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a PaymentAppCanMakePaymentTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<PaymentAppCanMakePaymentTrigger> for ::windows::core::IInspectable { fn from(value: PaymentAppCanMakePaymentTrigger) -> Self { value.0 } } impl ::core::convert::From<&PaymentAppCanMakePaymentTrigger> for ::windows::core::IInspectable { fn from(value: &PaymentAppCanMakePaymentTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for PaymentAppCanMakePaymentTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a PaymentAppCanMakePaymentTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<PaymentAppCanMakePaymentTrigger> for IBackgroundTrigger { fn from(value: PaymentAppCanMakePaymentTrigger) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&PaymentAppCanMakePaymentTrigger> for IBackgroundTrigger { fn from(value: &PaymentAppCanMakePaymentTrigger) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for PaymentAppCanMakePaymentTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &PaymentAppCanMakePaymentTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for PaymentAppCanMakePaymentTrigger {} unsafe impl ::core::marker::Sync for PaymentAppCanMakePaymentTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct PhoneTrigger(pub ::windows::core::IInspectable); impl PhoneTrigger { pub fn OneShot(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } #[cfg(feature = "ApplicationModel_Calls_Background")] pub fn TriggerType(&self) -> ::windows::core::Result<super::Calls::Background::PhoneTriggerType> { let this = self; unsafe { let mut result__: super::Calls::Background::PhoneTriggerType = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::Calls::Background::PhoneTriggerType>(result__) } } #[cfg(feature = "ApplicationModel_Calls_Background")] pub fn Create(r#type: super::Calls::Background::PhoneTriggerType, oneshot: bool) -> ::windows::core::Result<PhoneTrigger> { Self::IPhoneTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), r#type, oneshot, &mut result__).from_abi::<PhoneTrigger>(result__) }) } pub fn IPhoneTriggerFactory<R, F: FnOnce(&IPhoneTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<PhoneTrigger, IPhoneTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for PhoneTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.PhoneTrigger;{8dcfe99b-d4c5-49f1-b7d3-82e87a0e9dde})"); } unsafe impl ::windows::core::Interface for PhoneTrigger { type Vtable = IPhoneTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8dcfe99b_d4c5_49f1_b7d3_82e87a0e9dde); } impl ::windows::core::RuntimeName for PhoneTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.PhoneTrigger"; } impl ::core::convert::From<PhoneTrigger> for ::windows::core::IUnknown { fn from(value: PhoneTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&PhoneTrigger> for ::windows::core::IUnknown { fn from(value: &PhoneTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for PhoneTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a PhoneTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<PhoneTrigger> for ::windows::core::IInspectable { fn from(value: PhoneTrigger) -> Self { value.0 } } impl ::core::convert::From<&PhoneTrigger> for ::windows::core::IInspectable { fn from(value: &PhoneTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for PhoneTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a PhoneTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<PhoneTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: PhoneTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&PhoneTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &PhoneTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for PhoneTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &PhoneTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for PhoneTrigger {} unsafe impl ::core::marker::Sync for PhoneTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct PushNotificationTrigger(pub ::windows::core::IInspectable); impl PushNotificationTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<PushNotificationTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(applicationid: Param0) -> ::windows::core::Result<PushNotificationTrigger> { Self::IPushNotificationTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), applicationid.into_param().abi(), &mut result__).from_abi::<PushNotificationTrigger>(result__) }) } pub fn IPushNotificationTriggerFactory<R, F: FnOnce(&IPushNotificationTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<PushNotificationTrigger, IPushNotificationTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for PushNotificationTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.PushNotificationTrigger;{84b3a058-6027-4b87-9790-bdf3f757dbd7})"); } unsafe impl ::windows::core::Interface for PushNotificationTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl ::windows::core::RuntimeName for PushNotificationTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.PushNotificationTrigger"; } impl ::core::convert::From<PushNotificationTrigger> for ::windows::core::IUnknown { fn from(value: PushNotificationTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&PushNotificationTrigger> for ::windows::core::IUnknown { fn from(value: &PushNotificationTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for PushNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a PushNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<PushNotificationTrigger> for ::windows::core::IInspectable { fn from(value: PushNotificationTrigger) -> Self { value.0 } } impl ::core::convert::From<&PushNotificationTrigger> for ::windows::core::IInspectable { fn from(value: &PushNotificationTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for PushNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a PushNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<PushNotificationTrigger> for IBackgroundTrigger { fn from(value: PushNotificationTrigger) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&PushNotificationTrigger> for IBackgroundTrigger { fn from(value: &PushNotificationTrigger) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for PushNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &PushNotificationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for PushNotificationTrigger {} unsafe impl ::core::marker::Sync for PushNotificationTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct RcsEndUserMessageAvailableTrigger(pub ::windows::core::IInspectable); impl RcsEndUserMessageAvailableTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<RcsEndUserMessageAvailableTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for RcsEndUserMessageAvailableTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.RcsEndUserMessageAvailableTrigger;{986d0d6a-b2f6-467f-a978-a44091c11a66})"); } unsafe impl ::windows::core::Interface for RcsEndUserMessageAvailableTrigger { type Vtable = IRcsEndUserMessageAvailableTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x986d0d6a_b2f6_467f_a978_a44091c11a66); } impl ::windows::core::RuntimeName for RcsEndUserMessageAvailableTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.RcsEndUserMessageAvailableTrigger"; } impl ::core::convert::From<RcsEndUserMessageAvailableTrigger> for ::windows::core::IUnknown { fn from(value: RcsEndUserMessageAvailableTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&RcsEndUserMessageAvailableTrigger> for ::windows::core::IUnknown { fn from(value: &RcsEndUserMessageAvailableTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for RcsEndUserMessageAvailableTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a RcsEndUserMessageAvailableTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<RcsEndUserMessageAvailableTrigger> for ::windows::core::IInspectable { fn from(value: RcsEndUserMessageAvailableTrigger) -> Self { value.0 } } impl ::core::convert::From<&RcsEndUserMessageAvailableTrigger> for ::windows::core::IInspectable { fn from(value: &RcsEndUserMessageAvailableTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for RcsEndUserMessageAvailableTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a RcsEndUserMessageAvailableTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<RcsEndUserMessageAvailableTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: RcsEndUserMessageAvailableTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&RcsEndUserMessageAvailableTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &RcsEndUserMessageAvailableTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for RcsEndUserMessageAvailableTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &RcsEndUserMessageAvailableTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for RcsEndUserMessageAvailableTrigger {} unsafe impl ::core::marker::Sync for RcsEndUserMessageAvailableTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct RfcommConnectionTrigger(pub ::windows::core::IInspectable); impl RfcommConnectionTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<RfcommConnectionTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Devices_Bluetooth_Background")] pub fn InboundConnection(&self) -> ::windows::core::Result<super::super::Devices::Bluetooth::Background::RfcommInboundConnectionInformation> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Devices::Bluetooth::Background::RfcommInboundConnectionInformation>(result__) } } #[cfg(feature = "Devices_Bluetooth_Background")] pub fn OutboundConnection(&self) -> ::windows::core::Result<super::super::Devices::Bluetooth::Background::RfcommOutboundConnectionInformation> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Devices::Bluetooth::Background::RfcommOutboundConnectionInformation>(result__) } } pub fn AllowMultipleConnections(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetAllowMultipleConnections(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value).ok() } } #[cfg(feature = "Networking_Sockets")] pub fn ProtectionLevel(&self) -> ::windows::core::Result<super::super::Networking::Sockets::SocketProtectionLevel> { let this = self; unsafe { let mut result__: super::super::Networking::Sockets::SocketProtectionLevel = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Networking::Sockets::SocketProtectionLevel>(result__) } } #[cfg(feature = "Networking_Sockets")] pub fn SetProtectionLevel(&self, value: super::super::Networking::Sockets::SocketProtectionLevel) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value).ok() } } #[cfg(feature = "Networking")] pub fn RemoteHostName(&self) -> ::windows::core::Result<super::super::Networking::HostName> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Networking::HostName>(result__) } } #[cfg(feature = "Networking")] pub fn SetRemoteHostName<'a, Param0: ::windows::core::IntoParam<'a, super::super::Networking::HostName>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for RfcommConnectionTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.RfcommConnectionTrigger;{e8c4cae2-0b53-4464-9394-fd875654de64})"); } unsafe impl ::windows::core::Interface for RfcommConnectionTrigger { type Vtable = IRfcommConnectionTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe8c4cae2_0b53_4464_9394_fd875654de64); } impl ::windows::core::RuntimeName for RfcommConnectionTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.RfcommConnectionTrigger"; } impl ::core::convert::From<RfcommConnectionTrigger> for ::windows::core::IUnknown { fn from(value: RfcommConnectionTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&RfcommConnectionTrigger> for ::windows::core::IUnknown { fn from(value: &RfcommConnectionTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for RfcommConnectionTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a RfcommConnectionTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<RfcommConnectionTrigger> for ::windows::core::IInspectable { fn from(value: RfcommConnectionTrigger) -> Self { value.0 } } impl ::core::convert::From<&RfcommConnectionTrigger> for ::windows::core::IInspectable { fn from(value: &RfcommConnectionTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for RfcommConnectionTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a RfcommConnectionTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<RfcommConnectionTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: RfcommConnectionTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&RfcommConnectionTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &RfcommConnectionTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for RfcommConnectionTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &RfcommConnectionTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for RfcommConnectionTrigger {} unsafe impl ::core::marker::Sync for RfcommConnectionTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SecondaryAuthenticationFactorAuthenticationTrigger(pub ::windows::core::IInspectable); impl SecondaryAuthenticationFactorAuthenticationTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SecondaryAuthenticationFactorAuthenticationTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SecondaryAuthenticationFactorAuthenticationTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.SecondaryAuthenticationFactorAuthenticationTrigger;{f237f327-5181-4f24-96a7-700a4e5fac62})"); } unsafe impl ::windows::core::Interface for SecondaryAuthenticationFactorAuthenticationTrigger { type Vtable = ISecondaryAuthenticationFactorAuthenticationTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf237f327_5181_4f24_96a7_700a4e5fac62); } impl ::windows::core::RuntimeName for SecondaryAuthenticationFactorAuthenticationTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.SecondaryAuthenticationFactorAuthenticationTrigger"; } impl ::core::convert::From<SecondaryAuthenticationFactorAuthenticationTrigger> for ::windows::core::IUnknown { fn from(value: SecondaryAuthenticationFactorAuthenticationTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&SecondaryAuthenticationFactorAuthenticationTrigger> for ::windows::core::IUnknown { fn from(value: &SecondaryAuthenticationFactorAuthenticationTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SecondaryAuthenticationFactorAuthenticationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SecondaryAuthenticationFactorAuthenticationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SecondaryAuthenticationFactorAuthenticationTrigger> for ::windows::core::IInspectable { fn from(value: SecondaryAuthenticationFactorAuthenticationTrigger) -> Self { value.0 } } impl ::core::convert::From<&SecondaryAuthenticationFactorAuthenticationTrigger> for ::windows::core::IInspectable { fn from(value: &SecondaryAuthenticationFactorAuthenticationTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SecondaryAuthenticationFactorAuthenticationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SecondaryAuthenticationFactorAuthenticationTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<SecondaryAuthenticationFactorAuthenticationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: SecondaryAuthenticationFactorAuthenticationTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SecondaryAuthenticationFactorAuthenticationTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &SecondaryAuthenticationFactorAuthenticationTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for SecondaryAuthenticationFactorAuthenticationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &SecondaryAuthenticationFactorAuthenticationTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SensorDataThresholdTrigger(pub ::windows::core::IInspectable); impl SensorDataThresholdTrigger { #[cfg(feature = "Devices_Sensors")] pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, super::super::Devices::Sensors::ISensorDataThreshold>>(threshold: Param0) -> ::windows::core::Result<SensorDataThresholdTrigger> { Self::ISensorDataThresholdTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), threshold.into_param().abi(), &mut result__).from_abi::<SensorDataThresholdTrigger>(result__) }) } pub fn ISensorDataThresholdTriggerFactory<R, F: FnOnce(&ISensorDataThresholdTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SensorDataThresholdTrigger, ISensorDataThresholdTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SensorDataThresholdTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.SensorDataThresholdTrigger;{5bc0f372-d48b-4b7f-abec-15f9bacc12e2})"); } unsafe impl ::windows::core::Interface for SensorDataThresholdTrigger { type Vtable = ISensorDataThresholdTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5bc0f372_d48b_4b7f_abec_15f9bacc12e2); } impl ::windows::core::RuntimeName for SensorDataThresholdTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.SensorDataThresholdTrigger"; } impl ::core::convert::From<SensorDataThresholdTrigger> for ::windows::core::IUnknown { fn from(value: SensorDataThresholdTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&SensorDataThresholdTrigger> for ::windows::core::IUnknown { fn from(value: &SensorDataThresholdTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SensorDataThresholdTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SensorDataThresholdTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SensorDataThresholdTrigger> for ::windows::core::IInspectable { fn from(value: SensorDataThresholdTrigger) -> Self { value.0 } } impl ::core::convert::From<&SensorDataThresholdTrigger> for ::windows::core::IInspectable { fn from(value: &SensorDataThresholdTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SensorDataThresholdTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SensorDataThresholdTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<SensorDataThresholdTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: SensorDataThresholdTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SensorDataThresholdTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &SensorDataThresholdTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for SensorDataThresholdTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &SensorDataThresholdTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for SensorDataThresholdTrigger {} unsafe impl ::core::marker::Sync for SensorDataThresholdTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SmartCardTrigger(pub ::windows::core::IInspectable); impl SmartCardTrigger { #[cfg(feature = "Devices_SmartCards")] pub fn TriggerType(&self) -> ::windows::core::Result<super::super::Devices::SmartCards::SmartCardTriggerType> { let this = self; unsafe { let mut result__: super::super::Devices::SmartCards::SmartCardTriggerType = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Devices::SmartCards::SmartCardTriggerType>(result__) } } #[cfg(feature = "Devices_SmartCards")] pub fn Create(triggertype: super::super::Devices::SmartCards::SmartCardTriggerType) -> ::windows::core::Result<SmartCardTrigger> { Self::ISmartCardTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), triggertype, &mut result__).from_abi::<SmartCardTrigger>(result__) }) } pub fn ISmartCardTriggerFactory<R, F: FnOnce(&ISmartCardTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SmartCardTrigger, ISmartCardTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SmartCardTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.SmartCardTrigger;{f53bc5ac-84ca-4972-8ce9-e58f97b37a50})"); } unsafe impl ::windows::core::Interface for SmartCardTrigger { type Vtable = ISmartCardTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf53bc5ac_84ca_4972_8ce9_e58f97b37a50); } impl ::windows::core::RuntimeName for SmartCardTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.SmartCardTrigger"; } impl ::core::convert::From<SmartCardTrigger> for ::windows::core::IUnknown { fn from(value: SmartCardTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&SmartCardTrigger> for ::windows::core::IUnknown { fn from(value: &SmartCardTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SmartCardTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SmartCardTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SmartCardTrigger> for ::windows::core::IInspectable { fn from(value: SmartCardTrigger) -> Self { value.0 } } impl ::core::convert::From<&SmartCardTrigger> for ::windows::core::IInspectable { fn from(value: &SmartCardTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SmartCardTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SmartCardTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<SmartCardTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: SmartCardTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SmartCardTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &SmartCardTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for SmartCardTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &SmartCardTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SmsMessageReceivedTrigger(pub ::windows::core::IInspectable); impl SmsMessageReceivedTrigger { #[cfg(feature = "Devices_Sms")] pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, super::super::Devices::Sms::SmsFilterRules>>(filterrules: Param0) -> ::windows::core::Result<SmsMessageReceivedTrigger> { Self::ISmsMessageReceivedTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), filterrules.into_param().abi(), &mut result__).from_abi::<SmsMessageReceivedTrigger>(result__) }) } pub fn ISmsMessageReceivedTriggerFactory<R, F: FnOnce(&ISmsMessageReceivedTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SmsMessageReceivedTrigger, ISmsMessageReceivedTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SmsMessageReceivedTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.SmsMessageReceivedTrigger;{84b3a058-6027-4b87-9790-bdf3f757dbd7})"); } unsafe impl ::windows::core::Interface for SmsMessageReceivedTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl ::windows::core::RuntimeName for SmsMessageReceivedTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.SmsMessageReceivedTrigger"; } impl ::core::convert::From<SmsMessageReceivedTrigger> for ::windows::core::IUnknown { fn from(value: SmsMessageReceivedTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&SmsMessageReceivedTrigger> for ::windows::core::IUnknown { fn from(value: &SmsMessageReceivedTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SmsMessageReceivedTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SmsMessageReceivedTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SmsMessageReceivedTrigger> for ::windows::core::IInspectable { fn from(value: SmsMessageReceivedTrigger) -> Self { value.0 } } impl ::core::convert::From<&SmsMessageReceivedTrigger> for ::windows::core::IInspectable { fn from(value: &SmsMessageReceivedTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SmsMessageReceivedTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SmsMessageReceivedTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<SmsMessageReceivedTrigger> for IBackgroundTrigger { fn from(value: SmsMessageReceivedTrigger) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&SmsMessageReceivedTrigger> for IBackgroundTrigger { fn from(value: &SmsMessageReceivedTrigger) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for SmsMessageReceivedTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &SmsMessageReceivedTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for SmsMessageReceivedTrigger {} unsafe impl ::core::marker::Sync for SmsMessageReceivedTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SocketActivityTrigger(pub ::windows::core::IInspectable); impl SocketActivityTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SocketActivityTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn IsWakeFromLowPowerSupported(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<ISocketActivityTrigger>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } } unsafe impl ::windows::core::RuntimeType for SocketActivityTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.SocketActivityTrigger;{84b3a058-6027-4b87-9790-bdf3f757dbd7})"); } unsafe impl ::windows::core::Interface for SocketActivityTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl ::windows::core::RuntimeName for SocketActivityTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.SocketActivityTrigger"; } impl ::core::convert::From<SocketActivityTrigger> for ::windows::core::IUnknown { fn from(value: SocketActivityTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&SocketActivityTrigger> for ::windows::core::IUnknown { fn from(value: &SocketActivityTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SocketActivityTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SocketActivityTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SocketActivityTrigger> for ::windows::core::IInspectable { fn from(value: SocketActivityTrigger) -> Self { value.0 } } impl ::core::convert::From<&SocketActivityTrigger> for ::windows::core::IInspectable { fn from(value: &SocketActivityTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SocketActivityTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SocketActivityTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<SocketActivityTrigger> for IBackgroundTrigger { fn from(value: SocketActivityTrigger) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&SocketActivityTrigger> for IBackgroundTrigger { fn from(value: &SocketActivityTrigger) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for SocketActivityTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &SocketActivityTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for SocketActivityTrigger {} unsafe impl ::core::marker::Sync for SocketActivityTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct StorageLibraryChangeTrackerTrigger(pub ::windows::core::IInspectable); impl StorageLibraryChangeTrackerTrigger { #[cfg(feature = "Storage")] pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::StorageLibraryChangeTracker>>(tracker: Param0) -> ::windows::core::Result<StorageLibraryChangeTrackerTrigger> { Self::IStorageLibraryChangeTrackerTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), tracker.into_param().abi(), &mut result__).from_abi::<StorageLibraryChangeTrackerTrigger>(result__) }) } pub fn IStorageLibraryChangeTrackerTriggerFactory<R, F: FnOnce(&IStorageLibraryChangeTrackerTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<StorageLibraryChangeTrackerTrigger, IStorageLibraryChangeTrackerTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for StorageLibraryChangeTrackerTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.StorageLibraryChangeTrackerTrigger;{84b3a058-6027-4b87-9790-bdf3f757dbd7})"); } unsafe impl ::windows::core::Interface for StorageLibraryChangeTrackerTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl ::windows::core::RuntimeName for StorageLibraryChangeTrackerTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.StorageLibraryChangeTrackerTrigger"; } impl ::core::convert::From<StorageLibraryChangeTrackerTrigger> for ::windows::core::IUnknown { fn from(value: StorageLibraryChangeTrackerTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&StorageLibraryChangeTrackerTrigger> for ::windows::core::IUnknown { fn from(value: &StorageLibraryChangeTrackerTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for StorageLibraryChangeTrackerTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a StorageLibraryChangeTrackerTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<StorageLibraryChangeTrackerTrigger> for ::windows::core::IInspectable { fn from(value: StorageLibraryChangeTrackerTrigger) -> Self { value.0 } } impl ::core::convert::From<&StorageLibraryChangeTrackerTrigger> for ::windows::core::IInspectable { fn from(value: &StorageLibraryChangeTrackerTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for StorageLibraryChangeTrackerTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a StorageLibraryChangeTrackerTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<StorageLibraryChangeTrackerTrigger> for IBackgroundTrigger { fn from(value: StorageLibraryChangeTrackerTrigger) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&StorageLibraryChangeTrackerTrigger> for IBackgroundTrigger { fn from(value: &StorageLibraryChangeTrackerTrigger) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for StorageLibraryChangeTrackerTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &StorageLibraryChangeTrackerTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for StorageLibraryChangeTrackerTrigger {} unsafe impl ::core::marker::Sync for StorageLibraryChangeTrackerTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct StorageLibraryContentChangedTrigger(pub ::windows::core::IInspectable); impl StorageLibraryContentChangedTrigger { #[cfg(feature = "Storage")] pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::StorageLibrary>>(storagelibrary: Param0) -> ::windows::core::Result<StorageLibraryContentChangedTrigger> { Self::IStorageLibraryContentChangedTriggerStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), storagelibrary.into_param().abi(), &mut result__).from_abi::<StorageLibraryContentChangedTrigger>(result__) }) } #[cfg(all(feature = "Foundation_Collections", feature = "Storage"))] pub fn CreateFromLibraries<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IIterable<super::super::Storage::StorageLibrary>>>(storagelibraries: Param0) -> ::windows::core::Result<StorageLibraryContentChangedTrigger> { Self::IStorageLibraryContentChangedTriggerStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), storagelibraries.into_param().abi(), &mut result__).from_abi::<StorageLibraryContentChangedTrigger>(result__) }) } pub fn IStorageLibraryContentChangedTriggerStatics<R, F: FnOnce(&IStorageLibraryContentChangedTriggerStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<StorageLibraryContentChangedTrigger, IStorageLibraryContentChangedTriggerStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for StorageLibraryContentChangedTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.StorageLibraryContentChangedTrigger;{1637e0a7-829c-45bc-929b-a1e7ea78d89b})"); } unsafe impl ::windows::core::Interface for StorageLibraryContentChangedTrigger { type Vtable = IStorageLibraryContentChangedTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1637e0a7_829c_45bc_929b_a1e7ea78d89b); } impl ::windows::core::RuntimeName for StorageLibraryContentChangedTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.StorageLibraryContentChangedTrigger"; } impl ::core::convert::From<StorageLibraryContentChangedTrigger> for ::windows::core::IUnknown { fn from(value: StorageLibraryContentChangedTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&StorageLibraryContentChangedTrigger> for ::windows::core::IUnknown { fn from(value: &StorageLibraryContentChangedTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for StorageLibraryContentChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a StorageLibraryContentChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<StorageLibraryContentChangedTrigger> for ::windows::core::IInspectable { fn from(value: StorageLibraryContentChangedTrigger) -> Self { value.0 } } impl ::core::convert::From<&StorageLibraryContentChangedTrigger> for ::windows::core::IInspectable { fn from(value: &StorageLibraryContentChangedTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for StorageLibraryContentChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a StorageLibraryContentChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<StorageLibraryContentChangedTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: StorageLibraryContentChangedTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&StorageLibraryContentChangedTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &StorageLibraryContentChangedTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for StorageLibraryContentChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &StorageLibraryContentChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SystemCondition(pub ::windows::core::IInspectable); impl SystemCondition { pub fn ConditionType(&self) -> ::windows::core::Result<SystemConditionType> { let this = self; unsafe { let mut result__: SystemConditionType = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<SystemConditionType>(result__) } } pub fn Create(conditiontype: SystemConditionType) -> ::windows::core::Result<SystemCondition> { Self::ISystemConditionFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), conditiontype, &mut result__).from_abi::<SystemCondition>(result__) }) } pub fn ISystemConditionFactory<R, F: FnOnce(&ISystemConditionFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SystemCondition, ISystemConditionFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SystemCondition { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.SystemCondition;{c15fb476-89c5-420b-abd3-fb3030472128})"); } unsafe impl ::windows::core::Interface for SystemCondition { type Vtable = ISystemCondition_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc15fb476_89c5_420b_abd3_fb3030472128); } impl ::windows::core::RuntimeName for SystemCondition { const NAME: &'static str = "Windows.ApplicationModel.Background.SystemCondition"; } impl ::core::convert::From<SystemCondition> for ::windows::core::IUnknown { fn from(value: SystemCondition) -> Self { value.0 .0 } } impl ::core::convert::From<&SystemCondition> for ::windows::core::IUnknown { fn from(value: &SystemCondition) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SystemCondition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SystemCondition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SystemCondition> for ::windows::core::IInspectable { fn from(value: SystemCondition) -> Self { value.0 } } impl ::core::convert::From<&SystemCondition> for ::windows::core::IInspectable { fn from(value: &SystemCondition) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SystemCondition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SystemCondition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<SystemCondition> for IBackgroundCondition { type Error = ::windows::core::Error; fn try_from(value: SystemCondition) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SystemCondition> for IBackgroundCondition { type Error = ::windows::core::Error; fn try_from(value: &SystemCondition) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundCondition> for SystemCondition { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundCondition> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundCondition> for &SystemCondition { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundCondition> { ::core::convert::TryInto::<IBackgroundCondition>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct SystemConditionType(pub i32); impl SystemConditionType { pub const Invalid: SystemConditionType = SystemConditionType(0i32); pub const UserPresent: SystemConditionType = SystemConditionType(1i32); pub const UserNotPresent: SystemConditionType = SystemConditionType(2i32); pub const InternetAvailable: SystemConditionType = SystemConditionType(3i32); pub const InternetNotAvailable: SystemConditionType = SystemConditionType(4i32); pub const SessionConnected: SystemConditionType = SystemConditionType(5i32); pub const SessionDisconnected: SystemConditionType = SystemConditionType(6i32); pub const FreeNetworkAvailable: SystemConditionType = SystemConditionType(7i32); pub const BackgroundWorkCostNotHigh: SystemConditionType = SystemConditionType(8i32); } impl ::core::convert::From<i32> for SystemConditionType { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SystemConditionType { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for SystemConditionType { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.SystemConditionType;i4)"); } impl ::windows::core::DefaultType for SystemConditionType { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SystemTrigger(pub ::windows::core::IInspectable); impl SystemTrigger { pub fn OneShot(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn TriggerType(&self) -> ::windows::core::Result<SystemTriggerType> { let this = self; unsafe { let mut result__: SystemTriggerType = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<SystemTriggerType>(result__) } } pub fn Create(triggertype: SystemTriggerType, oneshot: bool) -> ::windows::core::Result<SystemTrigger> { Self::ISystemTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), triggertype, oneshot, &mut result__).from_abi::<SystemTrigger>(result__) }) } pub fn ISystemTriggerFactory<R, F: FnOnce(&ISystemTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SystemTrigger, ISystemTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SystemTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.SystemTrigger;{1d80c776-3748-4463-8d7e-276dc139ac1c})"); } unsafe impl ::windows::core::Interface for SystemTrigger { type Vtable = ISystemTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1d80c776_3748_4463_8d7e_276dc139ac1c); } impl ::windows::core::RuntimeName for SystemTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.SystemTrigger"; } impl ::core::convert::From<SystemTrigger> for ::windows::core::IUnknown { fn from(value: SystemTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&SystemTrigger> for ::windows::core::IUnknown { fn from(value: &SystemTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SystemTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SystemTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SystemTrigger> for ::windows::core::IInspectable { fn from(value: SystemTrigger) -> Self { value.0 } } impl ::core::convert::From<&SystemTrigger> for ::windows::core::IInspectable { fn from(value: &SystemTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SystemTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SystemTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<SystemTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: SystemTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SystemTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &SystemTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for SystemTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &SystemTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct SystemTriggerType(pub i32); impl SystemTriggerType { pub const Invalid: SystemTriggerType = SystemTriggerType(0i32); pub const SmsReceived: SystemTriggerType = SystemTriggerType(1i32); pub const UserPresent: SystemTriggerType = SystemTriggerType(2i32); pub const UserAway: SystemTriggerType = SystemTriggerType(3i32); pub const NetworkStateChange: SystemTriggerType = SystemTriggerType(4i32); pub const ControlChannelReset: SystemTriggerType = SystemTriggerType(5i32); pub const InternetAvailable: SystemTriggerType = SystemTriggerType(6i32); pub const SessionConnected: SystemTriggerType = SystemTriggerType(7i32); pub const ServicingComplete: SystemTriggerType = SystemTriggerType(8i32); pub const LockScreenApplicationAdded: SystemTriggerType = SystemTriggerType(9i32); pub const LockScreenApplicationRemoved: SystemTriggerType = SystemTriggerType(10i32); pub const TimeZoneChange: SystemTriggerType = SystemTriggerType(11i32); pub const OnlineIdConnectedStateChange: SystemTriggerType = SystemTriggerType(12i32); pub const BackgroundWorkCostChange: SystemTriggerType = SystemTriggerType(13i32); pub const PowerStateChange: SystemTriggerType = SystemTriggerType(14i32); pub const DefaultSignInAccountChange: SystemTriggerType = SystemTriggerType(15i32); } impl ::core::convert::From<i32> for SystemTriggerType { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SystemTriggerType { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for SystemTriggerType { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.ApplicationModel.Background.SystemTriggerType;i4)"); } impl ::windows::core::DefaultType for SystemTriggerType { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct TetheringEntitlementCheckTrigger(pub ::windows::core::IInspectable); impl TetheringEntitlementCheckTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<TetheringEntitlementCheckTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for TetheringEntitlementCheckTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.TetheringEntitlementCheckTrigger;{84b3a058-6027-4b87-9790-bdf3f757dbd7})"); } unsafe impl ::windows::core::Interface for TetheringEntitlementCheckTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl ::windows::core::RuntimeName for TetheringEntitlementCheckTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.TetheringEntitlementCheckTrigger"; } impl ::core::convert::From<TetheringEntitlementCheckTrigger> for ::windows::core::IUnknown { fn from(value: TetheringEntitlementCheckTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&TetheringEntitlementCheckTrigger> for ::windows::core::IUnknown { fn from(value: &TetheringEntitlementCheckTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for TetheringEntitlementCheckTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a TetheringEntitlementCheckTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<TetheringEntitlementCheckTrigger> for ::windows::core::IInspectable { fn from(value: TetheringEntitlementCheckTrigger) -> Self { value.0 } } impl ::core::convert::From<&TetheringEntitlementCheckTrigger> for ::windows::core::IInspectable { fn from(value: &TetheringEntitlementCheckTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for TetheringEntitlementCheckTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a TetheringEntitlementCheckTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<TetheringEntitlementCheckTrigger> for IBackgroundTrigger { fn from(value: TetheringEntitlementCheckTrigger) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&TetheringEntitlementCheckTrigger> for IBackgroundTrigger { fn from(value: &TetheringEntitlementCheckTrigger) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for TetheringEntitlementCheckTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &TetheringEntitlementCheckTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for TetheringEntitlementCheckTrigger {} unsafe impl ::core::marker::Sync for TetheringEntitlementCheckTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct TimeTrigger(pub ::windows::core::IInspectable); impl TimeTrigger { pub fn FreshnessTime(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn OneShot(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn Create(freshnesstime: u32, oneshot: bool) -> ::windows::core::Result<TimeTrigger> { Self::ITimeTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), freshnesstime, oneshot, &mut result__).from_abi::<TimeTrigger>(result__) }) } pub fn ITimeTriggerFactory<R, F: FnOnce(&ITimeTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<TimeTrigger, ITimeTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for TimeTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.TimeTrigger;{656e5556-0b2a-4377-ba70-3b45a935547f})"); } unsafe impl ::windows::core::Interface for TimeTrigger { type Vtable = ITimeTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x656e5556_0b2a_4377_ba70_3b45a935547f); } impl ::windows::core::RuntimeName for TimeTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.TimeTrigger"; } impl ::core::convert::From<TimeTrigger> for ::windows::core::IUnknown { fn from(value: TimeTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&TimeTrigger> for ::windows::core::IUnknown { fn from(value: &TimeTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for TimeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a TimeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<TimeTrigger> for ::windows::core::IInspectable { fn from(value: TimeTrigger) -> Self { value.0 } } impl ::core::convert::From<&TimeTrigger> for ::windows::core::IInspectable { fn from(value: &TimeTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for TimeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a TimeTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<TimeTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: TimeTrigger) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&TimeTrigger> for IBackgroundTrigger { type Error = ::windows::core::Error; fn try_from(value: &TimeTrigger) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for TimeTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &TimeTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::core::convert::TryInto::<IBackgroundTrigger>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ToastNotificationActionTrigger(pub ::windows::core::IInspectable); impl ToastNotificationActionTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<ToastNotificationActionTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(applicationid: Param0) -> ::windows::core::Result<ToastNotificationActionTrigger> { Self::IToastNotificationActionTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), applicationid.into_param().abi(), &mut result__).from_abi::<ToastNotificationActionTrigger>(result__) }) } pub fn IToastNotificationActionTriggerFactory<R, F: FnOnce(&IToastNotificationActionTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<ToastNotificationActionTrigger, IToastNotificationActionTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for ToastNotificationActionTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.ToastNotificationActionTrigger;{84b3a058-6027-4b87-9790-bdf3f757dbd7})"); } unsafe impl ::windows::core::Interface for ToastNotificationActionTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl ::windows::core::RuntimeName for ToastNotificationActionTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.ToastNotificationActionTrigger"; } impl ::core::convert::From<ToastNotificationActionTrigger> for ::windows::core::IUnknown { fn from(value: ToastNotificationActionTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&ToastNotificationActionTrigger> for ::windows::core::IUnknown { fn from(value: &ToastNotificationActionTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ToastNotificationActionTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ToastNotificationActionTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ToastNotificationActionTrigger> for ::windows::core::IInspectable { fn from(value: ToastNotificationActionTrigger) -> Self { value.0 } } impl ::core::convert::From<&ToastNotificationActionTrigger> for ::windows::core::IInspectable { fn from(value: &ToastNotificationActionTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ToastNotificationActionTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a ToastNotificationActionTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<ToastNotificationActionTrigger> for IBackgroundTrigger { fn from(value: ToastNotificationActionTrigger) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&ToastNotificationActionTrigger> for IBackgroundTrigger { fn from(value: &ToastNotificationActionTrigger) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for ToastNotificationActionTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &ToastNotificationActionTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for ToastNotificationActionTrigger {} unsafe impl ::core::marker::Sync for ToastNotificationActionTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ToastNotificationHistoryChangedTrigger(pub ::windows::core::IInspectable); impl ToastNotificationHistoryChangedTrigger { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<ToastNotificationHistoryChangedTrigger, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(applicationid: Param0) -> ::windows::core::Result<ToastNotificationHistoryChangedTrigger> { Self::IToastNotificationHistoryChangedTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), applicationid.into_param().abi(), &mut result__).from_abi::<ToastNotificationHistoryChangedTrigger>(result__) }) } pub fn IToastNotificationHistoryChangedTriggerFactory<R, F: FnOnce(&IToastNotificationHistoryChangedTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<ToastNotificationHistoryChangedTrigger, IToastNotificationHistoryChangedTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for ToastNotificationHistoryChangedTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.ToastNotificationHistoryChangedTrigger;{84b3a058-6027-4b87-9790-bdf3f757dbd7})"); } unsafe impl ::windows::core::Interface for ToastNotificationHistoryChangedTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl ::windows::core::RuntimeName for ToastNotificationHistoryChangedTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.ToastNotificationHistoryChangedTrigger"; } impl ::core::convert::From<ToastNotificationHistoryChangedTrigger> for ::windows::core::IUnknown { fn from(value: ToastNotificationHistoryChangedTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&ToastNotificationHistoryChangedTrigger> for ::windows::core::IUnknown { fn from(value: &ToastNotificationHistoryChangedTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ToastNotificationHistoryChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ToastNotificationHistoryChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ToastNotificationHistoryChangedTrigger> for ::windows::core::IInspectable { fn from(value: ToastNotificationHistoryChangedTrigger) -> Self { value.0 } } impl ::core::convert::From<&ToastNotificationHistoryChangedTrigger> for ::windows::core::IInspectable { fn from(value: &ToastNotificationHistoryChangedTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ToastNotificationHistoryChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a ToastNotificationHistoryChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<ToastNotificationHistoryChangedTrigger> for IBackgroundTrigger { fn from(value: ToastNotificationHistoryChangedTrigger) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&ToastNotificationHistoryChangedTrigger> for IBackgroundTrigger { fn from(value: &ToastNotificationHistoryChangedTrigger) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for ToastNotificationHistoryChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &ToastNotificationHistoryChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for ToastNotificationHistoryChangedTrigger {} unsafe impl ::core::marker::Sync for ToastNotificationHistoryChangedTrigger {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct UserNotificationChangedTrigger(pub ::windows::core::IInspectable); impl UserNotificationChangedTrigger { #[cfg(feature = "UI_Notifications")] pub fn Create(notificationkinds: super::super::UI::Notifications::NotificationKinds) -> ::windows::core::Result<UserNotificationChangedTrigger> { Self::IUserNotificationChangedTriggerFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), notificationkinds, &mut result__).from_abi::<UserNotificationChangedTrigger>(result__) }) } pub fn IUserNotificationChangedTriggerFactory<R, F: FnOnce(&IUserNotificationChangedTriggerFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<UserNotificationChangedTrigger, IUserNotificationChangedTriggerFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for UserNotificationChangedTrigger { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Background.UserNotificationChangedTrigger;{84b3a058-6027-4b87-9790-bdf3f757dbd7})"); } unsafe impl ::windows::core::Interface for UserNotificationChangedTrigger { type Vtable = IBackgroundTrigger_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x84b3a058_6027_4b87_9790_bdf3f757dbd7); } impl ::windows::core::RuntimeName for UserNotificationChangedTrigger { const NAME: &'static str = "Windows.ApplicationModel.Background.UserNotificationChangedTrigger"; } impl ::core::convert::From<UserNotificationChangedTrigger> for ::windows::core::IUnknown { fn from(value: UserNotificationChangedTrigger) -> Self { value.0 .0 } } impl ::core::convert::From<&UserNotificationChangedTrigger> for ::windows::core::IUnknown { fn from(value: &UserNotificationChangedTrigger) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for UserNotificationChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a UserNotificationChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<UserNotificationChangedTrigger> for ::windows::core::IInspectable { fn from(value: UserNotificationChangedTrigger) -> Self { value.0 } } impl ::core::convert::From<&UserNotificationChangedTrigger> for ::windows::core::IInspectable { fn from(value: &UserNotificationChangedTrigger) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for UserNotificationChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a UserNotificationChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<UserNotificationChangedTrigger> for IBackgroundTrigger { fn from(value: UserNotificationChangedTrigger) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&UserNotificationChangedTrigger> for IBackgroundTrigger { fn from(value: &UserNotificationChangedTrigger) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for UserNotificationChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IBackgroundTrigger> for &UserNotificationChangedTrigger { fn into_param(self) -> ::windows::core::Param<'a, IBackgroundTrigger> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for UserNotificationChangedTrigger {} unsafe impl ::core::marker::Sync for UserNotificationChangedTrigger {}
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type DisplayAdapter = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct DisplayBitsPerChannel(pub u32); impl DisplayBitsPerChannel { pub const None: Self = Self(0u32); pub const Bpc6: Self = Self(1u32); pub const Bpc8: Self = Self(2u32); pub const Bpc10: Self = Self(4u32); pub const Bpc12: Self = Self(8u32); pub const Bpc14: Self = Self(16u32); pub const Bpc16: Self = Self(32u32); } impl ::core::marker::Copy for DisplayBitsPerChannel {} impl ::core::clone::Clone for DisplayBitsPerChannel { fn clone(&self) -> Self { *self } } pub type DisplayDevice = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct DisplayDeviceCapability(pub i32); impl DisplayDeviceCapability { pub const FlipOverride: Self = Self(0i32); } impl ::core::marker::Copy for DisplayDeviceCapability {} impl ::core::clone::Clone for DisplayDeviceCapability { fn clone(&self) -> Self { *self } } pub type DisplayFence = *mut ::core::ffi::c_void; pub type DisplayManager = *mut ::core::ffi::c_void; pub type DisplayManagerChangedEventArgs = *mut ::core::ffi::c_void; pub type DisplayManagerDisabledEventArgs = *mut ::core::ffi::c_void; pub type DisplayManagerEnabledEventArgs = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct DisplayManagerOptions(pub u32); impl DisplayManagerOptions { pub const None: Self = Self(0u32); pub const EnforceSourceOwnership: Self = Self(1u32); pub const VirtualRefreshRateAware: Self = Self(2u32); } impl ::core::marker::Copy for DisplayManagerOptions {} impl ::core::clone::Clone for DisplayManagerOptions { fn clone(&self) -> Self { *self } } pub type DisplayManagerPathsFailedOrInvalidatedEventArgs = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct DisplayManagerResult(pub i32); impl DisplayManagerResult { pub const Success: Self = Self(0i32); pub const UnknownFailure: Self = Self(1i32); pub const TargetAccessDenied: Self = Self(2i32); pub const TargetStale: Self = Self(3i32); pub const RemoteSessionNotSupported: Self = Self(4i32); } impl ::core::marker::Copy for DisplayManagerResult {} impl ::core::clone::Clone for DisplayManagerResult { fn clone(&self) -> Self { *self } } pub type DisplayManagerResultWithState = *mut ::core::ffi::c_void; pub type DisplayModeInfo = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct DisplayModeQueryOptions(pub u32); impl DisplayModeQueryOptions { pub const None: Self = Self(0u32); pub const OnlyPreferredResolution: Self = Self(1u32); } impl ::core::marker::Copy for DisplayModeQueryOptions {} impl ::core::clone::Clone for DisplayModeQueryOptions { fn clone(&self) -> Self { *self } } pub type DisplayPath = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct DisplayPathScaling(pub i32); impl DisplayPathScaling { pub const Identity: Self = Self(0i32); pub const Centered: Self = Self(1i32); pub const Stretched: Self = Self(2i32); pub const AspectRatioStretched: Self = Self(3i32); pub const Custom: Self = Self(4i32); pub const DriverPreferred: Self = Self(5i32); } impl ::core::marker::Copy for DisplayPathScaling {} impl ::core::clone::Clone for DisplayPathScaling { fn clone(&self) -> Self { *self } } #[repr(transparent)] pub struct DisplayPathStatus(pub i32); impl DisplayPathStatus { pub const Unknown: Self = Self(0i32); pub const Succeeded: Self = Self(1i32); pub const Pending: Self = Self(2i32); pub const Failed: Self = Self(3i32); pub const FailedAsync: Self = Self(4i32); pub const InvalidatedAsync: Self = Self(5i32); } impl ::core::marker::Copy for DisplayPathStatus {} impl ::core::clone::Clone for DisplayPathStatus { fn clone(&self) -> Self { *self } } #[repr(transparent)] pub struct DisplayPresentStatus(pub i32); impl DisplayPresentStatus { pub const Success: Self = Self(0i32); pub const SourceStatusPreventedPresent: Self = Self(1i32); pub const ScanoutInvalid: Self = Self(2i32); pub const SourceInvalid: Self = Self(3i32); pub const DeviceInvalid: Self = Self(4i32); pub const UnknownFailure: Self = Self(5i32); } impl ::core::marker::Copy for DisplayPresentStatus {} impl ::core::clone::Clone for DisplayPresentStatus { fn clone(&self) -> Self { *self } } #[repr(C)] #[cfg(feature = "Foundation_Numerics")] pub struct DisplayPresentationRate { pub VerticalSyncRate: super::super::super::Foundation::Numerics::Rational, pub VerticalSyncsPerPresentation: i32, } #[cfg(feature = "Foundation_Numerics")] impl ::core::marker::Copy for DisplayPresentationRate {} #[cfg(feature = "Foundation_Numerics")] impl ::core::clone::Clone for DisplayPresentationRate { fn clone(&self) -> Self { *self } } pub type DisplayPrimaryDescription = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct DisplayRotation(pub i32); impl DisplayRotation { pub const None: Self = Self(0i32); pub const Clockwise90Degrees: Self = Self(1i32); pub const Clockwise180Degrees: Self = Self(2i32); pub const Clockwise270Degrees: Self = Self(3i32); } impl ::core::marker::Copy for DisplayRotation {} impl ::core::clone::Clone for DisplayRotation { fn clone(&self) -> Self { *self } } pub type DisplayScanout = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct DisplayScanoutOptions(pub u32); impl DisplayScanoutOptions { pub const None: Self = Self(0u32); pub const AllowTearing: Self = Self(2u32); } impl ::core::marker::Copy for DisplayScanoutOptions {} impl ::core::clone::Clone for DisplayScanoutOptions { fn clone(&self) -> Self { *self } } pub type DisplaySource = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct DisplaySourceStatus(pub i32); impl DisplaySourceStatus { pub const Active: Self = Self(0i32); pub const PoweredOff: Self = Self(1i32); pub const Invalid: Self = Self(2i32); pub const OwnedByAnotherDevice: Self = Self(3i32); pub const Unowned: Self = Self(4i32); } impl ::core::marker::Copy for DisplaySourceStatus {} impl ::core::clone::Clone for DisplaySourceStatus { fn clone(&self) -> Self { *self } } pub type DisplayState = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct DisplayStateApplyOptions(pub u32); impl DisplayStateApplyOptions { pub const None: Self = Self(0u32); pub const FailIfStateChanged: Self = Self(1u32); pub const ForceReapply: Self = Self(2u32); pub const ForceModeEnumeration: Self = Self(4u32); } impl ::core::marker::Copy for DisplayStateApplyOptions {} impl ::core::clone::Clone for DisplayStateApplyOptions { fn clone(&self) -> Self { *self } } #[repr(transparent)] pub struct DisplayStateFunctionalizeOptions(pub u32); impl DisplayStateFunctionalizeOptions { pub const None: Self = Self(0u32); pub const FailIfStateChanged: Self = Self(1u32); pub const ValidateTopologyOnly: Self = Self(2u32); } impl ::core::marker::Copy for DisplayStateFunctionalizeOptions {} impl ::core::clone::Clone for DisplayStateFunctionalizeOptions { fn clone(&self) -> Self { *self } } pub type DisplayStateOperationResult = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct DisplayStateOperationStatus(pub i32); impl DisplayStateOperationStatus { pub const Success: Self = Self(0i32); pub const PartialFailure: Self = Self(1i32); pub const UnknownFailure: Self = Self(2i32); pub const TargetOwnershipLost: Self = Self(3i32); pub const SystemStateChanged: Self = Self(4i32); pub const TooManyPathsForAdapter: Self = Self(5i32); pub const ModesNotSupported: Self = Self(6i32); pub const RemoteSessionNotSupported: Self = Self(7i32); } impl ::core::marker::Copy for DisplayStateOperationStatus {} impl ::core::clone::Clone for DisplayStateOperationStatus { fn clone(&self) -> Self { *self } } pub type DisplaySurface = *mut ::core::ffi::c_void; pub type DisplayTarget = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct DisplayTargetPersistence(pub i32); impl DisplayTargetPersistence { pub const None: Self = Self(0i32); pub const BootPersisted: Self = Self(1i32); pub const TemporaryPersisted: Self = Self(2i32); pub const PathPersisted: Self = Self(3i32); } impl ::core::marker::Copy for DisplayTargetPersistence {} impl ::core::clone::Clone for DisplayTargetPersistence { fn clone(&self) -> Self { *self } } pub type DisplayTask = *mut ::core::ffi::c_void; pub type DisplayTaskPool = *mut ::core::ffi::c_void; pub type DisplayTaskResult = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct DisplayTaskSignalKind(pub i32); impl DisplayTaskSignalKind { pub const OnPresentFlipAway: Self = Self(0i32); pub const OnPresentFlipTo: Self = Self(1i32); } impl ::core::marker::Copy for DisplayTaskSignalKind {} impl ::core::clone::Clone for DisplayTaskSignalKind { fn clone(&self) -> Self { *self } } pub type DisplayView = *mut ::core::ffi::c_void; pub type DisplayWireFormat = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct DisplayWireFormatColorSpace(pub i32); impl DisplayWireFormatColorSpace { pub const BT709: Self = Self(0i32); pub const BT2020: Self = Self(1i32); pub const ProfileDefinedWideColorGamut: Self = Self(2i32); } impl ::core::marker::Copy for DisplayWireFormatColorSpace {} impl ::core::clone::Clone for DisplayWireFormatColorSpace { fn clone(&self) -> Self { *self } } #[repr(transparent)] pub struct DisplayWireFormatEotf(pub i32); impl DisplayWireFormatEotf { pub const Sdr: Self = Self(0i32); pub const HdrSmpte2084: Self = Self(1i32); } impl ::core::marker::Copy for DisplayWireFormatEotf {} impl ::core::clone::Clone for DisplayWireFormatEotf { fn clone(&self) -> Self { *self } } #[repr(transparent)] pub struct DisplayWireFormatHdrMetadata(pub i32); impl DisplayWireFormatHdrMetadata { pub const None: Self = Self(0i32); pub const Hdr10: Self = Self(1i32); pub const Hdr10Plus: Self = Self(2i32); pub const DolbyVisionLowLatency: Self = Self(3i32); } impl ::core::marker::Copy for DisplayWireFormatHdrMetadata {} impl ::core::clone::Clone for DisplayWireFormatHdrMetadata { fn clone(&self) -> Self { *self } } #[repr(transparent)] pub struct DisplayWireFormatPixelEncoding(pub i32); impl DisplayWireFormatPixelEncoding { pub const Rgb444: Self = Self(0i32); pub const Ycc444: Self = Self(1i32); pub const Ycc422: Self = Self(2i32); pub const Ycc420: Self = Self(3i32); pub const Intensity: Self = Self(4i32); } impl ::core::marker::Copy for DisplayWireFormatPixelEncoding {} impl ::core::clone::Clone for DisplayWireFormatPixelEncoding { fn clone(&self) -> Self { *self } }
//! Module providing the abstractions needed to read files from an storage //! pub mod local; use std::{cmp::Ordering, path::PathBuf}; use thiserror::Error; use crate::htsget::{Class, Url}; type Result<T> = core::result::Result<T, StorageError>; /// An Storage represents some kind of object based storage (either locally or in the cloud) /// that can be used to retrieve files for alignments, variants or its respective indexes. pub trait Storage { // TODO Consider another type of interface based on IO streaming // so we don't need to guess the length of the headers, but just // parse them in an streaming fashion. fn get<K: AsRef<str>>(&self, key: K, options: GetOptions) -> Result<PathBuf>; fn url<K: AsRef<str>>(&self, key: K, options: UrlOptions) -> Result<Url>; } #[derive(Error, PartialEq, Debug)] pub enum StorageError { #[error("Invalid key: {0}")] InvalidKey(String), #[error("Not found: {0}")] NotFound(String), } #[derive(Debug, Clone, PartialEq)] pub struct BytesRange { start: Option<u64>, end: Option<u64>, } impl BytesRange { pub fn new(start: Option<u64>, end: Option<u64>) -> Self { Self { start, end } } pub fn with_start(mut self, start: u64) -> Self { self.start = Some(start); self } pub fn with_end(mut self, end: u64) -> Self { self.end = Some(end); self } pub fn get_start(&self) -> Option<u64> { self.start } pub fn get_end(&self) -> Option<u64> { self.end } pub fn overlaps(&self, range: &BytesRange) -> bool { let cond1 = match (self.start.as_ref(), range.end.as_ref()) { (None, None) | (None, Some(_)) | (Some(_), None) => true, (Some(start), Some(end)) => end >= start, }; let cond2 = match (self.end.as_ref(), range.start.as_ref()) { (None, None) | (None, Some(_)) | (Some(_), None) => true, (Some(end), Some(start)) => end >= start, }; cond1 && cond2 } pub fn merge_with(&mut self, range: &BytesRange) -> &Self { self.start = match (self.start.as_ref(), range.start.as_ref()) { (None, None) | (None, Some(_)) | (Some(_), None) => None, (Some(a), Some(b)) => Some(*a.min(b)), }; self.end = match (self.end.as_ref(), range.end.as_ref()) { (None, None) | (None, Some(_)) | (Some(_), None) => None, (Some(a), Some(b)) => Some(*a.max(b)), }; self } pub fn merge_all(mut ranges: Vec<BytesRange>) -> Vec<BytesRange> { if ranges.len() < 2 { ranges } else { ranges.sort_by(|a, b| { let a_start = a.get_start().unwrap_or(0); let b_start = b.get_start().unwrap_or(0); let start_ord = a_start.cmp(&b_start); if start_ord == Ordering::Equal { let a_end = a.get_end().unwrap_or(u64::MAX); let b_end = b.get_end().unwrap_or(u64::MAX); b_end.cmp(&a_end) } else { start_ord } }); let mut optimized_ranges = Vec::with_capacity(ranges.len()); let mut current_range = ranges[0].clone(); for range in ranges.iter().skip(1) { if current_range.overlaps(range) { current_range.merge_with(range); } else { optimized_ranges.push(current_range.clone()); current_range = range.clone(); } } optimized_ranges.push(current_range); optimized_ranges } } } impl Default for BytesRange { fn default() -> Self { Self { start: None, end: None, } } } pub struct GetOptions { range: BytesRange, } impl GetOptions { pub fn with_max_length(mut self, max_length: u64) -> Self { self.range = BytesRange::default().with_start(0).with_end(max_length); self } pub fn with_range(mut self, range: BytesRange) -> Self { self.range = range; self } } impl Default for GetOptions { fn default() -> Self { Self { range: BytesRange::default(), } } } pub struct UrlOptions { range: BytesRange, class: Option<Class>, } impl UrlOptions { pub fn with_range(mut self, range: BytesRange) -> Self { self.range = range; self } pub fn with_class(mut self, class: Class) -> Self { self.class = Some(class); self } } impl Default for UrlOptions { fn default() -> Self { Self { range: BytesRange::default(), class: None, } } } #[cfg(test)] mod tests { use super::*; #[test] fn bytes_range_overlapping_and_merge() { let test_cases = vec![ ( // 0123456789 BytesRange::new(None, Some(2)), // <--] BytesRange::new(Some(3), Some(5)), // [-] None, ), ( // 0123456789 BytesRange::new(None, Some(2)), // <--] BytesRange::new(Some(3), None), // [------> None, ), ( // 0123456789 BytesRange::new(None, Some(2)), // <--] BytesRange::new(Some(2), Some(4)), // [-] Some(BytesRange::new(None, Some(4))), // <----] ), ( // 0123456789 BytesRange::new(None, Some(2)), // <--] BytesRange::new(Some(2), None), // [-------> Some(BytesRange::new(None, None)), // <----------> ), ( // 0123456789 BytesRange::new(None, Some(2)), // <--] BytesRange::new(Some(1), Some(3)), // [-] Some(BytesRange::new(None, Some(3))), // <---] ), ( // 0123456789 BytesRange::new(None, Some(2)), // <--] BytesRange::new(Some(1), None), // [--------> Some(BytesRange::new(None, None)), // <----------> ), ( // 0123456789 BytesRange::new(None, Some(2)), // <--] BytesRange::new(Some(0), Some(2)), // [-] Some(BytesRange::new(None, Some(2))), // <--] ), ( // 0123456789 BytesRange::new(None, Some(2)), // <--] BytesRange::new(None, Some(2)), // <--] Some(BytesRange::new(None, Some(2))), // <--] ), ( // 0123456789 BytesRange::new(None, Some(2)), // <--] BytesRange::new(Some(0), Some(1)), // [] Some(BytesRange::new(None, Some(2))), // <--] ), ( // 0123456789 BytesRange::new(None, Some(2)), // <--] BytesRange::new(None, Some(1)), // <-] Some(BytesRange::new(None, Some(2))), // <--] ), ( // 0123456789 BytesRange::new(None, Some(2)), // <--] BytesRange::new(None, None), // <----------> Some(BytesRange::new(None, None)), // <----------> ), ( // 0123456789 BytesRange::new(Some(2), Some(4)), // [-] BytesRange::new(Some(6), Some(8)), // [-] None, ), ( // 0123456789 BytesRange::new(Some(2), Some(4)), // [-] BytesRange::new(Some(6), None), // [---> None, ), ( // 0123456789 BytesRange::new(Some(2), Some(4)), // [-] BytesRange::new(Some(4), Some(6)), // [-] Some(BytesRange::new(Some(2), Some(6))), // [---] ), ( // 0123456789 BytesRange::new(Some(2), Some(4)), // [-] BytesRange::new(Some(4), None), // [-----> Some(BytesRange::new(Some(2), None)), // [-------> ), ( // 0123456789 BytesRange::new(Some(2), Some(4)), // [-] BytesRange::new(Some(3), Some(5)), // [-] Some(BytesRange::new(Some(2), Some(5))), // [--] ), ( // 0123456789 BytesRange::new(Some(2), Some(4)), // [-] BytesRange::new(Some(3), None), // [------> Some(BytesRange::new(Some(2), None)), // [-------> ), ( // 0123456789 BytesRange::new(Some(2), Some(4)), // [-] BytesRange::new(Some(2), Some(3)), // [] Some(BytesRange::new(Some(2), Some(4))), // [-] ), ( // 0123456789 BytesRange::new(Some(2), Some(4)), // [-] BytesRange::new(None, Some(3)), // <---] Some(BytesRange::new(None, Some(4))), // <----] ), ( // 0123456789 BytesRange::new(Some(2), Some(4)), // [-] BytesRange::new(Some(1), Some(3)), // [-] Some(BytesRange::new(Some(1), Some(4))), // [--] ), ( // 0123456789 BytesRange::new(Some(2), Some(4)), // [-] BytesRange::new(None, Some(3)), // <---] Some(BytesRange::new(None, Some(4))), // <----] ), ( // 0123456789 BytesRange::new(Some(2), Some(4)), // [-] BytesRange::new(Some(0), Some(2)), // [-] Some(BytesRange::new(Some(0), Some(4))), // [---] ), ( // 0123456789 BytesRange::new(Some(2), Some(4)), // [-] BytesRange::new(None, Some(2)), // <--] Some(BytesRange::new(None, Some(4))), // <----] ), ( // 0123456789 BytesRange::new(Some(2), Some(4)), // [-] BytesRange::new(Some(0), Some(1)), // [] None, ), ( // 0123456789 BytesRange::new(Some(2), Some(4)), // [-] BytesRange::new(None, Some(1)), // <-] None, ), ( // 0123456789 BytesRange::new(Some(2), Some(4)), // [-] BytesRange::new(None, None), // <----------> Some(BytesRange::new(None, None)), // <----------> ), ( // 0123456789 BytesRange::new(Some(2), None), // [-------> BytesRange::new(Some(4), Some(6)), // [-] Some(BytesRange::new(Some(2), None)), // [-------> ), ( // 0123456789 BytesRange::new(Some(2), None), // [-------> BytesRange::new(Some(4), None), // [-----> Some(BytesRange::new(Some(2), None)), // [-------> ), ( // 0123456789 BytesRange::new(Some(2), None), // [-------> BytesRange::new(Some(2), Some(4)), // [-] Some(BytesRange::new(Some(2), None)), // [-------> ), ( // 0123456789 BytesRange::new(Some(2), None), // [-------> BytesRange::new(Some(2), None), // [-------> Some(BytesRange::new(Some(2), None)), // [-------> ), ( // 0123456789 BytesRange::new(Some(2), None), // [-------> BytesRange::new(Some(1), Some(3)), // [-] Some(BytesRange::new(Some(1), None)), // [--------> ), ( // 0123456789 BytesRange::new(Some(2), None), // [-------> BytesRange::new(None, Some(3)), // <---] Some(BytesRange::new(None, None)), // <----------> ), ( // 0123456789 BytesRange::new(Some(2), None), // [-------> BytesRange::new(Some(0), Some(2)), // [-] Some(BytesRange::new(Some(0), None)), // [---------> ), ( // 0123456789 BytesRange::new(Some(2), None), // [-------> BytesRange::new(None, Some(2)), // <--] Some(BytesRange::new(None, None)), // <----------> ), ( // 0123456789 BytesRange::new(Some(2), None), // [-------> BytesRange::new(Some(0), Some(1)), // [] None, ), ( // 0123456789 BytesRange::new(Some(2), None), // [-------> BytesRange::new(None, Some(1)), // <-] None, ), ( // 0123456789 BytesRange::new(Some(2), None), // [-------> BytesRange::new(None, None), // <----------> Some(BytesRange::new(None, None)), // <----------> ), ( // 0123456789 BytesRange::new(None, None), // <----------> BytesRange::new(None, None), // <----------> Some(BytesRange::new(None, None)), // <----------> ), ]; for (index, (a, b, expected)) in test_cases.iter().enumerate() { println!("Test case {}", index); println!(" {:?}", a); println!(" {:?}", b); println!(" {:?}", expected); if a.overlaps(b) { assert_eq!(*a.clone().merge_with(b), expected.clone().unwrap()); } else { assert!(expected.is_none()) } } } #[test] fn bytes_range_merge_all_when_list_is_empty() { assert_eq!(BytesRange::merge_all(Vec::new()), Vec::new()); } #[test] fn bytes_range_merge_all_when_list_has_one_range() { assert_eq!( BytesRange::merge_all(vec![BytesRange::default()]), vec![BytesRange::default()] ); } #[test] fn bytes_range_merge_all_when_list_has_many_ranges() { let ranges = vec![ BytesRange::new(None, Some(1)), BytesRange::new(Some(1), Some(2)), BytesRange::new(Some(5), Some(6)), BytesRange::new(Some(5), Some(8)), BytesRange::new(Some(6), Some(7)), BytesRange::new(Some(4), Some(5)), BytesRange::new(Some(3), Some(6)), BytesRange::new(Some(10), Some(12)), BytesRange::new(Some(10), Some(12)), BytesRange::new(Some(10), Some(14)), BytesRange::new(Some(14), Some(15)), BytesRange::new(Some(12), Some(16)), BytesRange::new(Some(17), Some(19)), BytesRange::new(Some(21), Some(23)), BytesRange::new(Some(18), Some(22)), BytesRange::new(Some(24), None), BytesRange::new(Some(24), Some(30)), BytesRange::new(Some(31), Some(33)), BytesRange::new(Some(35), None), ]; let expected_ranges = vec![ BytesRange::new(None, Some(2)), BytesRange::new(Some(3), Some(8)), BytesRange::new(Some(10), Some(16)), BytesRange::new(Some(17), Some(23)), BytesRange::new(Some(24), None), ]; assert_eq!(BytesRange::merge_all(ranges), expected_ranges); } }
use std::cell::RefCell; pub struct Ctxt { errors: RefCell<Vec<syn::Error>>, } impl Ctxt { pub fn new() -> Self { Ctxt { errors: RefCell::new(vec![]), } } pub fn push(&self, err: syn::Error) { self.errors.borrow_mut().push(err) } pub fn check(self) -> Result<(), Vec<syn::Error>> { if self.errors.borrow().is_empty() { Ok(()) } else { Err(self.errors.into_inner()) } } }
use sea_orm::{entity::prelude::*, ActiveValue}; use serde::{Deserialize, Serialize}; use crate::seconds_since_epoch; #[derive(Copy, Clone, Default, Debug, DeriveEntity)] pub struct Entity; impl EntityName for Entity { fn table_name(&self) -> &str { "access_token" } } #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Deserialize, Serialize)] pub struct Model { pub id: String, pub token: String, pub name: String, pub scope: String, pub single_use: bool, pub expires_at: i64, pub created_at: i64, pub updated_at: i64, } impl Model { pub fn is_expired(&self) -> bool { self.expires_at != 0 && seconds_since_epoch() > self.expires_at } pub fn has_access_to_scope(&self, scope: Option<&str>) -> bool { match scope { Some(scope) => { let scopes: Vec<&str> = self.scope.split(',').collect(); scopes.contains(&"*") || scopes.contains(&scope) } None => true, } } pub fn is_valid(&self, scope: Option<&str>) -> bool { !self.is_expired() && self.has_access_to_scope(scope) } } #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] pub enum Column { Id, Token, Name, Scope, SingleUse, ExpiresAt, CreatedAt, UpdatedAt, } #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] pub enum PrimaryKey { Id, } impl PrimaryKeyTrait for PrimaryKey { type ValueType = String; fn auto_increment() -> bool { false } } #[derive(Copy, Clone, Debug, EnumIter)] pub enum Relation {} impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { Self::Id => ColumnType::String(None).def().unique(), Self::CreatedAt => ColumnType::BigInteger.def(), Self::UpdatedAt => ColumnType::BigInteger.def(), Self::Token => ColumnType::String(None).def().unique(), Self::Name => ColumnType::String(None).def(), Self::Scope => ColumnType::String(None).def(), Self::SingleUse => ColumnType::Boolean.def(), Self::ExpiresAt => ColumnType::BigInteger.def(), } } } impl RelationTrait for Relation { fn def(&self) -> RelationDef { panic!("No RelationDef") } } impl ActiveModelBehavior for ActiveModel { fn new() -> Self { Self { id: ActiveValue::Set(Uuid::new_v4().to_string()), ..<Self as ActiveModelTrait>::default() } } fn before_save(mut self, insert: bool) -> Result<Self, DbErr> { let now: i64 = seconds_since_epoch(); self.updated_at = ActiveValue::Set(now); if insert { self.created_at = ActiveValue::Set(now); } Ok(self) } }
pub use self::variance::Variance; pub mod variance;
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtGui/qpolygon.h // dst-file: /src/gui/qpolygon.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block begin => // <= main block end // use block begin => use std::ops::Deref; use super::super::core::qrect::*; // 771 use super::super::core::qpoint::*; // 771 // use super::qpolygon::QPolygon; // 773 // <= use block end // ext block begin => // #[link(name = "Qt5Core")] // #[link(name = "Qt5Gui")] // #[link(name = "Qt5Widgets")] // #[link(name = "QtInline")] extern { fn QPolygon_Class_Size() -> c_int; // proto: QRect QPolygon::boundingRect(); fn C_ZNK8QPolygon12boundingRectEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QPolygon::setPoint(int index, int x, int y); fn C_ZN8QPolygon8setPointEiii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: c_int); // proto: void QPolygon::~QPolygon(); fn C_ZN8QPolygonD2Ev(qthis: u64 /* *mut c_void*/); // proto: void QPolygon::putPoints(int index, int nPoints, const QPolygon & from, int fromIndex); fn C_ZN8QPolygon9putPointsEiiRKS_i(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: *mut c_void, arg3: c_int); // proto: QPolygon QPolygon::translated(const QPoint & offset); fn C_ZNK8QPolygon10translatedERK6QPoint(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: QPolygon QPolygon::subtracted(const QPolygon & r); fn C_ZNK8QPolygon10subtractedERKS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: QPolygon QPolygon::intersected(const QPolygon & r); fn C_ZNK8QPolygon11intersectedERKS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: void QPolygon::setPoint(int index, const QPoint & p); fn C_ZN8QPolygon8setPointEiRK6QPoint(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void); // proto: void QPolygon::point(int i, int * x, int * y); fn C_ZNK8QPolygon5pointEiPiS0_(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_int, arg2: *mut c_int); // proto: void QPolygon::translate(int dx, int dy); fn C_ZN8QPolygon9translateEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int); // proto: void QPolygon::putPoints(int index, int nPoints, int firstx, int firsty); fn C_ZN8QPolygon9putPointsEiiiiz(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: c_int, arg3: c_int); // proto: void QPolygon::setPoints(int nPoints, int firstx, int firsty); fn C_ZN8QPolygon9setPointsEiiiz(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: c_int); // proto: void QPolygon::translate(const QPoint & offset); fn C_ZN8QPolygon9translateERK6QPoint(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QPolygon::swap(QPolygon & other); fn C_ZN8QPolygon4swapERS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QPoint QPolygon::point(int i); fn C_ZNK8QPolygon5pointEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: void QPolygon::QPolygon(const QPolygon & a); fn C_ZN8QPolygonC2ERKS_(arg0: *mut c_void) -> u64; // proto: void QPolygon::QPolygon(int nPoints, const int * points); fn C_ZN8QPolygonC2EiPKi(arg0: c_int, arg1: *mut c_int) -> u64; // proto: QPolygon QPolygon::united(const QPolygon & r); fn C_ZNK8QPolygon6unitedERKS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: QPolygon QPolygon::translated(int dx, int dy); fn C_ZNK8QPolygon10translatedEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int) -> *mut c_void; // proto: void QPolygon::putPoints(int index, int nPoints, const int * points); fn C_ZN8QPolygon9putPointsEiiPKi(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: *mut c_int); // proto: void QPolygon::setPoints(int nPoints, const int * points); fn C_ZN8QPolygon9setPointsEiPKi(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_int); // proto: void QPolygon::QPolygon(int size); fn C_ZN8QPolygonC2Ei(arg0: c_int) -> u64; // proto: void QPolygon::QPolygon(); fn C_ZN8QPolygonC2Ev() -> u64; // proto: void QPolygon::QPolygon(const QRect & r, bool closed); fn C_ZN8QPolygonC2ERK5QRectb(arg0: *mut c_void, arg1: c_char) -> u64; fn QPolygonF_Class_Size() -> c_int; // proto: QRectF QPolygonF::boundingRect(); fn C_ZNK9QPolygonF12boundingRectEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QPolygonF QPolygonF::intersected(const QPolygonF & r); fn C_ZNK9QPolygonF11intersectedERKS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: void QPolygonF::QPolygonF(const QPolygon & a); fn C_ZN9QPolygonFC2ERK8QPolygon(arg0: *mut c_void) -> u64; // proto: void QPolygonF::QPolygonF(const QRectF & r); fn C_ZN9QPolygonFC2ERK6QRectF(arg0: *mut c_void) -> u64; // proto: QPolygon QPolygonF::toPolygon(); fn C_ZNK9QPolygonF9toPolygonEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QPolygonF::~QPolygonF(); fn C_ZN9QPolygonFD2Ev(qthis: u64 /* *mut c_void*/); // proto: void QPolygonF::QPolygonF(int size); fn C_ZN9QPolygonFC2Ei(arg0: c_int) -> u64; // proto: QPolygonF QPolygonF::subtracted(const QPolygonF & r); fn C_ZNK9QPolygonF10subtractedERKS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: void QPolygonF::QPolygonF(); fn C_ZN9QPolygonFC2Ev() -> u64; // proto: void QPolygonF::translate(const QPointF & offset); fn C_ZN9QPolygonF9translateERK7QPointF(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QPolygonF::swap(QPolygonF & other); fn C_ZN9QPolygonF4swapERS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QPolygonF QPolygonF::translated(const QPointF & offset); fn C_ZNK9QPolygonF10translatedERK7QPointF(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: void QPolygonF::translate(qreal dx, qreal dy); fn C_ZN9QPolygonF9translateEdd(qthis: u64 /* *mut c_void*/, arg0: c_double, arg1: c_double); // proto: void QPolygonF::QPolygonF(const QPolygonF & a); fn C_ZN9QPolygonFC2ERKS_(arg0: *mut c_void) -> u64; // proto: QPolygonF QPolygonF::translated(qreal dx, qreal dy); fn C_ZNK9QPolygonF10translatedEdd(qthis: u64 /* *mut c_void*/, arg0: c_double, arg1: c_double) -> *mut c_void; // proto: bool QPolygonF::isClosed(); fn C_ZNK9QPolygonF8isClosedEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QPolygonF QPolygonF::united(const QPolygonF & r); fn C_ZNK9QPolygonF6unitedERKS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; } // <= ext block end // body block begin => // class sizeof(QPolygon)=1 #[derive(Default)] pub struct QPolygon { // qbase: None, pub qclsinst: u64 /* *mut c_void*/, } // class sizeof(QPolygonF)=1 #[derive(Default)] pub struct QPolygonF { // qbase: None, pub qclsinst: u64 /* *mut c_void*/, } impl /*struct*/ QPolygon { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QPolygon { return QPolygon{qclsinst: qthis, ..Default::default()}; } } // proto: QRect QPolygon::boundingRect(); impl /*struct*/ QPolygon { pub fn boundingRect<RetType, T: QPolygon_boundingRect<RetType>>(& self, overload_args: T) -> RetType { return overload_args.boundingRect(self); // return 1; } } pub trait QPolygon_boundingRect<RetType> { fn boundingRect(self , rsthis: & QPolygon) -> RetType; } // proto: QRect QPolygon::boundingRect(); impl<'a> /*trait*/ QPolygon_boundingRect<QRect> for () { fn boundingRect(self , rsthis: & QPolygon) -> QRect { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QPolygon12boundingRectEv()}; let mut ret = unsafe {C_ZNK8QPolygon12boundingRectEv(rsthis.qclsinst)}; let mut ret1 = QRect::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QPolygon::setPoint(int index, int x, int y); impl /*struct*/ QPolygon { pub fn setPoint<RetType, T: QPolygon_setPoint<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setPoint(self); // return 1; } } pub trait QPolygon_setPoint<RetType> { fn setPoint(self , rsthis: & QPolygon) -> RetType; } // proto: void QPolygon::setPoint(int index, int x, int y); impl<'a> /*trait*/ QPolygon_setPoint<()> for (i32, i32, i32) { fn setPoint(self , rsthis: & QPolygon) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QPolygon8setPointEiii()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let arg2 = self.2 as c_int; unsafe {C_ZN8QPolygon8setPointEiii(rsthis.qclsinst, arg0, arg1, arg2)}; // return 1; } } // proto: void QPolygon::~QPolygon(); impl /*struct*/ QPolygon { pub fn free<RetType, T: QPolygon_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QPolygon_free<RetType> { fn free(self , rsthis: & QPolygon) -> RetType; } // proto: void QPolygon::~QPolygon(); impl<'a> /*trait*/ QPolygon_free<()> for () { fn free(self , rsthis: & QPolygon) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QPolygonD2Ev()}; unsafe {C_ZN8QPolygonD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: void QPolygon::putPoints(int index, int nPoints, const QPolygon & from, int fromIndex); impl /*struct*/ QPolygon { pub fn putPoints<RetType, T: QPolygon_putPoints<RetType>>(& self, overload_args: T) -> RetType { return overload_args.putPoints(self); // return 1; } } pub trait QPolygon_putPoints<RetType> { fn putPoints(self , rsthis: & QPolygon) -> RetType; } // proto: void QPolygon::putPoints(int index, int nPoints, const QPolygon & from, int fromIndex); impl<'a> /*trait*/ QPolygon_putPoints<()> for (i32, i32, &'a QPolygon, Option<i32>) { fn putPoints(self , rsthis: & QPolygon) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QPolygon9putPointsEiiRKS_i()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let arg2 = self.2.qclsinst as *mut c_void; let arg3 = (if self.3.is_none() {0} else {self.3.unwrap()}) as c_int; unsafe {C_ZN8QPolygon9putPointsEiiRKS_i(rsthis.qclsinst, arg0, arg1, arg2, arg3)}; // return 1; } } // proto: QPolygon QPolygon::translated(const QPoint & offset); impl /*struct*/ QPolygon { pub fn translated<RetType, T: QPolygon_translated<RetType>>(& self, overload_args: T) -> RetType { return overload_args.translated(self); // return 1; } } pub trait QPolygon_translated<RetType> { fn translated(self , rsthis: & QPolygon) -> RetType; } // proto: QPolygon QPolygon::translated(const QPoint & offset); impl<'a> /*trait*/ QPolygon_translated<QPolygon> for (&'a QPoint) { fn translated(self , rsthis: & QPolygon) -> QPolygon { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QPolygon10translatedERK6QPoint()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK8QPolygon10translatedERK6QPoint(rsthis.qclsinst, arg0)}; let mut ret1 = QPolygon::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QPolygon QPolygon::subtracted(const QPolygon & r); impl /*struct*/ QPolygon { pub fn subtracted<RetType, T: QPolygon_subtracted<RetType>>(& self, overload_args: T) -> RetType { return overload_args.subtracted(self); // return 1; } } pub trait QPolygon_subtracted<RetType> { fn subtracted(self , rsthis: & QPolygon) -> RetType; } // proto: QPolygon QPolygon::subtracted(const QPolygon & r); impl<'a> /*trait*/ QPolygon_subtracted<QPolygon> for (&'a QPolygon) { fn subtracted(self , rsthis: & QPolygon) -> QPolygon { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QPolygon10subtractedERKS_()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK8QPolygon10subtractedERKS_(rsthis.qclsinst, arg0)}; let mut ret1 = QPolygon::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QPolygon QPolygon::intersected(const QPolygon & r); impl /*struct*/ QPolygon { pub fn intersected<RetType, T: QPolygon_intersected<RetType>>(& self, overload_args: T) -> RetType { return overload_args.intersected(self); // return 1; } } pub trait QPolygon_intersected<RetType> { fn intersected(self , rsthis: & QPolygon) -> RetType; } // proto: QPolygon QPolygon::intersected(const QPolygon & r); impl<'a> /*trait*/ QPolygon_intersected<QPolygon> for (&'a QPolygon) { fn intersected(self , rsthis: & QPolygon) -> QPolygon { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QPolygon11intersectedERKS_()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK8QPolygon11intersectedERKS_(rsthis.qclsinst, arg0)}; let mut ret1 = QPolygon::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QPolygon::setPoint(int index, const QPoint & p); impl<'a> /*trait*/ QPolygon_setPoint<()> for (i32, &'a QPoint) { fn setPoint(self , rsthis: & QPolygon) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QPolygon8setPointEiRK6QPoint()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; unsafe {C_ZN8QPolygon8setPointEiRK6QPoint(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: void QPolygon::point(int i, int * x, int * y); impl /*struct*/ QPolygon { pub fn point<RetType, T: QPolygon_point<RetType>>(& self, overload_args: T) -> RetType { return overload_args.point(self); // return 1; } } pub trait QPolygon_point<RetType> { fn point(self , rsthis: & QPolygon) -> RetType; } // proto: void QPolygon::point(int i, int * x, int * y); impl<'a> /*trait*/ QPolygon_point<()> for (i32, &'a mut Vec<i32>, &'a mut Vec<i32>) { fn point(self , rsthis: & QPolygon) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QPolygon5pointEiPiS0_()}; let arg0 = self.0 as c_int; let arg1 = self.1.as_ptr() as *mut c_int; let arg2 = self.2.as_ptr() as *mut c_int; unsafe {C_ZNK8QPolygon5pointEiPiS0_(rsthis.qclsinst, arg0, arg1, arg2)}; // return 1; } } // proto: void QPolygon::translate(int dx, int dy); impl /*struct*/ QPolygon { pub fn translate<RetType, T: QPolygon_translate<RetType>>(& self, overload_args: T) -> RetType { return overload_args.translate(self); // return 1; } } pub trait QPolygon_translate<RetType> { fn translate(self , rsthis: & QPolygon) -> RetType; } // proto: void QPolygon::translate(int dx, int dy); impl<'a> /*trait*/ QPolygon_translate<()> for (i32, i32) { fn translate(self , rsthis: & QPolygon) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QPolygon9translateEii()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; unsafe {C_ZN8QPolygon9translateEii(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: void QPolygon::putPoints(int index, int nPoints, int firstx, int firsty); impl<'a> /*trait*/ QPolygon_putPoints<()> for (i32, i32, i32, i32) { fn putPoints(self , rsthis: & QPolygon) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QPolygon9putPointsEiiiiz()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let arg2 = self.2 as c_int; let arg3 = self.3 as c_int; unsafe {C_ZN8QPolygon9putPointsEiiiiz(rsthis.qclsinst, arg0, arg1, arg2, arg3)}; // return 1; } } // proto: void QPolygon::setPoints(int nPoints, int firstx, int firsty); impl /*struct*/ QPolygon { pub fn setPoints<RetType, T: QPolygon_setPoints<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setPoints(self); // return 1; } } pub trait QPolygon_setPoints<RetType> { fn setPoints(self , rsthis: & QPolygon) -> RetType; } // proto: void QPolygon::setPoints(int nPoints, int firstx, int firsty); impl<'a> /*trait*/ QPolygon_setPoints<()> for (i32, i32, i32) { fn setPoints(self , rsthis: & QPolygon) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QPolygon9setPointsEiiiz()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let arg2 = self.2 as c_int; unsafe {C_ZN8QPolygon9setPointsEiiiz(rsthis.qclsinst, arg0, arg1, arg2)}; // return 1; } } // proto: void QPolygon::translate(const QPoint & offset); impl<'a> /*trait*/ QPolygon_translate<()> for (&'a QPoint) { fn translate(self , rsthis: & QPolygon) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QPolygon9translateERK6QPoint()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN8QPolygon9translateERK6QPoint(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QPolygon::swap(QPolygon & other); impl /*struct*/ QPolygon { pub fn swap<RetType, T: QPolygon_swap<RetType>>(& self, overload_args: T) -> RetType { return overload_args.swap(self); // return 1; } } pub trait QPolygon_swap<RetType> { fn swap(self , rsthis: & QPolygon) -> RetType; } // proto: void QPolygon::swap(QPolygon & other); impl<'a> /*trait*/ QPolygon_swap<()> for (&'a QPolygon) { fn swap(self , rsthis: & QPolygon) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QPolygon4swapERS_()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN8QPolygon4swapERS_(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QPoint QPolygon::point(int i); impl<'a> /*trait*/ QPolygon_point<QPoint> for (i32) { fn point(self , rsthis: & QPolygon) -> QPoint { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QPolygon5pointEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK8QPolygon5pointEi(rsthis.qclsinst, arg0)}; let mut ret1 = QPoint::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QPolygon::QPolygon(const QPolygon & a); impl /*struct*/ QPolygon { pub fn new<T: QPolygon_new>(value: T) -> QPolygon { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QPolygon_new { fn new(self) -> QPolygon; } // proto: void QPolygon::QPolygon(const QPolygon & a); impl<'a> /*trait*/ QPolygon_new for (&'a QPolygon) { fn new(self) -> QPolygon { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QPolygonC2ERKS_()}; let ctysz: c_int = unsafe{QPolygon_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.qclsinst as *mut c_void; let qthis: u64 = unsafe {C_ZN8QPolygonC2ERKS_(arg0)}; let rsthis = QPolygon{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QPolygon::QPolygon(int nPoints, const int * points); impl<'a> /*trait*/ QPolygon_new for (i32, &'a Vec<i32>) { fn new(self) -> QPolygon { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QPolygonC2EiPKi()}; let ctysz: c_int = unsafe{QPolygon_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.0 as c_int; let arg1 = self.1.as_ptr() as *mut c_int; let qthis: u64 = unsafe {C_ZN8QPolygonC2EiPKi(arg0, arg1)}; let rsthis = QPolygon{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: QPolygon QPolygon::united(const QPolygon & r); impl /*struct*/ QPolygon { pub fn united<RetType, T: QPolygon_united<RetType>>(& self, overload_args: T) -> RetType { return overload_args.united(self); // return 1; } } pub trait QPolygon_united<RetType> { fn united(self , rsthis: & QPolygon) -> RetType; } // proto: QPolygon QPolygon::united(const QPolygon & r); impl<'a> /*trait*/ QPolygon_united<QPolygon> for (&'a QPolygon) { fn united(self , rsthis: & QPolygon) -> QPolygon { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QPolygon6unitedERKS_()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK8QPolygon6unitedERKS_(rsthis.qclsinst, arg0)}; let mut ret1 = QPolygon::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QPolygon QPolygon::translated(int dx, int dy); impl<'a> /*trait*/ QPolygon_translated<QPolygon> for (i32, i32) { fn translated(self , rsthis: & QPolygon) -> QPolygon { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK8QPolygon10translatedEii()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let mut ret = unsafe {C_ZNK8QPolygon10translatedEii(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QPolygon::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QPolygon::putPoints(int index, int nPoints, const int * points); impl<'a> /*trait*/ QPolygon_putPoints<()> for (i32, i32, &'a Vec<i32>) { fn putPoints(self , rsthis: & QPolygon) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QPolygon9putPointsEiiPKi()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let arg2 = self.2.as_ptr() as *mut c_int; unsafe {C_ZN8QPolygon9putPointsEiiPKi(rsthis.qclsinst, arg0, arg1, arg2)}; // return 1; } } // proto: void QPolygon::setPoints(int nPoints, const int * points); impl<'a> /*trait*/ QPolygon_setPoints<()> for (i32, &'a Vec<i32>) { fn setPoints(self , rsthis: & QPolygon) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QPolygon9setPointsEiPKi()}; let arg0 = self.0 as c_int; let arg1 = self.1.as_ptr() as *mut c_int; unsafe {C_ZN8QPolygon9setPointsEiPKi(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: void QPolygon::QPolygon(int size); impl<'a> /*trait*/ QPolygon_new for (i32) { fn new(self) -> QPolygon { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QPolygonC2Ei()}; let ctysz: c_int = unsafe{QPolygon_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self as c_int; let qthis: u64 = unsafe {C_ZN8QPolygonC2Ei(arg0)}; let rsthis = QPolygon{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QPolygon::QPolygon(); impl<'a> /*trait*/ QPolygon_new for () { fn new(self) -> QPolygon { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QPolygonC2Ev()}; let ctysz: c_int = unsafe{QPolygon_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let qthis: u64 = unsafe {C_ZN8QPolygonC2Ev()}; let rsthis = QPolygon{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QPolygon::QPolygon(const QRect & r, bool closed); impl<'a> /*trait*/ QPolygon_new for (&'a QRect, Option<i8>) { fn new(self) -> QPolygon { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN8QPolygonC2ERK5QRectb()}; let ctysz: c_int = unsafe{QPolygon_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {false as i8} else {self.1.unwrap()}) as c_char; let qthis: u64 = unsafe {C_ZN8QPolygonC2ERK5QRectb(arg0, arg1)}; let rsthis = QPolygon{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } impl /*struct*/ QPolygonF { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QPolygonF { return QPolygonF{qclsinst: qthis, ..Default::default()}; } } // proto: QRectF QPolygonF::boundingRect(); impl /*struct*/ QPolygonF { pub fn boundingRect<RetType, T: QPolygonF_boundingRect<RetType>>(& self, overload_args: T) -> RetType { return overload_args.boundingRect(self); // return 1; } } pub trait QPolygonF_boundingRect<RetType> { fn boundingRect(self , rsthis: & QPolygonF) -> RetType; } // proto: QRectF QPolygonF::boundingRect(); impl<'a> /*trait*/ QPolygonF_boundingRect<QRectF> for () { fn boundingRect(self , rsthis: & QPolygonF) -> QRectF { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QPolygonF12boundingRectEv()}; let mut ret = unsafe {C_ZNK9QPolygonF12boundingRectEv(rsthis.qclsinst)}; let mut ret1 = QRectF::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QPolygonF QPolygonF::intersected(const QPolygonF & r); impl /*struct*/ QPolygonF { pub fn intersected<RetType, T: QPolygonF_intersected<RetType>>(& self, overload_args: T) -> RetType { return overload_args.intersected(self); // return 1; } } pub trait QPolygonF_intersected<RetType> { fn intersected(self , rsthis: & QPolygonF) -> RetType; } // proto: QPolygonF QPolygonF::intersected(const QPolygonF & r); impl<'a> /*trait*/ QPolygonF_intersected<QPolygonF> for (&'a QPolygonF) { fn intersected(self , rsthis: & QPolygonF) -> QPolygonF { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QPolygonF11intersectedERKS_()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK9QPolygonF11intersectedERKS_(rsthis.qclsinst, arg0)}; let mut ret1 = QPolygonF::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QPolygonF::QPolygonF(const QPolygon & a); impl /*struct*/ QPolygonF { pub fn new<T: QPolygonF_new>(value: T) -> QPolygonF { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QPolygonF_new { fn new(self) -> QPolygonF; } // proto: void QPolygonF::QPolygonF(const QPolygon & a); impl<'a> /*trait*/ QPolygonF_new for (&'a QPolygon) { fn new(self) -> QPolygonF { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QPolygonFC2ERK8QPolygon()}; let ctysz: c_int = unsafe{QPolygonF_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.qclsinst as *mut c_void; let qthis: u64 = unsafe {C_ZN9QPolygonFC2ERK8QPolygon(arg0)}; let rsthis = QPolygonF{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QPolygonF::QPolygonF(const QRectF & r); impl<'a> /*trait*/ QPolygonF_new for (&'a QRectF) { fn new(self) -> QPolygonF { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QPolygonFC2ERK6QRectF()}; let ctysz: c_int = unsafe{QPolygonF_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.qclsinst as *mut c_void; let qthis: u64 = unsafe {C_ZN9QPolygonFC2ERK6QRectF(arg0)}; let rsthis = QPolygonF{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: QPolygon QPolygonF::toPolygon(); impl /*struct*/ QPolygonF { pub fn toPolygon<RetType, T: QPolygonF_toPolygon<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toPolygon(self); // return 1; } } pub trait QPolygonF_toPolygon<RetType> { fn toPolygon(self , rsthis: & QPolygonF) -> RetType; } // proto: QPolygon QPolygonF::toPolygon(); impl<'a> /*trait*/ QPolygonF_toPolygon<QPolygon> for () { fn toPolygon(self , rsthis: & QPolygonF) -> QPolygon { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QPolygonF9toPolygonEv()}; let mut ret = unsafe {C_ZNK9QPolygonF9toPolygonEv(rsthis.qclsinst)}; let mut ret1 = QPolygon::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QPolygonF::~QPolygonF(); impl /*struct*/ QPolygonF { pub fn free<RetType, T: QPolygonF_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QPolygonF_free<RetType> { fn free(self , rsthis: & QPolygonF) -> RetType; } // proto: void QPolygonF::~QPolygonF(); impl<'a> /*trait*/ QPolygonF_free<()> for () { fn free(self , rsthis: & QPolygonF) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QPolygonFD2Ev()}; unsafe {C_ZN9QPolygonFD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: void QPolygonF::QPolygonF(int size); impl<'a> /*trait*/ QPolygonF_new for (i32) { fn new(self) -> QPolygonF { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QPolygonFC2Ei()}; let ctysz: c_int = unsafe{QPolygonF_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self as c_int; let qthis: u64 = unsafe {C_ZN9QPolygonFC2Ei(arg0)}; let rsthis = QPolygonF{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: QPolygonF QPolygonF::subtracted(const QPolygonF & r); impl /*struct*/ QPolygonF { pub fn subtracted<RetType, T: QPolygonF_subtracted<RetType>>(& self, overload_args: T) -> RetType { return overload_args.subtracted(self); // return 1; } } pub trait QPolygonF_subtracted<RetType> { fn subtracted(self , rsthis: & QPolygonF) -> RetType; } // proto: QPolygonF QPolygonF::subtracted(const QPolygonF & r); impl<'a> /*trait*/ QPolygonF_subtracted<QPolygonF> for (&'a QPolygonF) { fn subtracted(self , rsthis: & QPolygonF) -> QPolygonF { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QPolygonF10subtractedERKS_()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK9QPolygonF10subtractedERKS_(rsthis.qclsinst, arg0)}; let mut ret1 = QPolygonF::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QPolygonF::QPolygonF(); impl<'a> /*trait*/ QPolygonF_new for () { fn new(self) -> QPolygonF { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QPolygonFC2Ev()}; let ctysz: c_int = unsafe{QPolygonF_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let qthis: u64 = unsafe {C_ZN9QPolygonFC2Ev()}; let rsthis = QPolygonF{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QPolygonF::translate(const QPointF & offset); impl /*struct*/ QPolygonF { pub fn translate<RetType, T: QPolygonF_translate<RetType>>(& self, overload_args: T) -> RetType { return overload_args.translate(self); // return 1; } } pub trait QPolygonF_translate<RetType> { fn translate(self , rsthis: & QPolygonF) -> RetType; } // proto: void QPolygonF::translate(const QPointF & offset); impl<'a> /*trait*/ QPolygonF_translate<()> for (&'a QPointF) { fn translate(self , rsthis: & QPolygonF) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QPolygonF9translateERK7QPointF()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QPolygonF9translateERK7QPointF(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QPolygonF::swap(QPolygonF & other); impl /*struct*/ QPolygonF { pub fn swap<RetType, T: QPolygonF_swap<RetType>>(& self, overload_args: T) -> RetType { return overload_args.swap(self); // return 1; } } pub trait QPolygonF_swap<RetType> { fn swap(self , rsthis: & QPolygonF) -> RetType; } // proto: void QPolygonF::swap(QPolygonF & other); impl<'a> /*trait*/ QPolygonF_swap<()> for (&'a QPolygonF) { fn swap(self , rsthis: & QPolygonF) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QPolygonF4swapERS_()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QPolygonF4swapERS_(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QPolygonF QPolygonF::translated(const QPointF & offset); impl /*struct*/ QPolygonF { pub fn translated<RetType, T: QPolygonF_translated<RetType>>(& self, overload_args: T) -> RetType { return overload_args.translated(self); // return 1; } } pub trait QPolygonF_translated<RetType> { fn translated(self , rsthis: & QPolygonF) -> RetType; } // proto: QPolygonF QPolygonF::translated(const QPointF & offset); impl<'a> /*trait*/ QPolygonF_translated<QPolygonF> for (&'a QPointF) { fn translated(self , rsthis: & QPolygonF) -> QPolygonF { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QPolygonF10translatedERK7QPointF()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK9QPolygonF10translatedERK7QPointF(rsthis.qclsinst, arg0)}; let mut ret1 = QPolygonF::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QPolygonF::translate(qreal dx, qreal dy); impl<'a> /*trait*/ QPolygonF_translate<()> for (f64, f64) { fn translate(self , rsthis: & QPolygonF) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QPolygonF9translateEdd()}; let arg0 = self.0 as c_double; let arg1 = self.1 as c_double; unsafe {C_ZN9QPolygonF9translateEdd(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: void QPolygonF::QPolygonF(const QPolygonF & a); impl<'a> /*trait*/ QPolygonF_new for (&'a QPolygonF) { fn new(self) -> QPolygonF { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QPolygonFC2ERKS_()}; let ctysz: c_int = unsafe{QPolygonF_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.qclsinst as *mut c_void; let qthis: u64 = unsafe {C_ZN9QPolygonFC2ERKS_(arg0)}; let rsthis = QPolygonF{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: QPolygonF QPolygonF::translated(qreal dx, qreal dy); impl<'a> /*trait*/ QPolygonF_translated<QPolygonF> for (f64, f64) { fn translated(self , rsthis: & QPolygonF) -> QPolygonF { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QPolygonF10translatedEdd()}; let arg0 = self.0 as c_double; let arg1 = self.1 as c_double; let mut ret = unsafe {C_ZNK9QPolygonF10translatedEdd(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QPolygonF::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QPolygonF::isClosed(); impl /*struct*/ QPolygonF { pub fn isClosed<RetType, T: QPolygonF_isClosed<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isClosed(self); // return 1; } } pub trait QPolygonF_isClosed<RetType> { fn isClosed(self , rsthis: & QPolygonF) -> RetType; } // proto: bool QPolygonF::isClosed(); impl<'a> /*trait*/ QPolygonF_isClosed<i8> for () { fn isClosed(self , rsthis: & QPolygonF) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QPolygonF8isClosedEv()}; let mut ret = unsafe {C_ZNK9QPolygonF8isClosedEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QPolygonF QPolygonF::united(const QPolygonF & r); impl /*struct*/ QPolygonF { pub fn united<RetType, T: QPolygonF_united<RetType>>(& self, overload_args: T) -> RetType { return overload_args.united(self); // return 1; } } pub trait QPolygonF_united<RetType> { fn united(self , rsthis: & QPolygonF) -> RetType; } // proto: QPolygonF QPolygonF::united(const QPolygonF & r); impl<'a> /*trait*/ QPolygonF_united<QPolygonF> for (&'a QPolygonF) { fn united(self , rsthis: & QPolygonF) -> QPolygonF { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QPolygonF6unitedERKS_()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK9QPolygonF6unitedERKS_(rsthis.qclsinst, arg0)}; let mut ret1 = QPolygonF::inheritFrom(ret as u64); return ret1; // return 1; } } // <= body block end
/// Error Function Trait /// /// Implementation based on [Netlib Specfun 2.5](http://www.netlib.org/specfun/) /// /// Translated from Fortran March 2019 /// /// ## References /// - Cody, W. (1990), Performance evaluation of programs for the error /// and complementary error functions, ACM Transactions on Mathematical /// Software (TOMS), 16(1), 29–37. /// pub trait ErrorFunction { /// Computes the Error Function fn erf(self) -> Self ; /// Computes Complementary Error Function fn erfc(self) -> Self ; /// Computes exp(x^2) * erfc(x). fn erfcx(self) -> Self ; } impl ErrorFunction for f64 { fn erf(self) -> Self { crate::fad::erf(self) } fn erfc(self) -> Self { crate::fad::erfc(self) } fn erfcx(self) -> Self { crate::fad::erfcx(self) } } #[derive(PartialEq)] enum ErfKind { Erf, Erfc, Erfcx, } fn calerf(arg: f64, kind: ErfKind) -> f64 { //------------------------------------------------------------------ // // This packet evaluates erf(x), erfc(x), and exp(x*x)*erfc(x) // for a real argument x. It contains three FUNCTION type // subprograms: ERF, ERFC, and ERFCX (or DERF, DERFC, and DERFCX), // and one SUBROUTINE type subprogram, CALERF. The calling // statements for the primary entries are: // // Y=ERF(X) (or Y=DERF(X)), // // Y=ERFC(X) (or Y=DERFC(X)), // and // Y=ERFCX(X) (or Y=DERFCX(X)). // // The routine CALERF is intended for internal packet use only, // all computations within the packet being concentrated in this // routine. The function subprograms invoke CALERF with the // statement // // CALL CALERF(ARG,RESULT,JINT) // // where the parameter usage is as follows // // Function Parameters for CALERF // call ARG Result JINT // // ERF(ARG) ANY REAL ARGUMENT ERF(ARG) 0 // ERFC(ARG) ABS(ARG) .LT. XBIG ERFC(ARG) 1 // ERFCX(ARG) XNEG .LT. ARG .LT. XMAX ERFCX(ARG) 2 // // The main computation evaluates near-minimax approximations // from "Rational Chebyshev approximations for the error function" // by W. J. Cody, Math. Comp., 1969, PP. 631-638. This // transportable program uses rational functions that theoretically // approximate erf(x) and erfc(x) to at least 18 significant // decimal digits. The accuracy achieved depends on the arithmetic // system, the compiler, the intrinsic functions, and proper // selection of the machine-dependent constants. // //******************************************************************* //******************************************************************* // // Explanation of machine-dependent constants // // XMIN = the smallest positive floating-point number. // XINF = the largest positive finite floating-point number. // XNEG = the largest negative argument acceptable to ERFCX; // the negative of the solution to the equation // 2*exp(x*x) = XINF. // XSMALL = argument below which erf(x) may be represented by // 2*x/sqrt(pi) and above which x*x will not underflow. // A conservative value is the largest machine number X // such that 1.0 + X = 1.0 to machine precision. // XBIG = largest argument acceptable to ERFC; solution to // the equation: W(x) * (1-0.5/x**2) = XMIN, where // W(x) = exp(-x*x)/[x*sqrt(pi)]. // XHUGE = argument above which 1.0 - 1/(2*x*x) = 1.0 to // machine precision. A conservative value is // 1/[2*sqrt(XSMALL)] // XMAX = largest acceptable argument to ERFCX; the minimum // of XINF and 1/[sqrt(pi)*XMIN]. // // Approximate values for some important machines are: // // XMIN XINF XNEG XSMALL // // CDC 7600 (S.P.) 3.13E-294 1.26E+322 -27.220 7.11E-15 // CRAY-1 (S.P.) 4.58E-2467 5.45E+2465 -75.345 7.11E-15 // IEEE (IBM/XT, // SUN, etc.) (S.P.) 1.18E-38 3.40E+38 -9.382 5.96E-8 // IEEE (IBM/XT, // SUN, etc.) (D.P.) 2.23D-308 1.79D+308 -26.628 1.11D-16 // IBM 195 (D.P.) 5.40D-79 7.23E+75 -13.190 1.39D-17 // UNIVAC 1108 (D.P.) 2.78D-309 8.98D+307 -26.615 1.73D-18 // VAX D-Format (D.P.) 2.94D-39 1.70D+38 -9.345 1.39D-17 // VAX G-Format (D.P.) 5.56D-309 8.98D+307 -26.615 1.11D-16 // // // XBIG XHUGE XMAX // // CDC 7600 (S.P.) 25.922 8.39E+6 1.80X+293 // CRAY-1 (S.P.) 75.326 8.39E+6 5.45E+2465 // IEEE (IBM/XT, // SUN, etc.) (S.P.) 9.194 2.90E+3 4.79E+37 // IEEE (IBM/XT, // SUN, etc.) (D.P.) 26.543 6.71D+7 2.53D+307 // IBM 195 (D.P.) 13.306 1.90D+8 7.23E+75 // UNIVAC 1108 (D.P.) 26.582 5.37D+8 8.98D+307 // VAX D-Format (D.P.) 9.269 1.90D+8 1.70D+38 // VAX G-Format (D.P.) 26.569 6.71D+7 8.98D+307 // //******************************************************************* //******************************************************************* // // Error returns // // The program returns ERFC = 0 for ARG .GE. XBIG; // // ERFCX = XINF for ARG .LT. XNEG; // and // ERFCX = 0 for ARG .GE. XMAX. // // Intrinsic functions required are: // // ABS, AINT, EXP // // Author: W. J. Cody // Mathematics and Computer Science Division // Argonne National Laboratory // Argonne, IL 60439 // // Latest modification: March 19, 1990 // // INTEGER I,JINT // DOUBLE PRECISION // 1 A,ARG,B,C,D,DEL,FOUR,HALF,P,ONE,Q,RESULT,SIXTEN,SQRPI, // 2 TWO,THRESH,X,XBIG,XDEN,XHUGE,XINF,XMAX,XNEG,XNUM,XSMALL, // 3 Y,YSQ,ZERO // DIMENSION A(5),B(4),C(9),D(8),P(6),Q(5) //------------------------------------------------------------------ // Mathematical constants //------------------------------------------------------------------ //S DATA FOUR,ONE,HALF,TWO,ZERO/4.0E0,1.0E0,0.5E0,2.0E0,0.0E0/, //S 1 SQRPI/5.6418958354775628695E-1/,THRESH/0.46875E0/, //S 2 SIXTEN/16.0E0/ // DATA FOUR,ONE,HALF,TWO,ZERO/4.0D0,1.0D0,0.5D0,2.0D0,0.0D0/, // 1 SQRPI/5.6418958354775628695D-1/,THRESH/0.46875D0/, // 2 SIXTEN/16.0D0/ let one = 1.0; let two = 2.0; let zero = 0.0; let half = 0.5; let thresh = 0.46875; let four = 4.0; let sixten = 16.0; let sqrpi = 5.6418958354775628695e-1; // 1/sqrt(pi) //------------------------------------------------------------------ // Machine-dependent constants //------------------------------------------------------------------ //S DATA XINF,XNEG,XSMALL/3.40E+38,-9.382E0,5.96E-8/, //S 1 XBIG,XHUGE,XMAX/9.194E0,2.90E3,4.79E37/ // DATA XINF,XNEG,XSMALL/1.79D308,-26.628D0,1.11D-16/, // 1 XBIG,XHUGE,XMAX/26.543D0,6.71D7,2.53D307/ let xinf = 1.79e308; let xneg = -26.628e0; let xsmall = 1.11e-16; let xbig = 26.543e0; let xhuge = 6.71e7; let xmax = 2.53e307; //------------------------------------------------------------------ // Coefficients for approximation to erf in first interval //------------------------------------------------------------------ //S DATA A/3.16112374387056560E00,1.13864154151050156E02, //S 1 3.77485237685302021E02,3.20937758913846947E03, //S 2 1.85777706184603153E-1/ //S DATA B/2.36012909523441209E01,2.44024637934444173E02, //S 1 1.28261652607737228E03,2.84423683343917062E03/ let a = [3.16112374387056560e00,1.13864154151050156e02, 3.77485237685302021e02,3.20937758913846947e03, 1.85777706184603153e-1]; let b = [2.36012909523441209e01,2.44024637934444173e02, 1.28261652607737228e03,2.84423683343917062e03]; //------------------------------------------------------------------ // Coefficients for approximation to erfc in second interval //------------------------------------------------------------------ //S DATA C/5.64188496988670089E-1,8.88314979438837594E0, //S 1 6.61191906371416295E01,2.98635138197400131E02, //S 2 8.81952221241769090E02,1.71204761263407058E03, //S 3 2.05107837782607147E03,1.23033935479799725E03, //S 4 2.15311535474403846E-8/ //S DATA D/1.57449261107098347E01,1.17693950891312499E02, //S 1 5.37181101862009858E02,1.62138957456669019E03, //S 2 3.29079923573345963E03,4.36261909014324716E03, //S 3 3.43936767414372164E03,1.23033935480374942E03/ let c = [5.64188496988670089e-1,8.88314979438837594e0, 6.61191906371416295e01,2.98635138197400131e02, 8.81952221241769090e02,1.71204761263407058e03, 2.05107837782607147e03,1.23033935479799725e03, 2.15311535474403846e-8]; let d = [1.57449261107098347e01,1.17693950891312499e02, 5.37181101862009858e02,1.62138957456669019e03, 3.29079923573345963e03,4.36261909014324716e03, 3.43936767414372164e03,1.23033935480374942e03]; //------------------------------------------------------------------ // Coefficients for approximation to erfc in third interval //------------------------------------------------------------------ //S DATA P/3.05326634961232344E-1,3.60344899949804439E-1, //S 1 1.25781726111229246E-1,1.60837851487422766E-2, //S 2 6.58749161529837803E-4,1.63153871373020978E-2/ //S DATA Q/2.56852019228982242E00,1.87295284992346047E00, //S 1 5.27905102951428412E-1,6.05183413124413191E-2, //S 2 2.33520497626869185E-3/ let p = [3.05326634961232344e-1,3.60344899949804439e-1, 1.25781726111229246e-1,1.60837851487422766e-2, 6.58749161529837803e-4,1.63153871373020978e-2]; let q = [2.56852019228982242e00,1.87295284992346047e00, 5.27905102951428412e-1,6.05183413124413191e-2, 2.33520497626869185e-3]; //------------------------------------------------------------------ let x = arg; let y = x.abs(); let mut result = 0.0; if y <= thresh { // // Evaluate erf for |X| <= 0.46875 // let mut ysq = 0.0; if y > xsmall { ysq = y * y } let mut xnum = a[5-1]*ysq; let mut xden = ysq; for i in 0 .. 3 { xnum = (xnum + a[i]) * ysq; xden = (xden + b[i]) * ysq; } result = x * (xnum + a[4-1]) / (xden + b[4-1]); if kind != ErfKind::Erf { result = one - result; } if kind == ErfKind::Erfcx { result = ysq.exp() * result; } return result; } else if y <= four { // // Evaluate erfc for 0.46875 <= |X| <= 4.0 // let mut xnum = c[9-1]*y; let mut xden = y; for i in 0 .. 7 { xnum = (xnum + c[i]) * y; xden = (xden + d[i]) * y; } result = (xnum + c[8-1]) / (xden + d[8-1]); if kind != ErfKind::Erfcx { let ysq = (y*sixten).trunc()/sixten; let del = (y-ysq)*(y+ysq); result = (-ysq*ysq).exp() * (-del).exp() * result; } } else { // // Evaluate erfc for |X| > 4.0 // let mut goto_300 = false; if y >= xbig { if kind != ErfKind::Erfcx || y >= xmax { goto_300 = true; } if y >= xhuge { result = sqrpi / y; //go to 300 goto_300 = true; } } if ! goto_300 { let ysq = one / (y * y); let mut xnum = p[6-1]*ysq; let mut xden = ysq; for i in 0 .. 4 { xnum = (xnum + p[i]) * ysq; xden = (xden + q[i]) * ysq; } result = ysq *(xnum + p[5-1]) / (xden + q[5-1]); result = (sqrpi - result) / y; if kind != ErfKind::Erfcx { let ysq = (y*sixten).trunc()/sixten; let del = (y-ysq)*(y+ysq); result = (-ysq*ysq).exp() * (-del).exp() * result; } } } // // Fix up for negative argument, erf, etc. // if kind == ErfKind::Erf { // line 300 result = (half - result) + half; if x < zero { result = -result; } } else if kind == ErfKind::Erfc { if x < zero { result = two - result } } else { // ErfKind::Erfcx if x < zero { if x < xneg { result = xinf; } else { let ysq = (x*sixten).trunc()/sixten; let del = (x-ysq)*(x+ysq); let y = (ysq*ysq).exp() * del.exp(); result = (y+y) - result; } } } result } // This subprogram computes approximate values for erf(x). // (see comments heading CALERF). // // Author/date: W. J. Cody, January 8, 1985 pub fn erf(x: f64) -> f64 { calerf(x,ErfKind::Erf) } // This subprogram computes approximate values for erfc(x). // (see comments heading CALERF). // // Author/date: W. J. Cody, January 8, 1985 pub fn erfc(x: f64) -> f64 { calerf(x, ErfKind::Erfc) } // This subprogram computes approximate values for exp(x*x) * erfc(x). // (see comments heading CALERF). // // Author/date: W. J. Cody, March 30, 1987 pub fn erfcx(x: f64) -> f64 { calerf(x, ErfKind::Erfcx) } #[cfg(test)] mod tests { //use crate::erf::ErrorFunction; // use special_fun::FloatSpecial; // #[test] // fn erf_cephes_test() { // let eps = 1.5 * std::f64::EPSILON; // // Check vs special_fun::erf() (Cephes C library Wrapper) // let scale = 1000000; // for i in 0 .. 27 * scale { // let v = i as f64 / scale as f64; // if v > 26.641 { // break; // } // let a = v.erf(); // let b = crate::erf::erf( v ); // assert!((a-b).abs() <= eps, "{} != {} [{:e}] {:e}", a,b,(a-b).abs(), eps); // } // } // #[test] // fn erfc_cephes_test() { // let eps = 2.0 * std::f64::EPSILON; // // Check vs special_fun::erfc() (Cephes C library Wrapper) // let scale = 1000000; // for i in 0 .. 27 * scale { // let v = i as f64 / scale as f64; // if v > 26.641 { // break; // } // let a = v.erfc(); // let b = crate::erf::erfc( v ); // assert!((a-b).abs() <= eps, "{} != {} [{:e}] {:e}", a,b,(a-b).abs(), eps); // } // } #[inline] fn conv<T>(v: T) -> f64 where f64: std::convert::From<T> { f64::from(v) } #[inline] fn max<T: PartialOrd>(a: T, b: T) -> T { if a >= b { a } else { b } } #[inline] fn min<T: PartialOrd>(a: T, b: T) -> T { if a <= b { a } else { b } } fn ren(k: i64) -> f64 { //--------------------------------------------------------------------- // random number generator - based on algorithm 266 by pike and // hill (modified by hansson), communications of the acm, // vol. 8, no. 10, october 1965. // // this subprogram is intended for use on computers with // fixed point wordlength of at least 29 bits. it is // best if the floating-point significand has at most // 29 bits. // // latest modification: may 30, 1989 // // author: w. j. cody // mathematics and computer science division // argonne national laboratory // argonne, il 60439 let one = 1.0; let c1 = 2796203.0e0; let c2 = 1.0e-6; let c3 = 1.0e-12; let iy = 100001; let _j = k; let iy = iy * 125; let iy = iy - (iy/2796203) * 2796203; let ren = conv(iy) / c1 * (one + c2 + c3); ren } #[test] fn erftst() { let ibeta = std::f64::RADIX; let it = std::f64::MANTISSA_DIGITS; let eps = std::f64::EPSILON; let xmin = std::f64::MIN_POSITIVE; let c1 = 5.6418958354775628695e-1; let one = 1.0_f64; let half = 0.5; let ten = 10.0; let zero = 0.0; let sixten = 16.0; let x99 = -999.0; let thresh = 0.46875e0; let two = 2.0; let beta = conv(ibeta); let albeta = (beta).ln(); let ait = conv(it); let c = (ait*albeta).abs() + ten; let mut a = zero; let mut b = thresh; let n = 2000; let xn = conv(n); let jt = 0; let mut n0 = ( (ibeta/2)*(it+5)/6+4 ) as usize; let mut r1 = vec![0.0; 501]; let xmax = std::f64::MAX; let func1 = crate::fad::erf; let func2 = crate::fad::erfc; let func3 = crate::fad::erfcx; assert_eq!(xmin, 2.2250738585072014E-308); // Fragile //----------------------------------------------------------------- // Determine largest argument for ERFC test by Newton iteration //----------------------------------------------------------------- let c2 = xmin.ln() + (one/c1).ln(); let mut xbig = (-c2).sqrt(); loop { let x = xbig; // 50 let f0 = x*x; let ff = f0 + half/f0 + x.ln() + c2; let f0 = x+x + one/x - one/(x*f0); xbig = x - ff/f0; if (x-xbig).abs()/x <= ten*eps {//go to 50 break; } } let mut w; let mut v; let mut u; let mut z; let mut r; let mut f0; let mut ff; assert_eq!(xbig, 26.543258430632299); for j in 1 ..= 5 { // 300 /// Tests 1-5 let mut k1 = 0; let mut k3 = 0; let mut xc = zero; let mut r6 = zero; let mut r7 = zero; let del = (b - a) / xn; let mut xl = a; for _i in 0 .. n { // 200 // Number of Tests to conduct let mut x = del * ren(jt) + xl; if j == 1 { //----------------------------------------------------------------- // test erf against double series expansion //----------------------------------------------------------------- f0 = conv(n0 as i32); ff = f0+f0+one; z = x*x; w = z+z; u = zero; v = zero; for _k in 1 ..= n0 { // 60 u = -z/f0*(one+u); v = w/ff*(one+v); f0 = f0 - one; ff = ff - two; } v = c1*(x+x)*(((u*v+(u+v))+half)+half); u = func1(x); } else { //----------------------------------------------------------------- // test erfc or scaled erfc against expansion in repeated // integrals of the coerror function. //----------------------------------------------------------------- z = x + half; x = z - half; r = zero; if x <= one { n0 = 499; } else { //n0 = min(499,int(c/(abs(log(z))))); n0 = min(499.0, (c / z.ln().abs()).floor() ) as usize; } let mut n1 = n0 ; let mut xn1 = conv((n1+1) as i32); for _k in 1 ..= n0 { r = half/(z+xn1*r); r1[n1] = r; n1 = n1 - 1; xn1 = xn1 - one; }// 100 continue let mut k = n0; ff = c1/(z+r1[1]); if (j/2)*2 == j { f0 = func2(z) * (x+half*half).exp(); u = func2(x); } else { f0 = func3(z); u = func3(x); } let sc = f0/ff; //----------------------------------------------------------------- // scale things to avoid premature underflow //----------------------------------------------------------------- let epscon = f0 ; ff = sixten*ff/eps; for n1 in 1 ..= n0 { ff = r1[n1]*ff; r1[n1] = ff * sc; if r1[n1] < epscon { k = n1; break; //go to 111 } } //110 continue v = r1[k]; // 111 for n1 in 1 ..= k-1 { v = v + r1[k-n1]; } //120 continue //----------------------------------------------------------------- // remove scaling here //----------------------------------------------------------------- v = v*eps/sixten + f0; } //-------------------------------------------------------------------- // accumulate results //-------------------------------------------------------------------- w = (u - v) / u; // Relative Error let fac = 450.0; assert!(w.abs() < fac*std::f64::EPSILON, "{:e} != {:e} diff {:e} {:e} {}", u,v, w.abs(), fac*std::f64::EPSILON, w.abs()/std::f64::EPSILON); if w > zero { k1 = k1 + 1; } else if w < zero { k3 = k3 + 1; } w = w.abs(); if w > r6 { r6 = w; xc = x; } r7 = r7 + w * w; xl = xl + del; }// 200 continue //------------------------------------------------------------------ // gather and print statistics for test //------------------------------------------------------------------ let k2 = n - k3 - k1; r7 = (r7/xn).sqrt(); println!("TEST #{}", j); if j == 1 { println!(" Test of erf(x) vs double series expansion\n\n"); println!(" {} Random arguments were tested from the interval ({}, {})", n,a,b); println!(" ERF(X) was larger {} times", k1); } else if (j/2)*2 == j { println!(" Test of erfc(x) vs exp(x+1/4) SUM i^n erfc(x+1/2)"); println!(" {} Random arguments were tested from the interval ({}, {})", n,a,b); println!("ERFC(X) was larger {} times", k1); } else { println!(" Test of exp(x*x) erfc(x) vs SUM i^n erfc(x+1/2)"); println!("{} Random arguments were tested from the interval ({}, {})", n,a,b); println!("ERFCX(X) was larger {} times", k1); } println!(" agreed {} times, and",k2); println!(" was smaller {} times.\n", k3); println!(" There are {} base {} significant digits in a floating-point number", it,ibeta); if r6 != zero { w = r6.abs().ln() / albeta; } else { w = x99; } println!(" The maximum relative error of {:.4e} = {} ** {}\n occurred for X = {:.8e}", r6, ibeta, w, xc); w = max(ait+w,zero); println!(" The estimated loss of base {} significant digits is {}", ibeta, w); if r7 != zero { w = r7.abs().ln() / albeta; } else { w = x99; } println!(" The root mean square relative error was {:.4e} = {} ** {}", r7, ibeta, w); w = max(ait+w,zero); println!(" The estimated loss of base {} significant digits is {}", ibeta, w); println!(""); // ----------------------------------------------------------------- // initialize for next test //------------------------------------------------------------------ if j == 1 { a = b; b = two; } else if j == 3 { a = b; b = (xbig*sixten).trunc()/sixten-half; } else if j == 4 { b = ten + ten; } } //300 continue println!("Special Tests"); println!(" Estimated loss of base {} significant digits in", ibeta); println!("'Erf(x)+Erf(-x) Erf(x)+Erfc(x)-1 Erfcx(x)-exp(x*x)*erfc(x)"); let ans = [0.2763263901682369, -0.2763263901682369, 0.7236736098317631, 1.276326390168237]; assert!((func1(0.25) - ans[0]).abs() < 1e-15); assert!((func1(-0.25) - ans[1]).abs() < 1e-15); assert!((func2(0.25) - ans[2]).abs() < 1e-15); assert!((func2(-0.25) - ans[3]).abs() < 1e-15, "{} != {}", func2(-0.25),ans[3]); let arg = 0.5; let ans = [0.5204998778130465, -0.5204998778130465, 0.4795001221869535, 1.5204998778130465]; assert!((func1(arg) - ans[0]).abs() < 1e-15); assert!((func1(-arg) - ans[1]).abs() < 1e-15); assert!((func2(arg) - ans[2]).abs() < 1e-15); assert!((func2(-arg) - ans[3]).abs() < 1e-15, "{} != {}", func2(-arg),ans[3]); let mut x = zero; let del = -half; for _i in 1 ..= 10 { let u = func1(x); let mut a = u + func1(-x); assert!(a.abs() < 2.0 * std::f64::EPSILON); if a*u != zero { a = ait + (a/u).abs().ln() / albeta; } let v = func2(x); let mut b = u + v - one; assert!(b.abs() < 2.0 * std::f64::EPSILON); if b != zero { b = ait + b.abs().ln() / albeta; } let w = func3(x); let mut c = (x*sixten).trunc() / sixten; let r = (x-c)*(x+c); c = ((c*c).exp() * r.exp() * v-w)/w; assert!(c.abs() < 2.0 * std::f64::EPSILON); if c != zero { c = max(zero,ait + c.abs().ln() / albeta); } println!("{:7.3} {:16.2} {:16.2} {:16.2}", x,a,b,c); //write (iout,1031) x,a,b,c x = x + del; } println!("Test of special arguments"); let z = xmax; let zz = func1(z); assert!((zz-1.0).abs() < std::f64::EPSILON, "{} != {}", zz, 1.0); println!(" ERF ({:e}) = {:e}", z,zz); let z = zero; let zz = func1(z); assert!((zz-0.0).abs() < std::f64::EPSILON); println!(" ERF ({:e}) = {:e}", z,zz); let zz = func2(z); assert!((zz-1.0).abs() < std::f64::EPSILON); println!(" ERFC ({:e}) = {:e}", z,zz); let z = -xmax; let zz = func2(z); assert!((zz-2.0).abs() < std::f64::EPSILON); println!(" ERFC ({:e}) = {:e}", z,zz); println!("Test of Error Returns"); let w = xbig; let z = w * (one - half * half); println!("ERFC will be called with the argument {:e}", z); println!(" This should **not** underflow"); let zz = func2(z); assert!((zz-0.217879e-173).abs() < std::f64::EPSILON); println!(" ERFC ({:e}) = {:e}", z,zz); println!(""); let z = w * (one + ten * eps); println!("ERFC will be called with the argument {:e}", z); println!(" This **may** underflow"); let zz = func2(z); assert!((zz-0.222508e-307).abs() < std::f64::EPSILON); println!(" ERFC ({:e}) = {:e}", z,zz); println!(""); let mut w = xmax; if c1 < xmax*xmin { w = c1/xmin; } let z = w * (one - one/sixten); println!("ERFCX will be called with the argument {:e}", z); println!(" This should **not** underflow"); let zz = func3(z); println!(" ERFCX ({:e}) = {:e}", z,zz); assert!((zz-0.237341e-307).abs() < std::f64::EPSILON); println!(""); let w = -(xmax/two).ln().sqrt(); let z = w * (one-one/ten); println!("ERFCX will be called with the argument {:e}", z); println!(" This should **not** overflow"); let zz = func3(z); println!(" ERFCX ({:e}) = {:e}", z,zz); let ans = 0.5540070644707187e+250; let ans = 0.5540070644707037e+250; assert!((zz-ans).abs() < 1e-15, "{:e} != {:e} diff {:e}", zz,ans,(zz-ans).abs() ); println!(""); let z = w * (one + ten*eps); println!("ERFCX will be called with the argument {:e}", z); println!(" This **may** overflow"); let zz = func3(z); println!(" ERFCX ({:e}) = {:e}", z,zz); let ans = 0.179000e+309; assert!(zz.is_infinite()); println!(""); } }
#[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); let c1 = |num| { num }; let c2 = |num: u32| -> u32 { num }; fn add_one_v1(x: u32) -> u32 { x + 1 } let add_one_v2 = |x: u32| -> u32 { x + 1 }; let add_one_v3 = |x| { x + 1 }; let add_one_v4 = |x| x + 1; // compile error let example_closure = |x| x; let s = example_closure(String::from("hello")); let n = example_closure(5); // move keyword let x = vec![1, 2, 3]; let equal_to_x = move |z| z == x; } } struct Cacher<T> where T: Fn(u32) -> u32, { calculation: T, value: Option<u32>, } impl<T> Cacher<T> where T: Fn(u32) -> u32, { fn new(calculation: T) -> Cacher<T> { Cacher { calculation, value: None, } } }
// boxed variable fn box_int(a: i32) -> Box<i32> { let x: Box<i32> = Box::new(a); x } fn process(a: &mut Box<i32>){ **a = **a * **a; } fn main(){ println!("this is us {:?}", box_int(199)); let mut val = box_int(21); process(&mut val); println!("{}", val); }
use bindgen::Builder; use cmake::Config; use std::{env, path::PathBuf}; fn main() { let target = Config::new("libwebp").build_target("webp").build(); println!("cargo:rustc-link-search=native={}/build", target.display()); println!("cargo:rustc-link-lib=static=webp"); let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); Builder::default() .header("libwebp.h") .generate() .expect("Unable to generate bindings") .write_to_file(out_path.join("bindings.rs")) .expect("Unable to generate bindings"); }
//! Command `source` use crate::{registry::Registry, result::Result}; use std::cmp::Ordering; const MAX_PACKAGE_NAME_LEN: usize = 50; fn cap(mut name: String) -> String { name.push_str(&" ".repeat(MAX_PACKAGE_NAME_LEN - name.len())); name } /// Exec command `source` pub fn exec(query: String, version: bool) -> Result<()> { let registry = Registry::new()?; let mut source = registry.source()?; source.sort_by(|(np, _), (nq, _)| np.partial_cmp(nq).unwrap_or(Ordering::Greater)); println!( "{}", if query.is_empty() { source .iter() .map(|(name, ver)| { if version { name.to_string() } else { format!("{} - {}", cap(name.to_string()), ver) } }) .collect::<Vec<String>>() } else { source .iter() .filter(|(name, _)| name.contains(&query)) .map(|(name, ver)| { if version { name.to_string() } else { format!("{} - {}", cap(name.to_string()), ver) } }) .collect::<Vec<String>>() } .join("\n") ); Ok(()) }
use nalgebra::Vector3; use std::io::{Read, Result as IOResult, Error as IOError, ErrorKind}; use crate::{PrimitiveRead, LumpData, LumpType}; pub struct DispInfo { pub start_position: Vector3<f32>, pub disp_vert_start: i32, pub disp_tri_start: i32, pub power: i32, pub min_tess: i32, pub smoothing_angle: f32, pub contents: i32, pub map_face: u16, pub lightmap_alpha_start: i32, pub lightmap_sample_position_start: i32, pub edge_neighbors: [DispNeighbor; 4], pub corner_neighbors: [DispCornerNeighbors; 4], pub allowed_verts: [u32; 10] } impl DispInfo { pub fn edge_neighbor(&self, edge: NeighborEdge) -> &DispNeighbor { let index: u8 = unsafe { std::mem::transmute(edge) }; &self.edge_neighbors[index as usize] } pub fn corner_neighbor(&self, corner: NeighborCorner) -> &DispCornerNeighbors { let index: u8 = unsafe { std::mem::transmute(corner) }; &self.corner_neighbors[index as usize] } } impl LumpData for DispInfo { fn lump_type() -> LumpType { LumpType::DisplacementInfo } fn lump_type_hdr() -> Option<LumpType> { None } fn element_size(_version: i32) -> usize { 176 } fn read(read: &mut dyn Read, _version: i32) -> IOResult<Self> { let start_position = Vector3::new(read.read_f32()?, read.read_f32()?, read.read_f32()?); let disp_vert_start = read.read_i32()?; let disp_tri_start = read.read_i32()?; let power = read.read_i32()?; if power != 2 && power != 3 && power != 4 { panic!("illegal power: {}", power); } let min_tess = read.read_i32()?; let smoothing_angle = read.read_f32()?; let contents = read.read_i32()?; let map_face = read.read_u16()?; let _padding = read.read_u16()?; let lightmap_alpha_start = read.read_i32()?; let lightmap_sample_position_start = read.read_i32()?; let edge_neighbors = [ DispNeighbor::read(read)?, DispNeighbor::read(read)?, DispNeighbor::read(read)?, DispNeighbor::read(read)? ]; let corner_neighbors = [ DispCornerNeighbors::read(read)?, DispCornerNeighbors::read(read)?, DispCornerNeighbors::read(read)?, DispCornerNeighbors::read(read)? ]; let mut allowed_verts = [0u32; 10]; for i in 0..allowed_verts.len() { allowed_verts[i] = read.read_u32()?; } Ok(Self { start_position, disp_vert_start, disp_tri_start, power, min_tess, smoothing_angle, contents, map_face, lightmap_alpha_start, lightmap_sample_position_start, edge_neighbors, corner_neighbors, allowed_verts }) } } pub struct DispNeighbor { pub sub_neighbors: [DispSubNeighbor; 2] } impl DispNeighbor { pub fn any(&self) -> bool { self.sub_neighbors[0].is_valid() || self.sub_neighbors[1].is_valid() } pub fn corner_to_corner(&self) -> bool { self.sub_neighbors[0].is_valid() && self.sub_neighbors[0].span == NeighborSpan::CornerToCorner } pub fn simple_corner_to_corner(&self) -> bool { self.corner_to_corner() && self.sub_neighbors[0].neighbor_span == NeighborSpan::CornerToCorner } pub fn read(reader: &mut dyn Read) -> IOResult<Self> { let sub_neighbors = [DispSubNeighbor::read(reader)?, DispSubNeighbor::read(reader)?]; Ok(Self { sub_neighbors }) } } pub struct DispSubNeighbor { pub neighbor_index: u16, pub neighbor_orientation: NeighborOrientation, pub span: NeighborSpan, pub neighbor_span: NeighborSpan } impl DispSubNeighbor { pub fn is_valid(&self) -> bool { self.neighbor_index != 0xffff } pub fn read(reader: &mut dyn Read) -> IOResult<Self> { let neighbor_index = reader.read_u16()?; let neighbor_orientation = reader.read_u8()?; if neighbor_orientation > unsafe { std::mem::transmute::<NeighborOrientation, u8>(NeighborOrientation::CounterClockWise270) } && neighbor_orientation != unsafe { std::mem::transmute::<NeighborOrientation, u8>(NeighborOrientation::Unknown) } { return Err(IOError::new(ErrorKind::Other, format!("Value for neighbor orientation in DispSubNeighbor out of range: {}", neighbor_orientation))); } let span = reader.read_u8()?; if span > unsafe { std::mem::transmute::<NeighborSpan, u8>(NeighborSpan::MidpointToCorner) } { println!("{}", format!("Value for span in DispSubNeighbor out of range: {}", span)); // FIXME } let neighbor_span = reader.read_u8()?; if neighbor_span > unsafe { std::mem::transmute::<NeighborSpan, u8>(NeighborSpan::MidpointToCorner) } { println!("{}", format!("Value for neighbor_span in DispSubNeighbor out of range: {}", neighbor_span)); // FIXME } let _padding = reader.read_u8()?; Ok(Self { neighbor_index, neighbor_orientation: unsafe { std::mem::transmute(neighbor_orientation) }, span: unsafe { std::mem::transmute(span) }, neighbor_span: unsafe { std::mem::transmute(neighbor_span) }, }) } } pub struct DispCornerNeighbors { neighbors: [u16; 4], num_neighbors: u8 } impl DispCornerNeighbors { pub fn read(read: &mut dyn Read) -> IOResult<Self> { let neighbors = [read.read_u16()?, read.read_u16()?, read.read_u16()?, read.read_u16()?]; let num_neighbors = read.read_u8()?; if num_neighbors > 4 { return Err(IOError::new(ErrorKind::Other, format!("Value for num_neighbors in DispCornerNeighbors out of range: {}", num_neighbors))); } let _padding = read.read_u8()?; Ok(Self { neighbors, num_neighbors }) } pub fn corner_neighbor_indices(&self) -> &[u16] { &self.neighbors[..self.num_neighbors as usize] } } #[repr(u8)] #[derive(Copy, Clone, Debug, PartialOrd, PartialEq, Eq, Ord, Hash)] pub enum NeighborOrientation { CounterClockwise0 = 0, CounterClockwise90 = 1, CounterClockwise180 = 2, CounterClockWise270 = 3, Unknown = 255 } #[repr(u8)] #[derive(Copy, Clone, Debug, PartialOrd, PartialEq, Eq, Ord, Hash)] pub enum NeighborSpan { CornerToCorner = 0, CornerToMidpoint = 1, MidpointToCorner = 2 } #[repr(u8)] #[derive(Copy, Clone, Debug, PartialOrd, PartialEq, Eq, Ord, Hash)] pub enum NeighborCorner { LowerLeft = 0, UpperLeft = 1, UpperRight = 2, LowerRight = 3 } #[repr(u8)] #[derive(Copy, Clone, Debug, PartialOrd, PartialEq, Eq, Ord, Hash)] pub enum NeighborEdge { Left = 0, Top = 1, Right = 2, Bottom = 3 }
//! //! ticks.rs //! //! Created by Mitchell Nordine at 08:46PM on November 02, 2014. //! //! use num::{FromPrimitive, ToPrimitive}; use std::ops::{Add, Sub, Mul, Div, Rem, Neg, AddAssign, SubAssign, MulAssign, DivAssign, RemAssign}; use super::calc; use super::{ Bars, Bpm, Ms, ms_from_ticks, Ppqn, SampleHz, Samples, samples_from_ticks, TimeSig, }; /// Time representation in the form of Ticks. #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Ticks(pub calc::Ticks); impl Ticks { /// Return the unit value of Ticks. #[inline] pub fn ticks(&self) -> calc::Ticks { let Ticks(ticks) = *self; ticks } /// Convert to the equivalent duration as a number of Bars. #[inline] pub fn bars(&self, ts: TimeSig, ppqn: Ppqn) -> f64 { self.ticks() as f64 / Bars(1).ticks(ts, ppqn) as f64 } /// Convert to the equivalent duration as a number of Beats. #[inline] pub fn beats(&self, ppqn: Ppqn) -> f64 { self.ticks() as f64 / ppqn as f64 } /// Convert to the unit value of `Ms`. #[inline] pub fn ms(&self, bpm: Bpm, ppqn: Ppqn) -> calc::Ms { ms_from_ticks(self.ticks(), bpm, ppqn) } /// Convert to `Ms`. #[inline] pub fn to_ms(&self, bpm: Bpm, ppqn: Ppqn) -> Ms { Ms(self.ms(bpm, ppqn)) } /// Convert to the unit value of `Samples`. #[inline] pub fn samples(&self, bpm: Bpm, ppqn: Ppqn, sample_hz: SampleHz) -> calc::Samples { samples_from_ticks(self.ticks(), bpm, ppqn, sample_hz) } /// Convert to `Samples`. #[inline] pub fn to_samples(&self, bpm: Bpm, ppqn: Ppqn, sample_hz: SampleHz) -> Samples { Samples(self.samples(bpm, ppqn, sample_hz)) } } impl From<calc::Ticks> for Ticks { fn from(ticks: calc::Ticks) -> Self { Ticks(ticks) } } impl Add for Ticks { type Output = Self; #[inline] fn add(self, rhs: Self) -> Ticks { Ticks(self.ticks() + rhs.ticks()) } } impl Sub for Ticks { type Output = Self; #[inline] fn sub(self, rhs: Self) -> Ticks { Ticks(self.ticks() - rhs.ticks()) } } impl Mul for Ticks { type Output = Self; #[inline] fn mul(self, rhs: Self) -> Ticks { Ticks(self.ticks() * rhs.ticks()) } } impl Div for Ticks { type Output = Self; #[inline] fn div(self, rhs: Self) -> Ticks { Ticks(self.ticks() / rhs.ticks()) } } impl Rem for Ticks { type Output = Self; #[inline] fn rem(self, rhs: Self) -> Ticks { Ticks(self.ticks() % rhs.ticks()) } } impl Neg for Ticks { type Output = Self; #[inline] fn neg(self) -> Ticks { Ticks(-self.ticks()) } } impl AddAssign for Ticks { fn add_assign(&mut self, rhs: Self) { *self = *self + rhs; } } impl SubAssign for Ticks { fn sub_assign(&mut self, rhs: Self) { *self = *self - rhs; } } impl MulAssign for Ticks { fn mul_assign(&mut self, rhs: Self) { *self = *self * rhs; } } impl DivAssign for Ticks { fn div_assign(&mut self, rhs: Self) { *self = *self / rhs; } } impl RemAssign for Ticks { fn rem_assign(&mut self, rhs: Self) { *self = *self % rhs; } } impl ToPrimitive for Ticks { fn to_u64(&self) -> Option<u64> { self.ticks().to_u64() } fn to_i64(&self) -> Option<i64> { self.ticks().to_i64() } } impl FromPrimitive for Ticks { fn from_u64(n: u64) -> Option<Ticks> { Some(Ticks(n as calc::Ticks)) } fn from_i64(n: i64) -> Option<Ticks> { Some(Ticks(n as calc::Ticks)) } }
//! Memory profiling support using heappy //! //! Compiled only when the "heappy" feature is enabled use heappy::{self, HeapReport}; use observability_deps::tracing::info; use snafu::{ResultExt, Snafu}; use std::{thread, time}; #[derive(Debug, Snafu)] pub enum Error { #[snafu(display("{}", source))] HeappyError { source: heappy::Error }, #[snafu(display("{}", source))] JoinError { source: tokio::task::JoinError }, } pub(crate) async fn dump_heappy_rsprof(seconds: u64, interval: i32) -> Result<HeapReport, Error> { // heap profiler guard is not Send so it can't be used in async code. let report = tokio::task::spawn_blocking(move || { let guard = heappy::HeapProfilerGuard::new(interval as usize)?; info!( "start allocs profiling {} seconds with interval {} bytes", seconds, interval ); thread::sleep(time::Duration::from_secs(seconds)); info!( "done allocs profiling {} seconds with interval {} bytes, computing report", seconds, interval ); let report = guard.report(); info!("heap allocation report computed",); Ok(report) }) .await .context(JoinSnafu)? .context(HeappySnafu)?; Ok(report) }
mod file_mode; mod stat_buf; pub use rcore_fs::vfs::{FileSystem, FileType, FsError, INode, Metadata, Timespec, PATH_MAX}; pub use self::file_mode::FileMode; pub use self::stat_buf::{StatBuf, StatFlags, StatMode}; #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum SeekFrom { Start(u64), End(i64), Current(i64), }
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} #[repr(transparent)] pub struct GameListCategory(pub i32); impl GameListCategory { pub const Candidate: Self = Self(0i32); pub const ConfirmedBySystem: Self = Self(1i32); pub const ConfirmedByUser: Self = Self(2i32); } impl ::core::marker::Copy for GameListCategory {} impl ::core::clone::Clone for GameListCategory { fn clone(&self) -> Self { *self } } pub type GameListChangedEventHandler = *mut ::core::ffi::c_void; pub type GameListEntry = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct GameListEntryLaunchableState(pub i32); impl GameListEntryLaunchableState { pub const NotLaunchable: Self = Self(0i32); pub const ByLastRunningFullPath: Self = Self(1i32); pub const ByUserProvidedPath: Self = Self(2i32); pub const ByTile: Self = Self(3i32); } impl ::core::marker::Copy for GameListEntryLaunchableState {} impl ::core::clone::Clone for GameListEntryLaunchableState { fn clone(&self) -> Self { *self } } pub type GameListRemovedEventHandler = *mut ::core::ffi::c_void; pub type GameModeConfiguration = *mut ::core::ffi::c_void; pub type GameModeUserConfiguration = *mut ::core::ffi::c_void; pub type IGameListEntry = *mut ::core::ffi::c_void;
extern crate pine; // use pine::error::PineError; use pine::ast::input::*; use pine::ast::name::*; use pine::ast::op::*; use pine::ast::stat_expr_types::*; use pine::ast::string::*; mod utils; pub use utils::*; #[test] fn expression_test() { assert_eq!( pine::parse_ast("m = (high + low + close) / 3\n"), Ok(Block::new( vec![gen_assign( VarName::new_with_start("m", Position::new(0, 0)), gen_binop( BinaryOp::Div, gen_binop( BinaryOp::Plus, gen_binop( BinaryOp::Plus, gen_name(VarName::new_with_start("high", Position::new(0, 5)),), gen_name(VarName::new_with_start("low", Position::new(0, 12))), StrRange::from_start("high + low", Position::new(0, 5)) ), gen_name(VarName::new_with_start("close", Position::new(0, 18))), StrRange::from_start("high + low + close", Position::new(0, 5)) ), gen_int(3, StrRange::from_start("3", Position::new(0, 27))), // StrRange::from_start("(high + low + close) / 3", Position::new(0, 4)) bracket excluded StrRange::new(Position::new(0, 5), Position::new(0, 28)) ), StrRange::from_start("m = (high + low + close) / 3", Position::new(0, 0)) )], None, StrRange::from_start("m = (high + low + close) / 3", Position::new(0, 0)) )) ); let max_range = StrRange::from_start( "m = sma(high - low, 10) + sma(close, 20)", Position::new(0, 0), ); assert_eq!( pine::parse_ast("m = sma(high - low, 10) + sma(close, 20)\n"), Ok(Block::new( vec![gen_assign( VarName::new_with_start("m", Position::new(0, 0)), gen_binop( BinaryOp::Plus, gen_func_call( VarName::new_with_start("sma", Position::new(0, 4)), vec![ gen_binop( BinaryOp::Minus, gen_name(VarName::new_with_start("high", Position::new(0, 8))), gen_name(VarName::new_with_start("low", Position::new(0, 15))), StrRange::from_start("high - low", Position::new(0, 8)) ), gen_int(10, StrRange::from_start("10", Position::new(0, 20))) ], vec![], StrRange::from_start("sma(high - low, 10)", Position::new(0, 4)) ), gen_func_call( VarName::new_with_start("sma", Position::new(0, 26)), vec![ gen_name(VarName::new_with_start("close", Position::new(0, 30))), gen_int(20, StrRange::from_start("20", Position::new(0, 37))) ], vec![], StrRange::from_start("sma(close, 20)", Position::new(0, 26)) ), StrRange::from_start( "sma(high - low, 10) + sma(close, 20)", Position::new(0, 4) ) ), max_range, )], None, max_range )) ); } const VAR_ASSIGN: &str = "price = close if hl2 > price price := hl2 plot(price) "; #[test] fn var_assign_test() { assert_eq!( pine::parse_ast(VAR_ASSIGN), Ok(Block::new( vec![ gen_assign( VarName::new_with_start("price", Position::new(0, 0)), gen_name(VarName::new_with_start("close", Position::new(0, 8))), StrRange::from_start("price = close", Position::new(0, 0)) ), Statement::Ite(Box::new(IfThenElse::new_no_ctxid( gen_binop( BinaryOp::Gt, gen_name(VarName::new_with_start("hl2", Position::new(1, 3))), gen_name(VarName::new_with_start("price", Position::new(1, 9))), StrRange::from_start("hl2 > price", Position::new(1, 3)) ), Block::new( vec![Statement::VarAssignment(Box::new(VarAssignment::new( VarName::new_with_start("price", Position::new(2, 4)), gen_name(VarName::new_with_start("hl2", Position::new(2, 13))), StrRange::from_start("price := hl2", Position::new(2, 4)) )))], None, StrRange::from_start("price := hl2", Position::new(2, 4)) ), None, StrRange::new(Position::new(1, 0), Position::new(2, 16)) ))), gen_func_call_stmt( VarName::new_with_start("plot", Position::new(3, 0)), vec![gen_name(VarName::new_with_start( "price", Position::new(3, 5) ))], vec![], StrRange::from_start("plot(price)", Position::new(3, 0)) ), ], None, StrRange::new(Position::new(0, 0), Position::new(3, 11)) )) ); } const VAR_DECLARATION: &str = "m = true bool m = true var m = true var bool m = true "; #[test] fn variable_declare_test() { let gen_assign = |src, var, var_type, row, name_col, bool_col| { Statement::Assignment(Box::new(Assignment::new( vec![VarName::new_with_start("m", Position::new(row, name_col))], Exp::Bool(BoolNode::new( true, StrRange::from_start("true", Position::new(row, bool_col)), )), var, var_type, StrRange::from_start(src, Position::new(row, 0)), ))) }; assert_eq!( pine::parse_ast(VAR_DECLARATION), Ok(Block::new( vec![ gen_assign("m = true", false, None, 0, 0, 4), gen_assign("bool m = true", false, Some(DataType::Bool), 1, 5, 9), gen_assign("var m = true", true, None, 2, 4, 8), gen_assign("var bool m = true", true, Some(DataType::Bool), 3, 9, 13), ], None, StrRange::new(Position::new(0, 0), Position::new(3, 17)) )) ); } const IF_STATES: &str = "// This code compiles x = if close > open close else open "; const IF_NEST_STATS: &str = " x = if close > open b = if close > close[1] close else close[1] b else open "; #[test] fn if_stats_test() { assert_eq!( pine::parse_ast(IF_STATES), Ok(Block::new( vec![ // Statement::None(StrRange::from_start( // "// This code compiles\n", // Position::new(0, 0) // )), gen_assign( VarName::new_with_start("x", Position::new(1, 0)), Exp::Ite(Box::new(IfThenElse::new_no_ctxid( gen_binop( BinaryOp::Gt, gen_name(VarName::new_with_start("close", Position::new(1, 7))), gen_name(VarName::new_with_start("open", Position::new(1, 15))), StrRange::from_start("close > open", Position::new(1, 7)) ), Block::new( vec![], Some(gen_name(VarName::new_with_start( "close", Position::new(2, 4) ))), StrRange::from_start("close", Position::new(2, 4)) ), Some(Block::new( vec![], Some(gen_name(VarName::new_with_start( "open", Position::new(4, 4) ))), StrRange::from_start("open", Position::new(4, 4)) )), StrRange::new(Position::new(1, 4), Position::new(4, 8)) ))), StrRange::new(Position::new(1, 0), Position::new(4, 8)) ), ], None, StrRange::new(Position::new(1, 0), Position::new(4, 8)) )) ); assert_eq!( pine::parse_ast(IF_NEST_STATS), Ok(Block::new( vec![ // Statement::None(StrRange::from_start("\n", Position::new(0, 0))), gen_assign( VarName::new_with_start("x", Position::new(1, 0)), Exp::Ite(Box::new(IfThenElse::new_no_ctxid( gen_binop( BinaryOp::Gt, gen_name(VarName::new_with_start("close", Position::new(1, 7))), gen_name(VarName::new_with_start("open", Position::new(1, 15))), StrRange::from_start("close > open", Position::new(1, 7)) ), Block::new( vec![gen_assign( VarName::new_with_start("b", Position::new(2, 4)), Exp::Ite(Box::new(IfThenElse::new_no_ctxid( gen_binop( BinaryOp::Gt, gen_name(VarName::new_with_start( "close", Position::new(2, 11) )), gen_ref_call( VarName::new_with_start("close", Position::new(2, 19)), gen_int( 1, StrRange::from_start("1", Position::new(2, 25)) ), StrRange::from_start("close[1]", Position::new(2, 19)) ), StrRange::from_start( "close > close[1]", Position::new(2, 11) ) ), Block::new( vec![], Some(gen_name(VarName::new_with_start( "close", Position::new(3, 8) ))), StrRange::from_start("close", Position::new(3, 8)) ), Some(Block::new( vec![], Some(gen_ref_call( VarName::new_with_start("close", Position::new(5, 8)), gen_int( 1, StrRange::from_start("1", Position::new(5, 14)) ), StrRange::from_start("close[1]", Position::new(5, 8)) )), StrRange::from_start("close[1]", Position::new(5, 8)) )), StrRange::new(Position::new(2, 8), Position::new(5, 16)) ))), StrRange::new(Position::new(2, 4), Position::new(5, 16)) )], Some(gen_name(VarName::new_with_start("b", Position::new(6, 4)))), StrRange::new(Position::new(2, 4), Position::new(6, 5)) ), Some(Block::new( vec![], Some(gen_name(VarName::new_with_start( "open", Position::new(8, 4) ))), StrRange::from_start("open", Position::new(8, 4)) )), StrRange::new(Position::new(1, 4), Position::new(8, 8)) ))), StrRange::new(Position::new(1, 0), Position::new(8, 8)) ) ], None, StrRange::new(Position::new(1, 0), Position::new(8, 8)) )) ); } const IF_EXPR: &str = " if (crossover(source, lower)) strategy.entry(\"BBandLE\", strategy.long, stop=lower, oca_name=\"BollingerBands\", oca_type=strategy.oca.cancel, comment=\"BBandLE\") else strategy.cancel(id=\"BBandLE\") "; fn gen_dot_func_call<'a>( methods: Vec<VarName<'a>>, methods_range: StrRange, pos_args: Vec<Exp<'a>>, dict_args: Vec<(VarName<'a>, Exp<'a>)>, range: StrRange, ) -> Statement<'a> { Statement::Exp(Exp::FuncCall(Box::new(FunctionCall::new_no_ctxid( gen_prefix(methods[0], methods[1], methods_range), pos_args, dict_args, range, )))) } #[test] fn if_expr_test() { assert_eq!( pine::parse_ast(IF_EXPR), Ok(Block::new( vec![ // Statement::None(StrRange::from_start("\n", Position::new(0, 0))), Statement::Ite(Box::new(IfThenElse::new_no_ctxid( gen_func_call( VarName::new_with_start("crossover", Position::new(1, 4)), vec![ gen_name(VarName::new_with_start("source", Position::new(1, 14))), gen_name(VarName::new_with_start("lower", Position::new(1, 22))) ], vec![], StrRange::from_start("crossover(source, lower)", Position::new(1, 4)) ), Block::new( vec![gen_dot_func_call( vec![ VarName::new_with_start("strategy", Position::new(2, 4)), VarName::new_with_start("entry", Position::new(2, 13)) ], StrRange::from_start("strategy.entry", Position::new(2, 4)), vec![ Exp::Str(StringNode::new( String::from("BBandLE"), StrRange::from_start("BBandLE", Position::new(2, 20)) )), gen_prefix( VarName::new_with_start("strategy", Position::new(2, 30)), VarName::new_with_start("long", Position::new(2, 39)), StrRange::from_start("strategy.long", Position::new(2, 30)) ), ], vec![ ( VarName::new_with_start("stop", Position::new(2, 45)), gen_name(VarName::new_with_start( "lower", Position::new(2, 50) )) ), ( VarName::new_with_start("oca_name", Position::new(3, 19)), Exp::Str(StringNode::new( String::from("BollingerBands"), StrRange::from_start( "BollingerBands", Position::new(3, 29) ) )) ), ( VarName::new_with_start("oca_type", Position::new(4, 19)), gen_prefix_exp( gen_prefix( VarName::new_with_start( "strategy", Position::new(4, 28) ), VarName::new_with_start("oca", Position::new(4, 37)), StrRange::from_start( "strategy.oca", Position::new(4, 28) ) ), VarName::new_with_start("cancel", Position::new(4, 41)), StrRange::from_start( "strategy.oca.cancel", Position::new(4, 28) ) ) ), ( VarName::new_with_start("comment", Position::new(4, 49)), Exp::Str(StringNode::new( String::from("BBandLE"), StrRange::from_start("BBandLE", Position::new(4, 58)) )) ), ], StrRange::new(Position::new(2, 4), Position::new(4, 67)) )], None, StrRange::new(Position::new(2, 4), Position::new(4, 67)) ), Some(Block::new( vec![gen_dot_func_call( vec![ VarName::new_with_start("strategy", Position::new(6, 4)), VarName::new_with_start("cancel", Position::new(6, 13)) ], StrRange::from_start("strategy.cancel", Position::new(6, 4)), vec![], vec![( VarName::new_with_start("id", Position::new(6, 20)), Exp::Str(StringNode::new( String::from("BBandLE"), StrRange::from_start("BBandLE", Position::new(6, 24)) )) )], StrRange::new(Position::new(6, 4), Position::new(6, 33)) )], None, StrRange::new(Position::new(6, 4), Position::new(6, 33)) )), StrRange::new(Position::new(1, 0), Position::new(6, 33)) ))) ], None, StrRange::new(Position::new(1, 0), Position::new(6, 33)) )) ); }
use vec3::*; use ray::Ray; use hitable::*; use material::*; use util::*; use aabb::*; use onb::*; use pdf::*; #[derive(Debug, Clone)] pub struct Sphere { center: Vec3<f64>, radius: f64, material: Rc<Material>, } impl Sphere { pub fn new(cen: Vec3<f64>, r: f64, material: Rc<Material>) -> Sphere { Sphere { center: cen, radius: r, material: material, } } } impl Hitable for Sphere { fn hit(&self, _: &mut Rng, r: &Ray<f64>, t_min: f64, t_max: f64) -> Option<HitRecord> { let oc = r.origin() - self.center; let a = dot(&r.direction(), &r.direction()); let b = dot(&oc, &r.direction()); let c = dot(&oc, &oc) - self.radius * self.radius; let discriminant = b * b - a * c; if discriminant > 0.0 { let temp = (-b - discriminant.sqrt()) / a; if temp < t_max && temp > t_min { let p = r.point_at_parameter(temp); let (u, v) = get_sphere_uv(&((p-self.center)/self.radius)); let h = HitRecord::new(temp, u, v, p, (p - self.center) / self.radius, self.material.clone()); return Some(h); } let temp = (-b + discriminant.sqrt()) / a; if temp < t_max && temp > t_min { let p = r.point_at_parameter(temp); let (u, v) = get_sphere_uv(&((p-self.center)/self.radius)); let h = HitRecord::new(temp, u, v, p, (p - self.center) / self.radius, self.material.clone()); return Some(h); } } return None; } fn bounding_box(&self, _t0: f64, _t1: f64) -> Option<AABB> { Some(AABB::new(self.center - Vec3::new(self.radius, self.radius, self.radius), self.center + Vec3::new(self.radius, self.radius, self.radius))) } fn pdf_value(&self, rng: &mut Rng, o: &Vec3<f64>, v: &Vec3<f64>) -> f64 { if let Some(hrec) = self.hit(rng, &Ray::new(o.clone(), v.clone()), 0.001, f64::MAX) { let cos_theta_max = (1. - self.radius*self.radius/(self.center-*o).squared_length()).sqrt(); let solid_angle = 2.*PI*(1.-cos_theta_max); return 1. / solid_angle; } else { return 0.; } } fn random(&self, rng: &mut Rng, o: &Vec3<f64>) -> Vec3<f64> { let direction = self.center - *o; let distance_squared = direction.squared_length(); let uvw = Onb::new_from_w(&direction); return uvw.local_vec(&random_to_sphere(rng, self.radius, distance_squared)); } } fn get_sphere_uv(p: &Vec3<f64>) -> (f64, f64) { let phi = p.z.atan2(p.x); let theta = p.y.asin(); let u = 1.-(phi + PI) / (2.*PI); let v = (theta + PI/2.) / PI; return (u,v); }
use super::*; #[derive(Debug)] pub enum GameSettings { NewGame { player_name: String }, LoadGame { path: String }, } #[derive(Debug)] pub enum Screen { MainMenu { player_name: String }, } #[derive(Debug)] pub enum Action { Cancel, StartGame, ReadChar(char, bool), DeleteChar, InvalidKey, } impl State for Screen { type World = Option<GameSettings>; type Action = Action; fn render(&self, con: &mut Offscreen, _settings: &Self::World) { use Screen::*; match self { MainMenu { player_name, .. } => { con.set_default_background(colors::BLACK); con.set_default_foreground(colors::WHITE); let (w, h) = (con.width(), con.height()); let text = format!( "{}\n\n{}\n\n\n\n\n{}", "* Rustlike *", "A short adventure in game development.", "Press Enter to start a game. ESC to exit.", ); con.print_rect_ex( w / 2, h / 4, w - 2, h - 2, BackgroundFlag::Set, TextAlignment::Center, &text, ); let num_lines_intro = con.get_height_rect(w / 2, h / 4, w - 2, h - 2, &text); con.print_ex( w / 2, h / 4 + num_lines_intro + 3, BackgroundFlag::Set, TextAlignment::Center, format!("Enter name:\n{}", player_name), ); } } } fn interpret(&self, event: &Event) -> Self::Action { use Action::*; use Event::*; use KeyCode::{Backspace, Char, Enter, Escape, Spacebar}; use Screen::*; match self { MainMenu { .. } => match event { KeyEvent(Key { code: Escape, .. }) => Cancel, KeyEvent(Key { code: Enter, .. }) => StartGame, KeyEvent(Key { code: Backspace, .. }) => DeleteChar, KeyEvent(Key { code: Spacebar, printable, .. }) => ReadChar(*printable, false), KeyEvent(Key { code: Char, printable, shift, .. }) => ReadChar(*printable, *shift), Command(c) => { println!("Execute {:?}", c); InvalidKey } _ => InvalidKey, }, } } fn update(&mut self, action: Self::Action, settings: &mut Self::World) -> Transition<Self> { use Action::*; use Screen::*; use Transition::*; match self { MainMenu { player_name, .. } => match action { StartGame => { settings.replace(GameSettings::NewGame { player_name: player_name.clone(), }); Exit } DeleteChar => { player_name.pop(); Continue } ReadChar(c, upper) => { if upper { for u in c.to_uppercase() { player_name.push(u); } } else { player_name.push(c); } Continue } Cancel => Exit, InvalidKey => Continue, }, } } }
use actix_web::{http::StatusCode, HttpResponse, Json, Path, Query}; use auth::user::User as AuthUser; use bigneon_db::models::*; use bigneon_db::utils::errors::Optional; use db::Connection; use diesel::PgConnection; use errors::*; use helpers::application; use models::{ Paging, PagingParameters, PathParameters, Payload, RegisterRequest, UserProfileAttributes, }; use std::collections::HashMap; use uuid::Uuid; #[derive(Deserialize)] pub struct SearchUserByEmail { pub email: String, } #[derive(Serialize, Deserialize)] pub struct CurrentUser { pub user: DisplayUser, pub roles: Vec<String>, pub scopes: Vec<String>, pub organization_roles: HashMap<Uuid, Vec<String>>, pub organization_scopes: HashMap<Uuid, Vec<String>>, } pub fn current_user( (connection, user): (Connection, AuthUser), ) -> Result<HttpResponse, BigNeonError> { let connection = connection.get(); let user = User::find(user.id(), connection)?; let current_user = current_user_from_user(&user, connection)?; Ok(HttpResponse::Ok().json(&current_user)) } pub fn update_current_user( (connection, user_parameters, user): (Connection, Json<UserProfileAttributes>, AuthUser), ) -> Result<HttpResponse, BigNeonError> { let connection = connection.get(); let user = User::find(user.id(), connection)?; let updated_user = user.update(&user_parameters.into_inner().into(), connection)?; let current_user = current_user_from_user(&updated_user, connection)?; Ok(HttpResponse::Ok().json(&current_user)) } pub fn show( (connection, parameters, auth_user): (Connection, Path<PathParameters>, AuthUser), ) -> Result<HttpResponse, BigNeonError> { let connection = connection.get(); let user = User::find(parameters.id, connection)?; if !auth_user.user.can_read_user(&user, connection)? { return application::unauthorized(); } Ok(HttpResponse::Ok().json(&user.for_display()?)) } pub fn list_organizations( (connection, parameters, query_parameters, auth_user): ( Connection, Path<PathParameters>, Query<PagingParameters>, AuthUser, ), ) -> Result<HttpResponse, BigNeonError> { let connection = connection.get(); let user = User::find(parameters.id, connection)?; if !auth_user.user.can_read_user(&user, connection)? { return application::unauthorized(); } //TODO implement proper paging on db. let query_parameters = Paging::new(&query_parameters.into_inner()); let organization_links = Organization::all_org_names_linked_to_user(parameters.id, connection)?; let links_count = organization_links.len(); let mut payload = Payload { data: organization_links, paging: Paging::clone_with_new_total(&query_parameters, links_count as u64), }; payload.paging.limit = links_count as u64; Ok(HttpResponse::Ok().json(&payload)) } pub fn find_by_email( (connection, query, auth_user): (Connection, Query<SearchUserByEmail>, AuthUser), ) -> Result<HttpResponse, BigNeonError> { let connection = connection.get(); let user = match User::find_by_email(&query.into_inner().email, connection).optional()? { Some(u) => u, None => return Ok(HttpResponse::new(StatusCode::NO_CONTENT)), }; if !auth_user.user.can_read_user(&user, connection)? { return application::unauthorized(); } Ok(HttpResponse::Ok().json(&user.for_display()?)) } pub fn register( (connection, parameters): (Connection, Json<RegisterRequest>), ) -> Result<HttpResponse, BigNeonError> { let new_user: NewUser = parameters.into_inner().into(); new_user.commit(connection.get())?; Ok(HttpResponse::Created().finish()) } fn current_user_from_user( user: &User, connection: &PgConnection, ) -> Result<CurrentUser, BigNeonError> { let roles_by_organization = user.get_roles_by_organization(connection)?; let mut scopes_by_organization = HashMap::new(); for (organization_id, roles) in &roles_by_organization { scopes_by_organization.insert(organization_id.clone(), scopes::get_scopes(roles.clone())); } Ok(CurrentUser { user: user.clone().for_display()?, roles: user.role.clone(), scopes: user.get_global_scopes(), organization_roles: roles_by_organization, organization_scopes: scopes_by_organization, }) }
use leptos::*; use openapi::models::LoginRequest; use crate::auth; use crate::components::Button; use crate::components::TextInput; #[component] pub fn Login(cx: Scope) -> impl IntoView { let login = create_rw_signal(cx, String::new()); let password = create_rw_signal(cx, String::new()); let login_action = auth::state(cx).login_action; view! { cx, <div class="flex items-center justify-center w-full h-full"> <div class="max-sm:container flex flex-col w-full max-w-sm p-3 m-4 border-2 border-gray-900 shadow-xl bg-slate-700 rounded-xl"> <h1 class="mb-2 text-3xl font-bold text-white">Login</h1> <TextInput value=login placeholder="Login" /> <TextInput value=password placeholder="Password" password=true /> <Button on:click=move |_cx| { login_action.dispatch(LoginRequest { login: login(), password: password() }) }>Login</Button> </div> </div> } }
/// A decision to apply to the domain. #[derive(PartialEq, Eq, Hash, Debug, Clone, Copy, Serialize, Deserialize, Ord, PartialOrd)] #[repr(C)] pub enum Action { {{~#each choices}} /// cbindgen:field-names=[{{~#each arguments}}{{this.[0]}}, {{/each~}}domain] {{to_type_name name}}( {{~#each arguments}}{{this.[1].def.keys.IdType}},{{/each~}} {{>value_type.name value_type}}), {{/each~}} } /// Helper struct for printing actions with `format!` and `{}`. /// /// Actions contains IDs which references a [`Function`], and thus can't be properly displayed /// without extra information (the objects referred to by the IDs). This struct embeds a reference /// to the [`Function`], which allows it to implement the [`Display`] trait for actions. /// /// [`Display`]: std::fmt::Display /// [`Function`]: crate::ir::Function pub struct DisplayAction<'a> { action: &'a Action, ir_instance: &'a ir::Function, } impl<'a> std::fmt::Debug for DisplayAction<'a> { fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { std::fmt::Debug::fmt(self.action, fmt) } } impl<'a> std::fmt::Display for DisplayAction<'a> { #[allow(unused_variables)] fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { write!( fmt, "{:?} = {}", Choice::from(*self.action), self.action.display_domain(self.ir_instance)) } } /// Helper struct for printing the domain of an action with `format!` and `{}`. /// /// This is similar to [`DisplayAction`] but only displays the domain associated with the action, /// not the choice. pub struct DisplayActionDomain<'a> { action: &'a Action, ir_instance: &'a ir::Function, } impl<'a> std::fmt::Debug for DisplayActionDomain<'a> { #[allow(unused_variables)] fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { let DisplayActionDomain { action, ir_instance } = self; match **action { {{~#each choices}} Action::{{to_type_name name}}({{>choice.arg_names}}domain) => { std::fmt::Debug::fmt(&domain, fmt) }, {{~/each}} } } } impl<'a> std::fmt::Display for DisplayActionDomain<'a> { #[allow(unused_variables)] fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { let DisplayActionDomain { action, ir_instance } = self; match **action { {{~#each choices}} Action::{{to_type_name name}}({{>choice.arg_names}}domain) => { {{~#ifeq choice_def "Integer"}} write!(fmt, "{}", { {{~#each arguments}} let {{this.[0]}} = {{>set.item_getter this.[1] id=this.[0]}}; {{~/each}} domain.display({{>value_type.univers value_type}}) }) {{~else}} write!(fmt, "{}", domain) {{~/ifeq}} }, {{~/each}} } } } impl Action { /// Returns the action performing the complementary decision. #[allow(unused_variables)] pub fn complement(&self, ir_instance: &ir::Function) -> Option<Self> { match *self { {{~#each choices}} Action::{{to_type_name name}}({{>choice.arg_names}}domain) => {{~#if choice_def.Counter}}None{{else}}Some( Action::{{to_type_name name}}({{>choice.arg_names}} {{>choice.complement value="domain"}}) ){{~/if}}, {{~/each}} } } /// Returns an object that implements [`Display`] for printing the action with its associated /// function. /// /// This is needed because actions only contain IDs referring to objects stored on the /// [`Function`] and hence can't be displayed properly without the [`Function`]. /// /// [`Display`]: std::fmt::Display /// [`Function`]: crate::ir::Function pub fn display<'a>(&'a self, ir_instance: &'a ir::Function) -> DisplayAction<'a> { DisplayAction { action: self, ir_instance } } /// Returns an object that implements [`Display`] for printing an action's domain. /// /// This is useful to manipulate something that represents an action's domain for display or /// debugging, since the domains have different types for different actions. /// /// [`Display`]: std::fmt::Display pub fn display_domain<'a>(&'a self, ir_instance: &'a ir::Function) -> DisplayActionDomain<'a> { DisplayActionDomain { action: self, ir_instance } } } /// Applies an action to the domain. pub fn apply_action(action: Action, store: &mut DomainStore, diff: &mut DomainDiff) -> Result<(), ()> { debug!("applying action {:?}", action); match action { {{~#each choices}} Action::{{to_type_name name}}({{#each arguments}}{{this.[0]}}, {{/each}}value) => store.restrict_{{name}}({{#each arguments}}{{this.[0]}}, {{/each}}value, diff), {{~/each}} } }
use crate::repo_cache::RepoCacheOptions; use crate::subprocess::{exec, ExecError}; use fn_search_backend::Config; use std::process::Command; use std::string::FromUtf8Error; use std::time::Duration; use std::{error::Error, fmt}; pub fn chrome_dl(url: &str, config: &Config, o: &RepoCacheOptions) -> Result<String, ChromeError> { let res = exec( &mut Command::new(o.chromium_bin_path.as_str()).args(&[ "--headless", "--disable-gpu", "--dump-dom", url, ]), Duration::from_secs(config.scrape.chrome_timeout), )?; let stdout = res.stdout; match String::from_utf8(stdout) { Ok(output) => Ok(output), Err(e) => Err(ChromeError::StdoutParseError(e)), } } #[derive(Debug)] pub enum ChromeError { ProcessError(ExecError), StdoutParseError(FromUtf8Error), } impl Error for ChromeError {} impl fmt::Display for ChromeError { fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> Result<(), fmt::Error> { match self { ChromeError::ProcessError(e) => write!(f, "error during execution of chrome: {}", e), ChromeError::StdoutParseError(e) => { write!(f, "chrome returned invalid utf8 in output: {}", e) } } } } impl From<ExecError> for ChromeError { fn from(e: ExecError) -> Self { ChromeError::ProcessError(e) } }
pub mod enemies; pub mod levels; pub mod objects;
//! WebSocketcommunication.rs - module that cares about WebSocket communication //region: use use crate::rootrenderingcomponent::RootRenderingComponent; use crate::statusinviteasked; use crate::statusinviteaskbegin; use crate::statusplaybefore1stcard; use crate::statusplaybefore2ndcard; use crate::statustaketurnbegin; use crate::logmod; use futures::Future; use js_sys::Reflect; use mem4_common::GameStatus; use mem4_common::WsMessage; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use web_sys::{console, ErrorEvent, WebSocket}; //endregion //the location_href is not consumed in this function and Clippy wants a reference instead a value //but I don't want references, because they have the lifetime problem. #[allow(clippy::needless_pass_by_value)] ///setup WebSocket connection pub fn setup_ws_connection(location_href: String, client_ws_id: usize) -> WebSocket { //web-sys has WebSocket for Rust exactly like JavaScript has¸ //location_href comes in this format http://localhost:4000/ let mut loc_href = location_href.replace("http://", "ws://").replace("https://", "wss://"); //Only for debugging in the development environment //let mut loc_href = String::from("ws://192.168.1.57:80/"); loc_href.push_str("mem4ws/"); //send the client ws id as url_param for the first connect //and reconnect on lost connection loc_href.push_str(client_ws_id.to_string().as_str()); logmod::log1_str(&format!( "location_href {} loc_href {} client_ws_id {}", location_href, loc_href, client_ws_id )); //same server address and port as http server //for reconnect the old ws id will be an url param let ws = unwrap!(WebSocket::new(&loc_href), "WebSocket failed to connect."); //I don't know why is clone needed let ws_c = ws.clone(); //It looks that the first send is in some way a handshake and is part of the connection //it will be execute on open as a closure let open_handler = Box::new(move || { console::log_1(&"Connection opened, sending RequestWsUid to server".into()); unwrap!( ws_c.send_with_str( &serde_json::to_string(&WsMessage::RequestWsUid { test: String::from("test"), }) .expect("error sending test"), ), "Failed to send 'test' to server" ); }); let cb_oh: Closure<dyn Fn()> = Closure::wrap(open_handler); ws.set_onopen(Some(cb_oh.as_ref().unchecked_ref())); //don't drop the open_handler memory cb_oh.forget(); ws } /// receive WebSocket msg callback. I don't understand this much. Too much future and promises. pub fn setup_ws_msg_recv(ws: &WebSocket, weak: dodrio::VdomWeak) { //Player1 on machine1 have a button Ask player to play! before he starts to play. //Click and it sends the WsMessage invite. Player1 waits for the reply and cannot play. //Player2 on machine2 see the WsMessage and Accepts it. //It sends a WsMessage with the vector of cards. Both will need the same vector. //The vector of cards is copied. //Player1 click a card. It opens locally and sends WsMessage with index of the card. //Machine2 receives the WsMessage and runs the same code as the player would click. The RootRenderingComponent is blocked. //The method with_component() needs a future (promise) It will be executed on the next vdom tick. //This is the only way I found to write to RootRenderingComponent fields. let msg_recv_handler = Box::new(move |msg: JsValue| { let data: JsValue = unwrap!( Reflect::get(&msg, &"data".into()), "No 'data' field in WebSocket message!" ); //serde_json can find out the variant of WsMessage //parse json and put data in the enum let msg: WsMessage = serde_json::from_str(&data.as_string().expect("Field 'data' is not string")) .unwrap_or_else(|_x| WsMessage::Dummy { dummy: String::from("error"), }); //match enum by variant and prepares the future that will be executed on the next tick //in this big enum I put only boilerplate code that don't change any data. //for changing data I put code in separate functions for easy reading. match msg { //I don't know why I need a dummy, but is entertaining to have one. WsMessage::Dummy { dummy } => console::log_1(&dummy.into()), //this RequestWsUid is only for the WebSocket server WsMessage::RequestWsUid { test } => console::log_1(&test.into()), WsMessage::ResponseWsUid { your_ws_uid } => { wasm_bindgen_futures::spawn_local( weak.with_component({ move |root| { logmod::log1_str(&format!("ResponseWsUid: {} ", your_ws_uid)); let root_rendering_component = root.unwrap_mut::<RootRenderingComponent>(); root_rendering_component.on_response_ws_uid(your_ws_uid); } }) .map_err(|_| ()), ); } WsMessage::Invite { my_ws_uid, asked_folder_name, } => { wasm_bindgen_futures::spawn_local( weak.with_component({ let v2 = weak.clone(); move |root| { let root_rendering_component = root.unwrap_mut::<RootRenderingComponent>(); if let GameStatus::GameOverPlayAgainBegin | GameStatus::InviteAskBegin | GameStatus::InviteAsked = root_rendering_component.game_data.game_status { statusinviteaskbegin::on_msg_invite( root_rendering_component, my_ws_uid, asked_folder_name, ); v2.schedule_render(); } } }) .map_err(|_| ()), ); } WsMessage::PlayAccept { my_ws_uid, .. } => { wasm_bindgen_futures::spawn_local( weak.with_component({ let v2 = weak.clone(); move |root| { console::log_1(&"rcv PlayAccept".into()); let root_rendering_component = root.unwrap_mut::<RootRenderingComponent>(); statusinviteasked::on_msg_play_accept( root_rendering_component, my_ws_uid, ); v2.schedule_render(); } }) .map_err(|_| ()), ); } WsMessage::GameDataInit { card_grid_data, game_config, players, } => { wasm_bindgen_futures::spawn_local( weak.with_component({ let v2 = weak.clone(); move |root| { let root_rendering_component = root.unwrap_mut::<RootRenderingComponent>(); if let GameStatus::PlayAccepted = root_rendering_component.game_data.game_status { root_rendering_component.on_msg_game_data_init( &card_grid_data, &game_config, &players, ); v2.schedule_render(); } } }) .map_err(|_| ()), ); } WsMessage::PlayerClick1stCard { card_grid_data, game_status, card_index_of_first_click, card_index_of_second_click, .. } => { wasm_bindgen_futures::spawn_local( weak.with_component({ let v2 = weak.clone(); console::log_1(&"player_click".into()); move |root| { let root_rendering_component = root.unwrap_mut::<RootRenderingComponent>(); console::log_1(&"players".into()); statusplaybefore1stcard::on_msg_player_click_1st_card( root_rendering_component, game_status, card_grid_data.as_str(), card_index_of_first_click, card_index_of_second_click, ); v2.schedule_render(); } }) .map_err(|_| ()), ); } WsMessage::PlayerClick2ndCard { players, card_grid_data, game_status, card_index_of_first_click, card_index_of_second_click, .. } => { wasm_bindgen_futures::spawn_local( weak.with_component({ let v2 = weak.clone(); console::log_1(&"player_click".into()); move |root| { let root_rendering_component = root.unwrap_mut::<RootRenderingComponent>(); console::log_1(&"players".into()); statusplaybefore2ndcard::on_msg_player_click_2nd_card( root_rendering_component, players.as_str(), game_status, card_grid_data.as_str(), card_index_of_first_click, card_index_of_second_click, ); v2.schedule_render(); } }) .map_err(|_| ()), ); } WsMessage::TakeTurnBegin { card_grid_data, game_status, card_index_of_first_click, card_index_of_second_click, .. } => { wasm_bindgen_futures::spawn_local( weak.with_component({ let v2 = weak.clone(); console::log_1(&"take turn begin".into()); move |root| { let root_rendering_component = root.unwrap_mut::<RootRenderingComponent>(); console::log_1(&"players".into()); statustaketurnbegin::on_msg_take_turn_begin( root_rendering_component, game_status, card_grid_data.as_str(), card_index_of_first_click, card_index_of_second_click, ); v2.schedule_render(); } }) .map_err(|_| ()), ); } WsMessage::TakeTurnEnd { .. } => { wasm_bindgen_futures::spawn_local( weak.with_component({ let v2 = weak.clone(); move |root| { let root_rendering_component = root.unwrap_mut::<RootRenderingComponent>(); console::log_1(&"TakeTurnEnd".into()); statustaketurnbegin::on_msg_take_turn_end(root_rendering_component); v2.schedule_render(); } }) .map_err(|_| ()), ); } WsMessage::GameOverPlayAgainBegin { players, card_grid_data, game_status, card_index_of_first_click, card_index_of_second_click, .. } => { wasm_bindgen_futures::spawn_local( weak.with_component({ let v2 = weak.clone(); console::log_1(&"play again".into()); move |root| { let root_rendering_component = root.unwrap_mut::<RootRenderingComponent>(); console::log_1(&"players".into()); statusplaybefore2ndcard::on_msg_play_again( root_rendering_component, players.as_str(), game_status, card_grid_data.as_str(), card_index_of_first_click, card_index_of_second_click, ); v2.schedule_render(); } }) .map_err(|_| ()), ); } } }); //magic ?? let cb_mrh: Closure<dyn Fn(JsValue)> = Closure::wrap(msg_recv_handler); ws.set_onmessage(Some(cb_mrh.as_ref().unchecked_ref())); //don't drop the event listener from memory cb_mrh.forget(); } /// on error write it on the screen for debugging pub fn setup_ws_onerror(ws: &WebSocket, weak: dodrio::VdomWeak) { let onerror_callback = Closure::wrap(Box::new(move |e: ErrorEvent| { let err_text = format!("error event {:?}", e); logmod::log1_str(&err_text); { wasm_bindgen_futures::spawn_local( weak.with_component({ let v2 = weak.clone(); move |root| { console::log_1(&"error text".into()); let root_rendering_component = root.unwrap_mut::<RootRenderingComponent>(); root_rendering_component.game_data.error_text = err_text; v2.schedule_render(); } }) .map_err(|_| ()), ); } }) as Box<dyn FnMut(ErrorEvent)>); ws.set_onerror(Some(onerror_callback.as_ref().unchecked_ref())); onerror_callback.forget(); } /// on close WebSocket connection pub fn setup_ws_onclose(ws: &WebSocket, weak: dodrio::VdomWeak) { let onclose_callback = Closure::wrap(Box::new(move |e: ErrorEvent| { let err_text = format!("ws_onclose {:?}", e); logmod::log1_str(&err_text); { wasm_bindgen_futures::spawn_local( weak.with_component({ let v2 = weak.clone(); move |root| { console::log_1(&"spawn_local because of vdom".into()); let root_rendering_component = root.unwrap_mut::<RootRenderingComponent>(); //I want to show a reconnect button to the user root_rendering_component.game_data.is_reconnect = true; v2.schedule_render(); } }) .map_err(|_| ()), ); } }) as Box<dyn FnMut(ErrorEvent)>); ws.set_onclose(Some(onclose_callback.as_ref().unchecked_ref())); onclose_callback.forget(); } ///setup all ws events pub fn setup_all_ws_events(ws: &WebSocket, weak: dodrio::VdomWeak) { //WebSocket on receive message callback setup_ws_msg_recv(ws, weak.clone()); //WebSocket on error message callback setup_ws_onerror(ws, weak.clone()); //WebSocket on close message callback setup_ws_onclose(ws, weak); } ///generic send ws message pub fn ws_send_msg(ws: &WebSocket, ws_message: &WsMessage) { unwrap!( ws.send_with_str(&unwrap!( serde_json::to_string(ws_message), "error serde_json to_string WsMessage" ),), "Failed to send" ); }
//! [Exampwe of ewwonyenyonyuns code:](https://twitter.com/plaidfinch/status/1176637387511934976) //! //! This library implements streaming owoification. //! //! Get the binary on [Crates.io](https://crates.io/crates/wustc)! //! //! # Special thanks //! //! To all who support further development on [Patreon](https://patreon.com/nabijaczleweli), in particular: //! //! * ThePhD use std::io::{Result as IoResult, Write, Read}; /// Copy the specified to the specified stream while owoifying it /// /// Probably not as performant as it could as it's a byte-by-byte, not block-based copy but /// /// Adapted from https://github.com/EvilDeaaaadd/owoify/blob/fee2bdb05013b48d39c2e5f6ed76ade769bec2f8/src/lib.rs pub fn owo_copy<R: Read, W: Write>(from: R, mut to: W) -> IoResult<()> { let face_step = (&from as *const R as usize) % FACES.len(); let mut cur_face_idx = (&to as *const W as usize) % FACES.len(); let mut cur_state = State::None; for b in from.bytes() { handle_byte(b?, &mut to, face_step, &mut cur_face_idx, &mut cur_state)?; } Ok(()) } #[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] enum State { None, HaveSmallN, HaveBigN, HaveOveO, HaveOveV, HaveExclamationMarks, } static FACES: &[&str] = &["(・`ω´・)", "OwO", "owo", "oωo", "òωó", "°ω°", "UwU", ">w<", "^w^"]; fn handle_byte<W: Write>(b: u8, to: &mut W, face_step: usize, cur_face_idx: &mut usize, cur_state: &mut State) -> IoResult<()> { match (*cur_state, b) { (State::None, c) if c == b'r' || c == b'l' => to.write_all(b"w")?, (State::None, c) if c == b'R' || c == b'L' => to.write_all(b"W")?, (State::None, b'n') => *cur_state = State::HaveSmallN, (State::HaveSmallN, c) if c == b'a' || c == b'e' || c == b'i' || c == b'o' || c == b'u' => to.write_all(b"ny").and_then(|_| to.write_all(&[c]))?, (State::HaveSmallN, c) => { *cur_state = State::None; to.write_all(&[b'n']).and_then(|_| handle_byte(c, to, face_step, cur_face_idx, cur_state))? } (State::None, b'N') => *cur_state = State::HaveBigN, (State::HaveBigN, c) if c == b'a' || c == b'e' || c == b'i' || c == b'o' || c == b'u' => to.write_all(b"Ny").and_then(|_| to.write_all(&[c]))?, (State::HaveBigN, c) if c == b'A' || c == b'E' || c == b'I' || c == b'O' || c == b'U' => to.write_all(b"NY").and_then(|_| to.write_all(&[c]))?, (State::HaveBigN, c) => { *cur_state = State::None; to.write_all(b"N").and_then(|_| handle_byte(c, to, face_step, cur_face_idx, cur_state))? } (State::None, b'o') => *cur_state = State::HaveOveO, (State::HaveOveO, b'v') => *cur_state = State::HaveOveV, (State::HaveOveO, c) => { *cur_state = State::None; to.write_all(b"o").and_then(|_| handle_byte(c, to, face_step, cur_face_idx, cur_state))? } (State::HaveOveV, b'e') => { *cur_state = State::None; to.write_all(b"uv")? } (State::HaveOveV, c) => { *cur_state = State::None; to.write_all(b"ov").and_then(|_| handle_byte(c, to, face_step, cur_face_idx, cur_state))? } (s, b'!') if s == State::None || s == State::HaveExclamationMarks => *cur_state = State::HaveExclamationMarks, (State::HaveExclamationMarks, c) => { *cur_state = State::None; to.write_all(b" ") .and_then(|_| to.write_all(FACES[*cur_face_idx].as_bytes())) .and_then(|_| to.write_all(b" ")) .and_then(|_| handle_byte(c, to, face_step, cur_face_idx, cur_state))?; *cur_face_idx = (*cur_face_idx + face_step) % FACES.len(); } (State::None, c) => to.write_all(&[c])?, } Ok(()) }
use std::ops::{Add, Sub, Mul, Div, AddAssign, SubAssign, MulAssign, DivAssign}; use std::time::Duration; #[derive(Debug,Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Hash)] pub struct Round(pub usize); // Essentially "Instant" at the round level #[derive(Debug,Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Hash)] pub struct Rounds(pub usize); // Essentially "Duration" at the round level #[derive(Debug,Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Hash)] pub struct Turn(pub usize); // "Instant" for turns #[derive(Debug,Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Hash)] pub struct Turns(pub usize); // "Duration" for turns #[derive(Debug,Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Hash)] pub struct Time { pub round: Round, pub turn: Turn, } macro_rules! derive_op { ($type:ident, $rhs:ident, $trait:ident, $meth:ident, $binop:tt, $atrait:ident, $assn: ident, $abinop: tt) => { impl $trait<$rhs> for $type { type Output = Self; fn $meth(self, o: $rhs) -> Self { Self(self.0 $binop o.0) } } impl $atrait<$rhs> for $type { fn $assn(&mut self, o: $rhs) { self.0 $abinop o.0; } } } } macro_rules! impl_arith { ($type:ident) => { derive_op!($type, $type, Add, add, +, AddAssign, add_assign, +=); derive_op!($type, $type, Sub, sub, -, SubAssign, sub_assign, -=); derive_op!($type, $type, Mul, mul, *, MulAssign, mul_assign, *=); derive_op!($type, $type, Div, div, /, DivAssign, div_assign, /=); }; ($type:ident, $rhs:ident) => { derive_op!($type, $rhs, Add, add, +, AddAssign, add_assign, +=); derive_op!($type, $rhs, Sub, sub, -, SubAssign, sub_assign, -=); derive_op!($type, $rhs, Mul, mul, *, MulAssign, mul_assign, *=); derive_op!($type, $rhs, Div, div, /, DivAssign, div_assign, /=); } } macro_rules! impl_types { ($inst:ident, $dur:ident) => { impl $dur { pub const ZERO: $dur = $dur(0); } impl_arith!($dur); impl_arith!($inst, $dur); impl Sub for $inst { type Output = $dur; fn sub(self, o: Self) -> $dur { $dur(self.0 - o.0) } } } } impl_types!(Round, Rounds); impl_types!(Turn, Turns); impl Rounds { pub const SECS_PER: usize = 6; pub const ONE_MINUTE: usize = 60 / Self::SECS_PER; pub const TEN_MINUTES: usize = 10 * Self::ONE_MINUTE; pub const ONE_HOUR: usize = 60 * Self::ONE_MINUTE; } impl From<Duration> for Round { fn from(d: Duration) -> Self { Self(d.as_secs() as usize / Rounds::SECS_PER) } } impl Into<Duration> for Round { fn into(self) -> Duration { Duration::new((self.0 * Rounds::SECS_PER) as u64, 0) } }
use super::host; use crate::sys::{errno_from_host, fdentry_impl}; use std::fs; use std::io; use std::mem::ManuallyDrop; use std::path::PathBuf; #[derive(Debug)] pub enum Descriptor { File(fs::File), Stdin, Stdout, Stderr, } #[derive(Debug)] pub struct FdObject { pub file_type: host::__wasi_filetype_t, pub descriptor: ManuallyDrop<Descriptor>, pub needs_close: bool, // TODO: directories } #[derive(Debug)] pub struct FdEntry { pub fd_object: FdObject, pub rights_base: host::__wasi_rights_t, pub rights_inheriting: host::__wasi_rights_t, pub preopen_path: Option<PathBuf>, } impl Drop for FdObject { fn drop(&mut self) { if self.needs_close { unsafe { ManuallyDrop::drop(&mut self.descriptor) }; } } } impl FdEntry { pub fn from(file: fs::File) -> Result<Self, host::__wasi_errno_t> { fdentry_impl::determine_type_and_access_rights(&file).map( |(file_type, rights_base, rights_inheriting)| Self { fd_object: FdObject { file_type, descriptor: ManuallyDrop::new(Descriptor::File(file)), needs_close: true, }, rights_base, rights_inheriting, preopen_path: None, }, ) } pub fn duplicate(file: &fs::File) -> Result<Self, host::__wasi_errno_t> { file.try_clone() .map_err(|err| err.raw_os_error().map_or(host::__WASI_EIO, errno_from_host)) .and_then(Self::from) } pub fn duplicate_stdin() -> Result<Self, host::__wasi_errno_t> { fdentry_impl::determine_type_and_access_rights(&io::stdin()).map( |(file_type, rights_base, rights_inheriting)| Self { fd_object: FdObject { file_type, descriptor: ManuallyDrop::new(Descriptor::Stdin), needs_close: true, }, rights_base, rights_inheriting, preopen_path: None, }, ) } pub fn duplicate_stdout() -> Result<Self, host::__wasi_errno_t> { fdentry_impl::determine_type_and_access_rights(&io::stdout()).map( |(file_type, rights_base, rights_inheriting)| Self { fd_object: FdObject { file_type, descriptor: ManuallyDrop::new(Descriptor::Stdout), needs_close: true, }, rights_base, rights_inheriting, preopen_path: None, }, ) } pub fn duplicate_stderr() -> Result<Self, host::__wasi_errno_t> { fdentry_impl::determine_type_and_access_rights(&io::stderr()).map( |(file_type, rights_base, rights_inheriting)| Self { fd_object: FdObject { file_type, descriptor: ManuallyDrop::new(Descriptor::Stderr), needs_close: true, }, rights_base, rights_inheriting, preopen_path: None, }, ) } }
use std::path::PathBuf; use std::sync::mpsc; use std::time; use notify::{Watcher, RecursiveMode, watcher, DebouncedEvent, ReadDirectoryChangesWatcher}; use super::calibration; use nalgebra::{Translation3, UnitQuaternion}; pub struct ProfileProvider { path: PathBuf, watcher: ReadDirectoryChangesWatcher, rx: mpsc::Receiver<DebouncedEvent>, pub wfd_rotation: UnitQuaternion<f64>, pub wfd_translation: Translation3<f64>, } impl ProfileProvider { pub fn new(path: PathBuf) -> Self { let (tx, rx) = mpsc::channel(); let mut watcher = watcher(tx, time::Duration::from_secs(5)).unwrap(); watcher.watch(&path, RecursiveMode::NonRecursive).unwrap(); let profile = calibration::load(&path).unwrap(); let wfd_rotation = profile.wfd_rotation(); let wfd_translation = profile.wfd_translation(); Self { path, watcher, rx, wfd_rotation, wfd_translation } } pub fn reload_if_updated(&mut self) { let events = self.rx.try_iter().count(); if events > 0 { match calibration::load(&self.path) { Ok(profile) => { self.wfd_rotation = profile.wfd_rotation(); self.wfd_translation = profile.wfd_translation(); eprintln!("Profile was reloaded"); }, Err(e) => { eprintln!("Could not reload profile: {}", e); }, } } } }
use crate::algebra::Magma; /// A commutative magma. /// /// # Laws /// * Commutativity: ∀`x` ∀`y` (`x.op(&y)` = `y.op(&x)`) pub trait CommutativeMagma: Magma {}
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IWCNConnectNotify(pub ::windows::core::IUnknown); impl IWCNConnectNotify { pub unsafe fn ConnectSucceeded(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn ConnectFailed(&self, hrfailure: ::windows::core::HRESULT) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(hrfailure)).ok() } } unsafe impl ::windows::core::Interface for IWCNConnectNotify { type Vtable = IWCNConnectNotify_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc100be9f_d33a_4a4b_bf23_bbef4663d017); } impl ::core::convert::From<IWCNConnectNotify> for ::windows::core::IUnknown { fn from(value: IWCNConnectNotify) -> Self { value.0 } } impl ::core::convert::From<&IWCNConnectNotify> for ::windows::core::IUnknown { fn from(value: &IWCNConnectNotify) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWCNConnectNotify { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWCNConnectNotify { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IWCNConnectNotify_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hrfailure: ::windows::core::HRESULT) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IWCNDevice(pub ::windows::core::IUnknown); impl IWCNDevice { pub unsafe fn SetPassword(&self, r#type: WCN_PASSWORD_TYPE, dwpasswordlength: u32, pbpassword: *const u8) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(r#type), ::core::mem::transmute(dwpasswordlength), ::core::mem::transmute(pbpassword)).ok() } pub unsafe fn Connect<'a, Param0: ::windows::core::IntoParam<'a, IWCNConnectNotify>>(&self, pnotify: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), pnotify.into_param().abi()).ok() } pub unsafe fn GetAttribute(&self, attributetype: WCN_ATTRIBUTE_TYPE, dwmaxbuffersize: u32, pbbuffer: *mut u8, pdwbufferused: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(attributetype), ::core::mem::transmute(dwmaxbuffersize), ::core::mem::transmute(pbbuffer), ::core::mem::transmute(pdwbufferused)).ok() } pub unsafe fn GetIntegerAttribute(&self, attributetype: WCN_ATTRIBUTE_TYPE) -> ::windows::core::Result<u32> { let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(attributetype), &mut result__).from_abi::<u32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetStringAttribute(&self, attributetype: WCN_ATTRIBUTE_TYPE, cchmaxstring: u32, wszstring: super::super::Foundation::PWSTR) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(attributetype), ::core::mem::transmute(cchmaxstring), ::core::mem::transmute(wszstring)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetNetworkProfile(&self, cchmaxstringlength: u32, wszprofile: super::super::Foundation::PWSTR) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(cchmaxstringlength), ::core::mem::transmute(wszprofile)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetNetworkProfile<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszprofilexml: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), pszprofilexml.into_param().abi()).ok() } pub unsafe fn GetVendorExtension(&self, pvendorextspec: *const WCN_VENDOR_EXTENSION_SPEC, dwmaxbuffersize: u32, pbbuffer: *mut u8, pdwbufferused: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(pvendorextspec), ::core::mem::transmute(dwmaxbuffersize), ::core::mem::transmute(pbbuffer), ::core::mem::transmute(pdwbufferused)).ok() } pub unsafe fn SetVendorExtension(&self, pvendorextspec: *const WCN_VENDOR_EXTENSION_SPEC, cbbuffer: u32, pbbuffer: *const u8) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(pvendorextspec), ::core::mem::transmute(cbbuffer), ::core::mem::transmute(pbbuffer)).ok() } pub unsafe fn Unadvise(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn SetNFCPasswordParams(&self, r#type: WCN_PASSWORD_TYPE, dwoobpasswordid: u32, dwpasswordlength: u32, pbpassword: *const u8, dwremotepublickeyhashlength: u32, pbremotepublickeyhash: *const u8, dwdhkeybloblength: u32, pbdhkeyblob: *const u8) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).13)( ::core::mem::transmute_copy(self), ::core::mem::transmute(r#type), ::core::mem::transmute(dwoobpasswordid), ::core::mem::transmute(dwpasswordlength), ::core::mem::transmute(pbpassword), ::core::mem::transmute(dwremotepublickeyhashlength), ::core::mem::transmute(pbremotepublickeyhash), ::core::mem::transmute(dwdhkeybloblength), ::core::mem::transmute(pbdhkeyblob), ) .ok() } } unsafe impl ::windows::core::Interface for IWCNDevice { type Vtable = IWCNDevice_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc100be9c_d33a_4a4b_bf23_bbef4663d017); } impl ::core::convert::From<IWCNDevice> for ::windows::core::IUnknown { fn from(value: IWCNDevice) -> Self { value.0 } } impl ::core::convert::From<&IWCNDevice> for ::windows::core::IUnknown { fn from(value: &IWCNDevice) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IWCNDevice { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a IWCNDevice { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IWCNDevice_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, r#type: WCN_PASSWORD_TYPE, dwpasswordlength: u32, pbpassword: *const u8) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pnotify: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, attributetype: WCN_ATTRIBUTE_TYPE, dwmaxbuffersize: u32, pbbuffer: *mut u8, pdwbufferused: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, attributetype: WCN_ATTRIBUTE_TYPE, puinteger: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, attributetype: WCN_ATTRIBUTE_TYPE, cchmaxstring: u32, wszstring: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, cchmaxstringlength: u32, wszprofile: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszprofilexml: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pvendorextspec: *const WCN_VENDOR_EXTENSION_SPEC, dwmaxbuffersize: u32, pbbuffer: *mut u8, pdwbufferused: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pvendorextspec: *const WCN_VENDOR_EXTENSION_SPEC, cbbuffer: u32, pbbuffer: *const u8) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, r#type: WCN_PASSWORD_TYPE, dwoobpasswordid: u32, dwpasswordlength: u32, pbpassword: *const u8, dwremotepublickeyhashlength: u32, pbremotepublickeyhash: *const u8, dwdhkeybloblength: u32, pbdhkeyblob: *const u8) -> ::windows::core::HRESULT, ); #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const PKEY_WCN_DeviceType_Category: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x88190b8b_4684_11da_a26a_0002b3988e81), pid: 16u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const PKEY_WCN_DeviceType_SubCategory: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x88190b8b_4684_11da_a26a_0002b3988e81), pid: 18u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const PKEY_WCN_DeviceType_SubCategoryOUI: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x88190b8b_4684_11da_a26a_0002b3988e81), pid: 17u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const PKEY_WCN_SSID: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x88190b8b_4684_11da_a26a_0002b3988e81), pid: 32u32, }; pub const SID_WcnProvider: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc100beca_d33a_4a4b_bf23_bbef4663d017); pub const WCNDeviceObject: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc100bea7_d33a_4a4b_bf23_bbef4663d017); pub const WCN_API_MAX_BUFFER_SIZE: u32 = 2096u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_ATTRIBUTE_TYPE(pub i32); pub const WCN_TYPE_AP_CHANNEL: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(0i32); pub const WCN_TYPE_ASSOCIATION_STATE: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(1i32); pub const WCN_TYPE_AUTHENTICATION_TYPE: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(2i32); pub const WCN_TYPE_AUTHENTICATION_TYPE_FLAGS: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(3i32); pub const WCN_TYPE_AUTHENTICATOR: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(4i32); pub const WCN_TYPE_CONFIG_METHODS: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(5i32); pub const WCN_TYPE_CONFIGURATION_ERROR: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(6i32); pub const WCN_TYPE_CONFIRMATION_URL4: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(7i32); pub const WCN_TYPE_CONFIRMATION_URL6: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(8i32); pub const WCN_TYPE_CONNECTION_TYPE: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(9i32); pub const WCN_TYPE_CONNECTION_TYPE_FLAGS: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(10i32); pub const WCN_TYPE_CREDENTIAL: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(11i32); pub const WCN_TYPE_DEVICE_NAME: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(12i32); pub const WCN_TYPE_DEVICE_PASSWORD_ID: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(13i32); pub const WCN_TYPE_E_HASH1: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(14i32); pub const WCN_TYPE_E_HASH2: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(15i32); pub const WCN_TYPE_E_SNONCE1: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(16i32); pub const WCN_TYPE_E_SNONCE2: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(17i32); pub const WCN_TYPE_ENCRYPTED_SETTINGS: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(18i32); pub const WCN_TYPE_ENCRYPTION_TYPE: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(19i32); pub const WCN_TYPE_ENCRYPTION_TYPE_FLAGS: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(20i32); pub const WCN_TYPE_ENROLLEE_NONCE: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(21i32); pub const WCN_TYPE_FEATURE_ID: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(22i32); pub const WCN_TYPE_IDENTITY: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(23i32); pub const WCN_TYPE_IDENTITY_PROOF: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(24i32); pub const WCN_TYPE_KEY_WRAP_AUTHENTICATOR: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(25i32); pub const WCN_TYPE_KEY_IDENTIFIER: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(26i32); pub const WCN_TYPE_MAC_ADDRESS: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(27i32); pub const WCN_TYPE_MANUFACTURER: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(28i32); pub const WCN_TYPE_MESSAGE_TYPE: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(29i32); pub const WCN_TYPE_MODEL_NAME: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(30i32); pub const WCN_TYPE_MODEL_NUMBER: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(31i32); pub const WCN_TYPE_NETWORK_INDEX: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(32i32); pub const WCN_TYPE_NETWORK_KEY: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(33i32); pub const WCN_TYPE_NETWORK_KEY_INDEX: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(34i32); pub const WCN_TYPE_NEW_DEVICE_NAME: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(35i32); pub const WCN_TYPE_NEW_PASSWORD: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(36i32); pub const WCN_TYPE_OOB_DEVICE_PASSWORD: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(37i32); pub const WCN_TYPE_OS_VERSION: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(38i32); pub const WCN_TYPE_POWER_LEVEL: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(39i32); pub const WCN_TYPE_PSK_CURRENT: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(40i32); pub const WCN_TYPE_PSK_MAX: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(41i32); pub const WCN_TYPE_PUBLIC_KEY: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(42i32); pub const WCN_TYPE_RADIO_ENABLED: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(43i32); pub const WCN_TYPE_REBOOT: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(44i32); pub const WCN_TYPE_REGISTRAR_CURRENT: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(45i32); pub const WCN_TYPE_REGISTRAR_ESTABLISHED: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(46i32); pub const WCN_TYPE_REGISTRAR_LIST: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(47i32); pub const WCN_TYPE_REGISTRAR_MAX: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(48i32); pub const WCN_TYPE_REGISTRAR_NONCE: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(49i32); pub const WCN_TYPE_REQUEST_TYPE: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(50i32); pub const WCN_TYPE_RESPONSE_TYPE: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(51i32); pub const WCN_TYPE_RF_BANDS: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(52i32); pub const WCN_TYPE_R_HASH1: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(53i32); pub const WCN_TYPE_R_HASH2: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(54i32); pub const WCN_TYPE_R_SNONCE1: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(55i32); pub const WCN_TYPE_R_SNONCE2: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(56i32); pub const WCN_TYPE_SELECTED_REGISTRAR: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(57i32); pub const WCN_TYPE_SERIAL_NUMBER: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(58i32); pub const WCN_TYPE_WI_FI_PROTECTED_SETUP_STATE: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(59i32); pub const WCN_TYPE_SSID: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(60i32); pub const WCN_TYPE_TOTAL_NETWORKS: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(61i32); pub const WCN_TYPE_UUID_E: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(62i32); pub const WCN_TYPE_UUID_R: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(63i32); pub const WCN_TYPE_VENDOR_EXTENSION: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(64i32); pub const WCN_TYPE_VERSION: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(65i32); pub const WCN_TYPE_X_509_CERTIFICATE_REQUEST: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(66i32); pub const WCN_TYPE_X_509_CERTIFICATE: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(67i32); pub const WCN_TYPE_EAP_IDENTITY: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(68i32); pub const WCN_TYPE_MESSAGE_COUNTER: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(69i32); pub const WCN_TYPE_PUBLIC_KEY_HASH: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(70i32); pub const WCN_TYPE_REKEY_KEY: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(71i32); pub const WCN_TYPE_KEY_LIFETIME: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(72i32); pub const WCN_TYPE_PERMITTED_CONFIG_METHODS: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(73i32); pub const WCN_TYPE_SELECTED_REGISTRAR_CONFIG_METHODS: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(74i32); pub const WCN_TYPE_PRIMARY_DEVICE_TYPE: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(75i32); pub const WCN_TYPE_SECONDARY_DEVICE_TYPE_LIST: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(76i32); pub const WCN_TYPE_PORTABLE_DEVICE: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(77i32); pub const WCN_TYPE_AP_SETUP_LOCKED: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(78i32); pub const WCN_TYPE_APPLICATION_EXTENSION: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(79i32); pub const WCN_TYPE_EAP_TYPE: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(80i32); pub const WCN_TYPE_INITIALIZATION_VECTOR: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(81i32); pub const WCN_TYPE_KEY_PROVIDED_AUTOMATICALLY: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(82i32); pub const WCN_TYPE_802_1X_ENABLED: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(83i32); pub const WCN_TYPE_APPSESSIONKEY: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(84i32); pub const WCN_TYPE_WEPTRANSMITKEY: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(85i32); pub const WCN_TYPE_UUID: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(86i32); pub const WCN_TYPE_PRIMARY_DEVICE_TYPE_CATEGORY: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(87i32); pub const WCN_TYPE_PRIMARY_DEVICE_TYPE_SUBCATEGORY_OUI: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(88i32); pub const WCN_TYPE_PRIMARY_DEVICE_TYPE_SUBCATEGORY: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(89i32); pub const WCN_TYPE_CURRENT_SSID: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(90i32); pub const WCN_TYPE_BSSID: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(91i32); pub const WCN_TYPE_DOT11_MAC_ADDRESS: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(92i32); pub const WCN_TYPE_AUTHORIZED_MACS: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(93i32); pub const WCN_TYPE_NETWORK_KEY_SHAREABLE: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(94i32); pub const WCN_TYPE_REQUEST_TO_ENROLL: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(95i32); pub const WCN_TYPE_REQUESTED_DEVICE_TYPE: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(96i32); pub const WCN_TYPE_SETTINGS_DELAY_TIME: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(97i32); pub const WCN_TYPE_VERSION2: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(98i32); pub const WCN_TYPE_VENDOR_EXTENSION_WFA: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(99i32); pub const WCN_NUM_ATTRIBUTE_TYPES: WCN_ATTRIBUTE_TYPE = WCN_ATTRIBUTE_TYPE(100i32); impl ::core::convert::From<i32> for WCN_ATTRIBUTE_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_ATTRIBUTE_TYPE { type Abi = Self; } pub const WCN_E_AUTHENTICATION_FAILED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2147206142i32 as _); pub const WCN_E_CONNECTION_REJECTED: ::windows::core::HRESULT = ::windows::core::HRESULT(-2147206141i32 as _); pub const WCN_E_PEER_NOT_FOUND: ::windows::core::HRESULT = ::windows::core::HRESULT(-2147206143i32 as _); pub const WCN_E_PROTOCOL_ERROR: ::windows::core::HRESULT = ::windows::core::HRESULT(-2147206139i32 as _); pub const WCN_E_SESSION_TIMEDOUT: ::windows::core::HRESULT = ::windows::core::HRESULT(-2147206140i32 as _); pub const WCN_FLAG_AUTHENTICATED_VE: u32 = 2u32; pub const WCN_FLAG_DISCOVERY_VE: u32 = 1u32; pub const WCN_FLAG_ENCRYPTED_VE: u32 = 4u32; pub const WCN_MICROSOFT_VENDOR_ID: u32 = 311u32; pub const WCN_NO_SUBTYPE: u32 = 4294967294u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_PASSWORD_TYPE(pub i32); pub const WCN_PASSWORD_TYPE_PUSH_BUTTON: WCN_PASSWORD_TYPE = WCN_PASSWORD_TYPE(0i32); pub const WCN_PASSWORD_TYPE_PIN: WCN_PASSWORD_TYPE = WCN_PASSWORD_TYPE(1i32); pub const WCN_PASSWORD_TYPE_PIN_REGISTRAR_SPECIFIED: WCN_PASSWORD_TYPE = WCN_PASSWORD_TYPE(2i32); pub const WCN_PASSWORD_TYPE_OOB_SPECIFIED: WCN_PASSWORD_TYPE = WCN_PASSWORD_TYPE(3i32); pub const WCN_PASSWORD_TYPE_WFDS: WCN_PASSWORD_TYPE = WCN_PASSWORD_TYPE(4i32); impl ::core::convert::From<i32> for WCN_PASSWORD_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_PASSWORD_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_SESSION_STATUS(pub i32); pub const WCN_SESSION_STATUS_SUCCESS: WCN_SESSION_STATUS = WCN_SESSION_STATUS(0i32); pub const WCN_SESSION_STATUS_FAILURE_GENERIC: WCN_SESSION_STATUS = WCN_SESSION_STATUS(1i32); pub const WCN_SESSION_STATUS_FAILURE_TIMEOUT: WCN_SESSION_STATUS = WCN_SESSION_STATUS(2i32); impl ::core::convert::From<i32> for WCN_SESSION_STATUS { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_SESSION_STATUS { type Abi = Self; } pub const WCN_VALUE_DT_CATEGORY_AUDIO_DEVICE: u32 = 11u32; pub const WCN_VALUE_DT_CATEGORY_CAMERA: u32 = 4u32; pub const WCN_VALUE_DT_CATEGORY_COMPUTER: u32 = 1u32; pub const WCN_VALUE_DT_CATEGORY_DISPLAY: u32 = 7u32; pub const WCN_VALUE_DT_CATEGORY_GAMING_DEVICE: u32 = 9u32; pub const WCN_VALUE_DT_CATEGORY_INPUT_DEVICE: u32 = 2u32; pub const WCN_VALUE_DT_CATEGORY_MULTIMEDIA_DEVICE: u32 = 8u32; pub const WCN_VALUE_DT_CATEGORY_NETWORK_INFRASTRUCTURE: u32 = 6u32; pub const WCN_VALUE_DT_CATEGORY_OTHER: u32 = 255u32; pub const WCN_VALUE_DT_CATEGORY_PRINTER: u32 = 3u32; pub const WCN_VALUE_DT_CATEGORY_STORAGE: u32 = 5u32; pub const WCN_VALUE_DT_CATEGORY_TELEPHONE: u32 = 10u32; pub const WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE__HEADPHONES: u32 = 5u32; pub const WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE__HEADSET: u32 = 4u32; pub const WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE__HOMETHEATER: u32 = 7u32; pub const WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE__MICROPHONE: u32 = 6u32; pub const WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE__PMP: u32 = 3u32; pub const WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE__SPEAKERS: u32 = 2u32; pub const WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE__TUNER_RECEIVER: u32 = 1u32; pub const WCN_VALUE_DT_SUBTYPE_CAMERA__SECURITY_CAMERA: u32 = 4u32; pub const WCN_VALUE_DT_SUBTYPE_CAMERA__STILL_CAMERA: u32 = 1u32; pub const WCN_VALUE_DT_SUBTYPE_CAMERA__VIDEO_CAMERA: u32 = 2u32; pub const WCN_VALUE_DT_SUBTYPE_CAMERA__WEB_CAMERA: u32 = 3u32; pub const WCN_VALUE_DT_SUBTYPE_COMPUTER__DESKTOP: u32 = 6u32; pub const WCN_VALUE_DT_SUBTYPE_COMPUTER__MEDIACENTER: u32 = 3u32; pub const WCN_VALUE_DT_SUBTYPE_COMPUTER__MID: u32 = 7u32; pub const WCN_VALUE_DT_SUBTYPE_COMPUTER__NETBOOK: u32 = 8u32; pub const WCN_VALUE_DT_SUBTYPE_COMPUTER__NOTEBOOK: u32 = 5u32; pub const WCN_VALUE_DT_SUBTYPE_COMPUTER__PC: u32 = 1u32; pub const WCN_VALUE_DT_SUBTYPE_COMPUTER__SERVER: u32 = 2u32; pub const WCN_VALUE_DT_SUBTYPE_COMPUTER__ULTRAMOBILEPC: u32 = 4u32; pub const WCN_VALUE_DT_SUBTYPE_DISPLAY__MONITOR: u32 = 4u32; pub const WCN_VALUE_DT_SUBTYPE_DISPLAY__PICTURE_FRAME: u32 = 2u32; pub const WCN_VALUE_DT_SUBTYPE_DISPLAY__PROJECTOR: u32 = 3u32; pub const WCN_VALUE_DT_SUBTYPE_DISPLAY__TELEVISION: u32 = 1u32; pub const WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE__CONSOLE_ADAPT: u32 = 4u32; pub const WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE__PLAYSTATION: u32 = 3u32; pub const WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE__PORTABLE: u32 = 5u32; pub const WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE__XBOX: u32 = 1u32; pub const WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE__XBOX360: u32 = 2u32; pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__BARCODEREADER: u32 = 9u32; pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__BIOMETRICREADER: u32 = 8u32; pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__GAMECONTROLLER: u32 = 5u32; pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__JOYSTICK: u32 = 3u32; pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__KEYBOARD: u32 = 1u32; pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__MOUSE: u32 = 2u32; pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__REMOTE: u32 = 6u32; pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__TOUCHSCREEN: u32 = 7u32; pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__TRACKBALL: u32 = 4u32; pub const WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE__DAR: u32 = 1u32; pub const WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE__MCX: u32 = 3u32; pub const WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE__MEDIA_SERVER_ADAPT_EXT: u32 = 5u32; pub const WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE__PVP: u32 = 6u32; pub const WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE__PVR: u32 = 2u32; pub const WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE__SETTOPBOX: u32 = 4u32; pub const WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE__AP: u32 = 1u32; pub const WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE__BRIDGE: u32 = 5u32; pub const WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE__GATEWAY: u32 = 4u32; pub const WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE__ROUTER: u32 = 2u32; pub const WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE__SWITCH: u32 = 3u32; pub const WCN_VALUE_DT_SUBTYPE_PRINTER__ALLINONE: u32 = 5u32; pub const WCN_VALUE_DT_SUBTYPE_PRINTER__COPIER: u32 = 4u32; pub const WCN_VALUE_DT_SUBTYPE_PRINTER__FAX: u32 = 3u32; pub const WCN_VALUE_DT_SUBTYPE_PRINTER__PRINTER: u32 = 1u32; pub const WCN_VALUE_DT_SUBTYPE_PRINTER__SCANNER: u32 = 2u32; pub const WCN_VALUE_DT_SUBTYPE_STORAGE__NAS: u32 = 1u32; pub const WCN_VALUE_DT_SUBTYPE_TELEPHONE__PHONE_DUALMODE: u32 = 3u32; pub const WCN_VALUE_DT_SUBTYPE_TELEPHONE__PHONE_SINGLEMODE: u32 = 2u32; pub const WCN_VALUE_DT_SUBTYPE_TELEPHONE__SMARTPHONE_DUALMODE: u32 = 5u32; pub const WCN_VALUE_DT_SUBTYPE_TELEPHONE__SMARTPHONE_SINGLEMODE: u32 = 4u32; pub const WCN_VALUE_DT_SUBTYPE_TELEPHONE__WINDOWS_MOBILE: u32 = 1u32; pub const WCN_VALUE_DT_SUBTYPE_WIFI_OUI: u32 = 5304836u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_VALUE_TYPE_ASSOCIATION_STATE(pub i32); pub const WCN_VALUE_AS_NOT_ASSOCIATED: WCN_VALUE_TYPE_ASSOCIATION_STATE = WCN_VALUE_TYPE_ASSOCIATION_STATE(0i32); pub const WCN_VALUE_AS_CONNECTION_SUCCESS: WCN_VALUE_TYPE_ASSOCIATION_STATE = WCN_VALUE_TYPE_ASSOCIATION_STATE(1i32); pub const WCN_VALUE_AS_CONFIGURATION_FAILURE: WCN_VALUE_TYPE_ASSOCIATION_STATE = WCN_VALUE_TYPE_ASSOCIATION_STATE(2i32); pub const WCN_VALUE_AS_ASSOCIATION_FAILURE: WCN_VALUE_TYPE_ASSOCIATION_STATE = WCN_VALUE_TYPE_ASSOCIATION_STATE(3i32); pub const WCN_VALUE_AS_IP_FAILURE: WCN_VALUE_TYPE_ASSOCIATION_STATE = WCN_VALUE_TYPE_ASSOCIATION_STATE(4i32); impl ::core::convert::From<i32> for WCN_VALUE_TYPE_ASSOCIATION_STATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_VALUE_TYPE_ASSOCIATION_STATE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_VALUE_TYPE_AUTHENTICATION_TYPE(pub i32); pub const WCN_VALUE_AT_OPEN: WCN_VALUE_TYPE_AUTHENTICATION_TYPE = WCN_VALUE_TYPE_AUTHENTICATION_TYPE(1i32); pub const WCN_VALUE_AT_WPAPSK: WCN_VALUE_TYPE_AUTHENTICATION_TYPE = WCN_VALUE_TYPE_AUTHENTICATION_TYPE(2i32); pub const WCN_VALUE_AT_SHARED: WCN_VALUE_TYPE_AUTHENTICATION_TYPE = WCN_VALUE_TYPE_AUTHENTICATION_TYPE(4i32); pub const WCN_VALUE_AT_WPA: WCN_VALUE_TYPE_AUTHENTICATION_TYPE = WCN_VALUE_TYPE_AUTHENTICATION_TYPE(8i32); pub const WCN_VALUE_AT_WPA2: WCN_VALUE_TYPE_AUTHENTICATION_TYPE = WCN_VALUE_TYPE_AUTHENTICATION_TYPE(16i32); pub const WCN_VALUE_AT_WPA2PSK: WCN_VALUE_TYPE_AUTHENTICATION_TYPE = WCN_VALUE_TYPE_AUTHENTICATION_TYPE(32i32); pub const WCN_VALUE_AT_WPAWPA2PSK_MIXED: WCN_VALUE_TYPE_AUTHENTICATION_TYPE = WCN_VALUE_TYPE_AUTHENTICATION_TYPE(34i32); impl ::core::convert::From<i32> for WCN_VALUE_TYPE_AUTHENTICATION_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_VALUE_TYPE_AUTHENTICATION_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_VALUE_TYPE_BOOLEAN(pub i32); pub const WCN_VALUE_FALSE: WCN_VALUE_TYPE_BOOLEAN = WCN_VALUE_TYPE_BOOLEAN(0i32); pub const WCN_VALUE_TRUE: WCN_VALUE_TYPE_BOOLEAN = WCN_VALUE_TYPE_BOOLEAN(1i32); impl ::core::convert::From<i32> for WCN_VALUE_TYPE_BOOLEAN { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_VALUE_TYPE_BOOLEAN { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_VALUE_TYPE_CONFIGURATION_ERROR(pub i32); pub const WCN_VALUE_CE_NO_ERROR: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(0i32); pub const WCN_VALUE_CE_OOB_INTERFACE_READ_ERROR: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(1i32); pub const WCN_VALUE_CE_DECRYPTION_CRC_FAILURE: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(2i32); pub const WCN_VALUE_CE_2_4_CHANNEL_NOT_SUPPORTED: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(3i32); pub const WCN_VALUE_CE_5_0_CHANNEL_NOT_SUPPORTED: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(4i32); pub const WCN_VALUE_CE_SIGNAL_TOO_WEAK: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(5i32); pub const WCN_VALUE_CE_NETWORK_AUTHENTICATION_FAILURE: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(6i32); pub const WCN_VALUE_CE_NETWORK_ASSOCIATION_FAILURE: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(7i32); pub const WCN_VALUE_CE_NO_DHCP_RESPONSE: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(8i32); pub const WCN_VALUE_CE_FAILED_DHCP_CONFIG: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(9i32); pub const WCN_VALUE_CE_IP_ADDRESS_CONFLICT: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(10i32); pub const WCN_VALUE_CE_COULD_NOT_CONNECT_TO_REGISTRAR: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(11i32); pub const WCN_VALUE_CE_MULTIPLE_PBC_SESSIONS_DETECTED: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(12i32); pub const WCN_VALUE_CE_ROGUE_ACTIVITY_SUSPECTED: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(13i32); pub const WCN_VALUE_CE_DEVICE_BUSY: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(14i32); pub const WCN_VALUE_CE_SETUP_LOCKED: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(15i32); pub const WCN_VALUE_CE_MESSAGE_TIMEOUT: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(16i32); pub const WCN_VALUE_CE_REGISTRATION_SESSION_TIMEOUT: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(17i32); pub const WCN_VALUE_CE_DEVICE_PASSWORD_AUTH_FAILURE: WCN_VALUE_TYPE_CONFIGURATION_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR(18i32); impl ::core::convert::From<i32> for WCN_VALUE_TYPE_CONFIGURATION_ERROR { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_VALUE_TYPE_CONFIGURATION_ERROR { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_VALUE_TYPE_CONFIG_METHODS(pub i32); pub const WCN_VALUE_CM_USBA: WCN_VALUE_TYPE_CONFIG_METHODS = WCN_VALUE_TYPE_CONFIG_METHODS(1i32); pub const WCN_VALUE_CM_ETHERNET: WCN_VALUE_TYPE_CONFIG_METHODS = WCN_VALUE_TYPE_CONFIG_METHODS(2i32); pub const WCN_VALUE_CM_LABEL: WCN_VALUE_TYPE_CONFIG_METHODS = WCN_VALUE_TYPE_CONFIG_METHODS(4i32); pub const WCN_VALUE_CM_DISPLAY: WCN_VALUE_TYPE_CONFIG_METHODS = WCN_VALUE_TYPE_CONFIG_METHODS(8i32); pub const WCN_VALUE_CM_EXTERNAL_NFC: WCN_VALUE_TYPE_CONFIG_METHODS = WCN_VALUE_TYPE_CONFIG_METHODS(16i32); pub const WCN_VALUE_CM_INTEGRATED_NFC: WCN_VALUE_TYPE_CONFIG_METHODS = WCN_VALUE_TYPE_CONFIG_METHODS(32i32); pub const WCN_VALUE_CM_NFC_INTERFACE: WCN_VALUE_TYPE_CONFIG_METHODS = WCN_VALUE_TYPE_CONFIG_METHODS(64i32); pub const WCN_VALUE_CM_PUSHBUTTON: WCN_VALUE_TYPE_CONFIG_METHODS = WCN_VALUE_TYPE_CONFIG_METHODS(128i32); pub const WCN_VALUE_CM_KEYPAD: WCN_VALUE_TYPE_CONFIG_METHODS = WCN_VALUE_TYPE_CONFIG_METHODS(256i32); pub const WCN_VALUE_CM_VIRT_PUSHBUTTON: WCN_VALUE_TYPE_CONFIG_METHODS = WCN_VALUE_TYPE_CONFIG_METHODS(640i32); pub const WCN_VALUE_CM_PHYS_PUSHBUTTON: WCN_VALUE_TYPE_CONFIG_METHODS = WCN_VALUE_TYPE_CONFIG_METHODS(1152i32); pub const WCN_VALUE_CM_VIRT_DISPLAY: WCN_VALUE_TYPE_CONFIG_METHODS = WCN_VALUE_TYPE_CONFIG_METHODS(8200i32); pub const WCN_VALUE_CM_PHYS_DISPLAY: WCN_VALUE_TYPE_CONFIG_METHODS = WCN_VALUE_TYPE_CONFIG_METHODS(16392i32); impl ::core::convert::From<i32> for WCN_VALUE_TYPE_CONFIG_METHODS { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_VALUE_TYPE_CONFIG_METHODS { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_VALUE_TYPE_CONNECTION_TYPE(pub i32); pub const WCN_VALUE_CT_ESS: WCN_VALUE_TYPE_CONNECTION_TYPE = WCN_VALUE_TYPE_CONNECTION_TYPE(1i32); pub const WCN_VALUE_CT_IBSS: WCN_VALUE_TYPE_CONNECTION_TYPE = WCN_VALUE_TYPE_CONNECTION_TYPE(2i32); impl ::core::convert::From<i32> for WCN_VALUE_TYPE_CONNECTION_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_VALUE_TYPE_CONNECTION_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_VALUE_TYPE_DEVICE_PASSWORD_ID(pub i32); pub const WCN_VALUE_DP_DEFAULT: WCN_VALUE_TYPE_DEVICE_PASSWORD_ID = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID(0i32); pub const WCN_VALUE_DP_USER_SPECIFIED: WCN_VALUE_TYPE_DEVICE_PASSWORD_ID = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID(1i32); pub const WCN_VALUE_DP_MACHINE_SPECIFIED: WCN_VALUE_TYPE_DEVICE_PASSWORD_ID = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID(2i32); pub const WCN_VALUE_DP_REKEY: WCN_VALUE_TYPE_DEVICE_PASSWORD_ID = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID(3i32); pub const WCN_VALUE_DP_PUSHBUTTON: WCN_VALUE_TYPE_DEVICE_PASSWORD_ID = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID(4i32); pub const WCN_VALUE_DP_REGISTRAR_SPECIFIED: WCN_VALUE_TYPE_DEVICE_PASSWORD_ID = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID(5i32); pub const WCN_VALUE_DP_NFC_CONNECTION_HANDOVER: WCN_VALUE_TYPE_DEVICE_PASSWORD_ID = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID(7i32); pub const WCN_VALUE_DP_WFD_SERVICES: WCN_VALUE_TYPE_DEVICE_PASSWORD_ID = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID(8i32); pub const WCN_VALUE_DP_OUTOFBAND_MIN: WCN_VALUE_TYPE_DEVICE_PASSWORD_ID = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID(16i32); pub const WCN_VALUE_DP_OUTOFBAND_MAX: WCN_VALUE_TYPE_DEVICE_PASSWORD_ID = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID(65535i32); impl ::core::convert::From<i32> for WCN_VALUE_TYPE_DEVICE_PASSWORD_ID { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_VALUE_TYPE_DEVICE_PASSWORD_ID { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_VALUE_TYPE_ENCRYPTION_TYPE(pub i32); pub const WCN_VALUE_ET_NONE: WCN_VALUE_TYPE_ENCRYPTION_TYPE = WCN_VALUE_TYPE_ENCRYPTION_TYPE(1i32); pub const WCN_VALUE_ET_WEP: WCN_VALUE_TYPE_ENCRYPTION_TYPE = WCN_VALUE_TYPE_ENCRYPTION_TYPE(2i32); pub const WCN_VALUE_ET_TKIP: WCN_VALUE_TYPE_ENCRYPTION_TYPE = WCN_VALUE_TYPE_ENCRYPTION_TYPE(4i32); pub const WCN_VALUE_ET_AES: WCN_VALUE_TYPE_ENCRYPTION_TYPE = WCN_VALUE_TYPE_ENCRYPTION_TYPE(8i32); pub const WCN_VALUE_ET_TKIP_AES_MIXED: WCN_VALUE_TYPE_ENCRYPTION_TYPE = WCN_VALUE_TYPE_ENCRYPTION_TYPE(12i32); impl ::core::convert::From<i32> for WCN_VALUE_TYPE_ENCRYPTION_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_VALUE_TYPE_ENCRYPTION_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_VALUE_TYPE_MESSAGE_TYPE(pub i32); pub const WCN_VALUE_MT_BEACON: WCN_VALUE_TYPE_MESSAGE_TYPE = WCN_VALUE_TYPE_MESSAGE_TYPE(1i32); pub const WCN_VALUE_MT_PROBE_REQUEST: WCN_VALUE_TYPE_MESSAGE_TYPE = WCN_VALUE_TYPE_MESSAGE_TYPE(2i32); pub const WCN_VALUE_MT_PROBE_RESPONSE: WCN_VALUE_TYPE_MESSAGE_TYPE = WCN_VALUE_TYPE_MESSAGE_TYPE(3i32); pub const WCN_VALUE_MT_M1: WCN_VALUE_TYPE_MESSAGE_TYPE = WCN_VALUE_TYPE_MESSAGE_TYPE(4i32); pub const WCN_VALUE_MT_M2: WCN_VALUE_TYPE_MESSAGE_TYPE = WCN_VALUE_TYPE_MESSAGE_TYPE(5i32); pub const WCN_VALUE_MT_M2D: WCN_VALUE_TYPE_MESSAGE_TYPE = WCN_VALUE_TYPE_MESSAGE_TYPE(6i32); pub const WCN_VALUE_MT_M3: WCN_VALUE_TYPE_MESSAGE_TYPE = WCN_VALUE_TYPE_MESSAGE_TYPE(7i32); pub const WCN_VALUE_MT_M4: WCN_VALUE_TYPE_MESSAGE_TYPE = WCN_VALUE_TYPE_MESSAGE_TYPE(8i32); pub const WCN_VALUE_MT_M5: WCN_VALUE_TYPE_MESSAGE_TYPE = WCN_VALUE_TYPE_MESSAGE_TYPE(9i32); pub const WCN_VALUE_MT_M6: WCN_VALUE_TYPE_MESSAGE_TYPE = WCN_VALUE_TYPE_MESSAGE_TYPE(10i32); pub const WCN_VALUE_MT_M7: WCN_VALUE_TYPE_MESSAGE_TYPE = WCN_VALUE_TYPE_MESSAGE_TYPE(11i32); pub const WCN_VALUE_MT_M8: WCN_VALUE_TYPE_MESSAGE_TYPE = WCN_VALUE_TYPE_MESSAGE_TYPE(12i32); pub const WCN_VALUE_MT_ACK: WCN_VALUE_TYPE_MESSAGE_TYPE = WCN_VALUE_TYPE_MESSAGE_TYPE(13i32); pub const WCN_VALUE_MT_NACK: WCN_VALUE_TYPE_MESSAGE_TYPE = WCN_VALUE_TYPE_MESSAGE_TYPE(14i32); pub const WCN_VALUE_MT_DONE: WCN_VALUE_TYPE_MESSAGE_TYPE = WCN_VALUE_TYPE_MESSAGE_TYPE(15i32); impl ::core::convert::From<i32> for WCN_VALUE_TYPE_MESSAGE_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_VALUE_TYPE_MESSAGE_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct WCN_VALUE_TYPE_PRIMARY_DEVICE_TYPE { pub Category: u16, pub SubCategoryOUI: u32, pub SubCategory: u16, } impl WCN_VALUE_TYPE_PRIMARY_DEVICE_TYPE {} impl ::core::default::Default for WCN_VALUE_TYPE_PRIMARY_DEVICE_TYPE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for WCN_VALUE_TYPE_PRIMARY_DEVICE_TYPE { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for WCN_VALUE_TYPE_PRIMARY_DEVICE_TYPE {} unsafe impl ::windows::core::Abi for WCN_VALUE_TYPE_PRIMARY_DEVICE_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_VALUE_TYPE_REQUEST_TYPE(pub i32); pub const WCN_VALUE_ReqT_ENROLLEE_INFO: WCN_VALUE_TYPE_REQUEST_TYPE = WCN_VALUE_TYPE_REQUEST_TYPE(0i32); pub const WCN_VALUE_ReqT_ENROLLEE_OPEN_1X: WCN_VALUE_TYPE_REQUEST_TYPE = WCN_VALUE_TYPE_REQUEST_TYPE(1i32); pub const WCN_VALUE_ReqT_REGISTRAR: WCN_VALUE_TYPE_REQUEST_TYPE = WCN_VALUE_TYPE_REQUEST_TYPE(2i32); pub const WCN_VALUE_ReqT_MANAGER_REGISTRAR: WCN_VALUE_TYPE_REQUEST_TYPE = WCN_VALUE_TYPE_REQUEST_TYPE(3i32); impl ::core::convert::From<i32> for WCN_VALUE_TYPE_REQUEST_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_VALUE_TYPE_REQUEST_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_VALUE_TYPE_RESPONSE_TYPE(pub i32); pub const WCN_VALUE_RspT_ENROLLEE_INFO: WCN_VALUE_TYPE_RESPONSE_TYPE = WCN_VALUE_TYPE_RESPONSE_TYPE(0i32); pub const WCN_VALUE_RspT_ENROLLEE_OPEN_1X: WCN_VALUE_TYPE_RESPONSE_TYPE = WCN_VALUE_TYPE_RESPONSE_TYPE(1i32); pub const WCN_VALUE_RspT_REGISTRAR: WCN_VALUE_TYPE_RESPONSE_TYPE = WCN_VALUE_TYPE_RESPONSE_TYPE(2i32); pub const WCN_VALUE_RspT_AP: WCN_VALUE_TYPE_RESPONSE_TYPE = WCN_VALUE_TYPE_RESPONSE_TYPE(3i32); impl ::core::convert::From<i32> for WCN_VALUE_TYPE_RESPONSE_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_VALUE_TYPE_RESPONSE_TYPE { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_VALUE_TYPE_RF_BANDS(pub i32); pub const WCN_VALUE_RB_24GHZ: WCN_VALUE_TYPE_RF_BANDS = WCN_VALUE_TYPE_RF_BANDS(1i32); pub const WCN_VALUE_RB_50GHZ: WCN_VALUE_TYPE_RF_BANDS = WCN_VALUE_TYPE_RF_BANDS(2i32); impl ::core::convert::From<i32> for WCN_VALUE_TYPE_RF_BANDS { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_VALUE_TYPE_RF_BANDS { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_VALUE_TYPE_VERSION(pub i32); pub const WCN_VALUE_VERSION_1_0: WCN_VALUE_TYPE_VERSION = WCN_VALUE_TYPE_VERSION(16i32); pub const WCN_VALUE_VERSION_2_0: WCN_VALUE_TYPE_VERSION = WCN_VALUE_TYPE_VERSION(32i32); impl ::core::convert::From<i32> for WCN_VALUE_TYPE_VERSION { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_VALUE_TYPE_VERSION { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE(pub i32); pub const WCN_VALUE_SS_RESERVED00: WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE = WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE(0i32); pub const WCN_VALUE_SS_NOT_CONFIGURED: WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE = WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE(1i32); pub const WCN_VALUE_SS_CONFIGURED: WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE = WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE(2i32); impl ::core::convert::From<i32> for WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WCN_VENDOR_EXTENSION_SPEC { pub VendorId: u32, pub SubType: u32, pub Index: u32, pub Flags: u32, } impl WCN_VENDOR_EXTENSION_SPEC {} impl ::core::default::Default for WCN_VENDOR_EXTENSION_SPEC { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WCN_VENDOR_EXTENSION_SPEC { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WCN_VENDOR_EXTENSION_SPEC").field("VendorId", &self.VendorId).field("SubType", &self.SubType).field("Index", &self.Index).field("Flags", &self.Flags).finish() } } impl ::core::cmp::PartialEq for WCN_VENDOR_EXTENSION_SPEC { fn eq(&self, other: &Self) -> bool { self.VendorId == other.VendorId && self.SubType == other.SubType && self.Index == other.Index && self.Flags == other.Flags } } impl ::core::cmp::Eq for WCN_VENDOR_EXTENSION_SPEC {} unsafe impl ::windows::core::Abi for WCN_VENDOR_EXTENSION_SPEC { type Abi = Self; }
pub mod endings { use regex::Regex; pub fn ends_with(field_value : &str, ending : &str) -> bool { field_value.ends_with(ending) } pub fn base64_offset_contains(b64 : &str, value : &str) -> bool { //TODO: improve b64.contains(value) } pub fn regex(field_value : &str, regex : &str) -> bool { // Cannot fail here... must be checked before let re: Regex = match Regex::new(regex) { Ok(re) => re, Err(e) => return false }; re.is_match(field_value) } } pub mod pipes { pub fn to_base64(value : &str) -> String { base64::encode(value) } }
use std::io::prelude::*; fn main() { let stdin = std::io::stdin(); let l = stdin.lock().lines().next().unwrap().unwrap(); let a = l.chars().rev().collect::<String>(); println!("{}",a); }
//! A vector of slices. use std::iter::{FusedIterator, IntoIterator}; /// A vector of slices. /// /// Each slice is stored inline so as to be efficiently iterated through linearly. #[derive(Debug)] pub struct SliceVec<T> { data: Vec<T>, counts: Vec<usize>, indices: Vec<usize>, } impl<T> Default for SliceVec<T> { fn default() -> Self { Self { data: Vec::new(), counts: Vec::new(), indices: Vec::new(), } } } impl<T> SliceVec<T> { /// Pushes a new slice onto the end of the vector. pub fn push<I: IntoIterator<Item = T>>(&mut self, items: I) { self.indices.push(self.data.len()); let mut count = 0; for item in items.into_iter() { self.data.push(item); count += 1; } self.counts.push(count); } /// Gets an iterator over slices starting from the given index. pub fn iter_from(&self, start: usize) -> SliceVecIter<T> { let index = *self.indices.get(start).unwrap_or(&self.data.len()); SliceVecIter { data: &self.data[index..], counts: &self.counts[start..], } } } /// An iterator over slices in a `SliceVec`. #[derive(Clone)] pub struct SliceVecIter<'a, T> { pub(crate) data: &'a [T], pub(crate) counts: &'a [usize], } impl<'a, T> Iterator for SliceVecIter<'a, T> { type Item = &'a [T]; #[inline] fn next(&mut self) -> Option<Self::Item> { if let Some((count, remaining_counts)) = self.counts.split_first() { let (data, remaining_data) = self.data.split_at(*count); self.counts = remaining_counts; self.data = remaining_data; Some(data) } else { None } } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { (self.counts.len(), Some(self.counts.len())) } #[inline] fn count(self) -> usize { self.len() } } impl<'a, T> ExactSizeIterator for SliceVecIter<'a, T> {} impl<'a, T> FusedIterator for SliceVecIter<'a, T> {} #[cfg(test)] mod test { use super::*; #[test] fn create() { let _ = SliceVec::<usize>::default(); } #[test] fn push() { let mut vec = SliceVec::default(); let slices = [[1, 2, 3], [4, 5, 6]]; for slice in &slices { vec.push(slice.iter().copied()); } assert_eq!(vec.counts.len(), 2); } #[test] fn iter() { let mut vec = SliceVec::default(); let slices = [[1, 2, 3], [4, 5, 6]]; for slice in &slices { vec.push(slice.iter().copied()); } assert_eq!(vec.counts.len(), 2); for (i, slice) in vec.iter_from(0).enumerate() { let expected = &slices[i]; assert_eq!(slice.len(), expected.len()); for (j, x) in slice.iter().enumerate() { assert_eq!(x, &expected[j]); } } } }
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // This test case makes sure that the compiler doesn't crash due to a failing // table lookup when a source file is removed. // revisions:cfail1 cfail2 // Note that we specify -g so that the FileMaps actually get referenced by the // incr. comp. cache: // compile-flags: -Z query-dep-graph -g // compile-pass #![crate_type= "rlib"] #[cfg(cfail1)] mod auxiliary; #[cfg(cfail1)] pub fn foo() { auxiliary::print_hello(); } #[cfg(cfail2)] pub fn foo() { println!("hello"); }
use crate::protocol::parts::option_part::OptionId; use crate::protocol::parts::option_part::OptionPart; use crate::protocol::parts::option_value::OptionValue; // An Options part that provides source and line information. pub type CommandInfo = OptionPart<CommandInfoId>; impl CommandInfo { pub fn new(linenumber: i32, module: &str) -> Self { let mut ci = Self::default(); ci.insert(CommandInfoId::LineNumber, OptionValue::INT(linenumber)); ci.insert( CommandInfoId::SourceModule, OptionValue::STRING(module.to_string()), ); ci } } #[derive(Debug, Eq, PartialEq, Hash)] pub enum CommandInfoId { LineNumber, // 1 // INT // Line number in source SourceModule, // 2 // STRING // Name of source module __Unexpected__(u8), } impl OptionId<CommandInfoId> for CommandInfoId { fn to_u8(&self) -> u8 { match *self { Self::LineNumber => 1, Self::SourceModule => 2, Self::__Unexpected__(val) => val, } } fn from_u8(val: u8) -> Self { match val { 1 => Self::LineNumber, 2 => Self::SourceModule, val => { warn!("Unsupported value for CommandInfoId received: {}", val); Self::__Unexpected__(val) } } } fn part_type(&self) -> &'static str { "CommandInfo" } }
use rune_tests::*; #[test] fn test_binary_exprs() { assert_parse_error! { r#"pub fn main() { 0 < 10 >= 10 }"#, span, PrecedenceGroupRequired => { assert_eq!(span, Span::new(16, 22)); } }; // Test solving precedence with groups. assert_parse!(r#"pub fn main() { (0 < 10) >= 10 }"#); assert_parse!(r#"pub fn main() { 0 < (10 >= 10) }"#); assert_parse!(r#"pub fn main() { 0 < 10 && 10 > 0 }"#); assert_parse!(r#"pub fn main() { 0 < 10 && 10 > 0 || true }"#); assert_parse!(r#"pub fn main() { false || return }"#); }
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ extern crate serde; extern crate base64; extern crate openssl; extern crate reqwest; extern crate hawk; extern crate failure; #[macro_use] extern crate failure_derive; #[macro_use] extern crate hyper; #[macro_use] extern crate lazy_static; #[macro_use] extern crate serde_derive; #[macro_use] extern crate log; #[cfg_attr(test, macro_use)] extern crate serde_json; extern crate url; extern crate base16; // TODO: Some of these don't need to be pub... pub mod key_bundle; pub mod error; pub mod bso_record; pub mod record_types; pub mod token; pub mod collection_keys; pub mod util; pub mod request; pub mod service; pub mod changeset; pub mod sync; // Re-export some of the types callers are likely to want for convenience. pub use bso_record::{BsoRecord, EncryptedBso, Payload, CleartextBso}; pub use service::{Sync15ServiceInit, Sync15Service}; pub use changeset::{RecordChangeset, IncomingChangeset, OutgoingChangeset}; pub use error::{Result, Error, ErrorKind}; pub use sync::{synchronize, Store}; pub use util::{ServerTimestamp, SERVER_EPOCH};
use crate::error; use crate::state; use crossbeam::channel::{select, Receiver}; use regex::{self, Regex}; use std::fmt; use std::io; use std::io::BufRead; use std::sync::{Arc, Mutex}; use std::thread; use termion::clear; use termion::color; use termion::event::Key; use termion::style; use termion::terminal_size; pub type Result<T> = std::result::Result<T, error::AppError>; #[derive(Debug, Copy, Clone)] pub enum Mode { Normal, Search, } impl fmt::Display for Mode { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self) } } pub struct App<W: io::Write> { raw_buffer: Arc<Mutex<Vec<String>>>, output: W, state: Arc<Mutex<state::State>>, } impl<W> App<W> where W: io::Write, { /// pub fn new(output: W) -> Self { App { raw_buffer: Arc::new(Mutex::new(Vec::new())), output: output, state: Arc::new(Mutex::new(state::State::new())), } } // Return a footer that is as wide as the output is. The footer is a single line that spans // the width of the shell. The query that has been searched for is left on the line, while the // current mode is printed at the right corner. It looks something like this. // // <query> .........<mode> fn footer(&self, width: usize) -> String { let mut footer = String::new(); let state = self.state.clone(); let state = state.lock().unwrap(); let mode = &state.mode.to_string(); for c in state.query.clone() { footer.push(c); } let padding = vec![' '; width - state.query.len() - mode.chars().count() - 1]; for c in padding { footer.push(c); } footer.push_str(mode); footer } pub fn start(&mut self, keys: Receiver<Key>) -> Result<()> { write!(self.output, "{}", clear::All)?; self.output.flush()?; let state = self.state.clone(); let t = thread::spawn(move || loop { select! { recv(keys) -> key => { match key { Ok(key) => { if key == Key::Ctrl('c') { return } state.lock().unwrap().process_key(key); }, Err(e) => { return } } } } }); let raw_buffer = self.raw_buffer.clone(); thread::spawn(move || { let input = io::stdin(); let mut input = input.lock(); loop { let mut line = String::new(); let n = input.read_line(&mut line).expect("Failed to read input"); if n == 0 { return; } raw_buffer.lock().unwrap().push(line); } }); t.join(); return Ok(()); } fn redraw(&mut self) -> Result<()> { let (width, height) = terminal_size().unwrap(); write!(self.output, "{}", clear::All)?; self.output.flush()?; let state = self.state.clone(); let raw_buffer = self.raw_buffer.clone(); let mut regex = String::new(); for c in state.lock().unwrap().query.clone() { regex.push(c); } let regex = format!(r"(.*)(?P<m>{})(.*)", regex); let re = Regex::new(&regex.as_str()).unwrap(); for (i, line) in raw_buffer.lock().unwrap().iter().rev().enumerate() { if re.is_match(line) { if i >= height as usize { break; } for cap in re.captures_iter(line) { write!( self.output, "{}{}{}{}{}{}", termion::cursor::Goto(1, height - i as u16), &cap[1], color::Fg(color::Red), &cap[2], color::Fg(color::Reset), &cap[3], )?; } continue; } write!( self.output, "{}{}", termion::cursor::Goto(1, height - i as u16), line ) .unwrap() } self.output.flush().unwrap(); let footer = self.footer(width as usize); write!( self.output, "{}{}{}{}", termion::cursor::Goto(1, height), style::Invert, footer, style::Reset )?; self.output.flush()?; Ok(()) } }
use crate::make::scan_sheet_elements::{ScanSheetElements, ElementKind, BAR_WIDTH, BAR_LENGTH, FIELD_FONT_SIZE, ALIGNER_OUTER_RADIUS}; use crate::make::scan_sheet_elements::Element; use svg; use std::collections::{HashSet}; use crate::parse::BarsFound; const TEXT_WIDTH_MULTIPLIER: f64 = 0.6; // characters are how many times wider than they are tall const TEXT_GAP: f64 = 0.02; // how many pixels between the end of the text and the start of the field const FIELD_START_X: f64 = 0.2; pub const ALIGNER_DISTANCE_FROM_CORNER: f64 = 0.05; const BAR_DISTANCE_THRESHOLD: f64 = 0.01; const TITLE_X: f64 = 0.3; const TITLE_Y: f64 = 0.05; const DIGIT_GAP: f64 = BAR_LENGTH; // the gap between seven segment display digits const BAR_SPACE: f64 = 0.003; // const VERTICAL_FIELD_START: f64 = 0.3; const VERTICAL_FIELD_SPACE: f64 = 0.1; const BAR_VERTICAL_OFFSET: f64 = 0.03; const SEVEN_SEGMENT_DISPLAY_OFFSET: f64 = 0.0; // describes offset from the top left of the digit const SEVEN_SEGMENT_BAR_OFFSETS: [(f64, f64, bool); 7] = [ // (x, y, is_horizontal) (BAR_WIDTH+BAR_SPACE, 0.0, true), // top (BAR_WIDTH+BAR_LENGTH+2.0* BAR_SPACE, BAR_WIDTH+ BAR_SPACE, false), (BAR_WIDTH+BAR_LENGTH+2.0* BAR_SPACE, 2.0*BAR_WIDTH+BAR_LENGTH+3.0* BAR_SPACE, false), (BAR_WIDTH+ BAR_SPACE, 2.0*BAR_WIDTH+2.0*BAR_LENGTH+4.0* BAR_SPACE, true), // bottom (0.0, 2.0*BAR_WIDTH+BAR_LENGTH+3.0* BAR_SPACE, false), (0.0, BAR_WIDTH+ BAR_SPACE, false), (BAR_WIDTH+ BAR_SPACE, BAR_WIDTH+BAR_LENGTH+2.0* BAR_SPACE, true), // middle section ]; pub struct HighLevelPageDescription { pub document_title: String, pub fields: Vec<HighLevelField>, } impl HighLevelPageDescription { pub fn layout(&self) -> PageLayout { let mut id_generator = BarIdGenerator::new(); let mut layout = PageLayout::new(self.document_title.clone()); let mut current_y = VERTICAL_FIELD_START; for field in self.fields.iter() { // this is how far the actual field must be shifted over so it doesn't overlap with the text let text_x_offset = FIELD_START_X + TEXT_WIDTH_MULTIPLIER*FIELD_FONT_SIZE*field.descriptor.len() as f64 + TEXT_GAP; let new_entry = match field.kind { HighLevelKind::Boolean => LayoutEntry::Boolean(Bar::new(text_x_offset, current_y+BAR_VERTICAL_OFFSET, true, &mut id_generator)), HighLevelKind::SevenSegmentDisplay(digit_count) => LayoutEntry::SevenSegmentDisplay(SevenSegmentDisplay::new(text_x_offset, current_y+SEVEN_SEGMENT_DISPLAY_OFFSET, digit_count, &mut id_generator)), }; layout.add_entry(new_entry, field.descriptor.clone(), FIELD_START_X, current_y); current_y += VERTICAL_FIELD_SPACE; } layout } } pub struct HighLevelField { pub kind: HighLevelKind, pub descriptor: String, } pub enum HighLevelKind { Boolean, SevenSegmentDisplay(u8), // digit count } pub struct PageLayout { document_title: String, fields: Vec<LayoutEntry>, // FIXME: un-public descriptors: Vec<(f64, f64, String)>, // x, y, text } #[derive(Debug)] enum LayoutEntry { // TODO: replace this with a Field trait with elements_iter, interpret_found_target, && make not public Boolean(Bar), SevenSegmentDisplay(SevenSegmentDisplay), // this actually consists of bars } impl PageLayout { fn new(title: String) -> PageLayout { PageLayout { document_title: title, fields: Vec::new(), descriptors: Vec::new() } } fn add_entry(&mut self, entry: LayoutEntry, descriptor: String, x: f64, y: f64) { self.fields.push(entry); self.descriptors.push((x, y, descriptor)); } pub fn to_svg(&self) -> svg::Document { let mut elements = ScanSheetElements::empty(); elements.add_element(Element { // document title x: TITLE_X, y: TITLE_Y, kind: ElementKind::Title(self.document_title.clone()), }); elements.add_element(Element { // top left x: ALIGNER_DISTANCE_FROM_CORNER, y: ALIGNER_DISTANCE_FROM_CORNER, kind: ElementKind::Aligner, }); elements.add_element(Element { // top right x: 1.0-2.0*ALIGNER_OUTER_RADIUS-ALIGNER_DISTANCE_FROM_CORNER, y: ALIGNER_DISTANCE_FROM_CORNER, kind: ElementKind::Aligner, }); elements.add_element(Element { // bottom right x: 1.0-2.0*ALIGNER_OUTER_RADIUS-ALIGNER_DISTANCE_FROM_CORNER, y: 1.0-2.0*ALIGNER_OUTER_RADIUS-ALIGNER_DISTANCE_FROM_CORNER, kind: ElementKind::Aligner, }); elements.add_element(Element { // bottom left x: ALIGNER_DISTANCE_FROM_CORNER, y: 1.0-2.0*ALIGNER_OUTER_RADIUS-ALIGNER_DISTANCE_FROM_CORNER, kind: ElementKind::Aligner, }); for &(x, y, ref text) in self.descriptors.iter() { elements.add_element(Element { x, y, kind: ElementKind::FieldDescriptor(text.clone()), }); } for entry in self.fields.iter() { match *entry { LayoutEntry::Boolean(ref b) => elements.add_element(b.to_element()), LayoutEntry::SevenSegmentDisplay(ref n) => for element in n.elements_iter() { elements.add_element(element); } } } elements.to_svg() } pub fn interpret_targets(&self, targets_found: &BarsFound) -> Result<LayoutResult, LayoutResultError> { // avoid silently double counting bars, hard error instead let mut already_found = HashSet::new(); let mut result = Vec::new(); for entry in self.fields.iter() { match *entry { LayoutEntry::Boolean(ref bar) => { let is_set = bar.is_set(targets_found, &mut already_found)?; result.push(LayoutResultOption::Boolean(is_set)) }, LayoutEntry::SevenSegmentDisplay(ref number) => { let n = number.as_number(targets_found, &mut already_found)?; result.push(LayoutResultOption::Number(n)); } } } Ok(LayoutResult { result }) } } #[derive(Debug)] pub enum LayoutResultError { BarConflictError, SevenSegmentError(SevenSegmentError), } impl From<BarConflictError> for LayoutResultError { fn from(_error: BarConflictError) -> LayoutResultError { LayoutResultError::BarConflictError } } impl From<SevenSegmentError> for LayoutResultError { fn from(error: SevenSegmentError) -> LayoutResultError { LayoutResultError::SevenSegmentError(error) } } pub struct LayoutResult { result: Vec<LayoutResultOption>, } impl LayoutResult { pub fn describe_results(&self, page_description: &HighLevelPageDescription) { for (i, (field, result)) in page_description.fields.iter().zip(self.result.iter()).enumerate() { println!("field #{} - '{}' has value {:?}", i, field.descriptor, result); } } } #[derive(Debug)] enum LayoutResultOption { Boolean(bool), Number(u64), } #[derive(Debug)] struct SevenSegmentDisplay { digits: Vec<SevenSegmentDigit>, } impl SevenSegmentDisplay { fn new(x: f64, y: f64, digit_count: u8, id_generator: &mut BarIdGenerator) -> SevenSegmentDisplay { let mut digits = Vec::new(); let mut current_x = x; for _ in 0..digit_count { digits.push(SevenSegmentDigit::new(current_x, y, id_generator)); // we want to space it out current_x += BAR_WIDTH+BAR_LENGTH+BAR_WIDTH+DIGIT_GAP; } SevenSegmentDisplay { digits } } fn elements_iter(&self) -> impl Iterator<Item=Element>+'_ { let mut digit_index = 0; let mut bar_index = 0; std::iter::from_fn(move || { if bar_index == 7 { digit_index += 1; bar_index = 0; } if digit_index == self.digits.len() { return None; } let bar = &self.digits[digit_index].bars[bar_index]; bar_index += 1; Some(bar.to_element()) }) } fn as_number(&self, targets_found: &BarsFound, already_found: &mut HashSet<BarId>) -> Result<u64, SevenSegmentError> { // returns None if no segments are filled, or we have an invalid digit // we are looking at these digits from right to left let mut sum = 0; let mut power_of_ten = 1; let mut has_seen_empty = false; // there's no problem with seeing empty if the number has finished let mut all_are_empty = true; for digit in self.digits.iter().rev() { match digit.get_digit(targets_found, already_found) { Ok(_) if has_seen_empty => return Err(SevenSegmentError::Empty), // this situation looks like: 5523_23 or something Err(SevenSegmentError::Empty) => has_seen_empty = true, // something like _23 Err(SevenSegmentError::Invalid(n)) => return Err(SevenSegmentError::Invalid(n)), Err(SevenSegmentError::BarConflict) => return Err(SevenSegmentError::BarConflict), Ok(d) => { all_are_empty = false; sum += d*power_of_ten; }, } power_of_ten *= 10; } // make sure that we have seen at least one digit if all_are_empty { Err(SevenSegmentError::Empty) } else { Ok(sum) } } } #[derive(Debug)] struct SevenSegmentDigit { bars: Vec<Bar>, // specified in the order mentioned (a..f) in https://en.wikipedia.org/wiki/Seven-segment_display#Displaying_letters } impl SevenSegmentDigit { fn new(x: f64, y: f64, id_generator: &mut BarIdGenerator) -> SevenSegmentDigit { let bars = (0..7) .map(|i| { let (x_offset, y_offset, is_horizontal) = SEVEN_SEGMENT_BAR_OFFSETS[i]; Bar::new(x+x_offset, y+y_offset, is_horizontal, id_generator) }) .collect(); SevenSegmentDigit { bars } } fn get_digit(&self, targets_found: &BarsFound, already_found: &mut HashSet<BarId>) -> Result<u64, SevenSegmentError> { use SevenSegmentError::*; let mut bars_set = 0; // default value for (i, bar) in self.bars.iter().rev().enumerate() { let is_set = bar.is_set(targets_found, already_found)? as usize; bars_set |= is_set << i; } match bars_set { 0b0000000 => Err(Empty), 0b1111110 => Ok(0), 0b0110000 => Ok(1), 0b1101101 => Ok(2), 0b1111001 => Ok(3), 0b0110011 => Ok(4), 0b1011011 => Ok(5), 0b1011111 | 0b0011111 => Ok(6), // includes alternate 6 representation without top bar 0b1110000 => Ok(7), 0b1111111 => Ok(8), 0b1111011 | 0b1110011 => Ok(9), // alternate repr of 9 without bottom bar _ => Err(Invalid(bars_set)), } } } #[derive(Debug)] pub enum SevenSegmentError { Empty, // just a digit with no bars set Invalid(usize), // an invalid set of bars filled BarConflict, // a bar was found that we thought belonged to the display, but apparently it is owned by another target (bad error) } #[derive(Debug)] pub struct Bar { // FIXME: unpublic x: f64, y: f64, is_horizontal: bool, id: BarId, } impl Bar { fn new(x: f64, y: f64, is_horizontal: bool, id_generator: &mut BarIdGenerator) -> Bar { let id = id_generator.next(); Bar { x, y, is_horizontal, id } } fn mean_position(&self) -> (f64, f64) { // targets_found iterates over the mean position of the image targets, we have to get the mean position out here too let (base, height) = if self.is_horizontal { (BAR_LENGTH, BAR_WIDTH) } else { (BAR_WIDTH, BAR_LENGTH ) }; (self.x + base/2.0, self.y + height/2.0) } fn is_set(&self, targets_found: &BarsFound, already_found: &mut HashSet<BarId>) -> Result<bool, BarConflictError> { let (mean_x, mean_y) = self.mean_position(); for &(target_x, target_y) in targets_found.bars.iter() { let distance = (target_x-mean_x).hypot(target_y-mean_y); if distance < BAR_DISTANCE_THRESHOLD { if already_found.contains(&self.id) { return Err(BarConflictError) } else { return Ok(true); } } // else: this isn't even relavant to this target } Ok(false) } fn to_element(&self) -> Element { Element { x: self.x, y: self.y, kind: if self.is_horizontal { ElementKind::HorizontalBar } else { ElementKind::VerticalBar } } } } #[derive(Copy, Clone)] struct BarConflictError; impl From<BarConflictError> for SevenSegmentError { fn from(_error: BarConflictError) -> SevenSegmentError { SevenSegmentError::BarConflict } } #[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)] pub struct BarId { inner: u64, } struct BarIdGenerator { inner: u64, } impl BarIdGenerator { fn new() -> BarIdGenerator { BarIdGenerator { inner: 0, } } fn next(&mut self) -> BarId { let ret = BarId { inner: self.inner }; self.inner += 1; ret } }
// revisions: base nll // ignore-compare-mode-nll //[nll] compile-flags: -Z borrowck=mir trait Dummy { fn dummy(&self); } fn foo1<'a:'b,'b>(x: &'a mut (dyn Dummy+'a)) -> &'b mut (dyn Dummy+'b) { // Here, we are able to coerce x } fn foo2<'a:'b,'b>(x: &'b mut (dyn Dummy+'a)) -> &'b mut (dyn Dummy+'b) { // Here, we are able to coerce x } fn foo3<'a,'b>(x: &'a mut dyn Dummy) -> &'b mut dyn Dummy { // Without knowing 'a:'b, we can't coerce x //[base]~^ ERROR lifetime bound not satisfied //[base]~| ERROR cannot infer an appropriate lifetime //[nll]~^^^ ERROR lifetime may not live long enough } struct Wrapper<T>(T); fn foo4<'a:'b,'b>(x: Wrapper<&'a mut dyn Dummy>) -> Wrapper<&'b mut dyn Dummy> { // We can't coerce because it is packed in `Wrapper` x //[base]~^ ERROR mismatched types //[nll]~^^ ERROR lifetime may not live long enough } fn main() {}
use std::fs::File; use std::io::Write; use std::path::Path; use super::Color; #[derive(Debug)] pub enum CanvasError { InvalidIndex, } /// Rectangular grid of pixels pub struct Canvas { width: usize, height: usize, pixels: Vec<Color>, } impl Canvas { pub fn new(width: usize, height: usize) -> Self { Self::with_color(width, height, Default::default()) } pub fn with_color(width: usize, height: usize, color: Color) -> Self { Self { width, height, pixels: vec![color; width * height], } } pub fn width(&self) -> usize { self.width } pub fn height(&self) -> usize { self.height } fn pixel_index(&self, x: usize, y: usize) -> Result<usize, CanvasError> { let i = x + y * self.width; if i < self.pixels.len() { Ok(i) } else { Err(CanvasError::InvalidIndex) } } pub fn pixels(&self) -> &Vec<Color> { &self.pixels } pub fn pixels_mut(&mut self) -> &mut Vec<Color> { &mut self.pixels } pub fn pixel(&self, x: usize, y: usize) -> Result<&Color, CanvasError> { let i = self.pixel_index(x, y)?; Ok(&self.pixels[i]) } pub fn pixel_mut(&mut self, x: usize, y: usize) -> Result<&mut Color, CanvasError> { let i = self.pixel_index(x, y)?; Ok(&mut self.pixels[i]) } pub fn write_file<P: AsRef<Path>>(&self, path: P) -> std::io::Result<()> { let mut f = File::create(path)?; writeln!(f, "P3\n{} {}\n255", self.width, self.height)?; for p in self.pixels.iter() { writeln!(f, "{}", p)?; } Ok(()) } } #[cfg(test)] mod tests { use crate::{Canvas, BLACK, WHITE}; #[test] fn new_canvas_is_all_black() { let canvas = Canvas::new(10, 20); assert_eq!(10, canvas.width()); assert_eq!(20, canvas.height()); assert!(canvas.pixels().iter().all(|&p| p == BLACK)); } #[test] fn write_single_pixel() { let mut canvas = Canvas::new(10, 20); let pixel = canvas.pixel_mut(0, 0).unwrap(); *pixel = WHITE; assert!(canvas.pixels()[1..].iter().all(|&p| p == BLACK)); assert!(*canvas.pixel(0, 0).unwrap() == WHITE); } }
use png::PngData; pub fn reduce_alpha_channel(png: &mut PngData, bpp_factor: usize) -> Option<Vec<u8>> { let mut reduced = Vec::with_capacity(png.raw_data.len()); let byte_depth: u8 = png.ihdr_data.bit_depth.as_u8() >> 3; let bpp: usize = bpp_factor * byte_depth as usize; let colored_bytes = bpp - byte_depth as usize; for line in png.scan_lines() { reduced.push(line.filter); for (i, byte) in line.data.iter().enumerate() { if i % bpp >= colored_bytes { if *byte != 255 { return None; } } else { reduced.push(*byte); } } } if let Some(sbit_header) = png.aux_headers.get_mut(&"sBIT".to_string()) { assert_eq!(sbit_header.len(), bpp_factor); sbit_header.pop(); } Some(reduced) }
use nom::Err; use nom::ErrorKind; use nom::types::CompleteStr; use CompoundUnit; use Expr; use Num; use QualifiedUnit; use SiPrefix; use SimpleUnit; use Value; use errors::*; #[repr(u32)] #[derive(Copy, Clone)] enum Fail { Input, Summands, SummandsFollow, Factors, FactorsFollow, Value, NumExpr, Digits, SmallSignedInt, UnitExpr, SiUnit, SiUnitThen, QualifiedUnit, SimpleUnit, SiPrefix, SimplePower, SimplePowerNum, UnitOverJune, } named!(input<CompleteStr, Expr>, add_return_error!(Fail::Input.into(), alt_complete!( summands ) )); named!(summands<CompleteStr, Expr>, add_return_error!(Fail::Summands.into(), do_parse!( list: separated_nonempty_list_complete!( tag!("+"), return_error!(Fail::SummandsFollow.into(), factors)) >> ( Expr::Sum(list) ) ))); named!(factors<CompleteStr, Expr>, add_return_error!(Fail::Factors.into(), do_parse!( list: separated_nonempty_list_complete!( tag!("*"), return_error!(Fail::FactorsFollow.into(), value_expr)) >> ( Expr::Product(list) ) ))); named!(value_expr<CompleteStr, Expr>, do_parse!( value: value >> ( Expr::Value(value) ) )); /// e.g. "¼m", "7/3" named!(value<CompleteStr, Value>, add_return_error!(Fail::Value.into(), do_parse!( num: num_expr >> unit: opt!(unit_expr) >> ( Value { num, unit } ) ) )); named!(num_expr<CompleteStr, Num>, add_return_error!(Fail::NumExpr.into(), alt_complete!( digits => { |d: CompleteStr| Num::from_digits(d.0) } ) )); named!(unit_expr<CompleteStr, CompoundUnit>, add_return_error!(Fail::UnitExpr.into(), alt_complete!( unit_over_june ))); named!(unit_over_june<CompleteStr, CompoundUnit>, add_return_error!(Fail::UnitOverJune.into(), do_parse!( upper: unit_list >> lower: opt!(preceded!( alt_complete!(tag!("/") | tag!(" per ")), unit_list )) >> ( CompoundUnit { upper, lower: lower.unwrap_or_else(Vec::new) } ) ))); named!(unit_list<CompleteStr, Vec<QualifiedUnit>>, many1!(qualified_unit) ); named!(digits<CompleteStr, CompleteStr>, add_return_error!(Fail::Digits.into(), take_while1_s!(digit) )); named!(small_signed_int<CompleteStr, i16>, add_return_error!(Fail::SmallSignedInt.into(), flat_map!(recognize!(pair!(opt!(tag!("-")), digits)), parse_to!(i16)) )); named!(si_unit<CompleteStr, (SiPrefix, SimpleUnit)>, add_return_error!(Fail::SiUnit.into(), alt_complete!( pair!(si_prefix, simple_unit) | simple_unit => { |unit| (SiPrefix::None, unit) } ) )); named!(qualified_unit<CompleteStr, QualifiedUnit>, add_return_error!(Fail::QualifiedUnit.into(), do_parse!( si_unit: si_unit >> power: opt!(simple_power) >> ( QualifiedUnit { si_prefix: si_unit.0, simple_unit: si_unit.1, power: power.unwrap_or(1), }) ))); named!(si_prefix<CompleteStr, SiPrefix>, add_return_error!(Fail::SiPrefix.into(), alt_complete!( tag!("m") => { |_| SiPrefix::TenToThe(-3) } ))); named!(simple_unit<CompleteStr, SimpleUnit>, add_return_error!(Fail::SimpleUnit.into(), alt_complete!( tag!("s") => { |_| SimpleUnit::Second } | tag!("m") => { |_| SimpleUnit::Meter } ))); named!(simple_power<CompleteStr, i16>, add_return_error!(Fail::SimplePower.into(), preceded!( tag!("^"), return_error!(Fail::SimplePowerNum.into(), small_signed_int) ))); fn digit(c: char) -> bool { c.is_numeric() } pub fn parse_expr(msg: &str) -> Result<Expr> { match input(CompleteStr(msg)) { Ok((CompleteStr(""), expr)) => Ok(expr), Ok((tail, val)) => bail!( "illegal trailing data: {:?}, after successfully parsing: {:?}", tail.0, val ), Err(e) => panic!("{:?}", e), } } impl Fail { fn into(self) -> ErrorKind { ErrorKind::Custom(self as u32) } }
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // run-pass // This test case exposes conditions where the encoding of a trait object type // with projection predicates would differ between this crate and the upstream // crate, because the predicates were encoded in different order within each // crate. This led to different symbol hashes of functions using these type, // which in turn led to linker errors because the two crates would not agree on // the symbol name. // The fix was to make the order in which predicates get encoded stable. // aux-build:issue34796aux.rs extern crate issue34796aux; fn mk<T>() -> T { loop {} } struct Data<T, E> { data: T, error: E, } fn main() { issue34796aux::bar(|()| { Data::<(), std::io::Error> { data: mk(), error: mk(), } }) }