text
stringlengths
8
4.13M
use std::fs::File; use std::io; use std::io::Read; use std::io::ErrorKind; fn main() { // panic!("crash and burn"); let _v = vec![1, 2, 3]; //_v[99]; let _f = File::open("hello.txt").unwrap_or_else(|error| { if error.kind() == ErrorKind::NotFound { File::create("hello.txt").unwrap_or_else(|error| { panic!("Problem creating the file: {:?}", error); }) } else { panic!("Problem opening the file: {:?}", error); } }); let _f2 = File::open("hello.txt").unwrap(); let _f3 = File::open("hello.txt").expect("Failed to open hello.txt"); let _s1 = read_username_from_file().expect("Oh 💩"); } fn read_username_from_file() -> Result<String, io::Error> { let mut s = String::new(); File::open("hello2.txt")?.read_to_string(&mut s)?; Ok(s) }
#[inline] pub fn rotl(x: u32, k: u32) -> u32 { (x << k) | (x >> (32 - k)) } /// Implementation from http://prng.di.unimi.it/xoshiro128plusplus.c pub struct Xoshiro128Plus { val0: u32, val1: u32, val2: u32, val3: u32, } impl Xoshiro128Plus { pub fn new() -> Xoshiro128Plus { Xoshiro128Plus { val0: 0xdeadbeef, val1: 0xdeadbeef, val2: 0xdeadbeef, val3: 0xdeadbeef, } } pub fn rand(&mut self) -> u32 { let res = rotl(self.val0.wrapping_add(self.val3), 7) + self.val0; let t = self.val1 << 9; self.val2 ^= self.val0; self.val3 ^= self.val1; self.val1 ^= self.val2; self.val0 ^= self.val3; self.val2 ^= t; self.val3 = rotl(self.val3, 11); res } }
#![allow(clippy::bool_comparison)] //! This is a library was created for the development of [Fields of Mistria](https://twitter.com/FieldsofMistria), a farming RPG with *tons* of Sprites, by NPC Studio. This tool was created to support an Aseprite -> GMS2 pipeline tool. That tool is not public. Using this tool, one should be able to generate their own pipeline without difficulty. //! //! ***This crate only supports Gms2, and only supports Gms2 2.3 and above***. //! If users do want to use a version with Gms2 version 2.2, there is a //! historical release on the main branch which was made before 2.3's release, //! though it is not nearly as fully featured as the current branch. //! //! This repository has a pair: [the Yy-Boss](https://crates.io/crates/yy-boss), which provides active Yyp handling over stdin/stdout, abstracting over Gms2's native types to allow users to dynamically create resources (and analyze existing resources) without handling the Gms2 Yy files directly. macro_rules! create_guarded_uuid { ($this_val:ident) => { /// A newtype wrapper around a `uuid::Uuid`. The inner value can always be /// accessed with `inner` without consuming the wrapper -- its purpose is for /// developer simplicity. #[derive( PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize, Copy, Clone, Default, )] pub struct $this_val(uuid::Uuid); impl std::fmt::Debug for $this_val { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{} -- {}", stringify!($this_val), self.0) } } impl $this_val { /// Creates a new Id using `Uuid::new_v4` which is randomly generated. pub fn new() -> Self { Self(uuid::Uuid::new_v4()) } /// Creates a new Id with the provided Uuid. pub fn with_id(id: uuid::Uuid) -> Self { Self(id) } /// Creates a new Id with the provided String which *must* be a Uuid string. /// This does an unwrap internally, so probably don't use it! pub fn with_string(input: &str) -> Self { Self(uuid::Uuid::parse_str(input).unwrap()) } /// Gives access to the inner ID. Try to not use this one too much! pub fn inner(&self) -> uuid::Uuid { self.0 } } }; } mod typings { mod paths; pub use paths::*; mod tags; pub use tags::Tags; mod audio_group; pub use audio_group::AudioGroup; /// Typings associated with Sprite `.yy` files, including /// many of the types associated with `Sequences`, for now. In future /// iterations of this crate, those shared resources will be in their own /// module. pub mod sprite_yy { pub use super::*; mod sprite; pub use sprite::*; mod sprite_constants; pub use sprite_constants::*; mod sequence; pub use sequence::*; mod frames_layers; pub use frames_layers::*; } /// Typings associated with Object `.yy` files, including typing for Events /// and Vk Keycodes. pub mod object_yy { pub use super::*; mod object; pub use object::*; mod object_constants; pub use object_constants::*; mod event_type; pub use event_type::*; mod vk; pub use vk::*; } /// Typings associated with Texture Groups. pub mod texture_group; /// Typings for Scripts. pub mod script; /// Typings for Shaders. pub mod shader; /// Typings for Sounds. pub mod sounds; mod resource_version; pub use resource_version::ResourceVersion; mod yyp; pub use yyp::*; mod unidentified_resource; pub use unidentified_resource::*; mod note; pub use note::Note; } pub use typings::*; /// Two utilities which may be useful for downstream crates: /// /// 1. `TrailingCommaUtility` will *remove* all trailing commas /// from a given input string. It is a wrapper over a Regex pattern. /// 2. `PathValidator` will validate any paths as valid Gms2 names for a /// resource. pub mod utils { mod trailing_comma_utility; pub use trailing_comma_utility::TrailingCommaUtility; mod resource_name_validator; pub use resource_name_validator::ResourceNameValidator; }
pub mod benches; pub mod benchmark; pub mod io; pub mod utils;
//! Query execution abstraction & types. mod r#trait; pub(crate) use r#trait::*; pub(crate) mod projection; // Response types pub(crate) mod partition_response; pub(crate) mod response; // Instrumentation pub(crate) mod exec_instrumentation; pub(crate) mod result_instrumentation; pub(crate) mod tracing; #[cfg(test)] pub(crate) mod mock_query_exec;
use actix_web::{fs, App, HttpRequest, Result}; use actix_web::fs::NamedFile; use actix_web::http::Method; use actix_web::middleware::Logger; use std::path::Path; use api::auth; use api::flag; use api::path; use api::State; use api::stream; fn index<'r>(_req: &'r HttpRequest<State>) -> Result<NamedFile> { Ok(NamedFile::open(Path::new("www/index.html"))?) } pub fn api(state: State) -> App<State> { App::with_state(state) .prefix("/api/v1") .middleware(Logger::default()) .middleware(auth::UrlAuth) .middleware(auth::BasicAuth) .resource("/{app}/{env}/flag/", |r| { r.method(Method::POST).a(flag::create) }) .resource("/{app}/{env}/flag/{key}/", |r| { r.method(Method::GET).a(flag::read); r.method(Method::POST).a(flag::update); r.method(Method::DELETE).a(flag::delete) }) .resource("/{app}/{env}/flags/", |r| { r.method(Method::GET).a(flag::all) }) .resource("/path/", |r| r.method(Method::POST).a(path::create)) .resource("/paths/", |r| r.method(Method::GET).a(path::all)) .resource("/stream/{app}/{env}/", |r| r.f(stream::flag_stream)) } pub fn frontend(state: State) -> App<State> { App::with_state(state) .middleware(Logger::default()) .resource("/", |r| r.h(index)) .resource("/{app}/{env}/", |r| r.h(index)) .handler( "/", fs::StaticFiles::new("www/").expect("Failed to locate www directory").index_file("index.html"), ) }
//! Manipulation of sets and their items. use crate::ir; use proc_macro2::{Delimiter, Group, Ident, Span, TokenStream, TokenTree}; use quote; use utils::unwrap; /// Lists the new objects of the given set. pub fn iter_new_objects(set: &ir::SetDef) -> TokenTree { // TODO(cleanup): parse in the parser instead of after substitution. let expr = set.attributes()[&ir::SetDefKey::NewObjs].replace("$objs", "new_objs"); Group::new(Delimiter::Parenthesis, unwrap!(expr.parse())).into() } /// Represents an expression that holds the ID of an object. #[derive(Clone)] pub struct ObjectId<'a> { id: TokenTree, set: &'a ir::SetDef, } impl<'a> ObjectId<'a> { /// Creates a new variable to hold an object ID. pub fn new(name: &str, set: &'a ir::SetDef) -> Self { ObjectId { id: TokenTree::Ident(Ident::new(name, Span::call_site())), set, } } /// Creates an expression that returns the id of an object. pub fn from_object(object: &TokenTree, set: &'a ir::SetDef) -> Self { let expr = set.attributes()[&ir::SetDefKey::IdGetter] .replace("$fun", "ir_instance") .replace("$item", &object.to_string()); let id = Group::new(Delimiter::None, unwrap!(expr.parse())).into(); ObjectId { id, set } } /// Returns code that fetches the object corresponding to the ID. pub fn fetch_object(&self, arg: Option<&TokenTree>) -> TokenTree { // TODO(cleanup): parse in the parser instead of after substitution. let mut expr = self.set.attributes()[&ir::SetDefKey::ItemGetter] .replace("$fun", "ir_instance") .replace("$id", &self.id.to_string()); if let Some(arg) = arg { expr = expr.replace("$var", &arg.to_string()); } Group::new(Delimiter::None, unwrap!(expr.parse())).into() } } impl<'a> quote::ToTokens for ObjectId<'a> { fn to_tokens(&self, stream: &mut TokenStream) { self.id.to_tokens(stream) } }
#![allow(dead_code)] #![allow(unused_variables)] #![allow(unused_imports)] use base64::{Engine as _, engine::general_purpose}; use std::fs::File; use std::io::Error; fn main() { set1_1(); set1_2(); set1_3(); set1_4(); } fn fixed_length_xor(v1: Vec<u8>, v2: Vec<u8>) -> Vec<u8> { assert_eq!(v1.len(), v2.len()); let mut retvec: Vec<u8> = Vec::new(); for (e1, e2) in v1.iter().zip(v2.iter()) { // you can zip an iter? retvec.push(e1 ^ e2); } retvec } fn unhexlify(hex_string: &str) -> Vec<u8> { let mut bytes: Vec<u8> = Vec::new(); for i in (0..hex_string.len()).step_by(2) { let hex_byte = &hex_string[i..(i+2)]; if let Ok(byte) = u8::from_str_radix(hex_byte,16) { bytes.push(byte); } else { panic!("invalid hex input"); } } bytes } fn hexlify(raw_bytes: Vec<u8>) -> String { raw_bytes.iter() .map(|byte| format!("{:02x}", byte)) .collect() } fn b64encode(instr: Vec<u8>) -> String { general_purpose::STANDARD_NO_PAD.encode(instr) } fn b64decode(instr: Vec<u8>) -> Vec<u8> { general_purpose::STANDARD_NO_PAD.decode(instr).unwrap() } // ------------------------------------------------- fn set1_1() { let s1 = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"; let res = unhexlify(s1); let res1 = b64encode(res); // let res1 = general_purpose::STANDARD_NO_PAD.encode(res); assert_eq!(res1, String::from("SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t")); } fn set1_2() { let s1 = unhexlify("1c0111001f010100061a024b53535009181c"); let s2 = unhexlify("686974207468652062756c6c277320657965"); let r3 = hexlify(fixed_length_xor(s1,s2)); assert_eq!(r3, "746865206b696420646f6e277420706c6179"); // dbg!(r3); } fn set1_3() { let sss = unhexlify("1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736"); let len = sss.len(); /* let len = sss.len(); for i in 0..256 { // dbg!(i); let vvv: Vec<u8>= vec![i as u8; len]; let res = fixed_length_xor(sss.clone(), vvv); // vec![u8 of 3 of len 32] //println!("{:?}", &res); let ascii = String::from_utf8(res).expect("unprintable"); dbg!(i); // 88 dbg!(ascii); } */ let outstr = fixed_length_xor(sss, vec![88 as u8; len]); assert_eq!(String::from_utf8(outstr).unwrap(), String::from("Cooking MC's like a pound of bacon")); // dbg!(outstr); } fn score() { } fn set1_4() { let file = File::open("4.txt")?; // each line contains hex-encoded string }
use ethers_core::types::U256; pub(crate) fn highest_divisor_power_of_2(n: U256) -> U256 { n & (!(n - 1)) } pub(crate) fn pred(n: U256) -> U256 { n - highest_divisor_power_of_2(n) }
#[doc = "Reader of register TIMFDIER"] pub type R = crate::R<u32, super::TIMFDIER>; #[doc = "Writer for register TIMFDIER"] pub type W = crate::W<u32, super::TIMFDIER>; #[doc = "Register TIMFDIER `reset()`'s with value 0"] impl crate::ResetValue for super::TIMFDIER { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `DLYPRTDE`"] pub type DLYPRTDE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `DLYPRTDE`"] pub struct DLYPRTDE_W<'a> { w: &'a mut W, } impl<'a> DLYPRTDE_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 << 30)) | (((value as u32) & 0x01) << 30); self.w } } #[doc = "Reader of field `RSTDE`"] pub type RSTDE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `RSTDE`"] pub struct RSTDE_W<'a> { w: &'a mut W, } impl<'a> RSTDE_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 << 29)) | (((value as u32) & 0x01) << 29); self.w } } #[doc = "Reader of field `RSTx2DE`"] pub type RSTX2DE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `RSTx2DE`"] pub struct RSTX2DE_W<'a> { w: &'a mut W, } impl<'a> RSTX2DE_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 << 28)) | (((value as u32) & 0x01) << 28); self.w } } #[doc = "Reader of field `SETx2DE`"] pub type SETX2DE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `SETx2DE`"] pub struct SETX2DE_W<'a> { w: &'a mut W, } impl<'a> SETX2DE_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 << 27)) | (((value as u32) & 0x01) << 27); self.w } } #[doc = "Reader of field `RSTx1DE`"] pub type RSTX1DE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `RSTx1DE`"] pub struct RSTX1DE_W<'a> { w: &'a mut W, } impl<'a> RSTX1DE_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 << 26)) | (((value as u32) & 0x01) << 26); self.w } } #[doc = "Reader of field `SET1xDE`"] pub type SET1XDE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `SET1xDE`"] pub struct SET1XDE_W<'a> { w: &'a mut W, } impl<'a> SET1XDE_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 << 25)) | (((value as u32) & 0x01) << 25); self.w } } #[doc = "Reader of field `CPT2DE`"] pub type CPT2DE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CPT2DE`"] pub struct CPT2DE_W<'a> { w: &'a mut W, } impl<'a> CPT2DE_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 << 24)) | (((value as u32) & 0x01) << 24); self.w } } #[doc = "Reader of field `CPT1DE`"] pub type CPT1DE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CPT1DE`"] pub struct CPT1DE_W<'a> { w: &'a mut W, } impl<'a> CPT1DE_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 << 23)) | (((value as u32) & 0x01) << 23); self.w } } #[doc = "Reader of field `UPDDE`"] pub type UPDDE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `UPDDE`"] pub struct UPDDE_W<'a> { w: &'a mut W, } impl<'a> UPDDE_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 << 22)) | (((value as u32) & 0x01) << 22); self.w } } #[doc = "Reader of field `REPDE`"] pub type REPDE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `REPDE`"] pub struct REPDE_W<'a> { w: &'a mut W, } impl<'a> REPDE_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 << 20)) | (((value as u32) & 0x01) << 20); self.w } } #[doc = "Reader of field `CMP4DE`"] pub type CMP4DE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CMP4DE`"] pub struct CMP4DE_W<'a> { w: &'a mut W, } impl<'a> CMP4DE_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 << 19)) | (((value as u32) & 0x01) << 19); self.w } } #[doc = "Reader of field `CMP3DE`"] pub type CMP3DE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CMP3DE`"] pub struct CMP3DE_W<'a> { w: &'a mut W, } impl<'a> CMP3DE_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 << 18)) | (((value as u32) & 0x01) << 18); self.w } } #[doc = "Reader of field `CMP2DE`"] pub type CMP2DE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CMP2DE`"] pub struct CMP2DE_W<'a> { w: &'a mut W, } impl<'a> CMP2DE_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 << 17)) | (((value as u32) & 0x01) << 17); self.w } } #[doc = "Reader of field `CMP1DE`"] pub type CMP1DE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CMP1DE`"] pub struct CMP1DE_W<'a> { w: &'a mut W, } impl<'a> CMP1DE_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 << 16)) | (((value as u32) & 0x01) << 16); self.w } } #[doc = "Reader of field `DLYPRTIE`"] pub type DLYPRTIE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `DLYPRTIE`"] pub struct DLYPRTIE_W<'a> { w: &'a mut W, } impl<'a> DLYPRTIE_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 << 14)) | (((value as u32) & 0x01) << 14); self.w } } #[doc = "Reader of field `RSTIE`"] pub type RSTIE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `RSTIE`"] pub struct RSTIE_W<'a> { w: &'a mut W, } impl<'a> RSTIE_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 << 13)) | (((value as u32) & 0x01) << 13); self.w } } #[doc = "Reader of field `RSTx2IE`"] pub type RSTX2IE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `RSTx2IE`"] pub struct RSTX2IE_W<'a> { w: &'a mut W, } impl<'a> RSTX2IE_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 << 12)) | (((value as u32) & 0x01) << 12); self.w } } #[doc = "Reader of field `SETx2IE`"] pub type SETX2IE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `SETx2IE`"] pub struct SETX2IE_W<'a> { w: &'a mut W, } impl<'a> SETX2IE_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 << 11)) | (((value as u32) & 0x01) << 11); self.w } } #[doc = "Reader of field `RSTx1IE`"] pub type RSTX1IE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `RSTx1IE`"] pub struct RSTX1IE_W<'a> { w: &'a mut W, } impl<'a> RSTX1IE_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 << 10)) | (((value as u32) & 0x01) << 10); self.w } } #[doc = "Reader of field `SET1xIE`"] pub type SET1XIE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `SET1xIE`"] pub struct SET1XIE_W<'a> { w: &'a mut W, } impl<'a> SET1XIE_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 << 9)) | (((value as u32) & 0x01) << 9); self.w } } #[doc = "Reader of field `CPT2IE`"] pub type CPT2IE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CPT2IE`"] pub struct CPT2IE_W<'a> { w: &'a mut W, } impl<'a> CPT2IE_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 } } #[doc = "Reader of field `CPT1IE`"] pub type CPT1IE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CPT1IE`"] pub struct CPT1IE_W<'a> { w: &'a mut W, } impl<'a> CPT1IE_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 = "Reader of field `UPDIE`"] pub type UPDIE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `UPDIE`"] pub struct UPDIE_W<'a> { w: &'a mut W, } impl<'a> UPDIE_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 = "Reader of field `REPIE`"] pub type REPIE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `REPIE`"] pub struct REPIE_W<'a> { w: &'a mut W, } impl<'a> REPIE_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 = "Reader of field `CMP4IE`"] pub type CMP4IE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CMP4IE`"] pub struct CMP4IE_W<'a> { w: &'a mut W, } impl<'a> CMP4IE_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 = "Reader of field `CMP3IE`"] pub type CMP3IE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CMP3IE`"] pub struct CMP3IE_W<'a> { w: &'a mut W, } impl<'a> CMP3IE_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 = "Reader of field `CMP2IE`"] pub type CMP2IE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CMP2IE`"] pub struct CMP2IE_W<'a> { w: &'a mut W, } impl<'a> CMP2IE_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 = "Reader of field `CMP1IE`"] pub type CMP1IE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CMP1IE`"] pub struct CMP1IE_W<'a> { w: &'a mut W, } impl<'a> CMP1IE_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 } } impl R { #[doc = "Bit 30 - DLYPRTDE"] #[inline(always)] pub fn dlyprtde(&self) -> DLYPRTDE_R { DLYPRTDE_R::new(((self.bits >> 30) & 0x01) != 0) } #[doc = "Bit 29 - RSTDE"] #[inline(always)] pub fn rstde(&self) -> RSTDE_R { RSTDE_R::new(((self.bits >> 29) & 0x01) != 0) } #[doc = "Bit 28 - RSTx2DE"] #[inline(always)] pub fn rstx2de(&self) -> RSTX2DE_R { RSTX2DE_R::new(((self.bits >> 28) & 0x01) != 0) } #[doc = "Bit 27 - SETx2DE"] #[inline(always)] pub fn setx2de(&self) -> SETX2DE_R { SETX2DE_R::new(((self.bits >> 27) & 0x01) != 0) } #[doc = "Bit 26 - RSTx1DE"] #[inline(always)] pub fn rstx1de(&self) -> RSTX1DE_R { RSTX1DE_R::new(((self.bits >> 26) & 0x01) != 0) } #[doc = "Bit 25 - SET1xDE"] #[inline(always)] pub fn set1x_de(&self) -> SET1XDE_R { SET1XDE_R::new(((self.bits >> 25) & 0x01) != 0) } #[doc = "Bit 24 - CPT2DE"] #[inline(always)] pub fn cpt2de(&self) -> CPT2DE_R { CPT2DE_R::new(((self.bits >> 24) & 0x01) != 0) } #[doc = "Bit 23 - CPT1DE"] #[inline(always)] pub fn cpt1de(&self) -> CPT1DE_R { CPT1DE_R::new(((self.bits >> 23) & 0x01) != 0) } #[doc = "Bit 22 - UPDDE"] #[inline(always)] pub fn updde(&self) -> UPDDE_R { UPDDE_R::new(((self.bits >> 22) & 0x01) != 0) } #[doc = "Bit 20 - REPDE"] #[inline(always)] pub fn repde(&self) -> REPDE_R { REPDE_R::new(((self.bits >> 20) & 0x01) != 0) } #[doc = "Bit 19 - CMP4DE"] #[inline(always)] pub fn cmp4de(&self) -> CMP4DE_R { CMP4DE_R::new(((self.bits >> 19) & 0x01) != 0) } #[doc = "Bit 18 - CMP3DE"] #[inline(always)] pub fn cmp3de(&self) -> CMP3DE_R { CMP3DE_R::new(((self.bits >> 18) & 0x01) != 0) } #[doc = "Bit 17 - CMP2DE"] #[inline(always)] pub fn cmp2de(&self) -> CMP2DE_R { CMP2DE_R::new(((self.bits >> 17) & 0x01) != 0) } #[doc = "Bit 16 - CMP1DE"] #[inline(always)] pub fn cmp1de(&self) -> CMP1DE_R { CMP1DE_R::new(((self.bits >> 16) & 0x01) != 0) } #[doc = "Bit 14 - DLYPRTIE"] #[inline(always)] pub fn dlyprtie(&self) -> DLYPRTIE_R { DLYPRTIE_R::new(((self.bits >> 14) & 0x01) != 0) } #[doc = "Bit 13 - RSTIE"] #[inline(always)] pub fn rstie(&self) -> RSTIE_R { RSTIE_R::new(((self.bits >> 13) & 0x01) != 0) } #[doc = "Bit 12 - RSTx2IE"] #[inline(always)] pub fn rstx2ie(&self) -> RSTX2IE_R { RSTX2IE_R::new(((self.bits >> 12) & 0x01) != 0) } #[doc = "Bit 11 - SETx2IE"] #[inline(always)] pub fn setx2ie(&self) -> SETX2IE_R { SETX2IE_R::new(((self.bits >> 11) & 0x01) != 0) } #[doc = "Bit 10 - RSTx1IE"] #[inline(always)] pub fn rstx1ie(&self) -> RSTX1IE_R { RSTX1IE_R::new(((self.bits >> 10) & 0x01) != 0) } #[doc = "Bit 9 - SET1xIE"] #[inline(always)] pub fn set1x_ie(&self) -> SET1XIE_R { SET1XIE_R::new(((self.bits >> 9) & 0x01) != 0) } #[doc = "Bit 8 - CPT2IE"] #[inline(always)] pub fn cpt2ie(&self) -> CPT2IE_R { CPT2IE_R::new(((self.bits >> 8) & 0x01) != 0) } #[doc = "Bit 7 - CPT1IE"] #[inline(always)] pub fn cpt1ie(&self) -> CPT1IE_R { CPT1IE_R::new(((self.bits >> 7) & 0x01) != 0) } #[doc = "Bit 6 - UPDIE"] #[inline(always)] pub fn updie(&self) -> UPDIE_R { UPDIE_R::new(((self.bits >> 6) & 0x01) != 0) } #[doc = "Bit 4 - REPIE"] #[inline(always)] pub fn repie(&self) -> REPIE_R { REPIE_R::new(((self.bits >> 4) & 0x01) != 0) } #[doc = "Bit 3 - CMP4IE"] #[inline(always)] pub fn cmp4ie(&self) -> CMP4IE_R { CMP4IE_R::new(((self.bits >> 3) & 0x01) != 0) } #[doc = "Bit 2 - CMP3IE"] #[inline(always)] pub fn cmp3ie(&self) -> CMP3IE_R { CMP3IE_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 1 - CMP2IE"] #[inline(always)] pub fn cmp2ie(&self) -> CMP2IE_R { CMP2IE_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 0 - CMP1IE"] #[inline(always)] pub fn cmp1ie(&self) -> CMP1IE_R { CMP1IE_R::new((self.bits & 0x01) != 0) } } impl W { #[doc = "Bit 30 - DLYPRTDE"] #[inline(always)] pub fn dlyprtde(&mut self) -> DLYPRTDE_W { DLYPRTDE_W { w: self } } #[doc = "Bit 29 - RSTDE"] #[inline(always)] pub fn rstde(&mut self) -> RSTDE_W { RSTDE_W { w: self } } #[doc = "Bit 28 - RSTx2DE"] #[inline(always)] pub fn rstx2de(&mut self) -> RSTX2DE_W { RSTX2DE_W { w: self } } #[doc = "Bit 27 - SETx2DE"] #[inline(always)] pub fn setx2de(&mut self) -> SETX2DE_W { SETX2DE_W { w: self } } #[doc = "Bit 26 - RSTx1DE"] #[inline(always)] pub fn rstx1de(&mut self) -> RSTX1DE_W { RSTX1DE_W { w: self } } #[doc = "Bit 25 - SET1xDE"] #[inline(always)] pub fn set1x_de(&mut self) -> SET1XDE_W { SET1XDE_W { w: self } } #[doc = "Bit 24 - CPT2DE"] #[inline(always)] pub fn cpt2de(&mut self) -> CPT2DE_W { CPT2DE_W { w: self } } #[doc = "Bit 23 - CPT1DE"] #[inline(always)] pub fn cpt1de(&mut self) -> CPT1DE_W { CPT1DE_W { w: self } } #[doc = "Bit 22 - UPDDE"] #[inline(always)] pub fn updde(&mut self) -> UPDDE_W { UPDDE_W { w: self } } #[doc = "Bit 20 - REPDE"] #[inline(always)] pub fn repde(&mut self) -> REPDE_W { REPDE_W { w: self } } #[doc = "Bit 19 - CMP4DE"] #[inline(always)] pub fn cmp4de(&mut self) -> CMP4DE_W { CMP4DE_W { w: self } } #[doc = "Bit 18 - CMP3DE"] #[inline(always)] pub fn cmp3de(&mut self) -> CMP3DE_W { CMP3DE_W { w: self } } #[doc = "Bit 17 - CMP2DE"] #[inline(always)] pub fn cmp2de(&mut self) -> CMP2DE_W { CMP2DE_W { w: self } } #[doc = "Bit 16 - CMP1DE"] #[inline(always)] pub fn cmp1de(&mut self) -> CMP1DE_W { CMP1DE_W { w: self } } #[doc = "Bit 14 - DLYPRTIE"] #[inline(always)] pub fn dlyprtie(&mut self) -> DLYPRTIE_W { DLYPRTIE_W { w: self } } #[doc = "Bit 13 - RSTIE"] #[inline(always)] pub fn rstie(&mut self) -> RSTIE_W { RSTIE_W { w: self } } #[doc = "Bit 12 - RSTx2IE"] #[inline(always)] pub fn rstx2ie(&mut self) -> RSTX2IE_W { RSTX2IE_W { w: self } } #[doc = "Bit 11 - SETx2IE"] #[inline(always)] pub fn setx2ie(&mut self) -> SETX2IE_W { SETX2IE_W { w: self } } #[doc = "Bit 10 - RSTx1IE"] #[inline(always)] pub fn rstx1ie(&mut self) -> RSTX1IE_W { RSTX1IE_W { w: self } } #[doc = "Bit 9 - SET1xIE"] #[inline(always)] pub fn set1x_ie(&mut self) -> SET1XIE_W { SET1XIE_W { w: self } } #[doc = "Bit 8 - CPT2IE"] #[inline(always)] pub fn cpt2ie(&mut self) -> CPT2IE_W { CPT2IE_W { w: self } } #[doc = "Bit 7 - CPT1IE"] #[inline(always)] pub fn cpt1ie(&mut self) -> CPT1IE_W { CPT1IE_W { w: self } } #[doc = "Bit 6 - UPDIE"] #[inline(always)] pub fn updie(&mut self) -> UPDIE_W { UPDIE_W { w: self } } #[doc = "Bit 4 - REPIE"] #[inline(always)] pub fn repie(&mut self) -> REPIE_W { REPIE_W { w: self } } #[doc = "Bit 3 - CMP4IE"] #[inline(always)] pub fn cmp4ie(&mut self) -> CMP4IE_W { CMP4IE_W { w: self } } #[doc = "Bit 2 - CMP3IE"] #[inline(always)] pub fn cmp3ie(&mut self) -> CMP3IE_W { CMP3IE_W { w: self } } #[doc = "Bit 1 - CMP2IE"] #[inline(always)] pub fn cmp2ie(&mut self) -> CMP2IE_W { CMP2IE_W { w: self } } #[doc = "Bit 0 - CMP1IE"] #[inline(always)] pub fn cmp1ie(&mut self) -> CMP1IE_W { CMP1IE_W { w: self } } }
//! Abstract Syntax Tree use syntax::codemap::Spanned; use util::interner::Name; /// A spanned expression pub type Expr = Spanned<Expr_>; /// An expression #[derive(Debug)] pub enum Expr_ { /// `true` or `false` Bool(bool), /// `123` Integer(i64), /// `:a` Keyword(Name), /// `(+ 1 2)` List(Vec<Expr>), /// `nil` Nil, /// `def!`, `let*` Operator(Operator), /// `"Hello, world!"` String, /// `+`, `-` Symbol(Name), /// `[1 "two" 3]` Vector(Vec<Expr>), } #[derive(Clone, Copy, Debug)] /// Special operators pub enum Operator { /// `def!` Def, /// `if` If, /// `let*` Let, } impl Operator { /// Checks if `str` is a special operator pub fn from_str(str: &str) -> Option<Operator> { match str { "def!" => Some(Operator::Def), "if" => Some(Operator::If), "let*" => Some(Operator::Let), _ => None, } } }
#![no_main] #![no_std] use panic_rtt_target as _; #[rtic::app(device = stm32f3xx_hal::pac, dispatchers = [TIM20_BRK, TIM20_UP, TIM20_TRG_COM])] mod app { use dwt_systick_monotonic::DwtSystick; use rtt_target::{rprintln, rtt_init_print}; use stm32f3xx_hal::{ gpio::{self, Output, PushPull, AF7}, prelude::*, serial::{Event, Serial}, }; #[monotonic(binds = SysTick, default = true)] type DwtMono = DwtSystick<48_000_000>; type SerialType = Serial< stm32f3xx_hal::pac::USART1, ( gpio::gpioa::PA9<AF7<PushPull>>, gpio::gpioa::PA10<AF7<PushPull>>, ), >; type DirType = stm32f3xx_hal::gpio::gpioe::PE13<Output<PushPull>>; #[resources] struct Resources { serial: SerialType, dir: DirType, } #[init] fn init(cx: init::Context) -> (init::LateResources, init::Monotonics) { let mut flash = cx.device.FLASH.constrain(); let mut rcc = cx.device.RCC.constrain(); let mut dcb = cx.core.DCB; let dwt = cx.core.DWT; let systick = cx.core.SYST; rtt_init_print!(NoBlockSkip, 4096); rprintln!("pre init"); // Initialize the clocks let clocks = rcc.cfgr.sysclk(48.MHz()).freeze(&mut flash.acr); let mono = DwtSystick::new(&mut dcb, dwt, systick, clocks.sysclk().0); // Initialize the peripherals // DIR let mut gpioe = cx.device.GPIOE.split(&mut rcc.ahb); let mut dir: DirType = gpioe .pe13 .into_push_pull_output(&mut gpioe.moder, &mut gpioe.otyper); dir.set_low().unwrap(); // SERIAL let mut gpioa = cx.device.GPIOA.split(&mut rcc.ahb); let mut pins = ( gpioa .pa9 .into_af7_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrh), gpioa .pa10 .into_af7_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrh), ); pins.1.internal_pull_up(&mut gpioa.pupdr, true); let mut serial: SerialType = Serial::new(cx.device.USART1, pins, 19200.Bd(), clocks, &mut rcc.apb2); serial.listen(Event::Rxne); rprintln!("post init"); task1::spawn().unwrap(); (init::LateResources { dir, serial }, init::Monotonics(mono)) } #[task(binds = USART1_EXTI25, resources = [serial, dir])] fn protocol_serial_task(cx: protocol_serial_task::Context) { let mut serial = cx.resources.serial; let mut dir = cx.resources.dir; serial.lock(|serial| { dir.lock(|dir| { if serial.is_rxne() { dir.set_high().unwrap(); serial.unlisten(Event::Rxne); match serial.read() { Ok(byte) => { serial.write(byte).unwrap(); serial.listen(Event::Tc); } Err(_error) => rprintln!("irq error"), }; } if serial.is_tc() { dir.set_low().unwrap(); serial.unlisten(Event::Tc); serial.listen(Event::Rxne); } }) }); } #[task] fn task1(_cx: task1::Context) { rprintln!("task1"); } #[idle] fn idle(_: idle::Context) -> ! { rprintln!("idle"); loop { cortex_m::asm::nop(); } } }
//! Linux `futex`. //! //! # Safety //! //! Futex is a very low-level mechanism for implementing concurrency //! primitives. #![allow(unsafe_code)] use crate::thread::Timespec; use crate::{backend, io}; pub use backend::thread::{FutexFlags, FutexOperation}; /// `futex(uaddr, op, val, utime, uaddr2, val3)` /// /// # References /// - [Linux `futex` system call] /// - [Linux `futex` feature] /// /// # Safety /// /// This is a very low-level feature for implementing synchronization /// primitives. See the references links above. /// /// [Linux `futex` system call]: https://man7.org/linux/man-pages/man2/futex.2.html /// [Linux `futex` feature]: https://man7.org/linux/man-pages/man7/futex.7.html #[inline] pub unsafe fn futex( uaddr: *mut u32, op: FutexOperation, flags: FutexFlags, val: u32, utime: *const Timespec, uaddr2: *mut u32, val3: u32, ) -> io::Result<usize> { backend::thread::syscalls::futex(uaddr, op, flags, val, utime, uaddr2, val3) }
#![feature(specialization)] mod content; mod text; pub use text::Text; pub use content::{Content, ToContent};
pub mod util; pub mod state; use util::events::{ Event, Events, }; use util::settings; use util::utils::format_duration; use state::app::{ App, TimerMode, KeybindMode, MAX_FOCUS_DURATION, MAX_BREAK_DURATION }; use std::{ error::Error, io, time::Duration, }; use tui::{ backend::TermionBackend, layout::{Layout, Constraint, Direction}, style::{Style, Modifier, Color}, widgets::{Block, Borders, Gauge, LineGauge, Paragraph}, text::{Span, Spans}, Terminal }; use termion::{event::Key, raw::IntoRawMode}; #[derive(PartialEq)] pub enum Status { None, Quit, Debug, } fn main() -> Result<(), Box<dyn Error>> { let stdout = io::stdout().into_raw_mode()?; let backend = TermionBackend::new(stdout); let mut terminal = Terminal::new(backend)?; let events = Events::new(); let (settings, message) = settings::Settings::load(); let mut app = App::new(settings); app.log(message); terminal.clear(); loop { terminal.draw(|rect| { let chunks = Layout::default() .direction(Direction::Vertical) .margin(1) .constraints( [ Constraint::Length(5), Constraint::Length(3), Constraint::Percentage(20), Constraint::Percentage(20), Constraint::Percentage(40), Constraint::Percentage(10), ].as_ref() ) .split(rect.size()); let timer_guage = draw_timer(&mut app); rect.render_widget(timer_guage, chunks[0]); if app.is_editing_duration() { let duration = draw_duration(&app.duration, &app.edit_mode); rect.render_widget(duration, chunks[1]) } let keybind_help = draw_keybinds(&app.keybind_mode); rect.render_widget(keybind_help, chunks[2]); let debug_window = draw_debug(&app); rect.render_widget(debug_window, chunks[3]); let log_window = draw_logs(&app); rect.render_widget(log_window, chunks[4]); })?; match events.next()? { Event::Input(input) => { let status = handle_inputs(input, &mut app); if status == Status::Quit { terminal.clear(); break; } if status == Status::Debug { break; } } Event::Tick => { app.update(); } } } Ok(()) } fn handle_inputs(input: Key, app: & mut App) -> Status { if app.is_editing_duration() { if input == Key::Char('s') { app.set_duration(); } if input == Key::Char(']') { app.increase_duration(); } if input == Key::Char('[') { app.decrease_duration(); } } if input == Key::Char('q') { return Status::Quit; } if input == Key::Char('s') { app.start_timer(); } if input == Key::Char('b') { app.edit_duration(TimerMode::Break); } if input == Key::Char('f') { app.edit_duration(TimerMode::Focus); } if input == Key::Char('r') { app.reset_duration(); } if input == Key::Char('x') { app.switch_timer_mode(); } if input == Key::Char('c') { return Status::Debug; } if input == Key::Char(' ') { app.toggle_running(); } return Status::None; } fn draw_duration<'a>(duration: &'a Duration, mode: &'a TimerMode) -> LineGauge<'a> { let label = format_duration(duration); let (divisor, color, title) = match mode { TimerMode::Break => { (MAX_BREAK_DURATION.as_secs(), Color::Cyan, "Break Duration") } TimerMode::Focus => { (MAX_FOCUS_DURATION.as_secs(), Color::Green, "Focus Duration") } }; let ratio = duration.as_secs() as f64 / divisor as f64; LineGauge::default() .block( Block::default() .borders(Borders::ALL) .title(title), ) .gauge_style( Style::default() .fg(color) .bg(Color::Black) .add_modifier(Modifier::BOLD), ) .label(label) .ratio(ratio) } fn draw_timer<'a>(app: &'a mut App) -> Gauge<'a> { let label = format_duration(&app.time_remaining) + " remaining"; let (color, title) = match app.timer_mode { TimerMode::Break => (Color::Blue, "Break Time Remaining"), TimerMode::Focus => (Color::Green, "Focus Time Remaining"), }; let ratio = app.ratio(); Gauge::default() .block( Block::default() .borders(Borders::ALL) .title(title) .style( Style::default() .bg(Color::Black) .fg(Color::White) ) ) .ratio(ratio) .label(label) .style( Style::default() .fg(Color::Red) .bg(Color::Green) ) .gauge_style( Style::default() .fg(color) // Full bar color .bg(Color::Black) // Empty bar color ) } fn draw_keybinds<'a>(keybind_mode: &'a KeybindMode) -> Paragraph<'a> { let shared_bindings = Spans::from(Span::raw(format!("(s)tart | edit (b)reak | edit (f)ocus | (r)eset | (x)switch mode | (q)uit"))); let keybinds = match keybind_mode { KeybindMode::TimerControl => vec![ shared_bindings, ], KeybindMode::Editing => vec![ Spans::from(Span::raw(format!("([)decrease duration | (])increase duration | (s)ave"))), shared_bindings ], }; Paragraph::new(keybinds) .block( Block::default() .title("Hotkeys") .borders(Borders::ALL) ) } fn draw_debug<'a>(app: &'a App) -> Paragraph<'a> { let text = vec![ Spans::from(Span::raw(format!("Ratio: {}\n", app.ratio()))), Spans::from(Span::raw(format!("Remaining Time: {}\n", app.time_remaining.as_secs()))), Spans::from(Span::raw(format!("Remaining Ticks: {}\n", app.ticks_remaining))), Spans::from(Span::raw(format!("Focus Time: {}\n", app.focus_time.as_secs()))), Spans::from(Span::raw(format!("Break Time: {}\n", app.break_time.as_secs()))), Spans::from(Span::raw(format!("Running: {}\n", app.running))), ]; Paragraph::new(text) .block( Block::default() .title("Settings") .borders(Borders::ALL) ) } fn draw_logs<'a>(app: &'a App) -> Paragraph<'a> { let messages = app.messages.iter().rev().take(10); let mut text: Vec<Spans> = Vec::new(); for message in messages { text.push(Spans::from(Span::raw(message))); } Paragraph::new(text) .block( Block::default() .title("Messages") .borders(Borders::ALL) ) }
use actix::prelude::*; use std::ops::Add; use std::time::Duration; use super::runner_agent as agent; use ycommon::runner_proto as proto; #[derive(Message)] pub enum MsgRunnerEvent { Stdout(String), } pub type RunnerEventRecipient = Recipient<MsgRunnerEvent>; pub struct RunnerProxy { room_key: String, reset_params: proto::RunEnv, recipient: RunnerEventRecipient, service_uri_tpl: String, agent: Option<Addr<agent::RunnerAgent>>, reconnect_delay: Duration, } impl RunnerProxy { pub fn new( room_key: String, reset_params: proto::RunEnv, recipient: RunnerEventRecipient, runner_service_url: String, ) -> RunnerProxy { RunnerProxy { room_key, reset_params, recipient, service_uri_tpl: runner_service_url, agent: None, reconnect_delay: Duration::from_millis(0), } } fn service_full_uri(&self) -> String { self.service_uri_tpl .replace("{room_key}", self.room_key.as_str()) } fn agent_reconnect(&mut self, ctx: &mut <Self as Actor>::Context) { if self.agent.is_some() { warn!("agent is running, do not need to reconnect"); return; } let prefix = if self.reconnect_delay.as_millis() == 0 { "\r\n" } else { "" }; self.reconnect_delay = { let delay = self.reconnect_delay + Duration::from_millis(500); if delay.as_secs() <= 5 { delay } else { self.reconnect_delay } }; let waiting_str = format!( "reconnecting, waiting for {}ms", self.reconnect_delay.as_millis() ); info!("{}", waiting_str); let _ = self.recipient.do_send(MsgRunnerEvent::Stdout(format!( "{}{}\r\n", prefix, waiting_str ))); ctx.run_later(self.reconnect_delay.clone(), |this: &mut Self, context| { this.agent_connect(context); }); } fn agent_connect(&mut self, ctx: &mut <Self as Actor>::Context) { let service_full_uri = self.service_full_uri(); info!("connecting to agent: {}", service_full_uri); let listener = ctx.address().recipient(); let agent = agent::RunnerAgent::new(service_full_uri, listener).start(); self.agent = Some(agent); // launch let run_env = self.reset_params.clone(); self.send_agent_message(proto::ServiceRequests::Reset(run_env)); } fn agent_stop(&mut self, ctx: &mut <Self as Actor>::Context) { if let Some(agent) = self.agent.as_ref() { info!("sending stop signal to runner_agent"); agent.do_send(agent::ReqStop); } } } impl Actor for RunnerProxy { type Context = Context<Self>; fn started(&mut self, ctx: &mut Self::Context) { self.agent_connect(ctx); } fn stopping(&mut self, ctx: &mut Self::Context) -> Running { info!("runner proxy stopping: {}", self.room_key); self.agent_stop(ctx); Running::Stop } } impl Handler<proto::ServiceRequests> for RunnerProxy { type Result = MessageResult<proto::ServiceRequests>; fn handle(&mut self, mut msg: proto::ServiceRequests, ctx: &mut Self::Context) -> Self::Result { debug!("received command: {:?}", msg); match &mut msg { proto::ServiceRequests::Reset(params) => { self.reset_params.language = params.language.clone(); self.reset_params.boot = params.boot.clone(); if params.win_size.col > 0 && params.win_size.row > 0 { self.reset_params.win_size = params.win_size.clone(); } else { params.win_size = self.reset_params.win_size.clone(); } } proto::ServiceRequests::WinSize(params) => { self.reset_params.win_size = params.clone(); } _ => {} } // forward to agent self.send_agent_message(msg); MessageResult(()) } } impl RunnerProxy { fn send_agent_message(&mut self, msg: proto::ServiceRequests) { match self.agent.as_ref() { None => { warn!("agent not found: {}, msg = {:?}", self.room_key, msg); } Some(agent) => { agent.do_send(msg); } } } } // Handle listener events from RunnerAgent impl Handler<agent::Events> for RunnerProxy { type Result = MessageResult<agent::Events>; fn handle(&mut self, msg: agent::Events, ctx: &mut Self::Context) -> Self::Result { debug!("events from agent: {:?}", msg); match msg { agent::Events::Connected => { info!("runner agent connected successfully: {}", self.room_key); self.reconnect_delay = Duration::from_secs(0); } agent::Events::Closed => { // agent closed info!("runner agent closed: {}", self.room_key); self.agent.take(); self.agent_reconnect(ctx); } agent::Events::Response(packet) => match packet { proto::ServiceResponses::Init(resp) => {} proto::ServiceResponses::Reset(resp) => {} proto::ServiceResponses::Run(resp) => {} proto::ServiceResponses::Stdout(resp) => match resp.into() { Err(err) => {} Ok(val) => { let _ = self.recipient.do_send(MsgRunnerEvent::Stdout(val.data)); } }, proto::ServiceResponses::WinSize(resp) => {} }, } MessageResult(()) } } #[derive(Debug, Message)] pub struct ReqStop; impl Handler<ReqStop> for RunnerProxy { type Result = (); fn handle(&mut self, msg: ReqStop, ctx: &mut Self::Context) -> Self::Result { info!("requesting runner proxy stop"); ctx.stop(); } }
pub use VkAndroidSurfaceCreateFlagsKHR::*; #[repr(u32)] #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum VkAndroidSurfaceCreateFlagsKHR { VK_ANDROID_SURFACE_CREATE_NULL_BIT = 0, } use crate::SetupVkFlags; #[repr(C)] #[derive(Clone, Copy, Eq, PartialEq, Hash)] pub struct VkAndroidSurfaceCreateFlagBitsKHR(u32); SetupVkFlags!( VkAndroidSurfaceCreateFlagsKHR, VkAndroidSurfaceCreateFlagBitsKHR );
use super::{Body, Error, Result, StatusCode, Uri}; use crate::headers::{ContentType, Header, HeaderMapExt, Location}; use hyper::http::Response as HTTPResponse; pub type Response = HTTPResponse<Body>; pub trait ResponseTypedHeaderExt { fn typed_header<H: Header>(self, header: H) -> Self; } impl ResponseTypedHeaderExt for hyper::http::response::Builder { fn typed_header<H: Header>(mut self, header: H) -> Self { if let Some(res) = self.headers_mut() { res.typed_insert(header); } self } } mod wrapper { use super::{Body, Error, ResponseTypedHeaderExt, Result}; use crate::headers::Header; use hyper::header::{HeaderName, HeaderValue}; use hyper::StatusCode; use std::convert::TryFrom; pub struct ResponseWrapper(pub hyper::http::response::Builder); impl ResponseWrapper { pub fn status(mut self, status: StatusCode) -> Self { self.0 = self.0.status(status); self } pub fn typed_header<H: Header>(mut self, header: H) -> Self { self.0 = self.0.typed_header(header); self } pub fn header<K, V>(mut self, key: K, value: V) -> Self where HeaderName: TryFrom<K>, <HeaderName as TryFrom<K>>::Error: Into<hyper::http::Error>, HeaderValue: TryFrom<V>, <HeaderValue as TryFrom<V>>::Error: Into<hyper::http::Error>, { self.0 = self.0.header(key, value); self } pub fn body<B: Into<Body>>(self, body: B) -> Result { self.0.body(body.into()).map_err(Into::into) } } impl From<ResponseWrapper> for Result { fn from(response: ResponseWrapper) -> Self { response.0.body(Body::empty()).map_err(Into::into) } } impl From<ResponseWrapper> for Error { fn from(response: ResponseWrapper) -> Self { response.0.body(Body::empty()).into() } } } pub fn response() -> self::wrapper::ResponseWrapper { self::wrapper::ResponseWrapper(HTTPResponse::builder()) } pub fn html<B: Into<Body>>(body: B) -> Result { response().typed_header(ContentType::html()).body(body) } pub fn ok<B>(body: B) -> Result where B: Into<Body>, { response().typed_header(ContentType::text()).body(body) } pub fn not_found() -> Error { response().status(StatusCode::NOT_FOUND).into() } pub fn bad_request() -> Error { response().status(StatusCode::BAD_REQUEST).into() } pub fn internal_server_error() -> Error { response().status(StatusCode::INTERNAL_SERVER_ERROR).into() } pub fn redirect_to(uri: Uri) -> Result { response() .status(StatusCode::FOUND) .typed_header(Location::from(uri)) .into() }
use syn::fold::Fold; use syn::*; use quote::quote; use std::mem; use std::default::Default; use std::fmt::Display; use std::collections::HashMap; use syn::spanned::Spanned; use proc_macro2::TokenStream; pub struct Reader { input_name: String, objects: HashMap<String, Arg>, ops: Vec<Operation>, current_arg: Arg, output: Arg } impl Reader { pub fn new() -> Reader { Reader { input_name: "".to_string(), objects: HashMap::new(), ops: Vec::new(), current_arg: Arg::None, output: Arg::None, } } pub fn get_output_arg(self) -> Arg { self.output } fn compile_output(&mut self, original: &Expr) -> Expr { let arg = self.current_arg.take(); if Arg::None == arg { original.span().unwrap().error("Output cannot be none.").emit(); panic!("Output cannot be none.") } self.output = arg; /* let inp = "Input: ".to_string() + &self.input_name; let mut expressions = "".to_string(); for k in 0..self.ops.len() { expressions += &(format!("{}", self.ops[k]) + "\n"); } let out = "Output: ".to_string() + &self.output.to_string(); let new_code = quote! { { println!("{}", #inp); if !(#expressions).is_empty() { println!("{}", #expressions); } println!("{}", #out); #original } }; syn::parse2(new_code) .expect("could not generate prints") */ original.clone() } } impl Fold for Reader { fn fold_pat_type(&mut self, ii: PatType) -> PatType { match ii.pat.as_ref() { Pat::Ident(i) => { self.input_name = i.ident.to_string(); ii } _ => fold::fold_pat_type(self, ii) } } fn fold_local(&mut self, ii: Local) -> Local { let var_name = match &(&ii).pat { Pat::Ident(i) => { i.ident.to_string() } _ => {ii.span().unwrap().error("Unsupported local variable creation.").emit(); panic!("Unsupported local variable creation.")} }; let arg; if (&ii).init.is_some() { let (_, exp) = ii.clone().init.unwrap(); self.fold_expr(*exp); arg = self.current_arg.take(); } else { arg = Arg::None; } self.objects.insert(var_name, arg); ii } fn fold_stmt(&mut self, mut ii: Stmt) -> Stmt { ii = fold::fold_stmt(self, ii); if let Stmt::Expr(i) = &ii { ii = Stmt::Expr(self.compile_output(i)); } else if let Arg::Operation(op) = self.current_arg.take() { self.ops.push(*op); } ii } fn fold_expr(&mut self, mut ii: Expr) -> Expr { match ii.clone() { Expr::Binary(i) => { self.fold_expr(*i.left); let left = self.current_arg.take(); self.fold_expr(*i.right); let right = self.current_arg.take(); let method = match i.op { BinOp::Add(_) => { "add" } BinOp::Sub(_) => { "sub" } BinOp::Mul(_) => { "mul" } BinOp::Div(_) => { "div" } _ => {i.op.span().unwrap().error("Unsupported binary expression.").emit(); panic!("Unsupported binary expression.")} }; self.current_arg = Arg::Operation(Box::new(Operation::new(left, method.to_string(), vec![right]))); } Expr::Unary(i) => { self.fold_expr(*i.expr); let receiver = self.current_arg.take(); let op = match i.op { UnOp::Neg(_) => { "neg" } _ => {i.op.span().unwrap().error("Unsupported unary expression.").emit(); panic!("Unsupported unary expression.")} }; self.current_arg = Arg::Operation(Box::new(Operation::new(receiver, op.to_string(), vec![]))); } Expr::Paren(i) => { self.fold_expr(*i.expr); } Expr::Assign(i) => { self.fold_expr(*i.left.clone()); let arg = self.current_arg.take(); if let Arg::Item(obj_name) = arg { self.fold_expr(*i.right); let arg = self.current_arg.take(); self.objects.insert(obj_name, arg); } else { (*i.left).span().unwrap().error("Assigning to expression is not supported.").emit(); panic!("Assigning to expression is not supported."); } } Expr::Lit(i) => { let lit = match i.lit { Lit::Int(li) => li.to_string(), Lit::Float(li) => li.to_string(), _ => {i.lit.span().unwrap().error("Unsupported literal.").emit(); panic!("Unsupported literal.")} }; self.current_arg = Arg::Item(lit.clone()); } Expr::Path(i) => { let mut path = i.path.segments.last().unwrap().ident.to_string(); if let Some(arg) = self.objects.get(&path) { self.current_arg = arg.clone(); } else { if path == self.input_name { path = "input".to_string(); } self.current_arg = Arg::Item(path); } } //This has slightly diffent copies Path and Field, can we merge this? Expr::Reference(i) => { match *i.expr { Expr::Path(j) => { let mut path = j.path.segments.last().unwrap().ident.to_string(); if let Some(arg) = self.objects.get(&path) { self.current_arg = arg.clone(); } else { if path == self.input_name { path = "input".to_string(); } self.current_arg = Arg::Item("&".to_string() + &path); } } Expr::Field(j) => { let mut s = "&".to_string(); match *j.base { Expr::Path(k) => { s += &k.path.get_ident().unwrap().to_string(); } _ => {j.member.span().unwrap().error("Unsupported field indexing.").emit(); panic!("Unsupported field indexing.")} } match j.member { Member::Named(k) => { s += &(".".to_string() + &k.to_string()); } _ => {j.member.span().unwrap().error("Only name fields can be accessed.").emit(); panic!("Only name fields can be accessed.")} } self.current_arg = Arg::Item(s); } _ => {i.expr.span().unwrap().error("Unsupported reference.").emit(); panic!("Unsupported reference.")} } } Expr::Return(mut i) => { self.fold_expr(*i.clone().expr.unwrap()); i.expr = Some(Box::new(self.compile_output(&*i.expr.unwrap()))); ii = Expr::Return(i); } Expr::Field(i) => { let mut s = String::new(); match *i.base { Expr::Path(j) => { s += &j.path.get_ident().unwrap().to_string(); } _ => {i.member.span().unwrap().error("Unsupported field indexing.").emit(); panic!("Unsupported field indexing.")} } match i.member { Member::Named(j) => { s += &(".".to_string() + &j.to_string()); } _ => {i.member.span().unwrap().error("Only name fields can be accessed.").emit(); panic!("Only name fields can be accessed.")} } self.current_arg = Arg::Item(s.clone()); } Expr::MethodCall(i) => { self.fold_expr(*i.receiver); let receiver = self.current_arg.take(); let mut args = Vec::new(); for k in 0..i.args.len() { self.fold_expr(i.args[k].clone()); args.push(self.current_arg.take()); } self.current_arg = Arg::Operation(Box::new(Operation::new(receiver, i.method.to_string(), args))); } /* Expr::Let(i) => { self.operations.push("let".to_string()); } Expr::Block(i) => { self.operations.push("block".to_string()); } Expr::Verbatim(i) => { self.operations.push("verb".to_string()); } Expr::Group(i) => { self.operations.push("group".to_string()); } */ _ => {ii.span().unwrap().error("Unsupported expression.").emit(); panic!("Unsupported expression.")} } ii//fold::fold_expr(self, ii) } } #[derive(Debug, PartialEq, Clone)] pub enum Arg { None, Operation(Box<Operation>), Item(String) } impl Arg { fn take(&mut self) -> Arg { mem::take(self) } pub fn to_tokenstream(&self) -> TokenStream { match self { Arg::None => panic!(), Arg::Operation(op) => op.to_tokenstream(), Arg::Item(i) => i.parse().unwrap() } } } impl Default for Arg { fn default() -> Self { Arg::None } } impl Display for Arg { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { match self { Arg::Operation(op) => op.fmt(f), Arg::Item(item) => write!(f, "{}", item), _ => Ok(()) } } } #[derive(Debug, PartialEq, Clone)] pub struct Operation { pub receiver: Arg, pub method: String, pub args: Vec<Arg> } impl Operation { fn new(receiver: Arg, method: String, args: Vec<Arg>) -> Operation { Operation { receiver: receiver, method: method, args: args } } pub fn to_tokenstream(&self) -> TokenStream { if self.method == "add" { let rec = self.receiver.to_tokenstream(); let arg = self.args[0].to_tokenstream(); quote! {#rec+#arg} } else if self.method == "sub" { let rec = self.receiver.to_tokenstream(); let arg = self.args[0].to_tokenstream(); quote! {#rec-#arg} } else if self.method == "mul" { let rec = self.receiver.to_tokenstream(); let arg = self.args[0].to_tokenstream(); quote! {#rec*#arg} } else if self.method == "div" { let rec = self.receiver.to_tokenstream(); let arg = self.args[0].to_tokenstream(); quote! {#rec/#arg} } else if self.method == "neg" { let rec = self.receiver.to_tokenstream(); quote! {-#rec} } else { let rec = self.receiver.to_tokenstream(); let met: TokenStream = self.method.parse().unwrap(); let args: Vec<TokenStream> = self.args.iter().map(|arg| arg.to_tokenstream()).collect(); quote! {#rec.#met(#(#args),*)} } } } impl Display for Operation { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { write!(f, "{}(", self.method.to_string())?; write!(f, "{}", self.receiver)?; for i in 0..self.args.len() { write!(f, ", ")?; self.args[i].fmt(f)?; } write!(f, ")")?; Ok(()) } }
/// Returns the number of nucleotide differences in two DNAs of same size pub fn hamming_distance(dna1: &str, dna2: &str) -> usize { dna1.chars().zip(dna2.chars()).filter(|&(x, y)| x != y).count() }
use std::process::{Command, Output}; use std::path::Path; use std::env; pub struct Compiler { working_dir: String } impl Compiler { pub fn new(working_dir: &str) -> Compiler { Compiler { working_dir: working_dir.into() } } fn openssl_path(&self) -> String { match env::var("OPENSSL_INCLUDE_DIR") { Ok(val) => val, Err(_) => "/usr/include/openssl".into() } } pub fn call_configure_script(&self, prefix_path: &str) -> Output { Command::new("./configure") .arg(format!("--prefix={}", prefix_path)) .arg(format!("--with-openssl-dir={}", self.openssl_path())) .current_dir(Path::new(&self.working_dir)) .env("RUBY_CONFIGURE_OPTS","--with-readline-dir=\"/usr/lib\"") .output() .expect("Failed to call Configure script") } pub fn make(&self) -> Output { Command::new("make") .current_dir(Path::new(&self.working_dir)) .output() .expect("Failed to call make") } pub fn make_install(&self) -> Output { Command::new("make") .arg("install") .current_dir(Path::new(&self.working_dir)) .output() .expect("Failed to call make install") } }
use procon_reader::ProconReader; fn main() { let stdin = std::io::stdin(); let mut rd = ProconReader::new(stdin.lock()); let n: usize = rd.get(); let tlr: Vec<(u8, u32, u32)> = (0..n) .map(|_| { let t: u8 = rd.get(); let l: u32 = rd.get(); let r: u32 = rd.get(); (t, l, r) }) .collect(); let f = |(t, l, r)| match t { 1 => (l * 2, r * 2), 2 => (l * 2, r * 2 - 1), 3 => (l * 2 + 1, r * 2), 4 => (l * 2 + 1, r * 2 - 1), _ => unreachable!(), }; let mut ans = 0; for i in 0..n { for j in (i + 1)..n { let (l1, r1) = f(tlr[i]); let (l2, r2) = f(tlr[j]); let ((_, r1), (l2, _)) = if l1 <= l2 { ((l1, r1), (l2, r2)) } else { ((l2, r2), (l1, r1)) }; if l2 <= r1 { ans += 1 } } } println!("{}", ans); }
use farc::*; use std::path::*; use structopt::*; #[derive(StructOpt)] #[structopt(name = "farc", about = "manipulates SEGA File Archive file formats")] enum Opt { #[structopt(name = "create")] Create { #[structopt(parse(from_os_str))] create: PathBuf, #[structopt(short)] compress: bool, #[structopt(short)] encrypt: bool, }, #[structopt(name = "extract")] Extract { path: PathBuf, #[structopt(long, short)] ///Extract to the root directory of the archive instead of a nested folder root: bool, }, //Only view the archive without extracting #[structopt(name = "view")] View { path: PathBuf }, } use std::fs::File; use std::io::{self, Read}; fn main() { let opts = Opt::from_args(); match opts { Opt::Extract { path, root } => { let path = Path::new(&path); let mut file = File::open(&path).expect("Failed to open file"); let mut input = vec![]; file.read_to_end(&mut input).unwrap(); let (_, farc) = GenericArchive::read(&input).expect("Failed to parse archive"); let root_dir = path.parent().unwrap(); let root_dir = if root { root_dir.to_owned() } else { root_dir.join(path.file_stem().unwrap()) }; std::fs::create_dir(&root_dir); match farc { GenericArchive::Base(a) => extract(&root_dir, &a.entries), GenericArchive::Compress(a) => extract(&root_dir, &a.entries), GenericArchive::Extended(a) => { use ExtendedArchives::*; match a { Base(a) => extract(&root_dir, &a.0.entries), Compress(a) => extract(&root_dir, &a.0.entries), _ => unimplemented!("Extracting encrypted archives is not yet supported"), } } GenericArchive::Future(a) => { use FutureArchives::*; match a { Base(a) => extract(&root_dir, &a.0.entries), Compress(a) => extract(&root_dir, &a.0.entries), _ => unimplemented!("Extracting encrypted archives is not yet supported"), } } }; } Opt::View { path } => { let path = Path::new(&path); let mut file = File::open(&path).expect("Failed to open file"); let mut input = vec![]; file.read_to_end(&mut input).unwrap(); let farc = BaseArchive::read(&input) .expect("Failed to parse archive") .1; println!("FArc archive with {} entries", farc.entries.len()); for (i, entry) in farc.entries.iter().enumerate() { println!("#{} {}", i + 1, entry.name()); } } _ => (), }; } fn extract<'a, E: EntryExtract<'a>>( root_dir: &Path, entries: &'a [E], ) -> Result<(), Box<dyn std::error::Error>> { for entry in entries { let mut file = File::create(root_dir.join(&entry.name()))?; io::copy(&mut entry.extractor(), &mut file)?; } Ok(()) }
// 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 common_ast::ast::FormatTreeNode; use common_catalog::plan::PartStatistics; use common_exception::Result; use common_functions::BUILTIN_FUNCTIONS; use common_profile::ProfSpanSetRef; use itertools::Itertools; use super::AggregateExpand; use super::AggregateFinal; use super::AggregateFunctionDesc; use super::AggregatePartial; use super::EvalScalar; use super::Exchange; use super::Filter; use super::HashJoin; use super::Limit; use super::PhysicalPlan; use super::Project; use super::ProjectSet; use super::Sort; use super::TableScan; use super::UnionAll; use crate::executor::explain::PlanStatsInfo; use crate::executor::DistributedInsertSelect; use crate::executor::ExchangeSink; use crate::executor::ExchangeSource; use crate::executor::FragmentKind; use crate::executor::RuntimeFilterSource; use crate::planner::MetadataRef; use crate::planner::DUMMY_TABLE_INDEX; use crate::BaseTableColumn; use crate::ColumnEntry; use crate::DerivedColumn; use crate::TableInternalColumn; impl PhysicalPlan { pub fn format( &self, metadata: MetadataRef, prof_span_set: ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { to_format_tree(self, &metadata, &prof_span_set) } pub fn format_join(&self, metadata: &MetadataRef) -> Result<FormatTreeNode<String>> { match self { PhysicalPlan::TableScan(plan) => { if plan.table_index == DUMMY_TABLE_INDEX { return Ok(FormatTreeNode::with_children( format!("Scan: dummy, rows: {}", plan.source.statistics.read_rows), vec![], )); } let table = metadata.read().table(plan.table_index).clone(); let table_name = format!("{}.{}.{}", table.catalog(), table.database(), table.name()); Ok(FormatTreeNode::with_children( format!( "Scan: {}, rows: {}", table_name, plan.source.statistics.read_rows ), vec![], )) } PhysicalPlan::HashJoin(plan) => { let build_child = plan.build.format_join(metadata)?; let probe_child = plan.probe.format_join(metadata)?; let children = vec![ FormatTreeNode::with_children("Build".to_string(), vec![build_child]), FormatTreeNode::with_children("Probe".to_string(), vec![probe_child]), ]; Ok(FormatTreeNode::with_children( format!("HashJoin: {}", plan.join_type), children, )) } other => { let children = other .children() .map(|child| child.format_join(metadata)) .collect::<Result<Vec<FormatTreeNode<String>>>>()?; if children.len() == 1 { Ok(children[0].clone()) } else { Ok(FormatTreeNode::with_children( format!("{:?}", other), children, )) } } } } } fn to_format_tree( plan: &PhysicalPlan, metadata: &MetadataRef, prof_span_set: &ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { match plan { PhysicalPlan::TableScan(plan) => table_scan_to_format_tree(plan, metadata), PhysicalPlan::Filter(plan) => filter_to_format_tree(plan, metadata, prof_span_set), PhysicalPlan::Project(plan) => project_to_format_tree(plan, metadata, prof_span_set), PhysicalPlan::EvalScalar(plan) => eval_scalar_to_format_tree(plan, metadata, prof_span_set), PhysicalPlan::AggregateExpand(plan) => { aggregate_expand_to_format_tree(plan, metadata, prof_span_set) } PhysicalPlan::AggregatePartial(plan) => { aggregate_partial_to_format_tree(plan, metadata, prof_span_set) } PhysicalPlan::AggregateFinal(plan) => { aggregate_final_to_format_tree(plan, metadata, prof_span_set) } PhysicalPlan::Sort(plan) => sort_to_format_tree(plan, metadata, prof_span_set), PhysicalPlan::Limit(plan) => limit_to_format_tree(plan, metadata, prof_span_set), PhysicalPlan::HashJoin(plan) => hash_join_to_format_tree(plan, metadata, prof_span_set), PhysicalPlan::Exchange(plan) => exchange_to_format_tree(plan, metadata, prof_span_set), PhysicalPlan::UnionAll(plan) => union_all_to_format_tree(plan, metadata, prof_span_set), PhysicalPlan::ExchangeSource(plan) => exchange_source_to_format_tree(plan), PhysicalPlan::ExchangeSink(plan) => { exchange_sink_to_format_tree(plan, metadata, prof_span_set) } PhysicalPlan::DistributedInsertSelect(plan) => { distributed_insert_to_format_tree(plan.as_ref(), metadata, prof_span_set) } PhysicalPlan::ProjectSet(plan) => project_set_to_format_tree(plan, metadata, prof_span_set), PhysicalPlan::RuntimeFilterSource(plan) => { runtime_filter_source_to_format_tree(plan, metadata, prof_span_set) } } } fn table_scan_to_format_tree( plan: &TableScan, metadata: &MetadataRef, ) -> Result<FormatTreeNode<String>> { if plan.table_index == DUMMY_TABLE_INDEX { return Ok(FormatTreeNode::new("DummyTableScan".to_string())); } let table = metadata.read().table(plan.table_index).clone(); let table_name = format!("{}.{}.{}", table.catalog(), table.database(), table.name()); let filters = plan .source .push_downs .as_ref() .and_then(|extras| { extras .filter .as_ref() .map(|expr| expr.as_expr(&BUILTIN_FUNCTIONS).sql_display()) }) .unwrap_or_default(); let limit = plan .source .push_downs .as_ref() .map_or("NONE".to_string(), |extras| { extras .limit .map_or("NONE".to_string(), |limit| limit.to_string()) }); let mut children = vec![FormatTreeNode::new(format!("table: {table_name}"))]; // Part stats. children.extend(part_stats_info_to_format_tree(&plan.source.statistics)); // Push downs. children.push(FormatTreeNode::new(format!( "push downs: [filters: [{filters}], limit: {limit}]" ))); let output_columns = plan.source.output_schema.fields(); // If output_columns contains all columns of the source, // Then output_columns won't show in explain if output_columns.len() < plan.source.source_info.schema().fields().len() { children.push(FormatTreeNode::new(format!( "output columns: [{}]", output_columns.iter().map(|f| f.name()).join(", ") ))); } if let Some(info) = &plan.stat_info { let items = plan_stats_info_to_format_tree(info); children.extend(items); } Ok(FormatTreeNode::with_children( "TableScan".to_string(), children, )) } fn filter_to_format_tree( plan: &Filter, metadata: &MetadataRef, prof_span_set: &ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { let filter = plan .predicates .iter() .map(|pred| pred.as_expr(&BUILTIN_FUNCTIONS).sql_display()) .join(", "); let mut children = vec![FormatTreeNode::new(format!("filters: [{filter}]"))]; if let Some(info) = &plan.stat_info { let items = plan_stats_info_to_format_tree(info); children.extend(items); } if let Some(prof_span) = prof_span_set.lock().unwrap().get(&plan.plan_id) { let process_time = prof_span.process_time / 1000 / 1000; // milliseconds children.push(FormatTreeNode::new(format!( "total process time: {process_time}ms" ))); } children.push(to_format_tree(&plan.input, metadata, prof_span_set)?); Ok(FormatTreeNode::with_children( "Filter".to_string(), children, )) } fn project_to_format_tree( plan: &Project, metadata: &MetadataRef, prof_span_set: &ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { let columns = plan .columns .iter() .sorted() .map(|column| { format!( "{} (#{})", match metadata.read().column(*column) { ColumnEntry::BaseTableColumn(BaseTableColumn { column_name, .. }) => column_name, ColumnEntry::DerivedColumn(DerivedColumn { alias, .. }) => alias, ColumnEntry::InternalColumn(TableInternalColumn { internal_column, .. }) => internal_column.column_name(), }, column ) }) .collect::<Vec<_>>() .join(", "); let mut children = vec![FormatTreeNode::new(format!("columns: [{columns}]"))]; if let Some(info) = &plan.stat_info { let items = plan_stats_info_to_format_tree(info); children.extend(items); } if let Some(prof_span) = prof_span_set.lock().unwrap().get(&plan.plan_id) { let process_time = prof_span.process_time / 1000 / 1000; // milliseconds children.push(FormatTreeNode::new(format!( "total process time: {process_time}ms" ))); } children.push(to_format_tree(&plan.input, metadata, prof_span_set)?); Ok(FormatTreeNode::with_children( "Project".to_string(), children, )) } fn eval_scalar_to_format_tree( plan: &EvalScalar, metadata: &MetadataRef, prof_span_set: &ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { let scalars = plan .exprs .iter() .map(|(expr, _)| expr.as_expr(&BUILTIN_FUNCTIONS).sql_display()) .collect::<Vec<_>>() .join(", "); let mut children = vec![FormatTreeNode::new(format!("expressions: [{scalars}]"))]; if let Some(info) = &plan.stat_info { let items = plan_stats_info_to_format_tree(info); children.extend(items); } if let Some(prof_span) = prof_span_set.lock().unwrap().get(&plan.plan_id) { let process_time = prof_span.process_time / 1000 / 1000; // milliseconds children.push(FormatTreeNode::new(format!( "total process time: {process_time}ms" ))); } children.push(to_format_tree(&plan.input, metadata, prof_span_set)?); Ok(FormatTreeNode::with_children( "EvalScalar".to_string(), children, )) } pub fn pretty_display_agg_desc(desc: &AggregateFunctionDesc, metadata: &MetadataRef) -> String { format!( "{}({})", desc.sig.name, desc.arg_indices .iter() .map(|&index| { let column = metadata.read().column(index).clone(); match column { ColumnEntry::BaseTableColumn(BaseTableColumn { column_name, .. }) => { column_name } ColumnEntry::DerivedColumn(DerivedColumn { alias, .. }) => alias, ColumnEntry::InternalColumn(TableInternalColumn { internal_column, .. }) => internal_column.column_name().to_string(), } }) .collect::<Vec<_>>() .join(", ") ) } fn aggregate_expand_to_format_tree( plan: &AggregateExpand, metadata: &MetadataRef, prof_span_set: &ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { let sets = plan .grouping_sets .iter() .map(|set| { set.iter() .map(|column| { let column = metadata.read().column(*column).clone(); match column { ColumnEntry::BaseTableColumn(BaseTableColumn { column_name, .. }) => { column_name } ColumnEntry::DerivedColumn(DerivedColumn { alias, .. }) => alias, ColumnEntry::InternalColumn(TableInternalColumn { internal_column, .. }) => internal_column.column_name().to_string(), } }) .collect::<Vec<_>>() .join(", ") }) .map(|s| format!("({})", s)) .collect::<Vec<_>>() .join(", "); let mut children = vec![FormatTreeNode::new(format!("grouping sets: [{sets}]"))]; if let Some(info) = &plan.stat_info { let items = plan_stats_info_to_format_tree(info); children.extend(items); } if let Some(prof_span) = prof_span_set.lock().unwrap().get(&plan.plan_id) { let process_time = prof_span.process_time / 1000 / 1000; // milliseconds children.push(FormatTreeNode::new(format!( "total process time: {process_time}ms" ))); } children.push(to_format_tree(&plan.input, metadata, prof_span_set)?); Ok(FormatTreeNode::with_children( "AggregateExpand".to_string(), children, )) } fn aggregate_partial_to_format_tree( plan: &AggregatePartial, metadata: &MetadataRef, prof_span_set: &ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { let group_by = plan .group_by .iter() .map(|column| { let column = metadata.read().column(*column).clone(); let name = match column { ColumnEntry::BaseTableColumn(BaseTableColumn { column_name, .. }) => column_name, ColumnEntry::DerivedColumn(DerivedColumn { alias, .. }) => alias, ColumnEntry::InternalColumn(TableInternalColumn { internal_column, .. }) => internal_column.column_name().to_string(), }; Ok(name) }) .collect::<Result<Vec<_>>>()? .join(", "); let agg_funcs = plan .agg_funcs .iter() .map(|agg| pretty_display_agg_desc(agg, metadata)) .collect::<Vec<_>>() .join(", "); let mut children = vec![ FormatTreeNode::new(format!("group by: [{group_by}]")), FormatTreeNode::new(format!("aggregate functions: [{agg_funcs}]")), ]; if let Some(info) = &plan.stat_info { let items = plan_stats_info_to_format_tree(info); children.extend(items); } if let Some(prof_span) = prof_span_set.lock().unwrap().get(&plan.plan_id) { let process_time = prof_span.process_time / 1000 / 1000; // milliseconds children.push(FormatTreeNode::new(format!( "total process time: {process_time}ms" ))); } children.push(to_format_tree(&plan.input, metadata, prof_span_set)?); Ok(FormatTreeNode::with_children( "AggregatePartial".to_string(), children, )) } fn aggregate_final_to_format_tree( plan: &AggregateFinal, metadata: &MetadataRef, prof_span_set: &ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { let group_by = plan .group_by .iter() .map(|column| { let column = metadata.read().column(*column).clone(); let name = match column { ColumnEntry::BaseTableColumn(BaseTableColumn { column_name, .. }) => column_name, ColumnEntry::DerivedColumn(DerivedColumn { alias, .. }) => alias, ColumnEntry::InternalColumn(TableInternalColumn { internal_column, .. }) => internal_column.column_name().to_string(), }; Ok(name) }) .collect::<Result<Vec<_>>>()? .join(", "); let agg_funcs = plan .agg_funcs .iter() .map(|agg| pretty_display_agg_desc(agg, metadata)) .collect::<Vec<_>>() .join(", "); let mut children = vec![ FormatTreeNode::new(format!("group by: [{group_by}]")), FormatTreeNode::new(format!("aggregate functions: [{agg_funcs}]")), ]; if let Some(limit) = &plan.limit { let items = FormatTreeNode::new(format!("limit: {limit}")); children.push(items); } if let Some(info) = &plan.stat_info { let items = plan_stats_info_to_format_tree(info); children.extend(items); } if let Some(prof_span) = prof_span_set.lock().unwrap().get(&plan.plan_id) { let process_time = prof_span.process_time / 1000 / 1000; // milliseconds children.push(FormatTreeNode::new(format!( "total process time: {process_time}ms" ))); } children.push(to_format_tree(&plan.input, metadata, prof_span_set)?); Ok(FormatTreeNode::with_children( "AggregateFinal".to_string(), children, )) } fn sort_to_format_tree( plan: &Sort, metadata: &MetadataRef, prof_span_set: &ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { let sort_keys = plan .order_by .iter() .map(|sort_key| { let index = sort_key.order_by; let column = metadata.read().column(index).clone(); Ok(format!( "{} {} {}", match column { ColumnEntry::BaseTableColumn(BaseTableColumn { column_name, .. }) => column_name, ColumnEntry::DerivedColumn(DerivedColumn { alias, .. }) => alias, ColumnEntry::InternalColumn(TableInternalColumn { internal_column, .. }) => { internal_column.column_name().to_string() } }, if sort_key.asc { "ASC" } else { "DESC" }, if sort_key.nulls_first { "NULLS FIRST" } else { "NULLS LAST" } )) }) .collect::<Result<Vec<_>>>()? .join(", "); let mut children = vec![FormatTreeNode::new(format!("sort keys: [{sort_keys}]"))]; if let Some(info) = &plan.stat_info { let items = plan_stats_info_to_format_tree(info); children.extend(items); } if let Some(prof_span) = prof_span_set.lock().unwrap().get(&plan.plan_id) { let process_time = prof_span.process_time / 1000 / 1000; // milliseconds children.push(FormatTreeNode::new(format!( "total process time: {process_time}ms" ))); } children.push(to_format_tree(&plan.input, metadata, prof_span_set)?); Ok(FormatTreeNode::with_children("Sort".to_string(), children)) } fn limit_to_format_tree( plan: &Limit, metadata: &MetadataRef, prof_span_set: &ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { let mut children = vec![ FormatTreeNode::new(format!( "limit: {}", plan.limit .map_or("NONE".to_string(), |limit| limit.to_string()) )), FormatTreeNode::new(format!("offset: {}", plan.offset)), ]; if let Some(info) = &plan.stat_info { let items = plan_stats_info_to_format_tree(info); children.extend(items); } if let Some(prof_span) = prof_span_set.lock().unwrap().get(&plan.plan_id) { let process_time = prof_span.process_time / 1000 / 1000; // milliseconds children.push(FormatTreeNode::new(format!( "total process time: {process_time}ms" ))); } children.push(to_format_tree(&plan.input, metadata, prof_span_set)?); Ok(FormatTreeNode::with_children("Limit".to_string(), children)) } fn hash_join_to_format_tree( plan: &HashJoin, metadata: &MetadataRef, prof_span_set: &ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { let build_keys = plan .build_keys .iter() .map(|scalar| scalar.as_expr(&BUILTIN_FUNCTIONS).sql_display()) .collect::<Vec<_>>() .join(", "); let probe_keys = plan .probe_keys .iter() .map(|scalar| scalar.as_expr(&BUILTIN_FUNCTIONS).sql_display()) .collect::<Vec<_>>() .join(", "); let filters = plan .non_equi_conditions .iter() .map(|filter| filter.as_expr(&BUILTIN_FUNCTIONS).sql_display()) .collect::<Vec<_>>() .join(", "); let mut build_child = to_format_tree(&plan.build, metadata, prof_span_set)?; let mut probe_child = to_format_tree(&plan.probe, metadata, prof_span_set)?; build_child.payload = format!("{}(Build)", build_child.payload); probe_child.payload = format!("{}(Probe)", probe_child.payload); let mut children = vec![ FormatTreeNode::new(format!("join type: {}", plan.join_type)), FormatTreeNode::new(format!("build keys: [{build_keys}]")), FormatTreeNode::new(format!("probe keys: [{probe_keys}]")), FormatTreeNode::new(format!("filters: [{filters}]")), ]; if let Some(info) = &plan.stat_info { let items = plan_stats_info_to_format_tree(info); children.extend(items); } if let Some(prof_span) = prof_span_set.lock().unwrap().get(&plan.plan_id) { let process_time = prof_span.process_time / 1000 / 1000; // milliseconds children.push(FormatTreeNode::new(format!( "total process time: {process_time}ms" ))); } children.push(build_child); children.push(probe_child); Ok(FormatTreeNode::with_children( "HashJoin".to_string(), children, )) } fn exchange_to_format_tree( plan: &Exchange, metadata: &MetadataRef, prof_span_set: &ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { Ok(FormatTreeNode::with_children("Exchange".to_string(), vec![ FormatTreeNode::new(format!("exchange type: {}", match plan.kind { FragmentKind::Init => "Init-Partition".to_string(), FragmentKind::Normal => format!( "Hash({})", plan.keys .iter() .map(|key| { key.as_expr(&BUILTIN_FUNCTIONS).sql_display() }) .collect::<Vec<_>>() .join(", ") ), FragmentKind::Expansive => "Broadcast".to_string(), FragmentKind::Merge => "Merge".to_string(), })), to_format_tree(&plan.input, metadata, prof_span_set)?, ])) } fn union_all_to_format_tree( plan: &UnionAll, metadata: &MetadataRef, prof_span_set: &ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { let mut children = vec![]; if let Some(info) = &plan.stat_info { let items = plan_stats_info_to_format_tree(info); children.extend(items); } if let Some(prof_span) = prof_span_set.lock().unwrap().get(&plan.plan_id) { let process_time = prof_span.process_time / 1000 / 1000; // milliseconds children.push(FormatTreeNode::new(format!( "total process time: {process_time}ms" ))); } children.extend(vec![ to_format_tree(&plan.left, metadata, prof_span_set)?, to_format_tree(&plan.right, metadata, prof_span_set)?, ]); Ok(FormatTreeNode::with_children( "UnionAll".to_string(), children, )) } fn part_stats_info_to_format_tree(info: &PartStatistics) -> Vec<FormatTreeNode<String>> { let mut items = vec![ FormatTreeNode::new(format!("read rows: {}", info.read_rows)), FormatTreeNode::new(format!("read bytes: {}", info.read_bytes)), FormatTreeNode::new(format!("partitions total: {}", info.partitions_total)), FormatTreeNode::new(format!("partitions scanned: {}", info.partitions_scanned)), ]; if info.pruning_stats.segments_range_pruning_before > 0 { items.push(FormatTreeNode::new(format!( "pruning stats: [segments: <range pruning: {} to {}>, blocks: <range pruning: {} to {}, bloom pruning: {} to {}>]", info.pruning_stats.segments_range_pruning_before, info.pruning_stats.segments_range_pruning_after, info.pruning_stats.blocks_range_pruning_before, info.pruning_stats.blocks_range_pruning_after, info.pruning_stats.blocks_bloom_pruning_before, info.pruning_stats.blocks_bloom_pruning_after, ))) } items } fn plan_stats_info_to_format_tree(info: &PlanStatsInfo) -> Vec<FormatTreeNode<String>> { vec![FormatTreeNode::new(format!( "estimated rows: {0:.2}", info.estimated_rows ))] } fn exchange_source_to_format_tree(plan: &ExchangeSource) -> Result<FormatTreeNode<String>> { let mut children = vec![]; children.push(FormatTreeNode::new(format!( "source fragment: [{}]", plan.source_fragment_id ))); Ok(FormatTreeNode::with_children( "ExchangeSource".to_string(), children, )) } fn exchange_sink_to_format_tree( plan: &ExchangeSink, metadata: &MetadataRef, prof_span_set: &ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { let mut children = vec![]; children.push(FormatTreeNode::new(format!( "destination fragment: [{}]", plan.destination_fragment_id ))); children.push(to_format_tree(&plan.input, metadata, prof_span_set)?); Ok(FormatTreeNode::with_children( "ExchangeSink".to_string(), children, )) } fn distributed_insert_to_format_tree( plan: &DistributedInsertSelect, metadata: &MetadataRef, prof_span_set: &ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { let children = vec![to_format_tree(&plan.input, metadata, prof_span_set)?]; Ok(FormatTreeNode::with_children( "DistributedInsertSelect".to_string(), children, )) } fn project_set_to_format_tree( plan: &ProjectSet, metadata: &MetadataRef, prof_span_set: &ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { let mut children = vec![]; if let Some(info) = &plan.stat_info { let items = plan_stats_info_to_format_tree(info); children.extend(items); } if let Some(prof_span) = prof_span_set.lock().unwrap().get(&plan.plan_id) { let process_time = prof_span.process_time / 1000 / 1000; // milliseconds children.push(FormatTreeNode::new(format!( "total process time: {process_time}ms" ))); } children.extend(vec![FormatTreeNode::new(format!( "set returning functions: {}", plan.srf_exprs .iter() .map(|(expr, _)| expr.clone().as_expr(&BUILTIN_FUNCTIONS).sql_display()) .collect::<Vec<_>>() .join(", ") ))]); children.extend(vec![to_format_tree(&plan.input, metadata, prof_span_set)?]); Ok(FormatTreeNode::with_children( "ProjectSet".to_string(), children, )) } fn runtime_filter_source_to_format_tree( plan: &RuntimeFilterSource, metadata: &MetadataRef, prof_span_set: &ProfSpanSetRef, ) -> Result<FormatTreeNode<String>> { let children = vec![ to_format_tree(&plan.left_side, metadata, prof_span_set)?, to_format_tree(&plan.right_side, metadata, prof_span_set)?, ]; Ok(FormatTreeNode::with_children( "RuntimeFilterSource".to_string(), children, )) }
mod test_env; use rustcommon::mysqlaccessor_async; use tokio; use sqlx::Row; fn get_mysql_client_test<'a>() -> mysqlaccessor_async::MySQLAccessorAsync<'a> { let get_default = || mysqlaccessor_async::MySQLAccessorAsync::new() .host("localhost") .port(3306) .user("root") .passwd("") .db("test") .charset("utf8"); let ref env_map = test_env::ENV_CONFIG; if env_map.contains_key("mysql.host") && env_map.contains_key("mysql.port") && env_map.contains_key("mysql.user") && env_map.contains_key("mysql.passwd") && env_map.contains_key("mysql.db") { return mysqlaccessor_async::MySQLAccessorAsync::new() .host(env_map.get("mysql.host").unwrap().as_str()) .port(env_map.get("mysql.port").unwrap().parse::<u16>().unwrap()) .user(env_map.get("mysql.user").unwrap().as_str()) .passwd(env_map.get("mysql.passwd").unwrap().as_str()) .db(env_map.get("mysql.db").unwrap().as_str()) .charset("utf8"); } get_default() } #[tokio::test] async fn test_mysql_async_select() -> Result<(), String> { let mut mysql_client = get_mysql_client_test(); let _ = mysql_client.open_connection().await.unwrap(); match mysql_client.do_sql("select `id` from test_table").await { Ok(rows_option) => match rows_option { Some(rows) => { if rows.len() == 0 { return Err(String::from("do mysql_async_select fail, empty result")); } match rows.into_iter().all(|row| { true }) { true => Ok(()), false => Err(String::from("do mysql_async_select fail")) } } None => {Err(String::from("do mysql_async_select fail"))} }, Err(_) => {Err(String::from("do mysql_async_select fail"))} } }
use dotenv; use serenity::{ async_trait, model::{channel::Message, gateway::Ready}, prelude::*, }; use std::env; struct Handler; mod commands; use crate::commands::*; mod checks; use crate::checks::*; mod chess_game; #[async_trait] impl EventHandler for Handler { // For each received message do this: async fn message(&self, ctx: Context, msg: Message) { // Check if message is either from me or another bot let msg2 = msg.clone(); let ctx2 = ctx.clone(); if !author_is_bot(&msg) { // Check if message is sent via direct message if !send_via_dm(&msg) || author_is_owner(&msg) { // TODO: add variable prefix (needs to be stored in data) let parsed_message = parse_command(&msg, "t".into()); if parsed_message.is_command { let functions = get_commands(); match functions.get(&parsed_message.command.expect("Err parsing the command")) { Some(function) => { function( ctx, msg, ParsedCommand { is_command: false, command: None, args: parsed_message.args, }, ) .await; } _ => { if let Err(why) = msg .channel_id .say(&ctx.http, "Sorry, I do not know what to do now :(") .await { println!("Error sending message: {:?}", why); } } } } // TODO: handle message xp when message is no command if has_profanity_content(&msg2) { if let Err(why) = msg2 .channel_id .say(ctx2.http, "Hey, please watch your language!") .await { println!("Error sending message: {:?}", why); } } } // Sent via direct message else { let functions = get_commands(); match functions.get("dm_not_implemented") { Some(function) => { function( ctx, msg, ParsedCommand { is_command: false, command: None, args: None, }, ) .await; } _ => println!("No command found"), } } } } // After connecting successfully with discord do this: async fn ready(&self, _: Context, ready: Ready) { println!("{} is connected!", ready.user.name); } } #[tokio::main] async fn main() { // Configure the client with discord bot token in the environment. dotenv::from_filename("secrets.env").expect("Did not find secret.env"); let token = env::var("DISCORD_TOKEN").expect("Expected a token in the environment"); // Create a new instance of the Client, logging in as a bot. This will // automatically prepend your bot token with "Bot ", which is a requirement // by Discord for bot users. let mut client = Client::builder(&token) .event_handler(Handler) .await .expect("Err creating client"); // TODO: add presence update with funny message // Finally, start a single shard, and start listening to events. // // Shards will automatically attempt to reconnect, and will perform // exponential backoff until it reconnects. if let Err(why) = client.start().await { println!("Client error: {:?}", why); } // TODO: handle process exit so the presence is offline }
use crate::class_file::unvalidated::read::FromReader; use crate::class_file::unvalidated; use crate::class_file::unvalidated::AttributeInfo; use crate::class_file::unvalidated::{ClassFile as UnvalidatedClassFile}; use crate::class_file::unvalidated::ExceptionTableRecord; use crate::class_file::validated::validate_inst; use crate::class_file::validated::Constant; use crate::class_file::validated::FieldRef; use crate::class_file::validated::Instruction; use crate::class_file::validated::ValidationError; use std::collections::HashMap; use std::rc::Rc; use std::io::Cursor; #[derive(Debug)] pub struct MethodRef { pub(crate) class_name: String, pub(crate) name: String, pub(crate) desc: String, } #[derive(Debug)] pub struct MethodBody { max_stack: u16, pub(crate) max_locals: u16, bytes: Box<[u8]>, // TODO: validate exception table records exception_info: Vec<unvalidated::attribute::ExceptionTableRecord>, pub(crate) class_refs: HashMap<u32, Rc<String>>, pub(crate) field_refs: HashMap<u32, Rc<FieldRef>>, pub(crate) method_refs: HashMap<u32, Rc<MethodRef>>, pub(crate) const_refs: HashMap<u32, Rc<Constant>>, // TODO: method attributes } impl MethodBody { pub fn iter_from(&self, offset: u32) -> MethodInstrIter { MethodInstrIter { handle: self, offset: offset as usize } } } #[derive(Debug)] pub struct MethodHandle { // TODO: access_flags: unvalidated::MethodAccessFlags, pub(crate) name: String, pub(crate) desc: String, pub(crate) body: Option<Rc<MethodBody>>, // flags, attributes, .. } pub struct MethodInstrIter<'handle> { handle: &'handle MethodBody, pub(crate) offset: usize, } impl<'handle> Iterator for MethodInstrIter<'handle> { type Item = Instruction; fn next(&mut self) -> Option<Instruction> { let mut cursor = Cursor::new(&self.handle.bytes[self.offset..]); let raw_inst = match unvalidated::Instruction::read_from(&mut cursor) { Ok(inst) => inst, Err(_) => { return None; } }; let next = validate_inst(self.handle, self.offset as u32, &raw_inst); self.offset += cursor.position() as usize; next } } fn make_refs<'validation>( inst: &unvalidated::Instruction, max_locals: u16, position: u32, raw_class: &UnvalidatedClassFile, class_refs: &'validation mut HashMap<u32, Rc<String>>, field_refs: &'validation mut HashMap<u32, Rc<FieldRef>>, method_refs: &'validation mut HashMap<u32, Rc<MethodRef>>, const_refs: &'validation mut HashMap<u32, Rc<Constant>> ) -> Result<(), ValidationError> { use unvalidated::Instruction; match inst { Instruction::IStore(local_idx) | Instruction::LStore(local_idx) | Instruction::FStore(local_idx) | Instruction::DStore(local_idx) | Instruction::AStore(local_idx) | Instruction::ILoad(local_idx) | Instruction::LLoad(local_idx) | Instruction::FLoad(local_idx) | Instruction::DLoad(local_idx) | Instruction::ALoad(local_idx) => { if *local_idx >= max_locals { return Err(ValidationError::InvalidMethod("invalid local index")); } } Instruction::New(class_idx) | Instruction::CheckCast(class_idx) | Instruction::InstanceOf(class_idx) => { match raw_class.checked_const(*class_idx)? { unvalidated::Constant::Class(idx) => { class_refs.insert(position as u32, Rc::new(raw_class.get_str(*idx).unwrap().to_string())); } _ => { panic!("bad idx"); } } }, Instruction::Ldc(const_idx) | Instruction::LdcW(const_idx) => { match raw_class.checked_const(*const_idx)? { unvalidated::Constant::String(idx) => { let s = raw_class.checked_const(*idx)?.as_utf8()?; const_refs.insert(position as u32, Rc::new(Constant::String(s.to_string()))); } unvalidated::Constant::Integer(i) => { const_refs.insert(position as u32, Rc::new(Constant::Integer(*i))); } unvalidated::Constant::Float(f) => { const_refs.insert(position as u32, Rc::new(Constant::Float(*f))); } c => { return Err(ValidationError::BadConst(c.type_name().to_string(), "String, Integer, or Float".to_string())); } } } Instruction::Ldc2W(const_idx) => { match raw_class.checked_const(*const_idx)? { unvalidated::Constant::Long(l) => { const_refs.insert(position as u32, Rc::new(Constant::Long(*l))); } unvalidated::Constant::Double(d) => { const_refs.insert(position as u32, Rc::new(Constant::Double(*d))); } c => { return Err(ValidationError::BadConst(c.type_name().to_string(), "Long or Double".to_string())); } } } Instruction::PutStatic(field_idx) | Instruction::PutField(field_idx) | Instruction::GetStatic(field_idx) | Instruction::GetField(field_idx) => { if let Some(unvalidated::Constant::Fieldref(class_idx, name_and_type_idx)) = raw_class.get_const(*field_idx) { let referent_class_name = match raw_class.checked_const(*class_idx)? { unvalidated::Constant::Class(class_name_idx) => { raw_class.get_str(*class_name_idx).unwrap() } o => { return Err(ValidationError::BadConst(o.type_name().to_string(), "Class".to_string())); } }; // and now the name/type let (name, desc) = match raw_class.checked_const(*name_and_type_idx)? { unvalidated::Constant::NameAndType(name_idx, type_idx) => { ( raw_class.get_str(*name_idx).unwrap().to_string(), raw_class.get_str(*type_idx).unwrap().to_string(), ) } o => { return Err(ValidationError::BadConst(o.type_name().to_string(), "NameAndType".to_string())); } }; let field_ref = FieldRef { class_name: referent_class_name.to_string(), name, desc, }; // TODO: check position < u32::max field_refs.insert(position as u32, Rc::new(field_ref)); } } Instruction::InvokeVirtual(method_idx) | Instruction::InvokeSpecial(method_idx) | Instruction::InvokeStatic(method_idx) => { if let Some(unvalidated::Constant::Methodref(class_idx, name_and_type_idx)) = raw_class.get_const(*method_idx) { let referent_class_name = match raw_class.checked_const(*class_idx)? { unvalidated::Constant::Class(class_name_idx) => { raw_class.get_str(*class_name_idx).unwrap() } o => { return Err(ValidationError::BadConst(o.type_name().to_string(), "Class".to_string())); } }; // and now the name/type let (name, desc) = match raw_class.checked_const(*name_and_type_idx)? { unvalidated::Constant::NameAndType(name_idx, type_idx) => { ( raw_class.get_str(*name_idx).unwrap().to_string(), raw_class.get_str(*type_idx).unwrap().to_string(), ) } o => { return Err(ValidationError::BadConst(o.type_name().to_string(), "NameAndType".to_string())); } }; let method_ref = MethodRef { class_name: referent_class_name.to_string(), name, desc, }; // TODO: check position < u32::max method_refs.insert(position as u32, Rc::new(method_ref)); } } Instruction::InvokeInterface(_method_idx, _count) => { panic!("invokeinterface is not yet validated"); } Instruction::InvokeDynamic(_method_idx) => { panic!("invokedynamic is not yet validated"); } Instruction::NewArray(_tpe) => { panic!("newarray not yet validated"); } _ => { /* no validation necessary */ } } Ok(()) } impl MethodHandle { pub fn access(&self) -> &unvalidated::MethodAccessFlags { &self.access_flags } pub fn validate(raw_class: &UnvalidatedClassFile, raw_method: &unvalidated::MethodInfo) -> Result<MethodHandle, ValidationError> { let name = raw_class.checked_const(raw_method.name_index).and_then(|c| c.as_utf8())?.to_string(); let desc = raw_class.checked_const(raw_method.descriptor_index).and_then(|c| c.as_utf8())?.to_string(); let mut code_attrs = raw_method.attributes.iter().filter(|a| raw_class.get_str(a.name_index) == Some("Code")); let code_attr = code_attrs.next(); if code_attrs.next().is_some() { return Err(ValidationError::InvalidMethod("Multiple code attributes")); } let body = match code_attr { Some(attr) => { let data = &mut attr.data.as_slice(); let max_stack = u16::read_from(data).unwrap(); let max_locals = u16::read_from(data).unwrap(); let code_length = u32::read_from(data).unwrap(); let body_start = attr.data.len() - data.len(); for _ in 0..code_length { u8::read_from(data).unwrap(); } let exceptions_length = u16::read_from(data).unwrap(); let mut exceptions: Vec<ExceptionTableRecord> = Vec::new(); for _ in 0..exceptions_length { exceptions.push(ExceptionTableRecord::read_from(data).unwrap()); } let attr_length = u16::read_from(data).unwrap(); let mut attrs: Vec<AttributeInfo> = Vec::new(); for _ in 0..attr_length { attrs.push(AttributeInfo::read_from(data).unwrap()); } let method_body = &attr.data[(body_start as usize)..][..(code_length as usize)]; let mut body_cursor = Cursor::new(method_body); let mut class_refs = HashMap::new(); let mut field_refs = HashMap::new(); let mut method_refs = HashMap::new(); let mut const_refs = HashMap::new(); loop { let position = body_cursor.position() as u32; let inst = match unvalidated::Instruction::read_from(&mut body_cursor) { Ok(inst) => inst, _ => { break; } }; make_refs(&inst, max_locals, position, raw_class, &mut class_refs, &mut field_refs, &mut method_refs, &mut const_refs)?; } Some(Rc::new(MethodBody { max_stack, max_locals, bytes: method_body.to_vec().into_boxed_slice(), exception_info: exceptions, class_refs, field_refs, method_refs, const_refs, })) }, None => None }; Ok(MethodHandle { access_flags: raw_method.access_flags, name, desc, body }) } }
use std::ffi::CString; use std::os::raw::c_char; extern "C" { fn puts(s: *const c_char); } fn main() { let string = CString::new("Test").unwrap(); let ptr = string.into_raw(); unsafe { puts(ptr) }; // unsafe { CString::from_raw(ptr) }; } #[cfg(test)] mod tests { #[test] fn t1() {} #[test] fn t2() {} #[test] fn t3() {} #[test] fn t4() {} #[test] fn t5() {} }
//! Sender side of BIP78 //! //! This module contains types and methods used to implement sending via BIP78. //! Usage is prety simple: //! //! 1. Parse BIP21 as `bip78::Uri` //! 2. Create a finalized PSBT paying `.amount()` to `.address()` //! 3. Spawn a thread or async task that will broadcast the transaction after one minute unless //! canceled //! 4. Call `.create_request()` with the PSBT and your parameters //! 5. Send the request and receive response //! 6. Feed the response to `.process_response()` //! 7. Sign resulting PSBT //! 8. Cancel the one-minute deadline and broadcast the resulting PSBT //! use bitcoin::util::psbt::PartiallySignedTransaction as Psbt; use crate::input_type::InputType; use bitcoin::{TxOut, Script}; use error::{InternalValidationError, InternalCreateRequestError}; use crate::weight::{Weight, ComputeWeight}; use crate::psbt::PsbtExt; pub use error::{ValidationError, CreateRequestError}; // See usize casts #[cfg(not(any(target_pointer_width = "32", target_pointer_width = "64")))] compile_error!("This crate currently only supports 32 bit and 64 bit architectures"); mod error; type InternalResult<T> = Result<T, InternalValidationError>; /// Builder for sender-side payjoin parameters /// /// These parameters define how client wants to handle PayJoin. pub struct Params { disable_output_substitution: bool, fee_contribution: Option<(bitcoin::Amount, Option<usize>)>, clamp_fee_contribution: bool, } impl Params { /// Offer the receiver contribution to pay for his input. /// /// These parameters will allow the receiver to take `max_fee_contribution` from given change /// output to pay for additional inputs. The recommended fee is `size_of_one_input * fee_rate`. /// /// `change_index` specifies which output can be used to pay fee. I `None` is provided, then /// the output is auto-detected unless the supplied transaction has more than two outputs. pub fn with_fee_contribution(max_fee_contribution: bitcoin::Amount, change_index: Option<usize>) -> Self { Params { disable_output_substitution: false, fee_contribution: Some((max_fee_contribution, change_index)), clamp_fee_contribution: false, } } /// Perform PayJoin without incentivizing the payee to cooperate. /// /// While it's generally better to offer some contribution some users may wish not to. /// This function disables contribution. pub fn non_incentivizing() -> Self { Params { disable_output_substitution: false, fee_contribution: None, clamp_fee_contribution: false, } } /// Disable output substitution even if the receiver didn't. /// /// This forbids receiver switching output or decreasing amount. /// It is generally **not** recommended to set this as it may prevent the receiver from /// doing advanced operations such as opening LN channels and it also guarantees the /// receiver will **not** reward the sender with a discount. pub fn always_disable_output_substitution(mut self, disable: bool) -> Self { self.disable_output_substitution = disable; self } /// Decrease fee contribution instead of erroring. /// /// If this option is set and a transaction with change amount lower than fee /// contribution is provided then instead of returning error the fee contribution will /// be just lowered to match the change amount. pub fn clamp_fee_contribution(mut self, clamp: bool) -> Self { self.clamp_fee_contribution = clamp; self } } /// Represents data that needs to be transmitted to the receiver. /// /// You need to send this request over HTTP(S) to the receiver. #[non_exhaustive] pub struct Request { /// URL to send the request to. /// /// This is full URL with scheme etc - you can pass it right to `reqwest` or a similar library. pub url: String, /// Bytes to be sent to the receiver. /// /// This is properly encoded PSBT, already in base64. You only need to make sure `Content-Type` /// is `text/plain` and `Content-Length` is `body.len()` (most libraries do the latter /// automatically). pub body: Vec<u8>, } /// Data required for validation of response. /// /// This type is used to process the response. It is returned from `Uri::create_request()` method /// and you only need to call `process_response()` on it to continue BIP78 flow. pub struct Context { original_psbt: Psbt, disable_output_substitution: bool, fee_contribution: Option<(bitcoin::Amount, usize)>, input_type: InputType, sequence: u32, payee: Script, } macro_rules! check_eq { ($proposed:expr, $original:expr, $error:ident) => { match ($proposed, $original) { (proposed, original) if proposed != original => return Err(InternalValidationError::$error { proposed, original, }), _ => (), } } } macro_rules! ensure { ($cond:expr, $error:ident) => { if !($cond) { return Err(InternalValidationError::$error); } } } fn load_psbt_from_base64(mut input: impl std::io::Read) -> Result<Psbt, bitcoin::consensus::encode::Error> { use bitcoin::consensus::Decodable; let reader = base64::read::DecoderReader::new(&mut input, base64::STANDARD); Psbt::consensus_decode(reader) } fn calculate_psbt_fee(psbt: &Psbt) -> bitcoin::Amount { let mut total_outputs = bitcoin::Amount::ZERO; let mut total_inputs = bitcoin::Amount::ZERO; for output in &psbt.global.unsigned_tx.output { total_outputs += bitcoin::Amount::from_sat(output.value); } for input in psbt.input_pairs() { total_inputs += bitcoin::Amount::from_sat(input.previous_txout().unwrap().value); } total_inputs - total_outputs } impl Context { /// Decodes and validates the response. /// /// Call this method with response from receiver to continue BIP78 flow. If the response is /// valid you will get appropriate PSBT that you should sign and broadcast. #[inline] pub fn process_response(self, response: impl std::io::Read) -> Result<Psbt, ValidationError> { let proposal = load_psbt_from_base64(response) .map_err(InternalValidationError::Decode)?; // process in non-generic function self.process_proposal(proposal).map_err(Into::into) } fn process_proposal(self, proposal: Psbt) -> InternalResult<Psbt> { self.basic_checks(&proposal)?; let in_stats = self.check_inputs(&proposal)?; let out_stats = self.check_outputs(&proposal)?; self.check_fees(&proposal, in_stats, out_stats)?; Ok(proposal) } fn check_fees(&self, proposal: &Psbt, in_stats: InputStats, out_stats: OutputStats) -> InternalResult<()> { if out_stats.total_value > in_stats.total_value { return Err(InternalValidationError::Inflation); } let proposed_psbt_fee = in_stats.total_value - out_stats.total_value; let original_fee = calculate_psbt_fee(&self.original_psbt); ensure!(original_fee <= proposed_psbt_fee, AbsoluteFeeDecreased); ensure!(out_stats.contributed_fee <= proposed_psbt_fee - original_fee, PayeeTookContributedFee); let original_weight = self.original_psbt.global.unsigned_tx.weight(); let original_fee_rate = original_fee / original_weight; ensure!(out_stats.contributed_fee <= original_fee_rate * self.input_type.expected_input_weight() * (proposal.inputs.len() - self.original_psbt.inputs.len()) as u64, FeeContributionPaysOutputSizeIncrease); Ok(()) } // version and lock time fn basic_checks(&self, proposal: &Psbt) -> InternalResult<()> { check_eq!(proposal.global.unsigned_tx.version, self.original_psbt.global.unsigned_tx.version, VersionsDontMatch); check_eq!(proposal.global.unsigned_tx.lock_time, self.original_psbt.global.unsigned_tx.lock_time, LockTimesDontMatch); Ok(()) } fn check_inputs(&self, proposal: &Psbt) -> InternalResult<InputStats> { let mut original_inputs = self.original_psbt.input_pairs().peekable(); let mut total_value = bitcoin::Amount::ZERO; let mut total_weight = Weight::ZERO; for proposed in proposal.input_pairs() { ensure!(proposed.psbtin.bip32_derivation.is_empty(), TxInContainsKeyPaths); ensure!(proposed.psbtin.partial_sigs.is_empty(), ContainsPartialSigs); match original_inputs.peek() { // our (sender) Some(original) if proposed.txin.previous_output == original.txin.previous_output => { check_eq!(proposed.txin.sequence, original.txin.sequence, SenderTxinSequenceChanged); ensure!(proposed.psbtin.non_witness_utxo.is_none(), SenderTxinContainsNonWitnessUtxo); ensure!(proposed.psbtin.witness_utxo.is_none(), SenderTxinContainsWitnessUtxo); ensure!(proposed.psbtin.final_script_sig.is_none(), SenderTxinContainsFinalScriptSig); ensure!(proposed.psbtin.final_script_witness.is_none(), SenderTxinContainsFinalScriptWitness); let prevout = original.previous_txout().expect("We've validated this before"); total_value += bitcoin::Amount::from_sat(prevout.value); // We assume the signture will be the same size // I know sigs can be slightly different size but there isn't much to do about // it other than prefer Taproot. total_weight += original.txin.weight(); original_inputs.next(); }, // theirs (receiver) None | Some(_) => { /* this seems to be wrong but not sure why/how match (&proposed.psbtin.final_script_sig, &proposed.psbtin.final_script_witness) { // TODO: use to compute weight correctly (Some(sig), Some(witness)) => (), _ => return Err(InternalValidationError::ReceiverTxinNotFinalized) } */ ensure!(proposed.psbtin.witness_utxo.is_some() || proposed.psbtin.non_witness_utxo.is_some(), ReceiverTxinMissingUtxoInfo); ensure!(proposed.txin.sequence == self.sequence, MixedSequence); let txout = proposed.previous_txout() .map_err(InternalValidationError::InvalidProposedInput)?; total_value += bitcoin::Amount::from_sat(txout.value); // TODO: THIS IS INCORRECT, but we don't use it yet total_weight += proposed.txin.weight(); check_eq!(InputType::from_spent_input(txout, proposed.psbtin)?, self.input_type, MixedInputTypes); }, } } ensure!(original_inputs.peek().is_none(), MissingOrShuffledInputs); Ok(InputStats { total_value, total_weight, }) } fn check_outputs(&self, proposal: &Psbt) -> InternalResult<OutputStats> { let mut original_outputs = proposal.global.unsigned_tx.output.iter().enumerate().peekable(); let mut total_value = bitcoin::Amount::ZERO; let mut contributed_fee = bitcoin::Amount::ZERO; let mut total_weight = Weight::ZERO; for (proposed_txout, proposed_psbtout) in proposal.global.unsigned_tx.output.iter().zip(&proposal.outputs) { ensure!(proposed_psbtout.bip32_derivation.is_empty(), TxOutContainsKeyPaths); total_value += bitcoin::Amount::from_sat(proposed_txout.value); total_weight += proposed_txout.weight(); match (original_outputs.peek(), self.fee_contribution) { // fee output (Some((original_output_index, original_output)), Some((max_fee_contrib, fee_contrib_idx))) if proposed_txout.script_pubkey == original_output.script_pubkey && *original_output_index == fee_contrib_idx => { if proposed_txout.value < original_output.value { contributed_fee = bitcoin::Amount::from_sat(original_output.value - proposed_txout.value); ensure!(contributed_fee < max_fee_contrib, FeeContributionExceedsMaximum); //The remaining fee checks are done in the caller } original_outputs.next(); }, // payee output (Some((_original_output_index, original_output)), _) if original_output.script_pubkey == self.payee => { ensure!(!self.disable_output_substitution || (proposed_txout.script_pubkey == original_output.script_pubkey && proposed_txout.value >= original_output.value), DisallowedOutputSubstitution); original_outputs.next(); } // our output (Some((_original_output_index, original_output)), _) if proposed_txout.script_pubkey == original_output.script_pubkey => { ensure!(proposed_txout.value >= original_output.value, OutputValueDecreased); original_outputs.next(); }, // all original outputs processed, only additional outputs remain _ => (), } } ensure!(original_outputs.peek().is_none(), MissingOrShuffledOutputs); Ok(OutputStats { total_value, contributed_fee, total_weight, }) } } struct OutputStats { total_value: bitcoin::Amount, contributed_fee: bitcoin::Amount, total_weight: Weight, } struct InputStats { total_value: bitcoin::Amount, total_weight: Weight, } fn check_single_payee(psbt: &Psbt, script_pubkey: &Script, amount: bitcoin::Amount) -> Result<(), InternalCreateRequestError> { let mut payee_found = false; for output in &psbt.global.unsigned_tx.output { if output.script_pubkey == *script_pubkey { if output.value != amount.as_sat() { return Err(InternalCreateRequestError::PayeeValueNotEqual) } if payee_found { return Err(InternalCreateRequestError::MultiplePayeeOutputs) } payee_found = true; } } if payee_found { Ok(()) } else { Err(InternalCreateRequestError::MissingPayeeOutput) } } fn clear_unneeded_fields(psbt: &mut Psbt) { psbt.global.xpub.clear(); psbt.global.proprietary.clear(); psbt.global.unknown.clear(); for input in &mut psbt.inputs { input.bip32_derivation.clear(); input.proprietary.clear(); input.unknown.clear(); } for output in &mut psbt.outputs { output.bip32_derivation.clear(); output.proprietary.clear(); output.unknown.clear(); } } fn check_fee_output_amount(output: &TxOut, amount: bitcoin::Amount, clamp_fee_contribution: bool) -> Result<bitcoin::Amount, InternalCreateRequestError> { if output.value < amount.as_sat() { if clamp_fee_contribution { Ok(bitcoin::Amount::from_sat(output.value)) } else { Err(InternalCreateRequestError::FeeOutputValueLowerThanFeeContribution) } } else { Ok(amount) } } fn find_change_index(psbt: &Psbt, payee: &Script, amount: bitcoin::Amount, clamp_fee_contribution: bool) -> Result<Option<(bitcoin::Amount, usize)>, InternalCreateRequestError> { match (psbt.global.unsigned_tx.output.len(), clamp_fee_contribution) { (0, _) => return Err(InternalCreateRequestError::NoOutputs), (1, false) if psbt.global.unsigned_tx.output[0].script_pubkey == *payee => return Err(InternalCreateRequestError::FeeOutputValueLowerThanFeeContribution), (1, true) if psbt.global.unsigned_tx.output[0].script_pubkey == *payee => return Ok(None), (1, _) => return Err(InternalCreateRequestError::MissingPayeeOutput), (2, _) => (), _ => return Err(InternalCreateRequestError::AmbiguousChangeOutput), } let (index, output) = psbt.global.unsigned_tx.output .iter() .enumerate() .find(|(_, output)| output.script_pubkey != *payee) .ok_or(InternalCreateRequestError::MultiplePayeeOutputs)?; Ok(Some((check_fee_output_amount(output, amount, clamp_fee_contribution)?, index))) } fn check_change_index(psbt: &Psbt, payee: &Script, amount: bitcoin::Amount, index: usize, clamp_fee_contribution: bool) -> Result<(bitcoin::Amount, usize), InternalCreateRequestError> { let output = psbt.global.unsigned_tx.output .get(index) .ok_or(InternalCreateRequestError::ChangeIndexOutOfBounds)?; if output.script_pubkey == *payee { return Err(InternalCreateRequestError::ChangeIndexPointsAtPayee); } Ok((check_fee_output_amount(output, amount, clamp_fee_contribution)?, index)) } fn determine_fee_contribution(psbt: &Psbt, payee: &Script, params: &Params) -> Result<Option<(bitcoin::Amount, usize)>, InternalCreateRequestError> { Ok(match params.fee_contribution { Some((amount, None)) => find_change_index(psbt, payee, amount, params.clamp_fee_contribution)?, Some((amount, Some(index))) => Some(check_change_index(psbt, payee, amount, index, params.clamp_fee_contribution)?), None => None, }) } fn serialize_url(endpoint: String, disable_output_substitution: bool, fee_contribution: Option<(bitcoin::Amount, usize)>) -> String { use std::fmt::Write; let mut url = endpoint; url.push_str("?v=1"); if disable_output_substitution { url.push_str("&disableoutputsubstitution=1"); } if let Some((amount, index)) = fee_contribution { write!(url, "&additionalfeeoutputindex={}&maxadditionalfeecontribution={}", index, amount.as_sat()).expect("writing to string doesn't fail"); } // TODO: min feerate url } fn serialize_psbt(psbt: &Psbt) -> Vec<u8> { use bitcoin::consensus::Encodable; let mut encoder = base64::write::EncoderWriter::new(Vec::new(), base64::STANDARD); psbt.consensus_encode(&mut encoder) .expect("Vec doesn't return errors in its write implementation"); encoder.finish() .expect("Vec doesn't return errors in its write implementation") } pub(crate) fn from_psbt_and_uri(mut psbt: Psbt, uri: crate::Uri, params: Params) -> Result<(Request, Context), CreateRequestError> { psbt .validate_input_utxos(true) .map_err(InternalCreateRequestError::InvalidOriginalInput)?; let disable_output_substitution = uri.disable_output_substitution || params.disable_output_substitution; let payee = uri.address.script_pubkey(); check_single_payee(&psbt, &payee, uri.amount)?; let fee_contribution = determine_fee_contribution(&psbt, &payee, &params)?; clear_unneeded_fields(&mut psbt); let zeroth_input = psbt.input_pairs().next().ok_or(InternalCreateRequestError::NoInputs)?; let sequence = zeroth_input.txin.sequence; let txout = zeroth_input.previous_txout().expect("We already checked this above"); let input_type = InputType::from_spent_input(txout, &zeroth_input.psbtin).unwrap(); let url = serialize_url(uri.endpoint.into(), disable_output_substitution, fee_contribution); let body = serialize_psbt(&psbt); Ok((Request { url, body, }, Context { original_psbt: psbt, disable_output_substitution, fee_contribution, payee, input_type, sequence, })) } #[cfg(test)] mod tests { #[test] fn official_vectors() { use crate::input_type::{InputType, SegWitV0Type}; let mut original_psbt = "cHNidP8BAHMCAAAAAY8nutGgJdyYGXWiBEb45Hoe9lWGbkxh/6bNiOJdCDuDAAAAAAD+////AtyVuAUAAAAAF6kUHehJ8GnSdBUOOv6ujXLrWmsJRDCHgIQeAAAAAAAXqRR3QJbbz0hnQ8IvQ0fptGn+votneofTAAAAAAEBIKgb1wUAAAAAF6kU3k4ekGHKWRNbA1rV5tR5kEVDVNCHAQcXFgAUx4pFclNVgo1WWAdN1SYNX8tphTABCGsCRzBEAiB8Q+A6dep+Rz92vhy26lT0AjZn4PRLi8Bf9qoB/CMk0wIgP/Rj2PWZ3gEjUkTlhDRNAQ0gXwTO7t9n+V14pZ6oljUBIQMVmsAaoNWHVMS02LfTSe0e388LNitPa1UQZyOihY+FFgABABYAFEb2Giu6c4KO5YW0pfw3lGp9jMUUAAA=".as_bytes(); let mut proposal = "cHNidP8BAJwCAAAAAo8nutGgJdyYGXWiBEb45Hoe9lWGbkxh/6bNiOJdCDuDAAAAAAD+////jye60aAl3JgZdaIERvjkeh72VYZuTGH/ps2I4l0IO4MBAAAAAP7///8CJpW4BQAAAAAXqRQd6EnwadJ0FQ46/q6NcutaawlEMIcACT0AAAAAABepFHdAltvPSGdDwi9DR+m0af6+i2d6h9MAAAAAAQEgqBvXBQAAAAAXqRTeTh6QYcpZE1sDWtXm1HmQRUNU0IcBBBYAFMeKRXJTVYKNVlgHTdUmDV/LaYUwIgYDFZrAGqDVh1TEtNi300ntHt/PCzYrT2tVEGcjooWPhRYYSFzWUDEAAIABAACAAAAAgAEAAAAAAAAAAAEBIICEHgAAAAAAF6kUyPLL+cphRyyI5GTUazV0hF2R2NWHAQcXFgAUX4BmVeWSTJIEwtUb5TlPS/ntohABCGsCRzBEAiBnu3tA3yWlT0WBClsXXS9j69Bt+waCs9JcjWtNjtv7VgIge2VYAaBeLPDB6HGFlpqOENXMldsJezF9Gs5amvDQRDQBIQJl1jz1tBt8hNx2owTm+4Du4isx0pmdKNMNIjjaMHFfrQABABYAFEb2Giu6c4KO5YW0pfw3lGp9jMUUIgICygvBWB5prpfx61y1HDAwo37kYP3YRJBvAjtunBAur3wYSFzWUDEAAIABAACAAAAAgAEAAAABAAAAAAA=".as_bytes(); let original_psbt = super::load_psbt_from_base64(&mut original_psbt).unwrap(); eprintln!("original: {:#?}", original_psbt); let payee = original_psbt.global.unsigned_tx.output[1].script_pubkey.clone(); let sequence = original_psbt.global.unsigned_tx.input[0].sequence; let ctx = super::Context { original_psbt, disable_output_substitution: false, fee_contribution: None, payee, input_type: InputType::SegWitV0 { ty: SegWitV0Type::Pubkey, nested: true, }, sequence, }; let mut proposal = super::load_psbt_from_base64(&mut proposal).unwrap(); eprintln!("proposal: {:#?}", proposal); for output in &mut proposal.outputs { output.bip32_derivation.clear(); } for input in &mut proposal.inputs { input.bip32_derivation.clear(); } proposal.inputs[0].witness_utxo = None; ctx.process_proposal(proposal).unwrap(); } }
pub mod graphics; pub mod math; pub mod utils; use graphics::{Hittable, Ray}; use math::Color; use indicatif::ProgressBar; use rand::Rng; use rayon::prelude::*; use utils::Config; fn ray_color<T: Hittable + Sync + Send>(ray: Ray, world: &T, depth: u32) -> Color { if depth == 0 { return Color::ZERO; } if let Some(hit) = world.hit(&ray, 0.001, f64::INFINITY) { match hit.material.scatter(&ray, &hit) { None => return Color::ZERO, Some((scattered_ray, attenuation)) => { return attenuation * ray_color(scattered_ray, world, depth - 1) } } } let unit_direction = ray.direction; let t = 0.5 * (unit_direction.y + 1.0); (1.0 - t) * Color::ONE + t * Color::new(0.5, 0.7, 1.0) } pub fn render_image(config: Config) { let image_width = config.image_size.0; let image_height = config.image_size.1; let progress_bar = ProgressBar::new(image_height.into()); print!("P3\n{} {}\n255\n", image_width, image_height); let pixel_list = (0..(image_height * image_width)) .into_par_iter() .map(|i| (i % image_width, image_height - i / image_width)) .map(|(i, j)| { if i == 0 { progress_bar.inc(1); } // Random number generator let mut rng = rand::thread_rng(); let mut pixel_color = Color::ZERO; for _ in 0..config.samples_per_pixel { let u = ((i as f64) + rng.gen::<f64>()) / (image_width - 1) as f64; let v = ((j as f64) + rng.gen::<f64>()) / (image_height - 1) as f64; let ray = config.camera.get_ray(u, v); pixel_color = pixel_color + ray_color(ray, &config.world, config.max_depth); } (pixel_color, i, j) }) .collect::<Vec<(Color, u32, u32)>>(); for pixel in pixel_list { pixel.0.write_color(config.samples_per_pixel); } progress_bar.inc(1); }
#![cfg_attr(target_arch = "wasm32", allow(dead_code))] use rustpython_vm::{ builtins::{PyDictRef, PyStrRef}, function::ArgIterable, identifier, AsObject, PyResult, TryFromObject, VirtualMachine, }; pub struct ShellHelper<'vm> { vm: &'vm VirtualMachine, globals: PyDictRef, } fn reverse_string(s: &mut String) { let rev = s.chars().rev().collect(); *s = rev; } fn split_idents_on_dot(line: &str) -> Option<(usize, Vec<String>)> { let mut words = vec![String::new()]; let mut startpos = 0; for (i, c) in line.chars().rev().enumerate() { match c { '.' => { // check for a double dot if i != 0 && words.last().map_or(false, |s| s.is_empty()) { return None; } reverse_string(words.last_mut().unwrap()); if words.len() == 1 { startpos = line.len() - i; } words.push(String::new()); } c if c.is_alphanumeric() || c == '_' => words.last_mut().unwrap().push(c), _ => { if words.len() == 1 { if words.last().unwrap().is_empty() { return None; } startpos = line.len() - i; } break; } } } if words == [String::new()] { return None; } reverse_string(words.last_mut().unwrap()); words.reverse(); Some((startpos, words)) } impl<'vm> ShellHelper<'vm> { pub fn new(vm: &'vm VirtualMachine, globals: PyDictRef) -> Self { ShellHelper { vm, globals } } fn get_available_completions<'w>( &self, words: &'w [String], ) -> Option<(&'w str, impl Iterator<Item = PyResult<PyStrRef>> + 'vm)> { // the very first word and then all the ones after the dot let (first, rest) = words.split_first().unwrap(); let str_iter_method = |obj, name| { let iter = self.vm.call_special_method(obj, name, ())?; ArgIterable::<PyStrRef>::try_from_object(self.vm, iter)?.iter(self.vm) }; let (word_start, iter1, iter2) = if let Some((last, parents)) = rest.split_last() { // we need to get an attribute based off of the dir() of an object // last: the last word, could be empty if it ends with a dot // parents: the words before the dot let mut current = self.globals.get_item_opt(first.as_str(), self.vm).ok()??; for attr in parents { let attr = self.vm.ctx.new_str(attr.as_str()); current = current.get_attr(&attr, self.vm).ok()?; } let current_iter = str_iter_method(&current, identifier!(self.vm, __dir__)).ok()?; (last, current_iter, None) } else { // we need to get a variable based off of globals/builtins let globals = str_iter_method(self.globals.as_object(), identifier!(self.vm, keys)).ok()?; let builtins = str_iter_method(self.vm.builtins.as_object(), identifier!(self.vm, __dir__)) .ok()?; (first, globals, Some(builtins)) }; Some((word_start, iter1.chain(iter2.into_iter().flatten()))) } fn complete_opt(&self, line: &str) -> Option<(usize, Vec<String>)> { let (startpos, words) = split_idents_on_dot(line)?; let (word_start, iter) = self.get_available_completions(&words)?; let all_completions = iter .filter(|res| { res.as_ref() .ok() .map_or(true, |s| s.as_str().starts_with(word_start)) }) .collect::<Result<Vec<_>, _>>() .ok()?; let mut completions = if word_start.starts_with('_') { // if they're already looking for something starting with a '_', just give // them all the completions all_completions } else { // only the completions that don't start with a '_' let no_underscore = all_completions .iter() .cloned() .filter(|s| !s.as_str().starts_with('_')) .collect::<Vec<_>>(); // if there are only completions that start with a '_', give them all of the // completions, otherwise only the ones that don't start with '_' if no_underscore.is_empty() { all_completions } else { no_underscore } }; // sort the completions alphabetically completions.sort_by(|a, b| std::cmp::Ord::cmp(a.as_str(), b.as_str())); Some(( startpos, completions .into_iter() .map(|s| s.as_str().to_owned()) .collect(), )) } } cfg_if::cfg_if! { if #[cfg(not(target_arch = "wasm32"))] { use rustyline::{ completion::Completer, highlight::Highlighter, hint::Hinter, validate::Validator, Context, Helper, }; impl Completer for ShellHelper<'_> { type Candidate = String; fn complete( &self, line: &str, pos: usize, _ctx: &Context, ) -> rustyline::Result<(usize, Vec<String>)> { Ok(self .complete_opt(&line[0..pos]) // as far as I can tell, there's no better way to do both completion // and indentation (or even just indentation) .unwrap_or_else(|| (pos, vec!["\t".to_owned()]))) } } impl Hinter for ShellHelper<'_> { type Hint = String; } impl Highlighter for ShellHelper<'_> {} impl Validator for ShellHelper<'_> {} impl Helper for ShellHelper<'_> {} } }
pub mod abi; mod android_base; mod apple_base; mod apple_sdk_base; pub mod crt_objects; mod dragonfly_base; mod freebsd_base; mod linux_base; mod linux_gnu_base; mod linux_musl_base; mod netbsd_base; mod openbsd_base; mod wasm_base; use std::borrow::Cow; use std::collections::BTreeMap; use std::fmt; use std::str::FromStr; use thiserror::Error; #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum EncodingType { /// Use the default encoding based on target pointer width Default, /// Use a 32-bit encoding Encoding32, /// Use a 64-bit encoding Encoding64, /// An alternative 64-bit encoding, based on NaN-boxing Encoding64Nanboxed, } impl EncodingType { #[inline(always)] pub fn is_nanboxed(self) -> bool { self == Self::Encoding64Nanboxed } } use self::abi::Abi; use self::crt_objects::{CrtObjects, CrtObjectsFallback}; #[derive(Error, Debug)] #[error("invalid linker flavor: '{0}'")] pub struct InvalidLinkerFlavorError(String); #[derive(Error, Debug)] pub enum TargetError { #[error("unsupported target: '{0}'")] Unsupported(String), #[error("invalid target: {0}")] Other(String), } #[repr(C)] #[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)] pub enum LinkerFlavor { Em, Gcc, L4Bender, Ld, Msvc, Lld(LldFlavor), PtxLinker, BpfLinker, } impl fmt::Display for LinkerFlavor { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Self::Em => f.write_str("emcc"), Self::Gcc => f.write_str("cc"), Self::L4Bender => f.write_str("l4-bender"), Self::Ld => f.write_str("ld"), Self::Msvc => f.write_str("link.exe"), Self::Lld(_) => f.write_str("lld"), Self::PtxLinker => f.write_str("ptx-linker"), Self::BpfLinker => f.write_str("bpf-linker"), } } } pub type LinkArgs = BTreeMap<LinkerFlavor, Vec<String>>; #[repr(C)] #[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)] pub enum LldFlavor { Wasm, Ld64, Ld, Link, } impl fmt::Display for LldFlavor { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Self::Wasm => f.write_str("wasm-ld"), Self::Ld64 => f.write_str("ld64.lld"), Self::Ld => f.write_str("ld.lld"), Self::Link => f.write_str("link"), } } } impl FromStr for LldFlavor { type Err = InvalidLinkerFlavorError; fn from_str(s: &str) -> Result<Self, Self::Err> { match s { "darwin" | "ld64.lld" => Ok(LldFlavor::Ld64), "gnu" | "ld" | "ld.lld" => Ok(LldFlavor::Ld), "link" | "link.exe" => Ok(LldFlavor::Link), "wasm" | "wasm-ld" => Ok(LldFlavor::Wasm), _ => Err(InvalidLinkerFlavorError(s.to_string())), } } } macro_rules! flavor_mappings { ($((($($flavor:tt)*), $string:expr),)*) => ( impl LinkerFlavor { pub const fn one_of() -> &'static str { concat!("one of: ", $($string, " ",)*) } pub fn desc(&self) -> &str { match *self { $($($flavor)* => $string,)* } } } impl FromStr for LinkerFlavor { type Err = InvalidLinkerFlavorError; fn from_str(s: &str) -> Result<Self, Self::Err> { match s { $($string => Ok($($flavor)*),)* _ => Err(InvalidLinkerFlavorError(s.to_string())) } } } ) } flavor_mappings! { ((LinkerFlavor::Em), "em"), ((LinkerFlavor::Gcc), "gcc"), ((LinkerFlavor::L4Bender), "l4-bender"), ((LinkerFlavor::Ld), "ld"), ((LinkerFlavor::Msvc), "msvc"), ((LinkerFlavor::PtxLinker), "ptx-linker"), ((LinkerFlavor::BpfLinker), "bpf-linker"), ((LinkerFlavor::Lld(LldFlavor::Wasm)), "wasm-ld"), ((LinkerFlavor::Lld(LldFlavor::Ld64)), "ld64.lld"), ((LinkerFlavor::Lld(LldFlavor::Ld)), "ld.lld"), ((LinkerFlavor::Lld(LldFlavor::Link)), "lld-link"), } #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] #[repr(C)] pub enum RelocModel { Static, Pic, Pie, DynamicNoPic, /// Read-Only Position Independence /// /// Code and read-only data is accessed PC-relative /// The offsets between all code and RO data sections are known at static link time Ropi, /// Read-Write Position Indepdendence /// /// Read-write data is accessed relative to the static base register. /// The offsets between all writeable data sections are known at static /// link time. This does not affect read-only data. Rwpi, /// A combination of both of the above RopiRwpi, } impl FromStr for RelocModel { type Err = (); fn from_str(s: &str) -> Result<Self, Self::Err> { match s { "static" => Ok(Self::Static), "pic" => Ok(Self::Pic), "pie" => Ok(Self::Pie), "dynamic-no-pic" => Ok(Self::DynamicNoPic), "ropi" => Ok(Self::Ropi), "rwpi" => Ok(Self::Rwpi), "ropi-rwpi" => Ok(Self::RopiRwpi), _ => Err(()), } } } #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] #[repr(C)] pub enum CodeModel { #[allow(dead_code)] Other, Small, Kernel, Medium, Large, None, } impl FromStr for CodeModel { type Err = (); fn from_str(s: &str) -> Result<Self, Self::Err> { match s { "small" => Ok(Self::Small), "kernel" => Ok(Self::Kernel), "medium" => Ok(Self::Medium), "large" => Ok(Self::Large), _ => Err(()), } } } #[derive(Copy, Clone, Debug, PartialEq, Hash)] pub enum TlsModel { NotThreadLocal, GeneralDynamic, LocalDynamic, InitialExec, LocalExec, } impl FromStr for TlsModel { type Err = (); fn from_str(s: &str) -> Result<Self, Self::Err> { match s { "global-dynamic" => Ok(Self::GeneralDynamic), "local-dynamic" => Ok(Self::LocalDynamic), "initial-exec" => Ok(Self::InitialExec), "local-exec" => Ok(Self::LocalExec), _ => Err(()), } } } #[derive(Clone, Copy, Debug, PartialEq, Hash)] pub enum PanicStrategy { Unwind, Abort, } impl fmt::Display for PanicStrategy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { Self::Unwind => f.write_str("unwind"), Self::Abort => f.write_str("abort"), } } } impl FromStr for PanicStrategy { type Err = (); fn from_str(s: &str) -> Result<Self, Self::Err> { match s { "unwind" => Ok(Self::Unwind), "abort" => Ok(Self::Abort), _ => Err(()), } } } #[derive(Clone, Copy, Debug, PartialEq, Hash)] pub enum RelroLevel { Full, Partial, Off, None, } impl RelroLevel { pub fn desc(&self) -> &str { match *self { RelroLevel::Full => "full", RelroLevel::Partial => "partial", RelroLevel::Off => "off", RelroLevel::None => "none", } } } impl FromStr for RelroLevel { type Err = (); fn from_str(s: &str) -> Result<RelroLevel, ()> { match s { "full" => Ok(RelroLevel::Full), "partial" => Ok(RelroLevel::Partial), "off" => Ok(RelroLevel::Off), "none" => Ok(RelroLevel::None), _ => Err(()), } } } #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)] pub enum LinkOutputKind { /// Dynamically linked non position-independent executable. DynamicNoPicExe, /// Dynamically linked position-independent executable. DynamicPicExe, /// Statically linked non position-independent executable. StaticNoPicExe, /// Statically linked position-independent executable. StaticPicExe, /// Regular dynamic library ("dynamically linked"). DynamicDylib, /// Dynamic library with bundled libc ("statically linked"). StaticDylib, /// WASI module with a lifetime past the _initialize entry point WasiReactorExe, } impl LinkOutputKind { fn as_str(&self) -> &'static str { match self { LinkOutputKind::DynamicNoPicExe => "dynamic-nopic-exe", LinkOutputKind::DynamicPicExe => "dynamic-pic-exe", LinkOutputKind::StaticNoPicExe => "static-nopic-exe", LinkOutputKind::StaticPicExe => "static-pic-exe", LinkOutputKind::DynamicDylib => "dynamic-dylib", LinkOutputKind::StaticDylib => "static-dylib", LinkOutputKind::WasiReactorExe => "wasi-reactor-exe", } } pub fn from_str(s: &str) -> Option<LinkOutputKind> { Some(match s { "dynamic-nopic-exe" => LinkOutputKind::DynamicNoPicExe, "dynamic-pic-exe" => LinkOutputKind::DynamicPicExe, "static-nopic-exe" => LinkOutputKind::StaticNoPicExe, "static-pic-exe" => LinkOutputKind::StaticPicExe, "dynamic-dylib" => LinkOutputKind::DynamicDylib, "static-dylib" => LinkOutputKind::StaticDylib, "wasi-reactor-exe" => LinkOutputKind::WasiReactorExe, _ => return None, }) } } impl fmt::Display for LinkOutputKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.as_str()) } } #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum SplitDebugInfo { /// Split debug-information is disabled, meaning that on supported platforms /// you can find all debug information in the executable itself. This is /// only supported for ELF effectively. /// /// * Windows - not supported /// * macOS - don't run `dsymutil` /// * ELF - `.dwarf_*` sections Off, /// Split debug-information can be found in a "packed" location separate /// from the final artifact. This is supported on all platforms. /// /// * Windows - `*.pdb` /// * macOS - `*.dSYM` (run `dsymutil`) /// * ELF - `*.dwp` (run `rust-llvm-dwp`) Packed, /// Split debug-information can be found in individual object files on the /// filesystem. The main executable may point to the object files. /// /// * Windows - not supported /// * macOS - supported, scattered object files /// * ELF - supported, scattered `*.dwo` or `*.o` files (see `SplitDwarfKind`) Unpacked, } impl fmt::Display for SplitDebugInfo { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Self::Off => f.write_str("off"), Self::Packed => f.write_str("packed"), Self::Unpacked => f.write_str("unpacked"), } } } impl FromStr for SplitDebugInfo { type Err = (); fn from_str(s: &str) -> Result<Self, ()> { match s { "off" => Ok(Self::Off), "packed" => Ok(Self::Packed), "unpacked" => Ok(Self::Unpacked), _ => Err(()), } } } #[derive(Clone, Copy, PartialEq, Hash, Debug)] pub enum FramePointer { /// Forces the machine code generator to always preserve the frame pointers. Always, /// Forces the machine code generator to preserve the frame pointers except for the leaf /// functions (i.e. those that don't call other functions). NonLeaf, /// Allows the machine code generator to omit the frame pointers. /// /// This option does not guarantee that the frame pointers will be omitted. MayOmit, } impl fmt::Display for FramePointer { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Self::Always => f.write_str("always"), Self::NonLeaf => f.write_str("non-leaf"), Self::MayOmit => f.write_str("may-omit"), } } } impl FromStr for FramePointer { type Err = (); fn from_str(s: &str) -> Result<Self, ()> { Ok(match s { "always" => Self::Always, "non-leaf" => Self::NonLeaf, "may-omit" => Self::MayOmit, _ => return Err(()), }) } } #[derive(Clone, Copy, Debug, PartialEq, Hash)] pub enum MergeFunctions { Disabled, Trampolines, Aliases, } impl MergeFunctions { pub fn desc(&self) -> &str { match *self { MergeFunctions::Disabled => "disabled", MergeFunctions::Trampolines => "trampolines", MergeFunctions::Aliases => "aliases", } } } impl FromStr for MergeFunctions { type Err = (); fn from_str(s: &str) -> Result<MergeFunctions, ()> { match s { "disabled" => Ok(MergeFunctions::Disabled), "trampolines" => Ok(MergeFunctions::Trampolines), "aliases" => Ok(MergeFunctions::Aliases), _ => Err(()), } } } macro_rules! supported_targets { ( $(($( $triple:literal, )+ $module:ident ),)+ ) => { $(mod $module;)+ /// List of supported targets const TARGETS: &[&str] = &[$($($triple),+),+]; fn search<S: AsRef<str>>(target: S) -> Result<Target, TargetError> { let target = target.as_ref(); match target { $( $($triple)|+ => Ok($module::target()), )+ _ => Err(TargetError::Unsupported(target.to_string())), } } pub fn get_targets() -> impl Iterator<Item = String> { TARGETS.iter().filter_map(|t| -> Option<String> { search(t) .and(Ok(t.to_string())) .ok() }) } }; } supported_targets! { ("aarch64-apple-darwin", aarch64_apple_darwin), ("aarch64-apple-ios", aarch64_apple_ios), ("aarch64-apple-tvos", aarch64_apple_tvos), ("aarch64-linux-android", aarch64_linux_android), ("aarch64-unknown-freebsd", aarch64_unknown_freebsd), ("aarch64-unknown-linux-gnu", aarch64_unknown_linux_gnu), ("aarch64-unknown-linux-musl", aarch64_unknown_linux_musl), ("aarch64-unknown-netbsd", aarch64_unknown_netbsd), ("aarch64-unknown-openbsd", aarch64_unknown_openbsd), ("i686-apple-darwin", i686_apple_darwin), ("i686-linux-android", i686_linux_android), ("i686-unknown-freebsd", i686_unknown_freebsd), ("i686-unknown-linux-gnu", i686_unknown_linux_gnu), ("i686-unknown-linux-musl", i686_unknown_linux_musl), ("i686-unknown-netbsd", i686_unknown_netbsd), ("i686-unknown-openbsd", i686_unknown_openbsd), ("wasm32-unknown-emscripten", wasm32_unknown_emscripten), ("wasm32-unknown-unknown", wasm32_unknown_unknown), ("wasm32-wasi", wasm32_wasi), ("x86_64-apple-darwin", x86_64_apple_darwin), ("x86_64-apple-ios", x86_64_apple_ios), ("x86_64-apple-tvos", x86_64_apple_tvos), ("x86_64-linux-android", x86_64_linux_android), ("x86_64-unknown-dragonfly", x86_64_unknown_dragonfly), ("x86_64-unknown-freebsd", x86_64_unknown_freebsd), ("x86_64-unknown-linux-gnu", x86_64_unknown_linux_gnu), ("x86_64-unknown-linux-musl", x86_64_unknown_linux_musl), ("x86_64-unknown-netbsd", x86_64_unknown_netbsd), ("x86_64-unknown-openbsd", x86_64_unknown_openbsd), } #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum Endianness { Big, Little, Native, } impl Default for Endianness { fn default() -> Self { Self::Native } } impl ToString for Endianness { fn to_string(&self) -> String { match *self { Self::Big => "big".to_string(), Self::Little => "little".to_string(), Self::Native => "native".to_string(), } } } /// Everything Firefly knows about how to compile for a specific target. /// /// Every field here must be specified, and has no default value. #[derive(PartialEq, Clone, Debug)] pub struct Target { /// Target triple to pass to LLVM. pub llvm_target: Cow<'static, str>, /// The bit width of target pointers pub pointer_width: usize, /// Architecture to use for ABI considerations. Valid options include: "x86", /// "x86_64", "arm", "aarch64", "mips", "powerpc", "powerpc64", and others. pub arch: Cow<'static, str>, /// [Data layout](http://llvm.org/docs/LangRef.html#data-layout) to pass to LLVM. pub data_layout: Cow<'static, str>, /// Optional settings with defaults. pub options: TargetOptions, } impl Target { pub fn triple(&self) -> &str { use std::borrow::Borrow; self.llvm_target.borrow() } pub fn search(target: &str) -> Result<Target, TargetError> { self::search(target) } pub fn all() -> impl Iterator<Item = String> { self::get_targets() } /// Returns the term encoding used on this target pub fn term_encoding(&self) -> EncodingType { self.options.encoding } } pub trait HasTargetSpec { fn target_spec(&self) -> &Target; } impl HasTargetSpec for Target { fn target_spec(&self) -> &Target { self } } /// Optional aspects of a target specification. /// /// This has an implementation of `Default`, see each field for what the default is. In general, /// these try to take "minimal defaults" that don't assume anything about the runtime they run in. #[derive(PartialEq, Clone, Debug)] pub struct TargetOptions { /// Is this target built-in or loaded from a custom spec pub is_builtin: bool, /// Term encoding pub encoding: EncodingType, /// The endianness of the target pub endianness: Endianness, /// The width of c_int type. Defaults to "32". pub c_int_width: Cow<'static, str>, /// OS name to use for conditional compilation. Defaults to "none". /// "none" implies a bare metal target without a standard library. pub os: Cow<'static, str>, /// Environment name to use for conditional compilation. Defaults to "". pub env: Cow<'static, str>, /// ABI name to distinguish multiple ABIs on the same OS and architecture, e.g. "eabihf". Defaults to "". pub abi: Cow<'static, str>, /// Vendor name to use for conditional compilation. Defaults to "unknown". pub vendor: Cow<'static, str>, /// Default linker flavor used if `-C linker-flavor` or `-C linker` are not passed on the command line. /// Defaults to `LinkerFlavor::Gcc`. pub linker_flavor: LinkerFlavor, /// Linker to invoke pub linker: Option<Cow<'static, str>>, /// LLD flavor used if `lld` (or `firefly-lld`) is specified as a linker without clarifying its flavor pub lld_flavor: LldFlavor, /// Linker arguments that are passed *before* any user-defined libraries. pub pre_link_args: LinkArgs, // ... unconditionally /// Objects to link before and after all other object code. pub pre_link_objects: CrtObjects, pub post_link_objects: CrtObjects, /// Same as `(pre|post)_link_objects`, but when we fail to pull the objects with help of the /// target's native gcc and fall back to the "self-contained" mode and pull them manually. /// See `crt_objects.rs` for some more detailed documentation. pub pre_link_objects_fallback: CrtObjects, pub post_link_objects_fallback: CrtObjects, /// Which logic to use to determine whether to fall back to the "self-contained" mode or not. pub crt_objects_fallback: Option<CrtObjectsFallback>, /// Linker arguments that are unconditionally passed after any /// user-defined but before post_link_objects. Standard platform /// libraries that should be always be linked to, usually go here. pub late_link_args: LinkArgs, /// Linker arguments used in addition to `late_link_args` if at least one /// dependency is dynamically linked. pub late_link_args_dynamic: LinkArgs, /// Linker arguments used in addition to `late_link_args` if all /// dependencies are statically linked. pub late_link_args_static: LinkArgs, /// Linker arguments that are unconditionally passed *after* any /// user-defined libraries. pub post_link_args: LinkArgs, /// Optional link script applied to `dylib` and `executable` crate types. /// This is a string containing the script, not a path. Can only be applied /// to linkers where `linker_is_gnu` is true. pub link_script: Option<Cow<'static, str>>, /// Environment variables to be set for the linker invocation. pub link_env: Vec<(Cow<'static, str>, Cow<'static, str>)>, /// Environment variables to be removed for the linker invocation. pub link_env_remove: Vec<Cow<'static, str>>, /// Extra arguments to pass to the external assembler (when used) pub asm_args: Vec<Cow<'static, str>>, /// Default CPU to pass to LLVM. Corresponds to `llc -mcpu=$cpu`. Defaults /// to "generic". pub cpu: Cow<'static, str>, /// Default target features to pass to LLVM. These features will *always* be /// passed, and cannot be disabled even via `-C`. Corresponds to `llc /// -mattr=$features`. pub features: Cow<'static, str>, /// Whether dynamic linking is available on this target. Defaults to false. pub dynamic_linking: bool, /// If dynamic linking is available, whether only cdylibs are supported. pub only_cdylib: bool, /// Whether executables are available on this target. iOS, for example, only allows static /// libraries. Defaults to true. pub executables: bool, /// Relocation model to use in object file. Corresponds to `llc /// -relocation-model=$relocation_model`. Defaults to "pic". pub relocation_model: RelocModel, /// Code model to use. Corresponds to `llc -code-model=$code_model`. pub code_model: Option<CodeModel>, /// TLS model to use. Options are "global-dynamic" (default), "local-dynamic", "initial-exec" /// and "local-exec". This is similar to the -ftls-model option in GCC/Clang. pub tls_model: TlsModel, /// Do not emit code that uses the "red zone", if the ABI has one. Defaults to false. pub disable_redzone: bool, /// Frame pointer mode for this target. Defaults to `MayOmit` pub frame_pointer: FramePointer, /// Emit each function in its own section. Defaults to true. pub function_sections: bool, /// String to prepend to the name of every dynamic library. Defaults to "lib". pub dll_prefix: Cow<'static, str>, /// String to append to the name of every dynamic library. Defaults to ".so". pub dll_suffix: Cow<'static, str>, /// String to append to the name of every executable. pub exe_suffix: Cow<'static, str>, /// String to prepend to the name of every static library. Defaults to "lib". pub staticlib_prefix: Cow<'static, str>, /// String to append to the name of every static library. Defaults to ".a". pub staticlib_suffix: Cow<'static, str>, /// OS family to use for conditional compilation. Valid options: "unix", "windows". pub families: Vec<Cow<'static, str>>, /// Whether the target toolchain's ABI supports returning small structs as an integer. pub abi_return_struct_as_int: bool, /// Whether the target toolchain is like macOS's. Only useful for compiling against iOS/macOS, /// in particular running dsymutil and some other stuff like `-dead_strip`. Defaults to false. pub is_like_osx: bool, /// Whether the target toolchain is like Solaris's. /// Only useful for compiling against Illumos/Solaris, /// as they have a different set of linker flags. Defaults to false. pub is_like_solaris: bool, /// Whether the target is like Windows. /// This is a combination of several more specific properties represented as a single flag: /// - The target uses a Windows ABI, /// - uses PE/COFF as a format for object code, /// - uses Windows-style dllexport/dllimport for shared libraries, /// - uses import libraries and .def files for symbol exports, /// - executables support setting a subsystem. pub is_like_windows: bool, /// Whether the target is like MSVC. /// This is a combination of several more specific properties represented as a single flag: /// - The target has all the properties from `is_like_windows` /// (for in-tree targets "is_like_msvc ⇒ is_like_windows" is ensured by a unit test), /// - has some MSVC-specific Windows ABI properties, /// - uses a link.exe-like linker, /// - uses CodeView/PDB for debuginfo and natvis for its visualization, /// - uses SEH-based unwinding, /// - supports control flow guard mechanism. pub is_like_msvc: bool, /// Whether a target toolchain is like WASM. pub is_like_wasm: bool, /// Default supported Version of DWARF on this platform. /// Useful because some platforms (osx, bsd) only want up to DWARF2 pub default_dwarf_version: u32, /// Whether the linker support GNU-like arguments such as -O. Defaults to false. pub linker_is_gnu: bool, /// The MinGW toolchain has a known issue that prevents it from correctly /// handling COFF object files with more than 2<sup>15</sup> sections. Since each weak /// symbol needs its own COMDAT section, weak linkage implies a large /// number sections that easily exceeds the given limit for larger /// codebases. Consequently we want a way to disallow weak linkage on some /// platforms. pub allows_weak_linkage: bool, /// Whether the linker support rpaths or not. Defaults to false. pub has_rpath: bool, /// Whether to disable linking to the default libraries, typically corresponds /// to `-nodefaultlibs`. Defaults to true. pub no_default_libraries: bool, /// Dynamically linked executables can be compiled as position independent /// if the default relocation model of position independent code is not /// changed. This is a requirement to take advantage of ASLR, as otherwise /// the functions in the executable are not randomized and can be used /// during an exploit of a vulnerability in any code. pub position_independent_executables: bool, /// Executables that are both statically linked and position-independent are supported. pub static_position_independent_executables: bool, /// Determines if the target always requires using the PLT for indirect /// library calls or not. This controls the default value of the `-Z plt` flag. pub needs_plt: bool, /// Either partial, full, or off. Full RELRO makes the dynamic linker /// resolve all symbols at startup and marks the GOT read-only before /// starting the program, preventing overwriting the GOT. pub relro_level: RelroLevel, /// Format that archives should be emitted in. This affects whether we use /// LLVM to assemble an archive or fall back to the system linker, and /// currently only "gnu" is used to fall into LLVM. Unknown strings cause /// the system linker to be used. pub archive_format: Cow<'static, str>, /// Is asm!() allowed? Defaults to true. pub allow_asm: bool, /// Whether the runtime startup code requires the `main` function be passed /// `argc` and `argv` values. pub main_needs_argc_argv: bool, /// Flag indicating whether ELF TLS (e.g., #[thread_local]) is available for /// this target. pub has_thread_local: bool, // This is mainly for easy compatibility with emscripten. // If we give emcc .o files that are actually .bc files it // will 'just work'. pub obj_is_bitcode: bool, /// Whether the target requires that emitted object code includes bitcode. pub forces_embed_bitcode: bool, /// Content of the LLVM cmdline section associated with embedded bitcode. pub bitcode_llvm_cmdline: Cow<'static, str>, /// Don't use this field; instead use the `.min_atomic_width()` method. pub min_atomic_width: Option<u64>, /// Don't use this field; instead use the `.max_atomic_width()` method. pub max_atomic_width: Option<u64>, /// Whether the target supports atomic CAS operations natively pub atomic_cas: bool, /// Panic strategy: "unwind" or "abort" pub panic_strategy: PanicStrategy, /// Whether or not linking dylibs to a static CRT is allowed. pub crt_static_allows_dylibs: bool, /// Whether or not the CRT is statically linked by default. pub crt_static_default: bool, /// Whether or not crt-static is respected by the compiler (or is a no-op). pub crt_static_respected: bool, /// Whether or not stack probes (__rust_probestack) are enabled pub stack_probes: bool, /// The minimum alignment for global symbols. pub min_global_align: Option<u64>, /// Default number of codegen units to use in debug mode pub default_codegen_units: Option<u64>, /// Whether to generate trap instructions in places where optimization would /// otherwise produce control flow that falls through into unrelated memory. pub trap_unreachable: bool, /// This target requires everything to be compiled with LTO to emit a final /// executable, aka there is no native linker for this target. pub requires_lto: bool, /// This target has no support for threads. pub singlethread: bool, /// Whether library functions call lowering/optimization is disabled in LLVM /// for this target unconditionally. pub no_builtins: bool, /// The default visibility for symbols in this target should be "hidden" /// rather than "default" pub default_hidden_visibility: bool, /// Whether a .debug_gdb_scripts section will be added to the output object file pub emit_debug_gdb_scripts: bool, /// Whether or not to unconditionally `uwtable` attributes on functions, /// typically because the platform needs to unwind for things like stack /// unwinders. pub requires_uwtable: bool, /// Whether or not to emit `uwtable` attributes on functions if `-C force-unwind-tables` /// is not specified and `uwtable` is not required on this target. pub default_uwtable: bool, /// Whether or not SIMD types are passed by reference in the Rust ABI, /// typically required if a target can be compiled with a mixed set of /// target features. This is `true` by default, and `false` for targets like /// wasm32 where the whole program either has simd or not. pub simd_types_indirect: bool, /// Pass a list of symbol which should be exported in the dylib to the linker. pub limit_rdylib_exports: bool, /// If set, have the linker export exactly these symbols, instead of using /// the usual logic to figure this out from the crate itself. pub override_export_symbols: Option<Vec<Cow<'static, str>>>, /// Determines how or whether the MergeFunctions LLVM pass should run for /// this target. Either "disabled", "trampolines", or "aliases". /// The MergeFunctions pass is generally useful, but some targets may need /// to opt out. The default is "aliases". /// /// Workaround for: https://github.com/rust-lang/rust/issues/57356 pub merge_functions: MergeFunctions, /// Use platform dependent mcount function pub mcount: Cow<'static, str>, /// LLVM ABI name, corresponds to the '-mabi' parameter available in multilib C compilers pub llvm_abiname: Cow<'static, str>, /// Whether or not RelaxElfRelocation flag will be passed to the linker pub relax_elf_relocations: bool, /// Additional arguments to pass to LLVM, similar to the `-C llvm-args` codegen option. pub llvm_args: Vec<Cow<'static, str>>, /// Whether to use legacy .ctors initialization hooks rather than .init_array. Defaults /// to false (uses .init_array). pub use_ctors_section: bool, /// Whether the linker is instructed to add a `GNU_EH_FRAME` ELF header /// used to locate unwinding information is passed /// (only has effect if the linker is `ld`-like). pub eh_frame_header: bool, /// Is true if the target is an ARM architecture using thumb v1 which allows for /// thumb and arm interworking. pub has_thumb_interworking: bool, /// How to handle split debug information, if at all. Specifying `None` has /// target-specific meaning. pub split_debuginfo: SplitDebugInfo, /// If present it's a default value to use for adjusting the C ABI. pub default_adjusted_cabi: Option<Abi>, /// Minimum number of bits in #[repr(C)] enum. Defaults to 32. pub c_enum_min_bits: u64, /// Whether or not the DWARF `.debug_aranges` section should be generated. pub generate_arange_section: bool, /// Whether the target supports stack canary checks. `true` by default, /// since this is most common among tier 1 and tier 2 targets. pub supports_stack_protector: bool, } impl Default for TargetOptions { /// Creates a set of "sane defaults" for any target. This is still /// incomplete, and if used for compilation, will certainly not work. fn default() -> TargetOptions { TargetOptions { is_builtin: false, encoding: EncodingType::Encoding64Nanboxed, endianness: Endianness::Little, c_int_width: "32".into(), os: "none".into(), env: "".into(), abi: "".into(), vendor: "unknown".into(), linker_flavor: LinkerFlavor::Gcc, linker: option_env!("CFG_DEFAULT_LINKER").map(|s| s.into()), lld_flavor: LldFlavor::Ld, pre_link_args: LinkArgs::new(), post_link_args: LinkArgs::new(), link_script: None, asm_args: Vec::new(), cpu: "generic".into(), features: "".into(), dynamic_linking: false, only_cdylib: false, executables: true, relocation_model: RelocModel::Pic, code_model: None, tls_model: TlsModel::GeneralDynamic, disable_redzone: false, frame_pointer: FramePointer::MayOmit, function_sections: true, dll_prefix: "lib".into(), dll_suffix: ".so".into(), exe_suffix: "".into(), staticlib_prefix: "lib".into(), staticlib_suffix: ".a".into(), families: vec![], abi_return_struct_as_int: false, is_like_osx: false, is_like_solaris: false, is_like_windows: false, is_like_msvc: false, is_like_wasm: false, default_dwarf_version: 4, linker_is_gnu: true, allows_weak_linkage: true, has_rpath: false, no_default_libraries: true, position_independent_executables: false, static_position_independent_executables: false, needs_plt: false, relro_level: RelroLevel::None, pre_link_objects: Default::default(), post_link_objects: Default::default(), pre_link_objects_fallback: Default::default(), post_link_objects_fallback: Default::default(), crt_objects_fallback: None, late_link_args: LinkArgs::new(), late_link_args_dynamic: LinkArgs::new(), late_link_args_static: LinkArgs::new(), link_env: Vec::new(), link_env_remove: Vec::new(), archive_format: "gnu".into(), main_needs_argc_argv: true, allow_asm: true, has_thread_local: false, obj_is_bitcode: false, forces_embed_bitcode: false, bitcode_llvm_cmdline: "".into(), min_atomic_width: None, max_atomic_width: None, atomic_cas: true, panic_strategy: PanicStrategy::Unwind, crt_static_allows_dylibs: false, crt_static_default: false, crt_static_respected: false, stack_probes: false, min_global_align: None, default_codegen_units: None, trap_unreachable: true, requires_lto: false, singlethread: false, no_builtins: false, default_hidden_visibility: false, emit_debug_gdb_scripts: true, requires_uwtable: false, default_uwtable: false, simd_types_indirect: true, limit_rdylib_exports: true, override_export_symbols: None, merge_functions: MergeFunctions::Aliases, mcount: "mcount".into(), llvm_abiname: "".into(), relax_elf_relocations: false, llvm_args: vec![], use_ctors_section: false, eh_frame_header: true, has_thumb_interworking: false, split_debuginfo: SplitDebugInfo::Off, default_adjusted_cabi: None, c_enum_min_bits: 32, generate_arange_section: true, supports_stack_protector: true, } } } impl Target { /// Given a function ABI, turn it into the correct ABI for this target. pub fn adjust_abi(&self, abi: Abi) -> Abi { match abi { Abi::C { .. } => self.options.default_adjusted_cabi.unwrap_or(abi), Abi::System { unwind } if self.options.is_like_windows && self.arch == "x86" => { Abi::Stdcall { unwind } } Abi::System { unwind } => Abi::C { unwind }, Abi::EfiApi if self.arch == "x86_64" => Abi::Win64 { unwind: false }, Abi::EfiApi => Abi::C { unwind: false }, // See commentary in `is_abi_supported`. Abi::Stdcall { .. } | Abi::Thiscall { .. } if self.arch == "x86" => abi, Abi::Stdcall { unwind } | Abi::Thiscall { unwind } => Abi::C { unwind }, Abi::Fastcall { .. } if self.arch == "x86" => abi, Abi::Vectorcall { .. } if ["x86", "x86_64"].contains(&&self.arch[..]) => abi, Abi::Fastcall { unwind } | Abi::Vectorcall { unwind } => Abi::C { unwind }, abi => abi, } } /// Minimum integer size in bits that this target can perform atomic /// operations on. pub fn min_atomic_width(&self) -> u64 { self.options.min_atomic_width.unwrap_or(8) } /// Maximum integer size in bits that this target can perform atomic /// operations on. pub fn max_atomic_width(&self) -> u64 { self.options .max_atomic_width .unwrap_or_else(|| self.pointer_width as u64) } /// Returns a None if the UNSUPPORTED_CALLING_CONVENTIONS lint should be emitted pub fn is_abi_supported(&self, abi: Abi) -> Option<bool> { use Abi::*; Some(match abi { Erlang | Rust | C { .. } | System { .. } | RustIntrinsic | RustCall | PlatformIntrinsic | Unadjusted | Cdecl { .. } | EfiApi => true, X86Interrupt => ["x86", "x86_64"].contains(&&self.arch[..]), Aapcs { .. } => "arm" == self.arch, CCmseNonSecureCall => ["arm", "aarch64"].contains(&&self.arch[..]), Win64 { .. } | SysV64 { .. } => self.arch == "x86_64", PtxKernel => self.arch == "nvptx64", Msp430Interrupt => self.arch == "msp430", AmdGpuKernel => self.arch == "amdgcn", AvrInterrupt | AvrNonBlockingInterrupt => self.arch == "avr", Wasm => ["wasm32", "wasm64"].contains(&&self.arch[..]), Thiscall { .. } => self.arch == "x86", // On windows these fall-back to platform native calling convention (C) when the // architecture is not supported. // // This is I believe a historical accident that has occurred as part of Microsoft // striving to allow most of the code to "just" compile when support for 64-bit x86 // was added and then later again, when support for ARM architectures was added. // // This is well documented across MSDN. Support for this in Rust has been added in // #54576. This makes much more sense in context of Microsoft's C++ than it does in // Rust, but there isn't much leeway remaining here to change it back at the time this // comment has been written. // // Following are the relevant excerpts from the MSDN documentation. // // > The __vectorcall calling convention is only supported in native code on x86 and // x64 processors that include Streaming SIMD Extensions 2 (SSE2) and above. // > ... // > On ARM machines, __vectorcall is accepted and ignored by the compiler. // // -- https://docs.microsoft.com/en-us/cpp/cpp/vectorcall?view=msvc-160 // // > On ARM and x64 processors, __stdcall is accepted and ignored by the compiler; // // -- https://docs.microsoft.com/en-us/cpp/cpp/stdcall?view=msvc-160 // // > In most cases, keywords or compiler switches that specify an unsupported // > convention on a particular platform are ignored, and the platform default // > convention is used. // // -- https://docs.microsoft.com/en-us/cpp/cpp/argument-passing-and-naming-conventions Stdcall { .. } | Fastcall { .. } | Vectorcall { .. } if self.options.is_like_windows => { true } // Outside of Windows we want to only support these calling conventions for the // architectures for which these calling conventions are actually well defined. Stdcall { .. } | Fastcall { .. } if self.arch == "x86" => true, Vectorcall { .. } if ["x86", "x86_64"].contains(&&self.arch[..]) => true, // Return a `None` for other cases so that we know to emit a future compat lint. Stdcall { .. } | Fastcall { .. } | Vectorcall { .. } => return None, }) } }
mod generator; mod workspace; use self::generator::GeneratorWidget; use self::workspace::WorkspaceWidget; use gtk::{self, prelude::*, ButtonsType, DialogFlags, FileChooserAction, MessageType}; use packt_core::problem::Problem; use relm::{Component, ContainerWidget, Relm, Update, Widget}; use std::{self, fmt, path::PathBuf}; const GLADE_SRC: &str = include_str!("../packt.glade"); #[derive(Msg)] pub enum Msg<E: fmt::Display> { Import, Save(Problem), Err(E), Quit, } struct Widgets { _generator: Component<GeneratorWidget>, workspace: Component<WorkspaceWidget>, window: gtk::Window, } pub struct Win { widgets: Widgets, // relm: Relm<Win>, } impl Update for Win { type Model = (); type ModelParam = (); type Msg = Msg<String>; fn model(_relm: &Relm<Self>, _param: ()) -> Self::Model { () } fn update(&mut self, event: Self::Msg) { match event { Msg::Save(problem) => self.save_problem(&problem), Msg::Import => self.import_problem(), Msg::Quit => gtk::main_quit(), Msg::Err(e) => { let dialog = self.error_dialog(e); dialog.run(); dialog.close(); } } } } impl Widget for Win { type Root = gtk::Window; fn root(&self) -> Self::Root { self.widgets.window.clone() } fn view(relm: &Relm<Self>, _model: Self::Model) -> Self { use self::generator::Msg::*; use self::workspace::Msg::*; let builder = gtk::Builder::new_from_string(&GLADE_SRC); let window: gtk::Window = builder .get_object("main_window") .expect("failed to get main_window"); connect!( relm, window, connect_delete_event(_, _), return (Some(Msg::Quit), Inhibit(false)) ); let paned: gtk::Paned = builder .get_object("main_paned") .expect("failed to get main_paned"); let _generator = paned.add_widget::<GeneratorWidget>(()); let workspace = paned.add_widget::<WorkspaceWidget>(()); connect!(_generator@Moved(ref problem), workspace, Add(problem.clone())); connect!(workspace@Import, relm, Msg::Import); connect!(workspace@Saved(ref problem), relm, Msg::Save(problem.clone())); connect!(workspace@Error(ref e), relm, Msg::Err(e.to_string())); window.show_all(); Win { // relm: relm.clone(), widgets: Widgets { _generator, workspace, window, }, } } } impl Win { fn error_dialog<M: AsRef<str>>(&self, msg: M) -> gtk::MessageDialog { gtk::MessageDialog::new( Some(&self.widgets.window), DialogFlags::DESTROY_WITH_PARENT, MessageType::Warning, ButtonsType::Close, msg.as_ref(), ) } fn info_dialog(&self, msg: &str) -> gtk::MessageDialog { gtk::MessageDialog::new( Some(&self.widgets.window), DialogFlags::DESTROY_WITH_PARENT, MessageType::Info, ButtonsType::Close, msg, ) } fn filechooser_dialog(&self, action: FileChooserAction) -> Option<PathBuf> { let (title, accept_text) = match action { FileChooserAction::Save => ("Save file", "Save"), FileChooserAction::Open => ("Open file", "Open"), _ => unreachable!(), }; let dialog = gtk::FileChooserDialog::new( title.into(), Some(&self.widgets.window), FileChooserAction::Save, ); let cancel: i32 = gtk::ResponseType::Cancel.into(); let accept: i32 = gtk::ResponseType::Accept.into(); dialog.add_button("Cancel", cancel); dialog.add_button(accept_text, accept); if let Ok(p) = std::env::current_dir() { dialog.set_current_folder(p); } else if let Some(p) = std::env::home_dir() { dialog.set_current_folder(p); } let result = if accept == dialog.run() { dialog.get_filename() } else { None }; dialog.close(); result } fn save_problem(&mut self, problem: &Problem) { if let Some(path) = self.filechooser_dialog(FileChooserAction::Save) { problem.save(path).unwrap(); } } fn import_problem(&mut self) { if let Some(path) = self.filechooser_dialog(FileChooserAction::Open) { match Problem::from_path(path) { Ok(problem) => { self.widgets.workspace.emit(workspace::Msg::Add(problem)); } Err(_e) => (), /* self.relm.stream().emit(Msg::Err(e. * to_string())), */ } } } }
extern crate env_logger; extern crate handlebars; extern crate rustc_serialize; #[macro_use] extern crate maplit; use std::io::prelude::*; use std::io; use std::fs::File; use std::path::Path; use handlebars::{Handlebars}; fn load_template(name: &str) -> io::Result<String> { let path = Path::new(name); let mut file = try!(File::open(path)); let mut s = String::new(); try!(file.read_to_string(&mut s)); Ok(s) } fn main() { env_logger::init().unwrap(); let mut handlebars = Handlebars::new(); let t = load_template("./examples/template2.hbs").ok().unwrap(); handlebars.register_template_string("template", t).ok().unwrap(); let base0 = load_template("./examples/base0.hbs").ok().unwrap(); handlebars.register_template_string("base0", base0).ok().unwrap(); let base1 = load_template("./examples/base1.hbs").ok().unwrap(); handlebars.register_template_string("base1", base1).ok().unwrap(); let data0 = btreemap! { "title".to_string() => "example 0".to_string(), "parent".to_string() => "base0".to_string() }; let data1 = btreemap! { "title".to_string() => "example 1".to_string(), "parent".to_string() => "base1".to_string() }; println!("Page 0"); println!("{}", handlebars.render("template", &data0).ok().unwrap()); println!("======================================================="); println!("Page 1"); println!("{}", handlebars.render("template", &data1).ok().unwrap()); }
#[doc = "Reader of register RCR"] pub type R = crate::R<u32, super::RCR>; #[doc = "Writer for register RCR"] pub type W = crate::W<u32, super::RCR>; #[doc = "Register RCR `reset()`'s with value 0"] impl crate::ResetValue for super::RCR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `PAGE0_WP`"] pub type PAGE0_WP_R = crate::R<bool, bool>; #[doc = "Write proxy for field `PAGE0_WP`"] pub struct PAGE0_WP_W<'a> { w: &'a mut W, } impl<'a> PAGE0_WP_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 = "Reader of field `PAGE1_WP`"] pub type PAGE1_WP_R = crate::R<bool, bool>; #[doc = "Write proxy for field `PAGE1_WP`"] pub struct PAGE1_WP_W<'a> { w: &'a mut W, } impl<'a> PAGE1_WP_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 = "Reader of field `PAGE2_WP`"] pub type PAGE2_WP_R = crate::R<bool, bool>; #[doc = "Write proxy for field `PAGE2_WP`"] pub struct PAGE2_WP_W<'a> { w: &'a mut W, } impl<'a> PAGE2_WP_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 = "Reader of field `PAGE3_WP`"] pub type PAGE3_WP_R = crate::R<bool, bool>; #[doc = "Write proxy for field `PAGE3_WP`"] pub struct PAGE3_WP_W<'a> { w: &'a mut W, } impl<'a> PAGE3_WP_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 } } impl R { #[doc = "Bit 0 - CCM SRAM page write protection bit"] #[inline(always)] pub fn page0_wp(&self) -> PAGE0_WP_R { PAGE0_WP_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - CCM SRAM page write protection bit"] #[inline(always)] pub fn page1_wp(&self) -> PAGE1_WP_R { PAGE1_WP_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 2 - CCM SRAM page write protection bit"] #[inline(always)] pub fn page2_wp(&self) -> PAGE2_WP_R { PAGE2_WP_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 3 - CCM SRAM page write protection bit"] #[inline(always)] pub fn page3_wp(&self) -> PAGE3_WP_R { PAGE3_WP_R::new(((self.bits >> 3) & 0x01) != 0) } } impl W { #[doc = "Bit 0 - CCM SRAM page write protection bit"] #[inline(always)] pub fn page0_wp(&mut self) -> PAGE0_WP_W { PAGE0_WP_W { w: self } } #[doc = "Bit 1 - CCM SRAM page write protection bit"] #[inline(always)] pub fn page1_wp(&mut self) -> PAGE1_WP_W { PAGE1_WP_W { w: self } } #[doc = "Bit 2 - CCM SRAM page write protection bit"] #[inline(always)] pub fn page2_wp(&mut self) -> PAGE2_WP_W { PAGE2_WP_W { w: self } } #[doc = "Bit 3 - CCM SRAM page write protection bit"] #[inline(always)] pub fn page3_wp(&mut self) -> PAGE3_WP_W { PAGE3_WP_W { w: self } } }
//! File holding the Pushable trait //! //! Author: [Boris](mailto:boris@humanenginuity.com) //! Version: 1.0 //! //! ## Release notes //! - v1.0 : creation // ======================================================================= // LIBRARY IMPORTS // ======================================================================= use serde_json; use serde_json::Value; // ======================================================================= // TRAIT DEFINITION // ======================================================================= pub trait Pushable<T> { fn push(&mut self, value: T) -> &mut Self; } // ======================================================================= // TRAIT IMPLEMENTATION // ======================================================================= /// Implements `Pushable<T>` for `Vec<T>` impl<T> Pushable<T> for Vec<T> { fn push(&mut self, new_value: T) -> &mut Self { self.push(new_value); self } } /// Implements `Pushable` for `serde_json::Value` /// /// - If `self` is anything but a `Value::Array` => transforms to an Array containing the existing value and appends the new value /// - If `self` is a `Value::Array` => appends the new value impl Pushable<Value> for Value { fn push(&mut self, new_value: Value) -> &mut Self { if self.is_null() { ::std::mem::replace(self, new_value); self } else { let mut vect = Vec::new(); match *self { Value::Array(ref mut existing_vect) => vect.append(existing_vect), Value::Null => (), // do nothing ref existing_value @ _ => vect.push(existing_value.clone()), } vect.push(new_value); ::std::mem::replace(self, Value::Array(vect)); self } } } /// Allow to push a String using `serde_json::from_str()` /// It first try to use `serde_json::from_str()` on the String. If it fails, it pushes a new `Value::String()` instead impl Pushable<String> for Value { fn push(&mut self, new_value: String) -> &mut Self { self.push(new_value.as_str()) } } /// Allow to push a &str using `serde_json::from_str()` /// It first try to use `serde_json::from_str()` on the String. If it fails, it pushes a new `Value::String()` instead impl<'s> Pushable<&'s str> for Value { fn push(&mut self, new_value: &'s str) -> &mut Self { let value : Result<Value, _> = serde_json::from_str(new_value); if value.is_err() { self.push(Value::String(new_value.to_string())); } else { self.push(value.unwrap()); } self } } /// Allow to push Result<Value, _> (sugar for pushing `serde_json::from_xxx()`) /// Panics if conversion failed impl Pushable<Result<Value, serde_json::Error>> for Value { fn push(&mut self, new_value: Result<Value, serde_json::Error>) -> &mut Self { if new_value.is_err() { panic!("::amiwo::pushable<Result<V, E>>::push::error unable to push invalid value {}", &new_value.unwrap_err()); } else { self.push(new_value.unwrap()); } self } } // ======================================================================= // UNIT TESTS // ======================================================================= #[cfg(test)] mod tests { #![allow(non_snake_case)] use super::Pushable; use serde_json::Value; #[test] fn Pushable_test_value() { let mut x = Value::Null; x.push("a"); assert!(!x.is_array()); assert_eq!(x, json!("a")); let mut x = json!("a"); x.push("b"); assert_eq!(x, json!(["a", "b"])); let mut x = json!(1); x.push("b"); assert_eq!(x, json!([1, "b"])); let mut x = json!(true); x.push("b"); assert_eq!(x, json!([true, "b"])); let mut x = json!(["a", "b"]); x.push("c"); assert_eq!(x, json!(["a", "b", "c"])); let mut x = json!({ "key1": "value1", "key2": "value2" }); x.push("c"); assert_eq!(x, json!([ { "key1": "value1", "key2": "value2" }, "c" ])); } }
//! This block represents a number. Number are represented using a double use super::{BasicBlock, Primitive}; use crate::label::Label; #[derive(Debug)] pub struct Number { label: Label, value: f64, } impl Number { pub fn new(value: f64) -> Number { Number { label: Label::new("number"), value, } } } impl Primitive for Number { type ValueType = f64; fn get(&self) -> Self::ValueType { self.value } fn set(&mut self, value: Self::ValueType) { self.value = value; } } impl BasicBlock for Number { fn label(&self) -> &String { self.label.name() } fn output(&self) -> String { self.value.to_string() } fn interpret(&self) -> bool { !self.value.is_nan() } }
use std::fmt::Debug; use std::marker; use cgmath::{BaseFloat, EuclideanSpace, InnerSpace, Rotation, VectorSpace, Zero}; use core::{NextFrame, PhysicalEntity, Pose, Velocity}; use specs::prelude::{Component, Join, ReadStorage, System, WriteStorage}; /// Current frame update system. /// /// Will update positions and velocities for the current frame, based on `NextFrame` values. /// /// ### Type parameters: /// /// - `P`: Positional quantity, usually `Point2` or `Point3` /// - `R`: Rotational quantity, usually `Basis2` or `Quaternion` /// - `A`: Angular velocity, usually `Scalar` or `Vector3` /// - `T`: Transform type (`BodyPose2` or similar) /// /// ### System function: /// /// `fn(NextFrame<Velocity>, NextFrame<T>) -> (Velocity, T)` pub struct CurrentFrameUpdateSystem<P, R, A, T> { m: marker::PhantomData<(P, R, A, T)>, } impl<P, R, A, T> CurrentFrameUpdateSystem<P, R, A, T> where P: EuclideanSpace, P::Diff: VectorSpace + InnerSpace + Debug, P::Scalar: BaseFloat, R: Rotation<P>, A: Clone + Zero, T: Pose<P, R>, { /// Create system. pub fn new() -> Self { Self { m: marker::PhantomData, } } } impl<'a, P, R, A, T> System<'a> for CurrentFrameUpdateSystem<P, R, A, T> where P: EuclideanSpace + Send + Sync + 'static, P::Diff: VectorSpace + InnerSpace + Debug + Send + Sync + 'static, P::Scalar: BaseFloat + Send + Sync + 'static, R: Rotation<P> + Send + Sync + 'static, A: Clone + Zero + Send + Sync + 'static, T: Pose<P, R> + Component + Clone + Send + Sync + 'static, { type SystemData = ( ReadStorage<'a, PhysicalEntity<P::Scalar>>, WriteStorage<'a, Velocity<P::Diff, A>>, ReadStorage<'a, NextFrame<Velocity<P::Diff, A>>>, WriteStorage<'a, T>, ReadStorage<'a, NextFrame<T>>, ); fn run(&mut self, data: Self::SystemData) { let (entities, mut velocities, next_velocities, mut poses, next_poses) = data; // Update current pose for (_, next, pose) in (&entities, &next_poses, &mut poses) .join() .filter(|(e, ..)| e.active()) { *pose = next.value.clone(); } // Update current velocity for (_, next, velocity) in (&entities, &next_velocities, &mut velocities) .join() .filter(|(e, ..)| e.active()) { *velocity = next.value.clone(); } } }
// This is equivalent to having front_of_house/hosting.rs pub mod hosting { pub fn add_to_waitlist() {} }
#![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 AppExtension(pub ::windows::core::IInspectable); impl AppExtension { 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 DisplayName(&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 Description(&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).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn Package(&self) -> ::windows::core::Result<super::Package> { 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::Package>(result__) } } pub fn AppInfo(&self) -> ::windows::core::Result<super::AppInfo> { 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::AppInfo>(result__) } } #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub fn GetExtensionPropertiesAsync(&self) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<super::super::Foundation::Collections::IPropertySet>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<super::super::Foundation::Collections::IPropertySet>>(result__) } } #[cfg(all(feature = "Foundation", feature = "Storage"))] pub fn GetPublicFolderAsync(&self) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<super::super::Storage::StorageFolder>> { 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::Foundation::IAsyncOperation<super::super::Storage::StorageFolder>>(result__) } } pub fn AppUserModelId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IAppExtension2>(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__) } } } unsafe impl ::windows::core::RuntimeType for AppExtension { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.AppExtensions.AppExtension;{8450902c-15ed-4faf-93ea-2237bbf8cbd6})"); } unsafe impl ::windows::core::Interface for AppExtension { type Vtable = IAppExtension_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8450902c_15ed_4faf_93ea_2237bbf8cbd6); } impl ::windows::core::RuntimeName for AppExtension { const NAME: &'static str = "Windows.ApplicationModel.AppExtensions.AppExtension"; } impl ::core::convert::From<AppExtension> for ::windows::core::IUnknown { fn from(value: AppExtension) -> Self { value.0 .0 } } impl ::core::convert::From<&AppExtension> for ::windows::core::IUnknown { fn from(value: &AppExtension) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AppExtension { 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 AppExtension { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<AppExtension> for ::windows::core::IInspectable { fn from(value: AppExtension) -> Self { value.0 } } impl ::core::convert::From<&AppExtension> for ::windows::core::IInspectable { fn from(value: &AppExtension) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AppExtension { 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 AppExtension { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for AppExtension {} unsafe impl ::core::marker::Sync for AppExtension {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AppExtensionCatalog(pub ::windows::core::IInspectable); impl AppExtensionCatalog { #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub fn FindAllAsync(&self) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<super::super::Foundation::Collections::IVectorView<AppExtension>>> { 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<super::super::Foundation::Collections::IVectorView<AppExtension>>>(result__) } } #[cfg(feature = "Foundation")] pub fn RequestRemovePackageAsync<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, packagefullname: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<bool>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), packagefullname.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<bool>>(result__) } } #[cfg(feature = "Foundation")] pub fn PackageInstalled<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<AppExtensionCatalog, AppExtensionPackageInstalledEventArgs>>>(&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 RemovePackageInstalled<'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")] pub fn PackageUpdating<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<AppExtensionCatalog, AppExtensionPackageUpdatingEventArgs>>>(&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 RemovePackageUpdating<'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).11)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn PackageUpdated<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<AppExtensionCatalog, AppExtensionPackageUpdatedEventArgs>>>(&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).12)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemovePackageUpdated<'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).13)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn PackageUninstalling<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<AppExtensionCatalog, AppExtensionPackageUninstallingEventArgs>>>(&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).14)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemovePackageUninstalling<'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).15)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn PackageStatusChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<AppExtensionCatalog, AppExtensionPackageStatusChangedEventArgs>>>(&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).16)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemovePackageStatusChanged<'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).17)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } pub fn Open<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(appextensionname: Param0) -> ::windows::core::Result<AppExtensionCatalog> { Self::IAppExtensionCatalogStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), appextensionname.into_param().abi(), &mut result__).from_abi::<AppExtensionCatalog>(result__) }) } pub fn IAppExtensionCatalogStatics<R, F: FnOnce(&IAppExtensionCatalogStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<AppExtensionCatalog, IAppExtensionCatalogStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for AppExtensionCatalog { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.AppExtensions.AppExtensionCatalog;{97872032-8426-4ad1-9084-92e88c2da200})"); } unsafe impl ::windows::core::Interface for AppExtensionCatalog { type Vtable = IAppExtensionCatalog_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x97872032_8426_4ad1_9084_92e88c2da200); } impl ::windows::core::RuntimeName for AppExtensionCatalog { const NAME: &'static str = "Windows.ApplicationModel.AppExtensions.AppExtensionCatalog"; } impl ::core::convert::From<AppExtensionCatalog> for ::windows::core::IUnknown { fn from(value: AppExtensionCatalog) -> Self { value.0 .0 } } impl ::core::convert::From<&AppExtensionCatalog> for ::windows::core::IUnknown { fn from(value: &AppExtensionCatalog) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AppExtensionCatalog { 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 AppExtensionCatalog { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<AppExtensionCatalog> for ::windows::core::IInspectable { fn from(value: AppExtensionCatalog) -> Self { value.0 } } impl ::core::convert::From<&AppExtensionCatalog> for ::windows::core::IInspectable { fn from(value: &AppExtensionCatalog) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AppExtensionCatalog { 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 AppExtensionCatalog { 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 AppExtensionPackageInstalledEventArgs(pub ::windows::core::IInspectable); impl AppExtensionPackageInstalledEventArgs { pub fn AppExtensionName(&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 Package(&self) -> ::windows::core::Result<super::Package> { 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::Package>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn Extensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<AppExtension>> { 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<AppExtension>>(result__) } } } unsafe impl ::windows::core::RuntimeType for AppExtensionPackageInstalledEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.AppExtensions.AppExtensionPackageInstalledEventArgs;{39e59234-3351-4a8d-9745-e7d3dd45bc48})"); } unsafe impl ::windows::core::Interface for AppExtensionPackageInstalledEventArgs { type Vtable = IAppExtensionPackageInstalledEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x39e59234_3351_4a8d_9745_e7d3dd45bc48); } impl ::windows::core::RuntimeName for AppExtensionPackageInstalledEventArgs { const NAME: &'static str = "Windows.ApplicationModel.AppExtensions.AppExtensionPackageInstalledEventArgs"; } impl ::core::convert::From<AppExtensionPackageInstalledEventArgs> for ::windows::core::IUnknown { fn from(value: AppExtensionPackageInstalledEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&AppExtensionPackageInstalledEventArgs> for ::windows::core::IUnknown { fn from(value: &AppExtensionPackageInstalledEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AppExtensionPackageInstalledEventArgs { 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 AppExtensionPackageInstalledEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<AppExtensionPackageInstalledEventArgs> for ::windows::core::IInspectable { fn from(value: AppExtensionPackageInstalledEventArgs) -> Self { value.0 } } impl ::core::convert::From<&AppExtensionPackageInstalledEventArgs> for ::windows::core::IInspectable { fn from(value: &AppExtensionPackageInstalledEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AppExtensionPackageInstalledEventArgs { 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 AppExtensionPackageInstalledEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for AppExtensionPackageInstalledEventArgs {} unsafe impl ::core::marker::Sync for AppExtensionPackageInstalledEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AppExtensionPackageStatusChangedEventArgs(pub ::windows::core::IInspectable); impl AppExtensionPackageStatusChangedEventArgs { pub fn AppExtensionName(&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 Package(&self) -> ::windows::core::Result<super::Package> { 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::Package>(result__) } } } unsafe impl ::windows::core::RuntimeType for AppExtensionPackageStatusChangedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.AppExtensions.AppExtensionPackageStatusChangedEventArgs;{1ce17433-1153-44fd-87b1-8ae1050303df})"); } unsafe impl ::windows::core::Interface for AppExtensionPackageStatusChangedEventArgs { type Vtable = IAppExtensionPackageStatusChangedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1ce17433_1153_44fd_87b1_8ae1050303df); } impl ::windows::core::RuntimeName for AppExtensionPackageStatusChangedEventArgs { const NAME: &'static str = "Windows.ApplicationModel.AppExtensions.AppExtensionPackageStatusChangedEventArgs"; } impl ::core::convert::From<AppExtensionPackageStatusChangedEventArgs> for ::windows::core::IUnknown { fn from(value: AppExtensionPackageStatusChangedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&AppExtensionPackageStatusChangedEventArgs> for ::windows::core::IUnknown { fn from(value: &AppExtensionPackageStatusChangedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AppExtensionPackageStatusChangedEventArgs { 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 AppExtensionPackageStatusChangedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<AppExtensionPackageStatusChangedEventArgs> for ::windows::core::IInspectable { fn from(value: AppExtensionPackageStatusChangedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&AppExtensionPackageStatusChangedEventArgs> for ::windows::core::IInspectable { fn from(value: &AppExtensionPackageStatusChangedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AppExtensionPackageStatusChangedEventArgs { 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 AppExtensionPackageStatusChangedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for AppExtensionPackageStatusChangedEventArgs {} unsafe impl ::core::marker::Sync for AppExtensionPackageStatusChangedEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AppExtensionPackageUninstallingEventArgs(pub ::windows::core::IInspectable); impl AppExtensionPackageUninstallingEventArgs { pub fn AppExtensionName(&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 Package(&self) -> ::windows::core::Result<super::Package> { 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::Package>(result__) } } } unsafe impl ::windows::core::RuntimeType for AppExtensionPackageUninstallingEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.AppExtensions.AppExtensionPackageUninstallingEventArgs;{60f160c5-171e-40ff-ae98-ab2c20dd4d75})"); } unsafe impl ::windows::core::Interface for AppExtensionPackageUninstallingEventArgs { type Vtable = IAppExtensionPackageUninstallingEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x60f160c5_171e_40ff_ae98_ab2c20dd4d75); } impl ::windows::core::RuntimeName for AppExtensionPackageUninstallingEventArgs { const NAME: &'static str = "Windows.ApplicationModel.AppExtensions.AppExtensionPackageUninstallingEventArgs"; } impl ::core::convert::From<AppExtensionPackageUninstallingEventArgs> for ::windows::core::IUnknown { fn from(value: AppExtensionPackageUninstallingEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&AppExtensionPackageUninstallingEventArgs> for ::windows::core::IUnknown { fn from(value: &AppExtensionPackageUninstallingEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AppExtensionPackageUninstallingEventArgs { 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 AppExtensionPackageUninstallingEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<AppExtensionPackageUninstallingEventArgs> for ::windows::core::IInspectable { fn from(value: AppExtensionPackageUninstallingEventArgs) -> Self { value.0 } } impl ::core::convert::From<&AppExtensionPackageUninstallingEventArgs> for ::windows::core::IInspectable { fn from(value: &AppExtensionPackageUninstallingEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AppExtensionPackageUninstallingEventArgs { 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 AppExtensionPackageUninstallingEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for AppExtensionPackageUninstallingEventArgs {} unsafe impl ::core::marker::Sync for AppExtensionPackageUninstallingEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AppExtensionPackageUpdatedEventArgs(pub ::windows::core::IInspectable); impl AppExtensionPackageUpdatedEventArgs { pub fn AppExtensionName(&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 Package(&self) -> ::windows::core::Result<super::Package> { 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::Package>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn Extensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<AppExtension>> { 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<AppExtension>>(result__) } } } unsafe impl ::windows::core::RuntimeType for AppExtensionPackageUpdatedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.AppExtensions.AppExtensionPackageUpdatedEventArgs;{3a83c43f-797e-44b5-ba24-a4c8b5a543d7})"); } unsafe impl ::windows::core::Interface for AppExtensionPackageUpdatedEventArgs { type Vtable = IAppExtensionPackageUpdatedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3a83c43f_797e_44b5_ba24_a4c8b5a543d7); } impl ::windows::core::RuntimeName for AppExtensionPackageUpdatedEventArgs { const NAME: &'static str = "Windows.ApplicationModel.AppExtensions.AppExtensionPackageUpdatedEventArgs"; } impl ::core::convert::From<AppExtensionPackageUpdatedEventArgs> for ::windows::core::IUnknown { fn from(value: AppExtensionPackageUpdatedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&AppExtensionPackageUpdatedEventArgs> for ::windows::core::IUnknown { fn from(value: &AppExtensionPackageUpdatedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AppExtensionPackageUpdatedEventArgs { 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 AppExtensionPackageUpdatedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<AppExtensionPackageUpdatedEventArgs> for ::windows::core::IInspectable { fn from(value: AppExtensionPackageUpdatedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&AppExtensionPackageUpdatedEventArgs> for ::windows::core::IInspectable { fn from(value: &AppExtensionPackageUpdatedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AppExtensionPackageUpdatedEventArgs { 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 AppExtensionPackageUpdatedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for AppExtensionPackageUpdatedEventArgs {} unsafe impl ::core::marker::Sync for AppExtensionPackageUpdatedEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AppExtensionPackageUpdatingEventArgs(pub ::windows::core::IInspectable); impl AppExtensionPackageUpdatingEventArgs { pub fn AppExtensionName(&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 Package(&self) -> ::windows::core::Result<super::Package> { 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::Package>(result__) } } } unsafe impl ::windows::core::RuntimeType for AppExtensionPackageUpdatingEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.AppExtensions.AppExtensionPackageUpdatingEventArgs;{7ed59329-1a65-4800-a700-b321009e306a})"); } unsafe impl ::windows::core::Interface for AppExtensionPackageUpdatingEventArgs { type Vtable = IAppExtensionPackageUpdatingEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7ed59329_1a65_4800_a700_b321009e306a); } impl ::windows::core::RuntimeName for AppExtensionPackageUpdatingEventArgs { const NAME: &'static str = "Windows.ApplicationModel.AppExtensions.AppExtensionPackageUpdatingEventArgs"; } impl ::core::convert::From<AppExtensionPackageUpdatingEventArgs> for ::windows::core::IUnknown { fn from(value: AppExtensionPackageUpdatingEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&AppExtensionPackageUpdatingEventArgs> for ::windows::core::IUnknown { fn from(value: &AppExtensionPackageUpdatingEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AppExtensionPackageUpdatingEventArgs { 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 AppExtensionPackageUpdatingEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<AppExtensionPackageUpdatingEventArgs> for ::windows::core::IInspectable { fn from(value: AppExtensionPackageUpdatingEventArgs) -> Self { value.0 } } impl ::core::convert::From<&AppExtensionPackageUpdatingEventArgs> for ::windows::core::IInspectable { fn from(value: &AppExtensionPackageUpdatingEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AppExtensionPackageUpdatingEventArgs { 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 AppExtensionPackageUpdatingEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for AppExtensionPackageUpdatingEventArgs {} unsafe impl ::core::marker::Sync for AppExtensionPackageUpdatingEventArgs {} #[repr(transparent)] #[doc(hidden)] pub struct IAppExtension(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAppExtension { type Vtable = IAppExtension_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8450902c_15ed_4faf_93ea_2237bbf8cbd6); } #[repr(C)] #[doc(hidden)] pub struct IAppExtension_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, 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, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Foundation_Collections")))] usize, #[cfg(all(feature = "Foundation", feature = "Storage"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Storage")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IAppExtension2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAppExtension2 { type Vtable = IAppExtension2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xab3b15f0_14f9_4b9f_9419_a349a242ef38); } #[repr(C)] #[doc(hidden)] pub struct IAppExtension2_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 IAppExtensionCatalog(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAppExtensionCatalog { type Vtable = IAppExtensionCatalog_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x97872032_8426_4ad1_9084_92e88c2da200); } #[repr(C)] #[doc(hidden)] pub struct IAppExtensionCatalog_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 = "Foundation", feature = "Foundation_Collections"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Foundation_Collections")))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, packagefullname: ::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, 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, token: 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, token: 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, token: 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, token: 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, token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IAppExtensionCatalogStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAppExtensionCatalogStatics { type Vtable = IAppExtensionCatalogStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3c36668a_5f18_4f0b_9ce5_cab61d196f11); } #[repr(C)] #[doc(hidden)] pub struct IAppExtensionCatalogStatics_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, appextensionname: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IAppExtensionPackageInstalledEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAppExtensionPackageInstalledEventArgs { type Vtable = IAppExtensionPackageInstalledEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x39e59234_3351_4a8d_9745_e7d3dd45bc48); } #[repr(C)] #[doc(hidden)] pub struct IAppExtensionPackageInstalledEventArgs_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 ::windows::core::RawPtr) -> ::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 IAppExtensionPackageStatusChangedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAppExtensionPackageStatusChangedEventArgs { type Vtable = IAppExtensionPackageStatusChangedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1ce17433_1153_44fd_87b1_8ae1050303df); } #[repr(C)] #[doc(hidden)] pub struct IAppExtensionPackageStatusChangedEventArgs_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 ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IAppExtensionPackageUninstallingEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAppExtensionPackageUninstallingEventArgs { type Vtable = IAppExtensionPackageUninstallingEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x60f160c5_171e_40ff_ae98_ab2c20dd4d75); } #[repr(C)] #[doc(hidden)] pub struct IAppExtensionPackageUninstallingEventArgs_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 ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IAppExtensionPackageUpdatedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAppExtensionPackageUpdatedEventArgs { type Vtable = IAppExtensionPackageUpdatedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3a83c43f_797e_44b5_ba24_a4c8b5a543d7); } #[repr(C)] #[doc(hidden)] pub struct IAppExtensionPackageUpdatedEventArgs_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 ::windows::core::RawPtr) -> ::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 IAppExtensionPackageUpdatingEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAppExtensionPackageUpdatingEventArgs { type Vtable = IAppExtensionPackageUpdatingEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7ed59329_1a65_4800_a700_b321009e306a); } #[repr(C)] #[doc(hidden)] pub struct IAppExtensionPackageUpdatingEventArgs_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 ::windows::core::RawPtr) -> ::windows::core::HRESULT, );
use super::{Expression, Id}; use crate::{ hir, id::CountableId, impl_countable_id, rich_ir::{RichIrBuilder, ToRichIr, TokenType}, }; use enumset::EnumSet; use itertools::Itertools; use rustc_hash::FxHashSet; use std::fmt::{self, Debug, Display, Formatter}; // ID #[derive(Clone, Copy, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct BodyId(usize); impl_countable_id!(BodyId); impl Debug for BodyId { fn fmt(&self, f: &mut Formatter) -> fmt::Result { write!(f, "body_{}", self.0) } } impl Display for BodyId { fn fmt(&self, f: &mut Formatter) -> fmt::Result { write!(f, "body_{}", self.0) } } impl ToRichIr for BodyId { fn build_rich_ir(&self, builder: &mut RichIrBuilder) { let range = builder.push(self.to_string(), TokenType::Function, EnumSet::empty()); builder.push_reference(*self, range); } } // Bodies #[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct Bodies(Vec<Body>); impl Bodies { pub fn get(&self, id: BodyId) -> &Body { &self.0[id.to_usize()] } pub fn push(&mut self, constant: Body) -> BodyId { let id = BodyId::from_usize(self.0.len()); self.0.push(constant); id } fn ids_and_bodies(&self) -> impl Iterator<Item = (BodyId, &Body)> { self.0 .iter() .enumerate() .map(|(index, it)| (BodyId(index), it)) } } impl ToRichIr for Bodies { fn build_rich_ir(&self, builder: &mut RichIrBuilder) { builder.push_custom_multiline(self.ids_and_bodies(), |builder, (id, body)| { let range = builder.push(id.to_string(), TokenType::Function, EnumSet::empty()); builder.push_definition(*id, range); for parameter_id in body.parameter_ids() { builder.push(" ", None, EnumSet::empty()); let range = builder.push( parameter_id.to_string(), TokenType::Parameter, EnumSet::empty(), ); builder.push_definition(parameter_id, range); } let responsible_parameter_id = body.responsible_parameter_id(); builder.push( if body.parameter_count == 0 { " (responsible " } else { " (+ responsible " }, None, EnumSet::empty(), ); let range = builder.push( responsible_parameter_id.to_string(), TokenType::Parameter, EnumSet::empty(), ); builder.push_definition(responsible_parameter_id, range); builder.push(") =", None, EnumSet::empty()); builder.indent(); builder.push_newline(); body.build_rich_ir(builder); builder.dedent(); }) } } // Body /// IDs are assigned sequentially in the following order, starting at 0: /// /// - captured variables /// - parameters /// - responsible parameter /// - locals #[derive(Clone, Debug, Eq, PartialEq)] pub struct Body { original_hirs: FxHashSet<hir::Id>, captured_count: usize, parameter_count: usize, expressions: Vec<Expression>, } impl Body { pub fn new( original_hirs: FxHashSet<hir::Id>, captured_count: usize, parameter_count: usize, expressions: Vec<Expression>, ) -> Self { Self { original_hirs, captured_count, parameter_count, expressions, } } pub fn original_hirs(&self) -> &FxHashSet<hir::Id> { &self.original_hirs } pub fn captured_count(&self) -> usize { self.captured_count } fn captured_ids(&self) -> impl Iterator<Item = Id> { (0..self.captured_count).map(Id::from_usize) } pub fn parameter_count(&self) -> usize { self.parameter_count } fn parameter_ids(&self) -> impl Iterator<Item = Id> { (self.captured_count..self.captured_count + self.parameter_count).map(Id::from_usize) } fn responsible_parameter_id(&self) -> Id { Id::from_usize(self.captured_count + self.parameter_count) } pub fn expressions(&self) -> &[Expression] { &self.expressions } pub fn ids_and_expressions(&self) -> impl Iterator<Item = (Id, &Expression)> { let offset = self.captured_count + self.parameter_count + 1; self.expressions .iter() .enumerate() .map(move |(index, it)| (Id::from_usize(offset + index), it)) } } impl ToRichIr for Body { fn build_rich_ir(&self, builder: &mut RichIrBuilder) { builder.push("# Original HIR IDs: ", TokenType::Comment, EnumSet::empty()); builder.push_children_custom( self.original_hirs.iter().sorted(), |builder, id| { let range = builder.push(id.to_string(), TokenType::Symbol, EnumSet::empty()); builder.push_reference((*id).clone(), range); }, ", ", ); builder.push_newline(); builder.push("# Captured IDs: ", TokenType::Comment, EnumSet::empty()); if self.captured_ids().next().is_none() { builder.push("none", None, EnumSet::empty()); } else { builder.push_children_custom( self.captured_ids().collect_vec(), |builder, id| { let range = builder.push(id.to_string(), TokenType::Variable, EnumSet::empty()); builder.push_definition(*id, range); }, ", ", ); } builder.push_newline(); builder.push_custom_multiline(self.ids_and_expressions(), |builder, (id, expression)| { let range = builder.push(id.to_string(), TokenType::Variable, EnumSet::empty()); builder.push_definition(*id, range); builder.push(" = ", None, EnumSet::empty()); expression.build_rich_ir(builder); }); } }
#![allow(unknown_lints)] #![warn(clippy::all)] #![allow( clippy::too_many_arguments, clippy::cast_lossless, clippy::many_single_char_names )] use byteorder::{BigEndian as BE, ByteOrder}; use std::ops::Deref; #[derive(Copy, Clone, Debug)] pub struct FontInfo<Data: Deref<Target = [u8]>> { data: Data, // pointer to .ttf file // fontstart: usize, // offset of start of font num_glyphs: u32, // number of glyphs, needed for range checking loca: u32, head: u32, glyf: u32, hhea: u32, hmtx: u32, name: u32, kern: u32, // table locations as offset from start of .ttf index_map: u32, // a cmap mapping for our chosen character encoding index_to_loc_format: u32, // format needed to map from glyph index to glyph } #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] #[repr(C)] pub struct Vertex { pub x: i16, pub y: i16, pub cx: i16, pub cy: i16, type_: u8, } impl Vertex { pub fn vertex_type(&self) -> VertexType { match self.type_ { 1 => VertexType::MoveTo, 2 => VertexType::LineTo, 3 => VertexType::CurveTo, type_ => panic!("Invalid vertex type: {}", type_), } } } #[test] fn test_vertex_type() { fn v(type_: VertexType) -> Vertex { Vertex { x: 0, y: 0, cx: 0, cy: 0, type_: type_ as u8, } } assert_eq!(v(VertexType::MoveTo).vertex_type(), VertexType::MoveTo); assert_eq!(v(VertexType::LineTo).vertex_type(), VertexType::LineTo); assert_eq!(v(VertexType::CurveTo).vertex_type(), VertexType::CurveTo); } #[test] #[should_panic] fn test_invalid_vertex_type() { let v = Vertex { x: 0, y: 0, cx: 0, cy: 0, type_: 255, }; let s = match v.vertex_type() { VertexType::MoveTo => "move to", VertexType::LineTo => "line to", VertexType::CurveTo => "curve to", }; // With `Vertex::vertex_type` defined as `transmute` this would be undefined // behavior: println!("{}", s); } #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] #[repr(u8)] pub enum VertexType { MoveTo = 1, LineTo = 2, CurveTo = 3, } #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub struct Rect<T> { pub x0: T, pub y0: T, pub x1: T, pub y1: T, } #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub struct HMetrics { pub advance_width: i32, pub left_side_bearing: i32, } #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub struct VMetrics { pub ascent: i32, pub descent: i32, pub line_gap: i32, } #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(C)] pub enum PlatformId { // platformID Unicode = 0, Mac = 1, Iso = 2, Microsoft = 3, } fn platform_id(v: u16) -> Option<PlatformId> { use crate::PlatformId::*; match v { 0 => Some(Unicode), 1 => Some(Mac), 2 => Some(Iso), 3 => Some(Microsoft), _ => None, } } #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(C)] #[allow(non_camel_case_types)] pub enum UnicodeEid { // encodingID for PLATFORM_ID_UNICODE Unicode_1_0 = 0, Unicode_1_1 = 1, Iso_10646 = 2, Unicode_2_0_Bmp = 3, Unicode_2_0_Full = 4, } fn unicode_eid(v: u16) -> Option<UnicodeEid> { use crate::UnicodeEid::*; match v { 0 => Some(Unicode_1_0), 1 => Some(Unicode_1_1), 2 => Some(Iso_10646), 3 => Some(Unicode_2_0_Bmp), 4 => Some(Unicode_2_0_Full), _ => None, } } #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(C)] pub enum MicrosoftEid { // encodingID for PLATFORM_ID_MICROSOFT Symbol = 0, UnicodeBMP = 1, Shiftjis = 2, UnicodeFull = 10, } fn microsoft_eid(v: u16) -> Option<MicrosoftEid> { use crate::MicrosoftEid::*; match v { 0 => Some(Symbol), 1 => Some(UnicodeBMP), 2 => Some(Shiftjis), 10 => Some(UnicodeFull), _ => None, } } #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(C)] pub enum MacEid { // encodingID for PLATFORM_ID_MAC; same as Script Manager codes Roman = 0, Arabic = 4, Japanese = 1, Hebrew = 5, ChineseTrad = 2, Greek = 6, Korean = 3, Russian = 7, } fn mac_eid(v: u16) -> Option<MacEid> { use crate::MacEid::*; match v { 0 => Some(Roman), 1 => Some(Japanese), 2 => Some(ChineseTrad), 3 => Some(Korean), 4 => Some(Arabic), 5 => Some(Hebrew), 6 => Some(Greek), 7 => Some(Russian), _ => None, } } #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(C)] pub enum MicrosoftLang { // languageID for PLATFORM_ID_MICROSOFT; same as LCID... // problematic because there are e.g. 16 english LCIDs and 16 arabic LCIDs English = 0x0409, Italian = 0x0410, Chinese = 0x0804, Japanese = 0x0411, Dutch = 0x0413, Korean = 0x0412, French = 0x040c, Russian = 0x0419, German = 0x0407, // Spanish = 0x0409, Hebrew = 0x040d, Swedish = 0x041D, } fn microsoft_lang(v: u16) -> Option<MicrosoftLang> { use crate::MicrosoftLang::*; match v { 0x0409 => Some(English), 0x0804 => Some(Chinese), 0x0413 => Some(Dutch), 0x040c => Some(French), 0x0407 => Some(German), 0x040d => Some(Hebrew), 0x0410 => Some(Italian), 0x0411 => Some(Japanese), 0x0412 => Some(Korean), 0x0419 => Some(Russian), 0x041D => Some(Swedish), _ => None, } } #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(C)] pub enum MacLang { // languageID for PLATFORM_ID_MAC English = 0, Japanese = 11, Arabic = 12, Korean = 23, Dutch = 4, Russian = 32, French = 1, Spanish = 6, German = 2, Swedish = 5, Hebrew = 10, ChineseSimplified = 33, Italian = 3, ChineseTrad = 19, } fn mac_lang(v: u16) -> Option<MacLang> { use crate::MacLang::*; match v { 0 => Some(English), 12 => Some(Arabic), 4 => Some(Dutch), 1 => Some(French), 2 => Some(German), 10 => Some(Hebrew), 3 => Some(Italian), 11 => Some(Japanese), 23 => Some(Korean), 32 => Some(Russian), 6 => Some(Spanish), 5 => Some(Swedish), 33 => Some(ChineseSimplified), 19 => Some(ChineseTrad), _ => None, } } #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum PlatformEncodingLanguageId { Unicode(Option<Result<UnicodeEid, u16>>, Option<u16>), Mac(Option<Result<MacEid, u16>>, Option<Result<MacLang, u16>>), Iso(Option<u16>, Option<u16>), Microsoft( Option<Result<MicrosoftEid, u16>>, Option<Result<MicrosoftLang, u16>>, ), } fn platform_encoding_id( platform_id: PlatformId, encoding_id: Option<u16>, language_id: Option<u16>, ) -> PlatformEncodingLanguageId { match platform_id { PlatformId::Unicode => PlatformEncodingLanguageId::Unicode( encoding_id.map(|id| unicode_eid(id).ok_or(id)), language_id, ), PlatformId::Mac => PlatformEncodingLanguageId::Mac( encoding_id.map(|id| mac_eid(id).ok_or(id)), language_id.map(|id| mac_lang(id).ok_or(id)), ), PlatformId::Iso => PlatformEncodingLanguageId::Iso(encoding_id, language_id), PlatformId::Microsoft => PlatformEncodingLanguageId::Microsoft( encoding_id.map(|id| microsoft_eid(id).ok_or(id)), language_id.map(|id| microsoft_lang(id).ok_or(id)), ), } } // # accessors to parse data from file // on platforms that don't allow misaligned reads, if we want to allow // truetype fonts that aren't padded to alignment, define // ALLOW_UNALIGNED_TRUETYPE /// Return `true` if `data` holds a font stored in a format this crate /// recognizes, according to its signature in the initial bytes. pub fn is_font(data: &[u8]) -> bool { if data.len() >= 4 { let tag = &data[0..4]; tag == [b'1', 0, 0, 0] || tag == b"typ1" || tag == b"OTTO" || tag == [0, 1, 0, 0] } else { false } } /// Return `true` if `data` holds a TrueType Collection, according to its /// signature in the initial bytes. A TrueType Collection stores several fonts /// in a single file, allowing them to share data for glyphs they have in /// common. pub fn is_collection(data: &[u8]) -> bool { data.len() >= 4 && &data[0..4] == b"ttcf" } fn find_table(data: &[u8], fontstart: usize, tag: &[u8]) -> u32 { let num_tables = BE::read_u16(&data[fontstart + 4..]); let tabledir = fontstart + 12; for i in 0..num_tables { let loc = tabledir + 16 * (i as usize); if &data[loc..loc + 4] == tag { return BE::read_u32(&data[loc + 8..]); } } 0 } /// Each .ttf/.ttc file may have more than one font. Each font has a sequential /// index number starting from 0. Call this function to get the font offset for /// a given index; it returns None if the index is out of range. A regular .ttf /// file will only define one font and it always be at offset 0, so it will /// return Some(0) for index 0, and None for all other indices. You can just /// skip this step if you know it's that kind of font. pub fn get_font_offset_for_index(font_collection: &[u8], index: i32) -> Option<u32> { // if it's just a font, there's only one valid index if is_font(font_collection) { return if index == 0 { Some(0) } else { None }; } // check if it's a TTC if is_collection(font_collection) && (BE::read_u32(&font_collection[4..]) == 0x0001_0000 || BE::read_u32(&font_collection[4..]) == 0x0002_0000) { let n = BE::read_i32(&font_collection[8..]); if index >= n { return None; } return Some(BE::read_u32(&font_collection[12 + (index as usize) * 4..])); } None } macro_rules! read_ints { ($n:expr, i16, $data:expr) => {{ let mut nums = [0; $n]; let data = $data; BE::read_i16_into(&data[..$n * 2], &mut nums); nums }}; ($n:expr, u16, $data:expr) => {{ let mut nums = [0; $n]; let data = $data; BE::read_u16_into(&data[..$n * 2], &mut nums); nums }}; ($n:expr, u32, $data:expr) => {{ let mut nums = [0; $n]; let data = $data; BE::read_u32_into(&data[..$n * 4], &mut nums); nums }}; } impl<Data: Deref<Target = [u8]>> FontInfo<Data> { /// Given an offset into the file that defines a font, this function builds /// the necessary cached info for the rest of the system. pub fn new(data: Data, fontstart: usize) -> Option<FontInfo<Data>> { let cmap = find_table(&data, fontstart, b"cmap"); // required let loca = find_table(&data, fontstart, b"loca"); // required let head = find_table(&data, fontstart, b"head"); // required let glyf = find_table(&data, fontstart, b"glyf"); // required let hhea = find_table(&data, fontstart, b"hhea"); // required let hmtx = find_table(&data, fontstart, b"hmtx"); // required let name = find_table(&data, fontstart, b"name"); // not required let kern = find_table(&data, fontstart, b"kern"); // not required if cmap == 0 || loca == 0 || head == 0 || glyf == 0 || hhea == 0 || hmtx == 0 { return None; } let t = find_table(&data, fontstart, b"maxp"); let num_glyphs = if t != 0 { BE::read_u16(&data[t as usize + 4..]) } else { 0xffff }; // find a cmap encoding table we understand *now* to avoid searching // later. (todo: could make this installable) // the same regardless of glyph. let num_tables = BE::read_u16(&data[cmap as usize + 2..]); let mut index_map = 0; for i in 0..num_tables { let encoding_record = (cmap + 4 + 8 * (i as u32)) as usize; // find an encoding we understand: match platform_id(BE::read_u16(&data[encoding_record..])) { Some(PlatformId::Microsoft) => { match microsoft_eid(BE::read_u16(&data[encoding_record + 2..])) { Some(MicrosoftEid::UnicodeBMP) | Some(MicrosoftEid::UnicodeFull) => { // MS/Unicode index_map = cmap + BE::read_u32(&data[encoding_record + 4..]); } _ => (), } } Some(PlatformId::Unicode) => { // Mac/iOS has these // all the encodingIDs are unicode, so we don't bother to check it index_map = cmap + BE::read_u32(&data[encoding_record + 4..]); } _ => (), } } if index_map == 0 { return None; } let index_to_loc_format = BE::read_u16(&data[head as usize + 50..]) as u32; Some(FontInfo { // fontstart: fontstart, data, loca, head, glyf, hhea, hmtx, name, kern, num_glyphs: num_glyphs as u32, index_map, index_to_loc_format, }) } pub fn get_num_glyphs(&self) -> u32 { self.num_glyphs } /// If you're going to perform multiple operations on the same character /// and you want a speed-up, call this function with the character you're /// going to process, then use glyph-based functions instead of the /// codepoint-based functions. pub fn find_glyph_index(&self, unicode_codepoint: u32) -> u32 { let data = &self.data; let index_map = &data[self.index_map as usize..]; //self.index_map as usize; let format = BE::read_u16(index_map); match format { 0 => { // apple byte encoding let bytes = BE::read_u16(&index_map[2..]); if unicode_codepoint < bytes as u32 - 6 { return index_map[6 + unicode_codepoint as usize] as u32; } 0 } 6 => { let first = BE::read_u16(&index_map[6..]) as u32; let count = BE::read_u16(&index_map[8..]) as u32; if unicode_codepoint >= first && unicode_codepoint < first + count { return BE::read_u16(&index_map[10 + (unicode_codepoint - first) as usize * 2..]) as u32; } 0 } 2 => { // @TODO: high-byte mapping for japanese/chinese/korean panic!("Index map format unsupported: 2"); } 4 => { // standard mapping for windows fonts: binary search collection of ranges let segcount = BE::read_u16(&index_map[6..]) as usize >> 1; let mut search_range = BE::read_u16(&index_map[8..]) as usize >> 1; let mut entry_selector = BE::read_u16(&index_map[10..]); let range_shift = BE::read_u16(&index_map[12..]) as usize >> 1; // do a binary search of the segments let end_count = self.index_map as usize + 14; let mut search = end_count; if unicode_codepoint > 0xffff { return 0; } // they lie from endCount .. endCount + segCount // but searchRange is the nearest power of two, so... if unicode_codepoint >= BE::read_u16(&data[search + range_shift * 2..]) as u32 { search += range_shift * 2; } // now decrement to bias correctly to find smallest search -= 2; while entry_selector != 0 { search_range >>= 1; let end = BE::read_u16(&data[search + search_range * 2..]) as u32; if unicode_codepoint > end { search += search_range * 2; } entry_selector -= 1; } search += 2; { let item = (search - end_count) >> 1; assert!( unicode_codepoint <= BE::read_u16(&data[end_count + 2 * item..]) as u32 ); let start = BE::read_u16(&index_map[14 + segcount * 2 + 2 + 2 * item..]) as u32; if unicode_codepoint < start { return 0; } let offset = BE::read_u16(&index_map[14 + segcount * 6 + 2 + 2 * item..]) as usize; if offset == 0 { return (unicode_codepoint as i32 + BE::read_i16(&index_map[14 + segcount * 4 + 2 + 2 * item..]) as i32) as u16 as u32; } BE::read_u16( &index_map[offset + (unicode_codepoint - start) as usize * 2 + 14 + segcount * 6 + 2 + 2 * item..], ) as u32 } } 12 | 13 => { let mut low = 0u32; let mut high = BE::read_u32(&index_map[12..]); let groups = &index_map[16..]; // Binary search of the right group while low < high { let mid = (low + high) / 2; // rounds down, so low <= mid < high let mid12 = (mid * 12) as usize; let group = &groups[mid12..mid12 + 12]; let start_char = BE::read_u32(group); if unicode_codepoint < start_char { high = mid; } else if unicode_codepoint > BE::read_u32(&group[4..]) { low = mid + 1; } else { let start_glyph = BE::read_u32(&group[8..]); if format == 12 { return start_glyph + unicode_codepoint - start_char; } else { return start_glyph; } } } 0 } n => panic!("Index map format unsupported: {}", n), } } /// Returns the series of vertices encoding the shape of the glyph for this /// codepoint. /// /// The shape is a series of countours. Each one starts with /// a moveto, then consists of a series of mixed /// lineto and curveto segments. A lineto /// draws a line from previous endpoint to its x,y; a curveto /// draws a quadratic bezier from previous endpoint to /// its x,y, using cx,cy as the bezier control point. pub fn get_codepoint_shape(&self, unicode_codepoint: u32) -> Option<Vec<Vertex>> { self.get_glyph_shape(self.find_glyph_index(unicode_codepoint)) } fn get_glyf_offset(&self, glyph_index: u32) -> Option<u32> { if glyph_index >= self.num_glyphs || self.index_to_loc_format >= 2 { // glyph index out of range or unknown index->glyph map format return None; } let [g1, g2] = if self.index_to_loc_format == 0 { let d = &self.data[(self.loca + glyph_index * 2) as usize..]; let [g1, g2] = read_ints!(2, u16, d); [g1 as u32 * 2, g2 as u32 * 2] } else { read_ints!(2, u32, &self.data[(self.loca + glyph_index * 4) as usize..]) }; if g1 == g2 { None } else { Some(self.glyf + g1) } } /// Like `get_codepoint_box`, but takes a glyph index. Use this if you have /// cached the glyph index for a codepoint. pub fn get_glyph_box(&self, glyph_index: u32) -> Option<Rect<i16>> { let g = self.get_glyf_offset(glyph_index)? as usize; let [x0, y0, x1, y1] = read_ints!(4, i16, &self.data[g + 2..]); Some(Rect { x0, y0, x1, y1 }) } /// Gets the bounding box of the visible part of the glyph, in unscaled /// coordinates pub fn get_codepoint_box(&self, codepoint: u32) -> Option<Rect<i16>> { self.get_glyph_box(self.find_glyph_index(codepoint)) } /// returns true if nothing is drawn for this glyph pub fn is_glyph_empty(&self, glyph_index: u32) -> bool { match self.get_glyf_offset(glyph_index) { Some(g) => { let number_of_contours = BE::read_i16(&self.data[g as usize..]); number_of_contours == 0 } None => true, } } /// Like `get_codepoint_shape`, but takes a glyph index instead. Use this /// if you have cached the glyph index for a codepoint. pub fn get_glyph_shape(&self, glyph_index: u32) -> Option<Vec<Vertex>> { let g = match self.get_glyf_offset(glyph_index) { Some(g) => &self.data[g as usize..], None => return None, }; let number_of_contours = BE::read_i16(g); let vertices: Vec<Vertex> = if number_of_contours > 0 { self.glyph_shape_positive_contours(g, number_of_contours as usize) } else if number_of_contours == -1 { // Compound shapes let mut more = true; let mut comp = &g[10..]; let mut vertices = Vec::new(); while more { let mut mtx = [1.0, 0.0, 0.0, 1.0, 0.0, 0.0]; let [flags, gidx] = read_ints!(2, i16, comp); comp = &comp[4..]; let gidx = gidx as u16; if flags & 2 != 0 { // XY values if flags & 1 != 0 { // shorts let [a, b] = read_ints!(2, i16, comp); comp = &comp[4..]; mtx[4] = a as f32; mtx[5] = b as f32; } else { mtx[4] = (comp[0] as i8) as f32; mtx[5] = (comp[1] as i8) as f32; comp = &comp[2..]; } } else { panic!("Matching points not supported."); } if flags & (1 << 3) != 0 { // WE_HAVE_A_SCALE mtx[0] = BE::read_i16(comp) as f32 / 16384.0; comp = &comp[2..]; mtx[1] = 0.0; mtx[2] = 0.0; mtx[3] = mtx[0]; } else if flags & (1 << 6) != 0 { // WE_HAVE_AN_X_AND_YSCALE let [a, b] = read_ints!(2, i16, comp); comp = &comp[4..]; mtx[0] = a as f32 / 16384.0; mtx[1] = 0.0; mtx[2] = 0.0; mtx[3] = b as f32 / 16384.0; } else if flags & (1 << 7) != 0 { // WE_HAVE_A_TWO_BY_TWO let [a, b, c, d] = read_ints!(4, i16, comp); comp = &comp[8..]; mtx[0] = a as f32 / 16384.0; mtx[1] = b as f32 / 16384.0; mtx[2] = c as f32 / 16384.0; mtx[3] = d as f32 / 16384.0; } // Find transformation scales. let m = (mtx[0] * mtx[0] + mtx[1] * mtx[1]).sqrt(); let n = (mtx[2] * mtx[2] + mtx[3] * mtx[3]).sqrt(); // Get indexed glyph. let mut comp_verts = self.get_glyph_shape(gidx as u32).unwrap_or_else(Vec::new); if !comp_verts.is_empty() { // Transform vertices for v in &mut *comp_verts { let (x, y, cx, cy) = (v.x as f32, v.y as f32, v.cx as f32, v.cy as f32); *v = Vertex { type_: v.type_, x: (m * (mtx[0] * x + mtx[2] * y + mtx[4])) as i16, y: (n * (mtx[1] * x + mtx[3] * y + mtx[5])) as i16, cx: (m * (mtx[0] * cx + mtx[2] * cy + mtx[4])) as i16, cy: (n * (mtx[1] * cx + mtx[3] * cy + mtx[5])) as i16, }; } // Append vertices. vertices.append(&mut comp_verts); } // More components ? more = flags & (1 << 5) != 0; } vertices } else if number_of_contours < 0 { panic!("Contour format not supported.") } else { return None; }; Some(vertices) } #[inline] fn glyph_shape_positive_contours( &self, glyph_data: &[u8], number_of_contours: usize, ) -> Vec<Vertex> { use crate::VertexType::*; struct FlagData { flags: u8, x: i16, y: i16, } #[inline] fn close_shape( vertices: &mut Vec<Vertex>, was_off: bool, start_off: bool, sx: i16, sy: i16, scx: i16, scy: i16, cx: i16, cy: i16, ) { if start_off { if was_off { vertices.push(Vertex { type_: CurveTo as u8, x: (cx + scx) >> 1, y: (cy + scy) >> 1, cx, cy, }); } vertices.push(Vertex { type_: CurveTo as u8, x: sx, y: sy, cx: scx, cy: scy, }); } else { vertices.push(if was_off { Vertex { type_: CurveTo as u8, x: sx, y: sy, cx, cy, } } else { Vertex { type_: LineTo as u8, x: sx, y: sy, cx: 0, cy: 0, } }); } } let number_of_contours = number_of_contours as usize; let mut start_off = false; let mut was_off = false; let end_points_of_contours = &glyph_data[10..]; let ins = BE::read_u16(&glyph_data[10 + number_of_contours * 2..]) as usize; let mut points = &glyph_data[10 + number_of_contours * 2 + 2 + ins..]; let n = 1 + BE::read_u16(&end_points_of_contours[number_of_contours * 2 - 2..]) as usize; let m = n + 2 * number_of_contours; // a loose bound on how many vertices we might need let mut vertices: Vec<Vertex> = Vec::with_capacity(m); let mut flag_data = Vec::with_capacity(n); let mut next_move = 0; // in first pass, we load uninterpreted data into the allocated array above // first load flags { let mut flagcount = 0; let mut flags = 0; for _ in 0..n { if flagcount == 0 { flags = points[0]; if flags & 8 != 0 { flagcount = points[1]; points = &points[2..]; } else { points = &points[1..]; } } else { flagcount -= 1; } flag_data.push(FlagData { flags, x: 0, y: 0 }); } } // now load x coordinates let mut x_coord = 0_i16; for flag_data in &mut flag_data { let flags = flag_data.flags; if flags & 2 != 0 { let dx = i16::from(points[0]); points = &points[1..]; if flags & 16 != 0 { // ??? x_coord += dx; } else { x_coord -= dx; } } else if flags & 16 == 0 { x_coord += BE::read_i16(points); points = &points[2..]; } flag_data.x = x_coord; } // now load y coordinates let mut y_coord = 0_i16; for flag_data in &mut flag_data { let flags = flag_data.flags; if flags & 4 != 0 { let dy = i16::from(points[0]); points = &points[1..]; if flags & 32 != 0 { y_coord += dy; } else { y_coord -= dy; } } else if flags & 32 == 0 { y_coord += BE::read_i16(points); points = &points[2..]; } flag_data.y = y_coord; } // now convert them to our format let mut sx = 0; let mut sy = 0; let mut cx = 0; let mut cy = 0; let mut scx = 0; let mut scy = 0; let mut j = 0; let mut iter = flag_data.into_iter().enumerate().peekable(); while let Some((index, FlagData { flags, x, y })) = iter.next() { if next_move == index { if index != 0 { close_shape(&mut vertices, was_off, start_off, sx, sy, scx, scy, cx, cy); } // now start the new one start_off = flags & 1 == 0; if start_off { // if we start off with an off-curve point, then when we need to find a // point on the curve where we can start, and we // need to save some state for // when we wraparound. scx = x; scy = y; let (next_flags, next_x, next_y) = match iter.peek() { Some((_, fd)) => (fd.flags, fd.x, fd.y), None => break, }; if next_flags & 1 == 0 { // next point is also a curve point, so interpolate an on-point curve sx = (x + next_x) >> 1; sy = (y + next_y) >> 1; } else { // otherwise just use the next point as our start point sx = next_x; sy = next_y; // we're using point i+1 as the starting point, so skip it let _ = iter.next(); } } else { sx = x; sy = y; } vertices.push(Vertex { type_: MoveTo as u8, x: sx, y: sy, cx: 0, cy: 0, }); was_off = false; next_move = 1 + BE::read_u16(&end_points_of_contours[j * 2..]) as usize; j += 1; } else if flags & 1 == 0 { // if it's a curve if was_off { // two off-curve control points in a row means interpolate an on-curve // midpoint vertices.push(Vertex { type_: CurveTo as u8, x: ((cx + x) >> 1), y: ((cy + y) >> 1), cx, cy, }); } cx = x; cy = y; was_off = true; } else { vertices.push(if was_off { Vertex { type_: CurveTo as u8, x, y, cx, cy, } } else { Vertex { type_: LineTo as u8, x, y, cx: 0, cy: 0, } }); was_off = false; } } close_shape( &mut vertices, // &mut num_vertices, was_off, start_off, sx, sy, scx, scy, cx, cy, ); vertices } /// like `get_codepoint_h_metrics`, but takes a glyph index instead. Use /// this if you have cached the glyph index for a codepoint. pub fn get_glyph_h_metrics(&self, glyph_index: u32) -> HMetrics { let num_of_long_hor_metrics = BE::read_u16(&self.data[self.hhea as usize + 34..]) as usize; let glyph_index = glyph_index as usize; if glyph_index < num_of_long_hor_metrics { let data = &self.data[self.hmtx as usize + 4 * glyph_index..]; let [advance_width, left_side_bearing] = read_ints!(2, i16, data); HMetrics { advance_width: i32::from(advance_width), left_side_bearing: i32::from(left_side_bearing), } } else { HMetrics { advance_width: BE::read_i16( &self.data[self.hmtx as usize + 4 * (num_of_long_hor_metrics - 1)..], ) as i32, left_side_bearing: BE::read_i16( &self.data[self.hmtx as usize + 4 * num_of_long_hor_metrics + 2 * (glyph_index as isize - num_of_long_hor_metrics as isize) as usize..], ) as i32, } } } /// like `get_codepoint_kern_advance`, but takes glyph indices instead. Use /// this if you have cached the glyph indices for the codepoints. pub fn get_glyph_kern_advance(&self, glyph_1: u32, glyph_2: u32) -> i32 { let kern = &self.data[self.kern as usize..]; // we only look at the first table. it must be 'horizontal' and format 0 if self.kern == 0 || BE::read_u16(&kern[2..]) < 1 || BE::read_u16(&kern[8..]) != 1 { // kern not present, OR // no tables (need at least one), OR // horizontal flag not set in format return 0; } let mut l: i32 = 0; let mut r: i32 = BE::read_u16(&kern[10..]) as i32 - 1; let needle = glyph_1 << 16 | glyph_2; while l <= r { let m = (l + r) >> 1; let straw = BE::read_u32(&kern[18 + (m as usize) * 6..]); // note: unaligned read if needle < straw { r = m - 1; } else if needle > straw { l = m + 1; } else { return BE::read_i16(&kern[22 + (m as usize) * 6..]) as i32; } } 0 } /// an additional amount to add to the 'advance' value between cp1 and cp2 pub fn get_codepoint_kern_advance(&self, cp1: u32, cp2: u32) -> i32 { if self.kern == 0 { // if no kerning table, don't waste time looking up both codepoint->glyphs 0 } else { self.get_glyph_kern_advance(self.find_glyph_index(cp1), self.find_glyph_index(cp2)) } } /// `left_side_bearing` is the offset from the current horizontal position /// to the left edge of the character `advance_width` is the offset /// from the current horizontal position to the next horizontal /// position these are /// expressed in unscaled /// coordinates pub fn get_codepoint_h_metrics(&self, codepoint: u32) -> HMetrics { self.get_glyph_h_metrics(self.find_glyph_index(codepoint)) } /// `ascent` is the coordinate above the baseline the font extends; descent /// is the coordinate below the baseline the font extends (i.e. it is /// typically negative) `line_gap` is the spacing between one row's /// descent and the next row's ascent... so you should advance the /// vertical position by `ascent - /// descent + line_gap` these are expressed in unscaled coordinates, so /// you must multiply by the scale factor for a given size pub fn get_v_metrics(&self) -> VMetrics { let hhea = &self.data[self.hhea as usize..]; let [ascent, descent, line_gap] = read_ints!(3, i16, &hhea[4..]); VMetrics { ascent: i32::from(ascent), descent: i32::from(descent), line_gap: i32::from(line_gap), } } /// the bounding box around all possible characters pub fn get_bounding_box(&self) -> Rect<i16> { let head = &self.data[self.head as usize..]; Rect { x0: BE::read_i16(&head[36..]), y0: BE::read_i16(&head[38..]), x1: BE::read_i16(&head[40..]), y1: BE::read_i16(&head[42..]), } } /// computes a scale factor to produce a font whose "height" is 'pixels' /// tall. Height is measured as the distance from the highest ascender /// to the lowest descender; in other words, it's equivalent to calling /// GetFontVMetrics and computing: /// scale = pixels / (ascent - descent) /// so if you prefer to measure height by the ascent only, use a similar /// calculation. pub fn scale_for_pixel_height(&self, height: f32) -> f32 { let hhea = &self.data[self.hhea as usize..]; let fheight = { let [a, b] = read_ints!(2, i16, &hhea[4..]); f32::from(a) - f32::from(b) }; height / fheight } /// Returns the units per EM square of this font. pub fn units_per_em(&self) -> u16 { BE::read_u16(&self.data[self.head as usize + 18..]) } /// computes a scale factor to produce a font whose EM size is mapped to /// `pixels` tall. This is probably what traditional APIs compute, but /// I'm not positive. pub fn scale_for_mapping_em_to_pixels(&self, pixels: f32) -> f32 { pixels / (self.units_per_em() as f32) } /// like `get_codepoint_bitmap_box_subpixel`, but takes a glyph index /// instead of a codepoint. pub fn get_glyph_bitmap_box_subpixel( &self, glyph: u32, scale_x: f32, scale_y: f32, shift_x: f32, shift_y: f32, ) -> Option<Rect<i32>> { if let Some(glyph_box) = self.get_glyph_box(glyph) { // move to integral bboxes (treating pixels as little squares, what pixels get // touched?) Some(Rect { x0: (glyph_box.x0 as f32 * scale_x + shift_x).floor() as i32, y0: (-glyph_box.y1 as f32 * scale_y + shift_y).floor() as i32, x1: (glyph_box.x1 as f32 * scale_x + shift_x).ceil() as i32, y1: (-glyph_box.y0 as f32 * scale_y + shift_y).ceil() as i32, }) } else { // e.g. space character None } } /// like `get_codepoint_bitmap_box`, but takes a glyph index instead of a /// codepoint. pub fn get_glyph_bitmap_box( &self, glyph: u32, scale_x: f32, scale_y: f32, ) -> Option<Rect<i32>> { self.get_glyph_bitmap_box_subpixel(glyph, scale_x, scale_y, 0.0, 0.0) } /// same as get_codepoint_bitmap_box, but you can specify a subpixel /// shift for the character pub fn get_codepoint_bitmap_box_subpixel( &self, codepoint: u32, scale_x: f32, scale_y: f32, shift_x: f32, shift_y: f32, ) -> Option<Rect<i32>> { self.get_glyph_bitmap_box_subpixel( self.find_glyph_index(codepoint), scale_x, scale_y, shift_x, shift_y, ) } /// get the bounding box of the bitmap centered around the glyph origin; so /// the bitmap width is x1-x0, height is y1-y0, and location to place /// the bitmap top left is (left_side_bearing*scale, y0). /// (Note that the bitmap uses y-increases-down, but the shape uses /// y-increases-up, so CodepointBitmapBox and CodepointBox are inverted.) pub fn get_codepoint_bitmap_box( &self, codepoint: u32, scale_x: f32, scale_y: f32, ) -> Option<Rect<i32>> { self.get_codepoint_bitmap_box_subpixel(codepoint, scale_x, scale_y, 0.0, 0.0) } pub fn get_font_name_strings(&self) -> FontNameIter<'_, Data> { let nm = self.name as usize; if nm == 0 { return FontNameIter { font_info: &self, string_offset: 0, index: 0, count: 0, }; } let count = BE::read_u16(&self.data[nm + 2..]) as usize; let string_offset = nm + BE::read_u16(&self.data[nm + 4..]) as usize; FontNameIter { font_info: &self, string_offset, index: 0, count, } } } #[derive(Clone, Copy, Debug)] pub struct FontNameIter<'a, Data: Deref<Target = [u8]>> { /// Font info. font_info: &'a FontInfo<Data>, string_offset: usize, /// Next index. index: usize, /// Number of name strings. count: usize, } impl<'a, Data: 'a + Deref<Target = [u8]>> Iterator for FontNameIter<'a, Data> { type Item = (&'a [u8], Option<PlatformEncodingLanguageId>, u16); fn next(&mut self) -> Option<Self::Item> { if self.index >= self.count { return None; } let loc = self.font_info.name as usize + 6 + 12 * self.index; let pl_id = platform_id(BE::read_u16(&self.font_info.data[loc..])); let platform_encoding_language_id = pl_id.map(|pl_id| { let encoding_id = BE::read_u16(&self.font_info.data[loc + 2..]); let language_id = BE::read_u16(&self.font_info.data[loc + 4..]); platform_encoding_id(pl_id, Some(encoding_id), Some(language_id)) }); // @TODO: Define an enum type for Name ID. // See https://www.microsoft.com/typography/otspec/name.htm, "Name IDs" section. let name_id = BE::read_u16(&self.font_info.data[loc + 6..]); let length = BE::read_u16(&self.font_info.data[loc + 8..]) as usize; let offset = self.string_offset + BE::read_u16(&self.font_info.data[loc + 10..]) as usize; self.index += 1; Some(( &self.font_info.data[offset..offset + length], platform_encoding_language_id, name_id, )) } fn size_hint(&self) -> (usize, Option<usize>) { let remaining = self.count - self.index; (remaining, Some(remaining)) } fn count(self) -> usize { self.count - self.index } fn last(mut self) -> Option<Self::Item> { if self.index >= self.count || self.count == 0 { return None; } self.index = self.count - 1; self.next() } fn nth(&mut self, n: usize) -> Option<Self::Item> { if n > self.count - self.index { self.index = self.count; return None; } self.index += n; self.next() } }
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtCore/qregularexpression.h // dst-file: /src/core/qregularexpression.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::qregularexpression::QRegularExpressionMatch; // 773 // use super::qregularexpression::QRegularExpression; // 773 use super::qstring::*; // 773 use super::qstringlist::*; // 773 // <= use block end // ext block begin => // #[link(name = "Qt5Core")] // #[link(name = "Qt5Gui")] // #[link(name = "Qt5Widgets")] // #[link(name = "QtInline")] extern { fn QRegularExpressionMatchIterator_Class_Size() -> c_int; // proto: bool QRegularExpressionMatchIterator::hasNext(); fn C_ZNK31QRegularExpressionMatchIterator7hasNextEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: bool QRegularExpressionMatchIterator::isValid(); fn C_ZNK31QRegularExpressionMatchIterator7isValidEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QRegularExpressionMatch QRegularExpressionMatchIterator::peekNext(); fn C_ZNK31QRegularExpressionMatchIterator8peekNextEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QRegularExpressionMatchIterator::QRegularExpressionMatchIterator(); fn C_ZN31QRegularExpressionMatchIteratorC2Ev() -> u64; // proto: QRegularExpression QRegularExpressionMatchIterator::regularExpression(); fn C_ZNK31QRegularExpressionMatchIterator17regularExpressionEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QRegularExpressionMatchIterator::QRegularExpressionMatchIterator(const QRegularExpressionMatchIterator & iterator); fn C_ZN31QRegularExpressionMatchIteratorC2ERKS_(arg0: *mut c_void) -> u64; // proto: void QRegularExpressionMatchIterator::~QRegularExpressionMatchIterator(); fn C_ZN31QRegularExpressionMatchIteratorD2Ev(qthis: u64 /* *mut c_void*/); // proto: QRegularExpressionMatch QRegularExpressionMatchIterator::next(); fn C_ZN31QRegularExpressionMatchIterator4nextEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QRegularExpressionMatchIterator::swap(QRegularExpressionMatchIterator & other); fn C_ZN31QRegularExpressionMatchIterator4swapERS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); fn QRegularExpression_Class_Size() -> c_int; // proto: int QRegularExpression::patternErrorOffset(); fn C_ZNK18QRegularExpression18patternErrorOffsetEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: QString QRegularExpression::pattern(); fn C_ZNK18QRegularExpression7patternEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QRegularExpression::~QRegularExpression(); fn C_ZN18QRegularExpressionD2Ev(qthis: u64 /* *mut c_void*/); // proto: void QRegularExpression::optimize(); fn C_ZNK18QRegularExpression8optimizeEv(qthis: u64 /* *mut c_void*/); // proto: static QString QRegularExpression::escape(const QString & str); fn C_ZN18QRegularExpression6escapeERK7QString(arg0: *mut c_void) -> *mut c_void; // proto: void QRegularExpression::QRegularExpression(); fn C_ZN18QRegularExpressionC2Ev() -> u64; // proto: void QRegularExpression::swap(QRegularExpression & other); fn C_ZN18QRegularExpression4swapERS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QString QRegularExpression::errorString(); fn C_ZNK18QRegularExpression11errorStringEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: bool QRegularExpression::isValid(); fn C_ZNK18QRegularExpression7isValidEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: void QRegularExpression::QRegularExpression(const QRegularExpression & re); fn C_ZN18QRegularExpressionC2ERKS_(arg0: *mut c_void) -> u64; // proto: QStringList QRegularExpression::namedCaptureGroups(); fn C_ZNK18QRegularExpression18namedCaptureGroupsEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: int QRegularExpression::captureCount(); fn C_ZNK18QRegularExpression12captureCountEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QRegularExpression::setPattern(const QString & pattern); fn C_ZN18QRegularExpression10setPatternERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); fn QRegularExpressionMatch_Class_Size() -> c_int; // proto: int QRegularExpressionMatch::lastCapturedIndex(); fn C_ZNK23QRegularExpressionMatch17lastCapturedIndexEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QRegularExpressionMatch::QRegularExpressionMatch(); fn C_ZN23QRegularExpressionMatchC2Ev() -> u64; // proto: bool QRegularExpressionMatch::isValid(); fn C_ZNK23QRegularExpressionMatch7isValidEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: int QRegularExpressionMatch::capturedLength(int nth); fn C_ZNK23QRegularExpressionMatch14capturedLengthEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_int; // proto: int QRegularExpressionMatch::capturedLength(const QString & name); fn C_ZNK23QRegularExpressionMatch14capturedLengthERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_int; // proto: QStringRef QRegularExpressionMatch::capturedRef(int nth); fn C_ZNK23QRegularExpressionMatch11capturedRefEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: int QRegularExpressionMatch::capturedEnd(const QString & name); fn C_ZNK23QRegularExpressionMatch11capturedEndERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_int; // proto: QString QRegularExpressionMatch::captured(const QString & name); fn C_ZNK23QRegularExpressionMatch8capturedERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: QStringList QRegularExpressionMatch::capturedTexts(); fn C_ZNK23QRegularExpressionMatch13capturedTextsEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QRegularExpressionMatch::QRegularExpressionMatch(const QRegularExpressionMatch & match); fn C_ZN23QRegularExpressionMatchC2ERKS_(arg0: *mut c_void) -> u64; // proto: void QRegularExpressionMatch::swap(QRegularExpressionMatch & other); fn C_ZN23QRegularExpressionMatch4swapERS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QRegularExpressionMatch::~QRegularExpressionMatch(); fn C_ZN23QRegularExpressionMatchD2Ev(qthis: u64 /* *mut c_void*/); // proto: int QRegularExpressionMatch::capturedEnd(int nth); fn C_ZNK23QRegularExpressionMatch11capturedEndEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_int; // proto: QStringRef QRegularExpressionMatch::capturedRef(const QString & name); fn C_ZNK23QRegularExpressionMatch11capturedRefERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: bool QRegularExpressionMatch::hasMatch(); fn C_ZNK23QRegularExpressionMatch8hasMatchEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: int QRegularExpressionMatch::capturedStart(const QString & name); fn C_ZNK23QRegularExpressionMatch13capturedStartERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_int; // proto: QRegularExpression QRegularExpressionMatch::regularExpression(); fn C_ZNK23QRegularExpressionMatch17regularExpressionEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString QRegularExpressionMatch::captured(int nth); fn C_ZNK23QRegularExpressionMatch8capturedEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: int QRegularExpressionMatch::capturedStart(int nth); fn C_ZNK23QRegularExpressionMatch13capturedStartEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_int; // proto: bool QRegularExpressionMatch::hasPartialMatch(); fn C_ZNK23QRegularExpressionMatch15hasPartialMatchEv(qthis: u64 /* *mut c_void*/) -> c_char; } // <= ext block end // body block begin => // class sizeof(QRegularExpressionMatchIterator)=1 #[derive(Default)] pub struct QRegularExpressionMatchIterator { // qbase: None, pub qclsinst: u64 /* *mut c_void*/, } // class sizeof(QRegularExpression)=1 #[derive(Default)] pub struct QRegularExpression { // qbase: None, pub qclsinst: u64 /* *mut c_void*/, } // class sizeof(QRegularExpressionMatch)=1 #[derive(Default)] pub struct QRegularExpressionMatch { // qbase: None, pub qclsinst: u64 /* *mut c_void*/, } impl /*struct*/ QRegularExpressionMatchIterator { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QRegularExpressionMatchIterator { return QRegularExpressionMatchIterator{qclsinst: qthis, ..Default::default()}; } } // proto: bool QRegularExpressionMatchIterator::hasNext(); impl /*struct*/ QRegularExpressionMatchIterator { pub fn hasNext<RetType, T: QRegularExpressionMatchIterator_hasNext<RetType>>(& self, overload_args: T) -> RetType { return overload_args.hasNext(self); // return 1; } } pub trait QRegularExpressionMatchIterator_hasNext<RetType> { fn hasNext(self , rsthis: & QRegularExpressionMatchIterator) -> RetType; } // proto: bool QRegularExpressionMatchIterator::hasNext(); impl<'a> /*trait*/ QRegularExpressionMatchIterator_hasNext<i8> for () { fn hasNext(self , rsthis: & QRegularExpressionMatchIterator) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK31QRegularExpressionMatchIterator7hasNextEv()}; let mut ret = unsafe {C_ZNK31QRegularExpressionMatchIterator7hasNextEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: bool QRegularExpressionMatchIterator::isValid(); impl /*struct*/ QRegularExpressionMatchIterator { pub fn isValid<RetType, T: QRegularExpressionMatchIterator_isValid<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isValid(self); // return 1; } } pub trait QRegularExpressionMatchIterator_isValid<RetType> { fn isValid(self , rsthis: & QRegularExpressionMatchIterator) -> RetType; } // proto: bool QRegularExpressionMatchIterator::isValid(); impl<'a> /*trait*/ QRegularExpressionMatchIterator_isValid<i8> for () { fn isValid(self , rsthis: & QRegularExpressionMatchIterator) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK31QRegularExpressionMatchIterator7isValidEv()}; let mut ret = unsafe {C_ZNK31QRegularExpressionMatchIterator7isValidEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QRegularExpressionMatch QRegularExpressionMatchIterator::peekNext(); impl /*struct*/ QRegularExpressionMatchIterator { pub fn peekNext<RetType, T: QRegularExpressionMatchIterator_peekNext<RetType>>(& self, overload_args: T) -> RetType { return overload_args.peekNext(self); // return 1; } } pub trait QRegularExpressionMatchIterator_peekNext<RetType> { fn peekNext(self , rsthis: & QRegularExpressionMatchIterator) -> RetType; } // proto: QRegularExpressionMatch QRegularExpressionMatchIterator::peekNext(); impl<'a> /*trait*/ QRegularExpressionMatchIterator_peekNext<QRegularExpressionMatch> for () { fn peekNext(self , rsthis: & QRegularExpressionMatchIterator) -> QRegularExpressionMatch { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK31QRegularExpressionMatchIterator8peekNextEv()}; let mut ret = unsafe {C_ZNK31QRegularExpressionMatchIterator8peekNextEv(rsthis.qclsinst)}; let mut ret1 = QRegularExpressionMatch::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QRegularExpressionMatchIterator::QRegularExpressionMatchIterator(); impl /*struct*/ QRegularExpressionMatchIterator { pub fn new<T: QRegularExpressionMatchIterator_new>(value: T) -> QRegularExpressionMatchIterator { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QRegularExpressionMatchIterator_new { fn new(self) -> QRegularExpressionMatchIterator; } // proto: void QRegularExpressionMatchIterator::QRegularExpressionMatchIterator(); impl<'a> /*trait*/ QRegularExpressionMatchIterator_new for () { fn new(self) -> QRegularExpressionMatchIterator { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN31QRegularExpressionMatchIteratorC2Ev()}; let ctysz: c_int = unsafe{QRegularExpressionMatchIterator_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let qthis: u64 = unsafe {C_ZN31QRegularExpressionMatchIteratorC2Ev()}; let rsthis = QRegularExpressionMatchIterator{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: QRegularExpression QRegularExpressionMatchIterator::regularExpression(); impl /*struct*/ QRegularExpressionMatchIterator { pub fn regularExpression<RetType, T: QRegularExpressionMatchIterator_regularExpression<RetType>>(& self, overload_args: T) -> RetType { return overload_args.regularExpression(self); // return 1; } } pub trait QRegularExpressionMatchIterator_regularExpression<RetType> { fn regularExpression(self , rsthis: & QRegularExpressionMatchIterator) -> RetType; } // proto: QRegularExpression QRegularExpressionMatchIterator::regularExpression(); impl<'a> /*trait*/ QRegularExpressionMatchIterator_regularExpression<QRegularExpression> for () { fn regularExpression(self , rsthis: & QRegularExpressionMatchIterator) -> QRegularExpression { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK31QRegularExpressionMatchIterator17regularExpressionEv()}; let mut ret = unsafe {C_ZNK31QRegularExpressionMatchIterator17regularExpressionEv(rsthis.qclsinst)}; let mut ret1 = QRegularExpression::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QRegularExpressionMatchIterator::QRegularExpressionMatchIterator(const QRegularExpressionMatchIterator & iterator); impl<'a> /*trait*/ QRegularExpressionMatchIterator_new for (&'a QRegularExpressionMatchIterator) { fn new(self) -> QRegularExpressionMatchIterator { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN31QRegularExpressionMatchIteratorC2ERKS_()}; let ctysz: c_int = unsafe{QRegularExpressionMatchIterator_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_ZN31QRegularExpressionMatchIteratorC2ERKS_(arg0)}; let rsthis = QRegularExpressionMatchIterator{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QRegularExpressionMatchIterator::~QRegularExpressionMatchIterator(); impl /*struct*/ QRegularExpressionMatchIterator { pub fn free<RetType, T: QRegularExpressionMatchIterator_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QRegularExpressionMatchIterator_free<RetType> { fn free(self , rsthis: & QRegularExpressionMatchIterator) -> RetType; } // proto: void QRegularExpressionMatchIterator::~QRegularExpressionMatchIterator(); impl<'a> /*trait*/ QRegularExpressionMatchIterator_free<()> for () { fn free(self , rsthis: & QRegularExpressionMatchIterator) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN31QRegularExpressionMatchIteratorD2Ev()}; unsafe {C_ZN31QRegularExpressionMatchIteratorD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: QRegularExpressionMatch QRegularExpressionMatchIterator::next(); impl /*struct*/ QRegularExpressionMatchIterator { pub fn next<RetType, T: QRegularExpressionMatchIterator_next<RetType>>(& self, overload_args: T) -> RetType { return overload_args.next(self); // return 1; } } pub trait QRegularExpressionMatchIterator_next<RetType> { fn next(self , rsthis: & QRegularExpressionMatchIterator) -> RetType; } // proto: QRegularExpressionMatch QRegularExpressionMatchIterator::next(); impl<'a> /*trait*/ QRegularExpressionMatchIterator_next<QRegularExpressionMatch> for () { fn next(self , rsthis: & QRegularExpressionMatchIterator) -> QRegularExpressionMatch { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN31QRegularExpressionMatchIterator4nextEv()}; let mut ret = unsafe {C_ZN31QRegularExpressionMatchIterator4nextEv(rsthis.qclsinst)}; let mut ret1 = QRegularExpressionMatch::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QRegularExpressionMatchIterator::swap(QRegularExpressionMatchIterator & other); impl /*struct*/ QRegularExpressionMatchIterator { pub fn swap<RetType, T: QRegularExpressionMatchIterator_swap<RetType>>(& self, overload_args: T) -> RetType { return overload_args.swap(self); // return 1; } } pub trait QRegularExpressionMatchIterator_swap<RetType> { fn swap(self , rsthis: & QRegularExpressionMatchIterator) -> RetType; } // proto: void QRegularExpressionMatchIterator::swap(QRegularExpressionMatchIterator & other); impl<'a> /*trait*/ QRegularExpressionMatchIterator_swap<()> for (&'a QRegularExpressionMatchIterator) { fn swap(self , rsthis: & QRegularExpressionMatchIterator) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN31QRegularExpressionMatchIterator4swapERS_()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN31QRegularExpressionMatchIterator4swapERS_(rsthis.qclsinst, arg0)}; // return 1; } } impl /*struct*/ QRegularExpression { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QRegularExpression { return QRegularExpression{qclsinst: qthis, ..Default::default()}; } } // proto: int QRegularExpression::patternErrorOffset(); impl /*struct*/ QRegularExpression { pub fn patternErrorOffset<RetType, T: QRegularExpression_patternErrorOffset<RetType>>(& self, overload_args: T) -> RetType { return overload_args.patternErrorOffset(self); // return 1; } } pub trait QRegularExpression_patternErrorOffset<RetType> { fn patternErrorOffset(self , rsthis: & QRegularExpression) -> RetType; } // proto: int QRegularExpression::patternErrorOffset(); impl<'a> /*trait*/ QRegularExpression_patternErrorOffset<i32> for () { fn patternErrorOffset(self , rsthis: & QRegularExpression) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QRegularExpression18patternErrorOffsetEv()}; let mut ret = unsafe {C_ZNK18QRegularExpression18patternErrorOffsetEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: QString QRegularExpression::pattern(); impl /*struct*/ QRegularExpression { pub fn pattern<RetType, T: QRegularExpression_pattern<RetType>>(& self, overload_args: T) -> RetType { return overload_args.pattern(self); // return 1; } } pub trait QRegularExpression_pattern<RetType> { fn pattern(self , rsthis: & QRegularExpression) -> RetType; } // proto: QString QRegularExpression::pattern(); impl<'a> /*trait*/ QRegularExpression_pattern<QString> for () { fn pattern(self , rsthis: & QRegularExpression) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QRegularExpression7patternEv()}; let mut ret = unsafe {C_ZNK18QRegularExpression7patternEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QRegularExpression::~QRegularExpression(); impl /*struct*/ QRegularExpression { pub fn free<RetType, T: QRegularExpression_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QRegularExpression_free<RetType> { fn free(self , rsthis: & QRegularExpression) -> RetType; } // proto: void QRegularExpression::~QRegularExpression(); impl<'a> /*trait*/ QRegularExpression_free<()> for () { fn free(self , rsthis: & QRegularExpression) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QRegularExpressionD2Ev()}; unsafe {C_ZN18QRegularExpressionD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: void QRegularExpression::optimize(); impl /*struct*/ QRegularExpression { pub fn optimize<RetType, T: QRegularExpression_optimize<RetType>>(& self, overload_args: T) -> RetType { return overload_args.optimize(self); // return 1; } } pub trait QRegularExpression_optimize<RetType> { fn optimize(self , rsthis: & QRegularExpression) -> RetType; } // proto: void QRegularExpression::optimize(); impl<'a> /*trait*/ QRegularExpression_optimize<()> for () { fn optimize(self , rsthis: & QRegularExpression) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QRegularExpression8optimizeEv()}; unsafe {C_ZNK18QRegularExpression8optimizeEv(rsthis.qclsinst)}; // return 1; } } // proto: static QString QRegularExpression::escape(const QString & str); impl /*struct*/ QRegularExpression { pub fn escape_s<RetType, T: QRegularExpression_escape_s<RetType>>( overload_args: T) -> RetType { return overload_args.escape_s(); // return 1; } } pub trait QRegularExpression_escape_s<RetType> { fn escape_s(self ) -> RetType; } // proto: static QString QRegularExpression::escape(const QString & str); impl<'a> /*trait*/ QRegularExpression_escape_s<QString> for (&'a QString) { fn escape_s(self ) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QRegularExpression6escapeERK7QString()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN18QRegularExpression6escapeERK7QString(arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QRegularExpression::QRegularExpression(); impl /*struct*/ QRegularExpression { pub fn new<T: QRegularExpression_new>(value: T) -> QRegularExpression { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QRegularExpression_new { fn new(self) -> QRegularExpression; } // proto: void QRegularExpression::QRegularExpression(); impl<'a> /*trait*/ QRegularExpression_new for () { fn new(self) -> QRegularExpression { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QRegularExpressionC2Ev()}; let ctysz: c_int = unsafe{QRegularExpression_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let qthis: u64 = unsafe {C_ZN18QRegularExpressionC2Ev()}; let rsthis = QRegularExpression{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QRegularExpression::swap(QRegularExpression & other); impl /*struct*/ QRegularExpression { pub fn swap<RetType, T: QRegularExpression_swap<RetType>>(& self, overload_args: T) -> RetType { return overload_args.swap(self); // return 1; } } pub trait QRegularExpression_swap<RetType> { fn swap(self , rsthis: & QRegularExpression) -> RetType; } // proto: void QRegularExpression::swap(QRegularExpression & other); impl<'a> /*trait*/ QRegularExpression_swap<()> for (&'a QRegularExpression) { fn swap(self , rsthis: & QRegularExpression) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QRegularExpression4swapERS_()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN18QRegularExpression4swapERS_(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QString QRegularExpression::errorString(); impl /*struct*/ QRegularExpression { pub fn errorString<RetType, T: QRegularExpression_errorString<RetType>>(& self, overload_args: T) -> RetType { return overload_args.errorString(self); // return 1; } } pub trait QRegularExpression_errorString<RetType> { fn errorString(self , rsthis: & QRegularExpression) -> RetType; } // proto: QString QRegularExpression::errorString(); impl<'a> /*trait*/ QRegularExpression_errorString<QString> for () { fn errorString(self , rsthis: & QRegularExpression) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QRegularExpression11errorStringEv()}; let mut ret = unsafe {C_ZNK18QRegularExpression11errorStringEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QRegularExpression::isValid(); impl /*struct*/ QRegularExpression { pub fn isValid<RetType, T: QRegularExpression_isValid<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isValid(self); // return 1; } } pub trait QRegularExpression_isValid<RetType> { fn isValid(self , rsthis: & QRegularExpression) -> RetType; } // proto: bool QRegularExpression::isValid(); impl<'a> /*trait*/ QRegularExpression_isValid<i8> for () { fn isValid(self , rsthis: & QRegularExpression) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QRegularExpression7isValidEv()}; let mut ret = unsafe {C_ZNK18QRegularExpression7isValidEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QRegularExpression::QRegularExpression(const QRegularExpression & re); impl<'a> /*trait*/ QRegularExpression_new for (&'a QRegularExpression) { fn new(self) -> QRegularExpression { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QRegularExpressionC2ERKS_()}; let ctysz: c_int = unsafe{QRegularExpression_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_ZN18QRegularExpressionC2ERKS_(arg0)}; let rsthis = QRegularExpression{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: QStringList QRegularExpression::namedCaptureGroups(); impl /*struct*/ QRegularExpression { pub fn namedCaptureGroups<RetType, T: QRegularExpression_namedCaptureGroups<RetType>>(& self, overload_args: T) -> RetType { return overload_args.namedCaptureGroups(self); // return 1; } } pub trait QRegularExpression_namedCaptureGroups<RetType> { fn namedCaptureGroups(self , rsthis: & QRegularExpression) -> RetType; } // proto: QStringList QRegularExpression::namedCaptureGroups(); impl<'a> /*trait*/ QRegularExpression_namedCaptureGroups<QStringList> for () { fn namedCaptureGroups(self , rsthis: & QRegularExpression) -> QStringList { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QRegularExpression18namedCaptureGroupsEv()}; let mut ret = unsafe {C_ZNK18QRegularExpression18namedCaptureGroupsEv(rsthis.qclsinst)}; let mut ret1 = QStringList::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QRegularExpression::captureCount(); impl /*struct*/ QRegularExpression { pub fn captureCount<RetType, T: QRegularExpression_captureCount<RetType>>(& self, overload_args: T) -> RetType { return overload_args.captureCount(self); // return 1; } } pub trait QRegularExpression_captureCount<RetType> { fn captureCount(self , rsthis: & QRegularExpression) -> RetType; } // proto: int QRegularExpression::captureCount(); impl<'a> /*trait*/ QRegularExpression_captureCount<i32> for () { fn captureCount(self , rsthis: & QRegularExpression) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QRegularExpression12captureCountEv()}; let mut ret = unsafe {C_ZNK18QRegularExpression12captureCountEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QRegularExpression::setPattern(const QString & pattern); impl /*struct*/ QRegularExpression { pub fn setPattern<RetType, T: QRegularExpression_setPattern<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setPattern(self); // return 1; } } pub trait QRegularExpression_setPattern<RetType> { fn setPattern(self , rsthis: & QRegularExpression) -> RetType; } // proto: void QRegularExpression::setPattern(const QString & pattern); impl<'a> /*trait*/ QRegularExpression_setPattern<()> for (&'a QString) { fn setPattern(self , rsthis: & QRegularExpression) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QRegularExpression10setPatternERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN18QRegularExpression10setPatternERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } impl /*struct*/ QRegularExpressionMatch { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QRegularExpressionMatch { return QRegularExpressionMatch{qclsinst: qthis, ..Default::default()}; } } // proto: int QRegularExpressionMatch::lastCapturedIndex(); impl /*struct*/ QRegularExpressionMatch { pub fn lastCapturedIndex<RetType, T: QRegularExpressionMatch_lastCapturedIndex<RetType>>(& self, overload_args: T) -> RetType { return overload_args.lastCapturedIndex(self); // return 1; } } pub trait QRegularExpressionMatch_lastCapturedIndex<RetType> { fn lastCapturedIndex(self , rsthis: & QRegularExpressionMatch) -> RetType; } // proto: int QRegularExpressionMatch::lastCapturedIndex(); impl<'a> /*trait*/ QRegularExpressionMatch_lastCapturedIndex<i32> for () { fn lastCapturedIndex(self , rsthis: & QRegularExpressionMatch) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK23QRegularExpressionMatch17lastCapturedIndexEv()}; let mut ret = unsafe {C_ZNK23QRegularExpressionMatch17lastCapturedIndexEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QRegularExpressionMatch::QRegularExpressionMatch(); impl /*struct*/ QRegularExpressionMatch { pub fn new<T: QRegularExpressionMatch_new>(value: T) -> QRegularExpressionMatch { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QRegularExpressionMatch_new { fn new(self) -> QRegularExpressionMatch; } // proto: void QRegularExpressionMatch::QRegularExpressionMatch(); impl<'a> /*trait*/ QRegularExpressionMatch_new for () { fn new(self) -> QRegularExpressionMatch { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN23QRegularExpressionMatchC2Ev()}; let ctysz: c_int = unsafe{QRegularExpressionMatch_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let qthis: u64 = unsafe {C_ZN23QRegularExpressionMatchC2Ev()}; let rsthis = QRegularExpressionMatch{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: bool QRegularExpressionMatch::isValid(); impl /*struct*/ QRegularExpressionMatch { pub fn isValid<RetType, T: QRegularExpressionMatch_isValid<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isValid(self); // return 1; } } pub trait QRegularExpressionMatch_isValid<RetType> { fn isValid(self , rsthis: & QRegularExpressionMatch) -> RetType; } // proto: bool QRegularExpressionMatch::isValid(); impl<'a> /*trait*/ QRegularExpressionMatch_isValid<i8> for () { fn isValid(self , rsthis: & QRegularExpressionMatch) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK23QRegularExpressionMatch7isValidEv()}; let mut ret = unsafe {C_ZNK23QRegularExpressionMatch7isValidEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: int QRegularExpressionMatch::capturedLength(int nth); impl /*struct*/ QRegularExpressionMatch { pub fn capturedLength<RetType, T: QRegularExpressionMatch_capturedLength<RetType>>(& self, overload_args: T) -> RetType { return overload_args.capturedLength(self); // return 1; } } pub trait QRegularExpressionMatch_capturedLength<RetType> { fn capturedLength(self , rsthis: & QRegularExpressionMatch) -> RetType; } // proto: int QRegularExpressionMatch::capturedLength(int nth); impl<'a> /*trait*/ QRegularExpressionMatch_capturedLength<i32> for (Option<i32>) { fn capturedLength(self , rsthis: & QRegularExpressionMatch) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK23QRegularExpressionMatch14capturedLengthEi()}; let arg0 = (if self.is_none() {0} else {self.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK23QRegularExpressionMatch14capturedLengthEi(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: int QRegularExpressionMatch::capturedLength(const QString & name); impl<'a> /*trait*/ QRegularExpressionMatch_capturedLength<i32> for (&'a QString) { fn capturedLength(self , rsthis: & QRegularExpressionMatch) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK23QRegularExpressionMatch14capturedLengthERK7QString()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK23QRegularExpressionMatch14capturedLengthERK7QString(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: QStringRef QRegularExpressionMatch::capturedRef(int nth); impl /*struct*/ QRegularExpressionMatch { pub fn capturedRef<RetType, T: QRegularExpressionMatch_capturedRef<RetType>>(& self, overload_args: T) -> RetType { return overload_args.capturedRef(self); // return 1; } } pub trait QRegularExpressionMatch_capturedRef<RetType> { fn capturedRef(self , rsthis: & QRegularExpressionMatch) -> RetType; } // proto: QStringRef QRegularExpressionMatch::capturedRef(int nth); impl<'a> /*trait*/ QRegularExpressionMatch_capturedRef<QStringRef> for (Option<i32>) { fn capturedRef(self , rsthis: & QRegularExpressionMatch) -> QStringRef { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK23QRegularExpressionMatch11capturedRefEi()}; let arg0 = (if self.is_none() {0} else {self.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK23QRegularExpressionMatch11capturedRefEi(rsthis.qclsinst, arg0)}; let mut ret1 = QStringRef::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QRegularExpressionMatch::capturedEnd(const QString & name); impl /*struct*/ QRegularExpressionMatch { pub fn capturedEnd<RetType, T: QRegularExpressionMatch_capturedEnd<RetType>>(& self, overload_args: T) -> RetType { return overload_args.capturedEnd(self); // return 1; } } pub trait QRegularExpressionMatch_capturedEnd<RetType> { fn capturedEnd(self , rsthis: & QRegularExpressionMatch) -> RetType; } // proto: int QRegularExpressionMatch::capturedEnd(const QString & name); impl<'a> /*trait*/ QRegularExpressionMatch_capturedEnd<i32> for (&'a QString) { fn capturedEnd(self , rsthis: & QRegularExpressionMatch) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK23QRegularExpressionMatch11capturedEndERK7QString()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK23QRegularExpressionMatch11capturedEndERK7QString(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: QString QRegularExpressionMatch::captured(const QString & name); impl /*struct*/ QRegularExpressionMatch { pub fn captured<RetType, T: QRegularExpressionMatch_captured<RetType>>(& self, overload_args: T) -> RetType { return overload_args.captured(self); // return 1; } } pub trait QRegularExpressionMatch_captured<RetType> { fn captured(self , rsthis: & QRegularExpressionMatch) -> RetType; } // proto: QString QRegularExpressionMatch::captured(const QString & name); impl<'a> /*trait*/ QRegularExpressionMatch_captured<QString> for (&'a QString) { fn captured(self , rsthis: & QRegularExpressionMatch) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK23QRegularExpressionMatch8capturedERK7QString()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK23QRegularExpressionMatch8capturedERK7QString(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QStringList QRegularExpressionMatch::capturedTexts(); impl /*struct*/ QRegularExpressionMatch { pub fn capturedTexts<RetType, T: QRegularExpressionMatch_capturedTexts<RetType>>(& self, overload_args: T) -> RetType { return overload_args.capturedTexts(self); // return 1; } } pub trait QRegularExpressionMatch_capturedTexts<RetType> { fn capturedTexts(self , rsthis: & QRegularExpressionMatch) -> RetType; } // proto: QStringList QRegularExpressionMatch::capturedTexts(); impl<'a> /*trait*/ QRegularExpressionMatch_capturedTexts<QStringList> for () { fn capturedTexts(self , rsthis: & QRegularExpressionMatch) -> QStringList { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK23QRegularExpressionMatch13capturedTextsEv()}; let mut ret = unsafe {C_ZNK23QRegularExpressionMatch13capturedTextsEv(rsthis.qclsinst)}; let mut ret1 = QStringList::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QRegularExpressionMatch::QRegularExpressionMatch(const QRegularExpressionMatch & match); impl<'a> /*trait*/ QRegularExpressionMatch_new for (&'a QRegularExpressionMatch) { fn new(self) -> QRegularExpressionMatch { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN23QRegularExpressionMatchC2ERKS_()}; let ctysz: c_int = unsafe{QRegularExpressionMatch_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_ZN23QRegularExpressionMatchC2ERKS_(arg0)}; let rsthis = QRegularExpressionMatch{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QRegularExpressionMatch::swap(QRegularExpressionMatch & other); impl /*struct*/ QRegularExpressionMatch { pub fn swap<RetType, T: QRegularExpressionMatch_swap<RetType>>(& self, overload_args: T) -> RetType { return overload_args.swap(self); // return 1; } } pub trait QRegularExpressionMatch_swap<RetType> { fn swap(self , rsthis: & QRegularExpressionMatch) -> RetType; } // proto: void QRegularExpressionMatch::swap(QRegularExpressionMatch & other); impl<'a> /*trait*/ QRegularExpressionMatch_swap<()> for (&'a QRegularExpressionMatch) { fn swap(self , rsthis: & QRegularExpressionMatch) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN23QRegularExpressionMatch4swapERS_()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN23QRegularExpressionMatch4swapERS_(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QRegularExpressionMatch::~QRegularExpressionMatch(); impl /*struct*/ QRegularExpressionMatch { pub fn free<RetType, T: QRegularExpressionMatch_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QRegularExpressionMatch_free<RetType> { fn free(self , rsthis: & QRegularExpressionMatch) -> RetType; } // proto: void QRegularExpressionMatch::~QRegularExpressionMatch(); impl<'a> /*trait*/ QRegularExpressionMatch_free<()> for () { fn free(self , rsthis: & QRegularExpressionMatch) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN23QRegularExpressionMatchD2Ev()}; unsafe {C_ZN23QRegularExpressionMatchD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: int QRegularExpressionMatch::capturedEnd(int nth); impl<'a> /*trait*/ QRegularExpressionMatch_capturedEnd<i32> for (Option<i32>) { fn capturedEnd(self , rsthis: & QRegularExpressionMatch) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK23QRegularExpressionMatch11capturedEndEi()}; let arg0 = (if self.is_none() {0} else {self.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK23QRegularExpressionMatch11capturedEndEi(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: QStringRef QRegularExpressionMatch::capturedRef(const QString & name); impl<'a> /*trait*/ QRegularExpressionMatch_capturedRef<QStringRef> for (&'a QString) { fn capturedRef(self , rsthis: & QRegularExpressionMatch) -> QStringRef { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK23QRegularExpressionMatch11capturedRefERK7QString()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK23QRegularExpressionMatch11capturedRefERK7QString(rsthis.qclsinst, arg0)}; let mut ret1 = QStringRef::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QRegularExpressionMatch::hasMatch(); impl /*struct*/ QRegularExpressionMatch { pub fn hasMatch<RetType, T: QRegularExpressionMatch_hasMatch<RetType>>(& self, overload_args: T) -> RetType { return overload_args.hasMatch(self); // return 1; } } pub trait QRegularExpressionMatch_hasMatch<RetType> { fn hasMatch(self , rsthis: & QRegularExpressionMatch) -> RetType; } // proto: bool QRegularExpressionMatch::hasMatch(); impl<'a> /*trait*/ QRegularExpressionMatch_hasMatch<i8> for () { fn hasMatch(self , rsthis: & QRegularExpressionMatch) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK23QRegularExpressionMatch8hasMatchEv()}; let mut ret = unsafe {C_ZNK23QRegularExpressionMatch8hasMatchEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: int QRegularExpressionMatch::capturedStart(const QString & name); impl /*struct*/ QRegularExpressionMatch { pub fn capturedStart<RetType, T: QRegularExpressionMatch_capturedStart<RetType>>(& self, overload_args: T) -> RetType { return overload_args.capturedStart(self); // return 1; } } pub trait QRegularExpressionMatch_capturedStart<RetType> { fn capturedStart(self , rsthis: & QRegularExpressionMatch) -> RetType; } // proto: int QRegularExpressionMatch::capturedStart(const QString & name); impl<'a> /*trait*/ QRegularExpressionMatch_capturedStart<i32> for (&'a QString) { fn capturedStart(self , rsthis: & QRegularExpressionMatch) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK23QRegularExpressionMatch13capturedStartERK7QString()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK23QRegularExpressionMatch13capturedStartERK7QString(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: QRegularExpression QRegularExpressionMatch::regularExpression(); impl /*struct*/ QRegularExpressionMatch { pub fn regularExpression<RetType, T: QRegularExpressionMatch_regularExpression<RetType>>(& self, overload_args: T) -> RetType { return overload_args.regularExpression(self); // return 1; } } pub trait QRegularExpressionMatch_regularExpression<RetType> { fn regularExpression(self , rsthis: & QRegularExpressionMatch) -> RetType; } // proto: QRegularExpression QRegularExpressionMatch::regularExpression(); impl<'a> /*trait*/ QRegularExpressionMatch_regularExpression<QRegularExpression> for () { fn regularExpression(self , rsthis: & QRegularExpressionMatch) -> QRegularExpression { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK23QRegularExpressionMatch17regularExpressionEv()}; let mut ret = unsafe {C_ZNK23QRegularExpressionMatch17regularExpressionEv(rsthis.qclsinst)}; let mut ret1 = QRegularExpression::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QRegularExpressionMatch::captured(int nth); impl<'a> /*trait*/ QRegularExpressionMatch_captured<QString> for (Option<i32>) { fn captured(self , rsthis: & QRegularExpressionMatch) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK23QRegularExpressionMatch8capturedEi()}; let arg0 = (if self.is_none() {0} else {self.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK23QRegularExpressionMatch8capturedEi(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QRegularExpressionMatch::capturedStart(int nth); impl<'a> /*trait*/ QRegularExpressionMatch_capturedStart<i32> for (Option<i32>) { fn capturedStart(self , rsthis: & QRegularExpressionMatch) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK23QRegularExpressionMatch13capturedStartEi()}; let arg0 = (if self.is_none() {0} else {self.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK23QRegularExpressionMatch13capturedStartEi(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: bool QRegularExpressionMatch::hasPartialMatch(); impl /*struct*/ QRegularExpressionMatch { pub fn hasPartialMatch<RetType, T: QRegularExpressionMatch_hasPartialMatch<RetType>>(& self, overload_args: T) -> RetType { return overload_args.hasPartialMatch(self); // return 1; } } pub trait QRegularExpressionMatch_hasPartialMatch<RetType> { fn hasPartialMatch(self , rsthis: & QRegularExpressionMatch) -> RetType; } // proto: bool QRegularExpressionMatch::hasPartialMatch(); impl<'a> /*trait*/ QRegularExpressionMatch_hasPartialMatch<i8> for () { fn hasPartialMatch(self , rsthis: & QRegularExpressionMatch) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK23QRegularExpressionMatch15hasPartialMatchEv()}; let mut ret = unsafe {C_ZNK23QRegularExpressionMatch15hasPartialMatchEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // <= body block end
use crate::glyf::component::{Component, ComponentFlags}; use crate::glyf::point::Point; use bitflags::bitflags; use itertools::izip; use otspec::types::*; use otspec::{deserialize_visitor, read_field, read_field_counted}; use otspec_macros::tables; use serde::de::{SeqAccess, Visitor}; use serde::ser::SerializeSeq; use serde::{Deserialize, Deserializer, Serialize, Serializer}; tables!( GlyphCore { int16 xMin int16 yMin int16 xMax int16 yMax } ); bitflags! { #[derive(Serialize, Deserialize)] struct SimpleGlyphFlags: u8 { const ON_CURVE_POINT = 0x01; const X_SHORT_VECTOR = 0x02; const Y_SHORT_VECTOR = 0x04; const REPEAT_FLAG = 0x08; const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 0x10; const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 0x20; const OVERLAP_SIMPLE = 0x40; const RESERVED = 0x80; } } #[derive(Debug, PartialEq)] pub struct Glyph { pub xMin: int16, pub xMax: int16, pub yMin: int16, pub yMax: int16, pub contours: Vec<Vec<Point>>, pub instructions: Vec<u8>, pub components: Vec<Component>, pub overlap: bool, } deserialize_visitor!( Glyph, GlyphVisitor, fn visit_seq<A: SeqAccess<'de>>(self, mut seq: A) -> Result<Self::Value, A::Error> { // println!("Reading a glyph"); let maybe_num_contours = seq.next_element::<i16>()?; let num_contours = maybe_num_contours.unwrap(); // println!("Num contours: {:?}", num_contours); let core = read_field!(seq, GlyphCore, "a glyph header"); let mut components: Vec<Component> = vec![]; let mut instructions: Vec<u8> = vec![]; let mut contours: Vec<Vec<Point>> = Vec::with_capacity(if num_contours < 1 { 0 } else { num_contours as usize }); let mut overlap = false; let mut has_instructions = false; if num_contours < 1 { loop { let comp = read_field!(seq, Component, "component"); let has_more = comp.flags.contains(ComponentFlags::MORE_COMPONENTS); if comp.flags.contains(ComponentFlags::OVERLAP_COMPOUND) { overlap = true; } if comp.flags.contains(ComponentFlags::WE_HAVE_INSTRUCTIONS) { has_instructions = true; } components.push(comp); if !has_more { break; } } if has_instructions { let instructions_count = read_field!(seq, i16, "a count of instruction bytes"); if instructions_count > 0 { instructions = read_field_counted!(seq, instructions_count, "instructions"); } } } else { // println!("Reading {:?} contours", num_contours); let mut end_pts_of_contour: Vec<usize> = (0..num_contours as usize) .filter_map(|_| seq.next_element::<uint16>().unwrap()) .map(|x| (1 + x) as usize) .collect(); let instructions_count = read_field!(seq, i16, "a count of instruction bytes"); if instructions_count > 0 { instructions = read_field_counted!(seq, instructions_count, "instructions"); } // println!("Instructions: {:?}", instructions); let num_points = *(end_pts_of_contour .last() .ok_or_else(|| serde::de::Error::custom("No points?"))?) as usize; let mut i = 0; // println!("Number of points: {:?}", num_points); let mut flags: Vec<SimpleGlyphFlags> = Vec::with_capacity(num_points); while i < num_points { let flag = read_field!(seq, SimpleGlyphFlags, "a glyph flag"); flags.push(flag); if flag.contains(SimpleGlyphFlags::REPEAT_FLAG) { let mut repeat_count = read_field!(seq, u8, "a flag repeat count"); // println!("Repeated flag! {:?}", repeat_count); while repeat_count > 0 { flags.push(flag); repeat_count -= 1; i += 1; } } i += 1; } let mut x_coords: Vec<int16> = Vec::with_capacity(num_points); let mut y_coords: Vec<int16> = Vec::with_capacity(num_points); let mut last_x = 0_i16; let mut last_y = 0_i16; for i in 0..num_points { if flags[i].contains(SimpleGlyphFlags::X_SHORT_VECTOR) { let coord = read_field!(seq, u8, "an X coordinate") as i16; if flags[i].contains(SimpleGlyphFlags::X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) { last_x += coord; } else { last_x -= coord; } x_coords.push(last_x); // println!("Read short X coordinate {:?}", coord); // println!("X is now {:?}", last_x); } else if flags[i].contains(SimpleGlyphFlags::X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) { x_coords.push(last_x); // println!("Elided X coordinate"); // println!("X is still {:?}", last_x); } else { let coord = read_field!(seq, i16, "an X coordinate"); // println!("Read long X coordinate {:?}", coord); last_x += coord; // println!("X is now {:?}", last_x); x_coords.push(last_x); } } for i in 0..num_points { if flags[i].contains(SimpleGlyphFlags::Y_SHORT_VECTOR) { let coord = read_field!(seq, u8, "a Y coordinate") as i16; if flags[i].contains(SimpleGlyphFlags::Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) { last_y += coord; } else { last_y -= coord; } // println!("Read short Y coordinate {:?}", coord); // println!("Y is now {:?}", last_y); y_coords.push(last_y); } else if flags[i].contains(SimpleGlyphFlags::Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) { y_coords.push(last_y); // println!("Elided Y coordinate"); // println!("Y is still {:?}", last_y); } else { let coord = read_field!(seq, i16, "a Y coordinate"); last_y += coord; // println!("Read long Y coordinate {:?}", coord); // println!("Y is now {:?}", last_y); y_coords.push(last_y); } if flags[i].contains(SimpleGlyphFlags::OVERLAP_SIMPLE) { overlap = true; } } // Divvy x/y coords into contours let points: Vec<Point> = izip!(&x_coords, &y_coords, &flags) .map(|(x, y, flag)| Point { x: *x, y: *y, on_curve: flag.contains(SimpleGlyphFlags::ON_CURVE_POINT), }) .collect(); end_pts_of_contour.insert(0, 0); for window in end_pts_of_contour.windows(2) { // println!("Window: {:?}", window); contours.push(points[window[0]..window[1]].to_vec()); } // println!("Contours: {:?}", contours_vec); } Ok(Glyph { contours, components, instructions, overlap, xMax: core.xMax, yMax: core.yMax, xMin: core.xMin, yMin: core.yMin, }) } ); impl Glyph { pub fn has_components(&self) -> bool { !self.components.is_empty() } pub fn is_empty(&self) -> bool { self.components.is_empty() && self.contours.is_empty() } pub fn bounds_rect(&self) -> kurbo::Rect { kurbo::Rect::new( self.xMin.into(), self.yMin.into(), self.xMax.into(), self.yMax.into(), ) } pub fn set_bounds_rect(&mut self, r: kurbo::Rect) { self.xMin = r.min_x() as i16; self.xMax = r.max_x() as i16; self.yMin = r.min_y() as i16; self.yMax = r.max_y() as i16; } fn end_points(&self) -> Vec<u16> { assert!(!self.has_components()); let mut count: i16 = -1; let mut end_points = Vec::new(); for contour in &self.contours { count += contour.len() as i16; end_points.push(count as u16); } end_points } pub fn insert_explicit_oncurves(&mut self) { if self.contours.is_empty() { return; } for contour in self.contours.iter_mut() { for i in (0..contour.len() - 1).rev() { if !contour[i].on_curve && !contour[i + 1].on_curve { contour.insert( i + 1, Point { on_curve: true, x: (contour[i].x + contour[i + 1].x) / 2, y: (contour[i].y + contour[i + 1].y) / 2, }, ) } } } } fn _compileDeltasGreedy(&self) -> (Vec<u8>, Vec<u8>, Vec<u8>) { assert!(!self.has_components()); let mut last_x = 0; let mut last_y = 0; let mut compressed_flags: Vec<u8> = vec![]; let mut compressed_xs: Vec<u8> = vec![]; let mut compressed_ys: Vec<u8> = vec![]; for point in self.contours.iter().flatten() { let mut x = point.x - last_x; let mut y = point.y - last_y; let mut flag = if point.on_curve { SimpleGlyphFlags::ON_CURVE_POINT } else { SimpleGlyphFlags::empty() }; if x == 0 { flag |= SimpleGlyphFlags::X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR } else if -255 <= x && x <= 255 { flag |= SimpleGlyphFlags::X_SHORT_VECTOR; if x > 0 { flag |= SimpleGlyphFlags::X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR } else { x = -x; } compressed_xs.push(x as u8); } else { compressed_xs.extend(&i16::to_be_bytes(x as i16)); } if y == 0 { flag |= SimpleGlyphFlags::Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR } else if -255 <= y && y <= 255 { flag |= SimpleGlyphFlags::Y_SHORT_VECTOR; if y > 0 { flag |= SimpleGlyphFlags::Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR } else { y = -y; } compressed_ys.push(y as u8); } else { compressed_ys.extend(&i16::to_be_bytes(y as i16)); } /* Not gonna do repeating flags today */ compressed_flags.push(flag.bits()); last_x = point.x; last_y = point.y; } (compressed_flags, compressed_xs, compressed_ys) } pub fn decompose(&self, glyphs: &[Glyph]) -> Glyph { let mut newglyph = Glyph { xMin: 0, xMax: 0, yMin: 0, yMax: 0, instructions: vec![], overlap: self.overlap, contours: vec![], components: vec![], }; let mut new_contours = vec![]; new_contours.extend(self.contours.clone()); for comp in &self.components { let ix = comp.glyphIndex; match glyphs.get(ix as usize) { None => { log::error!("Component not found for ID={:?}", ix); } Some(other_glyph) => { for c in &other_glyph.contours { new_contours.push( c.iter() .map(|pt| pt.transform(comp.transformation)) .collect(), ); } if other_glyph.has_components() { log::warn!("Found nested components while decomposing"); } } } } if !new_contours.is_empty() { newglyph.contours = new_contours; } newglyph } pub fn gvar_coords_and_ends(&self) -> (Vec<(int16, int16)>, Vec<usize>) { let mut ends: Vec<usize> = self .contours .iter() .map(|c| c.len()) .scan(0, |acc, x| { *acc += x; Some(*acc) }) .collect(); let mut coords: Vec<(i16, i16)> = self .contours .iter() .flatten() .map(|pt| (pt.x, pt.y)) .collect(); for comp in &self.components { let [_, _, _, _, translateX, translateY] = comp.transformation.as_coeffs(); coords.push((translateX as i16, translateY as i16)); ends.push(ends.len()); } // Phantom points let left_side_x = 0; // XXX WRONG let right_side_x = 0; let top_side_y = 0; let bottom_side_y = 0; coords.push((left_side_x, 0)); ends.push(ends.len()); coords.push((right_side_x, 0)); ends.push(ends.len()); coords.push((0, top_side_y)); ends.push(ends.len()); coords.push((0, bottom_side_y)); ends.push(ends.len()); (coords, ends) } } impl Serialize for Glyph { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer, { let mut seq = serializer.serialize_seq(None)?; if self.is_empty() { return seq.end(); } seq.serialize_element::<i16>( &(if self.has_components() { -1 } else { self.contours.len() as i16 }), )?; // recalc bounds? seq.serialize_element::<GlyphCore>(&GlyphCore { xMin: self.xMin, xMax: self.xMax, yMin: self.yMin, yMax: self.yMax, })?; if self.has_components() { for (i, comp) in self.components.iter().enumerate() { let flags = comp .recompute_flags(i < self.components.len() - 1, !self.instructions.is_empty()); seq.serialize_element::<uint16>(&flags.bits())?; seq.serialize_element::<uint16>(&comp.glyphIndex)?; let [x_scale, scale01, scale10, scale_y, translateX, translateY] = comp.transformation.as_coeffs(); if flags.contains(ComponentFlags::ARGS_ARE_XY_VALUES) { if flags.contains(ComponentFlags::ARG_1_AND_2_ARE_WORDS) { seq.serialize_element::<i16>(&(translateX.round() as i16))?; seq.serialize_element::<i16>(&(translateY as i16))?; } else { seq.serialize_element::<i8>(&(translateX.round() as i8))?; seq.serialize_element::<i8>(&(translateY as i8))?; } } else { let (x, y) = comp.matchPoints.unwrap(); if flags.contains(ComponentFlags::ARG_1_AND_2_ARE_WORDS) { seq.serialize_element::<i16>(&(x as i16))?; seq.serialize_element::<i16>(&(y as i16))?; } else { seq.serialize_element::<i8>(&(x as i8))?; seq.serialize_element::<i8>(&(y as i8))?; } } if flags.contains(ComponentFlags::WE_HAVE_A_TWO_BY_TWO) { F2DOT14::serialize_element(&(x_scale as f32), &mut seq)?; F2DOT14::serialize_element(&(scale01 as f32), &mut seq)?; F2DOT14::serialize_element(&(scale10 as f32), &mut seq)?; F2DOT14::serialize_element(&(scale_y as f32), &mut seq)?; } else if flags.contains(ComponentFlags::WE_HAVE_AN_X_AND_Y_SCALE) { F2DOT14::serialize_element(&(x_scale as f32), &mut seq)?; F2DOT14::serialize_element(&(scale_y as f32), &mut seq)?; } else if flags.contains(ComponentFlags::WE_HAVE_A_SCALE) { F2DOT14::serialize_element(&(x_scale as f32), &mut seq)?; } if flags.contains(ComponentFlags::WE_HAVE_INSTRUCTIONS) { seq.serialize_element::<uint16>(&(self.instructions.len() as u16))?; seq.serialize_element::<Vec<u8>>(&self.instructions)?; } } } else { let end_pts_of_contour = self.end_points(); seq.serialize_element::<Vec<uint16>>(&end_pts_of_contour)?; if !self.instructions.is_empty() { seq.serialize_element::<uint16>(&(self.instructions.len() as u16))?; seq.serialize_element::<Vec<u8>>(&self.instructions)?; } else { seq.serialize_element::<uint16>(&0)?; } let (compressed_flags, compressed_xs, compressed_ys) = self._compileDeltasGreedy(); seq.serialize_element::<Vec<u8>>(&compressed_flags)?; seq.serialize_element::<Vec<u8>>(&compressed_xs)?; seq.serialize_element::<Vec<u8>>(&compressed_ys)?; } seq.end() } }
#![feature(async_await)] use async_std::task; use futures_timer::Delay; use rand::{thread_rng, Rng}; use std::time::Duration; fn main() { task::block_on(async { let mut tasks = vec![]; for i in 1..10 { tasks.push(async move { let random_delay = thread_rng().gen_range(1, 5); let _ = Delay::new(Duration::from_secs(random_delay)).await; println!("Received {}", i); }); } println!("Tasks triggered, waiting output"); futures::future::join_all(tasks).await; }); }
//! Data-driven game parameters and settings use std::{collections::HashMap, fs::File, path::PathBuf, str::FromStr}; use crate::core::UnitType; use crate::Result; use bevy::prelude::*; use serde::{Deserialize, Serialize}; use std::io::Read; #[derive(Clone, Debug, PartialEq, Hash, Eq, StageLabel)] pub enum ColoniesStage { ActorRpc, Resources, } #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize, SystemLabel)] pub enum WasmColoniesLabels { BigBang, } #[derive(Serialize, Deserialize, Debug, Clone, Default)] pub struct GameParameters { pub construction_times: HashMap<UnitType, u16>, } impl GameParameters { pub fn load_from_file(path: &str) -> Result<GameParameters> { let path = PathBuf::from_str(path)?; let mut f = File::open(path)?; let mut buf = Vec::new(); f.read_to_end(&mut buf)?; Ok(serde_json::from_slice(&buf)?) } }
fn main() { let path = std::env::var("GENIE_PATH").expect("GENIE_PATH env var is not set"); for genie in std::env::args().skip(1) { let mut split = genie.split("."); let name = split.next().unwrap().to_string(); let num = split.next().map(String::from); match genie::find(&path, &name, &num) { Some((src, n)) => match genie::nth(&path, n + 1) { Some(dst) => { let filename = src.file_name().expect("unable to get file name"); let mut dst = std::path::PathBuf::from(dst); dst.push(filename); std::fs::rename(src, dst).expect("failed to move socket"); } None => eprintln!("path exhausted, cannot promote {}", &name), }, None => eprintln!("genie not found in path"), } } }
#[derive(Debug)] pub struct Command { prefix:String, command:String, arguments:Vec<String> } impl Command { pub fn from(msg:&str,prefix:&str) -> Option<Command> { if msg.starts_with(prefix) { let mut cmd = String::new(); let mut last_part = String::new(); let mut params:Vec<String> = Vec::new(); for (ii,chr) in msg.chars().enumerate() { if ii != 0 { if chr == ' ' && cmd.is_empty() { cmd = last_part.clone(); } if chr == '{' { if cmd.is_empty() { cmd = last_part.clone(); } last_part = String::new(); } else if chr == '}' { params.push(last_part.clone()); } if chr != '{' { last_part.push(chr); } } } if cmd.is_empty() { cmd = last_part.clone(); } Some(Command{ prefix:prefix.to_string(), command:cmd, arguments:params }) } else{ None } } }
use uri_path::{path, Path}; macro_rules! path_test { (@assertion $path:ident, matches, $expected:literal) => { assert!($path.matches($expected).is_some()); }; (@assertion $path:ident, non_matches, $expected:literal) => { assert!($path.matches($expected).is_none()); }; (@assertion $path:ident, $assertion:ident, [$($expected:literal),* $(,)?]) => { $( path_test!(@assertion $path, $assertion, $expected); )* }; (@map $ctor:path, {$($name:ident : $value:expr),* $(,)?}) => {{ #[allow(unused_mut)] let mut map = $ctor(); $( map.insert(stringify!($name), $value); )* map }}; (@assertion $path:ident, replace, $map:tt => None) => {{ let params = path_test!(@map ::std::collections::BTreeMap::new, $map); assert!( $path.replace(&params).is_none() ); }}; (@assertion $path:ident, replace, $map:tt => $expected:literal) => {{ let params = path_test!(@map ::std::collections::BTreeMap::new, $map); assert_eq!( $path.replace(&params).unwrap().to_string(), $expected ); }}; (@assertion $path:ident, params, $input:literal => None) => {{ assert!( $path.matches($input).is_none() ); }}; (@assertion $path:ident, params, $input:literal => $map:tt) => {{ let params = path_test!(@map ::std::collections::HashMap::new, $map) .into_iter() .map(|(k, v): (&'static str, &str)| (k, v.to_string())) .collect(); assert_eq!( $path.matches($input).unwrap(), params ); }}; (@assertion $path:ident, $assertion:ident, {$($input:tt => $output:tt),* $(,)?}) => { $( path_test!(@assertion $path, $assertion, $input => $output); )* }; (@assertions $path:ident, {$($assertion:ident: $tests:tt),* $(,)?}) => { $( path_test!(@assertion $path, $assertion, $tests); )* }; ($($label:ident ( $path:expr ) $assertions:tt),* $(,)?) => { $( paste::item! { #[test] fn [<test_matches_ $label>]() { let path: Path = $path; path_test!(@assertions path, $assertions); } } )* }; } path_test! { literal("/test".into()) { matches: "/test", non_matches: ["/", "/other", "/test/other"], params: { "/test" => {}, }, replace: { {} => "/test", {first: "value"} => "/test?first=value", {first: "value", second: "another"} => "/test?first=value&second=another", }, }, segmented(path!("test" / param)) { matches: ["/test/123", "/test/abc"], non_matches: ["/", "/test", "/test/abc/whatever"], params: { "/test" => None, "/test/abc" => {param: "abc"}, "/test/abc/whatever" => None, }, replace: { {} => None, {param: "value"} => "/test/value", {param: "value", first: "other", second: "another"} => "/test/value?first=other&second=another", }, } } #[cfg(feature = "regex")] path_test! { regex_digits(path!("test" / [param ~ r"\d+"])) { matches: ["/test/1", "/test/123", "/test/000"], non_matches: ["/test", "/test/", "/test/abc"], params: { "/test" => None, "/test/abc" => None, "/test/1" => {param: "1"}, "/test/123" => {param: "123"}, }, replace: { {} => None, {param: "123"} => "/test/123", {param: "123", first: "other", second: "another"} => "/test/123?first=other&second=another", }, }, regex_digits_prefixed(path!("test" / [param ~ r"user-\d+"])) { matches: ["/test/user-1", "/test/user-123", "/test/user-000"], non_matches: ["/test", "/test/user", "/test/user-", "/test/user-abc"], params: { "/test" => None, "/test/user" => None, "/test/user-abc" => None, "/test/user-1" => {param: "user-1"}, "/test/user-123" => {param: "user-123"}, }, replace: { {} => None, {param: "user-123"} => "/test/user-123", {param: "user-123", first: "other", second: "another"} => "/test/user-123?first=other&second=another", }, }, }
use client::codec::{EncodeBuf, DecodeBuf}; use bytes::{BufMut}; use prost::Message; use ::std::marker::PhantomData; /// Protobuf codec #[derive(Debug)] pub struct Codec<T, U>(PhantomData<(T, U)>); #[derive(Debug)] pub struct Encoder<T>(PhantomData<T>); #[derive(Debug)] pub struct Decoder<T>(PhantomData<T>); /// Protobuf gRPC type aliases pub mod server { use {Request, Response}; use futures::{Future, Stream, Poll}; use {h2, http}; use tower::Service; /// A specialization of tower::Service. /// /// Existing tower::Service implementations with the correct form will /// automatically implement `GrpcService`. /// /// TODO: Rename to StreamingService? pub trait GrpcService: Clone { /// Protobuf request message type type Request; /// Stream of inbound request messages type RequestStream: Stream<Item = Self::Request, Error = ::Error>; /// Protobuf response message type type Response; /// Stream of outbound response messages type ResponseStream: Stream<Item = Self::Response, Error = ::Error>; /// Response future type Future: Future<Item = ::Response<Self::ResponseStream>, Error = ::Error>; /// Returns `Ready` when the service can accept a request fn poll_ready(&mut self) -> Poll<(), ::Error>; /// Call the service fn call(&mut self, request: Request<Self::RequestStream>) -> Self::Future; } impl<T, S1, S2> GrpcService for T where T: Service<Request = Request<S1>, Response = Response<S2>, Error = ::Error> + Clone, S1: Stream<Error = ::Error>, S2: Stream<Error = ::Error>, { type Request = S1::Item; type RequestStream = S1; type Response = S2::Item; type ResponseStream = S2; type Future = T::Future; fn poll_ready(&mut self) -> Poll<(), ::Error> { Service::poll_ready(self) } fn call(&mut self, request: T::Request) -> Self::Future { Service::call(self, request) } } /// A specialization of tower::Service. /// /// Existing tower::Service implementations with the correct form will /// automatically implement `UnaryService`. pub trait UnaryService: Clone { /// Protobuf request message type type Request; /// Protobuf response message type type Response; /// Response future type Future: Future<Item = ::Response<Self::Response>, Error = ::Error>; /// Returns `Ready` when the service can accept a request fn poll_ready(&mut self) -> Poll<(), ::Error>; /// Call the service fn call(&mut self, request: Request<Self::Request>) -> Self::Future; } impl<T, M1, M2> UnaryService for T where T: Service<Request = Request<M1>, Response = Response<M2>, Error = ::Error> + Clone, { type Request = M1; type Response = M2; type Future = T::Future; fn poll_ready(&mut self) -> Poll<(), ::Error> { Service::poll_ready(self) } fn call(&mut self, request: T::Request) -> Self::Future { Service::call(self, request) } } /// A specialization of tower::Service. /// /// Existing tower::Service implementations with the correct form will /// automatically implement `UnaryService`. pub trait ClientStreamingService: Clone { /// Protobuf request message type type Request; /// Stream of inbound request messages type RequestStream: Stream<Item = Self::Request, Error = ::Error>; /// Protobuf response message type type Response; /// Response future type Future: Future<Item = ::Response<Self::Response>, Error = ::Error>; /// Returns `Ready` when the service can accept a request fn poll_ready(&mut self) -> Poll<(), ::Error>; /// Call the service fn call(&mut self, request: Request<Self::RequestStream>) -> Self::Future; } impl<T, M, S> ClientStreamingService for T where T: Service<Request = Request<S>, Response = Response<M>, Error = ::Error> + Clone, S: Stream<Error = ::Error>, { type Request = S::Item; type RequestStream = S; type Response = M; type Future = T::Future; fn poll_ready(&mut self) -> Poll<(), ::Error> { Service::poll_ready(self) } fn call(&mut self, request: T::Request) -> Self::Future { Service::call(self, request) } } /// A specialization of tower::Service. /// /// Existing tower::Service implementations with the correct form will /// automatically implement `UnaryService`. pub trait ServerStreamingService: Clone { /// Protobuf request message type type Request; /// Protobuf response message type type Response; /// Stream of outbound response messages type ResponseStream: Stream<Item = Self::Response, Error = ::Error>; /// Response future type Future: Future<Item = ::Response<Self::ResponseStream>, Error = ::Error>; /// Returns `Ready` when the service can accept a request fn poll_ready(&mut self) -> Poll<(), ::Error>; /// Call the service fn call(&mut self, request: Request<Self::Request>) -> Self::Future; } impl<T, M, S> ServerStreamingService for T where T: Service<Request = Request<M>, Response = Response<S>, Error = ::Error> + Clone, S: Stream<Error = ::Error>, { type Request = M; type Response = S::Item; type ResponseStream = S; type Future = T::Future; fn poll_ready(&mut self) -> Poll<(), ::Error> { Service::poll_ready(self) } fn call(&mut self, request: T::Request) -> Self::Future { Service::call(self, request) } } #[derive(Debug)] pub struct Grpc<T> where T: GrpcService, { inner: ::server::Grpc<Wrap<T>, ::protobuf::Codec<T::Response, T::Request>>, } #[derive(Debug)] pub struct ResponseFuture<T> where T: GrpcService, { inner: ::server::streaming::ResponseFuture<T::Future, ::protobuf::Encoder<T::Response>>, } /// A protobuf encoded gRPC request stream #[derive(Debug)] pub struct Decode<T> { inner: ::server::Decode<::protobuf::Decoder<T>>, } /// A protobuf encoded gRPC response body pub struct Encode<T> where T: Stream, { inner: ::server::Encode<T, ::protobuf::Encoder<T::Item>>, } // ===== impl Grpc ===== impl<T, U> Grpc<T> where T: GrpcService<Request = U, RequestStream = Decode<U>>, T::Request: ::prost::Message + Default, T::Response: ::prost::Message, { pub fn new(inner: T) -> Self { let inner = ::server::Grpc::new(Wrap(inner), ::protobuf::Codec::new()); Grpc { inner } } } impl<T, U> Service for Grpc<T> where T: GrpcService<Request = U, RequestStream = Decode<U>>, T::Request: ::prost::Message + Default, T::Response: ::prost::Message, { type Request = ::http::Request<::tower_h2::RecvBody>; type Response = ::http::Response<Encode<T::ResponseStream>>; type Error = ::h2::Error; type Future = ResponseFuture<T>; fn poll_ready(&mut self) -> Poll<(), Self::Error> { self.inner.poll_ready() .map_err(Into::into) } fn call(&mut self, request: Self::Request) -> Self::Future { let inner = self.inner.call(request); ResponseFuture { inner } } } impl<T> Clone for Grpc<T> where T: GrpcService + Clone, { fn clone(&self) -> Self { let inner = self.inner.clone(); Grpc { inner } } } // ===== impl ResponseFuture ===== impl<T> Future for ResponseFuture<T> where T: GrpcService, T::Response: ::prost::Message, { type Item = ::http::Response<Encode<T::ResponseStream>>; type Error = ::h2::Error; fn poll(&mut self) -> Poll<Self::Item, Self::Error> { let response = try_ready!(self.inner.poll()); let (head, inner) = response.into_parts(); let body = Encode { inner }; let response = ::http::Response::from_parts(head, body); Ok(response.into()) } } // ===== impl Encode ===== impl<T> ::tower_h2::Body for Encode<T> where T: Stream<Error = ::Error>, T::Item: ::prost::Message, { type Data = ::bytes::Bytes; fn is_end_stream(&self) -> bool { false } fn poll_data(&mut self) -> Poll<Option<Self::Data>, ::h2::Error> { self.inner.poll_data() } fn poll_trailers(&mut self) -> Poll<Option<http::HeaderMap>, h2::Error> { self.inner.poll_trailers() } } // ===== impl Decode ===== impl<T> Stream for Decode<T> where T: ::prost::Message + Default, { type Item = T; type Error = ::Error; fn poll(&mut self) -> Poll<Option<T>, ::Error> { self.inner.poll() } } // ===== impl Wrap ===== #[derive(Debug, Clone)] struct Wrap<T>(T); impl<T, U> Service for Wrap<T> where T: GrpcService<Request = U, RequestStream = Decode<U>>, T::Request: ::prost::Message + Default, T::Response: ::prost::Message, { type Request = Request<::server::Decode<::protobuf::Decoder<T::Request>>>; type Response = Response<T::ResponseStream>; type Error = ::Error; type Future = T::Future; fn poll_ready(&mut self) -> Poll<(), ::Error> { self.0.poll_ready() } fn call(&mut self, request: Self::Request) -> Self::Future { let request = request.map(|inner| Decode { inner }); self.0.call(request) } } } // ===== impl Codec ===== impl<T, U> Codec<T, U> where T: Message, U: Message + Default, { /// Create a new protobuf codec pub fn new() -> Self { Codec(PhantomData) } } impl<T, U> ::server::Codec for Codec<T, U> where T: Message, U: Message + Default, { /// Protocol buffer gRPC content type const CONTENT_TYPE: &'static str = "application/grpc+proto"; type Encode = T; type Encoder = Encoder<T>; type Decode = U; type Decoder = Decoder<U>; fn encoder(&mut self) -> Self::Encoder { Encoder(PhantomData) } fn decoder(&mut self) -> Self::Decoder { Decoder(PhantomData) } } impl<T, U> Clone for Codec<T, U> { fn clone(&self) -> Self { Codec(PhantomData) } } // ===== impl Encoder ===== impl<T> ::server::Encoder for Encoder<T> where T: Message, { type Item = T; fn encode(&mut self, item: T, buf: &mut EncodeBuf) -> Result<(), ::Error> { let len = item.encoded_len(); if buf.remaining_mut() < len { buf.reserve(len); } item.encode(buf) .map_err(|_| unreachable!("Message only errors if not enough space")) } } impl<T> Clone for Encoder<T> { fn clone(&self) -> Self { Encoder(PhantomData) } } // ===== impl Decoder ===== impl<T> ::server::Decoder for Decoder<T> where T: Message + Default, { type Item = T; fn decode(&mut self, buf: &mut DecodeBuf) -> Result<T, ::Error> { Message::decode(buf) .map_err(|_| unimplemented!()) } } impl<T> Clone for Decoder<T> { fn clone(&self) -> Self { Decoder(PhantomData) } }
use super::app_model::{AppModel, ModelFieldName}; use console_error_panic_hook; use env_web::Env; use futures::future; use futures::stream::Stream; use std::panic; use stremio_core::state_types::msg::{Action, Msg}; use stremio_core::state_types::{Environment, Runtime, Update, UpdateWithCtx}; use wasm_bindgen::prelude::{wasm_bindgen, JsValue}; #[wasm_bindgen] pub struct StremioCoreWeb { runtime: Runtime<Env, AppModel>, } #[wasm_bindgen] impl StremioCoreWeb { #[wasm_bindgen(constructor)] pub fn new(emit: js_sys::Function) -> StremioCoreWeb { panic::set_hook(Box::new(console_error_panic_hook::hook)); let app = AppModel::default(); let (runtime, rx) = Runtime::<Env, AppModel>::new(app, 1000); Env::exec(Box::new(rx.for_each(move |msg| { let _ = emit.call1(&JsValue::NULL, &JsValue::from_serde(&msg).unwrap()); future::ok(()) }))); StremioCoreWeb { runtime } } pub fn dispatch(&self, action: &JsValue, model_field: &JsValue) -> JsValue { if let Ok(action) = action.into_serde::<Action>() { let message = Msg::Action(action); let effects = if let Ok(model_field) = model_field.into_serde::<ModelFieldName>() { self.runtime.dispatch_with(|model| match model_field { ModelFieldName::Ctx => model.ctx.update(&message), ModelFieldName::LibraryItems => { model.library_items.update(&model.ctx, &message) } ModelFieldName::ContinueWatchingPreview => { model.continue_watching_preview.update(&model.ctx, &message) } ModelFieldName::Board => model.board.update(&model.ctx, &message), ModelFieldName::Discover => model.discover.update(&model.ctx, &message), ModelFieldName::Library => model.library.update(&model.ctx, &message), ModelFieldName::ContinueWatching => { model.continue_watching.update(&model.ctx, &message) } ModelFieldName::Search => model.search.update(&model.ctx, &message), ModelFieldName::MetaDetails => model.meta_details.update(&model.ctx, &message), ModelFieldName::Addons => model.addons.update(&model.ctx, &message), ModelFieldName::AddonDetails => { model.addon_details.update(&model.ctx, &message) } ModelFieldName::StreamingServer => { model.streaming_server.update(&model.ctx, &message) } ModelFieldName::Player => model.player.update(&model.ctx, &message), }) } else { self.runtime.dispatch(&message) }; Env::exec(effects); JsValue::from(true) } else { JsValue::from(false) } } pub fn get_state(&self, model_field: &JsValue) -> JsValue { let model = &*self.runtime.app.read().unwrap(); if let Ok(model_field) = model_field.into_serde::<ModelFieldName>() { match model_field { ModelFieldName::Ctx => JsValue::from_serde(&model.ctx).unwrap(), ModelFieldName::LibraryItems => JsValue::from_serde(&model.library_items).unwrap(), ModelFieldName::ContinueWatchingPreview => { JsValue::from_serde(&model.continue_watching_preview).unwrap() } ModelFieldName::Board => JsValue::from_serde(&model.board).unwrap(), ModelFieldName::Discover => JsValue::from_serde(&model.discover).unwrap(), ModelFieldName::Library => JsValue::from_serde(&model.library).unwrap(), ModelFieldName::ContinueWatching => { JsValue::from_serde(&model.continue_watching).unwrap() } ModelFieldName::Search => JsValue::from_serde(&model.search).unwrap(), ModelFieldName::MetaDetails => JsValue::from_serde(&model.meta_details).unwrap(), ModelFieldName::Addons => JsValue::from_serde(&model.addons).unwrap(), ModelFieldName::AddonDetails => JsValue::from_serde(&model.addon_details).unwrap(), ModelFieldName::StreamingServer => { JsValue::from_serde(&model.streaming_server).unwrap() } ModelFieldName::Player => JsValue::from_serde(&model.player).unwrap(), } } else { JsValue::from_serde(model).unwrap() } } }
/*! Shows how to add controls dynamically into a flexbox layout */ extern crate native_windows_gui as nwg; extern crate native_windows_derive as nwd; use nwd::NwgUi; use nwg::{NativeUi, stretch}; use stretch::geometry::Size; use stretch::style::*; use std::cell::RefCell; #[derive(Default, NwgUi)] pub struct FlexboxDynamic { #[nwg_control(size: (300, 500), position: (400, 200), title: "Flexbox example")] #[nwg_events( OnWindowClose: [nwg::stop_thread_dispatch()], OnInit: [FlexboxDynamic::setup] )] window: nwg::Window, #[nwg_layout(parent: window, flex_direction: FlexDirection::Column)] layout: nwg::FlexboxLayout, buttons: RefCell<Vec<nwg::Button>>, } impl FlexboxDynamic { fn setup(&self) { let mut buttons = self.buttons.borrow_mut(); for i in 0.. 20 { buttons.push(nwg::Button::default()); let button_index = buttons.len() - 1; nwg::Button::builder() .text(&format!("Button {}", i+1)) .parent(&self.window) .build(&mut buttons[button_index]).expect("Failed to create button"); let style = Style { size: Size { width: Dimension::Auto, height: Dimension::Points(100.0) }, justify_content: JustifyContent::Center, ..Default::default() }; self.layout.add_child(&buttons[button_index], style).expect("Failed to add button to layout"); } } } fn main() { nwg::init().expect("Failed to init Native Windows GUI"); nwg::Font::set_global_family("Segoe UI").expect("Failed to set default font"); let _app = FlexboxDynamic::build_ui(Default::default()).expect("Failed to build UI"); nwg::dispatch_thread_events(); }
mod fixture; #[cfg(test)] mod integration { use super::*; #[test] fn test_helper() { let (dimensions, rgba) = fixture::get_fixture_image("beach-1.jpeg"); assert_eq!(dimensions.width, 300); assert_eq!(dimensions.height, 180); assert_eq!(rgba.len(), 300 * 180 * 4); } #[test] fn test_beach_example() { let (dimensions, image_data) = fixture::get_fixture_image("beach-1.jpeg"); let mut carver = seam_carving::SeamCarver::from_vec(image_data, dimensions.width, dimensions.height); let steps = 100; for _ in 0..steps { carver.mark_seam(); carver.delete_seam(); } let resized_image_data = carver.image_data_vec(); let expected_size = (dimensions.width - steps) * dimensions.height * 4; assert_eq!(resized_image_data.len(), expected_size as usize); fixture::save_fixture_image( "beach-1-resized.jpeg", dimensions.width - steps, dimensions.height, resized_image_data, ); } #[test] fn test_beach_flipped_example() { let (dimensions, image_data) = fixture::get_fixture_image("beach-1-flipped.jpeg"); let mut carver = seam_carving::SeamCarver::from_vec(image_data, dimensions.width, dimensions.height); let steps = 100; for _ in 0..steps { carver.mark_seam(); carver.delete_seam(); } let resized_image_data = carver.image_data_vec(); let expected_size = (dimensions.width - steps) * dimensions.height * 4; assert_eq!(resized_image_data.len(), expected_size as usize); fixture::save_fixture_image( "beach-1-flipped-resized.jpeg", dimensions.width - steps, dimensions.height, resized_image_data, ); } }
use gl_bindings::gl; #[derive(Copy, Clone)] pub struct ImageFormat { format_gl: gl::enuma, } impl ImageFormat { pub fn get(format_gl: gl::enuma) -> ImageFormat { ImageFormat { format_gl } } pub fn as_gl_enum(&self) -> gl::enuma { self.format_gl } }
test_stdout!(without_exiting_returns_true, "true\n"); // with_exiting_returns_false in unit tests
use P32::gcd; pub fn is_coprime_to(a: u32, b: u32) -> bool { gcd(a, b) == 1 } #[cfg(test)] mod tests { use super::*; #[test] fn test_is_coprime_to() { assert_eq!(is_coprime_to(35, 64), true); assert_eq!(is_coprime_to(35, 65), false); } }
use std::{fmt::Display, sync::Arc}; use datafusion::physical_plan::{ stream::RecordBatchStreamAdapter, ExecutionPlan, SendableRecordBatchStream, }; use super::DataFusionPlanExec; /// Creates a DataFusion plan that does nothing (for use in testing) #[derive(Debug, Default)] pub struct NoopDataFusionPlanExec; impl NoopDataFusionPlanExec { pub fn new() -> Self { Self } } impl Display for NoopDataFusionPlanExec { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "noop") } } impl DataFusionPlanExec for NoopDataFusionPlanExec { fn exec(&self, plan: Arc<dyn ExecutionPlan>) -> Vec<SendableRecordBatchStream> { let stream_count = plan.output_partitioning().partition_count(); let schema = plan.schema(); (0..stream_count) .map(|_| { let stream = futures::stream::empty(); let stream = RecordBatchStreamAdapter::new(Arc::clone(&schema), stream); Box::pin(stream) as SendableRecordBatchStream }) .collect() } }
// Copyright 2021 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::collections::BTreeMap; use anyhow::Context; use anyhow::Result; use gix::commit::describe::SelectRef; use gix::Repository; // Get the latest tag: // git describe --tags --abbrev=0 // v0.6.99-nightly pub fn get_latest_tag(repo: &Repository) -> Result<String> { let hc = repo.head_commit()?; let desc = hc .describe() .names(SelectRef::AllTags) .try_resolve()? .with_context(|| { format!( "Did not find a single candidate ref for naming id '{}'", hc.id ) })?; let tag = desc .format()? .name .with_context(|| format!("Did not find a valid tag for '{}'", hc.id))?; Ok(tag.to_string()) } // Get commit author list // git shortlog HEAD -sne | awk '{$1=""; sub(" ", " \""); print }' | awk -F'<' '!x[$1]++' | awk -F'<' '!x[$2]++' | awk -F'<' '{gsub(/ +$/, "\",", $1); print $1}' | sort | xargs // use email to uniq authors pub fn get_commit_authors(repo: &Repository) -> Result<String> { let mut authors: BTreeMap<String, String> = BTreeMap::new(); let revwalk = repo .rev_walk(Some(repo.head_id()?.detach())) .all()? .filter_map(Result::ok); for oid in revwalk { let obj = oid.try_object()?; match obj { None => continue, Some(object) => { let cm = object.try_into_commit()?; let author = cm.author()?; let email = author.email.to_string(); if authors.contains_key(&email) { continue; } let name = author.name.to_string(); authors.insert(email, name); } } } let result = authors .values() .map(|name| (name, 1)) .collect::<BTreeMap<&String, u8>>() .keys() .map(|name| name.as_str()) .collect::<Vec<&str>>() .join(", "); Ok(result) }
//! File I/O traits. extern crate libc; use std::mem; use std::slice; use std::io::Result; use std::path::Path; use super::layer::Layer; use super::variant::Variant; use super::context::Context; pub enum Status { Done = 0, Error = 1, } /// A raw frame. #[repr(C)] pub struct RawFrame { link: u32, payload: *const libc::c_char, len: libc::size_t, actlen: libc::size_t, ts_sec: i64, ts_nsec: i64, root: *const Layer, data: Variant, } impl RawFrame { /// Returns the link layer of `self`. pub fn link(&self) -> u32 { self.link } /// Sets the link layer of `self`. pub fn set_link(&mut self, val: u32) { self.link = val; } /// Returns the payload of `self`. pub fn payload(&self) -> &[u8] { unsafe { slice::from_raw_parts(self.payload as *const u8, self.len as usize) } } /// Sets the payload of `self`. /// /// This method calls `mem::forget` to `data` so it will remain until /// the current process is terminated. pub fn set_payload_and_forget(&mut self, data: Box<[u8]>) { self.payload = data.as_ptr() as *const i8; self.len = data.len() as usize; mem::forget(data); } /// Returns a reference to the custom metadata of `self`. pub fn data(&self) -> &Variant { &self.data } /// Returns a mutable reference to the custom metadata of `self`. pub fn data_mut(&mut self) -> &mut Variant { &mut self.data } /// Returns the actual length of `self`. pub fn actlen(&self) -> usize { self.actlen } /// Sets the actual length of `self`. pub fn set_actlen(&mut self, val: usize) { self.actlen = val; } /// Returns the timestamp of `self`. pub fn ts(&self) -> (i64, i64) { (self.ts_sec, self.ts_nsec) } /// Sets the timestamp of `self`. pub fn set_ts(&mut self, val: (i64, i64)) { self.ts_sec = val.0; self.ts_nsec = val.1; } /// Returns the root `Layer` of `self`. pub fn root(&self) -> Option<&Layer> { if self.root.is_null() { None } else { unsafe { Some(&*self.root) } } } } /// An importer trait. pub trait Importer { fn is_supported(_ctx: &mut Context, _path: &Path) -> bool { false } fn start( _ctx: &mut Context, _path: &Path, _dst: &mut [RawFrame], _cb: &Fn(&mut Context, usize, f64), ) -> Result<()> { Ok(()) } } /// An exporter trait. pub trait Exporter { fn is_supported(_ctx: &mut Context, _path: &Path) -> bool { false } fn start( _ctx: &mut Context, _path: &Path, _cb: &Fn(&mut Context) -> &[RawFrame], ) -> Result<()> { Ok(()) } }
type FloatStream = Box<Iterator<Item=f64>>; use controls::Switch; #[derive(Debug)] enum ADSRState { Start, Attack, Decay, Sustain, Release, Idle, } /// FilterADSR /// /// The attack, decay, sustain, release envelope helps us approximate real /// instruments and how the vibrations they create sound over time. Really, /// we're controlling volume over some duration and so a lot of the internal /// code here is going to be line drawing with Y being the volume and X /// being how long the part of the note should ring in or out for pub struct FilterADSR { state: ADSRState, /// When this switch is turned on, play a note play: Switch, /// This is essentially our X for line drawing. Always starts at zero. counter: f64, /// This is our M for line drawing current_slope: f64, /// This is our Y offset current_offset: f64, /// Whether the note can be released or not allow_release: bool, generator: FloatStream, attack: f64, decay: f64, sustain: f64, release: f64, } impl FilterADSR { fn calc_slope(startx: f64, starty: f64, endx: f64, endy: f64) -> f64 { if endx == startx { return endy - starty; } (endy - starty) / (endx - startx) } pub fn new(generator: FloatStream, play: Switch, a: f64, d: f64, s: f64, r: f64) -> Box<FilterADSR> { let a = FilterADSR { state: ADSRState::Idle, play: play, counter: 0.0, current_slope: 0.0, current_offset: 0.0, allow_release: false, generator: generator, //TODO: Create interface for generator(s) and pull the sample rate from them attack: a * 44.1, decay: d * 44.1, sustain: s, release: r * 44.1, }; Box::new(a) } } impl Iterator for FilterADSR { type Item = f64; fn next(&mut self) -> Option<f64> { match self.state { ADSRState::Idle => { if self.play.get() { self.state = ADSRState::Start; } return Some(0.0) }, _ => { if !self.play.get() { self.allow_release = true; } } } if let Some(x) = self.generator.next() { match self.state { ADSRState::Start => { self.state = ADSRState::Attack; self.counter = 0.0; self.current_slope = FilterADSR::calc_slope(0.0, 0.0, self.attack, 1.0); self.current_offset = 0.0; self.allow_release = false; }, ADSRState::Attack => { if self.counter > self.attack { self.state = ADSRState::Decay; self.counter = 0.0; self.current_slope = FilterADSR::calc_slope(0.0, 1.0, self.decay, self.sustain); self.current_offset = 1.0; } else { self.counter += 1.0; } }, ADSRState::Decay => { if self.counter > self.decay { self.state = ADSRState::Sustain; } else { self.counter += 1.0; } } ADSRState::Sustain => { if self.allow_release { self.state = ADSRState::Release; self.counter = 0.0; self.current_slope = FilterADSR::calc_slope(0.0, self.sustain, self.release, 0.0); self.current_offset = self.sustain; } } ADSRState::Release => { if self.counter > self.release { self.state = ADSRState::Idle; } else { self.counter += 1.0; } } ADSRState::Idle => return Some(0.0) } let volume = self.counter * self.current_slope + self.current_offset; return Some(volume * x); } None } }
use yew::prelude::*; use yew_router::components::RouterAnchor; use crate::app::AppRoute; pub struct EnterpriseHome { learn_more: bool, link: ComponentLink<Self>, } pub enum Msg { LearnMore, HideDetails } impl Component for EnterpriseHome { type Message = Msg; type Properties = (); fn create(_: Self::Properties, link: ComponentLink<Self>) -> Self { EnterpriseHome { learn_more: false, link, } } fn update(&mut self, msg: Self::Message) -> ShouldRender { match msg { Msg::LearnMore => { self.learn_more = true; true } Msg::HideDetails => { self.learn_more = false; true } } } fn change(&mut self, _: Self::Properties) -> ShouldRender { false } fn view(&self) -> Html { type Anchor = RouterAnchor<AppRoute>; html! { <div class="mx-auto pt-5 pb-5 px-4" style="max-width: 1048px;" > <div class="mb-3" > <div class="d-flex flex-row mb-3" > <div class="flex-fill fs-3 fw-bold" > {"Enterprise Connections"} </div> </div> <p> {"Configure Enterprise Connections like AD, SAML, Google Workspace and others so that you can let your users login with them. "} { if self.learn_more == true { html! { <a href="javascript: void(0)" class="text-decoration-none" onclick=self.link.callback(|_| Msg::HideDetails) > <span style=" white-space: nowrap; text-overflow: ellipsis; overflow: hidden; font-size: 14px; text-decoration: none; " > {"Hide details"} <i class="bi bi-arrow-right-short fs-5" style="vertical-align: -3px; margin-left: -2px;"></i> </span> </a> } } else { html! { <a href="javascript: void(0)" class="text-decoration-none" onclick=self.link.callback(|_| Msg::LearnMore) > <span style=" white-space: nowrap; text-overflow: ellipsis; overflow: hidden; font-size: 14px; text-decoration: none; " > {"Learn more"} <i class="bi bi-arrow-right-short fs-5" style="vertical-align: -3px; margin-left: -2px;"></i> </span> </a> } } } </p> { if self.learn_more == true { html! { <div class="alert alert-secondary" role="alert" style="font-size: 13px;" > <div class="fw-bold mb-3 pb-2" style=" font-size: 13px; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid rgb(200, 200, 200); " > {"With enterprise connection you can"} </div> <div class="d-inline-flex flex-row w-50" > <i class="bi bi-info-circle-fill me-4"></i> <p class="pe-5" > {"Let your users use their enterprise credentials to login to your app."} </p> </div> <div class="d-inline-flex flex-row" style="width: 49%;" > <i class="bi bi-info-circle-fill me-4"></i> <p class="pe-5" > {"Use Auth0's AD Connector to let Auth0 access your AD or LDAP enterprise IdP securely for validating user credentials."} </p> </div> <div class="d-inline-flex flex-row w-50" > <i class="bi bi-info-circle-fill me-4"></i> <p class="pe-5" > {"Use Auth0's beautiful Login Box Lock to let your users choose how to authenticate."} </p> </div> <div class="d-inline-flex flex-row" style="width: 49%;" > <i class="bi bi-info-circle-fill me-4"></i> <p class="pe-5" > {"Implement single sign on in your applications with a flip of a switch."} </p> </div> </div> } } else { html! {} } } </div> <div class="alert alert-warning mb-5" role="alert"> <i class="bi bi-exclamation-triangle me-2"></i> {"This feature is not included in your current plan. Upgrade your Subscription Enterprise connections in production."} </div> <div> <Anchor route=AppRoute::EnterpriseGoogle classes="d-flex border-bottom border-1 list-hover justify-content-between pe-auto text-decoration-none" > <div class="p-3 d-flex" style="width: 40%;" > <div style="flex: 0 0 auto; width: 40px; height: 40px;" class="d-flex justify-content-center align-items-center rounded me-3 border" > <img src="/assets/icons/google-avatar.png" class="w-50" /> </div> <div class="d-grid align-items-center" style="min-width: 40px;" > <span class="fw-bold mb-0" style=" white-space: nowrap; text-overflow: ellipsis; overflow: hidden; font-size: 14px; " > {"Google Workspace"} </span> </div> </div> <div class="p-3 d-flex align-items-center dropdown" > <button type="button" style="flex: 0 0 auto; width: 30px; height: 30px;" class="btn d-flex justify-content-center align-items-center rounded border" role="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false" > <i class="bi bi-plus"></i> </button> <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1"> <li> <Anchor route=AppRoute::SocialSettings classes="dropdown-item fs-7"> {"Settings"} </Anchor> </li> </ul> </div> </Anchor> <Anchor route=AppRoute::SocialSettings classes="d-flex border-bottom border-1 list-hover justify-content-between pe-auto text-decoration-none" > <div class="p-3 d-flex" style="width: 40%;" > <div style="flex: 0 0 auto; width: 40px; height: 40px;" class="d-flex justify-content-center align-items-center rounded me-3 border" > <img src="/assets/icons/azure-avatar.png" class="w-50" /> </div> <div class="d-grid align-items-center" style="min-width: 40px;" > <span class="fw-bold mb-0" style=" white-space: nowrap; text-overflow: ellipsis; overflow: hidden; font-size: 14px; " > {"Microsoft Azure AD"} </span> </div> </div> <div class="p-3 d-flex align-items-center dropdown" > <button type="button" style="flex: 0 0 auto; width: 30px; height: 30px;" class="btn d-flex justify-content-center align-items-center rounded border" role="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false" > <i class="bi bi-plus"></i> </button> <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1"> <li> <Anchor route=AppRoute::ApisSettings classes="dropdown-item fs-7"> {"Settings"} </Anchor> </li> </ul> </div> </Anchor> </div> </div> } } }
// based on: http://www.amnoid.de/gc/yaz0.txt <3 and libyaz0: https://github.com/aboood40091/libyaz0 #[cfg(test)] extern crate rand; #[cfg(test)] extern crate pretty_assertions; extern crate byteorder; use byteorder::{ReadBytesExt, WriteBytesExt, BE}; use std::io::Cursor; use std::io::SeekFrom; use std::io::prelude::*; use std::iter::FromIterator; // say you have a vector and only need from vec[5:7] you can do this via this // function and yes that thing is not really effective .... pub fn get_subvector(base: &Vec<u8>, from: usize, till: usize) -> Vec<u8> { if from >= till { return vec![]; } else if from > base.len() { return vec![]; } else if till > base.len() { return vec![]; } Vec::from_iter(base[from..till].iter().cloned()) } // TODO: test_decompress ?! // TODO: I think I need to add a Yaz0 magic?! // TODO: compress is broken! It takes like forever! #[cfg(test)] mod tests { #[test] fn test_get_subvector() { let ret = super::get_subvector(&vec![1, 2, 3, 4, 5, 6, 7, 8, 9], 3, 7); assert_eq!(ret, [4, 5, 6, 7]); } #[test] fn test_compress() { use rand::{thread_rng, Rng}; let mut rng = thread_rng(); // executes for all compression levels: for i in 0..9 { // generate a random block of data to test with: let mut block: Vec<u8> = Vec::new(); while block.len() != 2048 { block.push(rng.gen_range(0, 255)); } // run the test: super::compress(block, i); } } } // this function searches for recurring sequences?! fn compression_search(buffer: &Vec<u8>, pos: usize, max_len: usize, search_range: usize, src_end: usize) -> (usize, usize) { let mut found_len = 1; let mut found = 0; // println!("search_range: {}", search_range); // println!("pos: {}", pos); // println!("max_len: {}", max_len); // println!("src_end: {}", src_end); if pos + 2 < src_end { let mut search: isize = pos as isize - search_range as isize; if search < 0 { search = 0; } let mut cmp_end = pos + max_len; if cmp_end > src_end { cmp_end = src_end; } let c1 = get_subvector(&buffer, pos, pos+1); while search < pos as isize { search = { // TODO: this might be broken! // it should implement pythons str.find(sub[, start[, end]] ) let mut result: isize = -1; for i in search..pos as isize{ if c1 == get_subvector(&buffer, i as usize, c1.len()) { result = i as isize; break; } } result }; if search == -1 { break; } let mut cmp1 = (search + 1) as usize; let mut cmp2 = pos + 1; while cmp2 < cmp_end && buffer[cmp1] == buffer[cmp2] { cmp1 += 1; cmp2 += 1; } let len_ = cmp2 - pos; if found_len < len_ { found_len = len_; found = search as usize; if found_len == max_len { break; } } search += 1 } } (found, found_len) } /// most likely broken, but it "should" compress your stuff, /// I recommend using the other Yaz0 library for compression. /// The one who wrote it seems to be a lot more knowledgable /// in both Rust and Compression algorithms :/ pub fn compress(buffer: Vec<u8>, level: usize) -> Vec<u8> { let mut result: Vec<u8> = Vec::new(); let search_range = { if level == 0 { 0 } else if level < 9 { 0x10E0 * level / 9 - 0x0E0 } else { 0x1000 } }; let src_end = buffer.len(); let max_len = 0x111; let mut code_byte_pos; let mut pos = 0; while pos < src_end { code_byte_pos = result.len(); result.push(0); for i in 0..8 { if pos >= src_end { break; } let mut found_len = 1; let mut found = 0; if search_range > 0 { let ret = compression_search( &buffer, pos, max_len, search_range, src_end ); found = ret.0; found_len = ret.1; } if found_len > 2 { let delta = pos - found - 1; if found_len < 0x12 { result.push((delta >> 8 | (found_len - 2) << 4) as u8); result.push((delta & 0xFF) as u8); } else { result.push((delta >> 8) as u8); result.push((delta & 0xFF) as u8); result.push(((found_len - 0x12) & 0xFF) as u8); } pos += found_len; } else { result[code_byte_pos] |= 1 << (7 - i); result.push(buffer[pos]); pos += 1; } } } result } // aliases for compress and decompress: /// another name for compressing pub fn deflate(buffer: Vec<u8>, level: usize) -> Vec<u8> { compress(buffer, level) } /// another name for decompressing pub fn inflate(buffer: Vec<u8>) -> Vec<u8> { decompress(buffer) } /// generates a Yaz0 header. pub fn generate_header(size: u32) -> Vec<u8> { // TODO: make it a slice ? let mut result: Vec<u8> = b"Yaz0".to_vec(); result.write_u32::<BE>(size).unwrap(); result.append(&mut [0u8; 8].to_vec()); result } fn get_size(buffer: &Vec<u8>) -> usize { // TODO: looks pretty slow :/ let mut rdr = Cursor::new(buffer); rdr.seek(SeekFrom::Start(4)).unwrap(); rdr.read_u32::<BE>().unwrap() as usize } // for more information please visit the link mentioned on top of this file /// decompresses the entire buffer :) pub fn decompress(buffer: Vec<u8>) -> Vec<u8> { let size = get_size(&buffer); let mut result: Vec<u8> = Vec::with_capacity(size); let mut cursor = 16; // first 16 bytes are the header so we start reading at byte 17 let mut rcursor = 0; // result cursor let mut code = buffer[cursor]; cursor += 1; // code tells what to do next... let mut used_bits = 0; while rcursor < size { if used_bits == 8 { code = buffer[cursor]; cursor += 1; used_bits = 0; } // simply copy the byte: if 0x80 & code != 0 { result.push(buffer[cursor]); rcursor += 1; cursor += 1; } else { let mut byte_count = buffer[cursor] as usize; cursor += 1; let b2 = buffer[cursor] as usize; cursor += 1; // copy_source = where the byte is located in the source buffer let mut copy_source = rcursor - ((byte_count & 0x0F) << 8 | b2) - 1; if byte_count >> 4 == 0 { byte_count = (buffer[cursor] as usize) + 0x12; cursor += 1; } else { byte_count = (byte_count >> 4) + 2; } for _ in 0..byte_count { result.push(result[copy_source]); copy_source += 1; rcursor += 1; } } code <<= 1; used_bits += 1; } result } /// my first try porting a compression algorithm, /// it's really just the direct port of the python3 /// version ;) /// /// just call it with your buffer and it will give you a decompressed buffer back. pub fn alt_decompress(buffer: Vec<u8>) -> Vec<u8> { let mut result: Vec<u8> = Vec::new(); let src_end: usize = buffer.len(); let dest_end: usize = { let mut rdr = Cursor::new(get_subvector(&buffer, 4, 8)); rdr.read_u32::<BE>().unwrap() as usize }; // fill vector with 0's to prevent indexing error :) // NOTE is pointless ._. while result.len() != dest_end { result.push(0); } let mut code = buffer[16]; let mut src_pos: usize = 17; let mut dest_pos: usize = 0; while src_pos < src_end && dest_pos < dest_end { let mut normal_exit: bool = true; for _ in 0..8 { if src_pos >= src_end || dest_pos >= dest_end { normal_exit = false; break; } if code & 0x80 > 0 { result[dest_pos] = buffer[src_pos]; dest_pos += 1; src_pos += 1; } else { let b1 = buffer[src_pos] as usize; src_pos += 1; let b2 = buffer[src_pos] as usize; src_pos += 1; let mut copy_src: usize = { dest_pos - ((b1 & 0x0F) << 8 | b2) - 1 }; let n = { if b1 >> 4 == 0 { let temp: usize = (buffer[src_pos] as usize) + 0x12; src_pos += 1; temp } else { ((b1 >> 4) + 2) as usize } }; for _ in 0..n { result[dest_pos] = result[copy_src]; dest_pos += 1; copy_src += 1; } } code <<= 1; } if normal_exit { if src_pos >= src_end || dest_pos >= dest_end { break; } code = buffer[src_pos]; src_pos += 1; } } result }
use std::collections::HashMap; use ::TypeContainer; use ::ir::variant::Variant; use super::ast::{Block, Statement, Value, Ident, Item}; fn ir_to_spec(type_name: String, typ: TypeContainer) -> Statement { let mut statement = ir_to_spec_inner(typ); statement.items.insert( 0, Value::Item(Item { name: Ident::Simple("def_type".into()), args: vec![Value::String { string: type_name, is_block: false, } .into()], block: Block::empty(), }) ); statement } fn ir_to_spec_inner(typ: TypeContainer) -> Statement { let typ_inner = typ.borrow(); let typ_variant = &typ_inner.variant; let typ_data = &typ_inner.data; match *typ_variant { Variant::SimpleScalar(_) => { Statement { attributes: HashMap::new(), items: vec![ Value::Item(Item { name: Ident::RootNs(vec![ "native".into(), typ_data.name.to_string() ]), args: vec![], block: Block::empty(), }) ], } } Variant::Container(ref inner) => { Statement { attributes: HashMap::new(), items: vec![ Value::Item(Item { name: Ident::Simple("container".into()), args: vec![], block: Block { statements: inner.fields .iter() .map(|field| { let child = field.child.upgrade().unwrap(); let mut statement = ir_to_spec_inner(child); statement.items.insert( 0, Value::Item(Item { name: Ident::Simple("field".into()), args: vec![Value::String { string: field.name .to_string(), is_block: false, } .into()], block: Block::empty(), }) ); statement }) .collect(), }, }) ], } } _ => unimplemented!(), } } #[cfg(test)] mod tests { use super::ir_to_spec; use ::frontend::protocol_spec; use self::protocol_spec::ast::printer::print; use self::protocol_spec::ast::Block; #[test] fn basic_container() { let json = "[\"container\", [{\"name\": \"foo\", \"type\": \"u8\"}]]"; let ast = ::json_to_final_ast(json).unwrap(); let spec_ast = ir_to_spec("test_type".into(), ast); let spec = print(&Block { statements: vec![spec_ast] }); println!("{}", spec); } }
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type IndexedResourceCandidate = *mut ::core::ffi::c_void; pub type IndexedResourceQualifier = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct IndexedResourceType(pub i32); impl IndexedResourceType { pub const String: Self = Self(0i32); pub const Path: Self = Self(1i32); pub const EmbeddedData: Self = Self(2i32); } impl ::core::marker::Copy for IndexedResourceType {} impl ::core::clone::Clone for IndexedResourceType { fn clone(&self) -> Self { *self } } pub type ResourceIndexer = *mut ::core::ffi::c_void;
use std::{cell::RefCell, rc::Rc}; use crate::types::{ dot_pair::DotPair, exception::Exception, list::{List, ListItem}, value::Value, DynType, }; use super::{ calculators::calculate, scope::{Scope, ScopeRef, ScopeState}, special_forms::SpecialForms, }; pub struct CustomFunction { expression: Value, outer_scope: ScopeRef, arg_symbols: Value, } impl CustomFunction { pub fn new(expression: Value, outer_scope: ScopeRef, arg_symbols: Value) -> Self { Self { expression, outer_scope, arg_symbols, } } pub fn call(&self, special_forms: Rc<SpecialForms>, args: Value) -> Result<Value, Exception> { let scope = Rc::new(RefCell::new(Scope::new(Some(self.outer_scope.clone())))); self.define_parameters_in_scope(scope.clone(), args)?; calculate( special_forms.clone(), scope, ScopeState::Expression, self.expression.clone(), ) } fn define_parameters_in_scope(&self, scope: ScopeRef, args: Value) -> Result<(), Exception> { let mut defined_args = List::new(self.arg_symbols.clone()); let mut got_args = List::new(args); let prepared_exception = Err(Exception { thrown_object: Value::new( DynType::Str(format!("Arguments count error, given more or less")), None, ), traceback: vec![], previous_exception: None, }); while let ListItem::Middle(value) = defined_args.next() { let next = match got_args.next().to_middle() { Ok(v) => v, Err(_) => return prepared_exception, }; scope .borrow_mut() .define_variable(value.content.to_symbol()?, next)?; } match (defined_args.next(), got_args.next()) { (ListItem::Last(last), ListItem::Middle(got)) | (ListItem::Last(last), ListItem::Last(got)) => { scope.borrow_mut().define_variable( last.content.to_symbol()?, Value::new( DynType::Pair(DotPair { left: got, right: got_args.current_value, }), None, ), )?; } (ListItem::End, ListItem::End) => {} _ => return prepared_exception, } Ok(()) } }
//required in order for near_bindgen macro to work outside of lib.rs use crate::core::U256; use crate::interface::Operator; use crate::near::NO_DEPOSIT; use crate::*; use crate::{ domain::{self, Account, RedeemLock, RedeemStakeBatch, RegisteredAccount, StakeBatch}, errors::{ illegal_state::{ REDEEM_STAKE_BATCH_RECEIPT_SHOULD_EXIST, REDEEM_STAKE_BATCH_SHOULD_EXIST, STAKE_BATCH_SHOULD_EXIST, }, redeeming_stake_errors::NO_REDEEM_STAKE_BATCH_TO_RUN, staking_errors::{ BLOCKED_BY_BATCH_RUNNING, BLOCKED_BY_STAKE_TOKEN_VALUE_REFRESH, NO_FUNDS_IN_STAKE_BATCH_TO_WITHDRAW, }, staking_service::{ BATCH_BALANCE_INSUFFICIENT, DEPOSIT_REQUIRED_FOR_STAKE, INSUFFICIENT_STAKE_FOR_REDEEM_REQUEST, ZERO_REDEEM_AMOUNT, }, }, interface::{ staking_service::events, BatchId, RedeemStakeBatchReceipt, StakingService, YoctoNear, YoctoStake, }, near::{log, YOCTO}, staking_pool::StakingPoolPromiseBuilder, }; use near_sdk::{ env, ext_contract, near_bindgen, serde::{Deserialize, Serialize}, AccountId, Promise, PromiseOrValue, }; #[near_bindgen] impl StakingService for Contract { fn staking_pool_id(&self) -> AccountId { self.staking_pool_id.clone() } fn stake_batch_receipt(&self, batch_id: BatchId) -> Option<interface::StakeBatchReceipt> { self.stake_batch_receipts .get(&batch_id.into()) .map(interface::StakeBatchReceipt::from) } fn redeem_stake_batch_receipt( &self, batch_id: BatchId, ) -> Option<interface::RedeemStakeBatchReceipt> { self.redeem_stake_batch_receipts .get(&batch_id.into()) .map(interface::RedeemStakeBatchReceipt::from) } #[payable] fn deposit(&mut self) -> BatchId { let mut account = self.predecessor_registered_account(); let near_amount = env::attached_deposit().into(); let batch_id = self.deposit_near_for_account_to_stake(&mut account, near_amount); self.check_min_required_near_deposit(&account, batch_id); self.save_registered_account(&account); self.log_stake_batch(batch_id); batch_id.into() } /// stakes the funds collected within the contract level `StakeBatch` fn stake(&mut self) -> PromiseOrValue<BatchId> { match self.stake_batch_lock { None => self.run_stake_batch().into(), Some(StakeLock::Staking) => panic!(BLOCKED_BY_BATCH_RUNNING), Some(StakeLock::Staked { .. }) => { let batch = self.stake_batch.expect(STAKE_BATCH_SHOULD_EXIST); self.process_staked_batch(); PromiseOrValue::Value(batch.id().into()) } Some(StakeLock::RefreshingStakeTokenValue) => { panic!(BLOCKED_BY_STAKE_TOKEN_VALUE_REFRESH) } } } #[payable] fn deposit_and_stake(&mut self) -> PromiseOrValue<BatchId> { let batch_id = self.deposit(); if self.can_run_batch() { self.stake() } else { PromiseOrValue::Value(batch_id) } } fn withdraw_from_stake_batch(&mut self, amount: YoctoNear) { let mut account = self.predecessor_registered_account(); self.claim_receipt_funds(&mut account); if let Some(mut batch) = account.next_stake_batch { let amount = amount.into(); let batch_id = batch.id(); // remove funds from contract level batch { let mut batch = self.next_stake_batch.expect( "next_stake_batch at contract level should exist if it exists at account level", ); if batch.remove(amount).value() == 0 { self.next_stake_batch = None; } else { self.next_stake_batch = Some(batch); } } if batch.remove(amount).value() == 0 { account.next_stake_batch = None; } else { self.check_stake_batch_min_required_near_balance(batch); account.next_stake_batch = Some(batch); } self.save_registered_account(&account); Promise::new(env::predecessor_account_id()).transfer(amount.value()); self.log_stake_batch(batch_id); return; } if let Some(mut batch) = account.stake_batch { assert!(self.can_run_batch(), BLOCKED_BY_BATCH_RUNNING); let amount = amount.into(); let batch_id = batch.id(); // remove funds from contract level batch { let mut batch = self.stake_batch.expect( "stake_batch at contract level should exist if it exists at account level", ); if batch.remove(amount).value() == 0 { self.stake_batch = None; } else { self.stake_batch = Some(batch); } } if batch.remove(amount).value() == 0 { account.stake_batch = None; } else { account.stake_batch = Some(batch); } self.save_registered_account(&account); Promise::new(env::predecessor_account_id()).transfer(amount.value()); self.log_stake_batch(batch_id); return; } panic!(NO_FUNDS_IN_STAKE_BATCH_TO_WITHDRAW); } fn withdraw_all_from_stake_batch(&mut self) -> YoctoNear { let mut account = self.predecessor_registered_account(); self.claim_receipt_funds(&mut account); if let Some(batch) = account.next_stake_batch { let amount = batch.balance().amount(); let batch_id = batch.id(); // remove funds from contract level batch { let mut batch = self.next_stake_batch.expect( "next_stake_batch at contract level should exist if it exists at account level", ); if batch.remove(amount).value() == 0 { self.next_stake_batch = None; } else { self.next_stake_batch = Some(batch); } } account.next_stake_batch = None; self.save_registered_account(&account); Promise::new(env::predecessor_account_id()).transfer(amount.value()); self.log_stake_batch(batch_id); return amount.into(); } if let Some(batch) = account.stake_batch { assert!(self.can_run_batch(), BLOCKED_BY_BATCH_RUNNING); let amount = batch.balance().amount(); let batch_id = batch.id(); // remove funds from contract level batch { let mut batch = self.stake_batch.expect( "next_stake_batch at contract level should exist if it exists at account level", ); if batch.remove(amount).value() == 0 { self.stake_batch = None; } else { self.stake_batch = Some(batch); } } account.stake_batch = None; self.save_registered_account(&account); Promise::new(env::predecessor_account_id()).transfer(amount.value()); self.log_stake_batch(batch_id); return amount.into(); } 0.into() } fn redeem(&mut self, amount: YoctoStake) -> BatchId { let mut account = self.predecessor_registered_account(); let batch_id = self.redeem_stake_for_account(&mut account, amount.into()); self.save_registered_account(&account); self.log_redeem_stake_batch(batch_id.clone().into()); batch_id } fn redeem_all(&mut self) -> Option<BatchId> { let mut account = self.predecessor_registered_account(); self.claim_receipt_funds(&mut account); account.stake.map(|stake| { let amount = stake.amount(); let batch_id = self.redeem_stake_for_account(&mut account, amount); self.save_registered_account(&account); self.log_redeem_stake_batch(batch_id.clone().into()); batch_id }) } fn remove_all_from_redeem_stake_batch(&mut self) -> YoctoStake { let mut account = self.predecessor_registered_account(); self.claim_receipt_funds(&mut account); if self.redeem_stake_batch_lock.is_none() { if let Some(batch) = account.redeem_stake_batch { let amount = batch.balance().amount(); let batch_id = batch.id(); // remove funds from contract level batch { let mut batch = self.redeem_stake_batch.expect( "redeem_stake_batch at contract level should exist if it exists at account level", ); if batch.remove(amount).value() == 0 { self.redeem_stake_batch = None; } else { self.redeem_stake_batch = Some(batch); } } account.apply_stake_credit(amount); account.redeem_stake_batch = None; self.save_registered_account(&account); self.log_redeem_stake_batch(batch_id); return amount.into(); } } else if let Some(batch) = account.next_redeem_stake_batch { let amount = batch.balance().amount(); let batch_id = batch.id(); // remove funds from contract level batch { let mut batch = self.next_redeem_stake_batch.expect( "next_redeem_stake_batch at contract level should exist if it exists at account level", ); if batch.remove(amount).value() == 0 { self.next_redeem_stake_batch = None; } else { self.next_redeem_stake_batch = Some(batch); } } account.apply_stake_credit(amount); account.next_redeem_stake_batch = None; self.save_registered_account(&account); self.log_redeem_stake_batch(batch_id); return amount.into(); } 0.into() } fn remove_from_redeem_stake_batch(&mut self, amount: YoctoStake) { let mut account = self.predecessor_registered_account(); self.claim_receipt_funds(&mut account); if self.redeem_stake_batch_lock.is_none() { if let Some(mut batch) = account.redeem_stake_batch { let amount: domain::YoctoStake = amount.into(); assert!( amount <= batch.balance().amount(), BATCH_BALANCE_INSUFFICIENT ); // remove funds from contract level batch { let mut batch = self.redeem_stake_batch.expect( "redeem_stake_batch at contract level should exist if it exists at account level", ); if batch.remove(amount).value() == 0 { self.redeem_stake_batch = None; } else { self.redeem_stake_batch = Some(batch); } } account.apply_stake_credit(amount); if batch.remove(amount).value() == 0 { account.redeem_stake_batch = None; } else { account.redeem_stake_batch = Some(batch); } self.save_registered_account(&account); self.log_redeem_stake_batch(batch.id()); } } else if let Some(mut batch) = account.next_redeem_stake_batch { let amount: domain::YoctoStake = amount.into(); assert!( amount <= batch.balance().amount(), BATCH_BALANCE_INSUFFICIENT ); // remove funds from contract level batch { let mut batch = self.next_redeem_stake_batch.expect( "next_redeem_stake_batch at contract level should exist if it exists at account level", ); if batch.remove(amount).value() == 0 { self.next_redeem_stake_batch = None; } else { self.next_redeem_stake_batch = Some(batch); } } account.apply_stake_credit(amount); if batch.remove(amount).value() == 0 { account.next_redeem_stake_batch = None; } else { account.next_redeem_stake_batch = Some(batch); } self.save_registered_account(&account); self.log_redeem_stake_batch(batch.id()); } } fn unstake(&mut self) -> Promise { assert!(self.can_run_batch(), BLOCKED_BY_BATCH_RUNNING); match self.redeem_stake_batch_lock { None => { assert!( self.redeem_stake_batch.is_some(), NO_REDEEM_STAKE_BATCH_TO_RUN ); self.redeem_stake_batch_lock = Some(RedeemLock::Unstaking); self.staking_pool_promise() .get_account() .promise() .then(self.invoke_on_run_redeem_stake_batch()) .then(self.invoke_clear_redeem_lock()) } Some(RedeemLock::PendingWithdrawal) => self .staking_pool_promise() .get_account() .promise() .then(self.invoke_on_redeeming_stake_pending_withdrawal()), // this should already be handled by above assert and should never be hit // but it was added to satisfy the match clause for completeness Some(RedeemLock::Unstaking) => panic!(BLOCKED_BY_BATCH_RUNNING), } } fn redeem_and_unstake(&mut self, amount: YoctoStake) -> PromiseOrValue<BatchId> { let batch_id = self.redeem(amount); if self.can_unstake() { PromiseOrValue::Promise(self.unstake()) } else { PromiseOrValue::Value(batch_id) } } fn redeem_all_and_unstake(&mut self) -> PromiseOrValue<Option<BatchId>> { match self.redeem_all() { None => PromiseOrValue::Value(None), Some(batch_id) => { if self.can_unstake() { PromiseOrValue::Promise(self.unstake()) } else { PromiseOrValue::Value(Some(batch_id)) } } } } fn pending_withdrawal(&self) -> Option<RedeemStakeBatchReceipt> { self.get_pending_withdrawal() .map(RedeemStakeBatchReceipt::from) } fn claim_receipts(&mut self) { let mut account = self.predecessor_registered_account(); self.claim_receipt_funds(&mut account); } fn withdraw(&mut self, amount: interface::YoctoNear) { let mut account = self.predecessor_registered_account(); self.withdraw_near_funds(&mut account, amount.into()); } fn withdraw_all(&mut self) -> interface::YoctoNear { let mut account = self.predecessor_registered_account(); self.claim_receipt_funds(&mut account); match account.near { None => 0.into(), Some(balance) => { self.withdraw_near_funds(&mut account, balance.amount()); balance.amount().into() } } } fn transfer_near(&mut self, recipient: ValidAccountId, amount: interface::YoctoNear) { let mut account = self.predecessor_registered_account(); self.transfer_near_funds(&mut account, amount.into(), recipient); } fn transfer_all_near(&mut self, recipient: ValidAccountId) -> interface::YoctoNear { let mut account = self.predecessor_registered_account(); self.claim_receipt_funds(&mut account); match account.near { None => 0.into(), Some(balance) => { self.transfer_near_funds(&mut account, balance.amount(), recipient); balance.amount().into() } } } fn min_required_deposit_to_stake(&self) -> YoctoNear { self.min_required_near_deposit().into() } fn refresh_stake_token_value(&mut self) -> Promise { match self.stake_batch_lock { None => { assert!(!self.is_unstaking(), BLOCKED_BY_BATCH_RUNNING); self.stake_batch_lock = Some(StakeLock::RefreshingStakeTokenValue); StakingPoolPromiseBuilder::new(self.staking_pool_id.clone(), &self.config) .ping() .get_account() .promise() .then(self.invoke_refresh_stake_token_value()) } Some(StakeLock::RefreshingStakeTokenValue) => { panic!(BLOCKED_BY_STAKE_TOKEN_VALUE_REFRESH) } Some(_) => panic!(BLOCKED_BY_BATCH_RUNNING), } } fn stake_token_value(&self) -> interface::StakeTokenValue { self.stake_token_value.into() } } // staking pool func call invocations impl Contract { fn log_stake_batch(&self, batch_id: domain::BatchId) { if let Some(batch) = self.stake_batch { if batch_id == batch.id() { log(events::StakeBatch::from(batch)); } } else if let Some(batch) = self.next_stake_batch { if batch_id == batch.id() { log(events::StakeBatch::from(batch)); } } else { log(events::StakeBatchCancelled { batch_id: batch_id.value(), }); } } fn log_redeem_stake_batch(&self, batch_id: domain::BatchId) { if let Some(batch) = self.redeem_stake_batch { if batch_id == batch.id() { log(events::RedeemStakeBatch::from(batch)); } } else if let Some(batch) = self.next_redeem_stake_batch { if batch_id == batch.id() { log(events::RedeemStakeBatch::from(batch)); } } else { log(events::RedeemStakeBatchCancelled { batch_id: batch_id.value(), }); } } } /// NEAR transfers impl Contract { fn withdraw_near_funds(&mut self, account: &mut RegisteredAccount, amount: domain::YoctoNear) { self.claim_receipt_funds(account); account.apply_near_debit(amount); self.save_registered_account(&account); // check if there are enough funds to fulfill the request - if not then draw from liquidity if self.total_near.amount() < amount { // access liquidity // NOTE: will panic if there are not enough funds in liquidity pool // - should never panic unless there is a bug let difference = amount - self.total_near.amount(); self.near_liquidity_pool -= difference; self.total_near.credit(difference); } self.total_near.debit(amount); Promise::new(env::predecessor_account_id()).transfer(amount.value()); } fn transfer_near_funds( &mut self, account: &mut RegisteredAccount, amount: domain::YoctoNear, recipient: ValidAccountId, ) { self.claim_receipt_funds(account); account.apply_near_debit(amount); self.save_registered_account(&account); // check if there are enough funds to fulfill the request - if not then draw from liquidity if self.total_near.amount() < amount { // access liquidity // NOTE: will panic if there are not enough funds in liquidity pool // - should never panic unless there is a bug let difference = amount - self.total_near.amount(); self.near_liquidity_pool -= difference; self.total_near.credit(difference); } self.total_near.debit(amount); Promise::new(recipient.as_ref().to_string()).transfer(amount.value()); } } impl Contract { fn run_stake_batch(&mut self) -> Promise { assert!(self.can_run_batch(), BLOCKED_BY_BATCH_RUNNING); let batch = self.stake_batch.expect(STAKE_BATCH_SHOULD_EXIST); self.stake_batch_lock = Some(StakeLock::Staking); self.distribute_earnings(); if self.is_liquidity_needed() { self.staking_pool_promise() .get_account() .promise() .then(self.invoke_on_run_stake_batch()) .then(self.invoke_clear_stake_lock()) } else { // if liquidity is not needed, then lets stake it // NOTE: liquidity belongs to the stakers - some will leak over when we withdraw all from // the staking pool because of the shares rounding issue on the staking pool side let stake_amount = batch.balance().amount() + self.near_liquidity_pool; self.near_liquidity_pool = 0.into(); self.staking_pool_promise() .deposit_and_stake(stake_amount) .get_account() .promise() .then(self.invoke_on_deposit_and_stake(None)) .then(self.invoke_clear_stake_lock()) } } /// check that batch NEAR amount will issue at least 1 yoctoSTAKE /// we never want to issue 0 yoctoSTAKE tokens if NEAR is deposited and staked /// /// the min required NEAR deposit is calculated using the cached STAKE token value /// thus, to be on the safe side, we will require that minimum amount of NEAR deposit should be /// enough for 1000 yoctoSTAKE fn check_min_required_near_deposit(&self, account: &Account, batch_id: domain::BatchId) { if let Some(batch) = account.stake_batch(batch_id) { self.check_stake_batch_min_required_near_balance(batch) } } fn check_stake_batch_min_required_near_balance(&self, batch: StakeBatch) { let min_required_near_deposit = self.min_required_near_deposit(); assert!( batch.balance().amount() >= min_required_near_deposit, "minimum required NEAR deposit is: {}", min_required_near_deposit ); } fn min_required_near_deposit(&self) -> domain::YoctoNear { self.stake_token_value.stake_to_near(1000.into()) } pub(crate) fn get_pending_withdrawal(&self) -> Option<domain::RedeemStakeBatchReceipt> { self.redeem_stake_batch .map(|batch| self.redeem_stake_batch_receipts.get(&batch.id())) .flatten() } fn can_run_batch(&self) -> bool { !self.stake_batch_locked() && !self.is_unstaking() } fn can_unstake(&self) -> bool { if self.can_run_batch() { match self.redeem_stake_batch_lock { None => self.redeem_stake_batch.is_some(), Some(RedeemLock::PendingWithdrawal) => { let batch = self .redeem_stake_batch .expect(REDEEM_STAKE_BATCH_SHOULD_EXIST); let batch_receipt = self .redeem_stake_batch_receipts .get(&batch.id()) .expect(REDEEM_STAKE_BATCH_RECEIPT_SHOULD_EXIST); batch_receipt.unstaked_funds_available_for_withdrawal() } Some(RedeemLock::Unstaking) => false, } } else { self.can_run_batch() } } /// batches the NEAR to stake at the contract level and account level /// /// ## Panics /// if [amount] is zero /// /// ## Notes /// - before applying the deposit, batch receipts are processed [claim_receipt_funds] pub(crate) fn deposit_near_for_account_to_stake( &mut self, account: &mut RegisteredAccount, amount: domain::YoctoNear, ) -> domain::BatchId { assert!(amount.value() > 0, DEPOSIT_REQUIRED_FOR_STAKE); self.claim_receipt_funds(account); // use current batch if not staking, i.e., the stake batch is not running if !self.stake_batch_locked() { // apply at contract level let mut contract_batch = self.stake_batch.unwrap_or_else(|| self.new_stake_batch()); contract_batch.add(amount); self.stake_batch = Some(contract_batch); // apply at account level // NOTE: account batch ID must match contract batch ID let mut account_batch = account .stake_batch .unwrap_or_else(|| contract_batch.id().new_stake_batch()); account_batch.add(amount); account.stake_batch = Some(account_batch); account_batch.id() } else { // apply at contract level let mut contract_batch = self .next_stake_batch .unwrap_or_else(|| self.new_stake_batch()); contract_batch.add(amount); self.next_stake_batch = Some(contract_batch); // apply at account level // NOTE: account batch ID must match contract batch ID let mut account_batch = account .next_stake_batch .unwrap_or_else(|| contract_batch.id().new_stake_batch()); account_batch.add(amount); account.next_stake_batch = Some(account_batch); account_batch.id() } } fn new_stake_batch(&mut self) -> StakeBatch { *self.batch_id_sequence += 1; self.batch_id_sequence.new_stake_batch() } /// moves STAKE [amount] from account balance to redeem stake batch /// /// ## Panics /// - if amount == 0 /// - if STAKE account balance is too low to fulfill request /// /// ## Notes /// - before applying the deposit, batch receipts are processed [claim_receipt_funds] fn redeem_stake_for_account( &mut self, account: &mut RegisteredAccount, amount: domain::YoctoStake, ) -> BatchId { assert!(amount.value() > 0, ZERO_REDEEM_AMOUNT); self.claim_receipt_funds(account); assert!( account.can_redeem(amount), INSUFFICIENT_STAKE_FOR_REDEEM_REQUEST ); // debit the amount of STAKE to redeem from the account let mut stake = account.stake.expect("account has zero STAKE token balance"); if stake.debit(amount).value() > 0 { account.stake = Some(stake); } else { account.stake = None; } match self.redeem_stake_batch_lock { // use current batch None => { // apply at contract level let mut contract_batch = self .redeem_stake_batch .unwrap_or_else(|| self.new_redeem_stake_batch()); contract_batch.add(amount); self.redeem_stake_batch = Some(contract_batch); // apply at account level // NOTE: account batch ID must match contract batch ID let mut account_batch = account .redeem_stake_batch .unwrap_or_else(|| contract_batch.id().new_redeem_stake_batch()); account_batch.add(amount); account.redeem_stake_batch = Some(account_batch); account_batch.id().into() } // use next batch _ => { // apply at contract level let mut contract_batch = self .next_redeem_stake_batch .unwrap_or_else(|| self.new_redeem_stake_batch()); contract_batch.add(amount); self.next_redeem_stake_batch = Some(contract_batch); // apply at account level // NOTE: account batch ID must match contract batch ID let mut account_batch = account .next_redeem_stake_batch .unwrap_or_else(|| contract_batch.id().new_redeem_stake_batch()); account_batch.add(amount); account.next_redeem_stake_batch = Some(account_batch); account_batch.id().into() } } } fn new_redeem_stake_batch(&mut self) -> RedeemStakeBatch { *self.batch_id_sequence += 1; self.batch_id_sequence.new_redeem_stake_batch() } /// NOTE: the account is saved to storage if funds were claimed pub(crate) fn claim_receipt_funds(&mut self, account: &mut RegisteredAccount) { let claimed_stake_tokens = self.claim_stake_batch_receipts(&mut account.account); let claimed_near_tokens = self.claim_redeem_stake_batch_receipts(&mut account.account); let funds_were_claimed = claimed_stake_tokens || claimed_near_tokens; if funds_were_claimed { self.save_registered_account(&account); } } /// the purpose of this method is to to compute the account's STAKE balance taking into consideration /// that there may be unclaimed receipts on the account /// - this enables the latest account info to be returned within the context of a contract 'view' /// call - no receipts are physically claimed, i.e., contract state does not change pub(crate) fn apply_receipt_funds_for_view(&self, account: &Account) -> Account { let mut account = account.clone(); { fn apply_stake_credit( account: &mut Account, batch: StakeBatch, receipt: StakeBatchReceipt, ) { let staked_near = batch.balance().amount(); let stake = receipt.stake_token_value().near_to_stake(staked_near); account.apply_stake_credit(stake); } if let Some(batch) = account.stake_batch { if let Some(receipt) = self.stake_batch_receipts.get(&batch.id()) { apply_stake_credit(&mut account, batch, receipt); account.stake_batch = None; } } if let Some(batch) = account.next_stake_batch { if let Some(receipt) = self.stake_batch_receipts.get(&batch.id()) { apply_stake_credit(&mut account, batch, receipt); account.next_stake_batch = None; } } } { fn apply_near_credit( account: &mut Account, batch: RedeemStakeBatch, receipt: domain::RedeemStakeBatchReceipt, ) { let redeemed_stake = batch.balance().amount(); let near = receipt.stake_token_value().stake_to_near(redeemed_stake); account.apply_near_credit(near); } if let Some(RedeemLock::PendingWithdrawal) = self.redeem_stake_batch_lock { // NEAR funds cannot be claimed from a receipt that is pending withdrawal from the staking pool let batch_pending_withdrawal_id = self.redeem_stake_batch.as_ref().unwrap().id(); if let Some(batch) = account.redeem_stake_batch { if batch_pending_withdrawal_id != batch.id() { if let Some(receipt) = self.redeem_stake_batch_receipts.get(&batch.id()) { apply_near_credit(&mut account, batch, receipt); account.redeem_stake_batch = None } } } if let Some(batch) = account.next_redeem_stake_batch { if batch_pending_withdrawal_id != batch.id() { if let Some(receipt) = self.redeem_stake_batch_receipts.get(&batch.id()) { apply_near_credit(&mut account, batch, receipt); account.next_redeem_stake_batch = None } } } } else { if let Some(batch) = account.redeem_stake_batch { if let Some(receipt) = self.redeem_stake_batch_receipts.get(&batch.id()) { apply_near_credit(&mut account, batch, receipt); account.redeem_stake_batch = None } } if let Some(batch) = account.next_redeem_stake_batch { if let Some(receipt) = self.redeem_stake_batch_receipts.get(&batch.id()) { apply_near_credit(&mut account, batch, receipt); account.next_redeem_stake_batch = None } } } } account } fn claim_stake_batch_receipts(&mut self, account: &mut Account) -> bool { fn claim_stake_tokens_for_batch( contract: &mut Contract, account: &mut Account, batch: StakeBatch, mut receipt: domain::StakeBatchReceipt, ) { // how much NEAR did the account stake in the batch let staked_near = batch.balance().amount(); // claim the STAKE tokens for the account let stake = receipt.stake_token_value().near_to_stake(staked_near); account.apply_stake_credit(stake); // track that the STAKE tokens were claimed receipt.stake_tokens_issued(staked_near); if receipt.all_claimed() { // then delete the receipt and free the storage contract.stake_batch_receipts.remove(&batch.id()); } else { contract.stake_batch_receipts.insert(&batch.id(), &receipt); } } let mut claimed_funds = false; if let Some(batch) = account.stake_batch { if let Some(receipt) = self.stake_batch_receipts.get(&batch.id()) { claim_stake_tokens_for_batch(self, account, batch, receipt); account.stake_batch = None; claimed_funds = true; } } if let Some(batch) = account.next_stake_batch { if let Some(receipt) = self.stake_batch_receipts.get(&batch.id()) { claim_stake_tokens_for_batch(self, account, batch, receipt); account.next_stake_batch = None; claimed_funds = true; } } // move the next batch into the current batch as long as the contract is not locked and the // funds for the current batch have been claimed // // NOTE: while the contract is locked for running a stake batch, all deposits must go into // the next batch if !self.stake_batch_locked() && account.stake_batch.is_none() { account.stake_batch = account.next_stake_batch.take(); } claimed_funds } /// claim NEAR tokens for redeeming STAKE fn claim_redeem_stake_batch_receipts(&mut self, account: &mut Account) -> bool { fn claim_redeemed_stake_for_batch( contract: &mut Contract, account: &mut Account, account_batch: domain::RedeemStakeBatch, mut receipt: domain::RedeemStakeBatchReceipt, ) { // how much STAKE did the account redeem in the batch let redeemed_stake = account_batch.balance().amount(); // claim the NEAR tokens for the account let near = receipt.stake_token_value().stake_to_near(redeemed_stake); account.apply_near_credit(near); // track that the NEAR tokens were claimed receipt.stake_tokens_redeemed(redeemed_stake); if receipt.all_claimed() { // then delete the receipt and free the storage contract .redeem_stake_batch_receipts .remove(&account_batch.id()); } else { contract .redeem_stake_batch_receipts .insert(&account_batch.id(), &receipt); } } /// for a pending withdrawal, funds can also be claimed against the liquidity pool fn claim_redeemed_stake_for_batch_pending_withdrawal( contract: &mut Contract, account: &mut Account, account_batch: &mut domain::RedeemStakeBatch, mut receipt: domain::RedeemStakeBatchReceipt, ) { // how much STAKE did the account redeem in the batch let redeemed_stake = account_batch.balance().amount(); let redeemed_stake_near_value = receipt.stake_token_value().stake_to_near(redeemed_stake); let claimed_near = if contract.near_liquidity_pool >= redeemed_stake_near_value { redeemed_stake_near_value } else { contract.near_liquidity_pool }; let redeemable_stake = receipt.stake_token_value().near_to_stake(claimed_near); account_batch.remove(redeemable_stake); // claim the STAKE tokens for the account // let near = receipt.stake_token_value().stake_to_near(redeemable_stake); account.apply_near_credit(claimed_near); contract.near_liquidity_pool -= claimed_near; contract.total_near.credit(claimed_near); // track that the STAKE tokens were claimed receipt.stake_tokens_redeemed(redeemable_stake); if receipt.all_claimed() { // this means that effectively all funds have been withdrawn // which means we need to finalize the redeem workflow contract .redeem_stake_batch_receipts .remove(&account_batch.id()); contract.redeem_stake_batch_lock = None; contract.pop_redeem_stake_batch(); } else { contract .redeem_stake_batch_receipts .insert(&account_batch.id(), &receipt); } } let mut claimed_funds = false; match self.redeem_stake_batch_lock { // NEAR funds can be claimed for receipts that are not pending on the unstaked NEAR withdrawal // NEAR funds can also be claimed against the NEAR liquidity pool Some(RedeemLock::PendingWithdrawal) => { // NEAR funds cannot be claimed for a receipt that is pending withdrawal of unstaked NEAR from the staking pool let pending_batch_id = self .redeem_stake_batch .expect(REDEEM_STAKE_BATCH_SHOULD_EXIST) .id(); if let Some(mut batch) = account.redeem_stake_batch { if batch.id() != pending_batch_id { if let Some(receipt) = self.redeem_stake_batch_receipts.get(&batch.id()) { claim_redeemed_stake_for_batch(self, account, batch, receipt); account.redeem_stake_batch = None; claimed_funds = true; } } else if self.near_liquidity_pool.value() > 0 { if let Some(receipt) = self.redeem_stake_batch_receipts.get(&batch.id()) { claim_redeemed_stake_for_batch_pending_withdrawal( self, account, &mut batch, receipt, ); if batch.balance().amount().value() == 0 { account.redeem_stake_batch = None; } else { account.redeem_stake_batch = Some(batch); } claimed_funds = true; } } } if let Some(mut batch) = account.next_redeem_stake_batch { if batch.id() != pending_batch_id { if let Some(receipt) = self.redeem_stake_batch_receipts.get(&batch.id()) { claim_redeemed_stake_for_batch(self, account, batch, receipt); account.next_redeem_stake_batch = None; claimed_funds = true; } } else if self.near_liquidity_pool.value() > 0 { if let Some(receipt) = self.redeem_stake_batch_receipts.get(&batch.id()) { claim_redeemed_stake_for_batch_pending_withdrawal( self, account, &mut batch, receipt, ); if batch.balance().amount().value() == 0 { account.next_redeem_stake_batch = None; } else { account.next_redeem_stake_batch = Some(batch); } claimed_funds = true; } } } } None => { if let Some(batch) = account.redeem_stake_batch { if let Some(receipt) = self.redeem_stake_batch_receipts.get(&batch.id()) { claim_redeemed_stake_for_batch(self, account, batch, receipt); account.redeem_stake_batch = None; claimed_funds = true; } } if let Some(batch) = account.next_redeem_stake_batch { if let Some(receipt) = self.redeem_stake_batch_receipts.get(&batch.id()) { claim_redeemed_stake_for_batch(self, account, batch, receipt); account.next_redeem_stake_batch = None; claimed_funds = true; } } } Some(_) => { // this should never be reachable // while unstaking STAKE balances need to be locked, which means no receipts should be claimed return false; } } // shift the next batch into the current batch if the funds have been claimed for the current batch // and if the contract is not locked because it is running redeem stake batch workflow. // // NOTE: while a contract is locked, all redeem requests must be collected in the next batch if self.redeem_stake_batch_lock.is_none() && account.redeem_stake_batch.is_none() { account.redeem_stake_batch = account.next_redeem_stake_batch.take(); } claimed_funds } pub(crate) fn is_unstaking(&self) -> bool { match self.redeem_stake_batch_lock { Some(RedeemLock::Unstaking) => true, _ => false, } } /// returns a new [StakeTokenValue](crate::domain::StakeTokenValue) updated with the new staked /// NEAR balance. pub(crate) fn update_stake_token_value( &mut self, total_staked_near_balance: domain::YoctoNear, ) { let new_stake_token_value = domain::StakeTokenValue::new( domain::BlockTimeHeight::from_env(), total_staked_near_balance, self.total_stake.amount(), ); // the new STAKE token value should never be less than the current STAKE token value, unless // the total staked NEAR balance is zero // - when NEAR is staked, the staking pool converts the NEAR into shares. Because of rounding, // not all staked NEAR gets converted into shares, and some is left behind as unstaked in // the staking pool. In the example below 0.25 NEAR was deposited to be staked, however // after converting the NEAR to shares, there were 5 yoctoNEAR left over that remained // as unstaked: // // Log [stake.oysterpack.testnet]: @stake.oysterpack.testnet deposited 250000000000000000000000. New unstaked balance is 654566211093653841620326 // Log [stake.oysterpack.testnet]: @stake.oysterpack.testnet staking 249999999999999999999995. Received 13510178747482595266283 new staking shares. Total 404566211093653841620331 unstaked balance and 1146041341904922841152939 staking shares // // Thus, if we see that the STAKE value ticks down, we need to compensate the [total_staked_near_balance] // because the STAKE value should never decrease. // // How can this happen? When we withdraw unstaked funds, we do a withdraw all, which will // withdraw unstaked NEAR that should have been staked but couldn't because of the share conversion // rounding. When we need to compensate, then we need to add the compensation to the liquidity // to balance everything out. let new_stake_near_value = new_stake_token_value.stake_to_near(YOCTO.into()); let current_stake_near_value = self.stake_token_value.stake_to_near(YOCTO.into()); self.stake_token_value = if new_stake_near_value >= current_stake_near_value || total_staked_near_balance.value() == 0 { new_stake_token_value } else { let current_stake_near_value: U256 = U256::from(current_stake_near_value); let total_stake_supply: U256 = U256::from(self.total_stake.amount()); let total_staked_near_balance: U256 = U256::from(total_staked_near_balance.value()); // (staked_near_compensation + total_staked_near_balance) current_stake_near_value // ------------------------------------------------------ = ------------------------ // total_staked_near_balance YOCTO let staked_near_compensation = (current_stake_near_value * total_stake_supply / U256::from(YOCTO)) - total_staked_near_balance; // compensation needs to be added back to NEAR liquidity to rebalance the amounts *self.near_liquidity_pool += staked_near_compensation.as_u128(); log(events::NearLiquidityAdded { amount: staked_near_compensation.as_u128(), balance: self.near_liquidity_pool.value(), }); domain::StakeTokenValue::new( new_stake_token_value.block_time_height(), (total_staked_near_balance + staked_near_compensation) .as_u128() .into(), self.total_stake.amount(), ) } } } type Balance = near_sdk::json_types::U128; #[derive(Serialize, Deserialize, Clone)] #[serde(crate = "near_sdk::serde")] pub struct StakingPoolAccount { pub account_id: AccountId, /// The unstaked balance that can be withdrawn or staked. pub unstaked_balance: Balance, /// The amount balance staked at the current "stake" share price. pub staked_balance: Balance, /// Whether the unstaked balance is available for withdrawal now. pub can_withdraw: bool, } #[ext_contract(ext_redeeming_workflow_callbacks)] pub trait ExtRedeemingWorkflowCallbacks { fn on_run_redeem_stake_batch( &mut self, #[callback] staked_balance: near_sdk::json_types::U128, ) -> Promise; /// ## Success Workflow /// 1. store the redeem stake batch receipt /// 2. set the redeem stake batch lock state to pending withdrawal fn on_unstake(&mut self); fn clear_redeem_lock(&mut self); /// batch ID is returned when all unstaked NEAR has been withdrawn fn on_redeeming_stake_pending_withdrawal( &mut self, #[callback] staking_pool_account: StakingPoolAccount, ) -> near_sdk::PromiseOrValue<BatchId>; fn on_redeeming_stake_post_withdrawal(&mut self) -> BatchId; } #[ext_contract(ext_staking_workflow_callbacks)] pub trait ExtStakingWorkflowCallbacks { /// callback for getting staked balance from staking pool as part of stake batch processing workflow /// /// ## Success Workflow /// 1. Check if liquidity is needed /// 2. deposit and stake funds with staking pool /// 3. then get account from staking pool /// 4. then invoke [on_deposit_and_stake] callback fn on_run_stake_batch( &mut self, #[callback] staking_pool_account: StakingPoolAccount, ) -> Promise; /// ## Success Workflow /// 1. update the StateLock to Staked /// 2. invoke [`process_staked_batch`] fn on_deposit_and_stake( &mut self, near_liquidity: Option<interface::YoctoNear>, #[callback] staking_pool_account: StakingPoolAccount, ) -> Promise; /// 1. update the stake token value /// 2. store the stake batch receipt /// 3. update the STAKE token supply with the new STAKE tokens that were issued fn process_staked_batch(&mut self); /// defined on [Operator] interface fn clear_stake_lock(&mut self); } #[ext_contract(ext_callbacks)] pub trait Callbacks { fn on_refresh_stake_token_value( &mut self, #[callback] staking_pool_account: StakingPoolAccount, ); } #[near_bindgen] impl Contract { #[private] pub fn on_refresh_stake_token_value( &mut self, #[callback] staking_pool_account: StakingPoolAccount, ) -> interface::StakeTokenValue { let staked_balance = self.staked_near_balance( staking_pool_account.staked_balance.into(), staking_pool_account.unstaked_balance.into(), ); self.update_stake_token_value(staked_balance); self.clear_stake_lock(); self.stake_token_value.into() } } impl Contract { fn invoke_refresh_stake_token_value(&self) -> Promise { ext_callbacks::on_refresh_stake_token_value( &env::current_account_id(), NO_DEPOSIT.value(), self.config .gas_config() .callbacks() .on_refresh_stake_token_value() .value(), ) } } #[cfg(test)] mod test_deposit { use super::*; use crate::interface::{AccountManagement, Operator}; use crate::{near::YOCTO, test_utils::*}; use near_sdk::{env, testing_env, MockedBlockchain, VMContext}; /// Given the contract is not locked /// When an account deposits funds to be staked /// Then the funds are deposited into the current stake batch on the account /// And the funds are deposited into the current stake batch on the contract #[test] fn when_contract_not_locked() { // Arrange let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); context.attached_deposit = YOCTO; testing_env!(context.clone()); // Act let batch_id = test_context.deposit(); context.storage_usage = env::storage_usage(); fn check_stake_batch( test_context: &mut Contract, context: VMContext, batch_id: BatchId, expected_balance: YoctoNear, ) { // check account stake batch let account = test_context .lookup_account(to_valid_account_id(&context.predecessor_account_id)) .unwrap(); let account_stake_batch = account.stake_batch.as_ref().unwrap(); assert_eq!( account_stake_batch.balance.amount.value(), expected_balance.value() ); assert_eq!(account_stake_batch.id, batch_id); assert!(account.next_stake_batch.is_none()); // check contract state { let state = test_context.contract_state(); let contract_stake_batch = state.stake_batch.as_ref().unwrap(); assert_eq!(contract_stake_batch.balance, account_stake_batch.balance); assert!(state.next_stake_batch.is_none()); assert_eq!( state.balances.customer_batched_stake_deposits.value(), account_stake_batch.balance.amount.value() ); assert_eq!( state.balances.total_user_accounts_balance.value(), account_stake_batch.balance.amount.value() + account.storage_escrow.amount.value() ); } }; // Assert check_stake_batch( &mut test_context, context.clone(), batch_id.clone(), YOCTO.into(), ); // Act // user makes another deposit into same StakeBatch context.attached_deposit = YOCTO; testing_env!(context.clone()); let batch_id_2 = test_context.deposit(); context.storage_usage = env::storage_usage(); // Assert assert_eq!( batch_id, batch_id_2, "NEAR should have been deposited into same batch" ); check_stake_batch( &mut test_context, context.clone(), batch_id_2, (2 * YOCTO).into(), ); } /// Given the contract is locked /// When an account deposits funds to be staked /// Then the funds are deposited into the next stake batch on the account /// And the funds are deposited into the next stake batch on the contract #[test] fn when_contract_locked() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let mut context = test_context.context.clone(); context.attached_deposit = YOCTO; testing_env!(context.clone()); let batch_id = contract.deposit(); context.storage_usage = env::storage_usage(); context.attached_deposit = 0; testing_env!(context.clone()); contract.stake(); // locks the contract context.storage_usage = env::storage_usage(); // Act context.attached_deposit = 2 * YOCTO; testing_env!(context.clone()); let batch_id_2 = contract.deposit(); context.storage_usage = env::storage_usage(); assert_ne!(batch_id, batch_id_2); // Assert { // check account STAKE batches let account = contract .lookup_account(to_valid_account_id(test_context.account_id)) .unwrap(); let stake_batch = account.stake_batch.as_ref().unwrap(); assert_eq!(stake_batch.balance.amount.value(), YOCTO); assert_eq!(stake_batch.id, batch_id); let next_stake_batch = account.next_stake_batch.as_ref().unwrap(); assert_eq!(next_stake_batch.balance.amount.value(), (2 * YOCTO)); assert_eq!(next_stake_batch.id, batch_id_2); { let state = contract.contract_state(); let contract_stake_batch = state.stake_batch.as_ref().unwrap(); assert_eq!(contract_stake_batch.id, stake_batch.id); assert_eq!( contract_stake_batch.balance.amount, stake_batch.balance.amount ); let contract_next_stake_batch = state.next_stake_batch.as_ref().unwrap(); assert_eq!(contract_next_stake_batch.id, next_stake_batch.id); assert_eq!( contract_next_stake_batch.balance.amount, next_stake_batch.balance.amount ); } } // Arrange - When another account deposits, then funds should go into next Stakebatch let user_2 = "user-2.near"; context.predecessor_account_id = user_2.to_string(); context.attached_deposit = contract.account_storage_fee().value(); testing_env!(context.clone()); contract.register_account(); context.storage_usage = env::storage_usage(); // Act context.attached_deposit = 3 * YOCTO; testing_env!(context.clone()); let batch_id_3 = contract.deposit(); context.storage_usage = env::storage_usage(); // Assert { assert_eq!(batch_id_3, batch_id_2); // check account STAKE batches let account = contract .lookup_account(to_valid_account_id(&context.predecessor_account_id)) .unwrap(); assert!(account.stake_batch.is_none()); let next_stake_batch = account.next_stake_batch.as_ref().unwrap(); assert_eq!(next_stake_batch.balance.amount.value(), (3 * YOCTO)); assert_eq!(next_stake_batch.id, batch_id_3); { let state = contract.contract_state(); let contract_next_stake_batch = state.next_stake_batch.as_ref().unwrap(); assert_eq!(contract_next_stake_batch.id, next_stake_batch.id); assert_eq!(contract_next_stake_batch.balance.amount.value(), 5 * YOCTO); } } } #[test] #[should_panic(expected = "account is not registered")] fn account_not_registered() { let mut test_ctx = TestContext::new(); let contract = &mut test_ctx.contract; let mut context = test_ctx.context.clone(); context.predecessor_account_id = "unregistered-user.near".to_string(); context.attached_deposit = YOCTO; contract.deposit(); } #[test] #[should_panic(expected = "minimum required NEAR deposit is")] fn deposit_lt_min_required_deposit() { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let mut context = test_ctx.context.clone(); context.attached_deposit = contract.min_required_near_deposit().value() - 1; testing_env!(context); contract.deposit(); } #[test] fn deposit_eq_min_required_deposit() { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let mut context = test_ctx.context.clone(); context.attached_deposit = contract.min_required_near_deposit().value(); testing_env!(context); contract.deposit(); } #[test] fn with_receipts_to_claim() { // Arrange let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let mut context = test_ctx.context.clone(); context.attached_deposit = YOCTO; testing_env!(context.clone()); let batch_id = contract.deposit(); context.storage_usage = env::storage_usage(); context.attached_deposit = 0; testing_env!(context.clone()); contract.stake(); context.storage_usage = env::storage_usage(); // progress the staking workflow to completion { context.attached_deposit = 0; testing_env!(context.clone()); contract.on_deposit_and_stake( None, StakingPoolAccount { account_id: context.predecessor_account_id.clone(), unstaked_balance: 7.into(), staked_balance: (YOCTO - 7).into(), can_withdraw: true, }, ); context.storage_usage = env::storage_usage(); testing_env!(context.clone()); contract.process_staked_batch(); context.storage_usage = env::storage_usage(); context.predecessor_account_id = contract.operator_id(); testing_env!(context.clone()); contract.clear_stake_lock(); context.storage_usage = env::storage_usage(); } // at this point, the user should have unclaimed batch receipt funds context.is_view = true; testing_env!(context.clone()); let receipt = contract .stake_batch_receipt(batch_id.clone().into()) .unwrap(); assert_eq!(receipt.staked_near, YOCTO.into()); // Act context.is_view = false; context.predecessor_account_id = test_ctx.account_id.to_string(); context.attached_deposit = 2 * YOCTO; testing_env!(context.clone()); contract.deposit(); // Assert let account = contract .lookup_account(to_valid_account_id(test_ctx.account_id)) .unwrap(); assert_eq!(account.stake.unwrap().amount.value(), YOCTO); // check receipt was claimed context.is_view = true; testing_env!(context.clone()); assert!(contract.stake_batch_receipt(batch_id.into()).is_none()); } } #[cfg(test)] mod test_stake_token_value { use super::*; use crate::{near::YOCTO, test_utils::*}; use near_sdk::{testing_env, MockedBlockchain}; #[test] fn is_current() { // Arrange let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); context.epoch_height = 100; testing_env!(context); test_context.total_stake.credit(YOCTO.into()); test_context.update_stake_token_value(YOCTO.into()); // Act - explict false let stake_token_value = test_context.stake_token_value(); // Assert assert_eq!( stake_token_value.block_time_height.epoch_height, test_context .stake_token_value .block_time_height() .epoch_height() .into() ); } } #[cfg(test)] mod test_refresh_stake_token_value { use super::*; use crate::{near::YOCTO, test_utils::*}; use near_sdk::{testing_env, MockedBlockchain}; #[test] #[should_panic(expected = "action is blocked because a batch is running")] fn has_staking_lock() { // Arrange let mut test_context = TestContext::with_registered_account(); test_context.stake_batch_lock = Some(StakeLock::Staking); // Act test_context.refresh_stake_token_value(); } #[test] #[should_panic(expected = "action is blocked because a batch is running")] fn has_staked_lock() { // Arrange let mut test_context = TestContext::with_registered_account(); test_context.stake_batch_lock = Some(StakeLock::Staked { near_liquidity: None, staked_balance: Default::default(), unstaked_balance: Default::default(), }); // Act test_context.refresh_stake_token_value(); } #[test] #[should_panic(expected = "action is blocked because a batch is running")] fn has_unstaking_lock() { // Arrange let mut test_context = TestContext::with_registered_account(); test_context.redeem_stake_batch_lock = Some(RedeemLock::Unstaking); // Act test_context.refresh_stake_token_value(); } #[test] #[should_panic(expected = "action is blocked because STAKE token value is being refreshed")] fn has_refreshing_stake_token_value_lock() { // Arrange let mut test_context = TestContext::with_registered_account(); test_context.stake_batch_lock = Some(StakeLock::RefreshingStakeTokenValue); // Act test_context.refresh_stake_token_value(); } #[test] fn no_locks() { // Arrange let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); context.epoch_height = 100; testing_env!(context); test_context.total_stake.credit(YOCTO.into()); test_context.update_stake_token_value(YOCTO.into()); // Act test_context.refresh_stake_token_value(); // Assert let receipts = deserialize_receipts(); assert_eq!(receipts.len(), 2); { let receipt = &receipts[0]; let actions = &receipt.actions; assert_eq!(actions.len(), 2); { let action = &actions[0]; match action { Action::FunctionCall { method_name, gas, .. } => { assert_eq!(method_name, "ping"); assert_eq!( *gas, test_context .config .gas_config() .staking_pool() .ping() .value() ); } _ => panic!("expected function call"), } } { let action = &actions[1]; match action { Action::FunctionCall { method_name, gas, .. } => { assert_eq!(method_name, "get_account"); assert_eq!( *gas, test_context .config .gas_config() .staking_pool() .get_account() .value() ); } _ => panic!("expected function call"), } } } { let receipt = &receipts[1]; assert_eq!(receipt.actions.len(), 1); let action = &receipt.actions[0]; match action { Action::FunctionCall { method_name, gas, .. } => { assert_eq!(method_name, "on_refresh_stake_token_value"); assert_eq!( *gas, test_context .config .gas_config() .callbacks() .on_refresh_stake_token_value() .value() ); } _ => panic!("expected function call"), } } } } #[cfg(test)] mod test_stake { use super::*; use crate::interface::{ContractFinancials, Operator}; use crate::test_domain::OnDepositAndStakeArgs; use crate::{near::YOCTO, test_utils::*}; use near_sdk::{env, serde_json, testing_env, MockedBlockchain}; /// any account can invoke stake #[test] fn account_not_registered() { // Arrange let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let mut context = test_ctx.context.clone(); context.attached_deposit = YOCTO; testing_env!(context.clone()); contract.deposit(); // Act context.attached_deposit = 0; context.predecessor_account_id = "unregistered-user.near".to_string(); testing_env!(context.clone()); contract.stake(); } #[test] fn no_locks() { fn check_stake_action_receipts() { let receipts: Vec<Receipt> = deserialize_receipts(); assert_eq!(receipts.len(), 3); { let receipt = &receipts[0]; assert_eq!(receipt.actions.len(), 2); { let action = &receipt.actions[0]; match action { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "deposit_and_stake") } _ => panic!("expected `deposit_and_stake` func call on staking pool"), } } { let action = &receipt.actions[1]; match action { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "get_account") } _ => panic!("expected `get_account` func call on staking pool"), } } } { let receipt = &receipts[1]; let action = &receipt.actions[0]; match action { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "on_deposit_and_stake") } _ => panic!("expected `get_account` func call on staking pool"), } } { let receipt = &receipts[2]; let action = &receipt.actions[0]; match action { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "clear_stake_lock") } _ => panic!("expected `clear_stake_batch_lock` callback"), } } } fn check_on_deposit_and_stake_action_receipts() { let receipts: Vec<Receipt> = deserialize_receipts(); assert_eq!(receipts.len(), 1); { let receipt = &receipts[0]; assert_eq!(receipt.actions.len(), 1); { let action = &receipt.actions[0]; match action { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "process_staked_batch") } _ => panic!("expected `deposit_and_stake` func call on staking pool"), } } } } // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let mut context = test_context.context.clone(); context.attached_deposit = YOCTO; testing_env!(context.clone()); let batch_id = contract.deposit(); // Act context.attached_deposit = 0; testing_env!(context.clone()); contract.stake(); // Assert match contract.stake_batch_lock { Some(StakeLock::Staking) => { check_stake_action_receipts(); context.predecessor_account_id = env::current_account_id(); testing_env!(context.clone()); contract.on_deposit_and_stake( None, StakingPoolAccount { account_id: contract.staking_pool_id.clone(), unstaked_balance: 7.into(), staked_balance: (YOCTO - 7).into(), can_withdraw: true, }, ); match contract.stake_batch_lock { Some(StakeLock::Staked { .. }) => { check_on_deposit_and_stake_action_receipts(); context.predecessor_account_id = env::current_account_id(); testing_env!(context.clone()); contract.process_staked_batch(); assert!(contract.stake_batch_lock.is_none()); match contract.stake_batch_receipt(batch_id.into()) { Some(receipt) => { assert_eq!(receipt.staked_near.value(), YOCTO); } None => panic!("receipt should have been created"), } context.predecessor_account_id = env::current_account_id(); testing_env!(context.clone()); contract.clear_stake_lock(); } _ => panic!("expected StakeLock::Staked"), }; } _ => panic!("expected StakeLock::Staking"), } } #[test] #[should_panic(expected = "action is blocked because a batch is running")] fn locked_and_staking() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let mut context = test_context.context.clone(); context.attached_deposit = YOCTO; testing_env!(context.clone()); contract.deposit(); context.attached_deposit = 0; testing_env!(context.clone()); contract.stake(); // Act contract.stake(); } #[test] fn locked_and_staked() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let mut context = test_context.context.clone(); context.attached_deposit = YOCTO; testing_env!(context.clone()); let batch_id = contract.deposit(); context.attached_deposit = 0; testing_env!(context.clone()); contract.stake(); context.predecessor_account_id = env::current_account_id(); testing_env!(context.clone()); contract.on_deposit_and_stake( None, StakingPoolAccount { account_id: contract.staking_pool_id(), unstaked_balance: 10.into(), staked_balance: (YOCTO - 10).into(), can_withdraw: true, }, ); match contract.stake_batch_lock { Some(StakeLock::Staked { near_liquidity, staked_balance, unstaked_balance, }) => { assert!(near_liquidity.is_none()); assert_eq!(unstaked_balance.value(), 10); assert_eq!(staked_balance.value(), YOCTO - 10); // Act context.predecessor_account_id = contract.operator_id(); testing_env!(context.clone()); match contract.stake() { PromiseOrValue::Value(id) => { assert_eq!(batch_id, id); assert!(contract.stake_batch_lock.is_none()); } _ => panic!("expected batch ID to be returned"), } } _ => panic!("expected StakeLock::Staked"), } } #[test] #[should_panic(expected = "ILLEGAL STATE : stake batch should exist")] fn no_stake_batch() { let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; contract.stake(); } #[test] #[should_panic(expected = "action is blocked because a batch is running")] fn locked_and_unstaking() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let mut context = test_context.context.clone(); context.attached_deposit = YOCTO; testing_env!(context.clone()); contract.deposit(); let mut account = contract.predecessor_registered_account(); account.apply_stake_credit(YOCTO.into()); contract.save_registered_account(&account); context.attached_deposit = 0; testing_env!(context.clone()); contract.redeem_all_and_unstake(); match contract.redeem_stake_batch_lock { Some(RedeemLock::Unstaking) => { // Act contract.stake(); } _ => panic!("expected RedeemLock::Unstaking"), } } /// when there is a pending withdrawal, the contract tries to add liquidity #[test] fn with_pending_withdrawal() { fn check_action_receipts() { let receipts = deserialize_receipts(); assert_eq!(receipts.len(), 3); { let receipt = &receipts[0]; let action = &receipt.actions[0]; match action { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "get_account") } _ => panic!("expected `deposit_and_stake` func call on staking pool"), } } { let receipt = &receipts[1]; let action = &receipt.actions[0]; match action { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "on_run_stake_batch") } _ => panic!("expected `get_account` func call on staking pool"), } } { let receipt = &receipts[2]; let action = &receipt.actions[0]; match action { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "clear_stake_lock") } _ => panic!("expected `clear_stake_lock` callback"), } } } // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let mut context = test_context.context.clone(); context.attached_deposit = YOCTO; testing_env!(context.clone()); contract.deposit(); // simulate STAKE was redeemed and there is a pending withdrawal { contract.redeem_stake_batch_lock = Some(RedeemLock::PendingWithdrawal); *contract.batch_id_sequence += 1; let redeem_stake_batch = domain::RedeemStakeBatch::new(contract.batch_id_sequence, YOCTO.into()); contract.redeem_stake_batch = Some(redeem_stake_batch); let receipt = redeem_stake_batch.create_receipt(contract.stake_token_value); contract .redeem_stake_batch_receipts .insert(&contract.batch_id_sequence, &receipt); } // Act testing_env!(test_context.context.clone()); contract.stake(); // Assert match contract.stake_batch_lock { Some(StakeLock::Staking) => { check_action_receipts(); } _ => panic!("expected StakeLock::Staking"), } } #[test] fn earnings_are_distributed_when_staking() { // Arrange let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let mut context = test_ctx.context.clone(); context.attached_deposit = YOCTO; const CONTRACT_EARNINGS: u128 = 10 * YOCTO; context.account_balance += CONTRACT_EARNINGS; testing_env!(context.clone()); contract.deposit(); context.storage_usage = env::storage_usage(); context.attached_deposit = 0; testing_env!(context.clone()); contract.collected_earnings += domain::YoctoNear(2 * YOCTO); let collected_earnings = contract.collected_earnings; let owner_balance = contract.contract_owner_balance; let contract_owner_earnings = contract.contract_owner_earnings(); let user_accounts_earnings = contract.user_accounts_earnings(); let total_earnings_before_distribution = contract.total_earnings(); let total_user_accounts_balance = contract.total_user_accounts_balance(); // Act contract.stake(); // Assert println!( r#" contract_owner_earnings_percentage = {}% total_earnings = {} -> {} context.account_balance = {} -> {} contract_owner_balance = {} -> {} contract_owner_earnings = {} -> {} expected contract_owner_balance = {} user_accounts_earnings = {} -> {} total_user_accounts_balance = {} -> {} collected_earnings: {} -> {} "#, contract.config.contract_owner_earnings_percentage(), // total_earnings_before_distribution, contract.total_earnings(), // context.account_balance, env::account_balance(), // owner_balance, contract.contract_owner_balance, // contract_owner_earnings, contract.contract_owner_earnings(), owner_balance + contract_owner_earnings, // user_accounts_earnings, contract.user_accounts_earnings(), // total_user_accounts_balance, contract.total_user_accounts_balance(), // collected_earnings, contract.collected_earnings ); assert_eq!(total_earnings_before_distribution.value(), 9 * YOCTO); assert_eq!(contract.total_earnings(), 0.into()); assert_eq!(contract_owner_earnings, user_accounts_earnings); // 50/50 assert_eq!( context.account_balance, test_ctx.context.clone().account_balance + CONTRACT_EARNINGS ); assert_eq!( context.account_balance, env::account_balance() + contract_owner_earnings.value() + YOCTO ); assert_eq!( contract.contract_owner_balance, owner_balance + contract_owner_earnings, "earnings should have been distributed to owner balance" ); assert_eq!(contract.collected_earnings.value(), 0); let receipts = deserialize_receipts(); let deposit_and_stake_func_call_receipt = &receipts[0]; let action = &deposit_and_stake_func_call_receipt.actions[0]; match action { Action::FunctionCall { method_name, deposit, .. } => { assert_eq!(method_name, "deposit_and_stake"); assert_eq!(user_accounts_earnings.value(), (9 * YOCTO / 2)); assert_eq!( *deposit, user_accounts_earnings.value() + YOCTO, "contract earnings should have been distributed to users through staking" ); } _ => panic!("expected `deposit_and_stake` func call on staking pool"), } } #[test] fn when_entire_batch_balance_is_used_for_liquidity() { // Arrange let mut test_context = TestContext::with_registered_account(); // user deposits and stakes 1 NEAR { let mut context = test_context.context.clone(); context.attached_deposit = YOCTO; testing_env!(context); test_context.deposit_and_stake(); test_context.on_deposit_and_stake( None, StakingPoolAccount { account_id: env::current_account_id(), unstaked_balance: 0.into(), staked_balance: YOCTO.into(), can_withdraw: true, }, ); test_context.process_staked_batch(); } // user redeems all to create pending withdrawal that requires liquidity { testing_env!(test_context.context.clone()); test_context.redeem_all_and_unstake(); let mut context = test_context.context.clone(); context.predecessor_account_id = env::current_account_id(); testing_env!(context); test_context.on_run_redeem_stake_batch(StakingPoolAccount { account_id: env::current_account_id(), unstaked_balance: 0.into(), staked_balance: YOCTO.into(), can_withdraw: true, }); set_env_with_success_promise_result(&mut test_context); test_context.on_unstake(); test_context.clear_redeem_lock(); } // Act - deposit and stake let mut context = test_context.context.clone(); context.attached_deposit = (YOCTO / 2).into(); testing_env!(context); test_context.deposit_and_stake(); // Assert let receipts = deserialize_receipts(); assert_eq!(receipts.len(), 3); { let receipt = &receipts[0]; match &receipt.actions[0] { Action::FunctionCall { method_name, .. } => assert_eq!(method_name, "get_account"), _ => panic!("expected FunctionCall"), } } { let receipt = &receipts[1]; match &receipt.actions[0] { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "on_run_stake_batch") } _ => panic!("expected FunctionCall"), } } { let receipt = &receipts[2]; match &receipt.actions[0] { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "clear_stake_lock") } _ => panic!("expected FunctionCall"), } } // Act - progress stake workflow let mut context = test_context.context.clone(); context.predecessor_account_id = env::current_account_id(); testing_env!(context); test_context.on_run_stake_batch(StakingPoolAccount { account_id: env::current_account_id(), unstaked_balance: YOCTO.into(), staked_balance: 0.into(), can_withdraw: false, }); let receipts = deserialize_receipts(); assert_eq!(receipts.len(), 2); { let receipt = &receipts[0]; match &receipt.actions[0] { Action::FunctionCall { method_name, .. } => assert_eq!(method_name, "stake"), _ => panic!("expected FunctionCall"), } match &receipt.actions[1] { Action::FunctionCall { method_name, .. } => assert_eq!(method_name, "get_account"), _ => panic!("expected FunctionCall"), } } { let receipt = &receipts[1]; match &receipt.actions[0] { Action::FunctionCall { method_name, args, .. } => { assert_eq!(method_name, "on_deposit_and_stake"); let args: OnDepositAndStakeArgs = serde_json::from_str(args).unwrap(); assert_eq!(args.near_liquidity.unwrap().value(), YOCTO / 2); } _ => panic!("expected FunctionCall"), } } let mut context = test_context.context.clone(); context.predecessor_account_id = env::current_account_id(); testing_env!(context); test_context.on_deposit_and_stake( Some((YOCTO / 2).into()), StakingPoolAccount { account_id: env::current_account_id(), unstaked_balance: (YOCTO / 2).into(), staked_balance: (YOCTO / 2).into(), can_withdraw: false, }, ); println!("on_deposit_and_stake receipts"); let receipts = deserialize_receipts(); assert_eq!(receipts.len(), 1); { let receipt = &receipts[0]; match &receipt.actions[0] { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "process_staked_batch") } _ => panic!("expected FunctionCall"), } } let mut context = test_context.context.clone(); context.predecessor_account_id = env::current_account_id(); testing_env!(context); test_context.process_staked_batch(); testing_env!(test_context.context.clone()); let balances = test_context.balances(); assert_eq!(balances.near_liquidity_pool.value(), YOCTO / 2); } #[test] fn when_partial_batch_balance_is_used_for_liquidity() { // Arrange let mut test_context = TestContext::with_registered_account(); // user deposits and stakes 1 NEAR { let mut context = test_context.context.clone(); context.attached_deposit = YOCTO; testing_env!(context); test_context.deposit_and_stake(); test_context.on_deposit_and_stake( None, StakingPoolAccount { account_id: env::current_account_id(), unstaked_balance: 0.into(), staked_balance: YOCTO.into(), can_withdraw: true, }, ); test_context.process_staked_batch(); } // user redeems all to create pending withdrawal that requires liquidity { testing_env!(test_context.context.clone()); test_context.redeem_all_and_unstake(); let mut context = test_context.context.clone(); context.predecessor_account_id = env::current_account_id(); testing_env!(context); test_context.on_run_redeem_stake_batch(StakingPoolAccount { account_id: env::current_account_id(), unstaked_balance: 0.into(), staked_balance: YOCTO.into(), can_withdraw: true, }); set_env_with_success_promise_result(&mut test_context); test_context.on_unstake(); test_context.clear_redeem_lock(); } // Act - deposit and stake 2 NEAR - 1 NEAR will be added to liquidity let mut context = test_context.context.clone(); context.attached_deposit = (YOCTO * 2).into(); testing_env!(context); test_context.deposit_and_stake(); // Assert let receipts = deserialize_receipts(); assert_eq!(receipts.len(), 3); { let receipt = &receipts[0]; match &receipt.actions[0] { Action::FunctionCall { method_name, .. } => assert_eq!(method_name, "get_account"), _ => panic!("expected FunctionCall"), } } { let receipt = &receipts[1]; match &receipt.actions[0] { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "on_run_stake_batch") } _ => panic!("expected FunctionCall"), } } { let receipt = &receipts[2]; match &receipt.actions[0] { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "clear_stake_lock") } _ => panic!("expected FunctionCall"), } } // Act - progress stake workflow let mut context = test_context.context.clone(); context.predecessor_account_id = env::current_account_id(); testing_env!(context); test_context.on_run_stake_batch(StakingPoolAccount { account_id: env::current_account_id(), unstaked_balance: YOCTO.into(), staked_balance: 0.into(), can_withdraw: false, }); let receipts = deserialize_receipts(); assert_eq!(receipts.len(), 2); { let receipt = &receipts[0]; match &receipt.actions[0] { Action::FunctionCall { method_name, .. } => assert_eq!(method_name, "deposit"), _ => panic!("expected FunctionCall"), } match &receipt.actions[1] { Action::FunctionCall { method_name, .. } => assert_eq!(method_name, "stake"), _ => panic!("expected FunctionCall"), } match &receipt.actions[2] { Action::FunctionCall { method_name, .. } => assert_eq!(method_name, "get_account"), _ => panic!("expected FunctionCall"), } } { let receipt = &receipts[1]; match &receipt.actions[0] { Action::FunctionCall { method_name, args, .. } => { assert_eq!(method_name, "on_deposit_and_stake"); let args: OnDepositAndStakeArgs = serde_json::from_str(args).unwrap(); assert_eq!(args.near_liquidity.unwrap().value(), YOCTO); } _ => panic!("expected FunctionCall"), } } let mut context = test_context.context.clone(); context.predecessor_account_id = env::current_account_id(); testing_env!(context); test_context.on_deposit_and_stake( Some((YOCTO).into()), StakingPoolAccount { account_id: env::current_account_id(), unstaked_balance: 0.into(), staked_balance: (YOCTO * 2).into(), can_withdraw: false, }, ); println!("on_deposit_and_stake receipts"); let receipts = deserialize_receipts(); assert_eq!(receipts.len(), 1); { let receipt = &receipts[0]; match &receipt.actions[0] { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "process_staked_batch") } _ => panic!("expected FunctionCall"), } } let mut context = test_context.context.clone(); context.predecessor_account_id = env::current_account_id(); testing_env!(context); test_context.process_staked_batch(); testing_env!(test_context.context.clone()); // enough liquidity was added to clear the pending withdrawal assert!(test_context.pending_withdrawal().is_none()); // funds from liquidity pool should have been moved over to unstaked NEAR balance, which is // available for withdrawal let balances = test_context.balances(); assert_eq!(balances.near_liquidity_pool.value(), 0); assert_eq!(balances.total_available_unstaked_near.value(), YOCTO); } #[test] fn clear_stake_batch_lock_when_staked_should_retain_lock() { // Arrange let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); context.attached_deposit = YOCTO; testing_env!(context); test_context.deposit_and_stake(); testing_env!(test_context.context.clone()); test_context.on_deposit_and_stake( None, StakingPoolAccount { account_id: env::current_account_id(), unstaked_balance: 0.into(), staked_balance: YOCTO.into(), can_withdraw: true, }, ); // simulate StakeTokenContract::process_staked_batch() fails by not calling it // Act let mut context = test_context.context.clone(); context.predecessor_account_id = env::current_account_id(); testing_env!(context); test_context.clear_stake_lock(); match test_context.stake_batch_lock { Some(StakeLock::Staked { .. }) => println!("{:?}", test_context.stake_batch_lock), _ => panic!( "expected Staked but was: {:?}", test_context.stake_batch_lock ), } } } #[cfg(test)] mod test_withdraw_from_stake_batch { use super::*; use crate::{interface::AccountManagement, near::YOCTO, test_utils::*}; use near_sdk::{json_types::ValidAccountId, testing_env, MockedBlockchain}; use std::convert::TryFrom; /// Given an account has deposited funds into a stake batch /// And the contract is not locked /// When the account tries to withdraw funds from the batch /// Then the funds are transferred back to the account #[test] fn account_has_uncommitted_stake_batch() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; context.attached_deposit = 10 * YOCTO; testing_env!(context.clone()); contract.deposit(); testing_env!(context.clone()); contract.withdraw_from_stake_batch(YOCTO.into()); { let receipts = deserialize_receipts(); println!("{:#?}", &receipts); assert_eq!(receipts.len(), 1); let receipt = receipts.first().unwrap(); assert_eq!(receipt.receiver_id, test_context.account_id); match receipt.actions.first().unwrap() { Action::Transfer { deposit } => assert_eq!(*deposit, YOCTO), _ => panic!("unexpected action type"), } } let account = contract .lookup_account(ValidAccountId::try_from(test_context.account_id).unwrap()) .unwrap(); assert_eq!( account.stake_batch.unwrap().balance.amount.value(), (9 * YOCTO) ); assert_eq!( contract.stake_batch.unwrap().balance().amount().value(), (9 * YOCTO) ); } #[test] fn withdraw_all_funds_from_batch_specifying_exact_amount() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; context.attached_deposit = 10 * YOCTO; testing_env!(context.clone()); contract.deposit(); testing_env!(context.clone()); contract.withdraw_from_stake_batch(context.attached_deposit.into()); { let receipts = deserialize_receipts(); assert_eq!(receipts.len(), 1); let receipt = receipts.first().unwrap(); assert_eq!(receipt.receiver_id, test_context.account_id); match receipt.actions.first().unwrap() { Action::Transfer { deposit } => assert_eq!(*deposit, context.attached_deposit), _ => panic!("unexpected action type"), } } let account = contract .lookup_account(ValidAccountId::try_from(test_context.account_id).unwrap()) .unwrap(); assert!(account.stake_batch.is_none()); } /// Given an account has deposited funds into the next stake batch /// And the contract is locked /// When the account tries to withdraw funds from the batch /// Then the funds are transferred back to the account #[test] fn while_stake_batch_is_locked_withdraw_partial() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; contract.stake_batch_lock = Some(StakeLock::Staking); context.attached_deposit = 10 * YOCTO; testing_env!(context.clone()); contract.deposit(); testing_env!(context.clone()); contract.withdraw_from_stake_batch(YOCTO.into()); { let receipts = deserialize_receipts(); println!("{:#?}", &receipts); assert_eq!(receipts.len(), 1); let receipt = receipts.first().unwrap(); assert_eq!(receipt.receiver_id, test_context.account_id); match receipt.actions.first().unwrap() { Action::Transfer { deposit } => assert_eq!(*deposit, YOCTO), _ => panic!("unexpected action type"), } } let account = contract .lookup_account(ValidAccountId::try_from(test_context.account_id).unwrap()) .unwrap(); assert_eq!( account.next_stake_batch.unwrap().balance.amount.value(), (9 * YOCTO) ); } /// Given an account has deposited funds into the next stake batch /// And the contract is locked /// When the account tries to withdraw all funds from the batch /// Then the funds are transferred back to the account /// And the batch is deleted on the account #[test] fn while_stake_batch_is_locked_withdraw_all() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; contract.stake_batch_lock = Some(StakeLock::Staking); context.attached_deposit = 10 * YOCTO; testing_env!(context.clone()); contract.deposit(); testing_env!(context.clone()); contract.withdraw_from_stake_batch(context.attached_deposit.into()); { let receipts = deserialize_receipts(); assert_eq!(receipts.len(), 1); let receipt = receipts.first().unwrap(); assert_eq!(receipt.receiver_id, test_context.account_id); match receipt.actions.first().unwrap() { Action::Transfer { deposit } => assert_eq!(*deposit, context.attached_deposit), _ => panic!("unexpected action type"), } } let account = contract .lookup_account(ValidAccountId::try_from(test_context.account_id).unwrap()) .unwrap(); assert!(account.next_stake_batch.is_none()); } } #[cfg(test)] mod test_withdraw_all_from_stake_batch { use super::*; use crate::{interface::AccountManagement, near::YOCTO, test_utils::*}; use near_sdk::{json_types::ValidAccountId, testing_env, MockedBlockchain}; use std::convert::TryFrom; /// Given an account has deposited funds into the next stake batch /// And the contract is locked /// When the account tries to withdraw funds from the batch /// Then the funds are transferred back to the account #[test] fn while_stake_batch_is_locked() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; contract.stake_batch_lock = Some(StakeLock::Staking); context.attached_deposit = 10 * YOCTO; testing_env!(context.clone()); contract.deposit(); testing_env!(context.clone()); contract.withdraw_all_from_stake_batch(); { let receipts = deserialize_receipts(); assert_eq!(receipts.len(), 1); let receipt = receipts.first().unwrap(); assert_eq!(receipt.receiver_id, test_context.account_id); match receipt.actions.first().unwrap() { Action::Transfer { deposit } => assert_eq!(*deposit, 10 * YOCTO), _ => panic!("unexpected action type"), } } let account = contract .lookup_account(ValidAccountId::try_from(test_context.account_id).unwrap()) .unwrap(); assert!(account.next_stake_batch.is_none()); } #[test] fn while_stake_batch_is_locked_with_other_funds_batch() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; contract.stake_batch_lock = Some(StakeLock::Staking); context.attached_deposit = 10 * YOCTO; testing_env!(context.clone()); contract.deposit(); assert!(contract.next_stake_batch.is_some()); if let Some(batch) = contract.next_stake_batch.as_mut() { batch.add(YOCTO.into()); } testing_env!(context.clone()); contract.withdraw_all_from_stake_batch(); { let receipts = deserialize_receipts(); assert_eq!(receipts.len(), 1); let receipt = receipts.first().unwrap(); assert_eq!(receipt.receiver_id, test_context.account_id); match receipt.actions.first().unwrap() { Action::Transfer { deposit } => assert_eq!(*deposit, 10 * YOCTO), _ => panic!("unexpected action type"), } } let account = contract .lookup_account(ValidAccountId::try_from(test_context.account_id).unwrap()) .unwrap(); assert!(account.next_stake_batch.is_none()); assert_eq!( contract.next_stake_batch.unwrap().balance().amount(), YOCTO.into() ); } #[test] fn from_uncommitted_stake_batch() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; context.attached_deposit = 10 * YOCTO; testing_env!(context.clone()); contract.deposit(); let account = contract .lookup_account(ValidAccountId::try_from(test_context.account_id).unwrap()) .unwrap(); assert!(account.stake_batch.is_some()); assert!(contract.stake_batch.is_some()); testing_env!(context.clone()); contract.withdraw_all_from_stake_batch(); { let receipts = deserialize_receipts(); assert_eq!(receipts.len(), 1); let receipt = receipts.first().unwrap(); assert_eq!(receipt.receiver_id, test_context.account_id); match receipt.actions.first().unwrap() { Action::Transfer { deposit } => assert_eq!(*deposit, 10 * YOCTO), _ => panic!("unexpected action type"), } } let account = contract .lookup_account(ValidAccountId::try_from(test_context.account_id).unwrap()) .unwrap(); assert!(account.stake_batch.is_none()); assert!(contract.stake_batch.is_none()); } #[test] fn from_uncommitted_stake_batch_with_other_funds_batched() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; context.attached_deposit = 10 * YOCTO; testing_env!(context.clone()); contract.deposit(); let account = contract .lookup_account(ValidAccountId::try_from(test_context.account_id).unwrap()) .unwrap(); assert!(account.stake_batch.is_some()); assert!(contract.stake_batch.is_some()); if let Some(batch) = contract.stake_batch.as_mut() { batch.add(YOCTO.into()); } testing_env!(context.clone()); contract.withdraw_all_from_stake_batch(); { let receipts = deserialize_receipts(); assert_eq!(receipts.len(), 1); let receipt = receipts.first().unwrap(); assert_eq!(receipt.receiver_id, test_context.account_id); match receipt.actions.first().unwrap() { Action::Transfer { deposit } => assert_eq!(*deposit, 10 * YOCTO), _ => panic!("unexpected action type"), } } let account = contract .lookup_account(ValidAccountId::try_from(test_context.account_id).unwrap()) .unwrap(); assert!(account.stake_batch.is_none()); assert_eq!( contract.stake_batch.unwrap().balance().amount(), YOCTO.into() ); } #[test] fn with_no_stake_batch() { let mut test_context = TestContext::with_registered_account(); let context = test_context.context.clone(); let contract = &mut test_context.contract; testing_env!(context.clone()); assert_eq!(contract.withdraw_all_from_stake_batch().value(), 0); } #[test] #[should_panic(expected = "action is blocked because a batch is running")] fn withdraw_all_funds_from_stake_batch_while_unstaking() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; context.attached_deposit = 10 * YOCTO; testing_env!(context.clone()); contract.deposit(); contract.redeem_stake_batch_lock = Some(RedeemLock::Unstaking); testing_env!(context.clone()); contract.withdraw_all_from_stake_batch(); } #[test] #[should_panic(expected = "action is blocked because a batch is running")] fn withdraw_all_funds_from_stake_batch_while_stake_batch_is_locked() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; context.attached_deposit = 10 * YOCTO; testing_env!(context.clone()); contract.deposit(); contract.stake_batch_lock = Some(StakeLock::Staking); testing_env!(context.clone()); contract.withdraw_all_from_stake_batch(); } } #[cfg(test)] mod test_withdraw { use super::*; use crate::{near::YOCTO, test_utils::*}; use near_sdk::{testing_env, MockedBlockchain}; use std::ops::DerefMut; #[test] fn partial_funds() { let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; // Given the account has some NEAR balance let mut account = contract.registered_account(test_context.account_id); account.deref_mut().apply_near_credit((10 * YOCTO).into()); contract.save_registered_account(&account); contract.total_near.credit(account.near.unwrap().amount()); // When partial funds are withdrawn contract.withdraw((5 * YOCTO).into()); // Assert that the account NEAR balance was debited let account = contract.registered_account(test_context.account_id); assert_eq!(*account.near.unwrap().amount(), (5 * YOCTO).into()); } #[test] #[should_panic(expected = "account has zero NEAR balance")] fn with_no_near_funds() { let mut test_context = TestContext::with_registered_account(); test_context.contract.withdraw((50 * YOCTO).into()); } #[test] #[should_panic(expected = "account NEAR balance is too low to fulfill request")] fn with_insufficient_funds() { let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; // Given the account has some NEAR balance let mut account = contract.registered_account(test_context.account_id); account.deref_mut().apply_near_credit((10 * YOCTO).into()); contract.save_registered_account(&account); contract.withdraw((50 * YOCTO).into()); } #[test] #[should_panic(expected = "action is blocked because a batch is running")] fn withdraw_funds_from_stake_batch_with_staking_lock() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let mut context = test_context.context.clone(); context.attached_deposit = 10 * YOCTO; testing_env!(context.clone()); contract.deposit(); testing_env!(test_context.context.clone()); contract.stake(); // Act testing_env!(test_context.context.clone()); contract.withdraw_from_stake_batch(YOCTO.into()); } #[test] #[should_panic(expected = "action is blocked because a batch is running")] fn withdraw_funds_from_stake_batch_with_staked_lock() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let mut context = test_context.context.clone(); context.attached_deposit = 10 * YOCTO; testing_env!(context.clone()); contract.deposit(); testing_env!(test_context.context.clone()); contract.stake(); contract.stake_batch_lock = Some(StakeLock::Staked { unstaked_balance: YOCTO.into(), staked_balance: YOCTO.into(), near_liquidity: None, }); // Act testing_env!(test_context.context.clone()); contract.withdraw_from_stake_batch(YOCTO.into()); } #[test] #[should_panic(expected = "action is blocked because a batch is running")] fn withdraw_funds_from_stake_batch_while_unstaking() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; context.attached_deposit = 10 * YOCTO; testing_env!(context.clone()); contract.deposit(); contract.redeem_stake_batch_lock = Some(RedeemLock::Unstaking); testing_env!(context.clone()); contract.withdraw_from_stake_batch(YOCTO.into()); } #[test] #[should_panic(expected = "there are no funds in stake batch")] fn withdraw_funds_from_stake_batch_with_no_stake_batch() { let mut test_context = TestContext::with_registered_account(); let context = test_context.context.clone(); let contract = &mut test_context.contract; testing_env!(context.clone()); contract.withdraw_from_stake_batch(YOCTO.into()); } } #[cfg(test)] mod test_withdraw_all { use super::*; use crate::{near::YOCTO, test_utils::*}; use std::ops::Deref; #[test] fn has_near_funds() { let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; // Given the account has some NEAR balance let mut account = contract.registered_account(test_context.account_id); account.apply_near_credit((10 * YOCTO).into()); contract.save_registered_account(&account); contract.total_near.credit(account.near.unwrap().amount()); contract.withdraw_all(); // Assert that the account NEAR balance was debited let account = contract.registered_account(test_context.account_id); assert!(account.deref().near.is_none()); } #[test] fn has_near_funds_in_unclaimed_receipts() { let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; // Given the account has some NEAR balance let mut account = contract.registered_account(test_context.account_id); *contract.batch_id_sequence += 1; account.account.redeem_stake_batch = Some(RedeemStakeBatch::new( contract.batch_id_sequence, YOCTO.into(), )); contract.save_registered_account(&account); contract.total_near.credit(YOCTO.into()); contract.redeem_stake_batch_receipts.insert( &contract.batch_id_sequence, &domain::RedeemStakeBatchReceipt::new(YOCTO.into(), contract.stake_token_value), ); contract.withdraw_all(); // Assert that the account NEAR balance was debited let account = contract.registered_account(test_context.account_id); assert!(account.account.near.is_none()); } #[test] fn with_no_near_funds() { // Arrange let mut context = TestContext::with_registered_account(); let contract = &mut context.contract; // Act let amount = contract.withdraw_all(); // Assert assert_eq!(amount.value(), 0); } } #[cfg(test)] mod test_claim_receipts { use super::*; use crate::domain::BlockTimeHeight; use crate::test_utils::*; use crate::{interface::AccountManagement, near::YOCTO}; use near_sdk::{testing_env, MockedBlockchain}; use std::convert::TryInto; #[test] #[should_panic(expected = "account is not registered")] fn when_account_is_not_registered() { // Arrange let mut test_context = TestContext::new(); let contract = &mut test_context.contract; // Act contract.claim_receipts(); } /// Given the account has no funds in stake batches /// When funds are claimed /// Then there should be no effect #[test] fn when_account_has_no_batches() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; // Act contract.claim_receipts(); } /// Given the account has funds in the stake batch /// And there is no receipt for the batch /// When funds are claimed /// Then there should be no effect on the account #[test] fn when_account_has_funds_in_unprocessed_stake_batch() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; // deposit NEAR into StakeBatch test_context.context.attached_deposit = YOCTO; testing_env!(test_context.context.clone()); let batch_id = contract.deposit(); // Act contract.claim_receipts(); // Assert let account = contract .lookup_account(test_context.account_id.try_into().unwrap()) .unwrap(); let stake_batch = account.stake_batch.unwrap(); assert_eq!(stake_batch.id, batch_id.into()); assert_eq!(stake_batch.balance.amount, YOCTO.into()); assert!(account.stake.is_none()); } /// Given the account has funds in the stake batch /// And there is a receipt for the batch with additional funds batched into it /// When funds are claimed /// Then the STAKE tokens should be credited to the account /// And the receipt NEAR balance should have been debited #[test] fn when_account_has_batch_with_receipt() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let mut context = test_context.context.clone(); context.attached_deposit = YOCTO; testing_env!(context.clone()); let batch_id = contract.deposit(); let batch_id: domain::BatchId = domain::BatchId(batch_id.into()); // create a receipt for the batch to simulate that the batch has been staked { let stake_token_value = domain::StakeTokenValue::new(Default::default(), YOCTO.into(), YOCTO.into()); let receipt = domain::StakeBatchReceipt::new( (context.attached_deposit * 2).into(), // simulate that other accounts have deposited into the same batch stake_token_value, ); contract.stake_batch_receipts.insert(&batch_id, &receipt); } // Act contract.claim_receipts(); // Assert let account = contract.predecessor_registered_account().account; assert_eq!( account.stake.unwrap().amount().value(), YOCTO, "the funds should have been claimed by the account" ); assert!( account.stake_batch.is_none(), "stake batch should be set to None" ); let receipt = contract.stake_batch_receipts.get(&batch_id.into()).unwrap(); assert_eq!( receipt.staked_near().value(), YOCTO, "claiming STAKE tokens should have reduced the near balance on the receipt" ); } /// Given the account has funds in the stake batch /// And there is a receipt for the batch with exact matching funds /// When funds are claimed /// Then the STAKE tokens should be credited to the account /// And the receipt is deleted #[test] fn when_all_funds_on_stake_batch_receipt_are_claimed() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let mut context = test_context.context.clone(); context.attached_deposit = YOCTO; testing_env!(context.clone()); let batch_id = contract.deposit(); let batch_id: domain::BatchId = domain::BatchId(batch_id.into()); let stake_token_value = domain::StakeTokenValue::new(Default::default(), YOCTO.into(), YOCTO.into()); let receipt = domain::StakeBatchReceipt::new(context.attached_deposit.into(), stake_token_value); contract.stake_batch_receipts.insert(&batch_id, &receipt); // Act contract.claim_receipts(); // Assert let account = contract.predecessor_registered_account().account; assert_eq!( account.stake.unwrap().amount().value(), context.attached_deposit, "the funds should have been claimed by the account" ); assert!( account.stake_batch.is_none(), "stake batch should be set to None" ); assert!( contract.stake_batch_receipts.get(&batch_id).is_none(), "when all STAKE tokens are claimed, then the receipt should have been deleted" ); } /// Given Account::stake_batch and Account::next_stake_batch both have funds /// And there are exact receipts for both batches /// Then STAKE tokens should be claimed for both /// And the receipts should be deleted #[test] fn when_account_has_stake_batch_and_next_stake_batch_funds_with_receipts() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let mut context = test_context.context.clone(); context.attached_deposit = YOCTO; testing_env!(context.clone()); let batch_id = contract.deposit(); let batch_id_1: domain::BatchId = domain::BatchId(batch_id.into()); contract.stake_batch_lock = Some(StakeLock::Staking); context.attached_deposit = YOCTO * 2; testing_env!(context.clone()); let batch_id = contract.deposit(); let batch_id_2: domain::BatchId = domain::BatchId(batch_id.into()); assert_ne!(batch_id_1, batch_id_2); { let stake_token_value = domain::StakeTokenValue::new(Default::default(), YOCTO.into(), YOCTO.into()); contract.stake_batch_receipts.insert( &batch_id_1, &domain::StakeBatchReceipt::new(YOCTO.into(), stake_token_value), ); contract.stake_batch_receipts.insert( &batch_id_2, &domain::StakeBatchReceipt::new((YOCTO * 2).into(), stake_token_value), ); } contract.stake_batch_lock = None; // Act contract.claim_receipts(); // Assert assert!(contract.stake_batch_receipts.get(&batch_id_1).is_none()); assert!(contract.stake_batch_receipts.get(&batch_id_2).is_none()); let account = contract.predecessor_registered_account().account; // and the account batches have been cleared assert!(account.stake_batch.is_none()); assert!(account.next_stake_batch.is_none()); // and the STAKE tokens were claimed and credited to the account assert_eq!(account.stake.unwrap().amount().value(), 3 * YOCTO); } #[test] fn when_account_has_stake_batch_and_next_stake_batch_funds_with_receipt_for_stake_batch() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let mut context = test_context.context.clone(); context.attached_deposit = YOCTO; testing_env!(context.clone()); let batch_id = contract.deposit(); let batch_id_1: domain::BatchId = domain::BatchId(batch_id.into()); contract.stake_batch_lock = Some(StakeLock::Staking); context.attached_deposit = YOCTO * 2; testing_env!(context.clone()); let batch_id = contract.deposit(); let batch_id_2: domain::BatchId = domain::BatchId(batch_id.into()); assert_ne!(batch_id_1, batch_id_2); { let stake_token_value = domain::StakeTokenValue::new(Default::default(), YOCTO.into(), YOCTO.into()); contract.stake_batch_receipts.insert( &batch_id_1, &domain::StakeBatchReceipt::new(YOCTO.into(), stake_token_value), ); } contract.stake_batch_lock = None; // Act contract.claim_receipts(); // Assert assert!(contract.stake_batch_receipts.get(&batch_id_1).is_none()); let account = contract.predecessor_registered_account().account; // and the account batches have been cleared assert_eq!(account.stake_batch.unwrap().id(), batch_id_2); assert!(account.next_stake_batch.is_none()); // and the STAKE tokens were claimed and credited to the account assert_eq!(account.stake.unwrap().amount().value(), YOCTO); } /// Given an account has redeemed STAKE /// And the batch has completed /// Then the account can claim the NEAR funds #[test] fn when_account_has_redeem_stake_batch_with_receipt() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let mut account = contract.predecessor_registered_account(); account.apply_stake_credit(YOCTO.into()); contract.save_registered_account(&account); let batch_id = contract .redeem_all() .map(|batch_id| domain::BatchId(batch_id.into())) .unwrap(); contract.redeem_stake_batch_receipts.insert( &batch_id, &domain::RedeemStakeBatchReceipt::new((2 * YOCTO).into(), contract.stake_token_value), ); // Act contract.claim_receipts(); // Assert let account = contract.predecessor_registered_account().account; assert_eq!(account.near.unwrap().amount(), (YOCTO).into()); assert!(account.redeem_stake_batch.is_none()); // Then there should be 1 STAKE left unclaimed on the receipt let receipt = contract.redeem_stake_batch_receipts.get(&batch_id).unwrap(); assert_eq!(receipt.redeemed_stake(), YOCTO.into()); } #[test] fn when_account_has_redeem_stake_batch_and_next_redeem_stake_batch_with_receipts_for_both() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let batch_id_1 = { let mut account = contract.predecessor_registered_account(); account.apply_stake_credit(YOCTO.into()); contract.save_registered_account(&account); let batch_id = contract .redeem_all() .map(|batch_id| domain::BatchId(batch_id.into())) .unwrap(); contract.redeem_stake_batch_receipts.insert( &batch_id, &domain::RedeemStakeBatchReceipt::new( (2 * YOCTO).into(), contract.stake_token_value, ), ); batch_id }; let batch_id_2 = { let mut account = contract.predecessor_registered_account(); account.apply_stake_credit(YOCTO.into()); contract.save_registered_account(&account); contract.redeem_stake_batch_lock = Some(RedeemLock::PendingWithdrawal); let batch_id = contract .redeem_all() .map(|batch_id| domain::BatchId(batch_id.into())) .unwrap(); contract.redeem_stake_batch_receipts.insert( &batch_id, &domain::RedeemStakeBatchReceipt::new( (4 * YOCTO).into(), contract.stake_token_value, ), ); contract.redeem_stake_batch_lock = None; batch_id }; // Act contract.claim_receipts(); // Assert let account = contract.predecessor_registered_account().account; assert_eq!(account.near.unwrap().amount(), (2 * YOCTO).into()); assert!(account.redeem_stake_batch.is_none()); assert!(account.next_redeem_stake_batch.is_none()); // Then there should be 1 STAKE left unclaimed on the receipt let receipt = contract .redeem_stake_batch_receipts .get(&batch_id_1) .unwrap(); assert_eq!(receipt.redeemed_stake(), YOCTO.into()); let receipt = contract .redeem_stake_batch_receipts .get(&batch_id_2) .unwrap(); assert_eq!(receipt.redeemed_stake(), (3 * YOCTO).into()); } #[test] fn when_account_has_redeem_stake_batch_and_next_redeem_stake_batch_with_receipt_for_both_fully_claimed( ) { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let batch_id_1 = { let mut account = contract.predecessor_registered_account(); account.apply_stake_credit(YOCTO.into()); contract.save_registered_account(&account); let batch_id = contract .redeem_all() .map(|batch_id| domain::BatchId(batch_id.into())) .unwrap(); contract.redeem_stake_batch_receipts.insert( &batch_id, &domain::RedeemStakeBatchReceipt::new(YOCTO.into(), contract.stake_token_value), ); batch_id }; let batch_id_2 = { let mut account = contract.predecessor_registered_account(); account.apply_stake_credit(YOCTO.into()); contract.save_registered_account(&account); contract.redeem_stake_batch_lock = Some(RedeemLock::PendingWithdrawal); let batch_id = contract .redeem_all() .map(|batch_id| domain::BatchId(batch_id.into())) .unwrap(); contract.redeem_stake_batch_receipts.insert( &batch_id, &domain::RedeemStakeBatchReceipt::new(YOCTO.into(), contract.stake_token_value), ); contract.redeem_stake_batch_lock = None; batch_id }; // Act contract.claim_receipts(); // Assert let account = contract.predecessor_registered_account().account; assert_eq!(account.near.unwrap().amount(), (2 * YOCTO).into()); assert!(account.redeem_stake_batch.is_none()); assert!(account.next_redeem_stake_batch.is_none()); // Then there should be 1 STAKE left unclaimed on the receipt assert!(contract .redeem_stake_batch_receipts .get(&batch_id_1) .is_none()); assert!(contract .redeem_stake_batch_receipts .get(&batch_id_2) .is_none()); } #[test] fn when_account_has_redeem_stake_batch_and_next_redeem_stake_batch_with_receipts_for_current() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; { let mut account = contract.predecessor_registered_account(); account.apply_stake_credit(YOCTO.into()); contract.save_registered_account(&account); let batch_id = contract .redeem_all() .map(|batch_id| domain::BatchId(batch_id.into())) .unwrap(); contract.redeem_stake_batch_receipts.insert( &batch_id, &domain::RedeemStakeBatchReceipt::new( (2 * YOCTO).into(), contract.stake_token_value, ), ); batch_id }; let batch_id_2 = { let mut account = contract.predecessor_registered_account(); account.apply_stake_credit(YOCTO.into()); contract.save_registered_account(&account); contract.redeem_stake_batch_lock = Some(RedeemLock::PendingWithdrawal); let batch_id = contract .redeem_all() .map(|batch_id| domain::BatchId(batch_id.into())) .unwrap(); contract.redeem_stake_batch_lock = None; batch_id }; // Act contract.claim_receipts(); // Assert let account = contract.predecessor_registered_account().account; assert_eq!(account.near.unwrap().amount(), YOCTO.into()); assert_eq!(account.redeem_stake_batch.unwrap().id(), batch_id_2); assert!(account.next_redeem_stake_batch.is_none()); } /// Given an account has redeemed STAKE /// And the batch receipt is pending withdrawal /// And there is enough NEAR liquidity to fulfill the claim /// Then the account can claim the NEAR funds from the NEAR liquidity pool #[test] fn when_account_claims_against_liquidity() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let mut context = test_context.context.clone(); let mut registered_account = contract.predecessor_registered_account(); let account = &mut registered_account.account; account.apply_stake_credit(YOCTO.into()); contract.save_registered_account(&registered_account); context.attached_deposit = YOCTO; testing_env!(context.clone()); let batch_id = contract .redeem_all() .map(|id| domain::BatchId(id.into())) .unwrap(); contract.near_liquidity_pool = YOCTO.into(); contract.redeem_stake_batch_receipts.insert( &batch_id, &domain::RedeemStakeBatchReceipt::new((2 * YOCTO).into(), contract.stake_token_value), ); contract.redeem_stake_batch_lock = Some(RedeemLock::PendingWithdrawal); // Act contract.claim_receipts(); // Assert let account = contract.predecessor_registered_account().account; assert!(account.stake.is_none()); assert_eq!(account.near.unwrap().amount(), YOCTO.into()); assert!(account.redeem_stake_batch.is_none()); assert_eq!(contract.near_liquidity_pool, 0.into()); assert_eq!( contract.pending_withdrawal().unwrap().redeemed_stake, YOCTO.into() ); } /// Given an account has redeemed STAKE /// And the batch receipt is pending withdrawal /// And there is enough NEAR liquidity to fulfill the claim /// And the receipt is fully claimed /// Then the account can claim the NEAR funds from the NEAR liquidity pool /// And the RedeemLock is set to None /// And the receipt has been deleted #[test] fn when_account_claims_from_liquidity_pool_and_closes_out_pending_withdrawal() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let mut context = test_context.context.clone(); let mut registered_account = contract.predecessor_registered_account(); let account = &mut registered_account.account; account.apply_stake_credit(YOCTO.into()); contract.save_registered_account(&registered_account); context.attached_deposit = YOCTO; testing_env!(context.clone()); let batch_id = contract .redeem_all() .map(|id| domain::BatchId(id.into())) .unwrap(); contract.near_liquidity_pool = YOCTO.into(); contract.redeem_stake_batch_receipts.insert( &batch_id, &domain::RedeemStakeBatchReceipt::new(YOCTO.into(), contract.stake_token_value), ); contract.redeem_stake_batch_lock = Some(RedeemLock::PendingWithdrawal); // Act contract.claim_receipts(); // Assert let account = contract.predecessor_registered_account().account; assert!(account.stake.is_none()); assert_eq!(account.near.unwrap().amount(), YOCTO.into()); assert!(account.redeem_stake_batch.is_none()); assert_eq!(contract.near_liquidity_pool, 0.into()); assert!(contract.pending_withdrawal().is_none()); assert!(contract.redeem_stake_batch_lock.is_none()); } #[test] fn when_account_claims_from_liquidity_pool_and_liquidity_results_in_rounding_down_stake() { // Arrange let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; let mut registered_account = contract.predecessor_registered_account(); let account = &mut registered_account.account; account.apply_stake_credit(YOCTO.into()); contract.save_registered_account(&registered_account); let batch_id = contract .redeem_all() .map(|id| domain::BatchId(id.into())) .unwrap(); // contract has 1 NEAR in liquidity pool contract.near_liquidity_pool = YOCTO.into(); // exchange rate is 1 STAKE -> 3 NEAR contract.redeem_stake_batch_receipts.insert( &batch_id, &domain::RedeemStakeBatchReceipt::new( YOCTO.into(), domain::StakeTokenValue::new( BlockTimeHeight::from_env(), (3 * YOCTO).into(), YOCTO.into(), ), ), ); contract.redeem_stake_batch_lock = Some(RedeemLock::PendingWithdrawal); // Act contract.claim_receipts(); // Assert let account = contract.predecessor_registered_account().account; // account's STAKE balance should be zero because all STAKE was redeemed assert!(account.stake.is_none()); assert_eq!(account.near.unwrap().amount(), YOCTO.into()); assert_eq!( account.redeem_stake_batch.unwrap().balance().amount(), (YOCTO - (YOCTO / 3)).into() ); assert_eq!(contract.near_liquidity_pool, 0.into()); assert_eq!( contract.pending_withdrawal().unwrap().redeemed_stake, (YOCTO - (YOCTO / 3)).into() ); assert!(contract.redeem_stake_batch_lock.is_some()); // Arrange - unstaked NEAR has been withdrawn from staking pool contract.redeem_stake_batch_lock = None; // Act contract.claim_receipts(); // Assert let account = contract.predecessor_registered_account().account; assert_eq!(account.near.unwrap().amount(), (3 * YOCTO + 1).into()); println!( "account.redeem_stake_batch: {:?}", account.redeem_stake_batch ); assert!(account.redeem_stake_batch.is_none()); println!( "contract.pending_withdrawal(): {:?}", contract.pending_withdrawal() ); assert!(contract.pending_withdrawal().is_none()); } /// Given an account has redeemed STAKE into the current and next batches /// And there is a receipt for the current batch /// When the account claims funds, the current batch funds will be claimed /// And the next batch gets moved into the current batch slot #[test] fn claim_redeem_stake_batch_receipts_for_current_and_next_batch_with_receipt_for_current() { let mut ctx = TestContext::with_registered_account(); let contract = &mut ctx.contract; let mut account = contract.predecessor_registered_account(); account.redeem_stake_batch = Some(domain::RedeemStakeBatch::new( contract.batch_id_sequence, (10 * YOCTO).into(), )); *contract.batch_id_sequence += 1; account.next_redeem_stake_batch = Some(domain::RedeemStakeBatch::new( contract.batch_id_sequence, (15 * YOCTO).into(), )); contract.save_registered_account(&account); contract.redeem_stake_batch_receipts.insert( &(contract.batch_id_sequence.value() - 1).into(), &domain::RedeemStakeBatchReceipt::new((10 * YOCTO).into(), contract.stake_token_value), ); contract.claim_receipt_funds(&mut account); contract.save_registered_account(&account); let account = contract.predecessor_registered_account(); assert_eq!(account.near.unwrap().amount(), (10 * YOCTO).into()); assert_eq!( account.redeem_stake_batch.unwrap().balance().amount(), (15 * YOCTO).into() ); assert!(account.next_redeem_stake_batch.is_none()); assert!(contract .redeem_stake_batch_receipts .get(&(contract.batch_id_sequence.value() - 1).into()) .is_none()); } /// Given an account has redeemed STAKE /// And the batch has completed /// And there is a current batch pending withdrawal /// Then the account can claim the NEAR funds #[test] fn claim_redeem_stake_batch_receipts_for_old_batch_receipt_while_pending_withdrawal_on_current_batch( ) { let mut ctx = TestContext::with_registered_account(); let contract = &mut ctx.contract; let mut account = contract.predecessor_registered_account(); let batch_id = contract.batch_id_sequence; account.redeem_stake_batch = Some(domain::RedeemStakeBatch::new(batch_id, (10 * YOCTO).into())); account.next_redeem_stake_batch = Some(domain::RedeemStakeBatch::new( (batch_id.value() + 1).into(), (10 * YOCTO).into(), )); contract.save_registered_account(&account); *contract.batch_id_sequence += 10; contract.redeem_stake_batch = Some(domain::RedeemStakeBatch::new( contract.batch_id_sequence, (100 * YOCTO).into(), )); contract.redeem_stake_batch_receipts.insert( &batch_id, &domain::RedeemStakeBatchReceipt::new((20 * YOCTO).into(), contract.stake_token_value), ); contract.redeem_stake_batch_receipts.insert( &(batch_id.value() + 1).into(), &domain::RedeemStakeBatchReceipt::new((20 * YOCTO).into(), contract.stake_token_value), ); contract.claim_receipt_funds(&mut account); contract.save_registered_account(&account); let account = contract.predecessor_registered_account(); assert_eq!(account.near.unwrap().amount(), (20 * YOCTO).into()); assert!(account.redeem_stake_batch.is_none()); let receipt = contract.redeem_stake_batch_receipts.get(&batch_id).unwrap(); assert_eq!(receipt.redeemed_stake(), (10 * YOCTO).into()); } } #[cfg(test)] mod test { use super::*; use crate::domain::BlockTimeHeight; use crate::near::UNSTAKED_NEAR_FUNDS_NUM_EPOCHS_TO_UNLOCK; use crate::test_domain::GetStakedAccountBalanceArgs; use crate::{ interface::{AccountManagement, Operator}, near::YOCTO, test_utils::*, }; use near_sdk::{json_types::ValidAccountId, testing_env, MockedBlockchain}; use std::convert::{TryFrom, TryInto}; /// Given the account has no funds in stake batches /// When funds are claimed /// Then there should be no effect #[test] fn claim_receipt_funds_with_no_batched_funds() { let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; // should have no effect because there are no batches and no receipts let mut account = contract.registered_account(test_context.account_id); contract.claim_receipt_funds(&mut account); } /// Given the account has funds in the stake batch /// And there is no receipt for the batch /// When funds are claimed /// Then there should be no effect on the account #[test] fn claim_receipt_funds_with_funds_in_stake_batch_and_no_receipt() { let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; // Given account has funds deposited into the current StakeBatch // And there are no receipts let mut account = contract.registered_account(test_context.account_id); let batch_id = contract.deposit_near_for_account_to_stake(&mut account, YOCTO.into()); contract.save_registered_account(&account); // When batch receipts are claimed contract.claim_receipt_funds(&mut account); contract.save_registered_account(&account); // Then there should be no effect on the account let account = contract .lookup_account(test_context.account_id.try_into().unwrap()) .unwrap(); let stake_batch = account.stake_batch.unwrap(); assert_eq!(stake_batch.id, batch_id.into()); assert_eq!(stake_batch.balance.amount, YOCTO.into()); } /// Given the account has funds in the stake batch /// And there is a receipt for the batch with additional funds batched into it /// When funds are claimed /// Then the STAKE tokens should be credited to the account /// And the receipt NEAR balance should have been debited #[test] fn claim_receipt_funds_with_funds_in_stake_batch_and_with_receipt() { let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; // Given account has funds deposited into the current StakeBatch // And there are no receipts let mut account = contract.registered_account(test_context.account_id); let batch_id = contract.deposit_near_for_account_to_stake(&mut account, YOCTO.into()); contract.save_registered_account(&account); let mut account = contract.registered_account(test_context.account_id); // Given there is a receipt for the batch // And the receipt exists for the stake batch // And STAKE token value = 1 NEAR let stake_token_value = domain::StakeTokenValue::new(Default::default(), YOCTO.into(), YOCTO.into()); let receipt = domain::StakeBatchReceipt::new((2 * YOCTO).into(), stake_token_value); let batch_id = domain::BatchId(batch_id.into()); contract.stake_batch_receipts.insert(&batch_id, &receipt); // When batch receipts are claimed contract.claim_receipt_funds(&mut account); contract.save_registered_account(&account); // Assert let account = contract .lookup_account(test_context.account_id.try_into().unwrap()) .unwrap(); assert_eq!( account.stake.unwrap().amount.0 .0, YOCTO, "the funds should have been claimed by the account" ); assert!( account.stake_batch.is_none(), "stake batch should be set to None" ); let receipt = contract.stake_batch_receipts.get(&batch_id).unwrap(); assert_eq!( receipt.staked_near().value(), YOCTO, "claiming STAKE tokens should have reduced the near balance on the receipt" ); // Given account has funds deposited into the current StakeBatch let mut account = contract.registered_account(test_context.account_id); let batch_id = contract.deposit_near_for_account_to_stake(&mut account, YOCTO.into()); contract.save_registered_account(&account); // When batch receipts are claimed contract.claim_receipt_funds(&mut account); contract.save_registered_account(&account); // Assert let account = contract .lookup_account(test_context.account_id.try_into().unwrap()) .unwrap(); assert_eq!( account.stake.unwrap().amount.0 .0, 2 * YOCTO, "the funds should have been claimed by the account" ); assert!( account.stake_batch.is_none(), "stake batch should be set to None" ); let batch_id = domain::BatchId(batch_id.value()); let receipt = contract.stake_batch_receipts.get(&batch_id); assert!( receipt.is_none(), "when all STAKE tokens are claimed, then the receipt should have been deleted" ); } /// Given the account has funds in the stake batch /// And there is a receipt for the batch with exact matching funds /// When funds are claimed /// Then the STAKE tokens should be credited to the account /// And the receipt is deleted #[test] fn claim_receipt_funds_with_all_stake_batch_funds_claimed_on_receipt() { let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; // Given account has funds deposited into the current StakeBatch // And there are no receipts let mut account = contract.registered_account(test_context.account_id); let batch_id = contract.deposit_near_for_account_to_stake(&mut account, (2 * YOCTO).into()); contract.save_registered_account(&account); let mut account = contract.registered_account(test_context.account_id); // Given there is a receipt for the batch // And the receipt exists for the stake batch // And STAKE token value = 1 NEAR let stake_token_value = domain::StakeTokenValue::new(Default::default(), YOCTO.into(), YOCTO.into()); let receipt = domain::StakeBatchReceipt::new((2 * YOCTO).into(), stake_token_value); let batch_id = domain::BatchId(batch_id.into()); contract.stake_batch_receipts.insert(&batch_id, &receipt); // When batch receipts are claimed contract.claim_receipt_funds(&mut account); contract.save_registered_account(&account); // Assert let account = contract .lookup_account(test_context.account_id.try_into().unwrap()) .unwrap(); assert_eq!( account.stake.unwrap().amount.0 .0, 2 * YOCTO, "the funds should have been claimed by the account" ); assert!( account.stake_batch.is_none(), "stake batch should be set to None" ); let receipt = contract.stake_batch_receipts.get(&batch_id); assert!( receipt.is_none(), "when all STAKE tokens are claimed, then the receipt should have been deleted" ); } /// Given Account::stake_batch and Account::next_stake_batch both have funds /// And there are exact receipts for both batches /// Then STAKE tokens should be claimed for both /// And the receipts should be deleted #[test] fn claim_receipt_funds_with_stake_batch_and_next_stake_batch_funds_with_receipts() { let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; // Given account has funds deposited into the current StakeBatch // And there are no receipts let mut account = contract.registered_account(test_context.account_id); let stake_batch_id = domain::BatchId( contract .deposit_near_for_account_to_stake(&mut account, (2 * YOCTO).into()) .into(), ); assert_eq!( contract.stake_batch.unwrap().balance().amount(), (2 * YOCTO).into() ); // locking the contract should deposit the funds into the next stake batch contract.stake_batch_lock = Some(StakeLock::Staking); let next_stake_batch_id = contract.deposit_near_for_account_to_stake(&mut account, (3 * YOCTO).into()); assert_eq!( contract.next_stake_batch.unwrap().balance().amount(), (3 * YOCTO).into() ); contract.save_registered_account(&account); let account = contract .lookup_account(test_context.account_id.try_into().unwrap()) .unwrap(); assert_eq!( account.stake_batch.unwrap().balance.amount.value(), 2 * YOCTO ); assert_eq!( account.next_stake_batch.unwrap().balance.amount.value(), 3 * YOCTO ); contract.stake_batch_lock = None; // Given that the batches have receipts // And STAKE token value = 1 NEAR let stake_token_value = domain::StakeTokenValue::new(Default::default(), YOCTO.into(), YOCTO.into()); let receipt = domain::StakeBatchReceipt::new((2 * YOCTO).into(), stake_token_value); contract .stake_batch_receipts .insert(&domain::BatchId(stake_batch_id.into()), &receipt); let receipt = domain::StakeBatchReceipt::new((3 * YOCTO).into(), stake_token_value); contract .stake_batch_receipts .insert(&domain::BatchId(next_stake_batch_id.into()), &receipt); // When batch receipts are claimed let mut account = contract.registered_account(test_context.account_id); contract.claim_receipt_funds(&mut account); contract.save_registered_account(&account); // then receipts should be deleted because all funds have been claimed assert!(contract .stake_batch_receipts .get(&domain::BatchId(stake_batch_id.into())) .is_none()); let account = contract .lookup_account(test_context.account_id.try_into().unwrap()) .unwrap(); // and the account batches have been cleared assert!(account.stake_batch.is_none()); assert!(account.next_stake_batch.is_none()); // and the STAKE tokens were claimed and credited to the account assert_eq!(account.stake.unwrap().amount.0 .0, 5 * YOCTO); } /// Given there is no stake batch to run /// Then the call fails #[test] #[should_panic(expected = "ILLEGAL STATE : stake batch should exist")] fn stake_no_stake_batch() { let mut test_context = TestContext::with_registered_account(); test_context.contract.stake(); } /// Given the contract has a stake batch /// When the stake batch is run /// Then the contract is locked /// When the stake batch is run again while the contract is locked /// Then the func call panics #[test] #[should_panic(expected = "action is blocked because a batch is running")] fn stake_contract_when_stake_batch_in_progress() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; context.attached_deposit = YOCTO; testing_env!(context.clone()); contract.deposit(); context.account_balance += context.attached_deposit; context.attached_deposit = 0; testing_env!(context.clone()); contract.stake(); assert!(contract.stake_batch_locked()); testing_env!(context.clone()); // should panic because contract is locked contract.stake(); } #[test] fn deposit_and_stake_contract_when_stake_batch_in_progress() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; context.attached_deposit = YOCTO; testing_env!(context.clone()); if let PromiseOrValue::Promise(_) = contract.deposit_and_stake() { if let PromiseOrValue::Value(batch_id) = contract.deposit_and_stake() { assert_eq!(batch_id, contract.next_stake_batch.unwrap().id().into()); } else { panic!("expected staking batch to be in progress"); } } else { panic!("expected deposit to be staked"); } } /// Given the contract is running the redeem stake batch /// When the stake batch is run /// Then the func call panics #[test] #[should_panic(expected = "action is blocked because a batch is running")] fn stake_contract_when_redeem_stake_batch_in_progress_unstaking() { let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; contract.redeem_stake_batch_lock = Some(RedeemLock::Unstaking); contract.stake(); } #[test] fn deposit_and_stake_contract_when_redeem_stake_batch_in_progress_unstaking() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; contract.redeem_stake_batch_lock = Some(RedeemLock::Unstaking); context.attached_deposit = YOCTO; testing_env!(context.clone()); if let PromiseOrValue::Value(batch_id) = contract.deposit_and_stake() { assert_eq!(batch_id, contract.stake_batch.unwrap().id().into()); } else { panic!("expected staking batch to be in progress"); } } /// Given the contract is redeem status is pending withdrawal /// Then it is allowed to run stake batches #[test] fn stake_contract_when_redeem_status_pending_withdrawal() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; context.attached_deposit = YOCTO; testing_env!(context.clone()); contract.deposit(); contract.redeem_stake_batch_lock = Some(RedeemLock::PendingWithdrawal); contract.stake(); } #[test] fn deposit_and_stake_contract_when_redeem_status_pending_withdrawal() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; contract.redeem_stake_batch_lock = Some(RedeemLock::PendingWithdrawal); *contract.batch_id_sequence += 1; let redeem_stake_batch = domain::RedeemStakeBatch::new(contract.batch_id_sequence, YOCTO.into()); contract.redeem_stake_batch = Some(redeem_stake_batch); context.attached_deposit = YOCTO; testing_env!(context.clone()); contract.deposit_and_stake(); } /// Given the contract has just been deployed /// And the STAKE token value is retrieved within the same epoch /// Then the cached version should be returned #[test] fn stake_token_value_is_current() { let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; contract.total_stake.credit(YOCTO.into()); contract.stake_token_value = domain::StakeTokenValue::new(Default::default(), YOCTO.into(), YOCTO.into()); assert_eq!( contract.stake_token_value.total_stake_supply(), contract.total_stake.amount().into() ); assert_eq!( contract.stake_token_value.total_staked_near_balance(), YOCTO.into() ); } #[test] fn deposit_and_stake_success() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; context.attached_deposit = YOCTO; testing_env!(context.clone()); contract.deposit_and_stake(); assert!(contract.stake_batch_locked()); println!( "prepaid gas: {}, used_gas: {}, unused_gas: {}", context.prepaid_gas, env::used_gas(), context.prepaid_gas - env::used_gas() ); let receipts: Vec<Receipt> = deserialize_receipts(); assert_eq!(receipts.len(), 3); { let receipt = &receipts[0]; assert_eq!(receipt.actions.len(), 2); { let action = &receipt.actions[0]; match action { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "deposit_and_stake") } _ => panic!("expected `deposit_and_stake` func call on staking pool"), } } { let action = &receipt.actions[1]; match action { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "get_account") } _ => panic!("expected `get_account` func call on staking pool"), } } } { let receipt = &receipts[1]; let action = &receipt.actions[0]; match action { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "on_deposit_and_stake") } _ => panic!("expected `on_deposit_and_stake` func call on staking pool"), } } { let receipt = &receipts[2]; let action = &receipt.actions[0]; match action { Action::FunctionCall { method_name, .. } => { assert_eq!(method_name, "clear_stake_lock") } _ => panic!("expected `clear_stake_lock` callback"), } } } /// Given the funds were successfully deposited and staked into the staking pool /// Then the stake batch receipts is saved /// And the total STAKE supply is updated /// And if there are funds in the next stake batch, then move it into the current batch #[test] fn stake_workflow_success() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; { let staked_near_amount = 100 * YOCTO; context.attached_deposit = staked_near_amount; testing_env!(context.clone()); contract.deposit(); context.account_balance += context.attached_deposit; { context.attached_deposit = 0; testing_env!(context.clone()); // capture the batch ID to lookup the batch receipt after the workflow is done let batch_id = contract.stake_batch.unwrap().id(); contract.stake(); assert!(contract.stake_batch_locked()); { context.predecessor_account_id = context.current_account_id.clone(); testing_env!(context.clone()); let staking_pool_account = StakingPoolAccount { account_id: context.predecessor_account_id, unstaked_balance: YOCTO.into(), staked_balance: (99 * YOCTO).into(), can_withdraw: true, }; contract.on_run_stake_batch(staking_pool_account.clone()); // callback { context.predecessor_account_id = context.current_account_id.clone(); testing_env!(context.clone()); contract.on_deposit_and_stake(None, staking_pool_account); // callback contract.process_staked_batch(); let _receipt = contract.stake_batch_receipts.get(&batch_id).expect( "receipt should have been created by `on_deposit_and_stake` callback", ); assert_eq!( contract.total_stake.amount(), contract .stake_token_value .near_to_stake(staked_near_amount.into()) ); { context.predecessor_account_id = context.current_account_id.clone(); testing_env!(context.clone()); contract.clear_stake_lock(); assert!(!contract.stake_batch_locked()); } } } } } } /// Given a registered account has STAKE /// And there are no contract locks, i.e., no batches are being run /// When the account redeems STAKE /// Then the STAKE funds are moved from the the account's STAKE balance to the account's current redeem stake batch /// And the contract redeem stake batch is credited /// When the account redeems more STAKE /// And the batch has not yet run /// Then the STAKE will be added to the batch #[test] fn redeem_no_locks() { let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; assert!(contract.redeem_stake_batch.is_none()); assert!(contract.next_redeem_stake_batch.is_none()); // Given the account has STAKE let mut account = contract.registered_account(test_context.account_id); assert!(account.redeem_stake_batch.is_none()); assert!(account.next_redeem_stake_batch.is_none()); let initial_account_stake = (50 * YOCTO).into(); account.apply_stake_credit(initial_account_stake); contract.save_registered_account(&account); let redeem_amount = YoctoStake::from(10 * YOCTO); let batch_id = contract.redeem(redeem_amount.clone()); let batch = contract .redeem_stake_batch .expect("current stake batch should have funds"); assert_eq!(batch_id, batch.id().into()); assert_eq!(redeem_amount, batch.balance().amount().into()); let account = contract .lookup_account(ValidAccountId::try_from(test_context.account_id).unwrap()) .unwrap(); // assert STAKE was moved from account STAKE balance to redeem stake batch assert_eq!( account.stake.unwrap().amount, (initial_account_stake.value() - redeem_amount.value()).into() ); let redeem_stake_batch = account.redeem_stake_batch.unwrap(); assert_eq!(redeem_stake_batch.balance.amount, redeem_amount); assert_eq!(redeem_stake_batch.id, batch_id); let _batch_id_2 = contract.redeem(redeem_amount.clone()); let batch = contract .redeem_stake_batch .expect("current stake batch should have funds"); assert_eq!(batch_id, batch.id().into()); assert_eq!(redeem_amount.value() * 2, batch.balance().amount().value()); let account = contract .lookup_account(ValidAccountId::try_from(test_context.account_id).unwrap()) .unwrap(); // assert STAKE was moved from account STAKE balance to redeem stake batch assert_eq!( account.stake.unwrap().amount, (initial_account_stake.value() - (redeem_amount.value() * 2)).into() ); let redeem_stake_batch = account.redeem_stake_batch.unwrap(); assert_eq!( redeem_stake_batch.balance.amount, (redeem_amount.value() * 2).into() ); assert_eq!(redeem_stake_batch.id, batch_id); } /// Given a registered account has STAKE /// And there are no contract locks, i.e., no batches are being run /// When the account redeems STAKE /// Then the STAKE funds are moved from the the account's STAKE balance to the account's current redeem stake batch /// And the contract redeem stake batch is credited /// Given the contract is locked on the redeem stake batch for unstaking /// When the account redeems more STAKE /// Then the STAKE will be added to the next batch #[test] fn redeem_while_redeem_stake_batch_locked() { let mut test_context = TestContext::with_registered_account(); let contract = &mut test_context.contract; assert!(contract.redeem_stake_batch.is_none()); assert!(contract.next_redeem_stake_batch.is_none()); // Given the account has STAKE let mut account = contract.registered_account(test_context.account_id); assert!(account.redeem_stake_batch.is_none()); assert!(account.next_redeem_stake_batch.is_none()); let initial_account_stake = (50 * YOCTO).into(); account.apply_stake_credit(initial_account_stake); contract.save_registered_account(&account); let redeem_amount = YoctoStake::from(10 * YOCTO); let batch_id = contract.redeem(redeem_amount.clone()); let batch = contract .redeem_stake_batch .expect("current stake batch should have funds"); assert_eq!(batch_id, batch.id().into()); assert_eq!(redeem_amount, batch.balance().amount().into()); let account = contract .lookup_account(ValidAccountId::try_from(test_context.account_id).unwrap()) .unwrap(); // assert STAKE was moved from account STAKE balance to redeem stake batch assert_eq!( account.stake.unwrap().amount, (initial_account_stake.value() - redeem_amount.value()).into() ); let redeem_stake_batch = account.redeem_stake_batch.unwrap(); assert_eq!(redeem_stake_batch.balance.amount, redeem_amount); assert_eq!(redeem_stake_batch.id, batch_id); // Given the contract is locked for unstaking contract.redeem_stake_batch_lock = Some(RedeemLock::Unstaking); let batch_id_2 = contract.redeem(redeem_amount.clone()); let batch = contract .redeem_stake_batch .expect("current stake batch should have funds"); assert_eq!(redeem_amount.value(), batch.balance().amount().value()); let account = contract .lookup_account(ValidAccountId::try_from(test_context.account_id).unwrap()) .unwrap(); assert_eq!( account.stake.unwrap().amount, (initial_account_stake.value() - (redeem_amount.value() * 2)).into() ); let redeem_stake_batch = account.redeem_stake_batch.unwrap(); assert_eq!( redeem_stake_batch.balance.amount, (redeem_amount.value()).into() ); assert_eq!(redeem_stake_batch.id, batch_id); let next_redeem_stake_batch = account.next_redeem_stake_batch.unwrap(); assert_eq!( next_redeem_stake_batch.balance.amount, (redeem_amount.value()).into() ); assert_eq!(next_redeem_stake_batch.id, batch_id_2); } /// Given an account has unclaimed stake batch receipts /// When the account tries to redeem STAKE /// Then the stake batch receipts are first claimed before checking the account balance #[test] fn redeem_with_unclaimed_stake_batch_receipts() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; context.attached_deposit = 5 * YOCTO; testing_env!(context.clone()); contract.deposit(); // Given an account has unclaimed stake batch receipts let batch = contract.stake_batch.unwrap(); let receipt = domain::StakeBatchReceipt::new(batch.balance().amount(), contract.stake_token_value); contract.stake_batch_receipts.insert(&batch.id(), &receipt); // When the account tries to redeem STAKE testing_env!(context.clone()); contract.redeem((2 * YOCTO).into()); let account = contract.registered_account(test_context.account_id); assert_eq!(account.stake.unwrap().amount(), (3 * YOCTO).into()); assert_eq!( account.redeem_stake_batch.unwrap().balance().amount(), (2 * YOCTO).into() ); } /// Given an account has unclaimed stake batch receipts /// When the account tries to redeem STAKE /// Then the stake batch receipts are first claimed before checking the account balance #[test] fn redeem_all_with_unclaimed_stake_batch_receipts() { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; context.attached_deposit = 5 * YOCTO; testing_env!(context.clone()); contract.deposit(); // Given an account has unclaimed stake batch receipts let batch = contract.stake_batch.unwrap(); let receipt = domain::StakeBatchReceipt::new(batch.balance().amount(), contract.stake_token_value); contract.stake_batch_receipts.insert(&batch.id(), &receipt); // When the account tries to redeem STAKE testing_env!(context.clone()); contract.redeem_all(); let account = contract.registered_account(test_context.account_id); assert!(account.stake.is_none()); assert_eq!( account.redeem_stake_batch.unwrap().balance().amount(), batch.balance().amount().value().into() ); } /// Given a registered account has STAKE /// And there are no contract locks, i.e., no batches are being run /// When the account redeems all STAKE /// Then the STAKE funds are moved from the the account's STAKE balance to the account's current redeem stake batch /// And the contract redeem stake batch is credited #[test] fn redeem_all_with_redeem_lock_unstaking() { redeem_all_with_lock(RedeemLock::Unstaking); } #[test] fn redeem_all_with_redeem_lock_pending_withdrawal() { redeem_all_with_lock(RedeemLock::PendingWithdrawal); } fn redeem_all_with_lock(lock: RedeemLock) { let mut test_context = TestContext::with_registered_account(); let mut context = test_context.context.clone(); let contract = &mut test_context.contract; context.attached_deposit = YOCTO; context.account_balance = 100 * YOCTO; testing_env!(context.clone()); assert!(contract.redeem_stake_batch.is_none()); assert!(contract.next_redeem_stake_batch.is_none()); // Given the account has STAKE let mut account = contract.registered_account(test_context.account_id); assert!(account.redeem_stake_batch.is_none()); assert!(account.next_redeem_stake_batch.is_none()); let initial_account_stake = (50 * YOCTO).into(); account.apply_stake_credit(initial_account_stake); contract.save_registered_account(&account); let batch_id = contract.redeem_all().unwrap(); contract.redeem_stake_batch_lock = Some(lock); let batch = contract .redeem_stake_batch .expect("next stake batch should have funds"); assert_eq!(batch_id, batch.id().into()); assert_eq!( initial_account_stake.value(), batch.balance().amount().value() ); let account = contract .lookup_account(ValidAccountId::try_from(test_context.account_id).unwrap()) .unwrap(); // assert STAKE was moved from account STAKE balance to redeem stake batch assert!(account.stake.is_none()); let redeem_stake_batch = account .redeem_stake_batch .expect("redeemed STAKE should have been put into batch"); assert_eq!( redeem_stake_batch.balance.amount, initial_account_stake.into() ); assert_eq!(redeem_stake_batch.id, batch_id); } /// Given the contract is unlocked and has no batch runs in progress /// And there is a redeem stake batch /// When the redeem batch is run /// Then it creates the following receipts /// - func call to get account from staking pool /// - func call for callback to clear the release lock if the state is `Unstaking` #[test] fn unstake_no_locks() { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let context = test_ctx.context.clone(); *contract.batch_id_sequence += 1; contract.redeem_stake_batch = Some(RedeemStakeBatch::new( contract.batch_id_sequence, (10 * YOCTO).into(), )); contract.unstake(); assert!(contract.is_unstaking(),); let receipts = deserialize_receipts(); println!("receipt count = {}\n{:#?}", receipts.len(), receipts); assert_eq!(receipts.len(), 3); let receipts = receipts.as_slice(); { let receipt = receipts.first().unwrap(); assert_eq!(receipt.receiver_id, contract.staking_pool_id); let actions = receipt.actions.as_slice(); let func_call_action = actions.first().unwrap(); match func_call_action { Action::FunctionCall { method_name, args, .. } => { assert_eq!(method_name, "get_account"); let args: GetStakedAccountBalanceArgs = near_sdk::serde_json::from_str(args).unwrap(); assert_eq!(args.account_id, context.current_account_id); } _ => panic!("expected func call action"), } } { let receipt = &receipts[1]; assert_eq!(receipt.receiver_id, env::current_account_id()); let actions = receipt.actions.as_slice(); let func_call_action = actions.first().unwrap(); match func_call_action { Action::FunctionCall { method_name, args, .. } => { assert_eq!(method_name, "on_run_redeem_stake_batch"); assert!(args.is_empty()); } _ => panic!("expected func call action"), } } { let receipt = &receipts[2]; assert_eq!(receipt.receiver_id, env::current_account_id()); let actions = receipt.actions.as_slice(); let func_call_action = actions.first().unwrap(); match func_call_action { Action::FunctionCall { method_name, args, .. } => { assert_eq!(method_name, "clear_redeem_lock"); assert!(args.is_empty()); } _ => panic!("expected func call action"), } } } #[test] fn redeem_and_unstake_no_locks() { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let context = test_ctx.context.clone(); let mut account = contract.predecessor_registered_account(); account.stake = Some(TimestampedStakeBalance::new((100 * YOCTO).into())); contract.save_registered_account(&account); testing_env!(context.clone()); contract.redeem_and_unstake((10 * YOCTO).into()); assert!(contract.is_unstaking(),); let receipts = deserialize_receipts(); println!("receipt count = {}\n{:#?}", receipts.len(), receipts); assert_eq!(receipts.len(), 3); let receipts = receipts.as_slice(); { let receipt = receipts.first().unwrap(); assert_eq!(receipt.receiver_id, contract.staking_pool_id); let actions = receipt.actions.as_slice(); let func_call_action = actions.first().unwrap(); match func_call_action { Action::FunctionCall { method_name, args, .. } => { assert_eq!(method_name, "get_account"); let args: GetStakedAccountBalanceArgs = near_sdk::serde_json::from_str(args).unwrap(); assert_eq!(args.account_id, context.current_account_id); } _ => panic!("expected func call action"), } } { let receipt = &receipts[1]; assert_eq!(receipt.receiver_id, env::current_account_id()); let actions = receipt.actions.as_slice(); let func_call_action = actions.first().unwrap(); match func_call_action { Action::FunctionCall { method_name, args, .. } => { assert_eq!(method_name, "on_run_redeem_stake_batch"); assert!(args.is_empty()); } _ => panic!("expected func call action"), } } { let receipt = &receipts[2]; assert_eq!(receipt.receiver_id, env::current_account_id()); let actions = receipt.actions.as_slice(); let func_call_action = actions.first().unwrap(); match func_call_action { Action::FunctionCall { method_name, args, .. } => { assert_eq!(method_name, "clear_redeem_lock"); assert!(args.is_empty()); } _ => panic!("expected func call action"), } } } #[test] #[should_panic(expected = "action is blocked because a batch is running")] fn unstake_locked_for_staking() { // Arrange let mut context = TestContext::with_registered_account(); let contract = &mut context.contract; contract.stake_batch_lock = Some(StakeLock::Staking); // Act contract.unstake(); } #[test] fn redeem_and_unstake_locked_for_staking() { // Arrange let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; contract.stake_batch_lock = Some(StakeLock::Staking); let mut account = contract.predecessor_registered_account(); account.stake = Some(TimestampedStakeBalance::new((100 * YOCTO).into())); contract.save_registered_account(&account); if let PromiseOrValue::Value(batch_id) = contract.redeem_and_unstake((10 * YOCTO).into()) { assert_eq!(batch_id, contract.redeem_stake_batch.unwrap().id().into()); } else { panic!("expected batch ID to be returned because unstake workflow cannot be run if a batch is running"); } } #[test] #[should_panic(expected = "action is blocked because a batch is running")] fn unstake_locked_for_unstaking() { // Arrange let mut context = TestContext::with_registered_account(); let contract = &mut context.contract; contract.redeem_stake_batch_lock = Some(RedeemLock::Unstaking); // Act contract.unstake(); } #[test] fn redeem_and_unstake_locked_for_unstaking() { // Arrange let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; contract.redeem_stake_batch_lock = Some(RedeemLock::Unstaking); let mut account = contract.predecessor_registered_account(); account.stake = Some(TimestampedStakeBalance::new((100 * YOCTO).into())); contract.save_registered_account(&account); if let PromiseOrValue::Value(batch_id) = contract.redeem_and_unstake((10 * YOCTO).into()) { assert_eq!( batch_id, contract.next_redeem_stake_batch.unwrap().id().into() ); } else { panic!("expected batch ID to be returned because unstake workflow cannot be run if a batch is running"); } } #[test] #[should_panic(expected = "there is no redeem stake batch")] fn unstake_no_batch() { let mut contract = TestContext::with_registered_account().contract; contract.unstake(); } /// Given the contract is unlocked and has no batch runs in progress /// And there is a redeem stake batch /// When the redeem batch is run /// Then it creates the following receipts /// - func call to get account from staking pool /// - func call for callback to clear the release lock if the state is `Unstaking` #[test] fn unstake_pending_withdrawal() { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let mut context = test_ctx.context.clone(); *contract.batch_id_sequence += 1; contract.redeem_stake_batch = Some(RedeemStakeBatch::new( contract.batch_id_sequence, (10 * YOCTO).into(), )); contract.redeem_stake_batch_receipts.insert( &contract.batch_id_sequence, &domain::RedeemStakeBatchReceipt::new((10 * YOCTO).into(), contract.stake_token_value), ); contract.redeem_stake_batch_lock = Some(RedeemLock::PendingWithdrawal); context.epoch_height += UNSTAKED_NEAR_FUNDS_NUM_EPOCHS_TO_UNLOCK.value(); testing_env!(context.clone()); contract.unstake(); assert_eq!( contract.redeem_stake_batch_lock, Some(RedeemLock::PendingWithdrawal) ); let receipts = deserialize_receipts(); println!("receipt count = {}\n{:#?}", receipts.len(), receipts); assert_eq!(receipts.len(), 2); let receipts = receipts.as_slice(); { let receipt = receipts.first().unwrap(); assert_eq!(receipt.receiver_id, contract.staking_pool_id); let actions = receipt.actions.as_slice(); let func_call_action = actions.first().unwrap(); match func_call_action { Action::FunctionCall { method_name, args, .. } => { assert_eq!(method_name, "get_account"); assert_eq!(args, "{\"account_id\":\"stake.oysterpack.near\"}"); } _ => panic!("expected func call action"), } } { let receipt = &receipts[1]; assert_eq!(receipt.receiver_id, env::current_account_id()); let actions = receipt.actions.as_slice(); let func_call_action = actions.first().unwrap(); match func_call_action { Action::FunctionCall { method_name, args, .. } => { assert_eq!(method_name, "on_redeeming_stake_pending_withdrawal"); assert!(args.is_empty()); } _ => panic!("expected func call action"), } } } /// Given an account has redeemed STAKE /// And the batch has completed /// Then the account can claim the NEAR funds #[test] fn claim_receipt_funds_on_reddeem_stake_batch_receipt() { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let mut account = contract.predecessor_registered_account(); account.redeem_stake_batch = Some(domain::RedeemStakeBatch::new( contract.batch_id_sequence, (10 * YOCTO).into(), )); contract.redeem_stake_batch_receipts.insert( &contract.batch_id_sequence, &domain::RedeemStakeBatchReceipt::new((20 * YOCTO).into(), contract.stake_token_value), ); contract.claim_receipt_funds(&mut account); contract.save_registered_account(&account); let account = contract.predecessor_registered_account(); assert_eq!(account.near.unwrap().amount(), (10 * YOCTO).into()); assert!(account.redeem_stake_batch.is_none()); // Then there should be 10 STAKE left unclaimed on the receipt let receipt = contract .redeem_stake_batch_receipts .get(&contract.batch_id_sequence) .unwrap(); assert_eq!(receipt.redeemed_stake(), (10 * YOCTO).into()); } #[test] fn claim_redeem_stake_batch_receipts_for_current_and_next_batch() { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let mut account = contract.predecessor_registered_account(); account.redeem_stake_batch = Some(domain::RedeemStakeBatch::new( contract.batch_id_sequence, (10 * YOCTO).into(), )); *contract.batch_id_sequence += 1; account.next_redeem_stake_batch = Some(domain::RedeemStakeBatch::new( contract.batch_id_sequence, (15 * YOCTO).into(), )); contract.save_registered_account(&account); contract.redeem_stake_batch_receipts.insert( &(contract.batch_id_sequence.value() - 1).into(), &domain::RedeemStakeBatchReceipt::new((10 * YOCTO).into(), contract.stake_token_value), ); contract.redeem_stake_batch_receipts.insert( &contract.batch_id_sequence, &domain::RedeemStakeBatchReceipt::new((20 * YOCTO).into(), contract.stake_token_value), ); contract.claim_receipt_funds(&mut account); contract.save_registered_account(&account); let account = contract.predecessor_registered_account(); assert_eq!(account.near.unwrap().amount(), (25 * YOCTO).into()); assert!(account.redeem_stake_batch.is_none()); assert!(account.next_redeem_stake_batch.is_none()); assert!(contract .redeem_stake_batch_receipts .get(&(contract.batch_id_sequence.value() - 1).into()) .is_none()); assert_eq!( contract .redeem_stake_batch_receipts .get(&contract.batch_id_sequence) .unwrap() .redeemed_stake(), (5 * YOCTO).into() ); } /// Given an account has redeemed STAKE /// And the batch receipt is pending withdrawal /// And there is enough NEAR liquidity to fulfill the claim /// Then the account can claim the NEAR funds from the NEAR liquidity pool #[test] fn claim_redeem_stake_batch_receipts_for_current_batch_pending_withdrawal_with_full_near_liquidity_available( ) { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let mut account = contract.predecessor_registered_account(); account.redeem_stake_batch = Some(domain::RedeemStakeBatch::new( contract.batch_id_sequence, (10 * YOCTO).into(), )); contract.save_registered_account(&account); contract.redeem_stake_batch = Some(domain::RedeemStakeBatch::new( contract.batch_id_sequence, (20 * YOCTO).into(), )); contract.redeem_stake_batch_lock = Some(RedeemLock::PendingWithdrawal); contract.near_liquidity_pool = contract .stake_token_value .stake_to_near(account.redeem_stake_batch.unwrap().balance().amount()); contract.redeem_stake_batch_receipts.insert( &contract.batch_id_sequence, &domain::RedeemStakeBatchReceipt::new( contract.redeem_stake_batch.unwrap().balance().amount(), contract.stake_token_value, ), ); contract.claim_receipt_funds(&mut account); contract.save_registered_account(&account); let account = contract.predecessor_registered_account(); assert_eq!(account.near.unwrap().amount(), (10 * YOCTO).into()); assert!(account.redeem_stake_batch.is_none()); // Then there should be 10 STAKE left unclaimed on the receipt let receipt = contract .redeem_stake_batch_receipts .get(&contract.batch_id_sequence) .unwrap(); assert_eq!(receipt.redeemed_stake(), (10 * YOCTO).into()); assert_eq!(contract.near_liquidity_pool, 0.into()); assert_eq!(contract.total_near.amount(), (10 * YOCTO).into()); } /// Given an account has redeemed STAKE /// And the batch receipt is pending withdrawal /// And there is enough NEAR liquidity to fulfill the claim /// And the receipt is fully claimed /// Then the account can claim the NEAR funds from the NEAR liquidity pool /// And the RedeemLock is set to None /// And the receipt has been deleted #[test] fn claim_redeem_stake_batch_receipts_for_current_batch_pending_withdrawal_with_full_near_liquidity_available_and_receipt_fully_claimed( ) { // Arrange let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let mut account = contract.predecessor_registered_account(); account.redeem_stake_batch = Some(domain::RedeemStakeBatch::new( contract.batch_id_sequence, (10 * YOCTO).into(), )); contract.save_registered_account(&account); contract.redeem_stake_batch = Some(domain::RedeemStakeBatch::new( contract.batch_id_sequence, (10 * YOCTO).into(), )); contract.redeem_stake_batch_lock = Some(RedeemLock::PendingWithdrawal); contract.near_liquidity_pool = contract .stake_token_value .stake_to_near(account.redeem_stake_batch.unwrap().balance().amount()); contract.redeem_stake_batch_receipts.insert( &contract.batch_id_sequence, &domain::RedeemStakeBatchReceipt::new( contract.redeem_stake_batch.unwrap().balance().amount(), contract.stake_token_value, ), ); // Act contract.claim_receipts(); // Assert let account = contract.predecessor_registered_account(); assert_eq!(account.near.unwrap().amount(), (10 * YOCTO).into()); assert!(account.redeem_stake_batch.is_none()); // Then there should be 10 STAKE left unclaimed on the receipt assert!(contract .redeem_stake_batch_receipts .get(&contract.batch_id_sequence) .is_none()); assert!(contract.redeem_stake_batch_lock.is_none()); assert_eq!(contract.near_liquidity_pool, 0.into()); assert_eq!(contract.total_near.amount(), (10 * YOCTO).into()); } /// Given an account has redeemed STAKE into the current and next batches /// And there is a receipt for the current batch /// When the account claims funds, the current batch funds will be claimed /// And the next batch gets moved into the current batch slot #[test] fn claim_redeem_stake_batch_receipts_for_current_and_next_batch_with_receipt_for_current() { // Arrange let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; // account has redeemed 10 STAKE in current batch and 15 STAKE in next batch let mut account = contract.predecessor_registered_account(); account.redeem_stake_batch = Some(domain::RedeemStakeBatch::new( contract.batch_id_sequence, (10 * YOCTO).into(), )); //contract has receipt that matches exact value of account's batch amount contract.redeem_stake_batch_receipts.insert( &(contract.batch_id_sequence.value()).into(), &domain::RedeemStakeBatchReceipt::new( account.redeem_stake_batch.unwrap().balance().amount(), contract.stake_token_value, ), ); *contract.batch_id_sequence += 1; account.next_redeem_stake_batch = Some(domain::RedeemStakeBatch::new( contract.batch_id_sequence, (15 * YOCTO).into(), )); contract.save_registered_account(&account); // Act contract.claim_receipts(); // Assert let account = contract.predecessor_registered_account(); assert_eq!(account.near.unwrap().amount(), (10 * YOCTO).into()); assert!(account.next_redeem_stake_batch.is_none()); assert!(contract .redeem_stake_batch_receipts .get(&(contract.batch_id_sequence.value() - 1).into()) .is_none()); } /// Given an account has redeemed STAKE /// And the batch has completed /// And there is a current batch pending withdrawal /// Then the account can claim the NEAR funds #[test] fn claim_redeem_stake_batch_receipts_for_old_batch_receipt_while_pending_withdrawal_on_current_batch( ) { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let mut account = contract.predecessor_registered_account(); let batch_id = contract.batch_id_sequence; account.redeem_stake_batch = Some(domain::RedeemStakeBatch::new(batch_id, (10 * YOCTO).into())); account.next_redeem_stake_batch = Some(domain::RedeemStakeBatch::new( (batch_id.value() + 1).into(), (10 * YOCTO).into(), )); contract.save_registered_account(&account); *contract.batch_id_sequence += 10; contract.redeem_stake_batch = Some(domain::RedeemStakeBatch::new( contract.batch_id_sequence, (100 * YOCTO).into(), )); contract.redeem_stake_batch_receipts.insert( &batch_id, &domain::RedeemStakeBatchReceipt::new((20 * YOCTO).into(), contract.stake_token_value), ); contract.redeem_stake_batch_receipts.insert( &(batch_id.value() + 1).into(), &domain::RedeemStakeBatchReceipt::new((20 * YOCTO).into(), contract.stake_token_value), ); contract.claim_receipt_funds(&mut account); contract.save_registered_account(&account); let account = contract.predecessor_registered_account(); assert_eq!(account.near.unwrap().amount(), (20 * YOCTO).into()); assert!(account.redeem_stake_batch.is_none()); let receipt = contract.redeem_stake_batch_receipts.get(&batch_id).unwrap(); assert_eq!(receipt.redeemed_stake(), (10 * YOCTO).into()); } #[test] fn apply_unclaimed_receipts_to_account() { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let mut context = test_ctx.context.clone(); context.attached_deposit = 10 * YOCTO; testing_env!(context.clone()); contract.deposit(); let mut account = contract.predecessor_registered_account(); { let batch = contract.stake_batch.unwrap(); // create a stake batch receipt for the stake batch let receipt = domain::StakeBatchReceipt::new( batch.balance().amount(), contract.stake_token_value, ); contract.stake_batch_receipts.insert(&batch.id(), &receipt); *contract.batch_id_sequence += 1; let batch = domain::StakeBatch::new(contract.batch_id_sequence, (10 * YOCTO).into()); account.next_stake_batch = Some(batch); let receipt = domain::StakeBatchReceipt::new( batch.balance().amount(), contract.stake_token_value, ); contract .stake_batch_receipts .insert(&contract.batch_id_sequence, &receipt); contract.stake_batch = None; contract.next_stake_batch = None; } { // create a redeem stake batch receipt for 2 yoctoSTAKE *contract.batch_id_sequence += 1; let redeem_stake_batch = domain::RedeemStakeBatch::new(contract.batch_id_sequence, (2 * YOCTO).into()); contract.redeem_stake_batch_receipts.insert( &contract.batch_id_sequence, &domain::RedeemStakeBatchReceipt::new( redeem_stake_batch.balance().amount(), contract.stake_token_value, ), ); account.redeem_stake_batch = Some(redeem_stake_batch); *contract.batch_id_sequence += 1; let redeem_stake_batch = domain::RedeemStakeBatch::new(contract.batch_id_sequence, (2 * YOCTO).into()); contract.redeem_stake_batch_receipts.insert( &contract.batch_id_sequence, &domain::RedeemStakeBatchReceipt::new( redeem_stake_batch.balance().amount(), contract.stake_token_value, ), ); account.next_redeem_stake_batch = Some(redeem_stake_batch); } contract.save_registered_account(&account); context.is_view = true; testing_env!(context.clone()); let account = contract .lookup_account(to_valid_account_id(test_ctx.account_id)) .unwrap(); assert!(account.stake_batch.is_none()); assert!(account.redeem_stake_batch.is_none()); assert!(account.next_stake_batch.is_none()); assert!(account.next_redeem_stake_batch.is_none()); assert_eq!(account.stake.unwrap().amount, (2 * 10 * YOCTO).into()); assert_eq!(account.near.unwrap().amount, (2 * 2 * YOCTO).into()); } #[test] fn cancel_pending_redeem_stake_request_success() { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let mut account = contract.predecessor_registered_account(); account.apply_stake_credit((100 * YOCTO).into()); contract.save_registered_account(&account); contract.redeem((10 * YOCTO).into()); let account = contract.predecessor_registered_account(); assert_eq!(account.stake.unwrap().amount(), (90 * YOCTO).into()); assert!(account.redeem_stake_batch.is_some()); assert!(contract.redeem_stake_batch.is_some()); assert_eq!( contract.remove_all_from_redeem_stake_batch(), (10 * YOCTO).into() ); let account = contract.predecessor_registered_account(); assert_eq!(account.stake.unwrap().amount(), (100 * YOCTO).into()); assert!(account.redeem_stake_batch.is_none()); assert!(contract.redeem_stake_batch.is_none()); } #[test] fn cancel_pending_redeem_stake_request_success_with_funds_remaining_in_batch() { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let mut account = contract.predecessor_registered_account(); account.apply_stake_credit((100 * YOCTO).into()); contract.save_registered_account(&account); contract.redeem((10 * YOCTO).into()); { let mut batch = contract.redeem_stake_batch.unwrap(); batch.add(YOCTO.into()); contract.redeem_stake_batch = Some(batch); } let account = contract.predecessor_registered_account(); assert_eq!(account.stake.unwrap().amount(), (90 * YOCTO).into()); assert!(account.redeem_stake_batch.is_some()); assert!(contract.redeem_stake_batch.is_some()); assert_eq!( contract.remove_all_from_redeem_stake_batch(), (10 * YOCTO).into() ); let account = contract.predecessor_registered_account(); assert_eq!(account.stake.unwrap().amount(), (100 * YOCTO).into()); assert!(account.redeem_stake_batch.is_none()); assert_eq!( contract.redeem_stake_batch.unwrap().balance().amount(), YOCTO.into() ); } #[test] fn cancel_pending_redeem_stake_request_while_locked_success() { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let mut account = contract.predecessor_registered_account(); account.apply_stake_credit((100 * YOCTO).into()); contract.save_registered_account(&account); contract.redeem((10 * YOCTO).into()); contract.redeem_stake_batch_lock = Some(RedeemLock::PendingWithdrawal); contract.redeem((10 * YOCTO).into()); let account = contract.predecessor_registered_account(); assert_eq!(account.stake.unwrap().amount(), (80 * YOCTO).into()); assert!(account.next_redeem_stake_batch.is_some()); assert!(contract.next_redeem_stake_batch.is_some()); assert_eq!( contract.remove_all_from_redeem_stake_batch(), (10 * YOCTO).into() ); let account = contract.predecessor_registered_account(); assert_eq!(account.stake.unwrap().amount(), (90 * YOCTO).into()); assert!(account.next_redeem_stake_batch.is_none()); assert!(contract.next_redeem_stake_batch.is_none()); } #[test] fn cancel_pending_redeem_stake_request_while_locked_success_with_other_funds_in_batch() { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; let mut account = contract.predecessor_registered_account(); account.apply_stake_credit((100 * YOCTO).into()); contract.save_registered_account(&account); contract.redeem((10 * YOCTO).into()); contract.redeem_stake_batch_lock = Some(RedeemLock::PendingWithdrawal); contract.redeem((10 * YOCTO).into()); { let mut batch = contract.next_redeem_stake_batch.unwrap(); batch.add(YOCTO.into()); contract.next_redeem_stake_batch = Some(batch); } let account = contract.predecessor_registered_account(); assert_eq!(account.stake.unwrap().amount(), (80 * YOCTO).into()); assert!(account.next_redeem_stake_batch.is_some()); assert!(contract.next_redeem_stake_batch.is_some()); assert_eq!( contract.remove_all_from_redeem_stake_batch(), (10 * YOCTO).into() ); let account = contract.predecessor_registered_account(); assert_eq!(account.stake.unwrap().amount(), (90 * YOCTO).into()); assert!(account.next_redeem_stake_batch.is_none()); assert_eq!( contract.next_redeem_stake_batch.unwrap().balance().amount(), YOCTO.into() ); } #[test] fn cancel_pending_redeem_stake_request_no_batches_success() { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; assert_eq!(contract.remove_all_from_redeem_stake_batch(), 0.into()); } #[test] fn cancel_pending_redeem_stake_request_while_locked_no_next_batch_success() { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; contract.redeem_stake_batch_lock = Some(RedeemLock::Unstaking); assert_eq!(contract.remove_all_from_redeem_stake_batch(), 0.into()); } #[test] fn stake_batch_receipt_lookups() { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; assert!(contract .stake_batch_receipt(contract.batch_id_sequence.into()) .is_none()); *contract.batch_id_sequence += 1; contract.stake_batch_receipts.insert( &contract.batch_id_sequence, &domain::StakeBatchReceipt::new(YOCTO.into(), contract.stake_token_value), ); assert_eq!( contract .stake_batch_receipt(contract.batch_id_sequence.into()) .unwrap() .staked_near, YOCTO.into() ); } #[test] fn redeem_stake_batch_receipt_lookups() { let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; assert!(contract .redeem_stake_batch_receipt(contract.batch_id_sequence.into()) .is_none()); *contract.batch_id_sequence += 1; contract.redeem_stake_batch_receipts.insert( &contract.batch_id_sequence, &domain::RedeemStakeBatchReceipt::new(YOCTO.into(), contract.stake_token_value), ); assert_eq!( contract .redeem_stake_batch_receipt(contract.batch_id_sequence.into()) .unwrap() .redeemed_stake, YOCTO.into() ); } #[test] fn stake_token_value_compensation() { // StakeTokenValue { // total_staked_near_balance: 18503502971096472900569337, // total_stake_supply: 18004621608054163628202638, // stake_value: 1027708516952066370722278, // block_height: 30530205, // block_timestamp: 1609529212770398556, // epoch_height: 128, // } // StakeTokenValue { // total_staked_near_balance: 13364960386336141046957933, // total_stake_supply: 13004621608054163628202638, // stake_value: 1027708516952066370722277, // block_height: 30530458, // block_timestamp: 1609529367402036318, // epoch_height: 128, // }, let mut test_ctx = TestContext::with_registered_account(); let contract = &mut test_ctx.contract; contract.total_stake = TimestampedStakeBalance::new(18004621608054163628202638.into()); contract.stake_token_value = StakeTokenValue::new( BlockTimeHeight::from_env(), 18503502971096472900569337.into(), contract.total_stake.amount(), ); let old_stake_token_value = contract.stake_token_value; contract.total_stake = TimestampedStakeBalance::new(13004621608054163628202638.into()); contract.update_stake_token_value(13364960386336141046957933.into()); let new_stake_token_value = contract.stake_token_value; println!( "current_stake_token_value: {:?} {:?}", old_stake_token_value.total_staked_near_balance(), old_stake_token_value.total_stake_supply() ); println!( "new_stake_token_value: {:?} {:?}", new_stake_token_value.total_staked_near_balance(), new_stake_token_value.total_stake_supply() ); println!( "compensation = {}", new_stake_token_value.total_staked_near_balance().value() - 13364960386336141046957933 ); println!( "{}\n{}", old_stake_token_value.stake_to_near(YOCTO.into()), new_stake_token_value.stake_to_near(YOCTO.into()) ); assert_eq!( old_stake_token_value.stake_to_near(YOCTO.into()), new_stake_token_value.stake_to_near(YOCTO.into()) ); } } #[cfg(test)] pub mod test_domain { use super::*; #[derive(Serialize, Deserialize, Debug, Clone)] #[serde(crate = "near_sdk::serde")] pub struct OnDepositAndStakeArgs { pub near_liquidity: Option<YoctoNear>, } #[derive(Deserialize)] #[serde(crate = "near_sdk::serde")] #[allow(dead_code)] pub struct GetStakedAccountBalanceArgs { pub account_id: String, } }
#[macro_use] mod util; mod branch; mod detail; mod direction; mod dual; mod exp_log_sqrt; mod geometric_product; mod ideal_line; mod inner_product; mod join; mod line; mod matrices; mod meet; mod motor; mod plane; mod point; mod projection; mod rotor; mod translator; pub use branch::Branch; pub use direction::Direction; pub use dual::Dual; pub use exp_log_sqrt::{exp, log, sqrt}; pub use ideal_line::IdealLine; pub use line::Line; pub use matrices::{Mat3x4, Mat4x4}; pub use motor::Motor; pub use plane::Plane; pub use point::{origin, Element, Point}; pub use rotor::{EulerAngles, Rotor}; pub use translator::Translator; pub use util::{ApplyTo, ApplyToMany}; #[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } }
use nalgebra::{ allocator::Allocator, base::storage::{Owned, Storage}, convert, geometry::{Point3, Rotation3, UnitQuaternion}, DefaultAllocator, Dim, Matrix, Matrix3, RealField, SMatrix, Vector3, U1, U2, U3, U4, }; #[cfg(feature = "serde-serialize")] use serde::{Deserialize, Serialize}; use crate::{ coordinate_system::WorldFrame, intrinsics_perspective::{IntrinsicParametersPerspective, PerspectiveParams}, Bundle, Error, ExtrinsicParameters, IntrinsicParameters, Pixels, Points, RayBundle, }; /// A camera model that can convert world coordinates into pixel coordinates. /// /// # Examples /// /// Creates a new perspective camera: /// /// ``` /// use cam_geom::*; /// use nalgebra::*; /// /// // perepective parameters - focal length of 100, no skew, pixel center at (640,480) /// let intrinsics = IntrinsicParametersPerspective::from(PerspectiveParams { /// fx: 100.0, /// fy: 100.0, /// skew: 0.0, /// cx: 640.0, /// cy: 480.0, /// }); /// /// // Set extrinsic parameters - camera at (10,0,10), looing at (0,0,0), up (0,0,1) /// let camcenter = Vector3::new(10.0, 0.0, 10.0); /// let lookat = Vector3::new(0.0, 0.0, 0.0); /// let up = Unit::new_normalize(Vector3::new(0.0, 0.0, 1.0)); /// let pose = ExtrinsicParameters::from_view(&camcenter, &lookat, &up); /// /// // Create camera with both intrinsic and extrinsic parameters. /// let cam = Camera::new(intrinsics, pose); /// ``` /// /// Creates a new orthographic camera: /// /// ``` /// use cam_geom::*; /// use nalgebra::*; /// /// // orthographic parameters - scale of 100, pixel center at (640,480) /// let intrinsics = IntrinsicParametersOrthographic::from(OrthographicParams { /// sx: 100.0, /// sy: 100.0, /// cx: 640.0, /// cy: 480.0, /// }); /// /// // Set extrinsic parameters - camera at (10,0,10), looing at (0,0,0), up (0,0,1) /// let camcenter = Vector3::new(10.0, 0.0, 10.0); /// let lookat = Vector3::new(0.0, 0.0, 0.0); /// let up = Unit::new_normalize(Vector3::new(0.0, 0.0, 1.0)); /// let pose = ExtrinsicParameters::from_view(&camcenter, &lookat, &up); /// /// // Create camera with both intrinsic and extrinsic parameters. /// let cam = Camera::new(intrinsics, pose); /// ``` #[derive(Debug, Clone, PartialEq)] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] pub struct Camera<R, I> where I: IntrinsicParameters<R>, R: RealField, { intrinsics: I, extrinsics: ExtrinsicParameters<R>, } impl<R, I> Camera<R, I> where I: IntrinsicParameters<R>, R: RealField, { /// Create a new camera from intrinsic and extrinsic parameters. /// /// # Arguments /// Intrinsic parameters and extrinsic parameters #[inline] pub fn new(intrinsics: I, extrinsics: ExtrinsicParameters<R>) -> Self { Self { intrinsics, extrinsics, } } /// Return a reference to the extrinsic parameters. #[inline] pub fn extrinsics(&self) -> &ExtrinsicParameters<R> { &self.extrinsics } /// Return a reference to the intrinsic parameters. #[inline] pub fn intrinsics(&self) -> &I { &self.intrinsics } /// take 3D coordinates in world frame and convert to pixel coordinates pub fn world_to_pixel<NPTS, InStorage>( &self, world: &Points<WorldFrame, R, NPTS, InStorage>, ) -> Pixels<R, NPTS, Owned<R, NPTS, U2>> where NPTS: Dim, InStorage: Storage<R, NPTS, U3>, DefaultAllocator: Allocator<R, NPTS, U3>, DefaultAllocator: Allocator<R, NPTS, U2>, { let camera_frame = self.extrinsics.world_to_camera(world); self.intrinsics.camera_to_pixel(&camera_frame) } /// take pixel coordinates and project to 3D in world frame /// /// output arguments: /// `camera` - camera frame coordinate rays /// `world` - world frame coordinate rays /// /// Note that the camera frame coordinates are returned as they must /// be computed anyway, so this additional data is "free". pub fn pixel_to_world<IN, NPTS>( &self, pixels: &Pixels<R, NPTS, IN>, ) -> RayBundle<WorldFrame, I::BundleType, R, NPTS, Owned<R, NPTS, U3>> where I::BundleType: Bundle<R>, IN: Storage<R, NPTS, U2>, NPTS: Dim, I::BundleType: Bundle<R>, DefaultAllocator: Allocator<R, U1, U2>, DefaultAllocator: Allocator<R, NPTS, U2>, DefaultAllocator: Allocator<R, NPTS, U3>, { // get camera frame rays let camera = self.intrinsics.pixel_to_camera(pixels); // get world frame rays self.extrinsics.ray_camera_to_world(&camera) } } impl<R: RealField> Camera<R, IntrinsicParametersPerspective<R>> { /// Create a `Camera` from a 3x4 perspective projection matrix. pub fn from_perspective_matrix<S>(pmat: &Matrix<R, U3, U4, S>) -> Result<Self, Error> where S: Storage<R, U3, U4> + Clone, { let m = pmat.clone().remove_column(3); let (rquat, k) = rq_decomposition(m)?; let k22: R = k[(2, 2)].clone(); let one: R = convert(1.0); let k = k * (one / k22); // normalize let params = PerspectiveParams { fx: k[(0, 0)].clone(), fy: k[(1, 1)].clone(), skew: k[(0, 1)].clone(), cx: k[(0, 2)].clone(), cy: k[(1, 2)].clone(), }; let camcenter = pmat2cam_center(pmat); let extrinsics = ExtrinsicParameters::from_rotation_and_camcenter(rquat, camcenter); Ok(Self::new(params.into(), extrinsics)) } /// Create a 3x4 perspective projection matrix modeling this camera. pub fn as_camera_matrix(&self) -> SMatrix<R, 3, 4> { let m = { let p33 = self.intrinsics().as_intrinsics_matrix(); p33 * self.extrinsics().cache.qt.clone() }; // flip sign if focal length < 0 let m = if m[(0, 0)] < nalgebra::convert(0.0) { -m } else { m }; m.clone() / m[(2, 3)].clone() // normalize } } #[cfg(test)] pub fn roundtrip_camera<R, I>( cam: Camera<R, I>, width: usize, height: usize, step: usize, border: usize, eps: R, ) where R: RealField, I: IntrinsicParameters<R>, I::BundleType: Bundle<R>, { let pixels = crate::intrinsic_test_utils::generate_uv_raw(width, height, step, border); let world_coords = cam.pixel_to_world(&pixels); let world_coords_points = world_coords.point_on_ray(); // project back to pixel coordinates let pixel_actual = cam.world_to_pixel(&world_coords_points); approx::assert_abs_diff_eq!(pixels.data, pixel_actual.data, epsilon = convert(eps)); } #[allow(non_snake_case)] fn rq<R: RealField>(A: Matrix3<R>) -> (Matrix3<R>, Matrix3<R>) { let zero: R = convert(0.0); let one: R = convert(1.0); // see https://math.stackexchange.com/a/1640762 #[rustfmt::skip] let P = Matrix3::<R>::new( zero.clone(), zero.clone(), one.clone(), // row 1 zero.clone(), one.clone(), zero.clone(), // row 2 one, zero.clone(), zero, // row 3 ); let Atilde = P.clone() * A; let (Qtilde, Rtilde) = { let qrm = nalgebra::linalg::QR::new(Atilde.transpose()); (qrm.q(), qrm.r()) }; let Q = P.clone() * Qtilde.transpose(); let R = P.clone() * Rtilde.transpose() * P; (R, Q) } /// perform RQ decomposition and return results as right-handed quaternion and intrinsics matrix fn rq_decomposition<R: RealField>( orig: Matrix3<R>, ) -> Result<(UnitQuaternion<R>, Matrix3<R>), Error> { let (mut intrin, mut q) = rq(orig); let zero: R = convert(0.0); for i in 0..3 { if intrin[(i, i)] < zero { for j in 0..3 { intrin[(j, i)] = -intrin[(j, i)].clone(); q[(i, j)] = -q[(i, j)].clone(); } } } match right_handed_rotation_quat_new(&q) { Ok(rquat) => Ok((rquat, intrin)), Err(error) => { match error { Error::InvalidRotationMatrix => { // convert left-handed rotation to right-handed rotation let q = -q; let intrin = -intrin; let rquat = right_handed_rotation_quat_new(&q)?; Ok((rquat, intrin)) } e => Err(e), } } } } /// convert a 3x3 matrix into a valid right-handed rotation fn right_handed_rotation_quat_new<R: RealField>( orig: &Matrix3<R>, ) -> Result<UnitQuaternion<R>, Error> { let r1 = orig.clone(); let rotmat = Rotation3::from_matrix_unchecked(r1); let rquat = UnitQuaternion::from_rotation_matrix(&rotmat); if !is_right_handed_rotation_quat(&rquat) { return Err(Error::InvalidRotationMatrix); } Ok(rquat) } /// Check for valid right-handed rotation. /// /// Converts quaternion to rotation matrix and back again to quat then comparing /// quats. Probably there is a much faster and better way. pub(crate) fn is_right_handed_rotation_quat<R: RealField>(rquat: &UnitQuaternion<R>) -> bool { let rotmat2 = rquat.clone().to_rotation_matrix(); let rquat2 = UnitQuaternion::from_rotation_matrix(&rotmat2); let delta = rquat.rotation_to(&rquat2); let angle = my_quat_angle(&delta); let epsilon = R::default_epsilon() * convert(1e5); angle.abs() <= epsilon } /// get the camera center from a 3x4 camera projection matrix #[allow(clippy::many_single_char_names)] fn pmat2cam_center<R, S>(p: &Matrix<R, U3, U4, S>) -> Point3<R> where R: RealField, S: Storage<R, U3, U4> + Clone, { let x = p.clone().remove_column(0).determinant(); let y = -p.clone().remove_column(1).determinant(); let z = p.clone().remove_column(2).determinant(); let w = -p.clone().remove_column(3).determinant(); Point3::from(Vector3::new(x / w.clone(), y / w.clone(), z / w)) } // Calculate angle of quaternion /// /// This is the implementation from prior to /// https://github.com/rustsim/nalgebra/commit/74aefd9c23dadd12ee654c7d0206b0a96d22040c fn my_quat_angle<R: RealField>(quat: &nalgebra::UnitQuaternion<R>) -> R { let w = quat.quaternion().scalar().abs(); // Handle inaccuracies that make break `.acos`. if w >= R::one() { R::zero() } else { w.acos() * convert(2.0f64) } } #[cfg(test)] mod tests { #[test] #[cfg(feature = "serde-serialize")] fn test_serde() { use nalgebra::{Unit, Vector3}; use super::PerspectiveParams; use crate::{Camera, ExtrinsicParameters, IntrinsicParametersPerspective}; let params = PerspectiveParams { fx: 100.0, fy: 102.0, skew: 0.1, cx: 321.0, cy: 239.9, }; let intrinsics: IntrinsicParametersPerspective<_> = params.into(); let camcenter = Vector3::new(10.0, 0.0, 10.0); let lookat = Vector3::new(0.0, 0.0, 0.0); let up = Unit::new_normalize(Vector3::new(0.0, 0.0, 1.0)); let pose = ExtrinsicParameters::from_view(&camcenter, &lookat, &up); let expected = Camera::new(intrinsics, pose); let buf = serde_json::to_string(&expected).unwrap(); let actual: Camera<_, _> = serde_json::from_str(&buf).unwrap(); assert!(expected == actual); } }
/*! ![stability-experimental](https://img.shields.io/badge/stability-experimental-orange.svg) A crate to manipulate multiple sequences alignments in Rust. Instead of storing aligned sequences as multiple strings, `multi_seq_align` stores bases or residues in [`Alignment`] using a list of characters, like a matrix. This allows easy access to specific rows and columns of the alignment. # Usage ```rust # use multi_seq_align::Alignment; # use std::error::Error; # fn main() -> Result<(), Box<dyn Error>> { let mut kappa_casein_fragments_alignment = Alignment::with_sequences( &[ b"PAPISKWQSMP".to_vec(), b"HAQIPQRQYLP".to_vec(), b"PAQILQWQVLS".to_vec(), ], )?; // Let's extract a column of this alignment assert_eq!( kappa_casein_fragments_alignment.nth_position(6).unwrap(), [&b'W', &b'R', &b'W'] ); // But we also have the aligned sequence for the Platypus // Let's add it to the original alignment kappa_casein_fragments_alignment.add( b"EHQRP--YVLP".to_vec(), )?; // the new aligned sequence has a gap at the 6th position assert_eq!( kappa_casein_fragments_alignment.nth_position(6).unwrap(), [&b'W', &b'R', &b'W', &b'-'] ); // We can also loop over each position of the alignment for aas in kappa_casein_fragments_alignment.iter_positions() { println!("{:?}", aas); assert_eq!(aas.len(), 4); // 4 sequences } # Ok(()) # } ``` Here I instancied an alignment using `u8`, but `Alignment` works on generics like numbers, custom or third-party structs. # Features - Create [`Alignment`] from one or multiple aligned sequences at once (see [`add()`] and [`with_sequences()`]). - Extract columns of the alignment (see [`iter_positions()`] and [`iter_sequences(`]). This crate is currently in early stage development. I wouldn't recommend using it in production but I am interested in possible ideas to further the developemt of this project. Quite some work needs toi be done to improve the API and make it easy to use in other project. # Ideas - Computation of conservation scores - Identification of conserved sites - Computation of consensus sequence - Collapse / trim alignment - Serialisation / Deserialisation of alignment files - Extract sub-alignments - positions - motifs # Optimisation My goal is to reduce the footprint of this crate, there is ome work to do to achieve it. The code will eventually be optimised to be faster and to better use memory. [`Alignment`]: struct.Alignment.html [`iter_positions()`]: struct.Alignment.html#method.iter_positions [`iter_sequences(`]: struct.Alignment.html#method.iter_sequences [`add()`]: struct.Alignment.html#method.add [`with_sequences()`]: struct.Alignment.html#method.with_sequences */ #![warn(clippy::all, clippy::pedantic, clippy::nursery, clippy::cargo)] mod alignment; mod conservation; mod errors; mod iterators; mod utils; use displaydoc::Display; #[cfg(feature = "serde")] #[macro_use] extern crate serde; /// An alignment of DNA or amino acids sequences /// /// Aligned sequences should all have the same length. Each sequence is stored as one vector of `char`s. This allows an easy access to columns and rows of the alignment. #[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] // Use Rc to implement Copy #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct Alignment<T> { /// Sequences (as one) sequences: Vec<T>, /// The number of sequences in the alignment n_sequences: usize, /// The length of the alignment length: usize, } struct AlignmentPositionIterator<'a, T> { alignment: &'a Alignment<T>, index: usize, size_hint: usize, } struct AlignmentSequenceIterator<'a, T> { alignment: &'a Alignment<T>, index: usize, size_hint: usize, } #[derive(Display, Debug)] pub enum Mutation { /// * Conserved, /// : Conservative, /// . SemiConservative, /// NonConservative, } pub trait Conservation { fn positions_are_conserved(&self) -> Vec<Mutation>; }
// SPDX-License-Identifier: (MIT OR Apache-2.0) use std::cell::RefCell; #[cfg(feature = "nightly")] use std::fs::File; use std::io::{Read, Result, Seek, SeekFrom}; use std::rc::Rc; pub trait ISO9660Reader { /// Read the block(s) at a given LBA (logical block address) fn read_at(&mut self, buf: &mut [u8], lba: u64) -> Result<usize>; } #[cfg(not(feature = "nightly"))] impl<T: Read + Seek> ISO9660Reader for T { fn read_at(&mut self, buf: &mut [u8], lba: u64) -> Result<usize> { self.seek(SeekFrom::Start(lba * 2048))?; self.read(buf) } } #[cfg(feature = "nightly")] impl<T: Read + Seek> ISO9660Reader for T { default fn read_at(&mut self, buf: &mut [u8], lba: u64) -> Result<usize> { self.seek(SeekFrom::Start(lba * 2048))?; self.read(buf)? } } #[cfg(feature = "nightly")] impl ISO9660Reader for File { fn read_at(&mut self, buf: &mut [u8], lba: u64) -> Result<usize> { #[cfg(unix)] { use std::os::unix::fs::FileExt; FileExt::read_at(self, buf, lba * 2048)? } #[cfg(not(unix))] { use std::io::{Read, Seek, SeekFrom}; self.seek(SeekFrom::Start(lba * 2048))?; self.read(buf)? } } } // TODO: Figure out if sane API possible without Rc/RefCell pub(crate) struct FileRef<T: ISO9660Reader>(Rc<RefCell<T>>); impl<T: ISO9660Reader> Clone for FileRef<T> { fn clone(&self) -> FileRef<T> { FileRef(self.0.clone()) } } impl<T: ISO9660Reader> FileRef<T> { pub fn new(reader: T) -> FileRef<T> { FileRef(Rc::new(RefCell::new(reader))) } /// Read the block(s) at a given LBA (logical block address) pub fn read_at(&self, buf: &mut [u8], lba: u64) -> Result<usize> { (*self.0).borrow_mut().read_at(buf, lba) } }
#![feature(proc_macro_hygiene, decl_macro)] #![feature(plugin)] // #![feature(proc_macro_hygiene, decl_macro)] // #![plugin(rocket_codegen)] #[macro_use] extern crate rocket; extern crate rocket_contrib; extern crate rand; #[macro_use] extern crate serde_derive; use rand::Rng; use rocket::request::Form; use rocket_contrib::templates::Template; use rocket_contrib::json::Json; // use rocket_contrib::Json; // use serde_derive::Serialize; #[derive(Serialize)] struct PageContext { title: String, body: String, name: Option<String> } #[derive(FromForm)] struct NameForm { name: String, } const QUOTES: &[&'static str] = &[ "We're entering a new world in which data may be more important than software. -> Tim O'Rail", "Software comes from heaven when you have good hardware. -> Ken Olsen", "People who are really serious about software should make their own hardware -> Alan Kay", "Karma, memory, and desire are just the software of the soul. It's conditioning that the soul undergoes in order to create experience. And it's a cycle. In most people, the cycle is a conditioned response. They do the same things over and over again. -> Deepak Chopra", "If we want users to like our software, we should design it to behave like a likeable person -> Alan Cooper" ]; #[get("/")] fn index() -> String { "Yes, Rockeeet!".to_string() } #[get("/quote")] fn rand_quote() -> String { let quote = get_random_quote(); quote.to_string() } #[get("/page")] fn page() -> Template { let context = PageContext{ title: "Random Quote".to_string(), body: get_random_quote().to_string(), name: None, }; Template::render("index", &context) } #[post("/page", data = "<data>")] fn page_post(data: Form<NameForm>) -> Template { let form = data; let name = form.name.clone(); let context = PageContext{ title: "Random Quote".to_string(), body: get_random_quote().to_string(), name: Some(name), }; Template::render("index", &context) } #[derive(Serialize)] struct APIResponse { status: String, data: &'static[&'static str], } #[get("/quotes")] fn api_quotes() -> Json<APIResponse> { let response = APIResponse{ status: "ok".to_string(), data: QUOTES }; Json(response) } fn get_random_quote() -> &'static str { let mut rand_gen = rand::thread_rng(); let selected = rand_gen.gen_range(0, QUOTES.len()); QUOTES.get(selected).expect("No quote!") } fn main() { rocket::ignite() .mount("/", routes![index, rand_quote, page, page_post]) .mount("/api/v1", routes![api_quotes]) .attach(Template::fairing()) .launch(); }
use super::heredoc::HeredocMetadata; /// Tracks parser-specific metadata #[derive(Debug, Clone, Default)] pub struct Metadata<'a> { /// Provides a reference to the name of the file being parsed pub file: Option<&'a str>, /// Tracks the delimiter used when parsing a quoted string pub(crate) quote_delimiter: Option<char>, /// Tracks heredoc-specific lexer state pub(crate) heredoc: Option<Box<HeredocMetadata<'a>>>, /// Tracks parser stack depth pub(crate) stack_depth: usize, } #[cfg(test)] mod test { use super::*; #[test] fn test_metadata_size() { assert_eq!(40, std::mem::size_of::<Metadata>()); } }
use std::collections::BTreeMap; use serde::{ Serialize, Deserialize}; #[derive(Serialize, Debug, Deserialize)] pub struct SigmaRule { /// A brief title for the rule that should contain what the rules is supposed to detect (max. 256 characters) pub title: String, /// Sigma rules should be identified by a globally unique identifier in the id attribute. For this purpose random generated UUIDs (version 4) are recommended but not mandatory. An example for this is: /// ```yml /// title: Test rule /// id: 929a690e-bef0-4204-a928-ef5e620d6fcc /// ``` /// /// Rule identifiers can and should change for the following reasons: /// - Major changes in the rule. E.g. a different rule logic. /// - Derivation of a new rule from an existing or refinement of a rule in a way that both are kept active. /// - Merge of rules. /// /// To being able to keep track on relationships between detections, Sigma rules may also contain references to related rule identifiers in the related attribute. This allows to define common relationships between detections as follows: /// /// ```yml /// related: /// - id: 08fbc97d-0a2f-491c-ae21-8ffcfd3174e9 /// type: derived /// - id: 929a690e-bef0-4204-a928-ef5e620d6fcc /// type: obsoletes /// ``` ///Currently the following types are defined: /// - derived: Rule was derived from the referred rule or rules, which may remain active. /// - obsoletes: Rule obsoletes the referred rule or rules, which aren't used anymore. /// - merged: Rule was merged from the referred rules. The rules may be still existing and in use. /// - renamed: The rule had previously the referred identifier or identifiers but was renamed for any other reason, e.g. from a private naming scheme to UUIDs, to resolve collisions etc. It's not expected that a rule with this id exists anymore. /// #[serde(default = "default_id")] pub id: String, /// A short description of the rule and the malicious activity that can be detected (max. 65,535 characters) #[serde(default = "default_string")] pub description: String, /// References to the source that the rule was derived from. These could be blog articles, technical papers, presentations or even tweets. #[serde(default = "default_vector")] pub references: Vec<String>, /// Declares the status of the rule: /// - stable: the rule is considered as stable and may be used in production systems or dashboards. /// - test: an almost stable rule that possibly could require some fine tuning. /// - experimental: an experimental rule that could lead to false results or be noisy, but could also identify interesting events. #[serde(default = "default_status")] pub status: String, /// License of the rule according the SPDX ID specification: https://spdx.org/ids #[serde(default = "default_string")] pub license: String, /// Creator of the rule. #[serde(default = "default_author")] pub author: String, #[serde(default = "default_date")] pub date: String, ///This section describes the log data on which the detection is meant to be applied to. It describes the log source, the platform, the application and the type that is required in detection. /// ///It consists of three attributes that are evaluated automatically by the converters and an arbitrary number of optional elements. We recommend using a "definition" value in cases in which further explication is necessary. /// /// - category - examples: firewall, web, antivirus /// - product - examples: windows, apache, check point fw1 /// - service - examples: sshd, applocker /// ///The "category" value is used to select all log files written by a certain group of products, like firewalls or web server logs. The automatic conversion will use the keyword as a selector for multiple indices. /// ///The "product" value is used to select all log outputs of a certain product, e.g. all Windows Eventlog types including "Security", "System", "Application" and the new log types like "AppLocker" and "Windows Defender". /// ///Use the "service" value to select only a subset of a product's logs, like the "sshd" on Linux or the "Security" Eventlog on Windows systems. /// ///The "definition" can be used to describe the log source, including some information on the log verbosity level or configurations that have to be applied. It is not automatically evaluated by the converters but gives useful advice to readers on how to configure the source to provide the necessary events used in the detection. /// ///You can use the values of 'category, 'product' and 'service' to point the converters to a certain index. You could define in the configuration files that the category 'firewall' converts to ( index=fw1* OR index=asa* ) during Splunk search conversion or the product 'windows' converts to "_index":"logstash-windows*" in ElasticSearch queries. pub logsource: SigmaRuleLogSource, /// A set of search-identifiers that represent searches on log data pub detection: BTreeMap<String, SigmaRuleDetection>, /// A list of log fields that could be interesting in further analysis of the event and should be displayed to the analyst. #[serde(default = "default_vector")] pub fields: Vec<String>, #[serde(default = "default_vector")] pub falsepositives: Vec<String>, #[serde(default = "default_level")] pub level: String, #[serde(default = "default_vector")] pub tags: Vec<String>, #[serde(default = "default_string_tree")] pub parameters : BTreeMap<String,String> } impl SigmaRule { pub fn new(title : String,description : String, author : String, status : String) -> SigmaRule { let mut detection = BTreeMap::new(); detection.insert(String::from("condition"), SigmaRuleDetection::Condition(String::from(""))); return SigmaRule{ title, id : String::from(""), description, references : Vec::new(), license : String::new(), status, author, date : String::from(""), logsource : SigmaRuleLogSource { category : String::from(""), product : String::from(""), service : String::from(""), definition : String::from("") }, detection, fields : Vec::new(), falsepositives : Vec::new(), level : String::from(""), tags : Vec::new(), parameters : BTreeMap::new() } } } #[derive(Serialize, Debug, Deserialize)] pub struct SigmaRuleLogSource { #[serde(default = "default_string")] pub category: String, #[serde(default = "default_string")] pub product: String, #[serde(default = "default_string")] pub service: String, #[serde(default = "default_string")] pub definition: String, } fn default_string() -> String { return String::from("USIEM") } fn default_id() -> String { return uuid::Uuid::new_v4().to_string(); } fn default_vector() -> Vec<String> { return Vec::new() } fn default_string_tree() -> BTreeMap<String,String> { return BTreeMap::new() } fn default_level() -> String{ return String::from("info") } fn default_status() -> String{ return String::from("experimental") } fn default_author() -> String{ return String::from("usiem") } fn default_date() -> String { return chrono::Utc::now().to_rfc3339(); } #[derive(Serialize, Debug, Deserialize)] #[serde(untagged)] pub enum SigmaRuleDetection { /// The condition is the most complex part of the specification and will be subject to change over time and arising requirements. Condition(String), /// The lists contain strings that are applied to the full log message and are linked with a logical 'OR'. Keywords(Vec<String>), /// Maps (or dictionaries) consist of key/value pairs, in which the key is a field in the log data and the value a string or integer value. Lists of maps are joined with a logical 'OR'. All elements of a map are joined with a logical 'AND'. Selection(BTreeMap<String, SigmaValues>) } #[derive(Serialize, Debug, Deserialize)] #[serde(untagged)] pub enum SigmaValues { Text(Option<String>), Int(i32), Array(Vec<SigmaValues>), } #[cfg(test)] mod tests { use super::{SigmaRule, SigmaRuleDetection, SigmaValues}; use serde_json; use std::collections::BTreeMap; #[test] fn test_commander_listener(){ let mut rule = SigmaRule::new(String::from("Regla numero 1"), String::from("Regla de test"),String::from("Samuel"),String::from("testing")); rule.detection.insert("condition".to_owned(), SigmaRuleDetection::Condition(String::from("selection"))); let mut conditions1 = BTreeMap::new(); conditions1.insert("EventID".to_owned(), SigmaValues::Int(4656)); conditions1.insert("EventLog".to_owned(), SigmaValues::Text(Some("Security".to_owned()))); conditions1.insert("ProcessName".to_owned(), SigmaValues::Text(Some("C:\\Windows\\System32\\lsass.exe".to_owned()))); conditions1.insert("AccessMask".to_owned(), SigmaValues::Text(Some("0x705".to_owned()))); conditions1.insert("ObjectType".to_owned(), SigmaValues::Text(Some("SAM_DOMAIN".to_owned()))); rule.detection.insert("selection".to_owned(), SigmaRuleDetection::Selection(conditions1)); println!("{}",serde_json::to_string(&rule).expect("No serializa")); } #[test] fn sysmon_rule(){ let yml_rule = "title: Password Dumper Remote Thread in LSASS \n id: f239b326-2f41-4d6b-9dfa-c846a60ef505 \n description: Detects password dumper activity by monitoring remote thread creation EventID 8 in combination with the lsass.exe process as TargetImage. The process in field Process is the malicious program. A single execution can lead to hundreds of events. \n references: \n - https://jpcertcc.github.io/ToolAnalysisResultSheet/details/WCE.htm \n status: stable \n author: Thomas Patzke \n date: 2017/02/19 \n logsource: \n product: windows \n service: sysmon \n detection: \n selection: \n EventID: 8 \n TargetImage: 'C:\\Windows\\System32\\lsass.exe' \n StartModule: '' \n condition: selection \n tags: \n - attack.credential_access \n - attack.t1003 # an old one \n - attack.s0005 \n - attack.t1003.001 \n falsepositives: \n - unknown \n level: high"; let sigma_rule : SigmaRule = serde_yaml::from_str(yml_rule).expect("Cannot read"); let _rule = serde_json::to_string(&sigma_rule).expect("serializing problem"); } #[test] fn complex_sysmon_rule(){ let yml_rule = "title: Executable in ADS\n id: b69888d4-380c-45ce-9cf9-d9ce46e67821\n status: experimental\n description: Detects the creation of an ADS data stream that contains an executable (non-empty imphash)\n references:\n - https://twitter.com/0xrawsec/status/1002478725605273600?s=21\n tags:\n - attack.defense_evasion\n - attack.t1027 # an old one\n - attack.s0139\n - attack.t1564.004\n author: Florian Roth, @0xrawsec\n date: 2018/06/03\n modified: 2020/08/26\n logsource:\n product: windows\n service: sysmon\n definition: 'Requirements: Sysmon config with Imphash logging activated'\n detection:\n selection:\n EventID: 15\n filter1:\n Imphash: '00000000000000000000000000000000'\n filter2:\n Imphash: null\n condition: selection and not 1 of filter*\n fields:\n - TargetFilename\n - Image\n falsepositives:\n - unknown\n level: critical\n"; let sigma_rule : SigmaRule = serde_yaml::from_str(yml_rule).expect("Cannot read"); let _rule = serde_json::to_string(&sigma_rule).expect("serializing problem"); } }
//计划用rust实现我大一C语言作业... fn main(){ let a = leijia(100); let b = add(20,10); let c = jiecheng(5); let d = fandu(312); let e = gongyueshu(15,7); let f = gongbeishu(11,4); let g = weishu(-123456789); let h = max(10,20); let i = min(10,20); let j = cifang(2,10); let k = is_sushu(11); let l = is_pingfangshu(25); let m = is_tonggoushu(25); let n = is_wanshu(6); println!("{}",a); println!("{}",b); println!("{}",c); println!("{}",d); println!("{}",e); println!("{}",f); println!("{}",g); println!("{}",h); println!("{}",i); println!("{}",j); println!("{}",k); println!("{}",l); println!("{}",m); println!("{}",n); } //此函数用来返回a和b的合 fn add(a:i32, b:i32) -> i32 { a + b } //此函数用来返回1+2+3+…+n,若n<=0,函数用来返回0。 fn leijia(mut a:i32) -> i32 { let mut answer=0; while a>0 { answer = answer + a; a = a - 1; } answer } //此函数用来返回n!,若n<=0,函数用来返回0。 //u64可以算到20! fn jiecheng(n:i32) -> u64 { let mut answer:u64 = 1; if n <= 0 { return 0u64; }else{ for i in 1..n+1 { answer = answer * i as u64; } } answer } //此函数用来返回n的反读数 fn fandu(mut n:i32) -> i32 { let mut answer = 0; while n > 0{ answer = answer * 10 + n%10; n = n/10; } answer } //此函数用来计算两个数的最大公约数 //如果两个数小于1或者没有最大公约数(即公约数为1)则返回0 //暴力法 fn gongyueshu(a:i32, b:i32) -> i32 { let mut answer = if a > b { b }else{ a }; if a <= 1 && b <= 1 { return 0; }else{ while answer > 1{ if a%answer == 0 && b%answer == 0{ return answer; } answer = answer - 1; } } 0 } //此函数用来求两个数的最小公倍数 //暴力法 fn gongbeishu(a:i32, b:i32) -> i32 { let mut answer = if a > b { a }else{ b }; if a <= 0 && b <= 0 { return 0; }else{ while answer < a*b{ if answer%a == 0 && answer%b == 0{ return answer; } answer = answer + 1; } } a*b } //此函数返回一个数的位数 fn weishu(mut n:i32) -> i32 { let mut answer = 0; while n != 0{ answer = answer + 1; n = n/10; } answer } //此函数用来返回两个数中最大的数 fn max(a:i32, b:i32) -> i32 { if a > b { a }else{ b } } //此函数用来返回两个数中最小的数 fn min(a:i32, b:i32) -> i32 { if a > b { b }else{ a } } //此函数用来返回x的N次方 fn cifang(x:i32, mut n:i32) -> i32 { let mut answer = 1; while n!=0{ answer = answer * x; n = n - 1; } answer } //此函数用来判断n是否素数 //若n是素数,则函数返回true,若n不是素数,则函数返回false。 fn is_sushu(n:i32) -> bool { for i in 2..n { if n%i == 0 { return false; } } true } //此函数用来判断n是否平方数 //若n是平方数,则函数返回true,若n不是平方数,则函数返回false。 //一个正整数是另外一个正整数的平方,这个数就称为“平方数” //例如,25=5^2,25就是平方数。(1不是平方数) fn is_pingfangshu(n:i32) -> bool { if n <= 1 { return false; }else{ for i in 1..n { if i*i == n { return true; } } } false } //此函数用来判断n是否同构数 //若n是同构数,则函数返回true,若n不是同构数,则函数返回false。 //所谓“同构数”是指这样一个数,它出现在它的平方数的右侧 //例如5的平方是25,25的平方是625,故5和25都是同构数。1不是同构数 fn is_tonggoushu(n:i32) -> bool { let mut temp_n = n; if n <= 1 { return false; } let mut pow = 1; //存储10的n的位数次方 while temp_n != 0 { temp_n = temp_n / 10; pow = pow * 10; } if n == n*n%pow { true }else{ false } } //此函数用来判断n是否完数 //若n是完数,则函数返回true,若n不是完数,则函数返回false。 //一个数如果恰好等于它的所有真因子之和,这个数就称为“完数”。 //例如,6的真因子为1,2,3,而6=1+2+3,因此,6是“完数” fn is_wanshu(n:i32) -> bool { let mut sum = 0; for i in 1..n { if n%i == 0 { sum = sum + i; } } if sum == n { true }else{ false } }
//! Utilities for binary serialization/deserialization. //! //! The [`BeSer`] trait allows us to define data structures //! that can match data structures that are sent over the wire //! in big-endian form with no packing. //! //! The [`LeSer`] trait does the same thing, in little-endian form. //! //! Note: you will get a compile error if you try to `use` both traits //! in the same module or scope. This is intended to be a safety //! mechanism: mixing big-endian and little-endian encoding in the same file //! is error-prone. #![warn(missing_docs)] use bincode::Options; use serde::{de::DeserializeOwned, Serialize}; use std::io::{self, Read, Write}; use thiserror::Error; /// An error that occurred during a deserialize operation /// /// This could happen because the input data was too short, /// or because an invalid value was encountered. #[derive(Debug, Error)] pub enum DeserializeError { /// The deserializer isn't able to deserialize the supplied data. #[error("deserialize error")] BadInput, /// While deserializing from a `Read` source, an `io::Error` occurred. #[error("deserialize error: {0}")] Io(io::Error), } impl From<bincode::Error> for DeserializeError { fn from(e: bincode::Error) -> Self { match *e { bincode::ErrorKind::Io(io_err) => DeserializeError::Io(io_err), _ => DeserializeError::BadInput, } } } /// An error that occurred during a serialize operation /// /// This probably means our [`Write`] failed, e.g. we tried /// to write beyond the end of a buffer. #[derive(Debug, Error)] pub enum SerializeError { /// The serializer isn't able to serialize the supplied data. #[error("serialize error")] BadInput, /// While serializing into a `Write` sink, an `io::Error` occurred. #[error("serialize error: {0}")] Io(io::Error), } impl From<bincode::Error> for SerializeError { fn from(e: bincode::Error) -> Self { match *e { bincode::ErrorKind::Io(io_err) => SerializeError::Io(io_err), _ => SerializeError::BadInput, } } } /// A shortcut that configures big-endian binary serialization /// /// Properties: /// - Big endian /// - Fixed integer encoding (i.e. 1u32 is 00000001 not 01) /// /// Does not allow trailing bytes in deserialization. If this is desired, you /// may set [`Options::allow_trailing_bytes`] to explicitly accomodate this. pub fn be_coder() -> impl Options { bincode::DefaultOptions::new() .with_big_endian() .with_fixint_encoding() } /// A shortcut that configures little-ending binary serialization /// /// Properties: /// - Little endian /// - Fixed integer encoding (i.e. 1u32 is 00000001 not 01) /// /// Does not allow trailing bytes in deserialization. If this is desired, you /// may set [`Options::allow_trailing_bytes`] to explicitly accomodate this. pub fn le_coder() -> impl Options { bincode::DefaultOptions::new() .with_little_endian() .with_fixint_encoding() } /// Binary serialize/deserialize helper functions (Big Endian) /// pub trait BeSer { /// Serialize into a byte slice fn ser_into_slice(&self, mut b: &mut [u8]) -> Result<(), SerializeError> where Self: Serialize, { // &mut [u8] implements Write, but `ser_into` needs a mutable // reference to that. So we need the slightly awkward "mutable // reference to a mutable reference. self.ser_into(&mut b) } /// Serialize into a borrowed writer /// /// This is useful for most `Write` types except `&mut [u8]`, which /// can more easily use [`ser_into_slice`](Self::ser_into_slice). fn ser_into<W: Write>(&self, w: &mut W) -> Result<(), SerializeError> where Self: Serialize, { be_coder().serialize_into(w, &self).map_err(|e| e.into()) } /// Serialize into a new heap-allocated buffer fn ser(&self) -> Result<Vec<u8>, SerializeError> where Self: Serialize, { be_coder().serialize(&self).map_err(|e| e.into()) } /// Deserialize from the full contents of a byte slice /// /// See also: [`BeSer::des_prefix`] fn des(buf: &[u8]) -> Result<Self, DeserializeError> where Self: DeserializeOwned, { be_coder() .deserialize(buf) .or(Err(DeserializeError::BadInput)) } /// Deserialize from a prefix of the byte slice /// /// Uses as much of the byte slice as is necessary to deserialize the /// type, but does not guarantee that the entire slice is used. /// /// See also: [`BeSer::des`] fn des_prefix(buf: &[u8]) -> Result<Self, DeserializeError> where Self: DeserializeOwned, { be_coder() .allow_trailing_bytes() .deserialize(buf) .or(Err(DeserializeError::BadInput)) } /// Deserialize from a reader fn des_from<R: Read>(r: &mut R) -> Result<Self, DeserializeError> where Self: DeserializeOwned, { be_coder().deserialize_from(r).map_err(|e| e.into()) } /// Compute the serialized size of a data structure /// /// Note: it may be faster to serialize to a buffer and then measure the /// buffer length, than to call `serialized_size` and then `ser_into`. fn serialized_size(&self) -> Result<u64, SerializeError> where Self: Serialize, { be_coder().serialized_size(self).map_err(|e| e.into()) } } /// Binary serialize/deserialize helper functions (Little Endian) /// pub trait LeSer { /// Serialize into a byte slice fn ser_into_slice(&self, mut b: &mut [u8]) -> Result<(), SerializeError> where Self: Serialize, { // &mut [u8] implements Write, but `ser_into` needs a mutable // reference to that. So we need the slightly awkward "mutable // reference to a mutable reference. self.ser_into(&mut b) } /// Serialize into a borrowed writer /// /// This is useful for most `Write` types except `&mut [u8]`, which /// can more easily use [`ser_into_slice`](Self::ser_into_slice). fn ser_into<W: Write>(&self, w: &mut W) -> Result<(), SerializeError> where Self: Serialize, { le_coder().serialize_into(w, &self).map_err(|e| e.into()) } /// Serialize into a new heap-allocated buffer fn ser(&self) -> Result<Vec<u8>, SerializeError> where Self: Serialize, { le_coder().serialize(&self).map_err(|e| e.into()) } /// Deserialize from the full contents of a byte slice /// /// See also: [`LeSer::des_prefix`] fn des(buf: &[u8]) -> Result<Self, DeserializeError> where Self: DeserializeOwned, { le_coder() .deserialize(buf) .or(Err(DeserializeError::BadInput)) } /// Deserialize from a prefix of the byte slice /// /// Uses as much of the byte slice as is necessary to deserialize the /// type, but does not guarantee that the entire slice is used. /// /// See also: [`LeSer::des`] fn des_prefix(buf: &[u8]) -> Result<Self, DeserializeError> where Self: DeserializeOwned, { le_coder() .allow_trailing_bytes() .deserialize(buf) .or(Err(DeserializeError::BadInput)) } /// Deserialize from a reader fn des_from<R: Read>(r: &mut R) -> Result<Self, DeserializeError> where Self: DeserializeOwned, { le_coder().deserialize_from(r).map_err(|e| e.into()) } /// Compute the serialized size of a data structure /// /// Note: it may be faster to serialize to a buffer and then measure the /// buffer length, than to call `serialized_size` and then `ser_into`. fn serialized_size(&self) -> Result<u64, SerializeError> where Self: Serialize, { le_coder().serialized_size(self).map_err(|e| e.into()) } } // Because usage of `BeSer` or `LeSer` can be done with *either* a Serialize or // DeserializeOwned implementation, the blanket implementation has to be for every type. impl<T> BeSer for T {} impl<T> LeSer for T {} #[cfg(test)] mod tests { use super::DeserializeError; use serde::{Deserialize, Serialize}; use std::io::Cursor; #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct ShortStruct { a: u8, b: u32, } const SHORT1: ShortStruct = ShortStruct { a: 7, b: 65536 }; const SHORT1_ENC_BE: &[u8] = &[7, 0, 1, 0, 0]; const SHORT1_ENC_BE_TRAILING: &[u8] = &[7, 0, 1, 0, 0, 255, 255, 255]; const SHORT1_ENC_LE: &[u8] = &[7, 0, 0, 1, 0]; const SHORT1_ENC_LE_TRAILING: &[u8] = &[7, 0, 0, 1, 0, 255, 255, 255]; const SHORT2: ShortStruct = ShortStruct { a: 8, b: 0x07030000, }; const SHORT2_ENC_BE: &[u8] = &[8, 7, 3, 0, 0]; const SHORT2_ENC_BE_TRAILING: &[u8] = &[8, 7, 3, 0, 0, 0xff, 0xff, 0xff]; const SHORT2_ENC_LE: &[u8] = &[8, 0, 0, 3, 7]; const SHORT2_ENC_LE_TRAILING: &[u8] = &[8, 0, 0, 3, 7, 0xff, 0xff, 0xff]; #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct LongMsg { pub tag: u8, pub blockpos: u32, pub last_flush_position: u64, pub apply: u64, pub timestamp: i64, pub reply_requested: u8, } const LONG1: LongMsg = LongMsg { tag: 42, blockpos: 0x1000_2000, last_flush_position: 0x1234_2345_3456_4567, apply: 0x9876_5432_10FE_DCBA, timestamp: 0x7788_99AA_BBCC_DDFF, reply_requested: 1, }; #[test] fn be_short() { use super::BeSer; assert_eq!(SHORT1.serialized_size().unwrap(), 5); let encoded = SHORT1.ser().unwrap(); assert_eq!(encoded, SHORT1_ENC_BE); let decoded = ShortStruct::des(SHORT2_ENC_BE).unwrap(); assert_eq!(decoded, SHORT2); // with trailing data let decoded = ShortStruct::des_prefix(SHORT2_ENC_BE_TRAILING).unwrap(); assert_eq!(decoded, SHORT2); let err = ShortStruct::des(SHORT2_ENC_BE_TRAILING).unwrap_err(); assert!(matches!(err, DeserializeError::BadInput)); // serialize into a `Write` sink. let mut buf = Cursor::new(vec![0xFF; 8]); SHORT1.ser_into(&mut buf).unwrap(); assert_eq!(buf.into_inner(), SHORT1_ENC_BE_TRAILING); // deserialize from a `Write` sink. let mut buf = Cursor::new(SHORT2_ENC_BE); let decoded = ShortStruct::des_from(&mut buf).unwrap(); assert_eq!(decoded, SHORT2); // deserialize from a `Write` sink that terminates early. let mut buf = Cursor::new([0u8; 4]); let err = ShortStruct::des_from(&mut buf).unwrap_err(); assert!(matches!(err, DeserializeError::Io(_))); } #[test] fn le_short() { use super::LeSer; assert_eq!(SHORT1.serialized_size().unwrap(), 5); let encoded = SHORT1.ser().unwrap(); assert_eq!(encoded, SHORT1_ENC_LE); let decoded = ShortStruct::des(SHORT2_ENC_LE).unwrap(); assert_eq!(decoded, SHORT2); // with trailing data let decoded = ShortStruct::des_prefix(SHORT2_ENC_LE_TRAILING).unwrap(); assert_eq!(decoded, SHORT2); let err = ShortStruct::des(SHORT2_ENC_LE_TRAILING).unwrap_err(); assert!(matches!(err, DeserializeError::BadInput)); // serialize into a `Write` sink. let mut buf = Cursor::new(vec![0xFF; 8]); SHORT1.ser_into(&mut buf).unwrap(); assert_eq!(buf.into_inner(), SHORT1_ENC_LE_TRAILING); // deserialize from a `Write` sink. let mut buf = Cursor::new(SHORT2_ENC_LE); let decoded = ShortStruct::des_from(&mut buf).unwrap(); assert_eq!(decoded, SHORT2); // deserialize from a `Write` sink that terminates early. let mut buf = Cursor::new([0u8; 4]); let err = ShortStruct::des_from(&mut buf).unwrap_err(); assert!(matches!(err, DeserializeError::Io(_))); } #[test] fn be_long() { use super::BeSer; assert_eq!(LONG1.serialized_size().unwrap(), 30); let msg = LONG1; let encoded = msg.ser().unwrap(); let expected = hex_literal::hex!( "2A 1000 2000 1234 2345 3456 4567 9876 5432 10FE DCBA 7788 99AA BBCC DDFF 01" ); assert_eq!(encoded, expected); let msg2 = LongMsg::des(&encoded).unwrap(); assert_eq!(msg, msg2); } #[test] fn le_long() { use super::LeSer; assert_eq!(LONG1.serialized_size().unwrap(), 30); let msg = LONG1; let encoded = msg.ser().unwrap(); let expected = hex_literal::hex!( "2A 0020 0010 6745 5634 4523 3412 BADC FE10 3254 7698 FFDD CCBB AA99 8877 01" ); assert_eq!(encoded, expected); let msg2 = LongMsg::des(&encoded).unwrap(); assert_eq!(msg, msg2); } }
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 s = scan!(String); let s: Vec<char> = s.chars().collect(); let k = scan!(usize); let mut ans = 0; let mut dot = 0; let mut j = 0; for (i, &ch) in s.iter().enumerate() { if ch == '.' { dot += 1; } while j < i && dot > k { if s[j] == '.' { dot -= 1; } j += 1; } // eprintln!("{} {} {}", j, i, dot); if dot <= k { ans = ans.max(i - j + 1); } } println!("{}", ans); }
use std::{collections::HashMap, ffi::OsString, path::PathBuf}; #[derive(Debug)] pub struct Config { pub root: PathBuf, pub hostname: String, pub mappings: HashMap<OsString, String>, pub log: bool, }
use crate::utils::*; pub(crate) const NAME: &[&str] = &["futures::AsyncSeek"]; pub(crate) fn derive(data: &Data, items: &mut Vec<ItemImpl>) -> Result<()> { let io = quote!(::futures::io); derive_trait!( data, parse_quote!(#io::AsyncSeek)?, parse_quote! { trait AsyncSeek { #[inline] fn poll_seek( self: ::core::pin::Pin<&mut Self>, cx: &mut ::core::task::Context<'_>, pos: ::std::io::SeekFrom, ) -> ::core::task::Poll<::std::io::Result<u64>>; } }?, ) .map(|item| items.push(item)) }
use crate::lexer::SyntaxToken; use crate::syntax_kinds::SyntaxKind; pub fn convert_to_c(tokens: Vec<SyntaxToken>) -> String { let mut line: i32 = 0; let mut content = String::from("#include <stdio.h>\n#include <conio.h>\n#include <stdlib.h>\n\nint main()\n{\n "); for token in tokens { //println!("position: {} line: {} text: {}", token.position, token.line, token.text); if token.line > line { line = token.line; content.push('\n'); content.push_str(" "); } match token.kind { SyntaxKind::CaretToken => content.push_str(";"), SyntaxKind::OpenBracketToken => content.push_str("("), SyntaxKind::OpenSquareBracketToken => content.push_str("{"), SyntaxKind::CloseBracketToken => content.push_str(")"), SyntaxKind::CloseSquareBracketToken => content.push_str("}"), SyntaxKind::AdditionToken => content.push_str("+"), SyntaxKind::MultiplicationToken => content.push_str("*"), SyntaxKind::SubstractionToken => content.push_str("-"), SyntaxKind::IncrementToken => content.push_str("++"), SyntaxKind::DecrementToken => content.push_str("--"), SyntaxKind::DivisionToken => content.push_str("/"), SyntaxKind::ModulusToken => content.push_str("%"), SyntaxKind::AssignToken => content.push_str("="), SyntaxKind::GTToken => content.push_str(">"), SyntaxKind::LTToken => content.push_str("<"), SyntaxKind::GTOEToken => content.push_str(">="), SyntaxKind::LTOEToken => content.push_str("<="), SyntaxKind::EqualToken => content.push_str("=="), SyntaxKind::PrintToken => content.push_str("printf"), SyntaxKind::ScanToken => content.push_str("scanf"), SyntaxKind::ConditionToken => content.push_str("if"), SyntaxKind::LoopToken => content.push_str("while"), SyntaxKind::FloatDefToken => content.push_str("float"), SyntaxKind::IntegerDefToken => content.push_str("int"), SyntaxKind::CharacterDefToken => content.push_str("char"), _ => content.push_str(&*token.text) } } content.push_str("\n printf(\"\\npress any key...\");\n printf(\"%c\", getch());\n return 0;\n}"); return content; }
//! A fixed-point engine for data-flow analysis. use crate::{il, Error}; use std::collections::{HashMap, VecDeque}; use std::fmt::Debug; const DEFAULT_MAX_ANALYSIS_STEPS: usize = 250000; /// A trait which implements a forward, flow-sensitive analysis to a /// fixed point. pub trait FixedPointAnalysis<'f, State: 'f + Clone + Debug + PartialOrd> { /// Given an input state for a block, create an output state for this /// block. fn trans( &self, location: il::RefProgramLocation<'f>, state: Option<State>, ) -> Result<State, Error>; /// Given two states, join them into one state. fn join(&self, state0: State, state1: &State) -> Result<State, Error>; } /// A forward, work-list data-flow analysis algorithm. /// /// When force is true, the partial order over inputs is forced by joining /// states which do not inherently enforce the partial order. pub fn fixed_point_forward_options<'f, Analysis, State>( analysis: Analysis, function: &'f il::Function, force: bool, max_analysis_steps: usize, ) -> Result<HashMap<il::ProgramLocation, State>, Error> where Analysis: FixedPointAnalysis<'f, State>, State: 'f + Clone + Debug + PartialOrd, { let mut states: HashMap<il::ProgramLocation, State> = HashMap::new(); let mut queue: VecDeque<il::ProgramLocation> = VecDeque::new(); // Find the entry block to the function. let entry_index = function .control_flow_graph() .entry() .ok_or(Error::FixedPointRequiresEntry)?; let entry_block = function.control_flow_graph().block(entry_index)?; match entry_block.instructions().first() { Some(instruction) => { let location = il::RefFunctionLocation::Instruction(entry_block, instruction); let location = il::RefProgramLocation::new(function, location); queue.push_back(location.into()); } None => { let location = il::RefFunctionLocation::EmptyBlock(entry_block); let location = il::RefProgramLocation::new(function, location); queue.push_back(location.into()); } } let mut steps = 0; while !queue.is_empty() { if steps > max_analysis_steps { return Err(Error::FixedPointMaxSteps); } steps += 1; let location = queue.pop_front().unwrap(); // TODO this should not be an unwrap let location = location.function_location().apply(function).unwrap(); let location = il::RefProgramLocation::new(function, location); let location_predecessors = location.backward()?; let state = location_predecessors .into_iter() .fold(None, |s, p| match states.get(&p.into()) { Some(in_state) => match s { Some(s) => Some(analysis.join(s, in_state).unwrap()), None => Some(in_state.clone()), }, None => s, }); let mut state = analysis.trans(location.clone(), state)?; if let Some(in_state) = states.get(&location.clone().into()) { let ordering = match state.partial_cmp(in_state) { Some(ordering) => match ordering { ::std::cmp::Ordering::Less => Some("less"), ::std::cmp::Ordering::Equal => { continue; } ::std::cmp::Ordering::Greater => None, }, None => Some("no relation"), }; if force { state = analysis.join(state, in_state)?; } else if let Some(ordering) = ordering { return Err(Error::FixedPointOrdering( ordering.to_string(), location.into(), )); } } states.insert(location.clone().into(), state); for successor in location.forward()? { if !queue.contains(&successor.clone().into()) { queue.push_back(successor.into()); } } } Ok(states) } /// A guaranteed sound analysis, which enforces the partial order over states. pub fn fixed_point_forward<'f, Analysis, State>( analysis: Analysis, function: &'f il::Function, ) -> Result<HashMap<il::ProgramLocation, State>, Error> where Analysis: FixedPointAnalysis<'f, State>, State: 'f + Clone + Debug + PartialOrd, { fixed_point_forward_options(analysis, function, false, DEFAULT_MAX_ANALYSIS_STEPS) } /// A backward, work-list data-flow analysis algorithm. /// /// When force is true, the partial order over inputs is forced by joining /// states which do not inherently enforce the partial order. pub fn fixed_point_backward_options<'f, Analysis, State>( analysis: Analysis, function: &'f il::Function, force: bool, ) -> Result<HashMap<il::RefProgramLocation<'f>, State>, Error> where Analysis: FixedPointAnalysis<'f, State>, State: 'f + Clone + Debug + PartialOrd, { let mut states: HashMap<il::RefProgramLocation<'f>, State> = HashMap::new(); let mut queue: VecDeque<il::RefProgramLocation<'f>> = VecDeque::new(); // Find the entry block to the function. let exit_index = function .control_flow_graph() .entry() .ok_or(Error::FixedPointRequiresEntry)?; let exit_block = function.control_flow_graph().block(exit_index)?; match exit_block.instructions().last() { Some(instruction) => { let location = il::RefFunctionLocation::Instruction(exit_block, instruction); let location = il::RefProgramLocation::new(function, location); queue.push_back(location.clone()); } None => { let location = il::RefFunctionLocation::EmptyBlock(exit_block); let location = il::RefProgramLocation::new(function, location); queue.push_back(location.clone()); } } while !queue.is_empty() { let location = queue.pop_front().unwrap(); let location_successors = location.forward()?; let state = location_successors .iter() .fold(None, |s, p| match states.get(p) { Some(in_state) => match s { Some(s) => Some(analysis.join(s, in_state).unwrap()), None => Some(in_state.clone()), }, None => s, }); let mut state = analysis.trans(location.clone(), state)?; if let Some(in_state) = states.get(&location) { let ordering = match state.partial_cmp(in_state) { Some(ordering) => match ordering { ::std::cmp::Ordering::Less => Some("less"), ::std::cmp::Ordering::Equal => { continue; } ::std::cmp::Ordering::Greater => None, }, None => Some("no relation"), }; if force { state = analysis.join(state, in_state)?; } else if let Some(ordering) = ordering { return Err(Error::FixedPointOrdering( ordering.to_string(), location.into(), )); } } states.insert(location.clone(), state); for successor in location.backward()? { if !queue.contains(&successor) { queue.push_back(successor); } } } Ok(states) } /// A guaranteed sound analysis, which enforces the partial order over states. pub fn fixed_point_backward<'f, Analysis, State>( analysis: Analysis, function: &'f il::Function, ) -> Result<HashMap<il::RefProgramLocation<'f>, State>, Error> where Analysis: FixedPointAnalysis<'f, State>, State: 'f + Clone + Debug + PartialOrd, { fixed_point_backward_options(analysis, function, false) }
#[macro_export] /// Queries the database for the names of all tables, and calls /// [`infer_table_from_schema!`](macro.infer_table_from_schema!.html) for each /// one. /// /// Attempting to use the `env!` or `dotenv!` macros here will not work due to limitations of /// the Macros 1.1 system, but you can pass a string in the form `"env:SOME_ENV_VAR"` or /// `"dotenv:SOME_ENV_VAR"` to achieve the same effect. /// /// This macro can only be used in combination with the `diesel_codegen` or /// `diesel_codegen_syntex` crates. It will not work on its own. macro_rules! infer_schema { ($database_url: expr) => { mod __diesel_infer_schema { #[derive(InferSchema)] #[options(database_url=$database_url)] struct _Dummy; } pub use self::__diesel_infer_schema::*; } } #[macro_export] /// Establishes a database connection at compile time, loads the schema information about a table's /// columns, and invokes [`table!`](macro.table!.html) for you automatically. /// /// Attempting to use the `env!` or `dotenv!` macros here will not work due to limitations of the /// Macros 1.1 system, but you can pass a string in the form `"env:SOME_ENV_VAR"` or /// `"dotenv:SOME_ENV_VAR"` to achieve the same effect. /// /// At this time, the schema inference macros do not support types from third party crates, and /// having any columns with a type not supported by the diesel core crate will result in a compiler /// error (please [open an issue](https://github.com/diesel-rs/diesel/issues/new) if this happens /// unexpectedly for a type listed in our docs.) /// /// This macro can only be used in combination with the `diesel_codegen` or /// `diesel_codegen_syntex` crates. It will not work on its own. macro_rules! infer_table_from_schema { ($database_url: expr, $table_name: expr) => { #[derive(InferTableFromSchema)] #[options(database_url=$database_url, table_name=$table_name)] struct __DieselInferTableFromSchema; } } #[macro_export] /// This macro will read your migrations at compile time, and embed a module you can use to execute /// them at runtime without the migration files being present on the file system. This is useful if /// you would like to use Diesel's migration infrastructure, but want to ship a single executable /// file (such as for embedded applications). It can also be used to apply migrations to an in /// memory database (Diesel does this for its own test suite). /// /// You can optionally pass the path to the migrations directory to this macro. When left /// unspecified, Diesel Codegen will search for the migrations directory in the same way that /// Diesel CLI does. If specified, the path should be relative to the directory where `Cargo.toml` /// resides. /// /// This macro can only be used in combination with the `diesel_codegen` or /// `diesel_codegen_syntex` crates. It will not work on its own. macro_rules! embed_migrations { () => { mod embedded_migrations { #[derive(EmbedMigrations)] struct _Dummy; } }; ($migrations_path: expr) => { mod embedded_migrations { #[derive(EmbedMigrations)] #[options(migrations_path=$migrations_path)] struct _Dummy; } } }
#![no_std] #[macro_use] extern crate crypto_tests; extern crate magma; use crypto_tests::block_cipher::{BlockCipherTest, encrypt_decrypt}; #[test] fn magma() { let tests = new_block_cipher_tests!("1"); encrypt_decrypt::<magma::Magma>(&tests); }
// Copyright 2019 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 std::{cell::RefCell, rc::Rc}; use crate::{context::ContextInner, spinel_sys::*}; #[derive(Debug)] pub(crate) struct PathInner { context: Rc<RefCell<ContextInner>>, pub(crate) spn_path: SpnPath, } impl PathInner { fn new(context: &Rc<RefCell<ContextInner>>, spn_path: SpnPath) -> Self { Self { context: Rc::clone(context), spn_path } } } impl Drop for PathInner { fn drop(&mut self) { self.context.borrow_mut().discard_path(self.spn_path); } } /// Spinel path created by a `PathBuilder`. [spn_path_t] /// /// [spn_path_t]: https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/src/graphics/lib/compute/spinel/spinel.h#50 #[derive(Clone, Debug)] pub struct Path { pub(crate) inner: Rc<PathInner>, } impl Path { pub(crate) fn new(context: &Rc<RefCell<ContextInner>>, spn_path: SpnPath) -> Self { Self { inner: Rc::new(PathInner::new(context, spn_path)) } } } impl Eq for Path {} impl PartialEq for Path { fn eq(&self, other: &Self) -> bool { Rc::ptr_eq(&self.inner, &other.inner) } }
// TEST POC /** * Handle: trait, process(msg: &message) * handlers: Map<String, Handle> * handle: Handle, handle.process(message) * struct HeartBeat; * impl Handle for HeartBeat { * fn process(m: &message) { // do something } * } * */ #[derive(Debug)] struct Message { key: i32, val: String, } impl Message { fn new() -> Self { Message { key: 1, val: "Raft".to_string(), } } } type handle = fn(&Message); fn process(msg: &Message) { println!("{:?}", msg); } fn send_heart_beat(msg: &Message) { println!("{:?}", msg); } #[cfg(test)] mod node_tests { use super::*; use std::collections::HashMap; #[test] fn test_handle() { assert_eq!(2+3, 5); let mut msg = Message::new(); let mut map: HashMap<String, handle> = HashMap::new(); map.insert("/hello".to_string(), process); map.insert("/test".to_string(), send_heart_beat); if let Some(func) = map.get("/hello") { func(&msg); } if let Some(func) = map.get("/test") { msg.key = 4; msg.val = "Ruft!!!".to_string(); func(&msg); } } }
//! Choices that can be applied to split the search space. use std::fmt; use crate::explorer::config; use crate::ir::{self, Statement}; use crate::search_space::{Action, DimKind, Domain, NumSet, Order, SearchSpace}; use itertools::Itertools; use log::trace; use serde::{Deserialize, Serialize}; use utils::unwrap; /// Either a regular action or a manually applied action. #[derive(Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum ActionEx { Action(Action), LowerLayout { mem: ir::MemId, st_dims: Vec<ir::DimId>, ld_dims: Vec<ir::DimId>, }, } impl fmt::Debug for ActionEx { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { // Actions are already explicitly self-describing enough ActionEx::Action(action) => write!(f, "{:?}", action), ActionEx::LowerLayout { mem, st_dims, ld_dims, } => write!( f, "LowerLayout {{ mem: {:?}, st_dims: {:?}, ld_dims: {:?} }}", mem, st_dims, ld_dims ), } } } impl ir::IrDisplay for ActionEx { fn fmt(&self, fmt: &mut fmt::Formatter, function: &ir::Function) -> fmt::Result { match self { ActionEx::Action(action) => write!(fmt, "{}", action.display(function)), ActionEx::LowerLayout { mem, st_dims, ld_dims, } => write!( fmt, "LowerLayout {{ mem: {:?}, st_dims: {:?}, ld_dims: {:?} }}", mem, st_dims, ld_dims ), } } } /// Represents a choice that splits a search space in multiple ones. // TODO(search_space): explore and lower loayouts directly from the regular actions. pub type Choice = Vec<ActionEx>; pub fn list<'a>( iter_choice: impl IntoIterator<Item = &'a config::ChoiceGroup> + 'a, space: &'a SearchSpace, ) -> impl Iterator<Item = Choice> + 'a { iter_choice .into_iter() .map(move |choice_grp| -> Box<dyn Iterator<Item = Choice> + 'a> { use crate::explorer::config::ChoiceGroup; let fun = space.ir_instance(); match choice_grp { ChoiceGroup::LowerLayout => Box::new( fun.layouts_to_lower() .iter() .map(move |&layout| lower_layout_choice(space, layout)), ), ChoiceGroup::Size => Box::new(fun.static_dims().flat_map(move |dim| { let sizes = space.domain().get_size(dim.id()); gen_choice(sizes.list(), &|s| Action::Size(dim.id(), s)) })), ChoiceGroup::ThreadSize => { Box::new(fun.static_dims().flat_map(move |dim| { let kinds = space.domain().get_dim_kind(dim.id()); if kinds.intersects(DimKind::THREAD) { let sizes = space.domain().get_size(dim.id()); gen_choice(sizes.list(), &|s| Action::Size(dim.id(), s)) } else { None } })) } ChoiceGroup::DimKind => Box::new(fun.dims().flat_map(move |dim| { let kinds = space.domain().get_dim_kind(dim.id()); gen_choice(kinds.list(), &|k| Action::DimKind(dim.id(), k)) })), ChoiceGroup::Threads => Box::new(fun.dims().flat_map(move |dim| { let kinds = space.domain().get_dim_kind(dim.id()); gen_choice(kinds.bisect(DimKind::THREAD), &|k| { Action::DimKind(dim.id(), k) }) })), ChoiceGroup::DimMap => { Box::new(fun.static_dims().enumerate().flat_map(move |(i, lhs)| { fun.static_dims().take(i).flat_map(move |rhs| { let mappings = space.domain().get_thread_mapping(lhs.id(), rhs.id()); gen_choice(mappings.list(), &|m| { Action::ThreadMapping(lhs.id(), rhs.id(), m) }) }) })) } ChoiceGroup::Order => { Box::new(fun.dims().enumerate().flat_map(move |(i, lhs)| { // TODO(search_space): avoid picking ordering decisions that have little impact. // For this, we should avoid dimension-instruction and dimension-vector dim // orderings. The problem is that we do not know wich choice to pick in the end. let lhs = lhs.stmt_id(); let dims = fun.dims().take(i).map(|x| x.stmt_id()); dims.chain(fun.insts().map(|x| x.stmt_id())).flat_map( move |rhs| { let orders = space.domain().get_order(lhs, rhs); gen_choice(orders.list(), &|o| Action::Order(lhs, rhs, o)) }, ) })) } ChoiceGroup::DimNesting => { Box::new(fun.dims().enumerate().flat_map(move |(i, lhs)| { let lhs = lhs.stmt_id(); let dims = fun.dims().take(i).map(|x| x.stmt_id()); dims.chain(fun.insts().map(|x| x.stmt_id())).flat_map( move |rhs| { let available_orders = space.domain().get_order(lhs, rhs); let nesting_orders = Order::INNER | Order::OUTER; let orders = (available_orders & Order::INNER) .into_option() .into_iter() .chain( (available_orders & Order::OUTER).into_option(), ) .chain( (available_orders & !nesting_orders) .into_option(), ); gen_choice(orders, &|order| { Action::Order(lhs, rhs, order) }) }, ) })) } ChoiceGroup::DimFusion => { Box::new(fun.dims().enumerate().flat_map(move |(i, lhs)| { let lhs = lhs.stmt_id(); let dims = fun.dims().take(i).map(|x| x.stmt_id()); dims.chain(fun.insts().map(|x| x.stmt_id())).flat_map( move |rhs| { let available_orders = space.domain().get_order(lhs, rhs); gen_choice( available_orders.bisect(Order::MERGED), &|order| Action::Order(lhs, rhs, order), ) }, ) })) } ChoiceGroup::MemSpace => { Box::new(fun.mem_blocks().flat_map(move |block| { let mem_spaces = space.domain().get_mem_space(block.mem_id()); gen_choice(mem_spaces.list(), &|s| { Action::MemSpace(block.mem_id(), s) }) })) } ChoiceGroup::InstFlag => { Box::new(fun.mem_insts().flat_map(move |inst| { let flags = space.domain().get_inst_flag(inst.id()).list(); gen_choice(flags, &|f| Action::InstFlag(inst.id(), f)) })) } } }) .flatten() } /// This function is to be either removed or reimplemented eventually. It is just a replacement for /// the previous list implementation (exposes the choices in the same order). Default should /// preferably be handled in config file pub fn default_list<'a>(space: &'a SearchSpace) -> impl Iterator<Item = Choice> + 'a { list(&config::DEFAULT_ORDERING, space) } /// Generates a choice from a list of possible values. fn gen_choice<T, IT>(values: IT, action_gen: &dyn Fn(T) -> Action) -> Option<Choice> where IT: IntoIterator<Item = T>, { let choice = values .into_iter() .map(action_gen) .map(ActionEx::Action) .collect_vec(); if choice.len() <= 1 { None } else { Some(choice) } } /// Chooses an order between instructions and dimensions when multiple are possible. /// The function assumes the order between dimensions is already fixed. // TODO(search_space): fix order has currently no effect. Should we remove it ? // It is unused because inst-dim and dim-dim decisions are fixed by the explorer. We // cannot make them free as we might end-up in a dead-end. pub fn fix_order(mut space: SearchSpace) -> SearchSpace { // TODO(search_space): make fix_order useless with a differential model trace!("adding arbitrary constraints to the order"); // Fix the order between instructions and dimensions. let pairs = space .ir_instance() .statements() .cartesian_product(space.ir_instance().dims()) .map(|(lhs, rhs)| (lhs.stmt_id(), rhs.stmt_id())) .filter(|&(lhs, rhs)| lhs != rhs) .filter(|&(lhs, rhs)| !space.domain().get_order(lhs, rhs).is_constrained()) .collect_vec(); for (lhs, rhs) in pairs { let order = space.domain().get_order(lhs, rhs); if order.is_constrained() { continue; } let new_order = if order.intersects(Order::BEFORE) { Order::BEFORE } else if order.intersects(Order::AFTER) { Order::AFTER } else { panic!( "unconstrained order between {:?} and {:?}: {:?}", lhs, rhs, order ) }; let action = Action::Order(lhs, rhs, new_order); unwrap!(space.apply_decisions(vec![action]), "{:?}", action); } space } /// Generates the different ways to lower a layout. fn lower_layout_choice(space: &SearchSpace, mem: ir::MemId) -> Vec<ActionEx> { let mem_block = space.ir_instance().mem_block(mem); let mapped_dims = mem_block.mapped_dims().iter().cloned().collect_vec(); // Order dimensions until the stride is too big to matter in any way. let mut to_process = vec![(vec![], mapped_dims, mem_block.base_size())]; let mut actions = Vec::new(); while let Some((ordered_dims, remaining_dims, ordered_size)) = to_process.pop() { // TODO(search_space): parametrize the max stride for layout ordering if ordered_size >= 32 * 8 || remaining_dims.is_empty() { let (st_dims, ld_dims) = remaining_dims .into_iter() .chain(ordered_dims.into_iter().rev()) .unzip(); actions.push(ActionEx::LowerLayout { mem, st_dims, ld_dims, }); } else { for i in 0..remaining_dims.len() { let mut remaining_dims = remaining_dims.clone(); let mut ordered_dims = ordered_dims.clone(); let dim_pair = remaining_dims.swap_remove(i); let possible_sizes = unwrap!(space.ir_instance().dim(dim_pair.0).possible_sizes()); let size = space .domain() .get_size(dim_pair.0) .min_value(possible_sizes); let ordered_size = ordered_size * size; ordered_dims.push(dim_pair); to_process.push((ordered_dims, remaining_dims, ordered_size)); } } } actions } /// The error type for action application errors. /// /// Errors mostly originate from constraint propagation failing. pub struct ActionError { action: ActionEx, space: SearchSpace, } impl fmt::Debug for ActionError { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_struct("ActionError") .field("action", &self.action) .field("space", &"..") .finish() } } impl fmt::Display for ActionError { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { match &self.action { ActionEx::Action(action) => write!( fmt, "failed to apply action: {}", action.display(self.space.ir_instance()) ), ActionEx::LowerLayout { mem, .. } => { // We can't use the IR instance here, since it might be in an inconsistent state. write!(fmt, "failed to lower layout for {}", mem) } } } } impl std::error::Error for ActionError {} impl ActionEx { /// Apply this action to a search space pub fn apply_to(&self, mut space: SearchSpace) -> Result<SearchSpace, ActionError> { match match *self { ActionEx::Action(action) => space.apply_decisions(vec![action]), ActionEx::LowerLayout { mem, ref st_dims, ref ld_dims, } => space.lower_layout(mem, st_dims, ld_dims), } { Ok(()) => Ok(space), Err(()) => { // This contains the space to which the action was initially applied. Note that // since action application is a destructive operation, the space might in general // be in an inconsistent state. However, the IR instance is still valid when // `apply_decisions` failed (but *not* when `lower_layout` failed!), and that is // all we need to display a human-readable error message. Err(ActionError { action: self.clone(), space, }) } } } }
struct Color {} enum Slanted { Normal, Italic, Oblique } enum FontType { Serif, SansSerif, Monospace } struct Size {} trait Field { fn field_mut(&mut self, name: &str) -> Option<&mut Field>; fn field(&self, name: &str) -> Option<&Field>; fn assign(&mut self, value: &Field) -> Result; fn call(&self) -> Option<Box<Field>>; } // x.color = Color("green")..mix(parent.color) // get_mut("x").field_mut("color").assign(Color::from("green").mix(get("parent"). trait VectorFont { fn color(&mut self) -> &mut Color; } Text based - font attributes - bold - italic - color {mix} - font style - monospace | sans-serif | serif Vector based - Font - size {mix, min, max} - weight [thin .. fat] {mix, min, max} - variant [oblique | italic | bold] - Space - margin {mix, min, max} - vertical space {mix, min, max} - Color - brightness {mix, min, max} - hue {mix} - saturation {mix, min, max}
use data_types::{DeleteExpr, Op, Scalar}; use datafusion::{ logical_expr::BinaryExpr, prelude::{binary_expr, lit, Expr}, }; use snafu::{ResultExt, Snafu}; use std::ops::Deref; pub(crate) fn expr_to_df(expr: DeleteExpr) -> Expr { let column = datafusion::prelude::Column { relation: None, name: expr.column, }; binary_expr( Expr::Column(column), op_to_df(expr.op), lit(scalar_to_df(expr.scalar)), ) } #[derive(Debug, Snafu)] #[allow(clippy::large_enum_variant)] pub enum DataFusionToExprError { #[snafu(display("unsupported expression: {:?}", expr))] UnsupportedExpression { expr: Expr }, #[snafu(display("unsupported operants: left {:?}; right {:?}", left, right))] UnsupportedOperants { left: Expr, right: Expr }, #[snafu(display("cannot convert datafusion operator: {}", source))] CannotConvertDataFusionOperator { source: crate::delete_expr::DataFusionToOpError, }, #[snafu(display("cannot convert datafusion scalar value: {}", source))] CannotConvertDataFusionScalarValue { source: crate::delete_expr::DataFusionToScalarError, }, } pub(crate) fn df_to_expr(expr: Expr) -> Result<DeleteExpr, DataFusionToExprError> { match expr { Expr::BinaryExpr(BinaryExpr { left, op, right }) => { let (column, scalar) = match (left.deref(), right.deref()) { // The delete predicate parser currently only supports `<column><op><value>`, not `<value><op><column>`, // however this could can easily be extended to support the latter case as well. (Expr::Column(column), Expr::Literal(value)) => { let column = column.name.clone(); let scalar = df_to_scalar(value.clone()) .context(CannotConvertDataFusionScalarValueSnafu)?; (column, scalar) } (other_left, other_right) => { return Err(DataFusionToExprError::UnsupportedOperants { left: other_left.clone(), right: other_right.clone(), }); } }; let op = df_to_op(op).context(CannotConvertDataFusionOperatorSnafu)?; Ok(DeleteExpr { column, op, scalar }) } other => Err(DataFusionToExprError::UnsupportedExpression { expr: other }), } } pub(crate) fn op_to_df(op: Op) -> datafusion::logical_expr::Operator { match op { Op::Eq => datafusion::logical_expr::Operator::Eq, Op::Ne => datafusion::logical_expr::Operator::NotEq, } } #[derive(Debug, Snafu)] #[allow(missing_copy_implementations)] // allow extensions pub enum DataFusionToOpError { #[snafu(display("unsupported operator: {:?}", op))] UnsupportedOperator { op: datafusion::logical_expr::Operator, }, } pub(crate) fn df_to_op(op: datafusion::logical_expr::Operator) -> Result<Op, DataFusionToOpError> { match op { datafusion::logical_expr::Operator::Eq => Ok(Op::Eq), datafusion::logical_expr::Operator::NotEq => Ok(Op::Ne), other => Err(DataFusionToOpError::UnsupportedOperator { op: other }), } } pub(crate) fn scalar_to_df(scalar: Scalar) -> datafusion::scalar::ScalarValue { use datafusion::scalar::ScalarValue; match scalar { Scalar::Bool(value) => ScalarValue::Boolean(Some(value)), Scalar::I64(value) => ScalarValue::Int64(Some(value)), Scalar::F64(value) => ScalarValue::Float64(Some(value.into())), Scalar::String(value) => ScalarValue::Utf8(Some(value)), } } #[derive(Debug, Snafu)] pub enum DataFusionToScalarError { #[snafu(display("unsupported scalar value: {:?}", value))] UnsupportedScalarValue { value: datafusion::scalar::ScalarValue, }, } pub(crate) fn df_to_scalar( scalar: datafusion::scalar::ScalarValue, ) -> Result<Scalar, DataFusionToScalarError> { use datafusion::scalar::ScalarValue; match scalar { ScalarValue::Utf8(Some(value)) => Ok(Scalar::String(value)), ScalarValue::Int64(Some(value)) => Ok(Scalar::I64(value)), ScalarValue::Float64(Some(value)) => Ok(Scalar::F64(value.into())), ScalarValue::Boolean(Some(value)) => Ok(Scalar::Bool(value)), other => Err(DataFusionToScalarError::UnsupportedScalarValue { value: other }), } } #[cfg(test)] mod tests { use std::{ops::Not, sync::Arc}; use arrow::datatypes::Field; use test_helpers::assert_contains; use super::*; use datafusion::prelude::col; #[test] fn test_roundtrips() { assert_expr_works( DeleteExpr { column: "foo".to_string(), op: Op::Eq, scalar: Scalar::Bool(true), }, r#""foo"=true"#, ); assert_expr_works( DeleteExpr { column: "bar".to_string(), op: Op::Ne, scalar: Scalar::I64(-1), }, r#""bar"!=-1"#, ); assert_expr_works( DeleteExpr { column: "baz".to_string(), op: Op::Eq, scalar: Scalar::F64((-1.1).into()), }, r#""baz"=-1.1"#, ); assert_expr_works( DeleteExpr { column: "col".to_string(), op: Op::Eq, scalar: Scalar::String("foo".to_string()), }, r#""col"='foo'"#, ); } fn assert_expr_works(expr: DeleteExpr, display: &str) { let df_expr = expr_to_df(expr.clone()); let expr2 = df_to_expr(df_expr).unwrap(); assert_eq!(expr2, expr); assert_eq!(expr.to_string(), display); } #[test] fn test_unsupported_expression() { let expr = (col("foo").eq(lit("x"))).not(); let res = df_to_expr(expr); assert_contains!(res.unwrap_err().to_string(), "unsupported expression:"); } #[test] fn test_unsupported_operants() { let expr = col("foo").eq(col("bar")); let res = df_to_expr(expr); assert_contains!(res.unwrap_err().to_string(), "unsupported operants:"); } #[test] fn test_unsupported_scalar_value() { let scalar = datafusion::scalar::ScalarValue::List( Some(vec![]), Arc::new(Field::new( "field", arrow::datatypes::DataType::Float64, true, )), ); let res = df_to_scalar(scalar); assert_contains!(res.unwrap_err().to_string(), "unsupported scalar value:"); } #[test] fn test_unsupported_scalar_value_in_expr() { let expr = col("foo").eq(lit(datafusion::scalar::ScalarValue::new_list( Some(vec![]), arrow::datatypes::DataType::Float64, ))); let res = df_to_expr(expr); assert_contains!(res.unwrap_err().to_string(), "unsupported scalar value:"); } #[test] fn test_unsupported_operator() { let res = df_to_op(datafusion::logical_expr::Operator::Lt); assert_contains!(res.unwrap_err().to_string(), "unsupported operator:"); } #[test] fn test_unsupported_operator_in_expr() { let expr = col("foo").lt(lit("x")); let res = df_to_expr(expr); assert_contains!(res.unwrap_err().to_string(), "unsupported operator:"); } }
//! File Explorer example. //! //! This (rather complex) example creates a working text-based file explorer which shows off using standard library file system APIs to //! read the SD card and RomFS (if properly read via the `romfs:/` prefix). use ctru::applets::swkbd::{Button, SoftwareKeyboard}; use ctru::prelude::*; use std::fs::DirEntry; use std::os::horizon::fs::MetadataExt; use std::path::{Path, PathBuf}; fn main() { ctru::use_panic_handler(); let apt = Apt::new().unwrap(); let mut hid = Hid::new().unwrap(); let gfx = Gfx::new().unwrap(); // Mount the RomFS if available. #[cfg(all(feature = "romfs", romfs_exists))] let _romfs = ctru::services::romfs::RomFS::new().unwrap(); FileExplorer::new(&apt, &mut hid, &gfx).run(); } struct FileExplorer<'a> { apt: &'a Apt, hid: &'a mut Hid, gfx: &'a Gfx, console: Console<'a>, path: PathBuf, entries: Vec<DirEntry>, running: bool, } impl<'a> FileExplorer<'a> { fn new(apt: &'a Apt, hid: &'a mut Hid, gfx: &'a Gfx) -> Self { let mut top_screen = gfx.top_screen.borrow_mut(); top_screen.set_wide_mode(true); let console = Console::new(top_screen); FileExplorer { apt, hid, gfx, console, path: PathBuf::from("/"), entries: Vec::new(), running: false, } } fn run(&mut self) { self.running = true; // Print the file explorer commands. self.print_menu(); while self.running && self.apt.main_loop() { self.hid.scan_input(); let input = self.hid.keys_down(); if input.contains(KeyPad::START) { break; } else if input.contains(KeyPad::B) && self.path.components().count() > 1 { self.path.pop(); self.console.clear(); self.print_menu(); // Open a directory/file to read. } else if input.contains(KeyPad::A) { self.get_input_and_run(Self::set_next_path); // Open a specific path using the `SoftwareKeyboard` applet. } else if input.contains(KeyPad::X) { self.get_input_and_run(Self::set_exact_path); } self.gfx.wait_for_vblank(); } } fn print_menu(&mut self) { match std::fs::metadata(&self.path) { Ok(metadata) => { println!( "Viewing {} (size {} bytes, mode {:#o})", self.path.display(), metadata.len(), metadata.st_mode(), ); if metadata.is_file() { self.print_file_contents(); // let the user continue navigating from the parent dir // after dumping the file self.path.pop(); self.print_menu(); return; } else if metadata.is_dir() { self.print_dir_entries(); } else { println!("unsupported file type: {:?}", metadata.file_type()); } } Err(e) => { println!("Failed to read {}: {e}", self.path.display()) } }; println!("Press Start to exit, A to select an entry by number, B to go up a directory, X to set the path."); } fn print_dir_entries(&mut self) { let dir_listing = std::fs::read_dir(&self.path).expect("Failed to open path"); self.entries = Vec::new(); for (i, entry) in dir_listing.enumerate() { match entry { Ok(entry) => { println!("{i:2} - {}", entry.file_name().to_string_lossy()); self.entries.push(entry); if (i + 1) % 20 == 0 { self.wait_for_page_down(); } } Err(e) => { println!("{i} - Error: {e}"); } } } } fn print_file_contents(&mut self) { match std::fs::read_to_string(&self.path) { Ok(contents) => { println!("File contents:\n{0:->80}", ""); println!("{contents}"); println!("{0:->80}", ""); } Err(err) => { println!("Error reading file: {err}"); } } } // Paginate output. fn wait_for_page_down(&mut self) { println!("Press A to go to next page, or Start to exit"); while self.apt.main_loop() { self.hid.scan_input(); let input = self.hid.keys_down(); if input.contains(KeyPad::A) { break; } if input.contains(KeyPad::START) { self.running = false; return; } self.gfx.wait_for_vblank(); } } fn get_input_and_run(&mut self, action: impl FnOnce(&mut Self, String)) { let mut keyboard = SoftwareKeyboard::default(); match keyboard.get_string(2048) { Ok((path, Button::Right)) => { // Clicked "OK". action(self, path); } Ok((_, Button::Left)) => { // Clicked "Cancel". } Ok((_, Button::Middle)) => { // This button wasn't shown. unreachable!() } Err(e) => { panic!("Error: {e:?}") } } } fn set_next_path(&mut self, next_path_index: String) { let next_path_index: usize = match next_path_index.parse() { Ok(index) => index, Err(e) => { println!("Number parsing error: {e}"); return; } }; let next_entry = match self.entries.get(next_path_index) { Some(entry) => entry, None => { println!("Input number of bounds"); return; } }; self.console.clear(); self.path = next_entry.path(); self.print_menu(); } fn set_exact_path(&mut self, new_path_str: String) { let new_path = Path::new(&new_path_str); if !new_path.is_dir() { println!("Not a directory: {new_path_str}"); return; } self.console.clear(); self.path = new_path.to_path_buf(); self.print_menu(); } }
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct CH_DESCRIPTION_TYPE(pub i32); pub const ch_description_type_logical: CH_DESCRIPTION_TYPE = CH_DESCRIPTION_TYPE(1i32); pub const ch_description_type_center_frequency: CH_DESCRIPTION_TYPE = CH_DESCRIPTION_TYPE(2i32); pub const ch_description_type_phy_specific: CH_DESCRIPTION_TYPE = CH_DESCRIPTION_TYPE(3i32); impl ::core::convert::From<i32> for CH_DESCRIPTION_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for CH_DESCRIPTION_TYPE { type Abi = Self; } #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_InfraCast_AccessPointBssid: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 19u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_InfraCast_ChallengeAep: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 21u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_InfraCast_DevnodeAep: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 23u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_InfraCast_HostName_ResolutionMode: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 25u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_InfraCast_PinSupported: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 29u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_InfraCast_RtspTcpConnectionParametersSupported: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 30u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_InfraCast_SinkHostName: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 20u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_InfraCast_SinkIpAddress: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 26u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_InfraCast_StreamSecuritySupported: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 18u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_InfraCast_Supported: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 17u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirectServices_AdvertisementId: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x31b37743_7c5e_4005_93e6_e953f92b82e9), pid: 5u32 }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirectServices_RequestServiceInformation: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x31b37743_7c5e_4005_93e6_e953f92b82e9), pid: 7u32 }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirectServices_ServiceAddress: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x31b37743_7c5e_4005_93e6_e953f92b82e9), pid: 2u32 }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirectServices_ServiceConfigMethods: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x31b37743_7c5e_4005_93e6_e953f92b82e9), pid: 6u32 }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirectServices_ServiceInformation: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x31b37743_7c5e_4005_93e6_e953f92b82e9), pid: 4u32 }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirectServices_ServiceName: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x31b37743_7c5e_4005_93e6_e953f92b82e9), pid: 3u32 }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_DeviceAddress: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 1u32 }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_DeviceAddressCopy: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 13u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_FoundWsbService: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 24u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_GroupId: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 4u32 }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_InformationElements: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 12u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_InterfaceAddress: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 2u32 }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_InterfaceGuid: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 3u32 }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_IsConnected: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 5u32 }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_IsDMGCapable: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 22u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_IsLegacyDevice: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 7u32 }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_IsMiracastLCPSupported: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 9u32 }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_IsRecentlyAssociated: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 14u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_IsVisible: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 6u32 }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_LinkQuality: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 28u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_MiracastVersion: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 8u32 }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_Miracast_SessionMgmtControlPort: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 31u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_NoMiracastAutoProject: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 16u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_RtspTcpConnectionParametersSupported: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 32u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_Service_Aeps: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 15u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_Services: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 10u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_SupportedChannelList: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 11u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFiDirect_TransientAssociation: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0x1506935d_e3e7_450f_8637_82233ebe5f6e), pid: 27u32, }; #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_WiFi_InterfaceGuid: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::PROPERTYKEY { fmtid: ::windows::core::GUID::from_u128(0xef1167eb_cbfc_4341_a568_a7c91a68982c), pid: 2u32 }; pub const DISCOVERY_FILTER_BITMASK_ANY: u32 = 15u32; pub const DISCOVERY_FILTER_BITMASK_DEVICE: u32 = 1u32; pub const DISCOVERY_FILTER_BITMASK_GO: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_ACCESSNETWORKOPTIONS { pub AccessNetworkType: u8, pub Internet: u8, pub ASRA: u8, pub ESR: u8, pub UESA: u8, } impl DOT11_ACCESSNETWORKOPTIONS {} impl ::core::default::Default for DOT11_ACCESSNETWORKOPTIONS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_ACCESSNETWORKOPTIONS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_ACCESSNETWORKOPTIONS").field("AccessNetworkType", &self.AccessNetworkType).field("Internet", &self.Internet).field("ASRA", &self.ASRA).field("ESR", &self.ESR).field("UESA", &self.UESA).finish() } } impl ::core::cmp::PartialEq for DOT11_ACCESSNETWORKOPTIONS { fn eq(&self, other: &Self) -> bool { self.AccessNetworkType == other.AccessNetworkType && self.Internet == other.Internet && self.ASRA == other.ASRA && self.ESR == other.ESR && self.UESA == other.UESA } } impl ::core::cmp::Eq for DOT11_ACCESSNETWORKOPTIONS {} unsafe impl ::windows::core::Abi for DOT11_ACCESSNETWORKOPTIONS { 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 DOT11_AC_PARAM(pub i32); pub const dot11_AC_param_BE: DOT11_AC_PARAM = DOT11_AC_PARAM(0i32); pub const dot11_AC_param_BK: DOT11_AC_PARAM = DOT11_AC_PARAM(1i32); pub const dot11_AC_param_VI: DOT11_AC_PARAM = DOT11_AC_PARAM(2i32); pub const dot11_AC_param_VO: DOT11_AC_PARAM = DOT11_AC_PARAM(3i32); pub const dot11_AC_param_max: DOT11_AC_PARAM = DOT11_AC_PARAM(4i32); impl ::core::convert::From<i32> for DOT11_AC_PARAM { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_AC_PARAM { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_ADDITIONAL_IE { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uBeaconIEsOffset: u32, pub uBeaconIEsLength: u32, pub uResponseIEsOffset: u32, pub uResponseIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_ADDITIONAL_IE {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_ADDITIONAL_IE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_ADDITIONAL_IE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_ADDITIONAL_IE").field("Header", &self.Header).field("uBeaconIEsOffset", &self.uBeaconIEsOffset).field("uBeaconIEsLength", &self.uBeaconIEsLength).field("uResponseIEsOffset", &self.uResponseIEsOffset).field("uResponseIEsLength", &self.uResponseIEsLength).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_ADDITIONAL_IE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uBeaconIEsOffset == other.uBeaconIEsOffset && self.uBeaconIEsLength == other.uBeaconIEsLength && self.uResponseIEsOffset == other.uResponseIEsOffset && self.uResponseIEsLength == other.uResponseIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_ADDITIONAL_IE {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_ADDITIONAL_IE { type Abi = Self; } pub const DOT11_ADDITIONAL_IE_REVISION_1: u32 = 1u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DOT11_ADHOC_AUTH_ALGORITHM(pub i32); pub const DOT11_ADHOC_AUTH_ALGO_INVALID: DOT11_ADHOC_AUTH_ALGORITHM = DOT11_ADHOC_AUTH_ALGORITHM(-1i32); pub const DOT11_ADHOC_AUTH_ALGO_80211_OPEN: DOT11_ADHOC_AUTH_ALGORITHM = DOT11_ADHOC_AUTH_ALGORITHM(1i32); pub const DOT11_ADHOC_AUTH_ALGO_RSNA_PSK: DOT11_ADHOC_AUTH_ALGORITHM = DOT11_ADHOC_AUTH_ALGORITHM(7i32); impl ::core::convert::From<i32> for DOT11_ADHOC_AUTH_ALGORITHM { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_ADHOC_AUTH_ALGORITHM { 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 DOT11_ADHOC_CIPHER_ALGORITHM(pub i32); pub const DOT11_ADHOC_CIPHER_ALGO_INVALID: DOT11_ADHOC_CIPHER_ALGORITHM = DOT11_ADHOC_CIPHER_ALGORITHM(-1i32); pub const DOT11_ADHOC_CIPHER_ALGO_NONE: DOT11_ADHOC_CIPHER_ALGORITHM = DOT11_ADHOC_CIPHER_ALGORITHM(0i32); pub const DOT11_ADHOC_CIPHER_ALGO_CCMP: DOT11_ADHOC_CIPHER_ALGORITHM = DOT11_ADHOC_CIPHER_ALGORITHM(4i32); pub const DOT11_ADHOC_CIPHER_ALGO_WEP: DOT11_ADHOC_CIPHER_ALGORITHM = DOT11_ADHOC_CIPHER_ALGORITHM(257i32); impl ::core::convert::From<i32> for DOT11_ADHOC_CIPHER_ALGORITHM { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_ADHOC_CIPHER_ALGORITHM { 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 DOT11_ADHOC_CONNECT_FAIL_REASON(pub i32); pub const DOT11_ADHOC_CONNECT_FAIL_DOMAIN_MISMATCH: DOT11_ADHOC_CONNECT_FAIL_REASON = DOT11_ADHOC_CONNECT_FAIL_REASON(0i32); pub const DOT11_ADHOC_CONNECT_FAIL_PASSPHRASE_MISMATCH: DOT11_ADHOC_CONNECT_FAIL_REASON = DOT11_ADHOC_CONNECT_FAIL_REASON(1i32); pub const DOT11_ADHOC_CONNECT_FAIL_OTHER: DOT11_ADHOC_CONNECT_FAIL_REASON = DOT11_ADHOC_CONNECT_FAIL_REASON(2i32); impl ::core::convert::From<i32> for DOT11_ADHOC_CONNECT_FAIL_REASON { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_ADHOC_CONNECT_FAIL_REASON { 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 DOT11_ADHOC_NETWORK_CONNECTION_STATUS(pub i32); pub const DOT11_ADHOC_NETWORK_CONNECTION_STATUS_INVALID: DOT11_ADHOC_NETWORK_CONNECTION_STATUS = DOT11_ADHOC_NETWORK_CONNECTION_STATUS(0i32); pub const DOT11_ADHOC_NETWORK_CONNECTION_STATUS_DISCONNECTED: DOT11_ADHOC_NETWORK_CONNECTION_STATUS = DOT11_ADHOC_NETWORK_CONNECTION_STATUS(11i32); pub const DOT11_ADHOC_NETWORK_CONNECTION_STATUS_CONNECTING: DOT11_ADHOC_NETWORK_CONNECTION_STATUS = DOT11_ADHOC_NETWORK_CONNECTION_STATUS(12i32); pub const DOT11_ADHOC_NETWORK_CONNECTION_STATUS_CONNECTED: DOT11_ADHOC_NETWORK_CONNECTION_STATUS = DOT11_ADHOC_NETWORK_CONNECTION_STATUS(13i32); pub const DOT11_ADHOC_NETWORK_CONNECTION_STATUS_FORMED: DOT11_ADHOC_NETWORK_CONNECTION_STATUS = DOT11_ADHOC_NETWORK_CONNECTION_STATUS(14i32); impl ::core::convert::From<i32> for DOT11_ADHOC_NETWORK_CONNECTION_STATUS { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_ADHOC_NETWORK_CONNECTION_STATUS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_ANQP_QUERY_COMPLETE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub Status: DOT11_ANQP_QUERY_RESULT, pub hContext: super::super::Foundation::HANDLE, pub uResponseLength: u32, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_ANQP_QUERY_COMPLETE_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_ANQP_QUERY_COMPLETE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_ANQP_QUERY_COMPLETE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_ANQP_QUERY_COMPLETE_PARAMETERS").field("Header", &self.Header).field("Status", &self.Status).field("hContext", &self.hContext).field("uResponseLength", &self.uResponseLength).finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_ANQP_QUERY_COMPLETE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Status == other.Status && self.hContext == other.hContext && self.uResponseLength == other.uResponseLength } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_ANQP_QUERY_COMPLETE_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_ANQP_QUERY_COMPLETE_PARAMETERS { type Abi = Self; } pub const DOT11_ANQP_QUERY_COMPLETE_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DOT11_ANQP_QUERY_RESULT(pub i32); pub const dot11_ANQP_query_result_success: DOT11_ANQP_QUERY_RESULT = DOT11_ANQP_QUERY_RESULT(0i32); pub const dot11_ANQP_query_result_failure: DOT11_ANQP_QUERY_RESULT = DOT11_ANQP_QUERY_RESULT(1i32); pub const dot11_ANQP_query_result_timed_out: DOT11_ANQP_QUERY_RESULT = DOT11_ANQP_QUERY_RESULT(2i32); pub const dot11_ANQP_query_result_resources: DOT11_ANQP_QUERY_RESULT = DOT11_ANQP_QUERY_RESULT(3i32); pub const dot11_ANQP_query_result_advertisement_protocol_not_supported_on_remote: DOT11_ANQP_QUERY_RESULT = DOT11_ANQP_QUERY_RESULT(4i32); pub const dot11_ANQP_query_result_gas_protocol_failure: DOT11_ANQP_QUERY_RESULT = DOT11_ANQP_QUERY_RESULT(5i32); pub const dot11_ANQP_query_result_advertisement_server_not_responding: DOT11_ANQP_QUERY_RESULT = DOT11_ANQP_QUERY_RESULT(6i32); pub const dot11_ANQP_query_result_access_issues: DOT11_ANQP_QUERY_RESULT = DOT11_ANQP_QUERY_RESULT(7i32); impl ::core::convert::From<i32> for DOT11_ANQP_QUERY_RESULT { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_ANQP_QUERY_RESULT { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_AP_JOIN_REQUEST { pub uJoinFailureTimeout: u32, pub OperationalRateSet: DOT11_RATE_SET, pub uChCenterFrequency: u32, pub dot11BSSDescription: DOT11_BSS_DESCRIPTION, } impl DOT11_AP_JOIN_REQUEST {} impl ::core::default::Default for DOT11_AP_JOIN_REQUEST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_AP_JOIN_REQUEST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_AP_JOIN_REQUEST").field("uJoinFailureTimeout", &self.uJoinFailureTimeout).field("OperationalRateSet", &self.OperationalRateSet).field("uChCenterFrequency", &self.uChCenterFrequency).field("dot11BSSDescription", &self.dot11BSSDescription).finish() } } impl ::core::cmp::PartialEq for DOT11_AP_JOIN_REQUEST { fn eq(&self, other: &Self) -> bool { self.uJoinFailureTimeout == other.uJoinFailureTimeout && self.OperationalRateSet == other.OperationalRateSet && self.uChCenterFrequency == other.uChCenterFrequency && self.dot11BSSDescription == other.dot11BSSDescription } } impl ::core::cmp::Eq for DOT11_AP_JOIN_REQUEST {} unsafe impl ::windows::core::Abi for DOT11_AP_JOIN_REQUEST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_ASSOCIATION_COMPLETION_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub MacAddr: [u8; 6], pub uStatus: u32, pub bReAssocReq: super::super::Foundation::BOOLEAN, pub bReAssocResp: super::super::Foundation::BOOLEAN, pub uAssocReqOffset: u32, pub uAssocReqSize: u32, pub uAssocRespOffset: u32, pub uAssocRespSize: u32, pub uBeaconOffset: u32, pub uBeaconSize: u32, pub uIHVDataOffset: u32, pub uIHVDataSize: u32, pub AuthAlgo: DOT11_AUTH_ALGORITHM, pub UnicastCipher: DOT11_CIPHER_ALGORITHM, pub MulticastCipher: DOT11_CIPHER_ALGORITHM, pub uActivePhyListOffset: u32, pub uActivePhyListSize: u32, pub bFourAddressSupported: super::super::Foundation::BOOLEAN, pub bPortAuthorized: super::super::Foundation::BOOLEAN, pub ucActiveQoSProtocol: u8, pub DSInfo: DOT11_DS_INFO, pub uEncapTableOffset: u32, pub uEncapTableSize: u32, pub MulticastMgmtCipher: DOT11_CIPHER_ALGORITHM, pub uAssocComebackTime: u32, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_ASSOCIATION_COMPLETION_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_ASSOCIATION_COMPLETION_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_ASSOCIATION_COMPLETION_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_ASSOCIATION_COMPLETION_PARAMETERS") .field("Header", &self.Header) .field("MacAddr", &self.MacAddr) .field("uStatus", &self.uStatus) .field("bReAssocReq", &self.bReAssocReq) .field("bReAssocResp", &self.bReAssocResp) .field("uAssocReqOffset", &self.uAssocReqOffset) .field("uAssocReqSize", &self.uAssocReqSize) .field("uAssocRespOffset", &self.uAssocRespOffset) .field("uAssocRespSize", &self.uAssocRespSize) .field("uBeaconOffset", &self.uBeaconOffset) .field("uBeaconSize", &self.uBeaconSize) .field("uIHVDataOffset", &self.uIHVDataOffset) .field("uIHVDataSize", &self.uIHVDataSize) .field("AuthAlgo", &self.AuthAlgo) .field("UnicastCipher", &self.UnicastCipher) .field("MulticastCipher", &self.MulticastCipher) .field("uActivePhyListOffset", &self.uActivePhyListOffset) .field("uActivePhyListSize", &self.uActivePhyListSize) .field("bFourAddressSupported", &self.bFourAddressSupported) .field("bPortAuthorized", &self.bPortAuthorized) .field("ucActiveQoSProtocol", &self.ucActiveQoSProtocol) .field("DSInfo", &self.DSInfo) .field("uEncapTableOffset", &self.uEncapTableOffset) .field("uEncapTableSize", &self.uEncapTableSize) .field("MulticastMgmtCipher", &self.MulticastMgmtCipher) .field("uAssocComebackTime", &self.uAssocComebackTime) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_ASSOCIATION_COMPLETION_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.MacAddr == other.MacAddr && self.uStatus == other.uStatus && self.bReAssocReq == other.bReAssocReq && self.bReAssocResp == other.bReAssocResp && self.uAssocReqOffset == other.uAssocReqOffset && self.uAssocReqSize == other.uAssocReqSize && self.uAssocRespOffset == other.uAssocRespOffset && self.uAssocRespSize == other.uAssocRespSize && self.uBeaconOffset == other.uBeaconOffset && self.uBeaconSize == other.uBeaconSize && self.uIHVDataOffset == other.uIHVDataOffset && self.uIHVDataSize == other.uIHVDataSize && self.AuthAlgo == other.AuthAlgo && self.UnicastCipher == other.UnicastCipher && self.MulticastCipher == other.MulticastCipher && self.uActivePhyListOffset == other.uActivePhyListOffset && self.uActivePhyListSize == other.uActivePhyListSize && self.bFourAddressSupported == other.bFourAddressSupported && self.bPortAuthorized == other.bPortAuthorized && self.ucActiveQoSProtocol == other.ucActiveQoSProtocol && self.DSInfo == other.DSInfo && self.uEncapTableOffset == other.uEncapTableOffset && self.uEncapTableSize == other.uEncapTableSize && self.MulticastMgmtCipher == other.MulticastMgmtCipher && self.uAssocComebackTime == other.uAssocComebackTime } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_ASSOCIATION_COMPLETION_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_ASSOCIATION_COMPLETION_PARAMETERS { type Abi = Self; } pub const DOT11_ASSOCIATION_COMPLETION_PARAMETERS_REVISION_1: u32 = 1u32; pub const DOT11_ASSOCIATION_COMPLETION_PARAMETERS_REVISION_2: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_ASSOCIATION_INFO_EX { pub PeerMacAddress: [u8; 6], pub BSSID: [u8; 6], pub usCapabilityInformation: u16, pub usListenInterval: u16, pub ucPeerSupportedRates: [u8; 255], pub usAssociationID: u16, pub dot11AssociationState: DOT11_ASSOCIATION_STATE, pub dot11PowerMode: DOT11_POWER_MODE, pub liAssociationUpTime: i64, pub ullNumOfTxPacketSuccesses: u64, pub ullNumOfTxPacketFailures: u64, pub ullNumOfRxPacketSuccesses: u64, pub ullNumOfRxPacketFailures: u64, } impl DOT11_ASSOCIATION_INFO_EX {} impl ::core::default::Default for DOT11_ASSOCIATION_INFO_EX { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_ASSOCIATION_INFO_EX { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_ASSOCIATION_INFO_EX") .field("PeerMacAddress", &self.PeerMacAddress) .field("BSSID", &self.BSSID) .field("usCapabilityInformation", &self.usCapabilityInformation) .field("usListenInterval", &self.usListenInterval) .field("ucPeerSupportedRates", &self.ucPeerSupportedRates) .field("usAssociationID", &self.usAssociationID) .field("dot11AssociationState", &self.dot11AssociationState) .field("dot11PowerMode", &self.dot11PowerMode) .field("liAssociationUpTime", &self.liAssociationUpTime) .field("ullNumOfTxPacketSuccesses", &self.ullNumOfTxPacketSuccesses) .field("ullNumOfTxPacketFailures", &self.ullNumOfTxPacketFailures) .field("ullNumOfRxPacketSuccesses", &self.ullNumOfRxPacketSuccesses) .field("ullNumOfRxPacketFailures", &self.ullNumOfRxPacketFailures) .finish() } } impl ::core::cmp::PartialEq for DOT11_ASSOCIATION_INFO_EX { fn eq(&self, other: &Self) -> bool { self.PeerMacAddress == other.PeerMacAddress && self.BSSID == other.BSSID && self.usCapabilityInformation == other.usCapabilityInformation && self.usListenInterval == other.usListenInterval && self.ucPeerSupportedRates == other.ucPeerSupportedRates && self.usAssociationID == other.usAssociationID && self.dot11AssociationState == other.dot11AssociationState && self.dot11PowerMode == other.dot11PowerMode && self.liAssociationUpTime == other.liAssociationUpTime && self.ullNumOfTxPacketSuccesses == other.ullNumOfTxPacketSuccesses && self.ullNumOfTxPacketFailures == other.ullNumOfTxPacketFailures && self.ullNumOfRxPacketSuccesses == other.ullNumOfRxPacketSuccesses && self.ullNumOfRxPacketFailures == other.ullNumOfRxPacketFailures } } impl ::core::cmp::Eq for DOT11_ASSOCIATION_INFO_EX {} unsafe impl ::windows::core::Abi for DOT11_ASSOCIATION_INFO_EX { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_ASSOCIATION_INFO_LIST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub dot11AssocInfo: [DOT11_ASSOCIATION_INFO_EX; 1], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_ASSOCIATION_INFO_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_ASSOCIATION_INFO_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_ASSOCIATION_INFO_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_ASSOCIATION_INFO_LIST").field("Header", &self.Header).field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("dot11AssocInfo", &self.dot11AssocInfo).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_ASSOCIATION_INFO_LIST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.dot11AssocInfo == other.dot11AssocInfo } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_ASSOCIATION_INFO_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_ASSOCIATION_INFO_LIST { type Abi = Self; } pub const DOT11_ASSOCIATION_INFO_LIST_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_ASSOCIATION_PARAMS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub BSSID: [u8; 6], pub uAssocRequestIEsOffset: u32, pub uAssocRequestIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_ASSOCIATION_PARAMS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_ASSOCIATION_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_ASSOCIATION_PARAMS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_ASSOCIATION_PARAMS").field("Header", &self.Header).field("BSSID", &self.BSSID).field("uAssocRequestIEsOffset", &self.uAssocRequestIEsOffset).field("uAssocRequestIEsLength", &self.uAssocRequestIEsLength).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_ASSOCIATION_PARAMS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.BSSID == other.BSSID && self.uAssocRequestIEsOffset == other.uAssocRequestIEsOffset && self.uAssocRequestIEsLength == other.uAssocRequestIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_ASSOCIATION_PARAMS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_ASSOCIATION_PARAMS { type Abi = Self; } pub const DOT11_ASSOCIATION_PARAMS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_ASSOCIATION_START_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub MacAddr: [u8; 6], pub SSID: DOT11_SSID, pub uIHVDataOffset: u32, pub uIHVDataSize: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_ASSOCIATION_START_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_ASSOCIATION_START_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_ASSOCIATION_START_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_ASSOCIATION_START_PARAMETERS").field("Header", &self.Header).field("MacAddr", &self.MacAddr).field("SSID", &self.SSID).field("uIHVDataOffset", &self.uIHVDataOffset).field("uIHVDataSize", &self.uIHVDataSize).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_ASSOCIATION_START_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.MacAddr == other.MacAddr && self.SSID == other.SSID && self.uIHVDataOffset == other.uIHVDataOffset && self.uIHVDataSize == other.uIHVDataSize } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_ASSOCIATION_START_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_ASSOCIATION_START_PARAMETERS { type Abi = Self; } pub const DOT11_ASSOCIATION_START_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DOT11_ASSOCIATION_STATE(pub i32); pub const dot11_assoc_state_zero: DOT11_ASSOCIATION_STATE = DOT11_ASSOCIATION_STATE(0i32); pub const dot11_assoc_state_unauth_unassoc: DOT11_ASSOCIATION_STATE = DOT11_ASSOCIATION_STATE(1i32); pub const dot11_assoc_state_auth_unassoc: DOT11_ASSOCIATION_STATE = DOT11_ASSOCIATION_STATE(2i32); pub const dot11_assoc_state_auth_assoc: DOT11_ASSOCIATION_STATE = DOT11_ASSOCIATION_STATE(3i32); impl ::core::convert::From<i32> for DOT11_ASSOCIATION_STATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_ASSOCIATION_STATE { type Abi = Self; } pub const DOT11_ASSOC_ERROR_SOURCE_OS: u32 = 0u32; pub const DOT11_ASSOC_ERROR_SOURCE_OTHER: u32 = 255u32; pub const DOT11_ASSOC_ERROR_SOURCE_REMOTE: u32 = 1u32; pub const DOT11_ASSOC_STATUS_SUCCESS: u32 = 0u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DOT11_AUTH_ALGORITHM(pub i32); pub const DOT11_AUTH_ALGO_80211_OPEN: DOT11_AUTH_ALGORITHM = DOT11_AUTH_ALGORITHM(1i32); pub const DOT11_AUTH_ALGO_80211_SHARED_KEY: DOT11_AUTH_ALGORITHM = DOT11_AUTH_ALGORITHM(2i32); pub const DOT11_AUTH_ALGO_WPA: DOT11_AUTH_ALGORITHM = DOT11_AUTH_ALGORITHM(3i32); pub const DOT11_AUTH_ALGO_WPA_PSK: DOT11_AUTH_ALGORITHM = DOT11_AUTH_ALGORITHM(4i32); pub const DOT11_AUTH_ALGO_WPA_NONE: DOT11_AUTH_ALGORITHM = DOT11_AUTH_ALGORITHM(5i32); pub const DOT11_AUTH_ALGO_RSNA: DOT11_AUTH_ALGORITHM = DOT11_AUTH_ALGORITHM(6i32); pub const DOT11_AUTH_ALGO_RSNA_PSK: DOT11_AUTH_ALGORITHM = DOT11_AUTH_ALGORITHM(7i32); pub const DOT11_AUTH_ALGO_WPA3: DOT11_AUTH_ALGORITHM = DOT11_AUTH_ALGORITHM(8i32); pub const DOT11_AUTH_ALGO_WPA3_ENT_192: DOT11_AUTH_ALGORITHM = DOT11_AUTH_ALGORITHM(8i32); pub const DOT11_AUTH_ALGO_WPA3_SAE: DOT11_AUTH_ALGORITHM = DOT11_AUTH_ALGORITHM(9i32); pub const DOT11_AUTH_ALGO_OWE: DOT11_AUTH_ALGORITHM = DOT11_AUTH_ALGORITHM(10i32); pub const DOT11_AUTH_ALGO_WPA3_ENT: DOT11_AUTH_ALGORITHM = DOT11_AUTH_ALGORITHM(11i32); pub const DOT11_AUTH_ALGO_IHV_START: DOT11_AUTH_ALGORITHM = DOT11_AUTH_ALGORITHM(-2147483648i32); pub const DOT11_AUTH_ALGO_IHV_END: DOT11_AUTH_ALGORITHM = DOT11_AUTH_ALGORITHM(-1i32); impl ::core::convert::From<i32> for DOT11_AUTH_ALGORITHM { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_AUTH_ALGORITHM { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_AUTH_ALGORITHM_LIST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub AlgorithmIds: [DOT11_AUTH_ALGORITHM; 1], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_AUTH_ALGORITHM_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_AUTH_ALGORITHM_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_AUTH_ALGORITHM_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_AUTH_ALGORITHM_LIST").field("Header", &self.Header).field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("AlgorithmIds", &self.AlgorithmIds).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_AUTH_ALGORITHM_LIST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.AlgorithmIds == other.AlgorithmIds } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_AUTH_ALGORITHM_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_AUTH_ALGORITHM_LIST { type Abi = Self; } pub const DOT11_AUTH_ALGORITHM_LIST_REVISION_1: u32 = 1u32; pub const DOT11_AUTH_ALGO_MICHAEL: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_AUTH_CIPHER_PAIR { pub AuthAlgoId: DOT11_AUTH_ALGORITHM, pub CipherAlgoId: DOT11_CIPHER_ALGORITHM, } impl DOT11_AUTH_CIPHER_PAIR {} impl ::core::default::Default for DOT11_AUTH_CIPHER_PAIR { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_AUTH_CIPHER_PAIR { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_AUTH_CIPHER_PAIR").field("AuthAlgoId", &self.AuthAlgoId).field("CipherAlgoId", &self.CipherAlgoId).finish() } } impl ::core::cmp::PartialEq for DOT11_AUTH_CIPHER_PAIR { fn eq(&self, other: &Self) -> bool { self.AuthAlgoId == other.AuthAlgoId && self.CipherAlgoId == other.CipherAlgoId } } impl ::core::cmp::Eq for DOT11_AUTH_CIPHER_PAIR {} unsafe impl ::windows::core::Abi for DOT11_AUTH_CIPHER_PAIR { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_AUTH_CIPHER_PAIR_LIST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub AuthCipherPairs: [DOT11_AUTH_CIPHER_PAIR; 1], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_AUTH_CIPHER_PAIR_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_AUTH_CIPHER_PAIR_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_AUTH_CIPHER_PAIR_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_AUTH_CIPHER_PAIR_LIST").field("Header", &self.Header).field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("AuthCipherPairs", &self.AuthCipherPairs).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_AUTH_CIPHER_PAIR_LIST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.AuthCipherPairs == other.AuthCipherPairs } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_AUTH_CIPHER_PAIR_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_AUTH_CIPHER_PAIR_LIST { type Abi = Self; } pub const DOT11_AUTH_CIPHER_PAIR_LIST_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_AVAILABLE_CHANNEL_LIST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub uChannelNumber: [u32; 1], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_AVAILABLE_CHANNEL_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_AVAILABLE_CHANNEL_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_AVAILABLE_CHANNEL_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_AVAILABLE_CHANNEL_LIST").field("Header", &self.Header).field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("uChannelNumber", &self.uChannelNumber).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_AVAILABLE_CHANNEL_LIST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.uChannelNumber == other.uChannelNumber } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_AVAILABLE_CHANNEL_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_AVAILABLE_CHANNEL_LIST { type Abi = Self; } pub const DOT11_AVAILABLE_CHANNEL_LIST_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_AVAILABLE_FREQUENCY_LIST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub uFrequencyValue: [u32; 1], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_AVAILABLE_FREQUENCY_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_AVAILABLE_FREQUENCY_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_AVAILABLE_FREQUENCY_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_AVAILABLE_FREQUENCY_LIST").field("Header", &self.Header).field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("uFrequencyValue", &self.uFrequencyValue).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_AVAILABLE_FREQUENCY_LIST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.uFrequencyValue == other.uFrequencyValue } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_AVAILABLE_FREQUENCY_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_AVAILABLE_FREQUENCY_LIST { type Abi = Self; } pub const DOT11_AVAILABLE_FREQUENCY_LIST_REVISION_1: u32 = 1u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DOT11_BAND(pub i32); pub const dot11_band_2p4g: DOT11_BAND = DOT11_BAND(1i32); pub const dot11_band_4p9g: DOT11_BAND = DOT11_BAND(2i32); pub const dot11_band_5g: DOT11_BAND = DOT11_BAND(3i32); impl ::core::convert::From<i32> for DOT11_BAND { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_BAND { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_BSSID_CANDIDATE { pub BSSID: [u8; 6], pub uFlags: u32, } impl DOT11_BSSID_CANDIDATE {} impl ::core::default::Default for DOT11_BSSID_CANDIDATE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_BSSID_CANDIDATE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_BSSID_CANDIDATE").field("BSSID", &self.BSSID).field("uFlags", &self.uFlags).finish() } } impl ::core::cmp::PartialEq for DOT11_BSSID_CANDIDATE { fn eq(&self, other: &Self) -> bool { self.BSSID == other.BSSID && self.uFlags == other.uFlags } } impl ::core::cmp::Eq for DOT11_BSSID_CANDIDATE {} unsafe impl ::windows::core::Abi for DOT11_BSSID_CANDIDATE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_BSSID_LIST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub BSSIDs: [u8; 6], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_BSSID_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_BSSID_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_BSSID_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_BSSID_LIST").field("Header", &self.Header).field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("BSSIDs", &self.BSSIDs).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_BSSID_LIST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.BSSIDs == other.BSSIDs } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_BSSID_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_BSSID_LIST { type Abi = Self; } pub const DOT11_BSSID_LIST_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_BSS_DESCRIPTION { pub uReserved: u32, pub dot11BSSID: [u8; 6], pub dot11BSSType: DOT11_BSS_TYPE, pub usBeaconPeriod: u16, pub ullTimestamp: u64, pub usCapabilityInformation: u16, pub uBufferLength: u32, pub ucBuffer: [u8; 1], } impl DOT11_BSS_DESCRIPTION {} impl ::core::default::Default for DOT11_BSS_DESCRIPTION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_BSS_DESCRIPTION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_BSS_DESCRIPTION") .field("uReserved", &self.uReserved) .field("dot11BSSID", &self.dot11BSSID) .field("dot11BSSType", &self.dot11BSSType) .field("usBeaconPeriod", &self.usBeaconPeriod) .field("ullTimestamp", &self.ullTimestamp) .field("usCapabilityInformation", &self.usCapabilityInformation) .field("uBufferLength", &self.uBufferLength) .field("ucBuffer", &self.ucBuffer) .finish() } } impl ::core::cmp::PartialEq for DOT11_BSS_DESCRIPTION { fn eq(&self, other: &Self) -> bool { self.uReserved == other.uReserved && self.dot11BSSID == other.dot11BSSID && self.dot11BSSType == other.dot11BSSType && self.usBeaconPeriod == other.usBeaconPeriod && self.ullTimestamp == other.ullTimestamp && self.usCapabilityInformation == other.usCapabilityInformation && self.uBufferLength == other.uBufferLength && self.ucBuffer == other.ucBuffer } } impl ::core::cmp::Eq for DOT11_BSS_DESCRIPTION {} unsafe impl ::windows::core::Abi for DOT11_BSS_DESCRIPTION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_BSS_ENTRY { pub uPhyId: u32, pub PhySpecificInfo: DOT11_BSS_ENTRY_PHY_SPECIFIC_INFO, pub dot11BSSID: [u8; 6], pub dot11BSSType: DOT11_BSS_TYPE, pub lRSSI: i32, pub uLinkQuality: u32, pub bInRegDomain: super::super::Foundation::BOOLEAN, pub usBeaconPeriod: u16, pub ullTimestamp: u64, pub ullHostTimestamp: u64, pub usCapabilityInformation: u16, pub uBufferLength: u32, pub ucBuffer: [u8; 1], } #[cfg(feature = "Win32_Foundation")] impl DOT11_BSS_ENTRY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_BSS_ENTRY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_BSS_ENTRY { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_BSS_ENTRY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_BSS_ENTRY { type Abi = Self; } pub const DOT11_BSS_ENTRY_BYTE_ARRAY_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub union DOT11_BSS_ENTRY_PHY_SPECIFIC_INFO { pub uChCenterFrequency: u32, pub FHSS: DOT11_BSS_ENTRY_PHY_SPECIFIC_INFO_0, } impl DOT11_BSS_ENTRY_PHY_SPECIFIC_INFO {} impl ::core::default::Default for DOT11_BSS_ENTRY_PHY_SPECIFIC_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for DOT11_BSS_ENTRY_PHY_SPECIFIC_INFO { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for DOT11_BSS_ENTRY_PHY_SPECIFIC_INFO {} unsafe impl ::windows::core::Abi for DOT11_BSS_ENTRY_PHY_SPECIFIC_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_BSS_ENTRY_PHY_SPECIFIC_INFO_0 { pub uHopPattern: u32, pub uHopSet: u32, pub uDwellTime: u32, } impl DOT11_BSS_ENTRY_PHY_SPECIFIC_INFO_0 {} impl ::core::default::Default for DOT11_BSS_ENTRY_PHY_SPECIFIC_INFO_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_BSS_ENTRY_PHY_SPECIFIC_INFO_0 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("_FHSS_e__Struct").field("uHopPattern", &self.uHopPattern).field("uHopSet", &self.uHopSet).field("uDwellTime", &self.uDwellTime).finish() } } impl ::core::cmp::PartialEq for DOT11_BSS_ENTRY_PHY_SPECIFIC_INFO_0 { fn eq(&self, other: &Self) -> bool { self.uHopPattern == other.uHopPattern && self.uHopSet == other.uHopSet && self.uDwellTime == other.uDwellTime } } impl ::core::cmp::Eq for DOT11_BSS_ENTRY_PHY_SPECIFIC_INFO_0 {} unsafe impl ::windows::core::Abi for DOT11_BSS_ENTRY_PHY_SPECIFIC_INFO_0 { 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 DOT11_BSS_TYPE(pub i32); pub const dot11_BSS_type_infrastructure: DOT11_BSS_TYPE = DOT11_BSS_TYPE(1i32); pub const dot11_BSS_type_independent: DOT11_BSS_TYPE = DOT11_BSS_TYPE(2i32); pub const dot11_BSS_type_any: DOT11_BSS_TYPE = DOT11_BSS_TYPE(3i32); impl ::core::convert::From<i32> for DOT11_BSS_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_BSS_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_BYTE_ARRAY { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfBytes: u32, pub uTotalNumOfBytes: u32, pub ucBuffer: [u8; 1], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_BYTE_ARRAY {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_BYTE_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_BYTE_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_BYTE_ARRAY").field("Header", &self.Header).field("uNumOfBytes", &self.uNumOfBytes).field("uTotalNumOfBytes", &self.uTotalNumOfBytes).field("ucBuffer", &self.ucBuffer).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_BYTE_ARRAY { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfBytes == other.uNumOfBytes && self.uTotalNumOfBytes == other.uTotalNumOfBytes && self.ucBuffer == other.ucBuffer } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_BYTE_ARRAY {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_BYTE_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_CAN_SUSTAIN_AP_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub ulReason: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_CAN_SUSTAIN_AP_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_CAN_SUSTAIN_AP_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_CAN_SUSTAIN_AP_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_CAN_SUSTAIN_AP_PARAMETERS").field("Header", &self.Header).field("ulReason", &self.ulReason).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_CAN_SUSTAIN_AP_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.ulReason == other.ulReason } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_CAN_SUSTAIN_AP_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_CAN_SUSTAIN_AP_PARAMETERS { type Abi = Self; } pub const DOT11_CAN_SUSTAIN_AP_PARAMETERS_REVISION_1: u32 = 1u32; pub const DOT11_CAN_SUSTAIN_AP_REASON_IHV_END: u32 = 4294967295u32; pub const DOT11_CAN_SUSTAIN_AP_REASON_IHV_START: u32 = 4278190080u32; pub const DOT11_CAPABILITY_CHANNEL_AGILITY: u32 = 128u32; pub const DOT11_CAPABILITY_DSSSOFDM: u32 = 8192u32; pub const DOT11_CAPABILITY_INFO_CF_POLLABLE: u32 = 4u32; pub const DOT11_CAPABILITY_INFO_CF_POLL_REQ: u32 = 8u32; pub const DOT11_CAPABILITY_INFO_ESS: u32 = 1u32; pub const DOT11_CAPABILITY_INFO_IBSS: u32 = 2u32; pub const DOT11_CAPABILITY_INFO_PRIVACY: u32 = 16u32; pub const DOT11_CAPABILITY_PBCC: u32 = 64u32; pub const DOT11_CAPABILITY_SHORT_PREAMBLE: u32 = 32u32; pub const DOT11_CAPABILITY_SHORT_SLOT_TIME: u32 = 1024u32; pub const DOT11_CCA_MODE_CS_ONLY: u32 = 2u32; pub const DOT11_CCA_MODE_CS_WITH_TIMER: u32 = 8u32; pub const DOT11_CCA_MODE_ED_ONLY: u32 = 1u32; pub const DOT11_CCA_MODE_ED_and_CS: u32 = 4u32; pub const DOT11_CCA_MODE_HRCS_AND_ED: u32 = 16u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_CHANNEL_HINT { pub Dot11PhyType: DOT11_PHY_TYPE, pub uChannelNumber: u32, } impl DOT11_CHANNEL_HINT {} impl ::core::default::Default for DOT11_CHANNEL_HINT { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_CHANNEL_HINT { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_CHANNEL_HINT").field("Dot11PhyType", &self.Dot11PhyType).field("uChannelNumber", &self.uChannelNumber).finish() } } impl ::core::cmp::PartialEq for DOT11_CHANNEL_HINT { fn eq(&self, other: &Self) -> bool { self.Dot11PhyType == other.Dot11PhyType && self.uChannelNumber == other.uChannelNumber } } impl ::core::cmp::Eq for DOT11_CHANNEL_HINT {} unsafe impl ::windows::core::Abi for DOT11_CHANNEL_HINT { 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 DOT11_CIPHER_ALGORITHM(pub i32); pub const DOT11_CIPHER_ALGO_NONE: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(0i32); pub const DOT11_CIPHER_ALGO_WEP40: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(1i32); pub const DOT11_CIPHER_ALGO_TKIP: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(2i32); pub const DOT11_CIPHER_ALGO_CCMP: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(4i32); pub const DOT11_CIPHER_ALGO_WEP104: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(5i32); pub const DOT11_CIPHER_ALGO_BIP: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(6i32); pub const DOT11_CIPHER_ALGO_GCMP: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(8i32); pub const DOT11_CIPHER_ALGO_GCMP_256: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(9i32); pub const DOT11_CIPHER_ALGO_CCMP_256: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(10i32); pub const DOT11_CIPHER_ALGO_BIP_GMAC_128: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(11i32); pub const DOT11_CIPHER_ALGO_BIP_GMAC_256: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(12i32); pub const DOT11_CIPHER_ALGO_BIP_CMAC_256: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(13i32); pub const DOT11_CIPHER_ALGO_WPA_USE_GROUP: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(256i32); pub const DOT11_CIPHER_ALGO_RSN_USE_GROUP: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(256i32); pub const DOT11_CIPHER_ALGO_WEP: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(257i32); pub const DOT11_CIPHER_ALGO_IHV_START: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(-2147483648i32); pub const DOT11_CIPHER_ALGO_IHV_END: DOT11_CIPHER_ALGORITHM = DOT11_CIPHER_ALGORITHM(-1i32); impl ::core::convert::From<i32> for DOT11_CIPHER_ALGORITHM { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_CIPHER_ALGORITHM { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_CIPHER_ALGORITHM_LIST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub AlgorithmIds: [DOT11_CIPHER_ALGORITHM; 1], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_CIPHER_ALGORITHM_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_CIPHER_ALGORITHM_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_CIPHER_ALGORITHM_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_CIPHER_ALGORITHM_LIST").field("Header", &self.Header).field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("AlgorithmIds", &self.AlgorithmIds).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_CIPHER_ALGORITHM_LIST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.AlgorithmIds == other.AlgorithmIds } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_CIPHER_ALGORITHM_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_CIPHER_ALGORITHM_LIST { type Abi = Self; } pub const DOT11_CIPHER_ALGORITHM_LIST_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_CIPHER_DEFAULT_KEY_VALUE { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uKeyIndex: u32, pub AlgorithmId: DOT11_CIPHER_ALGORITHM, pub MacAddr: [u8; 6], pub bDelete: super::super::Foundation::BOOLEAN, pub bStatic: super::super::Foundation::BOOLEAN, pub usKeyLength: u16, pub ucKey: [u8; 1], } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_CIPHER_DEFAULT_KEY_VALUE {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_CIPHER_DEFAULT_KEY_VALUE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_CIPHER_DEFAULT_KEY_VALUE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_CIPHER_DEFAULT_KEY_VALUE") .field("Header", &self.Header) .field("uKeyIndex", &self.uKeyIndex) .field("AlgorithmId", &self.AlgorithmId) .field("MacAddr", &self.MacAddr) .field("bDelete", &self.bDelete) .field("bStatic", &self.bStatic) .field("usKeyLength", &self.usKeyLength) .field("ucKey", &self.ucKey) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_CIPHER_DEFAULT_KEY_VALUE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uKeyIndex == other.uKeyIndex && self.AlgorithmId == other.AlgorithmId && self.MacAddr == other.MacAddr && self.bDelete == other.bDelete && self.bStatic == other.bStatic && self.usKeyLength == other.usKeyLength && self.ucKey == other.ucKey } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_CIPHER_DEFAULT_KEY_VALUE {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_CIPHER_DEFAULT_KEY_VALUE { type Abi = Self; } pub const DOT11_CIPHER_DEFAULT_KEY_VALUE_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_CIPHER_KEY_MAPPING_KEY_VALUE { pub PeerMacAddr: [u8; 6], pub AlgorithmId: DOT11_CIPHER_ALGORITHM, pub Direction: DOT11_DIRECTION, pub bDelete: super::super::Foundation::BOOLEAN, pub bStatic: super::super::Foundation::BOOLEAN, pub usKeyLength: u16, pub ucKey: [u8; 1], } #[cfg(feature = "Win32_Foundation")] impl DOT11_CIPHER_KEY_MAPPING_KEY_VALUE {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_CIPHER_KEY_MAPPING_KEY_VALUE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_CIPHER_KEY_MAPPING_KEY_VALUE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_CIPHER_KEY_MAPPING_KEY_VALUE") .field("PeerMacAddr", &self.PeerMacAddr) .field("AlgorithmId", &self.AlgorithmId) .field("Direction", &self.Direction) .field("bDelete", &self.bDelete) .field("bStatic", &self.bStatic) .field("usKeyLength", &self.usKeyLength) .field("ucKey", &self.ucKey) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_CIPHER_KEY_MAPPING_KEY_VALUE { fn eq(&self, other: &Self) -> bool { self.PeerMacAddr == other.PeerMacAddr && self.AlgorithmId == other.AlgorithmId && self.Direction == other.Direction && self.bDelete == other.bDelete && self.bStatic == other.bStatic && self.usKeyLength == other.usKeyLength && self.ucKey == other.ucKey } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_CIPHER_KEY_MAPPING_KEY_VALUE {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_CIPHER_KEY_MAPPING_KEY_VALUE { type Abi = Self; } pub const DOT11_CIPHER_KEY_MAPPING_KEY_VALUE_BYTE_ARRAY_REVISION_1: u32 = 1u32; pub const DOT11_CONF_ALGO_TKIP: u32 = 2u32; pub const DOT11_CONF_ALGO_WEP_RC4: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_CONNECTION_COMPLETION_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uStatus: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_CONNECTION_COMPLETION_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_CONNECTION_COMPLETION_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_CONNECTION_COMPLETION_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_CONNECTION_COMPLETION_PARAMETERS").field("Header", &self.Header).field("uStatus", &self.uStatus).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_CONNECTION_COMPLETION_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uStatus == other.uStatus } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_CONNECTION_COMPLETION_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_CONNECTION_COMPLETION_PARAMETERS { type Abi = Self; } pub const DOT11_CONNECTION_COMPLETION_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_CONNECTION_START_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub BSSType: DOT11_BSS_TYPE, pub AdhocBSSID: [u8; 6], pub AdhocSSID: DOT11_SSID, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_CONNECTION_START_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_CONNECTION_START_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_CONNECTION_START_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_CONNECTION_START_PARAMETERS").field("Header", &self.Header).field("BSSType", &self.BSSType).field("AdhocBSSID", &self.AdhocBSSID).field("AdhocSSID", &self.AdhocSSID).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_CONNECTION_START_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.BSSType == other.BSSType && self.AdhocBSSID == other.AdhocBSSID && self.AdhocSSID == other.AdhocSSID } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_CONNECTION_START_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_CONNECTION_START_PARAMETERS { type Abi = Self; } pub const DOT11_CONNECTION_START_PARAMETERS_REVISION_1: u32 = 1u32; pub const DOT11_CONNECTION_STATUS_SUCCESS: u32 = 0u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_COUNTERS_ENTRY { pub uTransmittedFragmentCount: u32, pub uMulticastTransmittedFrameCount: u32, pub uFailedCount: u32, pub uRetryCount: u32, pub uMultipleRetryCount: u32, pub uFrameDuplicateCount: u32, pub uRTSSuccessCount: u32, pub uRTSFailureCount: u32, pub uACKFailureCount: u32, pub uReceivedFragmentCount: u32, pub uMulticastReceivedFrameCount: u32, pub uFCSErrorCount: u32, pub uTransmittedFrameCount: u32, } impl DOT11_COUNTERS_ENTRY {} impl ::core::default::Default for DOT11_COUNTERS_ENTRY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_COUNTERS_ENTRY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_COUNTERS_ENTRY") .field("uTransmittedFragmentCount", &self.uTransmittedFragmentCount) .field("uMulticastTransmittedFrameCount", &self.uMulticastTransmittedFrameCount) .field("uFailedCount", &self.uFailedCount) .field("uRetryCount", &self.uRetryCount) .field("uMultipleRetryCount", &self.uMultipleRetryCount) .field("uFrameDuplicateCount", &self.uFrameDuplicateCount) .field("uRTSSuccessCount", &self.uRTSSuccessCount) .field("uRTSFailureCount", &self.uRTSFailureCount) .field("uACKFailureCount", &self.uACKFailureCount) .field("uReceivedFragmentCount", &self.uReceivedFragmentCount) .field("uMulticastReceivedFrameCount", &self.uMulticastReceivedFrameCount) .field("uFCSErrorCount", &self.uFCSErrorCount) .field("uTransmittedFrameCount", &self.uTransmittedFrameCount) .finish() } } impl ::core::cmp::PartialEq for DOT11_COUNTERS_ENTRY { fn eq(&self, other: &Self) -> bool { self.uTransmittedFragmentCount == other.uTransmittedFragmentCount && self.uMulticastTransmittedFrameCount == other.uMulticastTransmittedFrameCount && self.uFailedCount == other.uFailedCount && self.uRetryCount == other.uRetryCount && self.uMultipleRetryCount == other.uMultipleRetryCount && self.uFrameDuplicateCount == other.uFrameDuplicateCount && self.uRTSSuccessCount == other.uRTSSuccessCount && self.uRTSFailureCount == other.uRTSFailureCount && self.uACKFailureCount == other.uACKFailureCount && self.uReceivedFragmentCount == other.uReceivedFragmentCount && self.uMulticastReceivedFrameCount == other.uMulticastReceivedFrameCount && self.uFCSErrorCount == other.uFCSErrorCount && self.uTransmittedFrameCount == other.uTransmittedFrameCount } } impl ::core::cmp::Eq for DOT11_COUNTERS_ENTRY {} unsafe impl ::windows::core::Abi for DOT11_COUNTERS_ENTRY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_COUNTRY_OR_REGION_STRING_LIST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub CountryOrRegionStrings: [u8; 3], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_COUNTRY_OR_REGION_STRING_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_COUNTRY_OR_REGION_STRING_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_COUNTRY_OR_REGION_STRING_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_COUNTRY_OR_REGION_STRING_LIST").field("Header", &self.Header).field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("CountryOrRegionStrings", &self.CountryOrRegionStrings).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_COUNTRY_OR_REGION_STRING_LIST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.CountryOrRegionStrings == other.CountryOrRegionStrings } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_COUNTRY_OR_REGION_STRING_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_COUNTRY_OR_REGION_STRING_LIST { type Abi = Self; } pub const DOT11_COUNTRY_OR_REGION_STRING_LIST_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_CURRENT_OFFLOAD_CAPABILITY { pub uReserved: u32, pub uFlags: u32, } impl DOT11_CURRENT_OFFLOAD_CAPABILITY {} impl ::core::default::Default for DOT11_CURRENT_OFFLOAD_CAPABILITY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_CURRENT_OFFLOAD_CAPABILITY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_CURRENT_OFFLOAD_CAPABILITY").field("uReserved", &self.uReserved).field("uFlags", &self.uFlags).finish() } } impl ::core::cmp::PartialEq for DOT11_CURRENT_OFFLOAD_CAPABILITY { fn eq(&self, other: &Self) -> bool { self.uReserved == other.uReserved && self.uFlags == other.uFlags } } impl ::core::cmp::Eq for DOT11_CURRENT_OFFLOAD_CAPABILITY {} unsafe impl ::windows::core::Abi for DOT11_CURRENT_OFFLOAD_CAPABILITY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_CURRENT_OPERATION_MODE { pub uReserved: u32, pub uCurrentOpMode: u32, } impl DOT11_CURRENT_OPERATION_MODE {} impl ::core::default::Default for DOT11_CURRENT_OPERATION_MODE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_CURRENT_OPERATION_MODE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_CURRENT_OPERATION_MODE").field("uReserved", &self.uReserved).field("uCurrentOpMode", &self.uCurrentOpMode).finish() } } impl ::core::cmp::PartialEq for DOT11_CURRENT_OPERATION_MODE { fn eq(&self, other: &Self) -> bool { self.uReserved == other.uReserved && self.uCurrentOpMode == other.uCurrentOpMode } } impl ::core::cmp::Eq for DOT11_CURRENT_OPERATION_MODE {} unsafe impl ::windows::core::Abi for DOT11_CURRENT_OPERATION_MODE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_CURRENT_OPTIONAL_CAPABILITY { pub uReserved: u32, pub bDot11CFPollable: super::super::Foundation::BOOLEAN, pub bDot11PCF: super::super::Foundation::BOOLEAN, pub bDot11PCFMPDUTransferToPC: super::super::Foundation::BOOLEAN, pub bStrictlyOrderedServiceClass: super::super::Foundation::BOOLEAN, } #[cfg(feature = "Win32_Foundation")] impl DOT11_CURRENT_OPTIONAL_CAPABILITY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_CURRENT_OPTIONAL_CAPABILITY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_CURRENT_OPTIONAL_CAPABILITY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_CURRENT_OPTIONAL_CAPABILITY") .field("uReserved", &self.uReserved) .field("bDot11CFPollable", &self.bDot11CFPollable) .field("bDot11PCF", &self.bDot11PCF) .field("bDot11PCFMPDUTransferToPC", &self.bDot11PCFMPDUTransferToPC) .field("bStrictlyOrderedServiceClass", &self.bStrictlyOrderedServiceClass) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_CURRENT_OPTIONAL_CAPABILITY { fn eq(&self, other: &Self) -> bool { self.uReserved == other.uReserved && self.bDot11CFPollable == other.bDot11CFPollable && self.bDot11PCF == other.bDot11PCF && self.bDot11PCFMPDUTransferToPC == other.bDot11PCFMPDUTransferToPC && self.bStrictlyOrderedServiceClass == other.bStrictlyOrderedServiceClass } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_CURRENT_OPTIONAL_CAPABILITY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_CURRENT_OPTIONAL_CAPABILITY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_DATA_RATE_MAPPING_ENTRY { pub ucDataRateIndex: u8, pub ucDataRateFlag: u8, pub usDataRateValue: u16, } impl DOT11_DATA_RATE_MAPPING_ENTRY {} impl ::core::default::Default for DOT11_DATA_RATE_MAPPING_ENTRY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_DATA_RATE_MAPPING_ENTRY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_DATA_RATE_MAPPING_ENTRY").field("ucDataRateIndex", &self.ucDataRateIndex).field("ucDataRateFlag", &self.ucDataRateFlag).field("usDataRateValue", &self.usDataRateValue).finish() } } impl ::core::cmp::PartialEq for DOT11_DATA_RATE_MAPPING_ENTRY { fn eq(&self, other: &Self) -> bool { self.ucDataRateIndex == other.ucDataRateIndex && self.ucDataRateFlag == other.ucDataRateFlag && self.usDataRateValue == other.usDataRateValue } } impl ::core::cmp::Eq for DOT11_DATA_RATE_MAPPING_ENTRY {} unsafe impl ::windows::core::Abi for DOT11_DATA_RATE_MAPPING_ENTRY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_DATA_RATE_MAPPING_TABLE { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uDataRateMappingLength: u32, pub DataRateMappingEntries: [DOT11_DATA_RATE_MAPPING_ENTRY; 126], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_DATA_RATE_MAPPING_TABLE {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_DATA_RATE_MAPPING_TABLE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_DATA_RATE_MAPPING_TABLE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_DATA_RATE_MAPPING_TABLE").field("Header", &self.Header).field("uDataRateMappingLength", &self.uDataRateMappingLength).field("DataRateMappingEntries", &self.DataRateMappingEntries).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_DATA_RATE_MAPPING_TABLE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uDataRateMappingLength == other.uDataRateMappingLength && self.DataRateMappingEntries == other.DataRateMappingEntries } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_DATA_RATE_MAPPING_TABLE {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_DATA_RATE_MAPPING_TABLE { type Abi = Self; } pub const DOT11_DATA_RATE_MAPPING_TABLE_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_DEFAULT_WEP_OFFLOAD { pub uReserved: u32, pub hOffloadContext: super::super::Foundation::HANDLE, pub hOffload: super::super::Foundation::HANDLE, pub dwIndex: u32, pub dot11OffloadType: DOT11_OFFLOAD_TYPE, pub dwAlgorithm: u32, pub uFlags: u32, pub dot11KeyDirection: DOT11_KEY_DIRECTION, pub ucMacAddress: [u8; 6], pub uNumOfRWsOnMe: u32, pub dot11IV48Counters: [DOT11_IV48_COUNTER; 16], pub usDot11RWBitMaps: [u16; 16], pub usKeyLength: u16, pub ucKey: [u8; 1], } #[cfg(feature = "Win32_Foundation")] impl DOT11_DEFAULT_WEP_OFFLOAD {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_DEFAULT_WEP_OFFLOAD { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_DEFAULT_WEP_OFFLOAD { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_DEFAULT_WEP_OFFLOAD") .field("uReserved", &self.uReserved) .field("hOffloadContext", &self.hOffloadContext) .field("hOffload", &self.hOffload) .field("dwIndex", &self.dwIndex) .field("dot11OffloadType", &self.dot11OffloadType) .field("dwAlgorithm", &self.dwAlgorithm) .field("uFlags", &self.uFlags) .field("dot11KeyDirection", &self.dot11KeyDirection) .field("ucMacAddress", &self.ucMacAddress) .field("uNumOfRWsOnMe", &self.uNumOfRWsOnMe) .field("dot11IV48Counters", &self.dot11IV48Counters) .field("usDot11RWBitMaps", &self.usDot11RWBitMaps) .field("usKeyLength", &self.usKeyLength) .field("ucKey", &self.ucKey) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_DEFAULT_WEP_OFFLOAD { fn eq(&self, other: &Self) -> bool { self.uReserved == other.uReserved && self.hOffloadContext == other.hOffloadContext && self.hOffload == other.hOffload && self.dwIndex == other.dwIndex && self.dot11OffloadType == other.dot11OffloadType && self.dwAlgorithm == other.dwAlgorithm && self.uFlags == other.uFlags && self.dot11KeyDirection == other.dot11KeyDirection && self.ucMacAddress == other.ucMacAddress && self.uNumOfRWsOnMe == other.uNumOfRWsOnMe && self.dot11IV48Counters == other.dot11IV48Counters && self.usDot11RWBitMaps == other.usDot11RWBitMaps && self.usKeyLength == other.usKeyLength && self.ucKey == other.ucKey } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_DEFAULT_WEP_OFFLOAD {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_DEFAULT_WEP_OFFLOAD { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_DEFAULT_WEP_UPLOAD { pub uReserved: u32, pub dot11OffloadType: DOT11_OFFLOAD_TYPE, pub hOffload: super::super::Foundation::HANDLE, pub uNumOfRWsUsed: u32, pub dot11IV48Counters: [DOT11_IV48_COUNTER; 16], pub usDot11RWBitMaps: [u16; 16], } #[cfg(feature = "Win32_Foundation")] impl DOT11_DEFAULT_WEP_UPLOAD {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_DEFAULT_WEP_UPLOAD { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_DEFAULT_WEP_UPLOAD { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_DEFAULT_WEP_UPLOAD") .field("uReserved", &self.uReserved) .field("dot11OffloadType", &self.dot11OffloadType) .field("hOffload", &self.hOffload) .field("uNumOfRWsUsed", &self.uNumOfRWsUsed) .field("dot11IV48Counters", &self.dot11IV48Counters) .field("usDot11RWBitMaps", &self.usDot11RWBitMaps) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_DEFAULT_WEP_UPLOAD { fn eq(&self, other: &Self) -> bool { self.uReserved == other.uReserved && self.dot11OffloadType == other.dot11OffloadType && self.hOffload == other.hOffload && self.uNumOfRWsUsed == other.uNumOfRWsUsed && self.dot11IV48Counters == other.dot11IV48Counters && self.usDot11RWBitMaps == other.usDot11RWBitMaps } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_DEFAULT_WEP_UPLOAD {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_DEFAULT_WEP_UPLOAD { type Abi = Self; } pub const DOT11_DEVICE_ENTRY_BYTE_ARRAY_REVISION_1: u32 = 1u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DOT11_DIRECTION(pub i32); pub const DOT11_DIR_INBOUND: DOT11_DIRECTION = DOT11_DIRECTION(1i32); pub const DOT11_DIR_OUTBOUND: DOT11_DIRECTION = DOT11_DIRECTION(2i32); pub const DOT11_DIR_BOTH: DOT11_DIRECTION = DOT11_DIRECTION(3i32); impl ::core::convert::From<i32> for DOT11_DIRECTION { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_DIRECTION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_DISASSOCIATE_PEER_REQUEST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerMacAddr: [u8; 6], pub usReason: u16, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_DISASSOCIATE_PEER_REQUEST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_DISASSOCIATE_PEER_REQUEST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_DISASSOCIATE_PEER_REQUEST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_DISASSOCIATE_PEER_REQUEST").field("Header", &self.Header).field("PeerMacAddr", &self.PeerMacAddr).field("usReason", &self.usReason).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_DISASSOCIATE_PEER_REQUEST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerMacAddr == other.PeerMacAddr && self.usReason == other.usReason } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_DISASSOCIATE_PEER_REQUEST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_DISASSOCIATE_PEER_REQUEST { type Abi = Self; } pub const DOT11_DISASSOCIATE_PEER_REQUEST_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_DISASSOCIATION_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub MacAddr: [u8; 6], pub uReason: u32, pub uIHVDataOffset: u32, pub uIHVDataSize: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_DISASSOCIATION_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_DISASSOCIATION_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_DISASSOCIATION_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_DISASSOCIATION_PARAMETERS").field("Header", &self.Header).field("MacAddr", &self.MacAddr).field("uReason", &self.uReason).field("uIHVDataOffset", &self.uIHVDataOffset).field("uIHVDataSize", &self.uIHVDataSize).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_DISASSOCIATION_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.MacAddr == other.MacAddr && self.uReason == other.uReason && self.uIHVDataOffset == other.uIHVDataOffset && self.uIHVDataSize == other.uIHVDataSize } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_DISASSOCIATION_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_DISASSOCIATION_PARAMETERS { type Abi = Self; } pub const DOT11_DISASSOCIATION_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_DIVERSITY_SELECTION_RX { pub uAntennaListIndex: u32, pub bDiversitySelectionRX: super::super::Foundation::BOOLEAN, } #[cfg(feature = "Win32_Foundation")] impl DOT11_DIVERSITY_SELECTION_RX {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_DIVERSITY_SELECTION_RX { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_DIVERSITY_SELECTION_RX { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_DIVERSITY_SELECTION_RX").field("uAntennaListIndex", &self.uAntennaListIndex).field("bDiversitySelectionRX", &self.bDiversitySelectionRX).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_DIVERSITY_SELECTION_RX { fn eq(&self, other: &Self) -> bool { self.uAntennaListIndex == other.uAntennaListIndex && self.bDiversitySelectionRX == other.bDiversitySelectionRX } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_DIVERSITY_SELECTION_RX {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_DIVERSITY_SELECTION_RX { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_DIVERSITY_SELECTION_RX_LIST { pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub dot11DiversitySelectionRx: [DOT11_DIVERSITY_SELECTION_RX; 1], } #[cfg(feature = "Win32_Foundation")] impl DOT11_DIVERSITY_SELECTION_RX_LIST {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_DIVERSITY_SELECTION_RX_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_DIVERSITY_SELECTION_RX_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_DIVERSITY_SELECTION_RX_LIST").field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("dot11DiversitySelectionRx", &self.dot11DiversitySelectionRx).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_DIVERSITY_SELECTION_RX_LIST { fn eq(&self, other: &Self) -> bool { self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.dot11DiversitySelectionRx == other.dot11DiversitySelectionRx } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_DIVERSITY_SELECTION_RX_LIST {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_DIVERSITY_SELECTION_RX_LIST { 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 DOT11_DIVERSITY_SUPPORT(pub i32); pub const dot11_diversity_support_unknown: DOT11_DIVERSITY_SUPPORT = DOT11_DIVERSITY_SUPPORT(0i32); pub const dot11_diversity_support_fixedlist: DOT11_DIVERSITY_SUPPORT = DOT11_DIVERSITY_SUPPORT(1i32); pub const dot11_diversity_support_notsupported: DOT11_DIVERSITY_SUPPORT = DOT11_DIVERSITY_SUPPORT(2i32); pub const dot11_diversity_support_dynamic: DOT11_DIVERSITY_SUPPORT = DOT11_DIVERSITY_SUPPORT(3i32); impl ::core::convert::From<i32> for DOT11_DIVERSITY_SUPPORT { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_DIVERSITY_SUPPORT { 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 DOT11_DS_INFO(pub i32); pub const DOT11_DS_CHANGED: DOT11_DS_INFO = DOT11_DS_INFO(0i32); pub const DOT11_DS_UNCHANGED: DOT11_DS_INFO = DOT11_DS_INFO(1i32); pub const DOT11_DS_UNKNOWN: DOT11_DS_INFO = DOT11_DS_INFO(2i32); impl ::core::convert::From<i32> for DOT11_DS_INFO { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_DS_INFO { type Abi = Self; } pub const DOT11_ENCAP_802_1H: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_ENCAP_ENTRY { pub usEtherType: u16, pub usEncapType: u16, } impl DOT11_ENCAP_ENTRY {} impl ::core::default::Default for DOT11_ENCAP_ENTRY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_ENCAP_ENTRY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_ENCAP_ENTRY").field("usEtherType", &self.usEtherType).field("usEncapType", &self.usEncapType).finish() } } impl ::core::cmp::PartialEq for DOT11_ENCAP_ENTRY { fn eq(&self, other: &Self) -> bool { self.usEtherType == other.usEtherType && self.usEncapType == other.usEncapType } } impl ::core::cmp::Eq for DOT11_ENCAP_ENTRY {} unsafe impl ::windows::core::Abi for DOT11_ENCAP_ENTRY { type Abi = Self; } pub const DOT11_ENCAP_RFC_1042: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_ERP_PHY_ATTRIBUTES { pub HRDSSSAttributes: DOT11_HRDSSS_PHY_ATTRIBUTES, pub bERPPBCCOptionImplemented: super::super::Foundation::BOOLEAN, pub bDSSSOFDMOptionImplemented: super::super::Foundation::BOOLEAN, pub bShortSlotTimeOptionImplemented: super::super::Foundation::BOOLEAN, } #[cfg(feature = "Win32_Foundation")] impl DOT11_ERP_PHY_ATTRIBUTES {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_ERP_PHY_ATTRIBUTES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_ERP_PHY_ATTRIBUTES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_ERP_PHY_ATTRIBUTES") .field("HRDSSSAttributes", &self.HRDSSSAttributes) .field("bERPPBCCOptionImplemented", &self.bERPPBCCOptionImplemented) .field("bDSSSOFDMOptionImplemented", &self.bDSSSOFDMOptionImplemented) .field("bShortSlotTimeOptionImplemented", &self.bShortSlotTimeOptionImplemented) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_ERP_PHY_ATTRIBUTES { fn eq(&self, other: &Self) -> bool { self.HRDSSSAttributes == other.HRDSSSAttributes && self.bERPPBCCOptionImplemented == other.bERPPBCCOptionImplemented && self.bDSSSOFDMOptionImplemented == other.bDSSSOFDMOptionImplemented && self.bShortSlotTimeOptionImplemented == other.bShortSlotTimeOptionImplemented } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_ERP_PHY_ATTRIBUTES {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_ERP_PHY_ATTRIBUTES { type Abi = Self; } pub const DOT11_EXEMPT_ALWAYS: u32 = 1u32; pub const DOT11_EXEMPT_BOTH: u32 = 3u32; pub const DOT11_EXEMPT_MULTICAST: u32 = 2u32; pub const DOT11_EXEMPT_NO_EXEMPTION: u32 = 0u32; pub const DOT11_EXEMPT_ON_KEY_MAPPING_KEY_UNAVAILABLE: u32 = 2u32; pub const DOT11_EXEMPT_UNICAST: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_EXTAP_ATTRIBUTES { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uScanSSIDListSize: u32, pub uDesiredSSIDListSize: u32, pub uPrivacyExemptionListSize: u32, pub uAssociationTableSize: u32, pub uDefaultKeyTableSize: u32, pub uWEPKeyValueMaxLength: u32, pub bStrictlyOrderedServiceClassImplemented: super::super::Foundation::BOOLEAN, pub uNumSupportedCountryOrRegionStrings: u32, pub pSupportedCountryOrRegionStrings: *mut u8, pub uInfraNumSupportedUcastAlgoPairs: u32, pub pInfraSupportedUcastAlgoPairs: *mut DOT11_AUTH_CIPHER_PAIR, pub uInfraNumSupportedMcastAlgoPairs: u32, pub pInfraSupportedMcastAlgoPairs: *mut DOT11_AUTH_CIPHER_PAIR, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_EXTAP_ATTRIBUTES {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_EXTAP_ATTRIBUTES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_EXTAP_ATTRIBUTES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_EXTAP_ATTRIBUTES") .field("Header", &self.Header) .field("uScanSSIDListSize", &self.uScanSSIDListSize) .field("uDesiredSSIDListSize", &self.uDesiredSSIDListSize) .field("uPrivacyExemptionListSize", &self.uPrivacyExemptionListSize) .field("uAssociationTableSize", &self.uAssociationTableSize) .field("uDefaultKeyTableSize", &self.uDefaultKeyTableSize) .field("uWEPKeyValueMaxLength", &self.uWEPKeyValueMaxLength) .field("bStrictlyOrderedServiceClassImplemented", &self.bStrictlyOrderedServiceClassImplemented) .field("uNumSupportedCountryOrRegionStrings", &self.uNumSupportedCountryOrRegionStrings) .field("pSupportedCountryOrRegionStrings", &self.pSupportedCountryOrRegionStrings) .field("uInfraNumSupportedUcastAlgoPairs", &self.uInfraNumSupportedUcastAlgoPairs) .field("pInfraSupportedUcastAlgoPairs", &self.pInfraSupportedUcastAlgoPairs) .field("uInfraNumSupportedMcastAlgoPairs", &self.uInfraNumSupportedMcastAlgoPairs) .field("pInfraSupportedMcastAlgoPairs", &self.pInfraSupportedMcastAlgoPairs) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_EXTAP_ATTRIBUTES { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uScanSSIDListSize == other.uScanSSIDListSize && self.uDesiredSSIDListSize == other.uDesiredSSIDListSize && self.uPrivacyExemptionListSize == other.uPrivacyExemptionListSize && self.uAssociationTableSize == other.uAssociationTableSize && self.uDefaultKeyTableSize == other.uDefaultKeyTableSize && self.uWEPKeyValueMaxLength == other.uWEPKeyValueMaxLength && self.bStrictlyOrderedServiceClassImplemented == other.bStrictlyOrderedServiceClassImplemented && self.uNumSupportedCountryOrRegionStrings == other.uNumSupportedCountryOrRegionStrings && self.pSupportedCountryOrRegionStrings == other.pSupportedCountryOrRegionStrings && self.uInfraNumSupportedUcastAlgoPairs == other.uInfraNumSupportedUcastAlgoPairs && self.pInfraSupportedUcastAlgoPairs == other.pInfraSupportedUcastAlgoPairs && self.uInfraNumSupportedMcastAlgoPairs == other.uInfraNumSupportedMcastAlgoPairs && self.pInfraSupportedMcastAlgoPairs == other.pInfraSupportedMcastAlgoPairs } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_EXTAP_ATTRIBUTES {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_EXTAP_ATTRIBUTES { type Abi = Self; } pub const DOT11_EXTAP_ATTRIBUTES_REVISION_1: u32 = 1u32; pub const DOT11_EXTAP_RECV_CONTEXT_REVISION_1: u32 = 1u32; pub const DOT11_EXTAP_SEND_CONTEXT_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_EXTSTA_ATTRIBUTES { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uScanSSIDListSize: u32, pub uDesiredBSSIDListSize: u32, pub uDesiredSSIDListSize: u32, pub uExcludedMacAddressListSize: u32, pub uPrivacyExemptionListSize: u32, pub uKeyMappingTableSize: u32, pub uDefaultKeyTableSize: u32, pub uWEPKeyValueMaxLength: u32, pub uPMKIDCacheSize: u32, pub uMaxNumPerSTADefaultKeyTables: u32, pub bStrictlyOrderedServiceClassImplemented: super::super::Foundation::BOOLEAN, pub ucSupportedQoSProtocolFlags: u8, pub bSafeModeImplemented: super::super::Foundation::BOOLEAN, pub uNumSupportedCountryOrRegionStrings: u32, pub pSupportedCountryOrRegionStrings: *mut u8, pub uInfraNumSupportedUcastAlgoPairs: u32, pub pInfraSupportedUcastAlgoPairs: *mut DOT11_AUTH_CIPHER_PAIR, pub uInfraNumSupportedMcastAlgoPairs: u32, pub pInfraSupportedMcastAlgoPairs: *mut DOT11_AUTH_CIPHER_PAIR, pub uAdhocNumSupportedUcastAlgoPairs: u32, pub pAdhocSupportedUcastAlgoPairs: *mut DOT11_AUTH_CIPHER_PAIR, pub uAdhocNumSupportedMcastAlgoPairs: u32, pub pAdhocSupportedMcastAlgoPairs: *mut DOT11_AUTH_CIPHER_PAIR, pub bAutoPowerSaveMode: super::super::Foundation::BOOLEAN, pub uMaxNetworkOffloadListSize: u32, pub bMFPCapable: super::super::Foundation::BOOLEAN, pub uInfraNumSupportedMcastMgmtAlgoPairs: u32, pub pInfraSupportedMcastMgmtAlgoPairs: *mut DOT11_AUTH_CIPHER_PAIR, pub bNeighborReportSupported: super::super::Foundation::BOOLEAN, pub bAPChannelReportSupported: super::super::Foundation::BOOLEAN, pub bActionFramesSupported: super::super::Foundation::BOOLEAN, pub bANQPQueryOffloadSupported: super::super::Foundation::BOOLEAN, pub bHESSIDConnectionSupported: super::super::Foundation::BOOLEAN, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_EXTSTA_ATTRIBUTES {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_EXTSTA_ATTRIBUTES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_EXTSTA_ATTRIBUTES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_EXTSTA_ATTRIBUTES") .field("Header", &self.Header) .field("uScanSSIDListSize", &self.uScanSSIDListSize) .field("uDesiredBSSIDListSize", &self.uDesiredBSSIDListSize) .field("uDesiredSSIDListSize", &self.uDesiredSSIDListSize) .field("uExcludedMacAddressListSize", &self.uExcludedMacAddressListSize) .field("uPrivacyExemptionListSize", &self.uPrivacyExemptionListSize) .field("uKeyMappingTableSize", &self.uKeyMappingTableSize) .field("uDefaultKeyTableSize", &self.uDefaultKeyTableSize) .field("uWEPKeyValueMaxLength", &self.uWEPKeyValueMaxLength) .field("uPMKIDCacheSize", &self.uPMKIDCacheSize) .field("uMaxNumPerSTADefaultKeyTables", &self.uMaxNumPerSTADefaultKeyTables) .field("bStrictlyOrderedServiceClassImplemented", &self.bStrictlyOrderedServiceClassImplemented) .field("ucSupportedQoSProtocolFlags", &self.ucSupportedQoSProtocolFlags) .field("bSafeModeImplemented", &self.bSafeModeImplemented) .field("uNumSupportedCountryOrRegionStrings", &self.uNumSupportedCountryOrRegionStrings) .field("pSupportedCountryOrRegionStrings", &self.pSupportedCountryOrRegionStrings) .field("uInfraNumSupportedUcastAlgoPairs", &self.uInfraNumSupportedUcastAlgoPairs) .field("pInfraSupportedUcastAlgoPairs", &self.pInfraSupportedUcastAlgoPairs) .field("uInfraNumSupportedMcastAlgoPairs", &self.uInfraNumSupportedMcastAlgoPairs) .field("pInfraSupportedMcastAlgoPairs", &self.pInfraSupportedMcastAlgoPairs) .field("uAdhocNumSupportedUcastAlgoPairs", &self.uAdhocNumSupportedUcastAlgoPairs) .field("pAdhocSupportedUcastAlgoPairs", &self.pAdhocSupportedUcastAlgoPairs) .field("uAdhocNumSupportedMcastAlgoPairs", &self.uAdhocNumSupportedMcastAlgoPairs) .field("pAdhocSupportedMcastAlgoPairs", &self.pAdhocSupportedMcastAlgoPairs) .field("bAutoPowerSaveMode", &self.bAutoPowerSaveMode) .field("uMaxNetworkOffloadListSize", &self.uMaxNetworkOffloadListSize) .field("bMFPCapable", &self.bMFPCapable) .field("uInfraNumSupportedMcastMgmtAlgoPairs", &self.uInfraNumSupportedMcastMgmtAlgoPairs) .field("pInfraSupportedMcastMgmtAlgoPairs", &self.pInfraSupportedMcastMgmtAlgoPairs) .field("bNeighborReportSupported", &self.bNeighborReportSupported) .field("bAPChannelReportSupported", &self.bAPChannelReportSupported) .field("bActionFramesSupported", &self.bActionFramesSupported) .field("bANQPQueryOffloadSupported", &self.bANQPQueryOffloadSupported) .field("bHESSIDConnectionSupported", &self.bHESSIDConnectionSupported) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_EXTSTA_ATTRIBUTES { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uScanSSIDListSize == other.uScanSSIDListSize && self.uDesiredBSSIDListSize == other.uDesiredBSSIDListSize && self.uDesiredSSIDListSize == other.uDesiredSSIDListSize && self.uExcludedMacAddressListSize == other.uExcludedMacAddressListSize && self.uPrivacyExemptionListSize == other.uPrivacyExemptionListSize && self.uKeyMappingTableSize == other.uKeyMappingTableSize && self.uDefaultKeyTableSize == other.uDefaultKeyTableSize && self.uWEPKeyValueMaxLength == other.uWEPKeyValueMaxLength && self.uPMKIDCacheSize == other.uPMKIDCacheSize && self.uMaxNumPerSTADefaultKeyTables == other.uMaxNumPerSTADefaultKeyTables && self.bStrictlyOrderedServiceClassImplemented == other.bStrictlyOrderedServiceClassImplemented && self.ucSupportedQoSProtocolFlags == other.ucSupportedQoSProtocolFlags && self.bSafeModeImplemented == other.bSafeModeImplemented && self.uNumSupportedCountryOrRegionStrings == other.uNumSupportedCountryOrRegionStrings && self.pSupportedCountryOrRegionStrings == other.pSupportedCountryOrRegionStrings && self.uInfraNumSupportedUcastAlgoPairs == other.uInfraNumSupportedUcastAlgoPairs && self.pInfraSupportedUcastAlgoPairs == other.pInfraSupportedUcastAlgoPairs && self.uInfraNumSupportedMcastAlgoPairs == other.uInfraNumSupportedMcastAlgoPairs && self.pInfraSupportedMcastAlgoPairs == other.pInfraSupportedMcastAlgoPairs && self.uAdhocNumSupportedUcastAlgoPairs == other.uAdhocNumSupportedUcastAlgoPairs && self.pAdhocSupportedUcastAlgoPairs == other.pAdhocSupportedUcastAlgoPairs && self.uAdhocNumSupportedMcastAlgoPairs == other.uAdhocNumSupportedMcastAlgoPairs && self.pAdhocSupportedMcastAlgoPairs == other.pAdhocSupportedMcastAlgoPairs && self.bAutoPowerSaveMode == other.bAutoPowerSaveMode && self.uMaxNetworkOffloadListSize == other.uMaxNetworkOffloadListSize && self.bMFPCapable == other.bMFPCapable && self.uInfraNumSupportedMcastMgmtAlgoPairs == other.uInfraNumSupportedMcastMgmtAlgoPairs && self.pInfraSupportedMcastMgmtAlgoPairs == other.pInfraSupportedMcastMgmtAlgoPairs && self.bNeighborReportSupported == other.bNeighborReportSupported && self.bAPChannelReportSupported == other.bAPChannelReportSupported && self.bActionFramesSupported == other.bActionFramesSupported && self.bANQPQueryOffloadSupported == other.bANQPQueryOffloadSupported && self.bHESSIDConnectionSupported == other.bHESSIDConnectionSupported } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_EXTSTA_ATTRIBUTES {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_EXTSTA_ATTRIBUTES { type Abi = Self; } pub const DOT11_EXTSTA_ATTRIBUTES_REVISION_1: u32 = 1u32; pub const DOT11_EXTSTA_ATTRIBUTES_REVISION_2: u32 = 2u32; pub const DOT11_EXTSTA_ATTRIBUTES_REVISION_3: u32 = 3u32; pub const DOT11_EXTSTA_ATTRIBUTES_REVISION_4: u32 = 4u32; pub const DOT11_EXTSTA_ATTRIBUTES_SAFEMODE_CERTIFIED: u32 = 2u32; pub const DOT11_EXTSTA_ATTRIBUTES_SAFEMODE_OID_SUPPORTED: u32 = 1u32; pub const DOT11_EXTSTA_ATTRIBUTES_SAFEMODE_RESERVED: u32 = 12u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_EXTSTA_CAPABILITY { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uScanSSIDListSize: u32, pub uDesiredBSSIDListSize: u32, pub uDesiredSSIDListSize: u32, pub uExcludedMacAddressListSize: u32, pub uPrivacyExemptionListSize: u32, pub uKeyMappingTableSize: u32, pub uDefaultKeyTableSize: u32, pub uWEPKeyValueMaxLength: u32, pub uPMKIDCacheSize: u32, pub uMaxNumPerSTADefaultKeyTables: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_EXTSTA_CAPABILITY {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_EXTSTA_CAPABILITY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_EXTSTA_CAPABILITY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_EXTSTA_CAPABILITY") .field("Header", &self.Header) .field("uScanSSIDListSize", &self.uScanSSIDListSize) .field("uDesiredBSSIDListSize", &self.uDesiredBSSIDListSize) .field("uDesiredSSIDListSize", &self.uDesiredSSIDListSize) .field("uExcludedMacAddressListSize", &self.uExcludedMacAddressListSize) .field("uPrivacyExemptionListSize", &self.uPrivacyExemptionListSize) .field("uKeyMappingTableSize", &self.uKeyMappingTableSize) .field("uDefaultKeyTableSize", &self.uDefaultKeyTableSize) .field("uWEPKeyValueMaxLength", &self.uWEPKeyValueMaxLength) .field("uPMKIDCacheSize", &self.uPMKIDCacheSize) .field("uMaxNumPerSTADefaultKeyTables", &self.uMaxNumPerSTADefaultKeyTables) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_EXTSTA_CAPABILITY { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uScanSSIDListSize == other.uScanSSIDListSize && self.uDesiredBSSIDListSize == other.uDesiredBSSIDListSize && self.uDesiredSSIDListSize == other.uDesiredSSIDListSize && self.uExcludedMacAddressListSize == other.uExcludedMacAddressListSize && self.uPrivacyExemptionListSize == other.uPrivacyExemptionListSize && self.uKeyMappingTableSize == other.uKeyMappingTableSize && self.uDefaultKeyTableSize == other.uDefaultKeyTableSize && self.uWEPKeyValueMaxLength == other.uWEPKeyValueMaxLength && self.uPMKIDCacheSize == other.uPMKIDCacheSize && self.uMaxNumPerSTADefaultKeyTables == other.uMaxNumPerSTADefaultKeyTables } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_EXTSTA_CAPABILITY {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_EXTSTA_CAPABILITY { type Abi = Self; } pub const DOT11_EXTSTA_CAPABILITY_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_EXTSTA_RECV_CONTEXT { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uReceiveFlags: u32, pub uPhyId: u32, pub uChCenterFrequency: u32, pub usNumberOfMPDUsReceived: u16, pub lRSSI: i32, pub ucDataRate: u8, pub uSizeMediaSpecificInfo: u32, pub pvMediaSpecificInfo: *mut ::core::ffi::c_void, pub ullTimestamp: u64, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_EXTSTA_RECV_CONTEXT {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_EXTSTA_RECV_CONTEXT { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_EXTSTA_RECV_CONTEXT { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_EXTSTA_RECV_CONTEXT") .field("Header", &self.Header) .field("uReceiveFlags", &self.uReceiveFlags) .field("uPhyId", &self.uPhyId) .field("uChCenterFrequency", &self.uChCenterFrequency) .field("usNumberOfMPDUsReceived", &self.usNumberOfMPDUsReceived) .field("lRSSI", &self.lRSSI) .field("ucDataRate", &self.ucDataRate) .field("uSizeMediaSpecificInfo", &self.uSizeMediaSpecificInfo) .field("pvMediaSpecificInfo", &self.pvMediaSpecificInfo) .field("ullTimestamp", &self.ullTimestamp) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_EXTSTA_RECV_CONTEXT { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uReceiveFlags == other.uReceiveFlags && self.uPhyId == other.uPhyId && self.uChCenterFrequency == other.uChCenterFrequency && self.usNumberOfMPDUsReceived == other.usNumberOfMPDUsReceived && self.lRSSI == other.lRSSI && self.ucDataRate == other.ucDataRate && self.uSizeMediaSpecificInfo == other.uSizeMediaSpecificInfo && self.pvMediaSpecificInfo == other.pvMediaSpecificInfo && self.ullTimestamp == other.ullTimestamp } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_EXTSTA_RECV_CONTEXT {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_EXTSTA_RECV_CONTEXT { type Abi = Self; } pub const DOT11_EXTSTA_RECV_CONTEXT_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_EXTSTA_SEND_CONTEXT { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub usExemptionActionType: u16, pub uPhyId: u32, pub uDelayedSleepValue: u32, pub pvMediaSpecificInfo: *mut ::core::ffi::c_void, pub uSendFlags: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_EXTSTA_SEND_CONTEXT {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_EXTSTA_SEND_CONTEXT { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_EXTSTA_SEND_CONTEXT { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_EXTSTA_SEND_CONTEXT") .field("Header", &self.Header) .field("usExemptionActionType", &self.usExemptionActionType) .field("uPhyId", &self.uPhyId) .field("uDelayedSleepValue", &self.uDelayedSleepValue) .field("pvMediaSpecificInfo", &self.pvMediaSpecificInfo) .field("uSendFlags", &self.uSendFlags) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_EXTSTA_SEND_CONTEXT { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.usExemptionActionType == other.usExemptionActionType && self.uPhyId == other.uPhyId && self.uDelayedSleepValue == other.uDelayedSleepValue && self.pvMediaSpecificInfo == other.pvMediaSpecificInfo && self.uSendFlags == other.uSendFlags } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_EXTSTA_SEND_CONTEXT {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_EXTSTA_SEND_CONTEXT { type Abi = Self; } pub const DOT11_EXTSTA_SEND_CONTEXT_REVISION_1: u32 = 1u32; pub const DOT11_FLAGS_80211B_CHANNEL_AGILITY: u32 = 4u32; pub const DOT11_FLAGS_80211B_PBCC: u32 = 2u32; pub const DOT11_FLAGS_80211B_SHORT_PREAMBLE: u32 = 1u32; pub const DOT11_FLAGS_80211G_BARKER_PREAMBLE_MODE: u32 = 128u32; pub const DOT11_FLAGS_80211G_DSSS_OFDM: u32 = 16u32; pub const DOT11_FLAGS_80211G_NON_ERP_PRESENT: u32 = 64u32; pub const DOT11_FLAGS_80211G_USE_PROTECTION: u32 = 32u32; pub const DOT11_FLAGS_PS_ON: u32 = 8u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_FRAGMENT_DESCRIPTOR { pub uOffset: u32, pub uLength: u32, } impl DOT11_FRAGMENT_DESCRIPTOR {} impl ::core::default::Default for DOT11_FRAGMENT_DESCRIPTOR { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_FRAGMENT_DESCRIPTOR { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_FRAGMENT_DESCRIPTOR").field("uOffset", &self.uOffset).field("uLength", &self.uLength).finish() } } impl ::core::cmp::PartialEq for DOT11_FRAGMENT_DESCRIPTOR { fn eq(&self, other: &Self) -> bool { self.uOffset == other.uOffset && self.uLength == other.uLength } } impl ::core::cmp::Eq for DOT11_FRAGMENT_DESCRIPTOR {} unsafe impl ::windows::core::Abi for DOT11_FRAGMENT_DESCRIPTOR { type Abi = Self; } pub const DOT11_FREQUENCY_BANDS_LOWER: u32 = 1u32; pub const DOT11_FREQUENCY_BANDS_MIDDLE: u32 = 2u32; pub const DOT11_FREQUENCY_BANDS_UPPER: u32 = 4u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_GO_NEGOTIATION_CONFIRMATION_SEND_COMPLETE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerDeviceAddress: [u8; 6], pub DialogToken: u8, pub Status: i32, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_GO_NEGOTIATION_CONFIRMATION_SEND_COMPLETE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_GO_NEGOTIATION_CONFIRMATION_SEND_COMPLETE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_GO_NEGOTIATION_CONFIRMATION_SEND_COMPLETE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_GO_NEGOTIATION_CONFIRMATION_SEND_COMPLETE_PARAMETERS") .field("Header", &self.Header) .field("PeerDeviceAddress", &self.PeerDeviceAddress) .field("DialogToken", &self.DialogToken) .field("Status", &self.Status) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_GO_NEGOTIATION_CONFIRMATION_SEND_COMPLETE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerDeviceAddress == other.PeerDeviceAddress && self.DialogToken == other.DialogToken && self.Status == other.Status && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_GO_NEGOTIATION_CONFIRMATION_SEND_COMPLETE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_GO_NEGOTIATION_CONFIRMATION_SEND_COMPLETE_PARAMETERS { type Abi = Self; } pub const DOT11_GO_NEGOTIATION_CONFIRMATION_SEND_COMPLETE_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_GO_NEGOTIATION_REQUEST_SEND_COMPLETE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerDeviceAddress: [u8; 6], pub DialogToken: u8, pub Status: i32, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_GO_NEGOTIATION_REQUEST_SEND_COMPLETE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_GO_NEGOTIATION_REQUEST_SEND_COMPLETE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_GO_NEGOTIATION_REQUEST_SEND_COMPLETE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_GO_NEGOTIATION_REQUEST_SEND_COMPLETE_PARAMETERS") .field("Header", &self.Header) .field("PeerDeviceAddress", &self.PeerDeviceAddress) .field("DialogToken", &self.DialogToken) .field("Status", &self.Status) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_GO_NEGOTIATION_REQUEST_SEND_COMPLETE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerDeviceAddress == other.PeerDeviceAddress && self.DialogToken == other.DialogToken && self.Status == other.Status && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_GO_NEGOTIATION_REQUEST_SEND_COMPLETE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_GO_NEGOTIATION_REQUEST_SEND_COMPLETE_PARAMETERS { type Abi = Self; } pub const DOT11_GO_NEGOTIATION_REQUEST_SEND_COMPLETE_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_GO_NEGOTIATION_RESPONSE_SEND_COMPLETE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerDeviceAddress: [u8; 6], pub DialogToken: u8, pub Status: i32, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_GO_NEGOTIATION_RESPONSE_SEND_COMPLETE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_GO_NEGOTIATION_RESPONSE_SEND_COMPLETE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_GO_NEGOTIATION_RESPONSE_SEND_COMPLETE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_GO_NEGOTIATION_RESPONSE_SEND_COMPLETE_PARAMETERS") .field("Header", &self.Header) .field("PeerDeviceAddress", &self.PeerDeviceAddress) .field("DialogToken", &self.DialogToken) .field("Status", &self.Status) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_GO_NEGOTIATION_RESPONSE_SEND_COMPLETE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerDeviceAddress == other.PeerDeviceAddress && self.DialogToken == other.DialogToken && self.Status == other.Status && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_GO_NEGOTIATION_RESPONSE_SEND_COMPLETE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_GO_NEGOTIATION_RESPONSE_SEND_COMPLETE_PARAMETERS { type Abi = Self; } pub const DOT11_GO_NEGOTIATION_RESPONSE_SEND_COMPLETE_PARAMETERS_REVISION_1: u32 = 1u32; pub const DOT11_HESSID_LENGTH: u32 = 6u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_HOPPING_PATTERN_ENTRY { pub uHoppingPatternIndex: u32, pub uRandomTableFieldNumber: u32, } impl DOT11_HOPPING_PATTERN_ENTRY {} impl ::core::default::Default for DOT11_HOPPING_PATTERN_ENTRY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_HOPPING_PATTERN_ENTRY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_HOPPING_PATTERN_ENTRY").field("uHoppingPatternIndex", &self.uHoppingPatternIndex).field("uRandomTableFieldNumber", &self.uRandomTableFieldNumber).finish() } } impl ::core::cmp::PartialEq for DOT11_HOPPING_PATTERN_ENTRY { fn eq(&self, other: &Self) -> bool { self.uHoppingPatternIndex == other.uHoppingPatternIndex && self.uRandomTableFieldNumber == other.uRandomTableFieldNumber } } impl ::core::cmp::Eq for DOT11_HOPPING_PATTERN_ENTRY {} unsafe impl ::windows::core::Abi for DOT11_HOPPING_PATTERN_ENTRY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_HOPPING_PATTERN_ENTRY_LIST { pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub dot11HoppingPatternEntry: [DOT11_HOPPING_PATTERN_ENTRY; 1], } impl DOT11_HOPPING_PATTERN_ENTRY_LIST {} impl ::core::default::Default for DOT11_HOPPING_PATTERN_ENTRY_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_HOPPING_PATTERN_ENTRY_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_HOPPING_PATTERN_ENTRY_LIST").field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("dot11HoppingPatternEntry", &self.dot11HoppingPatternEntry).finish() } } impl ::core::cmp::PartialEq for DOT11_HOPPING_PATTERN_ENTRY_LIST { fn eq(&self, other: &Self) -> bool { self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.dot11HoppingPatternEntry == other.dot11HoppingPatternEntry } } impl ::core::cmp::Eq for DOT11_HOPPING_PATTERN_ENTRY_LIST {} unsafe impl ::windows::core::Abi for DOT11_HOPPING_PATTERN_ENTRY_LIST { 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 DOT11_HOP_ALGO_ADOPTED(pub i32); pub const dot11_hop_algo_current: DOT11_HOP_ALGO_ADOPTED = DOT11_HOP_ALGO_ADOPTED(0i32); pub const dot11_hop_algo_hop_index: DOT11_HOP_ALGO_ADOPTED = DOT11_HOP_ALGO_ADOPTED(1i32); pub const dot11_hop_algo_hcc: DOT11_HOP_ALGO_ADOPTED = DOT11_HOP_ALGO_ADOPTED(2i32); impl ::core::convert::From<i32> for DOT11_HOP_ALGO_ADOPTED { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_HOP_ALGO_ADOPTED { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_HRDSSS_PHY_ATTRIBUTES { pub bShortPreambleOptionImplemented: super::super::Foundation::BOOLEAN, pub bPBCCOptionImplemented: super::super::Foundation::BOOLEAN, pub bChannelAgilityPresent: super::super::Foundation::BOOLEAN, pub uHRCCAModeSupported: u32, } #[cfg(feature = "Win32_Foundation")] impl DOT11_HRDSSS_PHY_ATTRIBUTES {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_HRDSSS_PHY_ATTRIBUTES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_HRDSSS_PHY_ATTRIBUTES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_HRDSSS_PHY_ATTRIBUTES") .field("bShortPreambleOptionImplemented", &self.bShortPreambleOptionImplemented) .field("bPBCCOptionImplemented", &self.bPBCCOptionImplemented) .field("bChannelAgilityPresent", &self.bChannelAgilityPresent) .field("uHRCCAModeSupported", &self.uHRCCAModeSupported) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_HRDSSS_PHY_ATTRIBUTES { fn eq(&self, other: &Self) -> bool { self.bShortPreambleOptionImplemented == other.bShortPreambleOptionImplemented && self.bPBCCOptionImplemented == other.bPBCCOptionImplemented && self.bChannelAgilityPresent == other.bChannelAgilityPresent && self.uHRCCAModeSupported == other.uHRCCAModeSupported } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_HRDSSS_PHY_ATTRIBUTES {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_HRDSSS_PHY_ATTRIBUTES { type Abi = Self; } pub const DOT11_HR_CCA_MODE_CS_AND_ED: u32 = 4u32; pub const DOT11_HR_CCA_MODE_CS_ONLY: u32 = 2u32; pub const DOT11_HR_CCA_MODE_CS_WITH_TIMER: u32 = 8u32; pub const DOT11_HR_CCA_MODE_ED_ONLY: u32 = 1u32; pub const DOT11_HR_CCA_MODE_HRCS_AND_ED: u32 = 16u32; pub const DOT11_HW_DEFRAGMENTATION_SUPPORTED: u32 = 8u32; pub const DOT11_HW_FRAGMENTATION_SUPPORTED: u32 = 4u32; pub const DOT11_HW_MSDU_AUTH_SUPPORTED_RX: u32 = 32u32; pub const DOT11_HW_MSDU_AUTH_SUPPORTED_TX: u32 = 16u32; pub const DOT11_HW_WEP_SUPPORTED_RX: u32 = 2u32; pub const DOT11_HW_WEP_SUPPORTED_TX: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_IBSS_PARAMS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub bJoinOnly: super::super::Foundation::BOOLEAN, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_IBSS_PARAMS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_IBSS_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_IBSS_PARAMS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_IBSS_PARAMS").field("Header", &self.Header).field("bJoinOnly", &self.bJoinOnly).field("uIEsOffset", &self.uIEsOffset).field("uIEsLength", &self.uIEsLength).finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_IBSS_PARAMS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.bJoinOnly == other.bJoinOnly && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_IBSS_PARAMS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_IBSS_PARAMS { type Abi = Self; } pub const DOT11_IBSS_PARAMS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_INCOMING_ASSOC_COMPLETION_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerMacAddr: [u8; 6], pub uStatus: u32, pub ucErrorSource: u8, pub bReAssocReq: super::super::Foundation::BOOLEAN, pub bReAssocResp: super::super::Foundation::BOOLEAN, pub uAssocReqOffset: u32, pub uAssocReqSize: u32, pub uAssocRespOffset: u32, pub uAssocRespSize: u32, pub AuthAlgo: DOT11_AUTH_ALGORITHM, pub UnicastCipher: DOT11_CIPHER_ALGORITHM, pub MulticastCipher: DOT11_CIPHER_ALGORITHM, pub uActivePhyListOffset: u32, pub uActivePhyListSize: u32, pub uBeaconOffset: u32, pub uBeaconSize: u32, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_INCOMING_ASSOC_COMPLETION_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_INCOMING_ASSOC_COMPLETION_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_INCOMING_ASSOC_COMPLETION_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_INCOMING_ASSOC_COMPLETION_PARAMETERS") .field("Header", &self.Header) .field("PeerMacAddr", &self.PeerMacAddr) .field("uStatus", &self.uStatus) .field("ucErrorSource", &self.ucErrorSource) .field("bReAssocReq", &self.bReAssocReq) .field("bReAssocResp", &self.bReAssocResp) .field("uAssocReqOffset", &self.uAssocReqOffset) .field("uAssocReqSize", &self.uAssocReqSize) .field("uAssocRespOffset", &self.uAssocRespOffset) .field("uAssocRespSize", &self.uAssocRespSize) .field("AuthAlgo", &self.AuthAlgo) .field("UnicastCipher", &self.UnicastCipher) .field("MulticastCipher", &self.MulticastCipher) .field("uActivePhyListOffset", &self.uActivePhyListOffset) .field("uActivePhyListSize", &self.uActivePhyListSize) .field("uBeaconOffset", &self.uBeaconOffset) .field("uBeaconSize", &self.uBeaconSize) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_INCOMING_ASSOC_COMPLETION_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerMacAddr == other.PeerMacAddr && self.uStatus == other.uStatus && self.ucErrorSource == other.ucErrorSource && self.bReAssocReq == other.bReAssocReq && self.bReAssocResp == other.bReAssocResp && self.uAssocReqOffset == other.uAssocReqOffset && self.uAssocReqSize == other.uAssocReqSize && self.uAssocRespOffset == other.uAssocRespOffset && self.uAssocRespSize == other.uAssocRespSize && self.AuthAlgo == other.AuthAlgo && self.UnicastCipher == other.UnicastCipher && self.MulticastCipher == other.MulticastCipher && self.uActivePhyListOffset == other.uActivePhyListOffset && self.uActivePhyListSize == other.uActivePhyListSize && self.uBeaconOffset == other.uBeaconOffset && self.uBeaconSize == other.uBeaconSize } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_INCOMING_ASSOC_COMPLETION_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_INCOMING_ASSOC_COMPLETION_PARAMETERS { type Abi = Self; } pub const DOT11_INCOMING_ASSOC_COMPLETION_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_INCOMING_ASSOC_DECISION { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerMacAddr: [u8; 6], pub bAccept: super::super::Foundation::BOOLEAN, pub usReasonCode: u16, pub uAssocResponseIEsOffset: u32, pub uAssocResponseIEsLength: u32, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_INCOMING_ASSOC_DECISION {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_INCOMING_ASSOC_DECISION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_INCOMING_ASSOC_DECISION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_INCOMING_ASSOC_DECISION") .field("Header", &self.Header) .field("PeerMacAddr", &self.PeerMacAddr) .field("bAccept", &self.bAccept) .field("usReasonCode", &self.usReasonCode) .field("uAssocResponseIEsOffset", &self.uAssocResponseIEsOffset) .field("uAssocResponseIEsLength", &self.uAssocResponseIEsLength) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_INCOMING_ASSOC_DECISION { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerMacAddr == other.PeerMacAddr && self.bAccept == other.bAccept && self.usReasonCode == other.usReasonCode && self.uAssocResponseIEsOffset == other.uAssocResponseIEsOffset && self.uAssocResponseIEsLength == other.uAssocResponseIEsLength } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_INCOMING_ASSOC_DECISION {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_INCOMING_ASSOC_DECISION { type Abi = Self; } pub const DOT11_INCOMING_ASSOC_DECISION_REVISION_1: u32 = 1u32; pub const DOT11_INCOMING_ASSOC_DECISION_REVISION_2: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_INCOMING_ASSOC_DECISION_V2 { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerMacAddr: [u8; 6], pub bAccept: super::super::Foundation::BOOLEAN, pub usReasonCode: u16, pub uAssocResponseIEsOffset: u32, pub uAssocResponseIEsLength: u32, pub WFDStatus: u8, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_INCOMING_ASSOC_DECISION_V2 {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_INCOMING_ASSOC_DECISION_V2 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_INCOMING_ASSOC_DECISION_V2 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_INCOMING_ASSOC_DECISION_V2") .field("Header", &self.Header) .field("PeerMacAddr", &self.PeerMacAddr) .field("bAccept", &self.bAccept) .field("usReasonCode", &self.usReasonCode) .field("uAssocResponseIEsOffset", &self.uAssocResponseIEsOffset) .field("uAssocResponseIEsLength", &self.uAssocResponseIEsLength) .field("WFDStatus", &self.WFDStatus) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_INCOMING_ASSOC_DECISION_V2 { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerMacAddr == other.PeerMacAddr && self.bAccept == other.bAccept && self.usReasonCode == other.usReasonCode && self.uAssocResponseIEsOffset == other.uAssocResponseIEsOffset && self.uAssocResponseIEsLength == other.uAssocResponseIEsLength && self.WFDStatus == other.WFDStatus } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_INCOMING_ASSOC_DECISION_V2 {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_INCOMING_ASSOC_DECISION_V2 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_INCOMING_ASSOC_REQUEST_RECEIVED_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerMacAddr: [u8; 6], pub bReAssocReq: super::super::Foundation::BOOLEAN, pub uAssocReqOffset: u32, pub uAssocReqSize: u32, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_INCOMING_ASSOC_REQUEST_RECEIVED_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_INCOMING_ASSOC_REQUEST_RECEIVED_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_INCOMING_ASSOC_REQUEST_RECEIVED_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_INCOMING_ASSOC_REQUEST_RECEIVED_PARAMETERS").field("Header", &self.Header).field("PeerMacAddr", &self.PeerMacAddr).field("bReAssocReq", &self.bReAssocReq).field("uAssocReqOffset", &self.uAssocReqOffset).field("uAssocReqSize", &self.uAssocReqSize).finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_INCOMING_ASSOC_REQUEST_RECEIVED_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerMacAddr == other.PeerMacAddr && self.bReAssocReq == other.bReAssocReq && self.uAssocReqOffset == other.uAssocReqOffset && self.uAssocReqSize == other.uAssocReqSize } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_INCOMING_ASSOC_REQUEST_RECEIVED_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_INCOMING_ASSOC_REQUEST_RECEIVED_PARAMETERS { type Abi = Self; } pub const DOT11_INCOMING_ASSOC_REQUEST_RECEIVED_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_INCOMING_ASSOC_STARTED_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerMacAddr: [u8; 6], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_INCOMING_ASSOC_STARTED_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_INCOMING_ASSOC_STARTED_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_INCOMING_ASSOC_STARTED_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_INCOMING_ASSOC_STARTED_PARAMETERS").field("Header", &self.Header).field("PeerMacAddr", &self.PeerMacAddr).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_INCOMING_ASSOC_STARTED_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerMacAddr == other.PeerMacAddr } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_INCOMING_ASSOC_STARTED_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_INCOMING_ASSOC_STARTED_PARAMETERS { type Abi = Self; } pub const DOT11_INCOMING_ASSOC_STARTED_PARAMETERS_REVISION_1: u32 = 1u32; pub const DOT11_INVALID_CHANNEL_NUMBER: u32 = 0u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_INVITATION_REQUEST_SEND_COMPLETE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerDeviceAddress: [u8; 6], pub ReceiverAddress: [u8; 6], pub DialogToken: u8, pub Status: i32, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_INVITATION_REQUEST_SEND_COMPLETE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_INVITATION_REQUEST_SEND_COMPLETE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_INVITATION_REQUEST_SEND_COMPLETE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_INVITATION_REQUEST_SEND_COMPLETE_PARAMETERS") .field("Header", &self.Header) .field("PeerDeviceAddress", &self.PeerDeviceAddress) .field("ReceiverAddress", &self.ReceiverAddress) .field("DialogToken", &self.DialogToken) .field("Status", &self.Status) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_INVITATION_REQUEST_SEND_COMPLETE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerDeviceAddress == other.PeerDeviceAddress && self.ReceiverAddress == other.ReceiverAddress && self.DialogToken == other.DialogToken && self.Status == other.Status && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_INVITATION_REQUEST_SEND_COMPLETE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_INVITATION_REQUEST_SEND_COMPLETE_PARAMETERS { type Abi = Self; } pub const DOT11_INVITATION_REQUEST_SEND_COMPLETE_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_INVITATION_RESPONSE_SEND_COMPLETE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub ReceiverDeviceAddress: [u8; 6], pub DialogToken: u8, pub Status: i32, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_INVITATION_RESPONSE_SEND_COMPLETE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_INVITATION_RESPONSE_SEND_COMPLETE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_INVITATION_RESPONSE_SEND_COMPLETE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_INVITATION_RESPONSE_SEND_COMPLETE_PARAMETERS") .field("Header", &self.Header) .field("ReceiverDeviceAddress", &self.ReceiverDeviceAddress) .field("DialogToken", &self.DialogToken) .field("Status", &self.Status) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_INVITATION_RESPONSE_SEND_COMPLETE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.ReceiverDeviceAddress == other.ReceiverDeviceAddress && self.DialogToken == other.DialogToken && self.Status == other.Status && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_INVITATION_RESPONSE_SEND_COMPLETE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_INVITATION_RESPONSE_SEND_COMPLETE_PARAMETERS { type Abi = Self; } pub const DOT11_INVITATION_RESPONSE_SEND_COMPLETE_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_IV48_COUNTER { pub uIV32Counter: u32, pub usIV16Counter: u16, } impl DOT11_IV48_COUNTER {} impl ::core::default::Default for DOT11_IV48_COUNTER { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_IV48_COUNTER { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_IV48_COUNTER").field("uIV32Counter", &self.uIV32Counter).field("usIV16Counter", &self.usIV16Counter).finish() } } impl ::core::cmp::PartialEq for DOT11_IV48_COUNTER { fn eq(&self, other: &Self) -> bool { self.uIV32Counter == other.uIV32Counter && self.usIV16Counter == other.usIV16Counter } } impl ::core::cmp::Eq for DOT11_IV48_COUNTER {} unsafe impl ::windows::core::Abi for DOT11_IV48_COUNTER { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_JOIN_REQUEST { pub uJoinFailureTimeout: u32, pub OperationalRateSet: DOT11_RATE_SET, pub uChCenterFrequency: u32, pub dot11BSSDescription: DOT11_BSS_DESCRIPTION, } impl DOT11_JOIN_REQUEST {} impl ::core::default::Default for DOT11_JOIN_REQUEST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_JOIN_REQUEST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_JOIN_REQUEST").field("uJoinFailureTimeout", &self.uJoinFailureTimeout).field("OperationalRateSet", &self.OperationalRateSet).field("uChCenterFrequency", &self.uChCenterFrequency).field("dot11BSSDescription", &self.dot11BSSDescription).finish() } } impl ::core::cmp::PartialEq for DOT11_JOIN_REQUEST { fn eq(&self, other: &Self) -> bool { self.uJoinFailureTimeout == other.uJoinFailureTimeout && self.OperationalRateSet == other.OperationalRateSet && self.uChCenterFrequency == other.uChCenterFrequency && self.dot11BSSDescription == other.dot11BSSDescription } } impl ::core::cmp::Eq for DOT11_JOIN_REQUEST {} unsafe impl ::windows::core::Abi for DOT11_JOIN_REQUEST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_KEY_ALGO_BIP { pub ucIPN: [u8; 6], pub ulBIPKeyLength: u32, pub ucBIPKey: [u8; 1], } impl DOT11_KEY_ALGO_BIP {} impl ::core::default::Default for DOT11_KEY_ALGO_BIP { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_KEY_ALGO_BIP { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_KEY_ALGO_BIP").field("ucIPN", &self.ucIPN).field("ulBIPKeyLength", &self.ulBIPKeyLength).field("ucBIPKey", &self.ucBIPKey).finish() } } impl ::core::cmp::PartialEq for DOT11_KEY_ALGO_BIP { fn eq(&self, other: &Self) -> bool { self.ucIPN == other.ucIPN && self.ulBIPKeyLength == other.ulBIPKeyLength && self.ucBIPKey == other.ucBIPKey } } impl ::core::cmp::Eq for DOT11_KEY_ALGO_BIP {} unsafe impl ::windows::core::Abi for DOT11_KEY_ALGO_BIP { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_KEY_ALGO_BIP_GMAC_256 { pub ucIPN: [u8; 6], pub ulBIPGmac256KeyLength: u32, pub ucBIPGmac256Key: [u8; 1], } impl DOT11_KEY_ALGO_BIP_GMAC_256 {} impl ::core::default::Default for DOT11_KEY_ALGO_BIP_GMAC_256 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_KEY_ALGO_BIP_GMAC_256 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_KEY_ALGO_BIP_GMAC_256").field("ucIPN", &self.ucIPN).field("ulBIPGmac256KeyLength", &self.ulBIPGmac256KeyLength).field("ucBIPGmac256Key", &self.ucBIPGmac256Key).finish() } } impl ::core::cmp::PartialEq for DOT11_KEY_ALGO_BIP_GMAC_256 { fn eq(&self, other: &Self) -> bool { self.ucIPN == other.ucIPN && self.ulBIPGmac256KeyLength == other.ulBIPGmac256KeyLength && self.ucBIPGmac256Key == other.ucBIPGmac256Key } } impl ::core::cmp::Eq for DOT11_KEY_ALGO_BIP_GMAC_256 {} unsafe impl ::windows::core::Abi for DOT11_KEY_ALGO_BIP_GMAC_256 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_KEY_ALGO_CCMP { pub ucIV48Counter: [u8; 6], pub ulCCMPKeyLength: u32, pub ucCCMPKey: [u8; 1], } impl DOT11_KEY_ALGO_CCMP {} impl ::core::default::Default for DOT11_KEY_ALGO_CCMP { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_KEY_ALGO_CCMP { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_KEY_ALGO_CCMP").field("ucIV48Counter", &self.ucIV48Counter).field("ulCCMPKeyLength", &self.ulCCMPKeyLength).field("ucCCMPKey", &self.ucCCMPKey).finish() } } impl ::core::cmp::PartialEq for DOT11_KEY_ALGO_CCMP { fn eq(&self, other: &Self) -> bool { self.ucIV48Counter == other.ucIV48Counter && self.ulCCMPKeyLength == other.ulCCMPKeyLength && self.ucCCMPKey == other.ucCCMPKey } } impl ::core::cmp::Eq for DOT11_KEY_ALGO_CCMP {} unsafe impl ::windows::core::Abi for DOT11_KEY_ALGO_CCMP { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_KEY_ALGO_GCMP { pub ucIV48Counter: [u8; 6], pub ulGCMPKeyLength: u32, pub ucGCMPKey: [u8; 1], } impl DOT11_KEY_ALGO_GCMP {} impl ::core::default::Default for DOT11_KEY_ALGO_GCMP { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_KEY_ALGO_GCMP { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_KEY_ALGO_GCMP").field("ucIV48Counter", &self.ucIV48Counter).field("ulGCMPKeyLength", &self.ulGCMPKeyLength).field("ucGCMPKey", &self.ucGCMPKey).finish() } } impl ::core::cmp::PartialEq for DOT11_KEY_ALGO_GCMP { fn eq(&self, other: &Self) -> bool { self.ucIV48Counter == other.ucIV48Counter && self.ulGCMPKeyLength == other.ulGCMPKeyLength && self.ucGCMPKey == other.ucGCMPKey } } impl ::core::cmp::Eq for DOT11_KEY_ALGO_GCMP {} unsafe impl ::windows::core::Abi for DOT11_KEY_ALGO_GCMP { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_KEY_ALGO_GCMP_256 { pub ucIV48Counter: [u8; 6], pub ulGCMP256KeyLength: u32, pub ucGCMP256Key: [u8; 1], } impl DOT11_KEY_ALGO_GCMP_256 {} impl ::core::default::Default for DOT11_KEY_ALGO_GCMP_256 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_KEY_ALGO_GCMP_256 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_KEY_ALGO_GCMP_256").field("ucIV48Counter", &self.ucIV48Counter).field("ulGCMP256KeyLength", &self.ulGCMP256KeyLength).field("ucGCMP256Key", &self.ucGCMP256Key).finish() } } impl ::core::cmp::PartialEq for DOT11_KEY_ALGO_GCMP_256 { fn eq(&self, other: &Self) -> bool { self.ucIV48Counter == other.ucIV48Counter && self.ulGCMP256KeyLength == other.ulGCMP256KeyLength && self.ucGCMP256Key == other.ucGCMP256Key } } impl ::core::cmp::Eq for DOT11_KEY_ALGO_GCMP_256 {} unsafe impl ::windows::core::Abi for DOT11_KEY_ALGO_GCMP_256 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_KEY_ALGO_TKIP_MIC { pub ucIV48Counter: [u8; 6], pub ulTKIPKeyLength: u32, pub ulMICKeyLength: u32, pub ucTKIPMICKeys: [u8; 1], } impl DOT11_KEY_ALGO_TKIP_MIC {} impl ::core::default::Default for DOT11_KEY_ALGO_TKIP_MIC { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_KEY_ALGO_TKIP_MIC { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_KEY_ALGO_TKIP_MIC").field("ucIV48Counter", &self.ucIV48Counter).field("ulTKIPKeyLength", &self.ulTKIPKeyLength).field("ulMICKeyLength", &self.ulMICKeyLength).field("ucTKIPMICKeys", &self.ucTKIPMICKeys).finish() } } impl ::core::cmp::PartialEq for DOT11_KEY_ALGO_TKIP_MIC { fn eq(&self, other: &Self) -> bool { self.ucIV48Counter == other.ucIV48Counter && self.ulTKIPKeyLength == other.ulTKIPKeyLength && self.ulMICKeyLength == other.ulMICKeyLength && self.ucTKIPMICKeys == other.ucTKIPMICKeys } } impl ::core::cmp::Eq for DOT11_KEY_ALGO_TKIP_MIC {} unsafe impl ::windows::core::Abi for DOT11_KEY_ALGO_TKIP_MIC { 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 DOT11_KEY_DIRECTION(pub i32); pub const dot11_key_direction_both: DOT11_KEY_DIRECTION = DOT11_KEY_DIRECTION(1i32); pub const dot11_key_direction_inbound: DOT11_KEY_DIRECTION = DOT11_KEY_DIRECTION(2i32); pub const dot11_key_direction_outbound: DOT11_KEY_DIRECTION = DOT11_KEY_DIRECTION(3i32); impl ::core::convert::From<i32> for DOT11_KEY_DIRECTION { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_KEY_DIRECTION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_LINK_QUALITY_ENTRY { pub PeerMacAddr: [u8; 6], pub ucLinkQuality: u8, } impl DOT11_LINK_QUALITY_ENTRY {} impl ::core::default::Default for DOT11_LINK_QUALITY_ENTRY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_LINK_QUALITY_ENTRY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_LINK_QUALITY_ENTRY").field("PeerMacAddr", &self.PeerMacAddr).field("ucLinkQuality", &self.ucLinkQuality).finish() } } impl ::core::cmp::PartialEq for DOT11_LINK_QUALITY_ENTRY { fn eq(&self, other: &Self) -> bool { self.PeerMacAddr == other.PeerMacAddr && self.ucLinkQuality == other.ucLinkQuality } } impl ::core::cmp::Eq for DOT11_LINK_QUALITY_ENTRY {} unsafe impl ::windows::core::Abi for DOT11_LINK_QUALITY_ENTRY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_LINK_QUALITY_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uLinkQualityListSize: u32, pub uLinkQualityListOffset: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_LINK_QUALITY_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_LINK_QUALITY_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_LINK_QUALITY_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_LINK_QUALITY_PARAMETERS").field("Header", &self.Header).field("uLinkQualityListSize", &self.uLinkQualityListSize).field("uLinkQualityListOffset", &self.uLinkQualityListOffset).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_LINK_QUALITY_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uLinkQualityListSize == other.uLinkQualityListSize && self.uLinkQualityListOffset == other.uLinkQualityListOffset } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_LINK_QUALITY_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_LINK_QUALITY_PARAMETERS { type Abi = Self; } pub const DOT11_LINK_QUALITY_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_MAC_ADDRESS_LIST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub MacAddrs: [u8; 6], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_MAC_ADDRESS_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_MAC_ADDRESS_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_MAC_ADDRESS_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MAC_ADDRESS_LIST").field("Header", &self.Header).field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("MacAddrs", &self.MacAddrs).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_MAC_ADDRESS_LIST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.MacAddrs == other.MacAddrs } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_MAC_ADDRESS_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_MAC_ADDRESS_LIST { type Abi = Self; } pub const DOT11_MAC_ADDRESS_LIST_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_MAC_FRAME_STATISTICS { pub ullTransmittedFrameCount: u64, pub ullReceivedFrameCount: u64, pub ullTransmittedFailureFrameCount: u64, pub ullReceivedFailureFrameCount: u64, pub ullWEPExcludedCount: u64, pub ullTKIPLocalMICFailures: u64, pub ullTKIPReplays: u64, pub ullTKIPICVErrorCount: u64, pub ullCCMPReplays: u64, pub ullCCMPDecryptErrors: u64, pub ullWEPUndecryptableCount: u64, pub ullWEPICVErrorCount: u64, pub ullDecryptSuccessCount: u64, pub ullDecryptFailureCount: u64, } impl DOT11_MAC_FRAME_STATISTICS {} impl ::core::default::Default for DOT11_MAC_FRAME_STATISTICS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_MAC_FRAME_STATISTICS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MAC_FRAME_STATISTICS") .field("ullTransmittedFrameCount", &self.ullTransmittedFrameCount) .field("ullReceivedFrameCount", &self.ullReceivedFrameCount) .field("ullTransmittedFailureFrameCount", &self.ullTransmittedFailureFrameCount) .field("ullReceivedFailureFrameCount", &self.ullReceivedFailureFrameCount) .field("ullWEPExcludedCount", &self.ullWEPExcludedCount) .field("ullTKIPLocalMICFailures", &self.ullTKIPLocalMICFailures) .field("ullTKIPReplays", &self.ullTKIPReplays) .field("ullTKIPICVErrorCount", &self.ullTKIPICVErrorCount) .field("ullCCMPReplays", &self.ullCCMPReplays) .field("ullCCMPDecryptErrors", &self.ullCCMPDecryptErrors) .field("ullWEPUndecryptableCount", &self.ullWEPUndecryptableCount) .field("ullWEPICVErrorCount", &self.ullWEPICVErrorCount) .field("ullDecryptSuccessCount", &self.ullDecryptSuccessCount) .field("ullDecryptFailureCount", &self.ullDecryptFailureCount) .finish() } } impl ::core::cmp::PartialEq for DOT11_MAC_FRAME_STATISTICS { fn eq(&self, other: &Self) -> bool { self.ullTransmittedFrameCount == other.ullTransmittedFrameCount && self.ullReceivedFrameCount == other.ullReceivedFrameCount && self.ullTransmittedFailureFrameCount == other.ullTransmittedFailureFrameCount && self.ullReceivedFailureFrameCount == other.ullReceivedFailureFrameCount && self.ullWEPExcludedCount == other.ullWEPExcludedCount && self.ullTKIPLocalMICFailures == other.ullTKIPLocalMICFailures && self.ullTKIPReplays == other.ullTKIPReplays && self.ullTKIPICVErrorCount == other.ullTKIPICVErrorCount && self.ullCCMPReplays == other.ullCCMPReplays && self.ullCCMPDecryptErrors == other.ullCCMPDecryptErrors && self.ullWEPUndecryptableCount == other.ullWEPUndecryptableCount && self.ullWEPICVErrorCount == other.ullWEPICVErrorCount && self.ullDecryptSuccessCount == other.ullDecryptSuccessCount && self.ullDecryptFailureCount == other.ullDecryptFailureCount } } impl ::core::cmp::Eq for DOT11_MAC_FRAME_STATISTICS {} unsafe impl ::windows::core::Abi for DOT11_MAC_FRAME_STATISTICS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_MAC_INFO { pub uReserved: u32, pub uNdisPortNumber: u32, pub MacAddr: [u8; 6], } impl DOT11_MAC_INFO {} impl ::core::default::Default for DOT11_MAC_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_MAC_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MAC_INFO").field("uReserved", &self.uReserved).field("uNdisPortNumber", &self.uNdisPortNumber).field("MacAddr", &self.MacAddr).finish() } } impl ::core::cmp::PartialEq for DOT11_MAC_INFO { fn eq(&self, other: &Self) -> bool { self.uReserved == other.uReserved && self.uNdisPortNumber == other.uNdisPortNumber && self.MacAddr == other.MacAddr } } impl ::core::cmp::Eq for DOT11_MAC_INFO {} unsafe impl ::windows::core::Abi for DOT11_MAC_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_MAC_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uOpmodeMask: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_MAC_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_MAC_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_MAC_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MAC_PARAMETERS").field("Header", &self.Header).field("uOpmodeMask", &self.uOpmodeMask).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_MAC_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uOpmodeMask == other.uOpmodeMask } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_MAC_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_MAC_PARAMETERS { type Abi = Self; } pub const DOT11_MAC_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_MANUFACTURING_CALLBACK_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub dot11ManufacturingCallbackType: DOT11_MANUFACTURING_CALLBACK_TYPE, pub uStatus: u32, pub pvContext: *mut ::core::ffi::c_void, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_MANUFACTURING_CALLBACK_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_MANUFACTURING_CALLBACK_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_MANUFACTURING_CALLBACK_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MANUFACTURING_CALLBACK_PARAMETERS").field("Header", &self.Header).field("dot11ManufacturingCallbackType", &self.dot11ManufacturingCallbackType).field("uStatus", &self.uStatus).field("pvContext", &self.pvContext).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_MANUFACTURING_CALLBACK_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.dot11ManufacturingCallbackType == other.dot11ManufacturingCallbackType && self.uStatus == other.uStatus && self.pvContext == other.pvContext } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_MANUFACTURING_CALLBACK_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_MANUFACTURING_CALLBACK_PARAMETERS { type Abi = Self; } pub const DOT11_MANUFACTURING_CALLBACK_REVISION_1: u32 = 1u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DOT11_MANUFACTURING_CALLBACK_TYPE(pub i32); pub const dot11_manufacturing_callback_unknown: DOT11_MANUFACTURING_CALLBACK_TYPE = DOT11_MANUFACTURING_CALLBACK_TYPE(0i32); pub const dot11_manufacturing_callback_self_test_complete: DOT11_MANUFACTURING_CALLBACK_TYPE = DOT11_MANUFACTURING_CALLBACK_TYPE(1i32); pub const dot11_manufacturing_callback_sleep_complete: DOT11_MANUFACTURING_CALLBACK_TYPE = DOT11_MANUFACTURING_CALLBACK_TYPE(2i32); pub const dot11_manufacturing_callback_IHV_start: DOT11_MANUFACTURING_CALLBACK_TYPE = DOT11_MANUFACTURING_CALLBACK_TYPE(-2147483648i32); pub const dot11_manufacturing_callback_IHV_end: DOT11_MANUFACTURING_CALLBACK_TYPE = DOT11_MANUFACTURING_CALLBACK_TYPE(-1i32); impl ::core::convert::From<i32> for DOT11_MANUFACTURING_CALLBACK_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_MANUFACTURING_CALLBACK_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_MANUFACTURING_FUNCTIONAL_TEST_QUERY_ADC { pub Dot11Band: DOT11_BAND, pub uChannel: u32, pub ADCPowerLevel: i32, } impl DOT11_MANUFACTURING_FUNCTIONAL_TEST_QUERY_ADC {} impl ::core::default::Default for DOT11_MANUFACTURING_FUNCTIONAL_TEST_QUERY_ADC { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_MANUFACTURING_FUNCTIONAL_TEST_QUERY_ADC { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MANUFACTURING_FUNCTIONAL_TEST_QUERY_ADC").field("Dot11Band", &self.Dot11Band).field("uChannel", &self.uChannel).field("ADCPowerLevel", &self.ADCPowerLevel).finish() } } impl ::core::cmp::PartialEq for DOT11_MANUFACTURING_FUNCTIONAL_TEST_QUERY_ADC { fn eq(&self, other: &Self) -> bool { self.Dot11Band == other.Dot11Band && self.uChannel == other.uChannel && self.ADCPowerLevel == other.ADCPowerLevel } } impl ::core::cmp::Eq for DOT11_MANUFACTURING_FUNCTIONAL_TEST_QUERY_ADC {} unsafe impl ::windows::core::Abi for DOT11_MANUFACTURING_FUNCTIONAL_TEST_QUERY_ADC { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_MANUFACTURING_FUNCTIONAL_TEST_RX { pub bEnabled: super::super::Foundation::BOOLEAN, pub Dot11Band: DOT11_BAND, pub uChannel: u32, pub PowerLevel: i32, } #[cfg(feature = "Win32_Foundation")] impl DOT11_MANUFACTURING_FUNCTIONAL_TEST_RX {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_MANUFACTURING_FUNCTIONAL_TEST_RX { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_MANUFACTURING_FUNCTIONAL_TEST_RX { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MANUFACTURING_FUNCTIONAL_TEST_RX").field("bEnabled", &self.bEnabled).field("Dot11Band", &self.Dot11Band).field("uChannel", &self.uChannel).field("PowerLevel", &self.PowerLevel).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_MANUFACTURING_FUNCTIONAL_TEST_RX { fn eq(&self, other: &Self) -> bool { self.bEnabled == other.bEnabled && self.Dot11Band == other.Dot11Band && self.uChannel == other.uChannel && self.PowerLevel == other.PowerLevel } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_MANUFACTURING_FUNCTIONAL_TEST_RX {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_MANUFACTURING_FUNCTIONAL_TEST_RX { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_MANUFACTURING_FUNCTIONAL_TEST_TX { pub bEnable: super::super::Foundation::BOOLEAN, pub bOpenLoop: super::super::Foundation::BOOLEAN, pub Dot11Band: DOT11_BAND, pub uChannel: u32, pub uSetPowerLevel: u32, pub ADCPowerLevel: i32, } #[cfg(feature = "Win32_Foundation")] impl DOT11_MANUFACTURING_FUNCTIONAL_TEST_TX {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_MANUFACTURING_FUNCTIONAL_TEST_TX { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_MANUFACTURING_FUNCTIONAL_TEST_TX { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MANUFACTURING_FUNCTIONAL_TEST_TX").field("bEnable", &self.bEnable).field("bOpenLoop", &self.bOpenLoop).field("Dot11Band", &self.Dot11Band).field("uChannel", &self.uChannel).field("uSetPowerLevel", &self.uSetPowerLevel).field("ADCPowerLevel", &self.ADCPowerLevel).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_MANUFACTURING_FUNCTIONAL_TEST_TX { fn eq(&self, other: &Self) -> bool { self.bEnable == other.bEnable && self.bOpenLoop == other.bOpenLoop && self.Dot11Band == other.Dot11Band && self.uChannel == other.uChannel && self.uSetPowerLevel == other.uSetPowerLevel && self.ADCPowerLevel == other.ADCPowerLevel } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_MANUFACTURING_FUNCTIONAL_TEST_TX {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_MANUFACTURING_FUNCTIONAL_TEST_TX { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_MANUFACTURING_SELF_TEST_QUERY_RESULTS { pub SelfTestType: DOT11_MANUFACTURING_SELF_TEST_TYPE, pub uTestID: u32, pub bResult: super::super::Foundation::BOOLEAN, pub uPinFailedBitMask: u32, pub pvContext: *mut ::core::ffi::c_void, pub uBytesWrittenOut: u32, pub ucBufferOut: [u8; 1], } #[cfg(feature = "Win32_Foundation")] impl DOT11_MANUFACTURING_SELF_TEST_QUERY_RESULTS {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_MANUFACTURING_SELF_TEST_QUERY_RESULTS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_MANUFACTURING_SELF_TEST_QUERY_RESULTS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MANUFACTURING_SELF_TEST_QUERY_RESULTS") .field("SelfTestType", &self.SelfTestType) .field("uTestID", &self.uTestID) .field("bResult", &self.bResult) .field("uPinFailedBitMask", &self.uPinFailedBitMask) .field("pvContext", &self.pvContext) .field("uBytesWrittenOut", &self.uBytesWrittenOut) .field("ucBufferOut", &self.ucBufferOut) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_MANUFACTURING_SELF_TEST_QUERY_RESULTS { fn eq(&self, other: &Self) -> bool { self.SelfTestType == other.SelfTestType && self.uTestID == other.uTestID && self.bResult == other.bResult && self.uPinFailedBitMask == other.uPinFailedBitMask && self.pvContext == other.pvContext && self.uBytesWrittenOut == other.uBytesWrittenOut && self.ucBufferOut == other.ucBufferOut } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_MANUFACTURING_SELF_TEST_QUERY_RESULTS {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_MANUFACTURING_SELF_TEST_QUERY_RESULTS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_MANUFACTURING_SELF_TEST_SET_PARAMS { pub SelfTestType: DOT11_MANUFACTURING_SELF_TEST_TYPE, pub uTestID: u32, pub uPinBitMask: u32, pub pvContext: *mut ::core::ffi::c_void, pub uBufferLength: u32, pub ucBufferIn: [u8; 1], } impl DOT11_MANUFACTURING_SELF_TEST_SET_PARAMS {} impl ::core::default::Default for DOT11_MANUFACTURING_SELF_TEST_SET_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_MANUFACTURING_SELF_TEST_SET_PARAMS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MANUFACTURING_SELF_TEST_SET_PARAMS") .field("SelfTestType", &self.SelfTestType) .field("uTestID", &self.uTestID) .field("uPinBitMask", &self.uPinBitMask) .field("pvContext", &self.pvContext) .field("uBufferLength", &self.uBufferLength) .field("ucBufferIn", &self.ucBufferIn) .finish() } } impl ::core::cmp::PartialEq for DOT11_MANUFACTURING_SELF_TEST_SET_PARAMS { fn eq(&self, other: &Self) -> bool { self.SelfTestType == other.SelfTestType && self.uTestID == other.uTestID && self.uPinBitMask == other.uPinBitMask && self.pvContext == other.pvContext && self.uBufferLength == other.uBufferLength && self.ucBufferIn == other.ucBufferIn } } impl ::core::cmp::Eq for DOT11_MANUFACTURING_SELF_TEST_SET_PARAMS {} unsafe impl ::windows::core::Abi for DOT11_MANUFACTURING_SELF_TEST_SET_PARAMS { 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 DOT11_MANUFACTURING_SELF_TEST_TYPE(pub i32); pub const DOT11_MANUFACTURING_SELF_TEST_TYPE_INTERFACE: DOT11_MANUFACTURING_SELF_TEST_TYPE = DOT11_MANUFACTURING_SELF_TEST_TYPE(1i32); pub const DOT11_MANUFACTURING_SELF_TEST_TYPE_RF_INTERFACE: DOT11_MANUFACTURING_SELF_TEST_TYPE = DOT11_MANUFACTURING_SELF_TEST_TYPE(2i32); pub const DOT11_MANUFACTURING_SELF_TEST_TYPE_BT_COEXISTENCE: DOT11_MANUFACTURING_SELF_TEST_TYPE = DOT11_MANUFACTURING_SELF_TEST_TYPE(3i32); impl ::core::convert::From<i32> for DOT11_MANUFACTURING_SELF_TEST_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_MANUFACTURING_SELF_TEST_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_MANUFACTURING_TEST { pub dot11ManufacturingTestType: DOT11_MANUFACTURING_TEST_TYPE, pub uBufferLength: u32, pub ucBuffer: [u8; 1], } impl DOT11_MANUFACTURING_TEST {} impl ::core::default::Default for DOT11_MANUFACTURING_TEST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_MANUFACTURING_TEST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MANUFACTURING_TEST").field("dot11ManufacturingTestType", &self.dot11ManufacturingTestType).field("uBufferLength", &self.uBufferLength).field("ucBuffer", &self.ucBuffer).finish() } } impl ::core::cmp::PartialEq for DOT11_MANUFACTURING_TEST { fn eq(&self, other: &Self) -> bool { self.dot11ManufacturingTestType == other.dot11ManufacturingTestType && self.uBufferLength == other.uBufferLength && self.ucBuffer == other.ucBuffer } } impl ::core::cmp::Eq for DOT11_MANUFACTURING_TEST {} unsafe impl ::windows::core::Abi for DOT11_MANUFACTURING_TEST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_MANUFACTURING_TEST_QUERY_DATA { pub uKey: u32, pub uOffset: u32, pub uBufferLength: u32, pub uBytesRead: u32, pub ucBufferOut: [u8; 1], } impl DOT11_MANUFACTURING_TEST_QUERY_DATA {} impl ::core::default::Default for DOT11_MANUFACTURING_TEST_QUERY_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_MANUFACTURING_TEST_QUERY_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MANUFACTURING_TEST_QUERY_DATA").field("uKey", &self.uKey).field("uOffset", &self.uOffset).field("uBufferLength", &self.uBufferLength).field("uBytesRead", &self.uBytesRead).field("ucBufferOut", &self.ucBufferOut).finish() } } impl ::core::cmp::PartialEq for DOT11_MANUFACTURING_TEST_QUERY_DATA { fn eq(&self, other: &Self) -> bool { self.uKey == other.uKey && self.uOffset == other.uOffset && self.uBufferLength == other.uBufferLength && self.uBytesRead == other.uBytesRead && self.ucBufferOut == other.ucBufferOut } } impl ::core::cmp::Eq for DOT11_MANUFACTURING_TEST_QUERY_DATA {} unsafe impl ::windows::core::Abi for DOT11_MANUFACTURING_TEST_QUERY_DATA { type Abi = Self; } pub const DOT11_MANUFACTURING_TEST_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_MANUFACTURING_TEST_SET_DATA { pub uKey: u32, pub uOffset: u32, pub uBufferLength: u32, pub ucBufferIn: [u8; 1], } impl DOT11_MANUFACTURING_TEST_SET_DATA {} impl ::core::default::Default for DOT11_MANUFACTURING_TEST_SET_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_MANUFACTURING_TEST_SET_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MANUFACTURING_TEST_SET_DATA").field("uKey", &self.uKey).field("uOffset", &self.uOffset).field("uBufferLength", &self.uBufferLength).field("ucBufferIn", &self.ucBufferIn).finish() } } impl ::core::cmp::PartialEq for DOT11_MANUFACTURING_TEST_SET_DATA { fn eq(&self, other: &Self) -> bool { self.uKey == other.uKey && self.uOffset == other.uOffset && self.uBufferLength == other.uBufferLength && self.ucBufferIn == other.ucBufferIn } } impl ::core::cmp::Eq for DOT11_MANUFACTURING_TEST_SET_DATA {} unsafe impl ::windows::core::Abi for DOT11_MANUFACTURING_TEST_SET_DATA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_MANUFACTURING_TEST_SLEEP { pub uSleepTime: u32, pub pvContext: *mut ::core::ffi::c_void, } impl DOT11_MANUFACTURING_TEST_SLEEP {} impl ::core::default::Default for DOT11_MANUFACTURING_TEST_SLEEP { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_MANUFACTURING_TEST_SLEEP { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MANUFACTURING_TEST_SLEEP").field("uSleepTime", &self.uSleepTime).field("pvContext", &self.pvContext).finish() } } impl ::core::cmp::PartialEq for DOT11_MANUFACTURING_TEST_SLEEP { fn eq(&self, other: &Self) -> bool { self.uSleepTime == other.uSleepTime && self.pvContext == other.pvContext } } impl ::core::cmp::Eq for DOT11_MANUFACTURING_TEST_SLEEP {} unsafe impl ::windows::core::Abi for DOT11_MANUFACTURING_TEST_SLEEP { 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 DOT11_MANUFACTURING_TEST_TYPE(pub i32); pub const dot11_manufacturing_test_unknown: DOT11_MANUFACTURING_TEST_TYPE = DOT11_MANUFACTURING_TEST_TYPE(0i32); pub const dot11_manufacturing_test_self_start: DOT11_MANUFACTURING_TEST_TYPE = DOT11_MANUFACTURING_TEST_TYPE(1i32); pub const dot11_manufacturing_test_self_query_result: DOT11_MANUFACTURING_TEST_TYPE = DOT11_MANUFACTURING_TEST_TYPE(2i32); pub const dot11_manufacturing_test_rx: DOT11_MANUFACTURING_TEST_TYPE = DOT11_MANUFACTURING_TEST_TYPE(3i32); pub const dot11_manufacturing_test_tx: DOT11_MANUFACTURING_TEST_TYPE = DOT11_MANUFACTURING_TEST_TYPE(4i32); pub const dot11_manufacturing_test_query_adc: DOT11_MANUFACTURING_TEST_TYPE = DOT11_MANUFACTURING_TEST_TYPE(5i32); pub const dot11_manufacturing_test_set_data: DOT11_MANUFACTURING_TEST_TYPE = DOT11_MANUFACTURING_TEST_TYPE(6i32); pub const dot11_manufacturing_test_query_data: DOT11_MANUFACTURING_TEST_TYPE = DOT11_MANUFACTURING_TEST_TYPE(7i32); pub const dot11_manufacturing_test_sleep: DOT11_MANUFACTURING_TEST_TYPE = DOT11_MANUFACTURING_TEST_TYPE(8i32); pub const dot11_manufacturing_test_awake: DOT11_MANUFACTURING_TEST_TYPE = DOT11_MANUFACTURING_TEST_TYPE(9i32); pub const dot11_manufacturing_test_IHV_start: DOT11_MANUFACTURING_TEST_TYPE = DOT11_MANUFACTURING_TEST_TYPE(-2147483648i32); pub const dot11_manufacturing_test_IHV_end: DOT11_MANUFACTURING_TEST_TYPE = DOT11_MANUFACTURING_TEST_TYPE(-1i32); impl ::core::convert::From<i32> for DOT11_MANUFACTURING_TEST_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_MANUFACTURING_TEST_TYPE { type Abi = Self; } pub const DOT11_MAX_CHANNEL_HINTS: u32 = 4u32; pub const DOT11_MAX_NUM_DEFAULT_KEY: u32 = 4u32; pub const DOT11_MAX_NUM_DEFAULT_KEY_MFP: u32 = 6u32; pub const DOT11_MAX_NUM_OF_FRAGMENTS: u32 = 16u32; pub const DOT11_MAX_PDU_SIZE: u32 = 2346u32; pub const DOT11_MAX_REQUESTED_SERVICE_INFORMATION_LENGTH: u32 = 255u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_MD_CAPABILITY_ENTRY_LIST { pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub dot11MDCapabilityEntry: [DOT11_MULTI_DOMAIN_CAPABILITY_ENTRY; 1], } impl DOT11_MD_CAPABILITY_ENTRY_LIST {} impl ::core::default::Default for DOT11_MD_CAPABILITY_ENTRY_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_MD_CAPABILITY_ENTRY_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MD_CAPABILITY_ENTRY_LIST").field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("dot11MDCapabilityEntry", &self.dot11MDCapabilityEntry).finish() } } impl ::core::cmp::PartialEq for DOT11_MD_CAPABILITY_ENTRY_LIST { fn eq(&self, other: &Self) -> bool { self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.dot11MDCapabilityEntry == other.dot11MDCapabilityEntry } } impl ::core::cmp::Eq for DOT11_MD_CAPABILITY_ENTRY_LIST {} unsafe impl ::windows::core::Abi for DOT11_MD_CAPABILITY_ENTRY_LIST { type Abi = Self; } pub const DOT11_MIN_PDU_SIZE: u32 = 256u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_MPDU_MAX_LENGTH_INDICATION { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uPhyId: u32, pub uMPDUMaxLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_MPDU_MAX_LENGTH_INDICATION {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_MPDU_MAX_LENGTH_INDICATION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_MPDU_MAX_LENGTH_INDICATION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MPDU_MAX_LENGTH_INDICATION").field("Header", &self.Header).field("uPhyId", &self.uPhyId).field("uMPDUMaxLength", &self.uMPDUMaxLength).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_MPDU_MAX_LENGTH_INDICATION { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uPhyId == other.uPhyId && self.uMPDUMaxLength == other.uMPDUMaxLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_MPDU_MAX_LENGTH_INDICATION {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_MPDU_MAX_LENGTH_INDICATION { type Abi = Self; } pub const DOT11_MPDU_MAX_LENGTH_INDICATION_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_MULTI_DOMAIN_CAPABILITY_ENTRY { pub uMultiDomainCapabilityIndex: u32, pub uFirstChannelNumber: u32, pub uNumberOfChannels: u32, pub lMaximumTransmitPowerLevel: i32, } impl DOT11_MULTI_DOMAIN_CAPABILITY_ENTRY {} impl ::core::default::Default for DOT11_MULTI_DOMAIN_CAPABILITY_ENTRY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_MULTI_DOMAIN_CAPABILITY_ENTRY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_MULTI_DOMAIN_CAPABILITY_ENTRY") .field("uMultiDomainCapabilityIndex", &self.uMultiDomainCapabilityIndex) .field("uFirstChannelNumber", &self.uFirstChannelNumber) .field("uNumberOfChannels", &self.uNumberOfChannels) .field("lMaximumTransmitPowerLevel", &self.lMaximumTransmitPowerLevel) .finish() } } impl ::core::cmp::PartialEq for DOT11_MULTI_DOMAIN_CAPABILITY_ENTRY { fn eq(&self, other: &Self) -> bool { self.uMultiDomainCapabilityIndex == other.uMultiDomainCapabilityIndex && self.uFirstChannelNumber == other.uFirstChannelNumber && self.uNumberOfChannels == other.uNumberOfChannels && self.lMaximumTransmitPowerLevel == other.lMaximumTransmitPowerLevel } } impl ::core::cmp::Eq for DOT11_MULTI_DOMAIN_CAPABILITY_ENTRY {} unsafe impl ::windows::core::Abi for DOT11_MULTI_DOMAIN_CAPABILITY_ENTRY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_NETWORK { pub dot11Ssid: DOT11_SSID, pub dot11BssType: DOT11_BSS_TYPE, } impl DOT11_NETWORK {} impl ::core::default::Default for DOT11_NETWORK { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_NETWORK { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_NETWORK").field("dot11Ssid", &self.dot11Ssid).field("dot11BssType", &self.dot11BssType).finish() } } impl ::core::cmp::PartialEq for DOT11_NETWORK { fn eq(&self, other: &Self) -> bool { self.dot11Ssid == other.dot11Ssid && self.dot11BssType == other.dot11BssType } } impl ::core::cmp::Eq for DOT11_NETWORK {} unsafe impl ::windows::core::Abi for DOT11_NETWORK { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_NETWORK_LIST { pub dwNumberOfItems: u32, pub dwIndex: u32, pub Network: [DOT11_NETWORK; 1], } impl DOT11_NETWORK_LIST {} impl ::core::default::Default for DOT11_NETWORK_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_NETWORK_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_NETWORK_LIST").field("dwNumberOfItems", &self.dwNumberOfItems).field("dwIndex", &self.dwIndex).field("Network", &self.Network).finish() } } impl ::core::cmp::PartialEq for DOT11_NETWORK_LIST { fn eq(&self, other: &Self) -> bool { self.dwNumberOfItems == other.dwNumberOfItems && self.dwIndex == other.dwIndex && self.Network == other.Network } } impl ::core::cmp::Eq for DOT11_NETWORK_LIST {} unsafe impl ::windows::core::Abi for DOT11_NETWORK_LIST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_NIC_SPECIFIC_EXTENSION { pub uBufferLength: u32, pub uTotalBufferLength: u32, pub ucBuffer: [u8; 1], } impl DOT11_NIC_SPECIFIC_EXTENSION {} impl ::core::default::Default for DOT11_NIC_SPECIFIC_EXTENSION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_NIC_SPECIFIC_EXTENSION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_NIC_SPECIFIC_EXTENSION").field("uBufferLength", &self.uBufferLength).field("uTotalBufferLength", &self.uTotalBufferLength).field("ucBuffer", &self.ucBuffer).finish() } } impl ::core::cmp::PartialEq for DOT11_NIC_SPECIFIC_EXTENSION { fn eq(&self, other: &Self) -> bool { self.uBufferLength == other.uBufferLength && self.uTotalBufferLength == other.uTotalBufferLength && self.ucBuffer == other.ucBuffer } } impl ::core::cmp::Eq for DOT11_NIC_SPECIFIC_EXTENSION {} unsafe impl ::windows::core::Abi for DOT11_NIC_SPECIFIC_EXTENSION { type Abi = Self; } pub const DOT11_NLO_FLAG_SCAN_AT_SYSTEM_RESUME: u32 = 4u32; pub const DOT11_NLO_FLAG_SCAN_ON_AOAC_PLATFORM: u32 = 2u32; pub const DOT11_NLO_FLAG_STOP_NLO_INDICATION: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_OFDM_PHY_ATTRIBUTES { pub uFrequencyBandsSupported: u32, } impl DOT11_OFDM_PHY_ATTRIBUTES {} impl ::core::default::Default for DOT11_OFDM_PHY_ATTRIBUTES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_OFDM_PHY_ATTRIBUTES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_OFDM_PHY_ATTRIBUTES").field("uFrequencyBandsSupported", &self.uFrequencyBandsSupported).finish() } } impl ::core::cmp::PartialEq for DOT11_OFDM_PHY_ATTRIBUTES { fn eq(&self, other: &Self) -> bool { self.uFrequencyBandsSupported == other.uFrequencyBandsSupported } } impl ::core::cmp::Eq for DOT11_OFDM_PHY_ATTRIBUTES {} unsafe impl ::windows::core::Abi for DOT11_OFDM_PHY_ATTRIBUTES { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_OFFLOAD_CAPABILITY { pub uReserved: u32, pub uFlags: u32, pub uSupportedWEPAlgorithms: u32, pub uNumOfReplayWindows: u32, pub uMaxWEPKeyMappingLength: u32, pub uSupportedAuthAlgorithms: u32, pub uMaxAuthKeyMappingLength: u32, } impl DOT11_OFFLOAD_CAPABILITY {} impl ::core::default::Default for DOT11_OFFLOAD_CAPABILITY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_OFFLOAD_CAPABILITY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_OFFLOAD_CAPABILITY") .field("uReserved", &self.uReserved) .field("uFlags", &self.uFlags) .field("uSupportedWEPAlgorithms", &self.uSupportedWEPAlgorithms) .field("uNumOfReplayWindows", &self.uNumOfReplayWindows) .field("uMaxWEPKeyMappingLength", &self.uMaxWEPKeyMappingLength) .field("uSupportedAuthAlgorithms", &self.uSupportedAuthAlgorithms) .field("uMaxAuthKeyMappingLength", &self.uMaxAuthKeyMappingLength) .finish() } } impl ::core::cmp::PartialEq for DOT11_OFFLOAD_CAPABILITY { fn eq(&self, other: &Self) -> bool { self.uReserved == other.uReserved && self.uFlags == other.uFlags && self.uSupportedWEPAlgorithms == other.uSupportedWEPAlgorithms && self.uNumOfReplayWindows == other.uNumOfReplayWindows && self.uMaxWEPKeyMappingLength == other.uMaxWEPKeyMappingLength && self.uSupportedAuthAlgorithms == other.uSupportedAuthAlgorithms && self.uMaxAuthKeyMappingLength == other.uMaxAuthKeyMappingLength } } impl ::core::cmp::Eq for DOT11_OFFLOAD_CAPABILITY {} unsafe impl ::windows::core::Abi for DOT11_OFFLOAD_CAPABILITY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_OFFLOAD_NETWORK { pub Ssid: DOT11_SSID, pub UnicastCipher: DOT11_CIPHER_ALGORITHM, pub AuthAlgo: DOT11_AUTH_ALGORITHM, pub Dot11ChannelHints: [DOT11_CHANNEL_HINT; 4], } impl DOT11_OFFLOAD_NETWORK {} impl ::core::default::Default for DOT11_OFFLOAD_NETWORK { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_OFFLOAD_NETWORK { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_OFFLOAD_NETWORK").field("Ssid", &self.Ssid).field("UnicastCipher", &self.UnicastCipher).field("AuthAlgo", &self.AuthAlgo).field("Dot11ChannelHints", &self.Dot11ChannelHints).finish() } } impl ::core::cmp::PartialEq for DOT11_OFFLOAD_NETWORK { fn eq(&self, other: &Self) -> bool { self.Ssid == other.Ssid && self.UnicastCipher == other.UnicastCipher && self.AuthAlgo == other.AuthAlgo && self.Dot11ChannelHints == other.Dot11ChannelHints } } impl ::core::cmp::Eq for DOT11_OFFLOAD_NETWORK {} unsafe impl ::windows::core::Abi for DOT11_OFFLOAD_NETWORK { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_OFFLOAD_NETWORK_LIST_INFO { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub ulFlags: u32, pub FastScanPeriod: u32, pub FastScanIterations: u32, pub SlowScanPeriod: u32, pub uNumOfEntries: u32, pub offloadNetworkList: [DOT11_OFFLOAD_NETWORK; 1], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_OFFLOAD_NETWORK_LIST_INFO {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_OFFLOAD_NETWORK_LIST_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_OFFLOAD_NETWORK_LIST_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_OFFLOAD_NETWORK_LIST_INFO") .field("Header", &self.Header) .field("ulFlags", &self.ulFlags) .field("FastScanPeriod", &self.FastScanPeriod) .field("FastScanIterations", &self.FastScanIterations) .field("SlowScanPeriod", &self.SlowScanPeriod) .field("uNumOfEntries", &self.uNumOfEntries) .field("offloadNetworkList", &self.offloadNetworkList) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_OFFLOAD_NETWORK_LIST_INFO { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.ulFlags == other.ulFlags && self.FastScanPeriod == other.FastScanPeriod && self.FastScanIterations == other.FastScanIterations && self.SlowScanPeriod == other.SlowScanPeriod && self.uNumOfEntries == other.uNumOfEntries && self.offloadNetworkList == other.offloadNetworkList } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_OFFLOAD_NETWORK_LIST_INFO {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_OFFLOAD_NETWORK_LIST_INFO { type Abi = Self; } pub const DOT11_OFFLOAD_NETWORK_LIST_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_OFFLOAD_NETWORK_STATUS_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub Status: i32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_OFFLOAD_NETWORK_STATUS_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_OFFLOAD_NETWORK_STATUS_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_OFFLOAD_NETWORK_STATUS_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_OFFLOAD_NETWORK_STATUS_PARAMETERS").field("Header", &self.Header).field("Status", &self.Status).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_OFFLOAD_NETWORK_STATUS_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Status == other.Status } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_OFFLOAD_NETWORK_STATUS_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_OFFLOAD_NETWORK_STATUS_PARAMETERS { type Abi = Self; } pub const DOT11_OFFLOAD_NETWORK_STATUS_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DOT11_OFFLOAD_TYPE(pub i32); pub const dot11_offload_type_wep: DOT11_OFFLOAD_TYPE = DOT11_OFFLOAD_TYPE(1i32); pub const dot11_offload_type_auth: DOT11_OFFLOAD_TYPE = DOT11_OFFLOAD_TYPE(2i32); impl ::core::convert::From<i32> for DOT11_OFFLOAD_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_OFFLOAD_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_OI { pub OILength: u16, pub OI: [u8; 5], } impl DOT11_OI {} impl ::core::default::Default for DOT11_OI { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_OI { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_OI").field("OILength", &self.OILength).field("OI", &self.OI).finish() } } impl ::core::cmp::PartialEq for DOT11_OI { fn eq(&self, other: &Self) -> bool { self.OILength == other.OILength && self.OI == other.OI } } impl ::core::cmp::Eq for DOT11_OI {} unsafe impl ::windows::core::Abi for DOT11_OI { type Abi = Self; } pub const DOT11_OI_MAX_LENGTH: u32 = 5u32; pub const DOT11_OI_MIN_LENGTH: u32 = 3u32; pub const DOT11_OPERATION_MODE_AP: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_OPERATION_MODE_CAPABILITY { pub uReserved: u32, pub uMajorVersion: u32, pub uMinorVersion: u32, pub uNumOfTXBuffers: u32, pub uNumOfRXBuffers: u32, pub uOpModeCapability: u32, } impl DOT11_OPERATION_MODE_CAPABILITY {} impl ::core::default::Default for DOT11_OPERATION_MODE_CAPABILITY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_OPERATION_MODE_CAPABILITY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_OPERATION_MODE_CAPABILITY") .field("uReserved", &self.uReserved) .field("uMajorVersion", &self.uMajorVersion) .field("uMinorVersion", &self.uMinorVersion) .field("uNumOfTXBuffers", &self.uNumOfTXBuffers) .field("uNumOfRXBuffers", &self.uNumOfRXBuffers) .field("uOpModeCapability", &self.uOpModeCapability) .finish() } } impl ::core::cmp::PartialEq for DOT11_OPERATION_MODE_CAPABILITY { fn eq(&self, other: &Self) -> bool { self.uReserved == other.uReserved && self.uMajorVersion == other.uMajorVersion && self.uMinorVersion == other.uMinorVersion && self.uNumOfTXBuffers == other.uNumOfTXBuffers && self.uNumOfRXBuffers == other.uNumOfRXBuffers && self.uOpModeCapability == other.uOpModeCapability } } impl ::core::cmp::Eq for DOT11_OPERATION_MODE_CAPABILITY {} unsafe impl ::windows::core::Abi for DOT11_OPERATION_MODE_CAPABILITY { type Abi = Self; } pub const DOT11_OPERATION_MODE_EXTENSIBLE_AP: u32 = 8u32; pub const DOT11_OPERATION_MODE_EXTENSIBLE_STATION: u32 = 4u32; pub const DOT11_OPERATION_MODE_MANUFACTURING: u32 = 1073741824u32; pub const DOT11_OPERATION_MODE_NETWORK_MONITOR: u32 = 2147483648u32; pub const DOT11_OPERATION_MODE_STATION: u32 = 1u32; pub const DOT11_OPERATION_MODE_UNKNOWN: u32 = 0u32; pub const DOT11_OPERATION_MODE_WFD_CLIENT: u32 = 64u32; pub const DOT11_OPERATION_MODE_WFD_DEVICE: u32 = 16u32; pub const DOT11_OPERATION_MODE_WFD_GROUP_OWNER: u32 = 32u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_OPTIONAL_CAPABILITY { pub uReserved: u32, pub bDot11PCF: super::super::Foundation::BOOLEAN, pub bDot11PCFMPDUTransferToPC: super::super::Foundation::BOOLEAN, pub bStrictlyOrderedServiceClass: super::super::Foundation::BOOLEAN, } #[cfg(feature = "Win32_Foundation")] impl DOT11_OPTIONAL_CAPABILITY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_OPTIONAL_CAPABILITY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_OPTIONAL_CAPABILITY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_OPTIONAL_CAPABILITY").field("uReserved", &self.uReserved).field("bDot11PCF", &self.bDot11PCF).field("bDot11PCFMPDUTransferToPC", &self.bDot11PCFMPDUTransferToPC).field("bStrictlyOrderedServiceClass", &self.bStrictlyOrderedServiceClass).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_OPTIONAL_CAPABILITY { fn eq(&self, other: &Self) -> bool { self.uReserved == other.uReserved && self.bDot11PCF == other.bDot11PCF && self.bDot11PCFMPDUTransferToPC == other.bDot11PCFMPDUTransferToPC && self.bStrictlyOrderedServiceClass == other.bStrictlyOrderedServiceClass } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_OPTIONAL_CAPABILITY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_OPTIONAL_CAPABILITY { type Abi = Self; } pub const DOT11_PACKET_TYPE_ALL_MULTICAST_CTRL: u32 = 4096u32; pub const DOT11_PACKET_TYPE_ALL_MULTICAST_DATA: u32 = 16384u32; pub const DOT11_PACKET_TYPE_ALL_MULTICAST_MGMT: u32 = 8192u32; pub const DOT11_PACKET_TYPE_BROADCAST_CTRL: u32 = 64u32; pub const DOT11_PACKET_TYPE_BROADCAST_DATA: u32 = 256u32; pub const DOT11_PACKET_TYPE_BROADCAST_MGMT: u32 = 128u32; pub const DOT11_PACKET_TYPE_DIRECTED_CTRL: u32 = 1u32; pub const DOT11_PACKET_TYPE_DIRECTED_DATA: u32 = 4u32; pub const DOT11_PACKET_TYPE_DIRECTED_MGMT: u32 = 2u32; pub const DOT11_PACKET_TYPE_MULTICAST_CTRL: u32 = 8u32; pub const DOT11_PACKET_TYPE_MULTICAST_DATA: u32 = 32u32; pub const DOT11_PACKET_TYPE_MULTICAST_MGMT: u32 = 16u32; pub const DOT11_PACKET_TYPE_PROMISCUOUS_CTRL: u32 = 512u32; pub const DOT11_PACKET_TYPE_PROMISCUOUS_DATA: u32 = 2048u32; pub const DOT11_PACKET_TYPE_PROMISCUOUS_MGMT: u32 = 1024u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_PEER_INFO { pub MacAddress: [u8; 6], pub usCapabilityInformation: u16, pub AuthAlgo: DOT11_AUTH_ALGORITHM, pub UnicastCipherAlgo: DOT11_CIPHER_ALGORITHM, pub MulticastCipherAlgo: DOT11_CIPHER_ALGORITHM, pub bWpsEnabled: super::super::Foundation::BOOLEAN, pub usListenInterval: u16, pub ucSupportedRates: [u8; 255], pub usAssociationID: u16, pub AssociationState: DOT11_ASSOCIATION_STATE, pub PowerMode: DOT11_POWER_MODE, pub liAssociationUpTime: i64, pub Statistics: DOT11_PEER_STATISTICS, } #[cfg(feature = "Win32_Foundation")] impl DOT11_PEER_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_PEER_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_PEER_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PEER_INFO") .field("MacAddress", &self.MacAddress) .field("usCapabilityInformation", &self.usCapabilityInformation) .field("AuthAlgo", &self.AuthAlgo) .field("UnicastCipherAlgo", &self.UnicastCipherAlgo) .field("MulticastCipherAlgo", &self.MulticastCipherAlgo) .field("bWpsEnabled", &self.bWpsEnabled) .field("usListenInterval", &self.usListenInterval) .field("ucSupportedRates", &self.ucSupportedRates) .field("usAssociationID", &self.usAssociationID) .field("AssociationState", &self.AssociationState) .field("PowerMode", &self.PowerMode) .field("liAssociationUpTime", &self.liAssociationUpTime) .field("Statistics", &self.Statistics) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_PEER_INFO { fn eq(&self, other: &Self) -> bool { self.MacAddress == other.MacAddress && self.usCapabilityInformation == other.usCapabilityInformation && self.AuthAlgo == other.AuthAlgo && self.UnicastCipherAlgo == other.UnicastCipherAlgo && self.MulticastCipherAlgo == other.MulticastCipherAlgo && self.bWpsEnabled == other.bWpsEnabled && self.usListenInterval == other.usListenInterval && self.ucSupportedRates == other.ucSupportedRates && self.usAssociationID == other.usAssociationID && self.AssociationState == other.AssociationState && self.PowerMode == other.PowerMode && self.liAssociationUpTime == other.liAssociationUpTime && self.Statistics == other.Statistics } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_PEER_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_PEER_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_PEER_INFO_LIST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub PeerInfo: [DOT11_PEER_INFO; 1], } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_PEER_INFO_LIST {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_PEER_INFO_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_PEER_INFO_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PEER_INFO_LIST").field("Header", &self.Header).field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("PeerInfo", &self.PeerInfo).finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_PEER_INFO_LIST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.PeerInfo == other.PeerInfo } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_PEER_INFO_LIST {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_PEER_INFO_LIST { type Abi = Self; } pub const DOT11_PEER_INFO_LIST_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_PEER_STATISTICS { pub ullDecryptSuccessCount: u64, pub ullDecryptFailureCount: u64, pub ullTxPacketSuccessCount: u64, pub ullTxPacketFailureCount: u64, pub ullRxPacketSuccessCount: u64, pub ullRxPacketFailureCount: u64, } impl DOT11_PEER_STATISTICS {} impl ::core::default::Default for DOT11_PEER_STATISTICS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_PEER_STATISTICS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PEER_STATISTICS") .field("ullDecryptSuccessCount", &self.ullDecryptSuccessCount) .field("ullDecryptFailureCount", &self.ullDecryptFailureCount) .field("ullTxPacketSuccessCount", &self.ullTxPacketSuccessCount) .field("ullTxPacketFailureCount", &self.ullTxPacketFailureCount) .field("ullRxPacketSuccessCount", &self.ullRxPacketSuccessCount) .field("ullRxPacketFailureCount", &self.ullRxPacketFailureCount) .finish() } } impl ::core::cmp::PartialEq for DOT11_PEER_STATISTICS { fn eq(&self, other: &Self) -> bool { self.ullDecryptSuccessCount == other.ullDecryptSuccessCount && self.ullDecryptFailureCount == other.ullDecryptFailureCount && self.ullTxPacketSuccessCount == other.ullTxPacketSuccessCount && self.ullTxPacketFailureCount == other.ullTxPacketFailureCount && self.ullRxPacketSuccessCount == other.ullRxPacketSuccessCount && self.ullRxPacketFailureCount == other.ullRxPacketFailureCount } } impl ::core::cmp::Eq for DOT11_PEER_STATISTICS {} unsafe impl ::windows::core::Abi for DOT11_PEER_STATISTICS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_PER_MSDU_COUNTERS { pub uTransmittedFragmentCount: u32, pub uRetryCount: u32, pub uRTSSuccessCount: u32, pub uRTSFailureCount: u32, pub uACKFailureCount: u32, } impl DOT11_PER_MSDU_COUNTERS {} impl ::core::default::Default for DOT11_PER_MSDU_COUNTERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_PER_MSDU_COUNTERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PER_MSDU_COUNTERS") .field("uTransmittedFragmentCount", &self.uTransmittedFragmentCount) .field("uRetryCount", &self.uRetryCount) .field("uRTSSuccessCount", &self.uRTSSuccessCount) .field("uRTSFailureCount", &self.uRTSFailureCount) .field("uACKFailureCount", &self.uACKFailureCount) .finish() } } impl ::core::cmp::PartialEq for DOT11_PER_MSDU_COUNTERS { fn eq(&self, other: &Self) -> bool { self.uTransmittedFragmentCount == other.uTransmittedFragmentCount && self.uRetryCount == other.uRetryCount && self.uRTSSuccessCount == other.uRTSSuccessCount && self.uRTSFailureCount == other.uRTSFailureCount && self.uACKFailureCount == other.uACKFailureCount } } impl ::core::cmp::Eq for DOT11_PER_MSDU_COUNTERS {} unsafe impl ::windows::core::Abi for DOT11_PER_MSDU_COUNTERS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_PHY_ATTRIBUTES { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PhyType: DOT11_PHY_TYPE, pub bHardwarePhyState: super::super::Foundation::BOOLEAN, pub bSoftwarePhyState: super::super::Foundation::BOOLEAN, pub bCFPollable: super::super::Foundation::BOOLEAN, pub uMPDUMaxLength: u32, pub TempType: DOT11_TEMP_TYPE, pub DiversitySupport: DOT11_DIVERSITY_SUPPORT, pub PhySpecificAttributes: DOT11_PHY_ATTRIBUTES_0, pub uNumberSupportedPowerLevels: u32, pub TxPowerLevels: [u32; 8], pub uNumDataRateMappingEntries: u32, pub DataRateMappingEntries: [DOT11_DATA_RATE_MAPPING_ENTRY; 126], pub SupportedDataRatesValue: DOT11_SUPPORTED_DATA_RATES_VALUE_V2, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_PHY_ATTRIBUTES {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_PHY_ATTRIBUTES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_PHY_ATTRIBUTES { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_PHY_ATTRIBUTES {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_PHY_ATTRIBUTES { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub union DOT11_PHY_ATTRIBUTES_0 { pub HRDSSSAttributes: DOT11_HRDSSS_PHY_ATTRIBUTES, pub OFDMAttributes: DOT11_OFDM_PHY_ATTRIBUTES, pub ERPAttributes: DOT11_ERP_PHY_ATTRIBUTES, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_PHY_ATTRIBUTES_0 {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_PHY_ATTRIBUTES_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_PHY_ATTRIBUTES_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_PHY_ATTRIBUTES_0 {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_PHY_ATTRIBUTES_0 { type Abi = Self; } pub const DOT11_PHY_ATTRIBUTES_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_PHY_FRAME_STATISTICS { pub ullTransmittedFrameCount: u64, pub ullMulticastTransmittedFrameCount: u64, pub ullFailedCount: u64, pub ullRetryCount: u64, pub ullMultipleRetryCount: u64, pub ullMaxTXLifetimeExceededCount: u64, pub ullTransmittedFragmentCount: u64, pub ullRTSSuccessCount: u64, pub ullRTSFailureCount: u64, pub ullACKFailureCount: u64, pub ullReceivedFrameCount: u64, pub ullMulticastReceivedFrameCount: u64, pub ullPromiscuousReceivedFrameCount: u64, pub ullMaxRXLifetimeExceededCount: u64, pub ullFrameDuplicateCount: u64, pub ullReceivedFragmentCount: u64, pub ullPromiscuousReceivedFragmentCount: u64, pub ullFCSErrorCount: u64, } impl DOT11_PHY_FRAME_STATISTICS {} impl ::core::default::Default for DOT11_PHY_FRAME_STATISTICS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_PHY_FRAME_STATISTICS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PHY_FRAME_STATISTICS") .field("ullTransmittedFrameCount", &self.ullTransmittedFrameCount) .field("ullMulticastTransmittedFrameCount", &self.ullMulticastTransmittedFrameCount) .field("ullFailedCount", &self.ullFailedCount) .field("ullRetryCount", &self.ullRetryCount) .field("ullMultipleRetryCount", &self.ullMultipleRetryCount) .field("ullMaxTXLifetimeExceededCount", &self.ullMaxTXLifetimeExceededCount) .field("ullTransmittedFragmentCount", &self.ullTransmittedFragmentCount) .field("ullRTSSuccessCount", &self.ullRTSSuccessCount) .field("ullRTSFailureCount", &self.ullRTSFailureCount) .field("ullACKFailureCount", &self.ullACKFailureCount) .field("ullReceivedFrameCount", &self.ullReceivedFrameCount) .field("ullMulticastReceivedFrameCount", &self.ullMulticastReceivedFrameCount) .field("ullPromiscuousReceivedFrameCount", &self.ullPromiscuousReceivedFrameCount) .field("ullMaxRXLifetimeExceededCount", &self.ullMaxRXLifetimeExceededCount) .field("ullFrameDuplicateCount", &self.ullFrameDuplicateCount) .field("ullReceivedFragmentCount", &self.ullReceivedFragmentCount) .field("ullPromiscuousReceivedFragmentCount", &self.ullPromiscuousReceivedFragmentCount) .field("ullFCSErrorCount", &self.ullFCSErrorCount) .finish() } } impl ::core::cmp::PartialEq for DOT11_PHY_FRAME_STATISTICS { fn eq(&self, other: &Self) -> bool { self.ullTransmittedFrameCount == other.ullTransmittedFrameCount && self.ullMulticastTransmittedFrameCount == other.ullMulticastTransmittedFrameCount && self.ullFailedCount == other.ullFailedCount && self.ullRetryCount == other.ullRetryCount && self.ullMultipleRetryCount == other.ullMultipleRetryCount && self.ullMaxTXLifetimeExceededCount == other.ullMaxTXLifetimeExceededCount && self.ullTransmittedFragmentCount == other.ullTransmittedFragmentCount && self.ullRTSSuccessCount == other.ullRTSSuccessCount && self.ullRTSFailureCount == other.ullRTSFailureCount && self.ullACKFailureCount == other.ullACKFailureCount && self.ullReceivedFrameCount == other.ullReceivedFrameCount && self.ullMulticastReceivedFrameCount == other.ullMulticastReceivedFrameCount && self.ullPromiscuousReceivedFrameCount == other.ullPromiscuousReceivedFrameCount && self.ullMaxRXLifetimeExceededCount == other.ullMaxRXLifetimeExceededCount && self.ullFrameDuplicateCount == other.ullFrameDuplicateCount && self.ullReceivedFragmentCount == other.ullReceivedFragmentCount && self.ullPromiscuousReceivedFragmentCount == other.ullPromiscuousReceivedFragmentCount && self.ullFCSErrorCount == other.ullFCSErrorCount } } impl ::core::cmp::Eq for DOT11_PHY_FRAME_STATISTICS {} unsafe impl ::windows::core::Abi for DOT11_PHY_FRAME_STATISTICS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_PHY_FREQUENCY_ADOPTED_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub ulPhyId: u32, pub Anonymous: DOT11_PHY_FREQUENCY_ADOPTED_PARAMETERS_0, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_PHY_FREQUENCY_ADOPTED_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_PHY_FREQUENCY_ADOPTED_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_PHY_FREQUENCY_ADOPTED_PARAMETERS { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_PHY_FREQUENCY_ADOPTED_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_PHY_FREQUENCY_ADOPTED_PARAMETERS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub union DOT11_PHY_FREQUENCY_ADOPTED_PARAMETERS_0 { pub ulChannel: u32, pub ulFrequency: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_PHY_FREQUENCY_ADOPTED_PARAMETERS_0 {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_PHY_FREQUENCY_ADOPTED_PARAMETERS_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_PHY_FREQUENCY_ADOPTED_PARAMETERS_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_PHY_FREQUENCY_ADOPTED_PARAMETERS_0 {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_PHY_FREQUENCY_ADOPTED_PARAMETERS_0 { type Abi = Self; } pub const DOT11_PHY_FREQUENCY_ADOPTED_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_PHY_ID_LIST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub dot11PhyId: [u32; 1], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_PHY_ID_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_PHY_ID_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_PHY_ID_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PHY_ID_LIST").field("Header", &self.Header).field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("dot11PhyId", &self.dot11PhyId).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_PHY_ID_LIST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.dot11PhyId == other.dot11PhyId } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_PHY_ID_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_PHY_ID_LIST { type Abi = Self; } pub const DOT11_PHY_ID_LIST_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_PHY_STATE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uPhyId: u32, pub bHardwarePhyState: super::super::Foundation::BOOLEAN, pub bSoftwarePhyState: super::super::Foundation::BOOLEAN, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_PHY_STATE_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_PHY_STATE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_PHY_STATE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PHY_STATE_PARAMETERS").field("Header", &self.Header).field("uPhyId", &self.uPhyId).field("bHardwarePhyState", &self.bHardwarePhyState).field("bSoftwarePhyState", &self.bSoftwarePhyState).finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_PHY_STATE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uPhyId == other.uPhyId && self.bHardwarePhyState == other.bHardwarePhyState && self.bSoftwarePhyState == other.bSoftwarePhyState } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_PHY_STATE_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_PHY_STATE_PARAMETERS { type Abi = Self; } pub const DOT11_PHY_STATE_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DOT11_PHY_TYPE(pub i32); pub const dot11_phy_type_unknown: DOT11_PHY_TYPE = DOT11_PHY_TYPE(0i32); pub const dot11_phy_type_any: DOT11_PHY_TYPE = DOT11_PHY_TYPE(0i32); pub const dot11_phy_type_fhss: DOT11_PHY_TYPE = DOT11_PHY_TYPE(1i32); pub const dot11_phy_type_dsss: DOT11_PHY_TYPE = DOT11_PHY_TYPE(2i32); pub const dot11_phy_type_irbaseband: DOT11_PHY_TYPE = DOT11_PHY_TYPE(3i32); pub const dot11_phy_type_ofdm: DOT11_PHY_TYPE = DOT11_PHY_TYPE(4i32); pub const dot11_phy_type_hrdsss: DOT11_PHY_TYPE = DOT11_PHY_TYPE(5i32); pub const dot11_phy_type_erp: DOT11_PHY_TYPE = DOT11_PHY_TYPE(6i32); pub const dot11_phy_type_ht: DOT11_PHY_TYPE = DOT11_PHY_TYPE(7i32); pub const dot11_phy_type_vht: DOT11_PHY_TYPE = DOT11_PHY_TYPE(8i32); pub const dot11_phy_type_dmg: DOT11_PHY_TYPE = DOT11_PHY_TYPE(9i32); pub const dot11_phy_type_he: DOT11_PHY_TYPE = DOT11_PHY_TYPE(10i32); pub const dot11_phy_type_IHV_start: DOT11_PHY_TYPE = DOT11_PHY_TYPE(-2147483648i32); pub const dot11_phy_type_IHV_end: DOT11_PHY_TYPE = DOT11_PHY_TYPE(-1i32); impl ::core::convert::From<i32> for DOT11_PHY_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_PHY_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_PHY_TYPE_INFO { pub dot11PhyType: DOT11_PHY_TYPE, pub bUseParameters: super::super::Foundation::BOOLEAN, pub uProbeDelay: u32, pub uMinChannelTime: u32, pub uMaxChannelTime: u32, pub ChDescriptionType: CH_DESCRIPTION_TYPE, pub uChannelListSize: u32, pub ucChannelListBuffer: [u8; 1], } #[cfg(feature = "Win32_Foundation")] impl DOT11_PHY_TYPE_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_PHY_TYPE_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_PHY_TYPE_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PHY_TYPE_INFO") .field("dot11PhyType", &self.dot11PhyType) .field("bUseParameters", &self.bUseParameters) .field("uProbeDelay", &self.uProbeDelay) .field("uMinChannelTime", &self.uMinChannelTime) .field("uMaxChannelTime", &self.uMaxChannelTime) .field("ChDescriptionType", &self.ChDescriptionType) .field("uChannelListSize", &self.uChannelListSize) .field("ucChannelListBuffer", &self.ucChannelListBuffer) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_PHY_TYPE_INFO { fn eq(&self, other: &Self) -> bool { self.dot11PhyType == other.dot11PhyType && self.bUseParameters == other.bUseParameters && self.uProbeDelay == other.uProbeDelay && self.uMinChannelTime == other.uMinChannelTime && self.uMaxChannelTime == other.uMaxChannelTime && self.ChDescriptionType == other.ChDescriptionType && self.uChannelListSize == other.uChannelListSize && self.ucChannelListBuffer == other.ucChannelListBuffer } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_PHY_TYPE_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_PHY_TYPE_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_PHY_TYPE_LIST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub dot11PhyType: [DOT11_PHY_TYPE; 1], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_PHY_TYPE_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_PHY_TYPE_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_PHY_TYPE_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PHY_TYPE_LIST").field("Header", &self.Header).field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("dot11PhyType", &self.dot11PhyType).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_PHY_TYPE_LIST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.dot11PhyType == other.dot11PhyType } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_PHY_TYPE_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_PHY_TYPE_LIST { type Abi = Self; } pub const DOT11_PHY_TYPE_LIST_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_PMKID_CANDIDATE_LIST_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uCandidateListSize: u32, pub uCandidateListOffset: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_PMKID_CANDIDATE_LIST_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_PMKID_CANDIDATE_LIST_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_PMKID_CANDIDATE_LIST_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PMKID_CANDIDATE_LIST_PARAMETERS").field("Header", &self.Header).field("uCandidateListSize", &self.uCandidateListSize).field("uCandidateListOffset", &self.uCandidateListOffset).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_PMKID_CANDIDATE_LIST_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uCandidateListSize == other.uCandidateListSize && self.uCandidateListOffset == other.uCandidateListOffset } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_PMKID_CANDIDATE_LIST_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_PMKID_CANDIDATE_LIST_PARAMETERS { type Abi = Self; } pub const DOT11_PMKID_CANDIDATE_LIST_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_PMKID_ENTRY { pub BSSID: [u8; 6], pub PMKID: [u8; 16], pub uFlags: u32, } impl DOT11_PMKID_ENTRY {} impl ::core::default::Default for DOT11_PMKID_ENTRY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_PMKID_ENTRY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PMKID_ENTRY").field("BSSID", &self.BSSID).field("PMKID", &self.PMKID).field("uFlags", &self.uFlags).finish() } } impl ::core::cmp::PartialEq for DOT11_PMKID_ENTRY { fn eq(&self, other: &Self) -> bool { self.BSSID == other.BSSID && self.PMKID == other.PMKID && self.uFlags == other.uFlags } } impl ::core::cmp::Eq for DOT11_PMKID_ENTRY {} unsafe impl ::windows::core::Abi for DOT11_PMKID_ENTRY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_PMKID_LIST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub PMKIDs: [DOT11_PMKID_ENTRY; 1], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_PMKID_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_PMKID_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_PMKID_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PMKID_LIST").field("Header", &self.Header).field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("PMKIDs", &self.PMKIDs).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_PMKID_LIST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.PMKIDs == other.PMKIDs } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_PMKID_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_PMKID_LIST { type Abi = Self; } pub const DOT11_PMKID_LIST_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_PORT_STATE_NOTIFICATION { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerMac: [u8; 6], pub bOpen: super::super::Foundation::BOOLEAN, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_PORT_STATE_NOTIFICATION {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_PORT_STATE_NOTIFICATION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_PORT_STATE_NOTIFICATION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PORT_STATE_NOTIFICATION").field("Header", &self.Header).field("PeerMac", &self.PeerMac).field("bOpen", &self.bOpen).finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_PORT_STATE_NOTIFICATION { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerMac == other.PeerMac && self.bOpen == other.bOpen } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_PORT_STATE_NOTIFICATION {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_PORT_STATE_NOTIFICATION { type Abi = Self; } pub const DOT11_PORT_STATE_NOTIFICATION_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_POWER_MGMT_AUTO_MODE_ENABLED_INFO { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub bEnabled: super::super::Foundation::BOOLEAN, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_POWER_MGMT_AUTO_MODE_ENABLED_INFO {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_POWER_MGMT_AUTO_MODE_ENABLED_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_POWER_MGMT_AUTO_MODE_ENABLED_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_POWER_MGMT_AUTO_MODE_ENABLED_INFO").field("Header", &self.Header).field("bEnabled", &self.bEnabled).finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_POWER_MGMT_AUTO_MODE_ENABLED_INFO { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.bEnabled == other.bEnabled } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_POWER_MGMT_AUTO_MODE_ENABLED_INFO {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_POWER_MGMT_AUTO_MODE_ENABLED_INFO { type Abi = Self; } pub const DOT11_POWER_MGMT_AUTO_MODE_ENABLED_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_POWER_MGMT_MODE { pub dot11PowerMode: DOT11_POWER_MODE, pub uPowerSaveLevel: u32, pub usListenInterval: u16, pub usAID: u16, pub bReceiveDTIMs: super::super::Foundation::BOOLEAN, } #[cfg(feature = "Win32_Foundation")] impl DOT11_POWER_MGMT_MODE {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_POWER_MGMT_MODE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_POWER_MGMT_MODE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_POWER_MGMT_MODE").field("dot11PowerMode", &self.dot11PowerMode).field("uPowerSaveLevel", &self.uPowerSaveLevel).field("usListenInterval", &self.usListenInterval).field("usAID", &self.usAID).field("bReceiveDTIMs", &self.bReceiveDTIMs).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_POWER_MGMT_MODE { fn eq(&self, other: &Self) -> bool { self.dot11PowerMode == other.dot11PowerMode && self.uPowerSaveLevel == other.uPowerSaveLevel && self.usListenInterval == other.usListenInterval && self.usAID == other.usAID && self.bReceiveDTIMs == other.bReceiveDTIMs } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_POWER_MGMT_MODE {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_POWER_MGMT_MODE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_POWER_MGMT_MODE_STATUS_INFO { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PowerSaveMode: DOT11_POWER_MODE, pub uPowerSaveLevel: u32, pub Reason: DOT11_POWER_MODE_REASON, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_POWER_MGMT_MODE_STATUS_INFO {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_POWER_MGMT_MODE_STATUS_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_POWER_MGMT_MODE_STATUS_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_POWER_MGMT_MODE_STATUS_INFO").field("Header", &self.Header).field("PowerSaveMode", &self.PowerSaveMode).field("uPowerSaveLevel", &self.uPowerSaveLevel).field("Reason", &self.Reason).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_POWER_MGMT_MODE_STATUS_INFO { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PowerSaveMode == other.PowerSaveMode && self.uPowerSaveLevel == other.uPowerSaveLevel && self.Reason == other.Reason } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_POWER_MGMT_MODE_STATUS_INFO {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_POWER_MGMT_MODE_STATUS_INFO { type Abi = Self; } pub const DOT11_POWER_MGMT_MODE_STATUS_INFO_REVISION_1: u32 = 1u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DOT11_POWER_MODE(pub i32); pub const dot11_power_mode_unknown: DOT11_POWER_MODE = DOT11_POWER_MODE(0i32); pub const dot11_power_mode_active: DOT11_POWER_MODE = DOT11_POWER_MODE(1i32); pub const dot11_power_mode_powersave: DOT11_POWER_MODE = DOT11_POWER_MODE(2i32); impl ::core::convert::From<i32> for DOT11_POWER_MODE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_POWER_MODE { 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 DOT11_POWER_MODE_REASON(pub i32); pub const dot11_power_mode_reason_no_change: DOT11_POWER_MODE_REASON = DOT11_POWER_MODE_REASON(0i32); pub const dot11_power_mode_reason_noncompliant_AP: DOT11_POWER_MODE_REASON = DOT11_POWER_MODE_REASON(1i32); pub const dot11_power_mode_reason_legacy_WFD_device: DOT11_POWER_MODE_REASON = DOT11_POWER_MODE_REASON(2i32); pub const dot11_power_mode_reason_compliant_AP: DOT11_POWER_MODE_REASON = DOT11_POWER_MODE_REASON(3i32); pub const dot11_power_mode_reason_compliant_WFD_device: DOT11_POWER_MODE_REASON = DOT11_POWER_MODE_REASON(4i32); pub const dot11_power_mode_reason_others: DOT11_POWER_MODE_REASON = DOT11_POWER_MODE_REASON(5i32); impl ::core::convert::From<i32> for DOT11_POWER_MODE_REASON { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_POWER_MODE_REASON { type Abi = Self; } pub const DOT11_POWER_SAVE_LEVEL_FAST_PSP: u32 = 2u32; pub const DOT11_POWER_SAVE_LEVEL_MAX_PSP: u32 = 1u32; pub const DOT11_POWER_SAVING_FAST_PSP: u32 = 8u32; pub const DOT11_POWER_SAVING_MAXIMUM_LEVEL: u32 = 24u32; pub const DOT11_POWER_SAVING_MAX_PSP: u32 = 16u32; pub const DOT11_POWER_SAVING_NO_POWER_SAVING: u32 = 0u32; pub const DOT11_PRIORITY_CONTENTION: u32 = 0u32; pub const DOT11_PRIORITY_CONTENTION_FREE: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_PRIVACY_EXEMPTION { pub usEtherType: u16, pub usExemptionActionType: u16, pub usExemptionPacketType: u16, } impl DOT11_PRIVACY_EXEMPTION {} impl ::core::default::Default for DOT11_PRIVACY_EXEMPTION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_PRIVACY_EXEMPTION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PRIVACY_EXEMPTION").field("usEtherType", &self.usEtherType).field("usExemptionActionType", &self.usExemptionActionType).field("usExemptionPacketType", &self.usExemptionPacketType).finish() } } impl ::core::cmp::PartialEq for DOT11_PRIVACY_EXEMPTION { fn eq(&self, other: &Self) -> bool { self.usEtherType == other.usEtherType && self.usExemptionActionType == other.usExemptionActionType && self.usExemptionPacketType == other.usExemptionPacketType } } impl ::core::cmp::Eq for DOT11_PRIVACY_EXEMPTION {} unsafe impl ::windows::core::Abi for DOT11_PRIVACY_EXEMPTION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_PRIVACY_EXEMPTION_LIST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub PrivacyExemptionEntries: [DOT11_PRIVACY_EXEMPTION; 1], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_PRIVACY_EXEMPTION_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_PRIVACY_EXEMPTION_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_PRIVACY_EXEMPTION_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PRIVACY_EXEMPTION_LIST").field("Header", &self.Header).field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("PrivacyExemptionEntries", &self.PrivacyExemptionEntries).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_PRIVACY_EXEMPTION_LIST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.PrivacyExemptionEntries == other.PrivacyExemptionEntries } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_PRIVACY_EXEMPTION_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_PRIVACY_EXEMPTION_LIST { type Abi = Self; } pub const DOT11_PRIVACY_EXEMPTION_LIST_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_PROVISION_DISCOVERY_REQUEST_SEND_COMPLETE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerDeviceAddress: [u8; 6], pub ReceiverAddress: [u8; 6], pub DialogToken: u8, pub Status: i32, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_PROVISION_DISCOVERY_REQUEST_SEND_COMPLETE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_PROVISION_DISCOVERY_REQUEST_SEND_COMPLETE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_PROVISION_DISCOVERY_REQUEST_SEND_COMPLETE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PROVISION_DISCOVERY_REQUEST_SEND_COMPLETE_PARAMETERS") .field("Header", &self.Header) .field("PeerDeviceAddress", &self.PeerDeviceAddress) .field("ReceiverAddress", &self.ReceiverAddress) .field("DialogToken", &self.DialogToken) .field("Status", &self.Status) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_PROVISION_DISCOVERY_REQUEST_SEND_COMPLETE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerDeviceAddress == other.PeerDeviceAddress && self.ReceiverAddress == other.ReceiverAddress && self.DialogToken == other.DialogToken && self.Status == other.Status && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_PROVISION_DISCOVERY_REQUEST_SEND_COMPLETE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_PROVISION_DISCOVERY_REQUEST_SEND_COMPLETE_PARAMETERS { type Abi = Self; } pub const DOT11_PROVISION_DISCOVERY_REQUEST_SEND_COMPLETE_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_PROVISION_DISCOVERY_RESPONSE_SEND_COMPLETE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub ReceiverDeviceAddress: [u8; 6], pub DialogToken: u8, pub Status: i32, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_PROVISION_DISCOVERY_RESPONSE_SEND_COMPLETE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_PROVISION_DISCOVERY_RESPONSE_SEND_COMPLETE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_PROVISION_DISCOVERY_RESPONSE_SEND_COMPLETE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_PROVISION_DISCOVERY_RESPONSE_SEND_COMPLETE_PARAMETERS") .field("Header", &self.Header) .field("ReceiverDeviceAddress", &self.ReceiverDeviceAddress) .field("DialogToken", &self.DialogToken) .field("Status", &self.Status) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_PROVISION_DISCOVERY_RESPONSE_SEND_COMPLETE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.ReceiverDeviceAddress == other.ReceiverDeviceAddress && self.DialogToken == other.DialogToken && self.Status == other.Status && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_PROVISION_DISCOVERY_RESPONSE_SEND_COMPLETE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_PROVISION_DISCOVERY_RESPONSE_SEND_COMPLETE_PARAMETERS { type Abi = Self; } pub const DOT11_PROVISION_DISCOVERY_RESPONSE_SEND_COMPLETE_PARAMETERS_REVISION_1: u32 = 1u32; pub const DOT11_PSD_IE_MAX_DATA_SIZE: u32 = 240u32; pub const DOT11_PSD_IE_MAX_ENTRY_NUMBER: u32 = 5u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_QOS_PARAMS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub ucEnabledQoSProtocolFlags: u8, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_QOS_PARAMS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_QOS_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_QOS_PARAMS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_QOS_PARAMS").field("Header", &self.Header).field("ucEnabledQoSProtocolFlags", &self.ucEnabledQoSProtocolFlags).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_QOS_PARAMS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.ucEnabledQoSProtocolFlags == other.ucEnabledQoSProtocolFlags } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_QOS_PARAMS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_QOS_PARAMS { type Abi = Self; } pub const DOT11_QOS_PARAMS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_QOS_TX_DURATION { pub uNominalMSDUSize: u32, pub uMinPHYRate: u32, pub uDuration: u32, } impl DOT11_QOS_TX_DURATION {} impl ::core::default::Default for DOT11_QOS_TX_DURATION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_QOS_TX_DURATION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_QOS_TX_DURATION").field("uNominalMSDUSize", &self.uNominalMSDUSize).field("uMinPHYRate", &self.uMinPHYRate).field("uDuration", &self.uDuration).finish() } } impl ::core::cmp::PartialEq for DOT11_QOS_TX_DURATION { fn eq(&self, other: &Self) -> bool { self.uNominalMSDUSize == other.uNominalMSDUSize && self.uMinPHYRate == other.uMinPHYRate && self.uDuration == other.uDuration } } impl ::core::cmp::Eq for DOT11_QOS_TX_DURATION {} unsafe impl ::windows::core::Abi for DOT11_QOS_TX_DURATION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_QOS_TX_MEDIUM_TIME { pub dot11PeerAddress: [u8; 6], pub ucQoSPriority: u8, pub uMediumTimeAdmited: u32, } impl DOT11_QOS_TX_MEDIUM_TIME {} impl ::core::default::Default for DOT11_QOS_TX_MEDIUM_TIME { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_QOS_TX_MEDIUM_TIME { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_QOS_TX_MEDIUM_TIME").field("dot11PeerAddress", &self.dot11PeerAddress).field("ucQoSPriority", &self.ucQoSPriority).field("uMediumTimeAdmited", &self.uMediumTimeAdmited).finish() } } impl ::core::cmp::PartialEq for DOT11_QOS_TX_MEDIUM_TIME { fn eq(&self, other: &Self) -> bool { self.dot11PeerAddress == other.dot11PeerAddress && self.ucQoSPriority == other.ucQoSPriority && self.uMediumTimeAdmited == other.uMediumTimeAdmited } } impl ::core::cmp::Eq for DOT11_QOS_TX_MEDIUM_TIME {} unsafe impl ::windows::core::Abi for DOT11_QOS_TX_MEDIUM_TIME { 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 DOT11_RADIO_STATE(pub i32); pub const dot11_radio_state_unknown: DOT11_RADIO_STATE = DOT11_RADIO_STATE(0i32); pub const dot11_radio_state_on: DOT11_RADIO_STATE = DOT11_RADIO_STATE(1i32); pub const dot11_radio_state_off: DOT11_RADIO_STATE = DOT11_RADIO_STATE(2i32); impl ::core::convert::From<i32> for DOT11_RADIO_STATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_RADIO_STATE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_RATE_SET { pub uRateSetLength: u32, pub ucRateSet: [u8; 126], } impl DOT11_RATE_SET {} impl ::core::default::Default for DOT11_RATE_SET { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_RATE_SET { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_RATE_SET").field("uRateSetLength", &self.uRateSetLength).field("ucRateSet", &self.ucRateSet).finish() } } impl ::core::cmp::PartialEq for DOT11_RATE_SET { fn eq(&self, other: &Self) -> bool { self.uRateSetLength == other.uRateSetLength && self.ucRateSet == other.ucRateSet } } impl ::core::cmp::Eq for DOT11_RATE_SET {} unsafe impl ::windows::core::Abi for DOT11_RATE_SET { type Abi = Self; } pub const DOT11_RATE_SET_MAX_LENGTH: u32 = 126u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_RECEIVED_GO_NEGOTIATION_CONFIRMATION_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerDeviceAddress: [u8; 6], pub DialogToken: u8, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_RECEIVED_GO_NEGOTIATION_CONFIRMATION_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_RECEIVED_GO_NEGOTIATION_CONFIRMATION_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_RECEIVED_GO_NEGOTIATION_CONFIRMATION_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_RECEIVED_GO_NEGOTIATION_CONFIRMATION_PARAMETERS").field("Header", &self.Header).field("PeerDeviceAddress", &self.PeerDeviceAddress).field("DialogToken", &self.DialogToken).field("uIEsOffset", &self.uIEsOffset).field("uIEsLength", &self.uIEsLength).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_RECEIVED_GO_NEGOTIATION_CONFIRMATION_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerDeviceAddress == other.PeerDeviceAddress && self.DialogToken == other.DialogToken && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_RECEIVED_GO_NEGOTIATION_CONFIRMATION_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_RECEIVED_GO_NEGOTIATION_CONFIRMATION_PARAMETERS { type Abi = Self; } pub const DOT11_RECEIVED_GO_NEGOTIATION_CONFIRMATION_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_RECEIVED_GO_NEGOTIATION_REQUEST_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerDeviceAddress: [u8; 6], pub DialogToken: u8, pub RequestContext: *mut ::core::ffi::c_void, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_RECEIVED_GO_NEGOTIATION_REQUEST_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_RECEIVED_GO_NEGOTIATION_REQUEST_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_RECEIVED_GO_NEGOTIATION_REQUEST_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_RECEIVED_GO_NEGOTIATION_REQUEST_PARAMETERS") .field("Header", &self.Header) .field("PeerDeviceAddress", &self.PeerDeviceAddress) .field("DialogToken", &self.DialogToken) .field("RequestContext", &self.RequestContext) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_RECEIVED_GO_NEGOTIATION_REQUEST_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerDeviceAddress == other.PeerDeviceAddress && self.DialogToken == other.DialogToken && self.RequestContext == other.RequestContext && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_RECEIVED_GO_NEGOTIATION_REQUEST_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_RECEIVED_GO_NEGOTIATION_REQUEST_PARAMETERS { type Abi = Self; } pub const DOT11_RECEIVED_GO_NEGOTIATION_REQUEST_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_RECEIVED_GO_NEGOTIATION_RESPONSE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerDeviceAddress: [u8; 6], pub DialogToken: u8, pub ResponseContext: *mut ::core::ffi::c_void, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_RECEIVED_GO_NEGOTIATION_RESPONSE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_RECEIVED_GO_NEGOTIATION_RESPONSE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_RECEIVED_GO_NEGOTIATION_RESPONSE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_RECEIVED_GO_NEGOTIATION_RESPONSE_PARAMETERS") .field("Header", &self.Header) .field("PeerDeviceAddress", &self.PeerDeviceAddress) .field("DialogToken", &self.DialogToken) .field("ResponseContext", &self.ResponseContext) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_RECEIVED_GO_NEGOTIATION_RESPONSE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerDeviceAddress == other.PeerDeviceAddress && self.DialogToken == other.DialogToken && self.ResponseContext == other.ResponseContext && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_RECEIVED_GO_NEGOTIATION_RESPONSE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_RECEIVED_GO_NEGOTIATION_RESPONSE_PARAMETERS { type Abi = Self; } pub const DOT11_RECEIVED_GO_NEGOTIATION_RESPONSE_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_RECEIVED_INVITATION_REQUEST_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub TransmitterDeviceAddress: [u8; 6], pub BSSID: [u8; 6], pub DialogToken: u8, pub RequestContext: *mut ::core::ffi::c_void, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_RECEIVED_INVITATION_REQUEST_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_RECEIVED_INVITATION_REQUEST_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_RECEIVED_INVITATION_REQUEST_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_RECEIVED_INVITATION_REQUEST_PARAMETERS") .field("Header", &self.Header) .field("TransmitterDeviceAddress", &self.TransmitterDeviceAddress) .field("BSSID", &self.BSSID) .field("DialogToken", &self.DialogToken) .field("RequestContext", &self.RequestContext) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_RECEIVED_INVITATION_REQUEST_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.TransmitterDeviceAddress == other.TransmitterDeviceAddress && self.BSSID == other.BSSID && self.DialogToken == other.DialogToken && self.RequestContext == other.RequestContext && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_RECEIVED_INVITATION_REQUEST_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_RECEIVED_INVITATION_REQUEST_PARAMETERS { type Abi = Self; } pub const DOT11_RECEIVED_INVITATION_REQUEST_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_RECEIVED_INVITATION_RESPONSE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub TransmitterDeviceAddress: [u8; 6], pub BSSID: [u8; 6], pub DialogToken: u8, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_RECEIVED_INVITATION_RESPONSE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_RECEIVED_INVITATION_RESPONSE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_RECEIVED_INVITATION_RESPONSE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_RECEIVED_INVITATION_RESPONSE_PARAMETERS") .field("Header", &self.Header) .field("TransmitterDeviceAddress", &self.TransmitterDeviceAddress) .field("BSSID", &self.BSSID) .field("DialogToken", &self.DialogToken) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_RECEIVED_INVITATION_RESPONSE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.TransmitterDeviceAddress == other.TransmitterDeviceAddress && self.BSSID == other.BSSID && self.DialogToken == other.DialogToken && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_RECEIVED_INVITATION_RESPONSE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_RECEIVED_INVITATION_RESPONSE_PARAMETERS { type Abi = Self; } pub const DOT11_RECEIVED_INVITATION_RESPONSE_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_RECEIVED_PROVISION_DISCOVERY_REQUEST_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub TransmitterDeviceAddress: [u8; 6], pub BSSID: [u8; 6], pub DialogToken: u8, pub RequestContext: *mut ::core::ffi::c_void, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_RECEIVED_PROVISION_DISCOVERY_REQUEST_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_RECEIVED_PROVISION_DISCOVERY_REQUEST_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_RECEIVED_PROVISION_DISCOVERY_REQUEST_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_RECEIVED_PROVISION_DISCOVERY_REQUEST_PARAMETERS") .field("Header", &self.Header) .field("TransmitterDeviceAddress", &self.TransmitterDeviceAddress) .field("BSSID", &self.BSSID) .field("DialogToken", &self.DialogToken) .field("RequestContext", &self.RequestContext) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_RECEIVED_PROVISION_DISCOVERY_REQUEST_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.TransmitterDeviceAddress == other.TransmitterDeviceAddress && self.BSSID == other.BSSID && self.DialogToken == other.DialogToken && self.RequestContext == other.RequestContext && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_RECEIVED_PROVISION_DISCOVERY_REQUEST_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_RECEIVED_PROVISION_DISCOVERY_REQUEST_PARAMETERS { type Abi = Self; } pub const DOT11_RECEIVED_PROVISION_DISCOVERY_REQUEST_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_RECEIVED_PROVISION_DISCOVERY_RESPONSE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub TransmitterDeviceAddress: [u8; 6], pub BSSID: [u8; 6], pub DialogToken: u8, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_RECEIVED_PROVISION_DISCOVERY_RESPONSE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_RECEIVED_PROVISION_DISCOVERY_RESPONSE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_RECEIVED_PROVISION_DISCOVERY_RESPONSE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_RECEIVED_PROVISION_DISCOVERY_RESPONSE_PARAMETERS") .field("Header", &self.Header) .field("TransmitterDeviceAddress", &self.TransmitterDeviceAddress) .field("BSSID", &self.BSSID) .field("DialogToken", &self.DialogToken) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_RECEIVED_PROVISION_DISCOVERY_RESPONSE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.TransmitterDeviceAddress == other.TransmitterDeviceAddress && self.BSSID == other.BSSID && self.DialogToken == other.DialogToken && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_RECEIVED_PROVISION_DISCOVERY_RESPONSE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_RECEIVED_PROVISION_DISCOVERY_RESPONSE_PARAMETERS { type Abi = Self; } pub const DOT11_RECEIVED_PROVISION_DISCOVERY_RESPONSE_PARAMETERS_REVISION_1: u32 = 1u32; pub const DOT11_RECV_CONTEXT_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_RECV_EXTENSION_INFO { pub uVersion: u32, pub pvReserved: *mut ::core::ffi::c_void, pub dot11PhyType: DOT11_PHY_TYPE, pub uChCenterFrequency: u32, pub lRSSI: i32, pub lRSSIMin: i32, pub lRSSIMax: i32, pub uRSSI: u32, pub ucPriority: u8, pub ucDataRate: u8, pub ucPeerMacAddress: [u8; 6], pub dwExtendedStatus: u32, pub hWEPOffloadContext: super::super::Foundation::HANDLE, pub hAuthOffloadContext: super::super::Foundation::HANDLE, pub usWEPAppliedMask: u16, pub usWPAMSDUPriority: u16, pub dot11LowestIV48Counter: DOT11_IV48_COUNTER, pub usDot11LeftRWBitMap: u16, pub dot11HighestIV48Counter: DOT11_IV48_COUNTER, pub usDot11RightRWBitMap: u16, pub usNumberOfMPDUsReceived: u16, pub usNumberOfFragments: u16, pub pNdisPackets: [*mut ::core::ffi::c_void; 1], } #[cfg(feature = "Win32_Foundation")] impl DOT11_RECV_EXTENSION_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_RECV_EXTENSION_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_RECV_EXTENSION_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_RECV_EXTENSION_INFO") .field("uVersion", &self.uVersion) .field("pvReserved", &self.pvReserved) .field("dot11PhyType", &self.dot11PhyType) .field("uChCenterFrequency", &self.uChCenterFrequency) .field("lRSSI", &self.lRSSI) .field("lRSSIMin", &self.lRSSIMin) .field("lRSSIMax", &self.lRSSIMax) .field("uRSSI", &self.uRSSI) .field("ucPriority", &self.ucPriority) .field("ucDataRate", &self.ucDataRate) .field("ucPeerMacAddress", &self.ucPeerMacAddress) .field("dwExtendedStatus", &self.dwExtendedStatus) .field("hWEPOffloadContext", &self.hWEPOffloadContext) .field("hAuthOffloadContext", &self.hAuthOffloadContext) .field("usWEPAppliedMask", &self.usWEPAppliedMask) .field("usWPAMSDUPriority", &self.usWPAMSDUPriority) .field("dot11LowestIV48Counter", &self.dot11LowestIV48Counter) .field("usDot11LeftRWBitMap", &self.usDot11LeftRWBitMap) .field("dot11HighestIV48Counter", &self.dot11HighestIV48Counter) .field("usDot11RightRWBitMap", &self.usDot11RightRWBitMap) .field("usNumberOfMPDUsReceived", &self.usNumberOfMPDUsReceived) .field("usNumberOfFragments", &self.usNumberOfFragments) .field("pNdisPackets", &self.pNdisPackets) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_RECV_EXTENSION_INFO { fn eq(&self, other: &Self) -> bool { self.uVersion == other.uVersion && self.pvReserved == other.pvReserved && self.dot11PhyType == other.dot11PhyType && self.uChCenterFrequency == other.uChCenterFrequency && self.lRSSI == other.lRSSI && self.lRSSIMin == other.lRSSIMin && self.lRSSIMax == other.lRSSIMax && self.uRSSI == other.uRSSI && self.ucPriority == other.ucPriority && self.ucDataRate == other.ucDataRate && self.ucPeerMacAddress == other.ucPeerMacAddress && self.dwExtendedStatus == other.dwExtendedStatus && self.hWEPOffloadContext == other.hWEPOffloadContext && self.hAuthOffloadContext == other.hAuthOffloadContext && self.usWEPAppliedMask == other.usWEPAppliedMask && self.usWPAMSDUPriority == other.usWPAMSDUPriority && self.dot11LowestIV48Counter == other.dot11LowestIV48Counter && self.usDot11LeftRWBitMap == other.usDot11LeftRWBitMap && self.dot11HighestIV48Counter == other.dot11HighestIV48Counter && self.usDot11RightRWBitMap == other.usDot11RightRWBitMap && self.usNumberOfMPDUsReceived == other.usNumberOfMPDUsReceived && self.usNumberOfFragments == other.usNumberOfFragments && self.pNdisPackets == other.pNdisPackets } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_RECV_EXTENSION_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_RECV_EXTENSION_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_RECV_EXTENSION_INFO_V2 { pub uVersion: u32, pub pvReserved: *mut ::core::ffi::c_void, pub dot11PhyType: DOT11_PHY_TYPE, pub uChCenterFrequency: u32, pub lRSSI: i32, pub uRSSI: u32, pub ucPriority: u8, pub ucDataRate: u8, pub ucPeerMacAddress: [u8; 6], pub dwExtendedStatus: u32, pub hWEPOffloadContext: super::super::Foundation::HANDLE, pub hAuthOffloadContext: super::super::Foundation::HANDLE, pub usWEPAppliedMask: u16, pub usWPAMSDUPriority: u16, pub dot11LowestIV48Counter: DOT11_IV48_COUNTER, pub usDot11LeftRWBitMap: u16, pub dot11HighestIV48Counter: DOT11_IV48_COUNTER, pub usDot11RightRWBitMap: u16, pub usNumberOfMPDUsReceived: u16, pub usNumberOfFragments: u16, pub pNdisPackets: [*mut ::core::ffi::c_void; 1], } #[cfg(feature = "Win32_Foundation")] impl DOT11_RECV_EXTENSION_INFO_V2 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_RECV_EXTENSION_INFO_V2 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_RECV_EXTENSION_INFO_V2 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_RECV_EXTENSION_INFO_V2") .field("uVersion", &self.uVersion) .field("pvReserved", &self.pvReserved) .field("dot11PhyType", &self.dot11PhyType) .field("uChCenterFrequency", &self.uChCenterFrequency) .field("lRSSI", &self.lRSSI) .field("uRSSI", &self.uRSSI) .field("ucPriority", &self.ucPriority) .field("ucDataRate", &self.ucDataRate) .field("ucPeerMacAddress", &self.ucPeerMacAddress) .field("dwExtendedStatus", &self.dwExtendedStatus) .field("hWEPOffloadContext", &self.hWEPOffloadContext) .field("hAuthOffloadContext", &self.hAuthOffloadContext) .field("usWEPAppliedMask", &self.usWEPAppliedMask) .field("usWPAMSDUPriority", &self.usWPAMSDUPriority) .field("dot11LowestIV48Counter", &self.dot11LowestIV48Counter) .field("usDot11LeftRWBitMap", &self.usDot11LeftRWBitMap) .field("dot11HighestIV48Counter", &self.dot11HighestIV48Counter) .field("usDot11RightRWBitMap", &self.usDot11RightRWBitMap) .field("usNumberOfMPDUsReceived", &self.usNumberOfMPDUsReceived) .field("usNumberOfFragments", &self.usNumberOfFragments) .field("pNdisPackets", &self.pNdisPackets) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_RECV_EXTENSION_INFO_V2 { fn eq(&self, other: &Self) -> bool { self.uVersion == other.uVersion && self.pvReserved == other.pvReserved && self.dot11PhyType == other.dot11PhyType && self.uChCenterFrequency == other.uChCenterFrequency && self.lRSSI == other.lRSSI && self.uRSSI == other.uRSSI && self.ucPriority == other.ucPriority && self.ucDataRate == other.ucDataRate && self.ucPeerMacAddress == other.ucPeerMacAddress && self.dwExtendedStatus == other.dwExtendedStatus && self.hWEPOffloadContext == other.hWEPOffloadContext && self.hAuthOffloadContext == other.hAuthOffloadContext && self.usWEPAppliedMask == other.usWEPAppliedMask && self.usWPAMSDUPriority == other.usWPAMSDUPriority && self.dot11LowestIV48Counter == other.dot11LowestIV48Counter && self.usDot11LeftRWBitMap == other.usDot11LeftRWBitMap && self.dot11HighestIV48Counter == other.dot11HighestIV48Counter && self.usDot11RightRWBitMap == other.usDot11RightRWBitMap && self.usNumberOfMPDUsReceived == other.usNumberOfMPDUsReceived && self.usNumberOfFragments == other.usNumberOfFragments && self.pNdisPackets == other.pNdisPackets } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_RECV_EXTENSION_INFO_V2 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_RECV_EXTENSION_INFO_V2 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_RECV_SENSITIVITY { pub ucDataRate: u8, pub lRSSIMin: i32, pub lRSSIMax: i32, } impl DOT11_RECV_SENSITIVITY {} impl ::core::default::Default for DOT11_RECV_SENSITIVITY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_RECV_SENSITIVITY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_RECV_SENSITIVITY").field("ucDataRate", &self.ucDataRate).field("lRSSIMin", &self.lRSSIMin).field("lRSSIMax", &self.lRSSIMax).finish() } } impl ::core::cmp::PartialEq for DOT11_RECV_SENSITIVITY { fn eq(&self, other: &Self) -> bool { self.ucDataRate == other.ucDataRate && self.lRSSIMin == other.lRSSIMin && self.lRSSIMax == other.lRSSIMax } } impl ::core::cmp::Eq for DOT11_RECV_SENSITIVITY {} unsafe impl ::windows::core::Abi for DOT11_RECV_SENSITIVITY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_RECV_SENSITIVITY_LIST { pub Anonymous: DOT11_RECV_SENSITIVITY_LIST_0, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub dot11RecvSensitivity: [DOT11_RECV_SENSITIVITY; 1], } impl DOT11_RECV_SENSITIVITY_LIST {} impl ::core::default::Default for DOT11_RECV_SENSITIVITY_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for DOT11_RECV_SENSITIVITY_LIST { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for DOT11_RECV_SENSITIVITY_LIST {} unsafe impl ::windows::core::Abi for DOT11_RECV_SENSITIVITY_LIST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub union DOT11_RECV_SENSITIVITY_LIST_0 { pub dot11PhyType: DOT11_PHY_TYPE, pub uPhyId: u32, } impl DOT11_RECV_SENSITIVITY_LIST_0 {} impl ::core::default::Default for DOT11_RECV_SENSITIVITY_LIST_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for DOT11_RECV_SENSITIVITY_LIST_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for DOT11_RECV_SENSITIVITY_LIST_0 {} unsafe impl ::windows::core::Abi for DOT11_RECV_SENSITIVITY_LIST_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_REG_DOMAINS_SUPPORT_VALUE { pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub dot11RegDomainValue: [DOT11_REG_DOMAIN_VALUE; 1], } impl DOT11_REG_DOMAINS_SUPPORT_VALUE {} impl ::core::default::Default for DOT11_REG_DOMAINS_SUPPORT_VALUE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_REG_DOMAINS_SUPPORT_VALUE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_REG_DOMAINS_SUPPORT_VALUE").field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("dot11RegDomainValue", &self.dot11RegDomainValue).finish() } } impl ::core::cmp::PartialEq for DOT11_REG_DOMAINS_SUPPORT_VALUE { fn eq(&self, other: &Self) -> bool { self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.dot11RegDomainValue == other.dot11RegDomainValue } } impl ::core::cmp::Eq for DOT11_REG_DOMAINS_SUPPORT_VALUE {} unsafe impl ::windows::core::Abi for DOT11_REG_DOMAINS_SUPPORT_VALUE { type Abi = Self; } pub const DOT11_REG_DOMAIN_DOC: u32 = 32u32; pub const DOT11_REG_DOMAIN_ETSI: u32 = 48u32; pub const DOT11_REG_DOMAIN_FCC: u32 = 16u32; pub const DOT11_REG_DOMAIN_FRANCE: u32 = 50u32; pub const DOT11_REG_DOMAIN_MKK: u32 = 64u32; pub const DOT11_REG_DOMAIN_OTHER: u32 = 0u32; pub const DOT11_REG_DOMAIN_SPAIN: u32 = 49u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_REG_DOMAIN_VALUE { pub uRegDomainsSupportIndex: u32, pub uRegDomainsSupportValue: u32, } impl DOT11_REG_DOMAIN_VALUE {} impl ::core::default::Default for DOT11_REG_DOMAIN_VALUE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_REG_DOMAIN_VALUE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_REG_DOMAIN_VALUE").field("uRegDomainsSupportIndex", &self.uRegDomainsSupportIndex).field("uRegDomainsSupportValue", &self.uRegDomainsSupportValue).finish() } } impl ::core::cmp::PartialEq for DOT11_REG_DOMAIN_VALUE { fn eq(&self, other: &Self) -> bool { self.uRegDomainsSupportIndex == other.uRegDomainsSupportIndex && self.uRegDomainsSupportValue == other.uRegDomainsSupportValue } } impl ::core::cmp::Eq for DOT11_REG_DOMAIN_VALUE {} unsafe impl ::windows::core::Abi for DOT11_REG_DOMAIN_VALUE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_RESET_REQUEST { pub dot11ResetType: DOT11_RESET_TYPE, pub dot11MacAddress: [u8; 6], pub bSetDefaultMIB: super::super::Foundation::BOOLEAN, } #[cfg(feature = "Win32_Foundation")] impl DOT11_RESET_REQUEST {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_RESET_REQUEST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_RESET_REQUEST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_RESET_REQUEST").field("dot11ResetType", &self.dot11ResetType).field("dot11MacAddress", &self.dot11MacAddress).field("bSetDefaultMIB", &self.bSetDefaultMIB).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_RESET_REQUEST { fn eq(&self, other: &Self) -> bool { self.dot11ResetType == other.dot11ResetType && self.dot11MacAddress == other.dot11MacAddress && self.bSetDefaultMIB == other.bSetDefaultMIB } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_RESET_REQUEST {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_RESET_REQUEST { 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 DOT11_RESET_TYPE(pub i32); pub const dot11_reset_type_phy: DOT11_RESET_TYPE = DOT11_RESET_TYPE(1i32); pub const dot11_reset_type_mac: DOT11_RESET_TYPE = DOT11_RESET_TYPE(2i32); pub const dot11_reset_type_phy_and_mac: DOT11_RESET_TYPE = DOT11_RESET_TYPE(3i32); impl ::core::convert::From<i32> for DOT11_RESET_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_RESET_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_ROAMING_COMPLETION_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uStatus: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_ROAMING_COMPLETION_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_ROAMING_COMPLETION_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_ROAMING_COMPLETION_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_ROAMING_COMPLETION_PARAMETERS").field("Header", &self.Header).field("uStatus", &self.uStatus).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_ROAMING_COMPLETION_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uStatus == other.uStatus } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_ROAMING_COMPLETION_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_ROAMING_COMPLETION_PARAMETERS { type Abi = Self; } pub const DOT11_ROAMING_COMPLETION_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_ROAMING_START_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub AdhocBSSID: [u8; 6], pub AdhocSSID: DOT11_SSID, pub uRoamingReason: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_ROAMING_START_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_ROAMING_START_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_ROAMING_START_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_ROAMING_START_PARAMETERS").field("Header", &self.Header).field("AdhocBSSID", &self.AdhocBSSID).field("AdhocSSID", &self.AdhocSSID).field("uRoamingReason", &self.uRoamingReason).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_ROAMING_START_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.AdhocBSSID == other.AdhocBSSID && self.AdhocSSID == other.AdhocSSID && self.uRoamingReason == other.uRoamingReason } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_ROAMING_START_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_ROAMING_START_PARAMETERS { type Abi = Self; } pub const DOT11_ROAMING_START_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_RSSI_RANGE { pub dot11PhyType: DOT11_PHY_TYPE, pub uRSSIMin: u32, pub uRSSIMax: u32, } impl DOT11_RSSI_RANGE {} impl ::core::default::Default for DOT11_RSSI_RANGE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_RSSI_RANGE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_RSSI_RANGE").field("dot11PhyType", &self.dot11PhyType).field("uRSSIMin", &self.uRSSIMin).field("uRSSIMax", &self.uRSSIMax).finish() } } impl ::core::cmp::PartialEq for DOT11_RSSI_RANGE { fn eq(&self, other: &Self) -> bool { self.dot11PhyType == other.dot11PhyType && self.uRSSIMin == other.uRSSIMin && self.uRSSIMax == other.uRSSIMax } } impl ::core::cmp::Eq for DOT11_RSSI_RANGE {} unsafe impl ::windows::core::Abi for DOT11_RSSI_RANGE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_SCAN_REQUEST { pub dot11BSSType: DOT11_BSS_TYPE, pub dot11BSSID: [u8; 6], pub dot11SSID: DOT11_SSID, pub dot11ScanType: DOT11_SCAN_TYPE, pub bRestrictedScan: super::super::Foundation::BOOLEAN, pub bUseRequestIE: super::super::Foundation::BOOLEAN, pub uRequestIDsOffset: u32, pub uNumOfRequestIDs: u32, pub uPhyTypesOffset: u32, pub uNumOfPhyTypes: u32, pub uIEsOffset: u32, pub uIEsLength: u32, pub ucBuffer: [u8; 1], } #[cfg(feature = "Win32_Foundation")] impl DOT11_SCAN_REQUEST {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_SCAN_REQUEST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_SCAN_REQUEST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SCAN_REQUEST") .field("dot11BSSType", &self.dot11BSSType) .field("dot11BSSID", &self.dot11BSSID) .field("dot11SSID", &self.dot11SSID) .field("dot11ScanType", &self.dot11ScanType) .field("bRestrictedScan", &self.bRestrictedScan) .field("bUseRequestIE", &self.bUseRequestIE) .field("uRequestIDsOffset", &self.uRequestIDsOffset) .field("uNumOfRequestIDs", &self.uNumOfRequestIDs) .field("uPhyTypesOffset", &self.uPhyTypesOffset) .field("uNumOfPhyTypes", &self.uNumOfPhyTypes) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .field("ucBuffer", &self.ucBuffer) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_SCAN_REQUEST { fn eq(&self, other: &Self) -> bool { self.dot11BSSType == other.dot11BSSType && self.dot11BSSID == other.dot11BSSID && self.dot11SSID == other.dot11SSID && self.dot11ScanType == other.dot11ScanType && self.bRestrictedScan == other.bRestrictedScan && self.bUseRequestIE == other.bUseRequestIE && self.uRequestIDsOffset == other.uRequestIDsOffset && self.uNumOfRequestIDs == other.uNumOfRequestIDs && self.uPhyTypesOffset == other.uPhyTypesOffset && self.uNumOfPhyTypes == other.uNumOfPhyTypes && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength && self.ucBuffer == other.ucBuffer } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_SCAN_REQUEST {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_SCAN_REQUEST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_SCAN_REQUEST_V2 { pub dot11BSSType: DOT11_BSS_TYPE, pub dot11BSSID: [u8; 6], pub dot11ScanType: DOT11_SCAN_TYPE, pub bRestrictedScan: super::super::Foundation::BOOLEAN, pub udot11SSIDsOffset: u32, pub uNumOfdot11SSIDs: u32, pub bUseRequestIE: super::super::Foundation::BOOLEAN, pub uRequestIDsOffset: u32, pub uNumOfRequestIDs: u32, pub uPhyTypeInfosOffset: u32, pub uNumOfPhyTypeInfos: u32, pub uIEsOffset: u32, pub uIEsLength: u32, pub ucBuffer: [u8; 1], } #[cfg(feature = "Win32_Foundation")] impl DOT11_SCAN_REQUEST_V2 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_SCAN_REQUEST_V2 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_SCAN_REQUEST_V2 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SCAN_REQUEST_V2") .field("dot11BSSType", &self.dot11BSSType) .field("dot11BSSID", &self.dot11BSSID) .field("dot11ScanType", &self.dot11ScanType) .field("bRestrictedScan", &self.bRestrictedScan) .field("udot11SSIDsOffset", &self.udot11SSIDsOffset) .field("uNumOfdot11SSIDs", &self.uNumOfdot11SSIDs) .field("bUseRequestIE", &self.bUseRequestIE) .field("uRequestIDsOffset", &self.uRequestIDsOffset) .field("uNumOfRequestIDs", &self.uNumOfRequestIDs) .field("uPhyTypeInfosOffset", &self.uPhyTypeInfosOffset) .field("uNumOfPhyTypeInfos", &self.uNumOfPhyTypeInfos) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .field("ucBuffer", &self.ucBuffer) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_SCAN_REQUEST_V2 { fn eq(&self, other: &Self) -> bool { self.dot11BSSType == other.dot11BSSType && self.dot11BSSID == other.dot11BSSID && self.dot11ScanType == other.dot11ScanType && self.bRestrictedScan == other.bRestrictedScan && self.udot11SSIDsOffset == other.udot11SSIDsOffset && self.uNumOfdot11SSIDs == other.uNumOfdot11SSIDs && self.bUseRequestIE == other.bUseRequestIE && self.uRequestIDsOffset == other.uRequestIDsOffset && self.uNumOfRequestIDs == other.uNumOfRequestIDs && self.uPhyTypeInfosOffset == other.uPhyTypeInfosOffset && self.uNumOfPhyTypeInfos == other.uNumOfPhyTypeInfos && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength && self.ucBuffer == other.ucBuffer } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_SCAN_REQUEST_V2 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_SCAN_REQUEST_V2 { 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 DOT11_SCAN_TYPE(pub i32); pub const dot11_scan_type_active: DOT11_SCAN_TYPE = DOT11_SCAN_TYPE(1i32); pub const dot11_scan_type_passive: DOT11_SCAN_TYPE = DOT11_SCAN_TYPE(2i32); pub const dot11_scan_type_auto: DOT11_SCAN_TYPE = DOT11_SCAN_TYPE(3i32); pub const dot11_scan_type_forced: DOT11_SCAN_TYPE = DOT11_SCAN_TYPE(-2147483648i32); impl ::core::convert::From<i32> for DOT11_SCAN_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_SCAN_TYPE { type Abi = Self; } pub const DOT11_SEND_CONTEXT_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_SEND_GO_NEGOTIATION_CONFIRMATION_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerDeviceAddress: [u8; 6], pub DialogToken: u8, pub ResponseContext: *mut ::core::ffi::c_void, pub uSendTimeout: u32, pub Status: u8, pub GroupCapability: u8, pub GroupID: DOT11_WFD_GROUP_ID, pub bUseGroupID: super::super::Foundation::BOOLEAN, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_SEND_GO_NEGOTIATION_CONFIRMATION_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_SEND_GO_NEGOTIATION_CONFIRMATION_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_SEND_GO_NEGOTIATION_CONFIRMATION_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SEND_GO_NEGOTIATION_CONFIRMATION_PARAMETERS") .field("Header", &self.Header) .field("PeerDeviceAddress", &self.PeerDeviceAddress) .field("DialogToken", &self.DialogToken) .field("ResponseContext", &self.ResponseContext) .field("uSendTimeout", &self.uSendTimeout) .field("Status", &self.Status) .field("GroupCapability", &self.GroupCapability) .field("GroupID", &self.GroupID) .field("bUseGroupID", &self.bUseGroupID) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_SEND_GO_NEGOTIATION_CONFIRMATION_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerDeviceAddress == other.PeerDeviceAddress && self.DialogToken == other.DialogToken && self.ResponseContext == other.ResponseContext && self.uSendTimeout == other.uSendTimeout && self.Status == other.Status && self.GroupCapability == other.GroupCapability && self.GroupID == other.GroupID && self.bUseGroupID == other.bUseGroupID && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_SEND_GO_NEGOTIATION_CONFIRMATION_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_SEND_GO_NEGOTIATION_CONFIRMATION_PARAMETERS { type Abi = Self; } pub const DOT11_SEND_GO_NEGOTIATION_CONFIRMATION_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_SEND_GO_NEGOTIATION_REQUEST_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerDeviceAddress: [u8; 6], pub DialogToken: u8, pub uSendTimeout: u32, pub GroupOwnerIntent: DOT11_WFD_GO_INTENT, pub MinimumConfigTimeout: DOT11_WFD_CONFIGURATION_TIMEOUT, pub IntendedInterfaceAddress: [u8; 6], pub GroupCapability: u8, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_SEND_GO_NEGOTIATION_REQUEST_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_SEND_GO_NEGOTIATION_REQUEST_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_SEND_GO_NEGOTIATION_REQUEST_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SEND_GO_NEGOTIATION_REQUEST_PARAMETERS") .field("Header", &self.Header) .field("PeerDeviceAddress", &self.PeerDeviceAddress) .field("DialogToken", &self.DialogToken) .field("uSendTimeout", &self.uSendTimeout) .field("GroupOwnerIntent", &self.GroupOwnerIntent) .field("MinimumConfigTimeout", &self.MinimumConfigTimeout) .field("IntendedInterfaceAddress", &self.IntendedInterfaceAddress) .field("GroupCapability", &self.GroupCapability) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_SEND_GO_NEGOTIATION_REQUEST_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerDeviceAddress == other.PeerDeviceAddress && self.DialogToken == other.DialogToken && self.uSendTimeout == other.uSendTimeout && self.GroupOwnerIntent == other.GroupOwnerIntent && self.MinimumConfigTimeout == other.MinimumConfigTimeout && self.IntendedInterfaceAddress == other.IntendedInterfaceAddress && self.GroupCapability == other.GroupCapability && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_SEND_GO_NEGOTIATION_REQUEST_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_SEND_GO_NEGOTIATION_REQUEST_PARAMETERS { type Abi = Self; } pub const DOT11_SEND_GO_NEGOTIATION_REQUEST_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_SEND_GO_NEGOTIATION_RESPONSE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub PeerDeviceAddress: [u8; 6], pub DialogToken: u8, pub RequestContext: *mut ::core::ffi::c_void, pub uSendTimeout: u32, pub Status: u8, pub GroupOwnerIntent: DOT11_WFD_GO_INTENT, pub MinimumConfigTimeout: DOT11_WFD_CONFIGURATION_TIMEOUT, pub IntendedInterfaceAddress: [u8; 6], pub GroupCapability: u8, pub GroupID: DOT11_WFD_GROUP_ID, pub bUseGroupID: super::super::Foundation::BOOLEAN, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_SEND_GO_NEGOTIATION_RESPONSE_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_SEND_GO_NEGOTIATION_RESPONSE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_SEND_GO_NEGOTIATION_RESPONSE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SEND_GO_NEGOTIATION_RESPONSE_PARAMETERS") .field("Header", &self.Header) .field("PeerDeviceAddress", &self.PeerDeviceAddress) .field("DialogToken", &self.DialogToken) .field("RequestContext", &self.RequestContext) .field("uSendTimeout", &self.uSendTimeout) .field("Status", &self.Status) .field("GroupOwnerIntent", &self.GroupOwnerIntent) .field("MinimumConfigTimeout", &self.MinimumConfigTimeout) .field("IntendedInterfaceAddress", &self.IntendedInterfaceAddress) .field("GroupCapability", &self.GroupCapability) .field("GroupID", &self.GroupID) .field("bUseGroupID", &self.bUseGroupID) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_SEND_GO_NEGOTIATION_RESPONSE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.PeerDeviceAddress == other.PeerDeviceAddress && self.DialogToken == other.DialogToken && self.RequestContext == other.RequestContext && self.uSendTimeout == other.uSendTimeout && self.Status == other.Status && self.GroupOwnerIntent == other.GroupOwnerIntent && self.MinimumConfigTimeout == other.MinimumConfigTimeout && self.IntendedInterfaceAddress == other.IntendedInterfaceAddress && self.GroupCapability == other.GroupCapability && self.GroupID == other.GroupID && self.bUseGroupID == other.bUseGroupID && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_SEND_GO_NEGOTIATION_RESPONSE_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_SEND_GO_NEGOTIATION_RESPONSE_PARAMETERS { type Abi = Self; } pub const DOT11_SEND_GO_NEGOTIATION_RESPONSE_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_SEND_INVITATION_REQUEST_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub DialogToken: u8, pub PeerDeviceAddress: [u8; 6], pub uSendTimeout: u32, pub MinimumConfigTimeout: DOT11_WFD_CONFIGURATION_TIMEOUT, pub InvitationFlags: DOT11_WFD_INVITATION_FLAGS, pub GroupBSSID: [u8; 6], pub bUseGroupBSSID: super::super::Foundation::BOOLEAN, pub OperatingChannel: DOT11_WFD_CHANNEL, pub bUseSpecifiedOperatingChannel: super::super::Foundation::BOOLEAN, pub GroupID: DOT11_WFD_GROUP_ID, pub bLocalGO: super::super::Foundation::BOOLEAN, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_SEND_INVITATION_REQUEST_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_SEND_INVITATION_REQUEST_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_SEND_INVITATION_REQUEST_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SEND_INVITATION_REQUEST_PARAMETERS") .field("Header", &self.Header) .field("DialogToken", &self.DialogToken) .field("PeerDeviceAddress", &self.PeerDeviceAddress) .field("uSendTimeout", &self.uSendTimeout) .field("MinimumConfigTimeout", &self.MinimumConfigTimeout) .field("InvitationFlags", &self.InvitationFlags) .field("GroupBSSID", &self.GroupBSSID) .field("bUseGroupBSSID", &self.bUseGroupBSSID) .field("OperatingChannel", &self.OperatingChannel) .field("bUseSpecifiedOperatingChannel", &self.bUseSpecifiedOperatingChannel) .field("GroupID", &self.GroupID) .field("bLocalGO", &self.bLocalGO) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_SEND_INVITATION_REQUEST_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.DialogToken == other.DialogToken && self.PeerDeviceAddress == other.PeerDeviceAddress && self.uSendTimeout == other.uSendTimeout && self.MinimumConfigTimeout == other.MinimumConfigTimeout && self.InvitationFlags == other.InvitationFlags && self.GroupBSSID == other.GroupBSSID && self.bUseGroupBSSID == other.bUseGroupBSSID && self.OperatingChannel == other.OperatingChannel && self.bUseSpecifiedOperatingChannel == other.bUseSpecifiedOperatingChannel && self.GroupID == other.GroupID && self.bLocalGO == other.bLocalGO && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_SEND_INVITATION_REQUEST_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_SEND_INVITATION_REQUEST_PARAMETERS { type Abi = Self; } pub const DOT11_SEND_INVITATION_REQUEST_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_SEND_INVITATION_RESPONSE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub ReceiverDeviceAddress: [u8; 6], pub DialogToken: u8, pub RequestContext: *mut ::core::ffi::c_void, pub uSendTimeout: u32, pub Status: u8, pub MinimumConfigTimeout: DOT11_WFD_CONFIGURATION_TIMEOUT, pub GroupBSSID: [u8; 6], pub bUseGroupBSSID: super::super::Foundation::BOOLEAN, pub OperatingChannel: DOT11_WFD_CHANNEL, pub bUseSpecifiedOperatingChannel: super::super::Foundation::BOOLEAN, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_SEND_INVITATION_RESPONSE_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_SEND_INVITATION_RESPONSE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_SEND_INVITATION_RESPONSE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SEND_INVITATION_RESPONSE_PARAMETERS") .field("Header", &self.Header) .field("ReceiverDeviceAddress", &self.ReceiverDeviceAddress) .field("DialogToken", &self.DialogToken) .field("RequestContext", &self.RequestContext) .field("uSendTimeout", &self.uSendTimeout) .field("Status", &self.Status) .field("MinimumConfigTimeout", &self.MinimumConfigTimeout) .field("GroupBSSID", &self.GroupBSSID) .field("bUseGroupBSSID", &self.bUseGroupBSSID) .field("OperatingChannel", &self.OperatingChannel) .field("bUseSpecifiedOperatingChannel", &self.bUseSpecifiedOperatingChannel) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_SEND_INVITATION_RESPONSE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.ReceiverDeviceAddress == other.ReceiverDeviceAddress && self.DialogToken == other.DialogToken && self.RequestContext == other.RequestContext && self.uSendTimeout == other.uSendTimeout && self.Status == other.Status && self.MinimumConfigTimeout == other.MinimumConfigTimeout && self.GroupBSSID == other.GroupBSSID && self.bUseGroupBSSID == other.bUseGroupBSSID && self.OperatingChannel == other.OperatingChannel && self.bUseSpecifiedOperatingChannel == other.bUseSpecifiedOperatingChannel && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_SEND_INVITATION_RESPONSE_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_SEND_INVITATION_RESPONSE_PARAMETERS { type Abi = Self; } pub const DOT11_SEND_INVITATION_RESPONSE_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_SEND_PROVISION_DISCOVERY_REQUEST_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub DialogToken: u8, pub PeerDeviceAddress: [u8; 6], pub uSendTimeout: u32, pub GroupCapability: u8, pub GroupID: DOT11_WFD_GROUP_ID, pub bUseGroupID: super::super::Foundation::BOOLEAN, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_SEND_PROVISION_DISCOVERY_REQUEST_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_SEND_PROVISION_DISCOVERY_REQUEST_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_SEND_PROVISION_DISCOVERY_REQUEST_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SEND_PROVISION_DISCOVERY_REQUEST_PARAMETERS") .field("Header", &self.Header) .field("DialogToken", &self.DialogToken) .field("PeerDeviceAddress", &self.PeerDeviceAddress) .field("uSendTimeout", &self.uSendTimeout) .field("GroupCapability", &self.GroupCapability) .field("GroupID", &self.GroupID) .field("bUseGroupID", &self.bUseGroupID) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_SEND_PROVISION_DISCOVERY_REQUEST_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.DialogToken == other.DialogToken && self.PeerDeviceAddress == other.PeerDeviceAddress && self.uSendTimeout == other.uSendTimeout && self.GroupCapability == other.GroupCapability && self.GroupID == other.GroupID && self.bUseGroupID == other.bUseGroupID && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_SEND_PROVISION_DISCOVERY_REQUEST_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_SEND_PROVISION_DISCOVERY_REQUEST_PARAMETERS { type Abi = Self; } pub const DOT11_SEND_PROVISION_DISCOVERY_REQUEST_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_SEND_PROVISION_DISCOVERY_RESPONSE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub ReceiverDeviceAddress: [u8; 6], pub DialogToken: u8, pub RequestContext: *mut ::core::ffi::c_void, pub uSendTimeout: u32, pub uIEsOffset: u32, pub uIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_SEND_PROVISION_DISCOVERY_RESPONSE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_SEND_PROVISION_DISCOVERY_RESPONSE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_SEND_PROVISION_DISCOVERY_RESPONSE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SEND_PROVISION_DISCOVERY_RESPONSE_PARAMETERS") .field("Header", &self.Header) .field("ReceiverDeviceAddress", &self.ReceiverDeviceAddress) .field("DialogToken", &self.DialogToken) .field("RequestContext", &self.RequestContext) .field("uSendTimeout", &self.uSendTimeout) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_SEND_PROVISION_DISCOVERY_RESPONSE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.ReceiverDeviceAddress == other.ReceiverDeviceAddress && self.DialogToken == other.DialogToken && self.RequestContext == other.RequestContext && self.uSendTimeout == other.uSendTimeout && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_SEND_PROVISION_DISCOVERY_RESPONSE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_SEND_PROVISION_DISCOVERY_RESPONSE_PARAMETERS { type Abi = Self; } pub const DOT11_SEND_PROVISION_DISCOVERY_RESPONSE_PARAMETERS_REVISION_1: u32 = 1u32; pub const DOT11_SERVICE_CLASS_REORDERABLE_MULTICAST: u32 = 0u32; pub const DOT11_SERVICE_CLASS_STRICTLY_ORDERED: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_SSID { pub uSSIDLength: u32, pub ucSSID: [u8; 32], } impl DOT11_SSID {} impl ::core::default::Default for DOT11_SSID { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_SSID { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SSID").field("uSSIDLength", &self.uSSIDLength).field("ucSSID", &self.ucSSID).finish() } } impl ::core::cmp::PartialEq for DOT11_SSID { fn eq(&self, other: &Self) -> bool { self.uSSIDLength == other.uSSIDLength && self.ucSSID == other.ucSSID } } impl ::core::cmp::Eq for DOT11_SSID {} unsafe impl ::windows::core::Abi for DOT11_SSID { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_SSID_LIST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub SSIDs: [DOT11_SSID; 1], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_SSID_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_SSID_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_SSID_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SSID_LIST").field("Header", &self.Header).field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("SSIDs", &self.SSIDs).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_SSID_LIST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.SSIDs == other.SSIDs } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_SSID_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_SSID_LIST { type Abi = Self; } pub const DOT11_SSID_LIST_REVISION_1: u32 = 1u32; pub const DOT11_SSID_MAX_LENGTH: u32 = 32u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_START_REQUEST { pub uStartFailureTimeout: u32, pub OperationalRateSet: DOT11_RATE_SET, pub uChCenterFrequency: u32, pub dot11BSSDescription: DOT11_BSS_DESCRIPTION, } impl DOT11_START_REQUEST {} impl ::core::default::Default for DOT11_START_REQUEST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_START_REQUEST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_START_REQUEST").field("uStartFailureTimeout", &self.uStartFailureTimeout).field("OperationalRateSet", &self.OperationalRateSet).field("uChCenterFrequency", &self.uChCenterFrequency).field("dot11BSSDescription", &self.dot11BSSDescription).finish() } } impl ::core::cmp::PartialEq for DOT11_START_REQUEST { fn eq(&self, other: &Self) -> bool { self.uStartFailureTimeout == other.uStartFailureTimeout && self.OperationalRateSet == other.OperationalRateSet && self.uChCenterFrequency == other.uChCenterFrequency && self.dot11BSSDescription == other.dot11BSSDescription } } impl ::core::cmp::Eq for DOT11_START_REQUEST {} unsafe impl ::windows::core::Abi for DOT11_START_REQUEST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_STATISTICS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub ullFourWayHandshakeFailures: u64, pub ullTKIPCounterMeasuresInvoked: u64, pub ullReserved: u64, pub MacUcastCounters: DOT11_MAC_FRAME_STATISTICS, pub MacMcastCounters: DOT11_MAC_FRAME_STATISTICS, pub PhyCounters: [DOT11_PHY_FRAME_STATISTICS; 1], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_STATISTICS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_STATISTICS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_STATISTICS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_STATISTICS") .field("Header", &self.Header) .field("ullFourWayHandshakeFailures", &self.ullFourWayHandshakeFailures) .field("ullTKIPCounterMeasuresInvoked", &self.ullTKIPCounterMeasuresInvoked) .field("ullReserved", &self.ullReserved) .field("MacUcastCounters", &self.MacUcastCounters) .field("MacMcastCounters", &self.MacMcastCounters) .field("PhyCounters", &self.PhyCounters) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_STATISTICS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.ullFourWayHandshakeFailures == other.ullFourWayHandshakeFailures && self.ullTKIPCounterMeasuresInvoked == other.ullTKIPCounterMeasuresInvoked && self.ullReserved == other.ullReserved && self.MacUcastCounters == other.MacUcastCounters && self.MacMcastCounters == other.MacMcastCounters && self.PhyCounters == other.PhyCounters } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_STATISTICS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_STATISTICS { type Abi = Self; } pub const DOT11_STATISTICS_REVISION_1: u32 = 1u32; pub const DOT11_STATUS_AP_JOIN_CONFIRM: u32 = 5u32; pub const DOT11_STATUS_AUTH_FAILED: u32 = 131072u32; pub const DOT11_STATUS_AUTH_NOT_VERIFIED: u32 = 32768u32; pub const DOT11_STATUS_AUTH_VERIFIED: u32 = 65536u32; pub const DOT11_STATUS_ENCRYPTION_FAILED: u32 = 512u32; pub const DOT11_STATUS_EXCESSIVE_DATA_LENGTH: u32 = 256u32; pub const DOT11_STATUS_GENERATE_AUTH_FAILED: u32 = 16384u32; pub const DOT11_STATUS_ICV_VERIFIED: u32 = 2048u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_STATUS_INDICATION { pub uStatusType: u32, pub ndisStatus: i32, } impl DOT11_STATUS_INDICATION {} impl ::core::default::Default for DOT11_STATUS_INDICATION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_STATUS_INDICATION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_STATUS_INDICATION").field("uStatusType", &self.uStatusType).field("ndisStatus", &self.ndisStatus).finish() } } impl ::core::cmp::PartialEq for DOT11_STATUS_INDICATION { fn eq(&self, other: &Self) -> bool { self.uStatusType == other.uStatusType && self.ndisStatus == other.ndisStatus } } impl ::core::cmp::Eq for DOT11_STATUS_INDICATION {} unsafe impl ::windows::core::Abi for DOT11_STATUS_INDICATION { type Abi = Self; } pub const DOT11_STATUS_JOIN_CONFIRM: u32 = 2u32; pub const DOT11_STATUS_MPDU_MAX_LENGTH_CHANGED: u32 = 6u32; pub const DOT11_STATUS_PACKET_NOT_REASSEMBLED: u32 = 8192u32; pub const DOT11_STATUS_PACKET_REASSEMBLED: u32 = 4096u32; pub const DOT11_STATUS_PS_LIFETIME_EXPIRED: u32 = 262144u32; pub const DOT11_STATUS_RESET_CONFIRM: u32 = 4u32; pub const DOT11_STATUS_RETRY_LIMIT_EXCEEDED: u32 = 2u32; pub const DOT11_STATUS_SCAN_CONFIRM: u32 = 1u32; pub const DOT11_STATUS_START_CONFIRM: u32 = 3u32; pub const DOT11_STATUS_SUCCESS: u32 = 1u32; pub const DOT11_STATUS_UNAVAILABLE_BSS: u32 = 128u32; pub const DOT11_STATUS_UNAVAILABLE_PRIORITY: u32 = 16u32; pub const DOT11_STATUS_UNAVAILABLE_SERVICE_CLASS: u32 = 32u32; pub const DOT11_STATUS_UNSUPPORTED_PRIORITY: u32 = 4u32; pub const DOT11_STATUS_UNSUPPORTED_SERVICE_CLASS: u32 = 8u32; pub const DOT11_STATUS_WEP_KEY_UNAVAILABLE: u32 = 1024u32; pub const DOT11_STATUS_XMIT_MSDU_TIMER_EXPIRED: u32 = 64u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_STOP_AP_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub ulReason: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_STOP_AP_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_STOP_AP_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_STOP_AP_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_STOP_AP_PARAMETERS").field("Header", &self.Header).field("ulReason", &self.ulReason).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_STOP_AP_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.ulReason == other.ulReason } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_STOP_AP_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_STOP_AP_PARAMETERS { type Abi = Self; } pub const DOT11_STOP_AP_PARAMETERS_REVISION_1: u32 = 1u32; pub const DOT11_STOP_AP_REASON_AP_ACTIVE: u32 = 3u32; pub const DOT11_STOP_AP_REASON_CHANNEL_NOT_AVAILABLE: u32 = 2u32; pub const DOT11_STOP_AP_REASON_FREQUENCY_NOT_AVAILABLE: u32 = 1u32; pub const DOT11_STOP_AP_REASON_IHV_END: u32 = 4294967295u32; pub const DOT11_STOP_AP_REASON_IHV_START: u32 = 4278190080u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_SUPPORTED_ANTENNA { pub uAntennaListIndex: u32, pub bSupportedAntenna: super::super::Foundation::BOOLEAN, } #[cfg(feature = "Win32_Foundation")] impl DOT11_SUPPORTED_ANTENNA {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_SUPPORTED_ANTENNA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_SUPPORTED_ANTENNA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SUPPORTED_ANTENNA").field("uAntennaListIndex", &self.uAntennaListIndex).field("bSupportedAntenna", &self.bSupportedAntenna).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_SUPPORTED_ANTENNA { fn eq(&self, other: &Self) -> bool { self.uAntennaListIndex == other.uAntennaListIndex && self.bSupportedAntenna == other.bSupportedAntenna } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_SUPPORTED_ANTENNA {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_SUPPORTED_ANTENNA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_SUPPORTED_ANTENNA_LIST { pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub dot11SupportedAntenna: [DOT11_SUPPORTED_ANTENNA; 1], } #[cfg(feature = "Win32_Foundation")] impl DOT11_SUPPORTED_ANTENNA_LIST {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_SUPPORTED_ANTENNA_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_SUPPORTED_ANTENNA_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SUPPORTED_ANTENNA_LIST").field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("dot11SupportedAntenna", &self.dot11SupportedAntenna).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_SUPPORTED_ANTENNA_LIST { fn eq(&self, other: &Self) -> bool { self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.dot11SupportedAntenna == other.dot11SupportedAntenna } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_SUPPORTED_ANTENNA_LIST {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_SUPPORTED_ANTENNA_LIST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_SUPPORTED_DATA_RATES_VALUE { pub ucSupportedTxDataRatesValue: [u8; 8], pub ucSupportedRxDataRatesValue: [u8; 8], } impl DOT11_SUPPORTED_DATA_RATES_VALUE {} impl ::core::default::Default for DOT11_SUPPORTED_DATA_RATES_VALUE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_SUPPORTED_DATA_RATES_VALUE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SUPPORTED_DATA_RATES_VALUE").field("ucSupportedTxDataRatesValue", &self.ucSupportedTxDataRatesValue).field("ucSupportedRxDataRatesValue", &self.ucSupportedRxDataRatesValue).finish() } } impl ::core::cmp::PartialEq for DOT11_SUPPORTED_DATA_RATES_VALUE { fn eq(&self, other: &Self) -> bool { self.ucSupportedTxDataRatesValue == other.ucSupportedTxDataRatesValue && self.ucSupportedRxDataRatesValue == other.ucSupportedRxDataRatesValue } } impl ::core::cmp::Eq for DOT11_SUPPORTED_DATA_RATES_VALUE {} unsafe impl ::windows::core::Abi for DOT11_SUPPORTED_DATA_RATES_VALUE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_SUPPORTED_DATA_RATES_VALUE_V2 { pub ucSupportedTxDataRatesValue: [u8; 255], pub ucSupportedRxDataRatesValue: [u8; 255], } impl DOT11_SUPPORTED_DATA_RATES_VALUE_V2 {} impl ::core::default::Default for DOT11_SUPPORTED_DATA_RATES_VALUE_V2 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_SUPPORTED_DATA_RATES_VALUE_V2 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SUPPORTED_DATA_RATES_VALUE_V2").field("ucSupportedTxDataRatesValue", &self.ucSupportedTxDataRatesValue).field("ucSupportedRxDataRatesValue", &self.ucSupportedRxDataRatesValue).finish() } } impl ::core::cmp::PartialEq for DOT11_SUPPORTED_DATA_RATES_VALUE_V2 { fn eq(&self, other: &Self) -> bool { self.ucSupportedTxDataRatesValue == other.ucSupportedTxDataRatesValue && self.ucSupportedRxDataRatesValue == other.ucSupportedRxDataRatesValue } } impl ::core::cmp::Eq for DOT11_SUPPORTED_DATA_RATES_VALUE_V2 {} unsafe impl ::windows::core::Abi for DOT11_SUPPORTED_DATA_RATES_VALUE_V2 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_SUPPORTED_DSSS_CHANNEL { pub uChannel: u32, } impl DOT11_SUPPORTED_DSSS_CHANNEL {} impl ::core::default::Default for DOT11_SUPPORTED_DSSS_CHANNEL { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_SUPPORTED_DSSS_CHANNEL { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SUPPORTED_DSSS_CHANNEL").field("uChannel", &self.uChannel).finish() } } impl ::core::cmp::PartialEq for DOT11_SUPPORTED_DSSS_CHANNEL { fn eq(&self, other: &Self) -> bool { self.uChannel == other.uChannel } } impl ::core::cmp::Eq for DOT11_SUPPORTED_DSSS_CHANNEL {} unsafe impl ::windows::core::Abi for DOT11_SUPPORTED_DSSS_CHANNEL { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_SUPPORTED_DSSS_CHANNEL_LIST { pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub dot11SupportedDSSSChannel: [DOT11_SUPPORTED_DSSS_CHANNEL; 1], } impl DOT11_SUPPORTED_DSSS_CHANNEL_LIST {} impl ::core::default::Default for DOT11_SUPPORTED_DSSS_CHANNEL_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_SUPPORTED_DSSS_CHANNEL_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SUPPORTED_DSSS_CHANNEL_LIST").field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("dot11SupportedDSSSChannel", &self.dot11SupportedDSSSChannel).finish() } } impl ::core::cmp::PartialEq for DOT11_SUPPORTED_DSSS_CHANNEL_LIST { fn eq(&self, other: &Self) -> bool { self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.dot11SupportedDSSSChannel == other.dot11SupportedDSSSChannel } } impl ::core::cmp::Eq for DOT11_SUPPORTED_DSSS_CHANNEL_LIST {} unsafe impl ::windows::core::Abi for DOT11_SUPPORTED_DSSS_CHANNEL_LIST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_SUPPORTED_OFDM_FREQUENCY { pub uCenterFrequency: u32, } impl DOT11_SUPPORTED_OFDM_FREQUENCY {} impl ::core::default::Default for DOT11_SUPPORTED_OFDM_FREQUENCY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_SUPPORTED_OFDM_FREQUENCY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SUPPORTED_OFDM_FREQUENCY").field("uCenterFrequency", &self.uCenterFrequency).finish() } } impl ::core::cmp::PartialEq for DOT11_SUPPORTED_OFDM_FREQUENCY { fn eq(&self, other: &Self) -> bool { self.uCenterFrequency == other.uCenterFrequency } } impl ::core::cmp::Eq for DOT11_SUPPORTED_OFDM_FREQUENCY {} unsafe impl ::windows::core::Abi for DOT11_SUPPORTED_OFDM_FREQUENCY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_SUPPORTED_OFDM_FREQUENCY_LIST { pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub dot11SupportedOFDMFrequency: [DOT11_SUPPORTED_OFDM_FREQUENCY; 1], } impl DOT11_SUPPORTED_OFDM_FREQUENCY_LIST {} impl ::core::default::Default for DOT11_SUPPORTED_OFDM_FREQUENCY_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_SUPPORTED_OFDM_FREQUENCY_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SUPPORTED_OFDM_FREQUENCY_LIST").field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("dot11SupportedOFDMFrequency", &self.dot11SupportedOFDMFrequency).finish() } } impl ::core::cmp::PartialEq for DOT11_SUPPORTED_OFDM_FREQUENCY_LIST { fn eq(&self, other: &Self) -> bool { self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.dot11SupportedOFDMFrequency == other.dot11SupportedOFDMFrequency } } impl ::core::cmp::Eq for DOT11_SUPPORTED_OFDM_FREQUENCY_LIST {} unsafe impl ::windows::core::Abi for DOT11_SUPPORTED_OFDM_FREQUENCY_LIST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_SUPPORTED_PHY_TYPES { pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub dot11PHYType: [DOT11_PHY_TYPE; 1], } impl DOT11_SUPPORTED_PHY_TYPES {} impl ::core::default::Default for DOT11_SUPPORTED_PHY_TYPES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_SUPPORTED_PHY_TYPES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SUPPORTED_PHY_TYPES").field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("dot11PHYType", &self.dot11PHYType).finish() } } impl ::core::cmp::PartialEq for DOT11_SUPPORTED_PHY_TYPES { fn eq(&self, other: &Self) -> bool { self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.dot11PHYType == other.dot11PHYType } } impl ::core::cmp::Eq for DOT11_SUPPORTED_PHY_TYPES {} unsafe impl ::windows::core::Abi for DOT11_SUPPORTED_PHY_TYPES { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_SUPPORTED_POWER_LEVELS { pub uNumOfSupportedPowerLevels: u32, pub uTxPowerLevelValues: [u32; 8], } impl DOT11_SUPPORTED_POWER_LEVELS {} impl ::core::default::Default for DOT11_SUPPORTED_POWER_LEVELS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_SUPPORTED_POWER_LEVELS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_SUPPORTED_POWER_LEVELS").field("uNumOfSupportedPowerLevels", &self.uNumOfSupportedPowerLevels).field("uTxPowerLevelValues", &self.uTxPowerLevelValues).finish() } } impl ::core::cmp::PartialEq for DOT11_SUPPORTED_POWER_LEVELS { fn eq(&self, other: &Self) -> bool { self.uNumOfSupportedPowerLevels == other.uNumOfSupportedPowerLevels && self.uTxPowerLevelValues == other.uTxPowerLevelValues } } impl ::core::cmp::Eq for DOT11_SUPPORTED_POWER_LEVELS {} unsafe impl ::windows::core::Abi for DOT11_SUPPORTED_POWER_LEVELS { 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 DOT11_TEMP_TYPE(pub i32); pub const dot11_temp_type_unknown: DOT11_TEMP_TYPE = DOT11_TEMP_TYPE(0i32); pub const dot11_temp_type_1: DOT11_TEMP_TYPE = DOT11_TEMP_TYPE(1i32); pub const dot11_temp_type_2: DOT11_TEMP_TYPE = DOT11_TEMP_TYPE(2i32); impl ::core::convert::From<i32> for DOT11_TEMP_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_TEMP_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_TKIPMIC_FAILURE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub bDefaultKeyFailure: super::super::Foundation::BOOLEAN, pub uKeyIndex: u32, pub PeerMac: [u8; 6], } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_TKIPMIC_FAILURE_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_TKIPMIC_FAILURE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_TKIPMIC_FAILURE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_TKIPMIC_FAILURE_PARAMETERS").field("Header", &self.Header).field("bDefaultKeyFailure", &self.bDefaultKeyFailure).field("uKeyIndex", &self.uKeyIndex).field("PeerMac", &self.PeerMac).finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_TKIPMIC_FAILURE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.bDefaultKeyFailure == other.bDefaultKeyFailure && self.uKeyIndex == other.uKeyIndex && self.PeerMac == other.PeerMac } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_TKIPMIC_FAILURE_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_TKIPMIC_FAILURE_PARAMETERS { type Abi = Self; } pub const DOT11_TKIPMIC_FAILURE_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_UPDATE_IE { pub dot11UpdateIEOp: DOT11_UPDATE_IE_OP, pub uBufferLength: u32, pub ucBuffer: [u8; 1], } impl DOT11_UPDATE_IE {} impl ::core::default::Default for DOT11_UPDATE_IE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_UPDATE_IE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_UPDATE_IE").field("dot11UpdateIEOp", &self.dot11UpdateIEOp).field("uBufferLength", &self.uBufferLength).field("ucBuffer", &self.ucBuffer).finish() } } impl ::core::cmp::PartialEq for DOT11_UPDATE_IE { fn eq(&self, other: &Self) -> bool { self.dot11UpdateIEOp == other.dot11UpdateIEOp && self.uBufferLength == other.uBufferLength && self.ucBuffer == other.ucBuffer } } impl ::core::cmp::Eq for DOT11_UPDATE_IE {} unsafe impl ::windows::core::Abi for DOT11_UPDATE_IE { 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 DOT11_UPDATE_IE_OP(pub i32); pub const dot11_update_ie_op_create_replace: DOT11_UPDATE_IE_OP = DOT11_UPDATE_IE_OP(1i32); pub const dot11_update_ie_op_delete: DOT11_UPDATE_IE_OP = DOT11_UPDATE_IE_OP(2i32); impl ::core::convert::From<i32> for DOT11_UPDATE_IE_OP { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_UPDATE_IE_OP { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_VENUEINFO { pub VenueGroup: u8, pub VenueType: u8, } impl DOT11_VENUEINFO {} impl ::core::default::Default for DOT11_VENUEINFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_VENUEINFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_VENUEINFO").field("VenueGroup", &self.VenueGroup).field("VenueType", &self.VenueType).finish() } } impl ::core::cmp::PartialEq for DOT11_VENUEINFO { fn eq(&self, other: &Self) -> bool { self.VenueGroup == other.VenueGroup && self.VenueType == other.VenueType } } impl ::core::cmp::Eq for DOT11_VENUEINFO {} unsafe impl ::windows::core::Abi for DOT11_VENUEINFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_VWIFI_ATTRIBUTES { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uTotalNumOfEntries: u32, pub Combinations: [DOT11_VWIFI_COMBINATION; 1], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_VWIFI_ATTRIBUTES {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_VWIFI_ATTRIBUTES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_VWIFI_ATTRIBUTES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_VWIFI_ATTRIBUTES").field("Header", &self.Header).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("Combinations", &self.Combinations).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_VWIFI_ATTRIBUTES { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.Combinations == other.Combinations } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_VWIFI_ATTRIBUTES {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_VWIFI_ATTRIBUTES { type Abi = Self; } pub const DOT11_VWIFI_ATTRIBUTES_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_VWIFI_COMBINATION { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumInfrastructure: u32, pub uNumAdhoc: u32, pub uNumSoftAP: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_VWIFI_COMBINATION {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_VWIFI_COMBINATION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_VWIFI_COMBINATION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_VWIFI_COMBINATION").field("Header", &self.Header).field("uNumInfrastructure", &self.uNumInfrastructure).field("uNumAdhoc", &self.uNumAdhoc).field("uNumSoftAP", &self.uNumSoftAP).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_VWIFI_COMBINATION { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumInfrastructure == other.uNumInfrastructure && self.uNumAdhoc == other.uNumAdhoc && self.uNumSoftAP == other.uNumSoftAP } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_VWIFI_COMBINATION {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_VWIFI_COMBINATION { type Abi = Self; } pub const DOT11_VWIFI_COMBINATION_REVISION_1: u32 = 1u32; pub const DOT11_VWIFI_COMBINATION_REVISION_2: u32 = 2u32; pub const DOT11_VWIFI_COMBINATION_REVISION_3: u32 = 3u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_VWIFI_COMBINATION_V2 { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumInfrastructure: u32, pub uNumAdhoc: u32, pub uNumSoftAP: u32, pub uNumVirtualStation: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_VWIFI_COMBINATION_V2 {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_VWIFI_COMBINATION_V2 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_VWIFI_COMBINATION_V2 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_VWIFI_COMBINATION_V2").field("Header", &self.Header).field("uNumInfrastructure", &self.uNumInfrastructure).field("uNumAdhoc", &self.uNumAdhoc).field("uNumSoftAP", &self.uNumSoftAP).field("uNumVirtualStation", &self.uNumVirtualStation).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_VWIFI_COMBINATION_V2 { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumInfrastructure == other.uNumInfrastructure && self.uNumAdhoc == other.uNumAdhoc && self.uNumSoftAP == other.uNumSoftAP && self.uNumVirtualStation == other.uNumVirtualStation } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_VWIFI_COMBINATION_V2 {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_VWIFI_COMBINATION_V2 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_VWIFI_COMBINATION_V3 { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumInfrastructure: u32, pub uNumAdhoc: u32, pub uNumSoftAP: u32, pub uNumVirtualStation: u32, pub uNumWFDGroup: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_VWIFI_COMBINATION_V3 {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_VWIFI_COMBINATION_V3 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_VWIFI_COMBINATION_V3 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_VWIFI_COMBINATION_V3") .field("Header", &self.Header) .field("uNumInfrastructure", &self.uNumInfrastructure) .field("uNumAdhoc", &self.uNumAdhoc) .field("uNumSoftAP", &self.uNumSoftAP) .field("uNumVirtualStation", &self.uNumVirtualStation) .field("uNumWFDGroup", &self.uNumWFDGroup) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_VWIFI_COMBINATION_V3 { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumInfrastructure == other.uNumInfrastructure && self.uNumAdhoc == other.uNumAdhoc && self.uNumSoftAP == other.uNumSoftAP && self.uNumVirtualStation == other.uNumVirtualStation && self.uNumWFDGroup == other.uNumWFDGroup } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_VWIFI_COMBINATION_V3 {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_VWIFI_COMBINATION_V3 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_WEP_OFFLOAD { pub uReserved: u32, pub hOffloadContext: super::super::Foundation::HANDLE, pub hOffload: super::super::Foundation::HANDLE, pub dot11OffloadType: DOT11_OFFLOAD_TYPE, pub dwAlgorithm: u32, pub bRowIsOutbound: super::super::Foundation::BOOLEAN, pub bUseDefault: super::super::Foundation::BOOLEAN, pub uFlags: u32, pub ucMacAddress: [u8; 6], pub uNumOfRWsOnPeer: u32, pub uNumOfRWsOnMe: u32, pub dot11IV48Counters: [DOT11_IV48_COUNTER; 16], pub usDot11RWBitMaps: [u16; 16], pub usKeyLength: u16, pub ucKey: [u8; 1], } #[cfg(feature = "Win32_Foundation")] impl DOT11_WEP_OFFLOAD {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_WEP_OFFLOAD { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_WEP_OFFLOAD { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WEP_OFFLOAD") .field("uReserved", &self.uReserved) .field("hOffloadContext", &self.hOffloadContext) .field("hOffload", &self.hOffload) .field("dot11OffloadType", &self.dot11OffloadType) .field("dwAlgorithm", &self.dwAlgorithm) .field("bRowIsOutbound", &self.bRowIsOutbound) .field("bUseDefault", &self.bUseDefault) .field("uFlags", &self.uFlags) .field("ucMacAddress", &self.ucMacAddress) .field("uNumOfRWsOnPeer", &self.uNumOfRWsOnPeer) .field("uNumOfRWsOnMe", &self.uNumOfRWsOnMe) .field("dot11IV48Counters", &self.dot11IV48Counters) .field("usDot11RWBitMaps", &self.usDot11RWBitMaps) .field("usKeyLength", &self.usKeyLength) .field("ucKey", &self.ucKey) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_WEP_OFFLOAD { fn eq(&self, other: &Self) -> bool { self.uReserved == other.uReserved && self.hOffloadContext == other.hOffloadContext && self.hOffload == other.hOffload && self.dot11OffloadType == other.dot11OffloadType && self.dwAlgorithm == other.dwAlgorithm && self.bRowIsOutbound == other.bRowIsOutbound && self.bUseDefault == other.bUseDefault && self.uFlags == other.uFlags && self.ucMacAddress == other.ucMacAddress && self.uNumOfRWsOnPeer == other.uNumOfRWsOnPeer && self.uNumOfRWsOnMe == other.uNumOfRWsOnMe && self.dot11IV48Counters == other.dot11IV48Counters && self.usDot11RWBitMaps == other.usDot11RWBitMaps && self.usKeyLength == other.usKeyLength && self.ucKey == other.ucKey } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_WEP_OFFLOAD {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_WEP_OFFLOAD { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_WEP_UPLOAD { pub uReserved: u32, pub dot11OffloadType: DOT11_OFFLOAD_TYPE, pub hOffload: super::super::Foundation::HANDLE, pub uNumOfRWsUsed: u32, pub dot11IV48Counters: [DOT11_IV48_COUNTER; 16], pub usDot11RWBitMaps: [u16; 16], } #[cfg(feature = "Win32_Foundation")] impl DOT11_WEP_UPLOAD {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_WEP_UPLOAD { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_WEP_UPLOAD { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WEP_UPLOAD") .field("uReserved", &self.uReserved) .field("dot11OffloadType", &self.dot11OffloadType) .field("hOffload", &self.hOffload) .field("uNumOfRWsUsed", &self.uNumOfRWsUsed) .field("dot11IV48Counters", &self.dot11IV48Counters) .field("usDot11RWBitMaps", &self.usDot11RWBitMaps) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_WEP_UPLOAD { fn eq(&self, other: &Self) -> bool { self.uReserved == other.uReserved && self.dot11OffloadType == other.dot11OffloadType && self.hOffload == other.hOffload && self.uNumOfRWsUsed == other.uNumOfRWsUsed && self.dot11IV48Counters == other.dot11IV48Counters && self.usDot11RWBitMaps == other.usDot11RWBitMaps } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_WEP_UPLOAD {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_WEP_UPLOAD { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_WFD_ADDITIONAL_IE { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uBeaconIEsOffset: u32, pub uBeaconIEsLength: u32, pub uProbeResponseIEsOffset: u32, pub uProbeResponseIEsLength: u32, pub uDefaultRequestIEsOffset: u32, pub uDefaultRequestIEsLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_WFD_ADDITIONAL_IE {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_WFD_ADDITIONAL_IE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_WFD_ADDITIONAL_IE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_ADDITIONAL_IE") .field("Header", &self.Header) .field("uBeaconIEsOffset", &self.uBeaconIEsOffset) .field("uBeaconIEsLength", &self.uBeaconIEsLength) .field("uProbeResponseIEsOffset", &self.uProbeResponseIEsOffset) .field("uProbeResponseIEsLength", &self.uProbeResponseIEsLength) .field("uDefaultRequestIEsOffset", &self.uDefaultRequestIEsOffset) .field("uDefaultRequestIEsLength", &self.uDefaultRequestIEsLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_WFD_ADDITIONAL_IE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uBeaconIEsOffset == other.uBeaconIEsOffset && self.uBeaconIEsLength == other.uBeaconIEsLength && self.uProbeResponseIEsOffset == other.uProbeResponseIEsOffset && self.uProbeResponseIEsLength == other.uProbeResponseIEsLength && self.uDefaultRequestIEsOffset == other.uDefaultRequestIEsOffset && self.uDefaultRequestIEsLength == other.uDefaultRequestIEsLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_WFD_ADDITIONAL_IE {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_WFD_ADDITIONAL_IE { type Abi = Self; } pub const DOT11_WFD_ADDITIONAL_IE_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR { pub AdvertisementID: u32, pub ConfigMethods: u16, pub ServiceNameLength: u8, pub ServiceName: [u8; 255], } impl DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR {} impl ::core::default::Default for DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR").field("AdvertisementID", &self.AdvertisementID).field("ConfigMethods", &self.ConfigMethods).field("ServiceNameLength", &self.ServiceNameLength).field("ServiceName", &self.ServiceName).finish() } } impl ::core::cmp::PartialEq for DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR { fn eq(&self, other: &Self) -> bool { self.AdvertisementID == other.AdvertisementID && self.ConfigMethods == other.ConfigMethods && self.ServiceNameLength == other.ServiceNameLength && self.ServiceName == other.ServiceName } } impl ::core::cmp::Eq for DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR {} unsafe impl ::windows::core::Abi for DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WFD_ADVERTISED_SERVICE_LIST { pub ServiceCount: u16, pub AdvertisedService: [DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR; 1], } impl DOT11_WFD_ADVERTISED_SERVICE_LIST {} impl ::core::default::Default for DOT11_WFD_ADVERTISED_SERVICE_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_WFD_ADVERTISED_SERVICE_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_ADVERTISED_SERVICE_LIST").field("ServiceCount", &self.ServiceCount).field("AdvertisedService", &self.AdvertisedService).finish() } } impl ::core::cmp::PartialEq for DOT11_WFD_ADVERTISED_SERVICE_LIST { fn eq(&self, other: &Self) -> bool { self.ServiceCount == other.ServiceCount && self.AdvertisedService == other.AdvertisedService } } impl ::core::cmp::Eq for DOT11_WFD_ADVERTISED_SERVICE_LIST {} unsafe impl ::windows::core::Abi for DOT11_WFD_ADVERTISED_SERVICE_LIST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WFD_ADVERTISEMENT_ID { pub AdvertisementID: u32, pub ServiceAddress: [u8; 6], } impl DOT11_WFD_ADVERTISEMENT_ID {} impl ::core::default::Default for DOT11_WFD_ADVERTISEMENT_ID { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_WFD_ADVERTISEMENT_ID { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_ADVERTISEMENT_ID").field("AdvertisementID", &self.AdvertisementID).field("ServiceAddress", &self.ServiceAddress).finish() } } impl ::core::cmp::PartialEq for DOT11_WFD_ADVERTISEMENT_ID { fn eq(&self, other: &Self) -> bool { self.AdvertisementID == other.AdvertisementID && self.ServiceAddress == other.ServiceAddress } } impl ::core::cmp::Eq for DOT11_WFD_ADVERTISEMENT_ID {} unsafe impl ::windows::core::Abi for DOT11_WFD_ADVERTISEMENT_ID { type Abi = Self; } pub const DOT11_WFD_APS2_SERVICE_TYPE_MAX_LENGTH: u32 = 21u32; pub const DOT11_WFD_ASP2_INSTANCE_NAME_MAX_LENGTH: u32 = 63u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_WFD_ATTRIBUTES { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumConcurrentGORole: u32, pub uNumConcurrentClientRole: u32, pub WPSVersionsSupported: u32, pub bServiceDiscoverySupported: super::super::Foundation::BOOLEAN, pub bClientDiscoverabilitySupported: super::super::Foundation::BOOLEAN, pub bInfrastructureManagementSupported: super::super::Foundation::BOOLEAN, pub uMaxSecondaryDeviceTypeListSize: u32, pub DeviceAddress: [u8; 6], pub uInterfaceAddressListCount: u32, pub pInterfaceAddressList: *mut u8, pub uNumSupportedCountryOrRegionStrings: u32, pub pSupportedCountryOrRegionStrings: *mut u8, pub uDiscoveryFilterListSize: u32, pub uGORoleClientTableSize: u32, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_WFD_ATTRIBUTES {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_WFD_ATTRIBUTES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_WFD_ATTRIBUTES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_ATTRIBUTES") .field("Header", &self.Header) .field("uNumConcurrentGORole", &self.uNumConcurrentGORole) .field("uNumConcurrentClientRole", &self.uNumConcurrentClientRole) .field("WPSVersionsSupported", &self.WPSVersionsSupported) .field("bServiceDiscoverySupported", &self.bServiceDiscoverySupported) .field("bClientDiscoverabilitySupported", &self.bClientDiscoverabilitySupported) .field("bInfrastructureManagementSupported", &self.bInfrastructureManagementSupported) .field("uMaxSecondaryDeviceTypeListSize", &self.uMaxSecondaryDeviceTypeListSize) .field("DeviceAddress", &self.DeviceAddress) .field("uInterfaceAddressListCount", &self.uInterfaceAddressListCount) .field("pInterfaceAddressList", &self.pInterfaceAddressList) .field("uNumSupportedCountryOrRegionStrings", &self.uNumSupportedCountryOrRegionStrings) .field("pSupportedCountryOrRegionStrings", &self.pSupportedCountryOrRegionStrings) .field("uDiscoveryFilterListSize", &self.uDiscoveryFilterListSize) .field("uGORoleClientTableSize", &self.uGORoleClientTableSize) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_WFD_ATTRIBUTES { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumConcurrentGORole == other.uNumConcurrentGORole && self.uNumConcurrentClientRole == other.uNumConcurrentClientRole && self.WPSVersionsSupported == other.WPSVersionsSupported && self.bServiceDiscoverySupported == other.bServiceDiscoverySupported && self.bClientDiscoverabilitySupported == other.bClientDiscoverabilitySupported && self.bInfrastructureManagementSupported == other.bInfrastructureManagementSupported && self.uMaxSecondaryDeviceTypeListSize == other.uMaxSecondaryDeviceTypeListSize && self.DeviceAddress == other.DeviceAddress && self.uInterfaceAddressListCount == other.uInterfaceAddressListCount && self.pInterfaceAddressList == other.pInterfaceAddressList && self.uNumSupportedCountryOrRegionStrings == other.uNumSupportedCountryOrRegionStrings && self.pSupportedCountryOrRegionStrings == other.pSupportedCountryOrRegionStrings && self.uDiscoveryFilterListSize == other.uDiscoveryFilterListSize && self.uGORoleClientTableSize == other.uGORoleClientTableSize } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_WFD_ATTRIBUTES {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_WFD_ATTRIBUTES { type Abi = Self; } pub const DOT11_WFD_ATTRIBUTES_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WFD_CHANNEL { pub CountryRegionString: [u8; 3], pub OperatingClass: u8, pub ChannelNumber: u8, } impl DOT11_WFD_CHANNEL {} impl ::core::default::Default for DOT11_WFD_CHANNEL { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_WFD_CHANNEL { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_CHANNEL").field("CountryRegionString", &self.CountryRegionString).field("OperatingClass", &self.OperatingClass).field("ChannelNumber", &self.ChannelNumber).finish() } } impl ::core::cmp::PartialEq for DOT11_WFD_CHANNEL { fn eq(&self, other: &Self) -> bool { self.CountryRegionString == other.CountryRegionString && self.OperatingClass == other.OperatingClass && self.ChannelNumber == other.ChannelNumber } } impl ::core::cmp::Eq for DOT11_WFD_CHANNEL {} unsafe impl ::windows::core::Abi for DOT11_WFD_CHANNEL { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WFD_CONFIGURATION_TIMEOUT { pub GOTimeout: u8, pub ClientTimeout: u8, } impl DOT11_WFD_CONFIGURATION_TIMEOUT {} impl ::core::default::Default for DOT11_WFD_CONFIGURATION_TIMEOUT { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_WFD_CONFIGURATION_TIMEOUT { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_CONFIGURATION_TIMEOUT").field("GOTimeout", &self.GOTimeout).field("ClientTimeout", &self.ClientTimeout).finish() } } impl ::core::cmp::PartialEq for DOT11_WFD_CONFIGURATION_TIMEOUT { fn eq(&self, other: &Self) -> bool { self.GOTimeout == other.GOTimeout && self.ClientTimeout == other.ClientTimeout } } impl ::core::cmp::Eq for DOT11_WFD_CONFIGURATION_TIMEOUT {} unsafe impl ::windows::core::Abi for DOT11_WFD_CONFIGURATION_TIMEOUT { type Abi = Self; } pub const DOT11_WFD_DEVICE_AUTO_AVAILABILITY: u32 = 16u32; pub const DOT11_WFD_DEVICE_CAPABILITY_CONCURRENT_OPERATION: u32 = 4u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_WFD_DEVICE_CAPABILITY_CONFIG { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub bServiceDiscoveryEnabled: super::super::Foundation::BOOLEAN, pub bClientDiscoverabilityEnabled: super::super::Foundation::BOOLEAN, pub bConcurrentOperationSupported: super::super::Foundation::BOOLEAN, pub bInfrastructureManagementEnabled: super::super::Foundation::BOOLEAN, pub bDeviceLimitReached: super::super::Foundation::BOOLEAN, pub bInvitationProcedureEnabled: super::super::Foundation::BOOLEAN, pub WPSVersionsEnabled: u32, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_WFD_DEVICE_CAPABILITY_CONFIG {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_WFD_DEVICE_CAPABILITY_CONFIG { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_WFD_DEVICE_CAPABILITY_CONFIG { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_DEVICE_CAPABILITY_CONFIG") .field("Header", &self.Header) .field("bServiceDiscoveryEnabled", &self.bServiceDiscoveryEnabled) .field("bClientDiscoverabilityEnabled", &self.bClientDiscoverabilityEnabled) .field("bConcurrentOperationSupported", &self.bConcurrentOperationSupported) .field("bInfrastructureManagementEnabled", &self.bInfrastructureManagementEnabled) .field("bDeviceLimitReached", &self.bDeviceLimitReached) .field("bInvitationProcedureEnabled", &self.bInvitationProcedureEnabled) .field("WPSVersionsEnabled", &self.WPSVersionsEnabled) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_WFD_DEVICE_CAPABILITY_CONFIG { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.bServiceDiscoveryEnabled == other.bServiceDiscoveryEnabled && self.bClientDiscoverabilityEnabled == other.bClientDiscoverabilityEnabled && self.bConcurrentOperationSupported == other.bConcurrentOperationSupported && self.bInfrastructureManagementEnabled == other.bInfrastructureManagementEnabled && self.bDeviceLimitReached == other.bDeviceLimitReached && self.bInvitationProcedureEnabled == other.bInvitationProcedureEnabled && self.WPSVersionsEnabled == other.WPSVersionsEnabled } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_WFD_DEVICE_CAPABILITY_CONFIG {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_WFD_DEVICE_CAPABILITY_CONFIG { type Abi = Self; } pub const DOT11_WFD_DEVICE_CAPABILITY_CONFIG_REVISION_1: u32 = 1u32; pub const DOT11_WFD_DEVICE_CAPABILITY_P2P_CLIENT_DISCOVERABILITY: u32 = 2u32; pub const DOT11_WFD_DEVICE_CAPABILITY_P2P_DEVICE_LIMIT: u32 = 16u32; pub const DOT11_WFD_DEVICE_CAPABILITY_P2P_INFRASTRUCTURE_MANAGED: u32 = 8u32; pub const DOT11_WFD_DEVICE_CAPABILITY_P2P_INVITATION_PROCEDURE: u32 = 32u32; pub const DOT11_WFD_DEVICE_CAPABILITY_RESERVED_6: u32 = 64u32; pub const DOT11_WFD_DEVICE_CAPABILITY_RESERVED_7: u32 = 128u32; pub const DOT11_WFD_DEVICE_CAPABILITY_SERVICE_DISCOVERY: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WFD_DEVICE_ENTRY { pub uPhyId: u32, pub PhySpecificInfo: DOT11_BSS_ENTRY_PHY_SPECIFIC_INFO, pub dot11BSSID: [u8; 6], pub dot11BSSType: DOT11_BSS_TYPE, pub TransmitterAddress: [u8; 6], pub lRSSI: i32, pub uLinkQuality: u32, pub usBeaconPeriod: u16, pub ullTimestamp: u64, pub ullBeaconHostTimestamp: u64, pub ullProbeResponseHostTimestamp: u64, pub usCapabilityInformation: u16, pub uBeaconIEsOffset: u32, pub uBeaconIEsLength: u32, pub uProbeResponseIEsOffset: u32, pub uProbeResponseIEsLength: u32, } impl DOT11_WFD_DEVICE_ENTRY {} impl ::core::default::Default for DOT11_WFD_DEVICE_ENTRY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for DOT11_WFD_DEVICE_ENTRY { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for DOT11_WFD_DEVICE_ENTRY {} unsafe impl ::windows::core::Abi for DOT11_WFD_DEVICE_ENTRY { type Abi = Self; } pub const DOT11_WFD_DEVICE_HIGH_AVAILABILITY: u32 = 24u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_WFD_DEVICE_INFO { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub DeviceAddress: [u8; 6], pub ConfigMethods: u16, pub PrimaryDeviceType: DOT11_WFD_DEVICE_TYPE, pub DeviceName: DOT11_WPS_DEVICE_NAME, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_WFD_DEVICE_INFO {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_WFD_DEVICE_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_WFD_DEVICE_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_DEVICE_INFO").field("Header", &self.Header).field("DeviceAddress", &self.DeviceAddress).field("ConfigMethods", &self.ConfigMethods).field("PrimaryDeviceType", &self.PrimaryDeviceType).field("DeviceName", &self.DeviceName).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_WFD_DEVICE_INFO { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.DeviceAddress == other.DeviceAddress && self.ConfigMethods == other.ConfigMethods && self.PrimaryDeviceType == other.PrimaryDeviceType && self.DeviceName == other.DeviceName } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_WFD_DEVICE_INFO {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_WFD_DEVICE_INFO { type Abi = Self; } pub const DOT11_WFD_DEVICE_INFO_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_WFD_DEVICE_LISTEN_CHANNEL { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub ChannelNumber: u8, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_WFD_DEVICE_LISTEN_CHANNEL {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_WFD_DEVICE_LISTEN_CHANNEL { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_WFD_DEVICE_LISTEN_CHANNEL { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_DEVICE_LISTEN_CHANNEL").field("Header", &self.Header).field("ChannelNumber", &self.ChannelNumber).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_WFD_DEVICE_LISTEN_CHANNEL { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.ChannelNumber == other.ChannelNumber } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_WFD_DEVICE_LISTEN_CHANNEL {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_WFD_DEVICE_LISTEN_CHANNEL { type Abi = Self; } pub const DOT11_WFD_DEVICE_LISTEN_CHANNEL_REVISION_1: u32 = 1u32; pub const DOT11_WFD_DEVICE_NOT_DISCOVERABLE: u32 = 0u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WFD_DEVICE_TYPE { pub CategoryID: u16, pub SubCategoryID: u16, pub OUI: [u8; 4], } impl DOT11_WFD_DEVICE_TYPE {} impl ::core::default::Default for DOT11_WFD_DEVICE_TYPE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_WFD_DEVICE_TYPE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_DEVICE_TYPE").field("CategoryID", &self.CategoryID).field("SubCategoryID", &self.SubCategoryID).field("OUI", &self.OUI).finish() } } impl ::core::cmp::PartialEq for DOT11_WFD_DEVICE_TYPE { fn eq(&self, other: &Self) -> bool { self.CategoryID == other.CategoryID && self.SubCategoryID == other.SubCategoryID && self.OUI == other.OUI } } impl ::core::cmp::Eq for DOT11_WFD_DEVICE_TYPE {} unsafe impl ::windows::core::Abi for DOT11_WFD_DEVICE_TYPE { type Abi = Self; } pub const DOT11_WFD_DISCOVER_COMPLETE_MAX_LIST_SIZE: u32 = 128u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_WFD_DISCOVER_COMPLETE_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub Status: i32, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub uListOffset: u32, pub uListLength: u32, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_WFD_DISCOVER_COMPLETE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_WFD_DISCOVER_COMPLETE_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_WFD_DISCOVER_COMPLETE_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_DISCOVER_COMPLETE_PARAMETERS") .field("Header", &self.Header) .field("Status", &self.Status) .field("uNumOfEntries", &self.uNumOfEntries) .field("uTotalNumOfEntries", &self.uTotalNumOfEntries) .field("uListOffset", &self.uListOffset) .field("uListLength", &self.uListLength) .finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_WFD_DISCOVER_COMPLETE_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Status == other.Status && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.uListOffset == other.uListOffset && self.uListLength == other.uListLength } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_WFD_DISCOVER_COMPLETE_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_WFD_DISCOVER_COMPLETE_PARAMETERS { type Abi = Self; } pub const DOT11_WFD_DISCOVER_COMPLETE_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WFD_DISCOVER_DEVICE_FILTER { pub DeviceID: [u8; 6], pub ucBitmask: u8, pub GroupSSID: DOT11_SSID, } impl DOT11_WFD_DISCOVER_DEVICE_FILTER {} impl ::core::default::Default for DOT11_WFD_DISCOVER_DEVICE_FILTER { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_WFD_DISCOVER_DEVICE_FILTER { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_DISCOVER_DEVICE_FILTER").field("DeviceID", &self.DeviceID).field("ucBitmask", &self.ucBitmask).field("GroupSSID", &self.GroupSSID).finish() } } impl ::core::cmp::PartialEq for DOT11_WFD_DISCOVER_DEVICE_FILTER { fn eq(&self, other: &Self) -> bool { self.DeviceID == other.DeviceID && self.ucBitmask == other.ucBitmask && self.GroupSSID == other.GroupSSID } } impl ::core::cmp::Eq for DOT11_WFD_DISCOVER_DEVICE_FILTER {} unsafe impl ::windows::core::Abi for DOT11_WFD_DISCOVER_DEVICE_FILTER { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_WFD_DISCOVER_REQUEST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub DiscoverType: DOT11_WFD_DISCOVER_TYPE, pub ScanType: DOT11_WFD_SCAN_TYPE, pub uDiscoverTimeout: u32, pub uDeviceFilterListOffset: u32, pub uNumDeviceFilters: u32, pub uIEsOffset: u32, pub uIEsLength: u32, pub bForceScanLegacyNetworks: super::super::Foundation::BOOLEAN, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_WFD_DISCOVER_REQUEST {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_WFD_DISCOVER_REQUEST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_WFD_DISCOVER_REQUEST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_DISCOVER_REQUEST") .field("Header", &self.Header) .field("DiscoverType", &self.DiscoverType) .field("ScanType", &self.ScanType) .field("uDiscoverTimeout", &self.uDiscoverTimeout) .field("uDeviceFilterListOffset", &self.uDeviceFilterListOffset) .field("uNumDeviceFilters", &self.uNumDeviceFilters) .field("uIEsOffset", &self.uIEsOffset) .field("uIEsLength", &self.uIEsLength) .field("bForceScanLegacyNetworks", &self.bForceScanLegacyNetworks) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_WFD_DISCOVER_REQUEST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.DiscoverType == other.DiscoverType && self.ScanType == other.ScanType && self.uDiscoverTimeout == other.uDiscoverTimeout && self.uDeviceFilterListOffset == other.uDeviceFilterListOffset && self.uNumDeviceFilters == other.uNumDeviceFilters && self.uIEsOffset == other.uIEsOffset && self.uIEsLength == other.uIEsLength && self.bForceScanLegacyNetworks == other.bForceScanLegacyNetworks } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_WFD_DISCOVER_REQUEST {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_WFD_DISCOVER_REQUEST { type Abi = Self; } pub const DOT11_WFD_DISCOVER_REQUEST_REVISION_1: u32 = 1u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DOT11_WFD_DISCOVER_TYPE(pub i32); pub const dot11_wfd_discover_type_scan_only: DOT11_WFD_DISCOVER_TYPE = DOT11_WFD_DISCOVER_TYPE(1i32); pub const dot11_wfd_discover_type_find_only: DOT11_WFD_DISCOVER_TYPE = DOT11_WFD_DISCOVER_TYPE(2i32); pub const dot11_wfd_discover_type_auto: DOT11_WFD_DISCOVER_TYPE = DOT11_WFD_DISCOVER_TYPE(3i32); pub const dot11_wfd_discover_type_scan_social_channels: DOT11_WFD_DISCOVER_TYPE = DOT11_WFD_DISCOVER_TYPE(4i32); pub const dot11_wfd_discover_type_forced: DOT11_WFD_DISCOVER_TYPE = DOT11_WFD_DISCOVER_TYPE(-2147483648i32); impl ::core::convert::From<i32> for DOT11_WFD_DISCOVER_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_WFD_DISCOVER_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WFD_GO_INTENT { pub _bitfield: u8, } impl DOT11_WFD_GO_INTENT {} impl ::core::default::Default for DOT11_WFD_GO_INTENT { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_WFD_GO_INTENT { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_GO_INTENT").field("_bitfield", &self._bitfield).finish() } } impl ::core::cmp::PartialEq for DOT11_WFD_GO_INTENT { fn eq(&self, other: &Self) -> bool { self._bitfield == other._bitfield } } impl ::core::cmp::Eq for DOT11_WFD_GO_INTENT {} unsafe impl ::windows::core::Abi for DOT11_WFD_GO_INTENT { type Abi = Self; } pub const DOT11_WFD_GROUP_CAPABILITY_CROSS_CONNECTION_SUPPORTED: u32 = 16u32; pub const DOT11_WFD_GROUP_CAPABILITY_EAPOL_KEY_IP_ADDRESS_ALLOCATION_SUPPORTED: u32 = 128u32; pub const DOT11_WFD_GROUP_CAPABILITY_GROUP_LIMIT_REACHED: u32 = 4u32; pub const DOT11_WFD_GROUP_CAPABILITY_GROUP_OWNER: u32 = 1u32; pub const DOT11_WFD_GROUP_CAPABILITY_INTRABSS_DISTRIBUTION_SUPPORTED: u32 = 8u32; pub const DOT11_WFD_GROUP_CAPABILITY_IN_GROUP_FORMATION: u32 = 64u32; pub const DOT11_WFD_GROUP_CAPABILITY_NONE: u32 = 0u32; pub const DOT11_WFD_GROUP_CAPABILITY_PERSISTENT_GROUP: u32 = 2u32; pub const DOT11_WFD_GROUP_CAPABILITY_PERSISTENT_RECONNECT_SUPPORTED: u32 = 32u32; pub const DOT11_WFD_GROUP_CAPABILITY_RESERVED_7: u32 = 128u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WFD_GROUP_ID { pub DeviceAddress: [u8; 6], pub SSID: DOT11_SSID, } impl DOT11_WFD_GROUP_ID {} impl ::core::default::Default for DOT11_WFD_GROUP_ID { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_WFD_GROUP_ID { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_GROUP_ID").field("DeviceAddress", &self.DeviceAddress).field("SSID", &self.SSID).finish() } } impl ::core::cmp::PartialEq for DOT11_WFD_GROUP_ID { fn eq(&self, other: &Self) -> bool { self.DeviceAddress == other.DeviceAddress && self.SSID == other.SSID } } impl ::core::cmp::Eq for DOT11_WFD_GROUP_ID {} unsafe impl ::windows::core::Abi for DOT11_WFD_GROUP_ID { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_WFD_GROUP_JOIN_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub GOOperatingChannel: DOT11_WFD_CHANNEL, pub GOConfigTime: u32, pub bInGroupFormation: super::super::Foundation::BOOLEAN, pub bWaitForWPSReady: super::super::Foundation::BOOLEAN, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_WFD_GROUP_JOIN_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_WFD_GROUP_JOIN_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_WFD_GROUP_JOIN_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_GROUP_JOIN_PARAMETERS").field("Header", &self.Header).field("GOOperatingChannel", &self.GOOperatingChannel).field("GOConfigTime", &self.GOConfigTime).field("bInGroupFormation", &self.bInGroupFormation).field("bWaitForWPSReady", &self.bWaitForWPSReady).finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_WFD_GROUP_JOIN_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.GOOperatingChannel == other.GOOperatingChannel && self.GOConfigTime == other.GOConfigTime && self.bInGroupFormation == other.bInGroupFormation && self.bWaitForWPSReady == other.bWaitForWPSReady } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_WFD_GROUP_JOIN_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_WFD_GROUP_JOIN_PARAMETERS { type Abi = Self; } pub const DOT11_WFD_GROUP_JOIN_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub bPersistentGroupEnabled: super::super::Foundation::BOOLEAN, pub bIntraBSSDistributionSupported: super::super::Foundation::BOOLEAN, pub bCrossConnectionSupported: super::super::Foundation::BOOLEAN, pub bPersistentReconnectSupported: super::super::Foundation::BOOLEAN, pub bGroupFormationEnabled: super::super::Foundation::BOOLEAN, pub uMaximumGroupLimit: u32, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG") .field("Header", &self.Header) .field("bPersistentGroupEnabled", &self.bPersistentGroupEnabled) .field("bIntraBSSDistributionSupported", &self.bIntraBSSDistributionSupported) .field("bCrossConnectionSupported", &self.bCrossConnectionSupported) .field("bPersistentReconnectSupported", &self.bPersistentReconnectSupported) .field("bGroupFormationEnabled", &self.bGroupFormationEnabled) .field("uMaximumGroupLimit", &self.uMaximumGroupLimit) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.bPersistentGroupEnabled == other.bPersistentGroupEnabled && self.bIntraBSSDistributionSupported == other.bIntraBSSDistributionSupported && self.bCrossConnectionSupported == other.bCrossConnectionSupported && self.bPersistentReconnectSupported == other.bPersistentReconnectSupported && self.bGroupFormationEnabled == other.bGroupFormationEnabled && self.uMaximumGroupLimit == other.uMaximumGroupLimit } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG { type Abi = Self; } pub const DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG_REVISION_1: u32 = 1u32; pub const DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG_REVISION_2: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG_V2 { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub bPersistentGroupEnabled: super::super::Foundation::BOOLEAN, pub bIntraBSSDistributionSupported: super::super::Foundation::BOOLEAN, pub bCrossConnectionSupported: super::super::Foundation::BOOLEAN, pub bPersistentReconnectSupported: super::super::Foundation::BOOLEAN, pub bGroupFormationEnabled: super::super::Foundation::BOOLEAN, pub uMaximumGroupLimit: u32, pub bEapolKeyIpAddressAllocationSupported: super::super::Foundation::BOOLEAN, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG_V2 {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG_V2 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG_V2 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG_V2") .field("Header", &self.Header) .field("bPersistentGroupEnabled", &self.bPersistentGroupEnabled) .field("bIntraBSSDistributionSupported", &self.bIntraBSSDistributionSupported) .field("bCrossConnectionSupported", &self.bCrossConnectionSupported) .field("bPersistentReconnectSupported", &self.bPersistentReconnectSupported) .field("bGroupFormationEnabled", &self.bGroupFormationEnabled) .field("uMaximumGroupLimit", &self.uMaximumGroupLimit) .field("bEapolKeyIpAddressAllocationSupported", &self.bEapolKeyIpAddressAllocationSupported) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG_V2 { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.bPersistentGroupEnabled == other.bPersistentGroupEnabled && self.bIntraBSSDistributionSupported == other.bIntraBSSDistributionSupported && self.bCrossConnectionSupported == other.bCrossConnectionSupported && self.bPersistentReconnectSupported == other.bPersistentReconnectSupported && self.bGroupFormationEnabled == other.bGroupFormationEnabled && self.uMaximumGroupLimit == other.uMaximumGroupLimit && self.bEapolKeyIpAddressAllocationSupported == other.bEapolKeyIpAddressAllocationSupported } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG_V2 {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for DOT11_WFD_GROUP_OWNER_CAPABILITY_CONFIG_V2 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_WFD_GROUP_START_PARAMETERS { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub AdvertisedOperatingChannel: DOT11_WFD_CHANNEL, } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_WFD_GROUP_START_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_WFD_GROUP_START_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_WFD_GROUP_START_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_GROUP_START_PARAMETERS").field("Header", &self.Header).field("AdvertisedOperatingChannel", &self.AdvertisedOperatingChannel).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_WFD_GROUP_START_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.AdvertisedOperatingChannel == other.AdvertisedOperatingChannel } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_WFD_GROUP_START_PARAMETERS {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_WFD_GROUP_START_PARAMETERS { type Abi = Self; } pub const DOT11_WFD_GROUP_START_PARAMETERS_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WFD_INVITATION_FLAGS { pub _bitfield: u8, } impl DOT11_WFD_INVITATION_FLAGS {} impl ::core::default::Default for DOT11_WFD_INVITATION_FLAGS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_WFD_INVITATION_FLAGS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_INVITATION_FLAGS").field("_bitfield", &self._bitfield).finish() } } impl ::core::cmp::PartialEq for DOT11_WFD_INVITATION_FLAGS { fn eq(&self, other: &Self) -> bool { self._bitfield == other._bitfield } } impl ::core::cmp::Eq for DOT11_WFD_INVITATION_FLAGS {} unsafe impl ::windows::core::Abi for DOT11_WFD_INVITATION_FLAGS { type Abi = Self; } pub const DOT11_WFD_MINOR_REASON_DISASSOCIATED_FROM_WLAN_CROSS_CONNECTION_POLICY: u32 = 1u32; pub const DOT11_WFD_MINOR_REASON_DISASSOCIATED_INFRASTRUCTURE_MANAGED_POLICY: u32 = 4u32; pub const DOT11_WFD_MINOR_REASON_DISASSOCIATED_NOT_MANAGED_INFRASTRUCTURE_CAPABLE: u32 = 2u32; pub const DOT11_WFD_MINOR_REASON_DISASSOCIATED_WFD_COEXISTENCE_POLICY: u32 = 3u32; pub const DOT11_WFD_MINOR_REASON_SUCCESS: u32 = 0u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DOT11_WFD_SCAN_TYPE(pub i32); pub const dot11_wfd_scan_type_active: DOT11_WFD_SCAN_TYPE = DOT11_WFD_SCAN_TYPE(1i32); pub const dot11_wfd_scan_type_passive: DOT11_WFD_SCAN_TYPE = DOT11_WFD_SCAN_TYPE(2i32); pub const dot11_wfd_scan_type_auto: DOT11_WFD_SCAN_TYPE = DOT11_WFD_SCAN_TYPE(3i32); impl ::core::convert::From<i32> for DOT11_WFD_SCAN_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_WFD_SCAN_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_NetworkManagement_Ndis")] pub struct DOT11_WFD_SECONDARY_DEVICE_TYPE_LIST { pub Header: super::Ndis::NDIS_OBJECT_HEADER, pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub SecondaryDeviceTypes: [DOT11_WFD_DEVICE_TYPE; 1], } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl DOT11_WFD_SECONDARY_DEVICE_TYPE_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::default::Default for DOT11_WFD_SECONDARY_DEVICE_TYPE_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::fmt::Debug for DOT11_WFD_SECONDARY_DEVICE_TYPE_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_SECONDARY_DEVICE_TYPE_LIST").field("Header", &self.Header).field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("SecondaryDeviceTypes", &self.SecondaryDeviceTypes).finish() } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::PartialEq for DOT11_WFD_SECONDARY_DEVICE_TYPE_LIST { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.SecondaryDeviceTypes == other.SecondaryDeviceTypes } } #[cfg(feature = "Win32_NetworkManagement_Ndis")] impl ::core::cmp::Eq for DOT11_WFD_SECONDARY_DEVICE_TYPE_LIST {} #[cfg(feature = "Win32_NetworkManagement_Ndis")] unsafe impl ::windows::core::Abi for DOT11_WFD_SECONDARY_DEVICE_TYPE_LIST { type Abi = Self; } pub const DOT11_WFD_SECONDARY_DEVICE_TYPE_LIST_REVISION_1: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WFD_SERVICE_HASH_LIST { pub ServiceHashCount: u16, pub ServiceHash: [u8; 6], } impl DOT11_WFD_SERVICE_HASH_LIST {} impl ::core::default::Default for DOT11_WFD_SERVICE_HASH_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_WFD_SERVICE_HASH_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_SERVICE_HASH_LIST").field("ServiceHashCount", &self.ServiceHashCount).field("ServiceHash", &self.ServiceHash).finish() } } impl ::core::cmp::PartialEq for DOT11_WFD_SERVICE_HASH_LIST { fn eq(&self, other: &Self) -> bool { self.ServiceHashCount == other.ServiceHashCount && self.ServiceHash == other.ServiceHash } } impl ::core::cmp::Eq for DOT11_WFD_SERVICE_HASH_LIST {} unsafe impl ::windows::core::Abi for DOT11_WFD_SERVICE_HASH_LIST { type Abi = Self; } pub const DOT11_WFD_SERVICE_INFORMATION_MAX_LENGTH: u32 = 65535u32; pub const DOT11_WFD_SERVICE_NAME_MAX_LENGTH: u32 = 255u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WFD_SESSION_ID { pub SessionID: u32, pub SessionAddress: [u8; 6], } impl DOT11_WFD_SESSION_ID {} impl ::core::default::Default for DOT11_WFD_SESSION_ID { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_WFD_SESSION_ID { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_SESSION_ID").field("SessionID", &self.SessionID).field("SessionAddress", &self.SessionAddress).finish() } } impl ::core::cmp::PartialEq for DOT11_WFD_SESSION_ID { fn eq(&self, other: &Self) -> bool { self.SessionID == other.SessionID && self.SessionAddress == other.SessionAddress } } impl ::core::cmp::Eq for DOT11_WFD_SESSION_ID {} unsafe impl ::windows::core::Abi for DOT11_WFD_SESSION_ID { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WFD_SESSION_INFO { pub uSessionInfoLength: u16, pub ucSessionInfo: [u8; 144], } impl DOT11_WFD_SESSION_INFO {} impl ::core::default::Default for DOT11_WFD_SESSION_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_WFD_SESSION_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WFD_SESSION_INFO").field("uSessionInfoLength", &self.uSessionInfoLength).field("ucSessionInfo", &self.ucSessionInfo).finish() } } impl ::core::cmp::PartialEq for DOT11_WFD_SESSION_INFO { fn eq(&self, other: &Self) -> bool { self.uSessionInfoLength == other.uSessionInfoLength && self.ucSessionInfo == other.ucSessionInfo } } impl ::core::cmp::Eq for DOT11_WFD_SESSION_INFO {} unsafe impl ::windows::core::Abi for DOT11_WFD_SESSION_INFO { type Abi = Self; } pub const DOT11_WFD_SESSION_INFO_MAX_LENGTH: u32 = 144u32; pub const DOT11_WFD_STATUS_FAILED_INCOMPATIBLE_PARAMETERS: u32 = 2u32; pub const DOT11_WFD_STATUS_FAILED_INCOMPATIBLE_PROVISIONING_METHOD: u32 = 10u32; pub const DOT11_WFD_STATUS_FAILED_INFORMATION_IS_UNAVAILABLE: u32 = 1u32; pub const DOT11_WFD_STATUS_FAILED_INVALID_PARAMETERS: u32 = 4u32; pub const DOT11_WFD_STATUS_FAILED_LIMIT_REACHED: u32 = 3u32; pub const DOT11_WFD_STATUS_FAILED_MATCHING_MAX_INTENT: u32 = 9u32; pub const DOT11_WFD_STATUS_FAILED_NO_COMMON_CHANNELS: u32 = 7u32; pub const DOT11_WFD_STATUS_FAILED_PREVIOUS_PROTOCOL_ERROR: u32 = 6u32; pub const DOT11_WFD_STATUS_FAILED_REJECTED_BY_USER: u32 = 11u32; pub const DOT11_WFD_STATUS_FAILED_UNABLE_TO_ACCOMODATE_REQUEST: u32 = 5u32; pub const DOT11_WFD_STATUS_FAILED_UNKNOWN_WFD_GROUP: u32 = 8u32; pub const DOT11_WFD_STATUS_SUCCESS: u32 = 0u32; pub const DOT11_WFD_STATUS_SUCCESS_ACCEPTED_BY_USER: u32 = 12u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WME_AC_PARAMETERS { pub ucAccessCategoryIndex: u8, pub ucAIFSN: u8, pub ucECWmin: u8, pub ucECWmax: u8, pub usTXOPLimit: u16, } impl DOT11_WME_AC_PARAMETERS {} impl ::core::default::Default for DOT11_WME_AC_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_WME_AC_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WME_AC_PARAMETERS").field("ucAccessCategoryIndex", &self.ucAccessCategoryIndex).field("ucAIFSN", &self.ucAIFSN).field("ucECWmin", &self.ucECWmin).field("ucECWmax", &self.ucECWmax).field("usTXOPLimit", &self.usTXOPLimit).finish() } } impl ::core::cmp::PartialEq for DOT11_WME_AC_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.ucAccessCategoryIndex == other.ucAccessCategoryIndex && self.ucAIFSN == other.ucAIFSN && self.ucECWmin == other.ucECWmin && self.ucECWmax == other.ucECWmax && self.usTXOPLimit == other.usTXOPLimit } } impl ::core::cmp::Eq for DOT11_WME_AC_PARAMETERS {} unsafe impl ::windows::core::Abi for DOT11_WME_AC_PARAMETERS { type Abi = Self; } pub const DOT11_WME_PACKET: u32 = 256u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WME_UPDATE_IE { pub uParamElemMinBeaconIntervals: u32, pub uWMEInfoElemOffset: u32, pub uWMEInfoElemLength: u32, pub uWMEParamElemOffset: u32, pub uWMEParamElemLength: u32, pub ucBuffer: [u8; 1], } impl DOT11_WME_UPDATE_IE {} impl ::core::default::Default for DOT11_WME_UPDATE_IE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_WME_UPDATE_IE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WME_UPDATE_IE") .field("uParamElemMinBeaconIntervals", &self.uParamElemMinBeaconIntervals) .field("uWMEInfoElemOffset", &self.uWMEInfoElemOffset) .field("uWMEInfoElemLength", &self.uWMEInfoElemLength) .field("uWMEParamElemOffset", &self.uWMEParamElemOffset) .field("uWMEParamElemLength", &self.uWMEParamElemLength) .field("ucBuffer", &self.ucBuffer) .finish() } } impl ::core::cmp::PartialEq for DOT11_WME_UPDATE_IE { fn eq(&self, other: &Self) -> bool { self.uParamElemMinBeaconIntervals == other.uParamElemMinBeaconIntervals && self.uWMEInfoElemOffset == other.uWMEInfoElemOffset && self.uWMEInfoElemLength == other.uWMEInfoElemLength && self.uWMEParamElemOffset == other.uWMEParamElemOffset && self.uWMEParamElemLength == other.uWMEParamElemLength && self.ucBuffer == other.ucBuffer } } impl ::core::cmp::Eq for DOT11_WME_UPDATE_IE {} unsafe impl ::windows::core::Abi for DOT11_WME_UPDATE_IE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DOT11_WPA_TSC { pub uReserved: u32, pub dot11OffloadType: DOT11_OFFLOAD_TYPE, pub hOffload: super::super::Foundation::HANDLE, pub dot11IV48Counter: DOT11_IV48_COUNTER, } #[cfg(feature = "Win32_Foundation")] impl DOT11_WPA_TSC {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DOT11_WPA_TSC { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DOT11_WPA_TSC { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WPA_TSC").field("uReserved", &self.uReserved).field("dot11OffloadType", &self.dot11OffloadType).field("hOffload", &self.hOffload).field("dot11IV48Counter", &self.dot11IV48Counter).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DOT11_WPA_TSC { fn eq(&self, other: &Self) -> bool { self.uReserved == other.uReserved && self.dot11OffloadType == other.dot11OffloadType && self.hOffload == other.hOffload && self.dot11IV48Counter == other.dot11IV48Counter } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DOT11_WPA_TSC {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DOT11_WPA_TSC { 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 DOT11_WPS_CONFIG_METHOD(pub i32); pub const DOT11_WPS_CONFIG_METHOD_NULL: DOT11_WPS_CONFIG_METHOD = DOT11_WPS_CONFIG_METHOD(0i32); pub const DOT11_WPS_CONFIG_METHOD_DISPLAY: DOT11_WPS_CONFIG_METHOD = DOT11_WPS_CONFIG_METHOD(8i32); pub const DOT11_WPS_CONFIG_METHOD_NFC_TAG: DOT11_WPS_CONFIG_METHOD = DOT11_WPS_CONFIG_METHOD(32i32); pub const DOT11_WPS_CONFIG_METHOD_NFC_INTERFACE: DOT11_WPS_CONFIG_METHOD = DOT11_WPS_CONFIG_METHOD(64i32); pub const DOT11_WPS_CONFIG_METHOD_PUSHBUTTON: DOT11_WPS_CONFIG_METHOD = DOT11_WPS_CONFIG_METHOD(128i32); pub const DOT11_WPS_CONFIG_METHOD_KEYPAD: DOT11_WPS_CONFIG_METHOD = DOT11_WPS_CONFIG_METHOD(256i32); pub const DOT11_WPS_CONFIG_METHOD_WFDS_DEFAULT: DOT11_WPS_CONFIG_METHOD = DOT11_WPS_CONFIG_METHOD(4096i32); impl ::core::convert::From<i32> for DOT11_WPS_CONFIG_METHOD { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_WPS_CONFIG_METHOD { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DOT11_WPS_DEVICE_NAME { pub uDeviceNameLength: u32, pub ucDeviceName: [u8; 32], } impl DOT11_WPS_DEVICE_NAME {} impl ::core::default::Default for DOT11_WPS_DEVICE_NAME { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DOT11_WPS_DEVICE_NAME { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DOT11_WPS_DEVICE_NAME").field("uDeviceNameLength", &self.uDeviceNameLength).field("ucDeviceName", &self.ucDeviceName).finish() } } impl ::core::cmp::PartialEq for DOT11_WPS_DEVICE_NAME { fn eq(&self, other: &Self) -> bool { self.uDeviceNameLength == other.uDeviceNameLength && self.ucDeviceName == other.ucDeviceName } } impl ::core::cmp::Eq for DOT11_WPS_DEVICE_NAME {} unsafe impl ::windows::core::Abi for DOT11_WPS_DEVICE_NAME { type Abi = Self; } pub const DOT11_WPS_DEVICE_NAME_MAX_LENGTH: u32 = 32u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DOT11_WPS_DEVICE_PASSWORD_ID(pub i32); pub const DOT11_WPS_PASSWORD_ID_DEFAULT: DOT11_WPS_DEVICE_PASSWORD_ID = DOT11_WPS_DEVICE_PASSWORD_ID(0i32); pub const DOT11_WPS_PASSWORD_ID_USER_SPECIFIED: DOT11_WPS_DEVICE_PASSWORD_ID = DOT11_WPS_DEVICE_PASSWORD_ID(1i32); pub const DOT11_WPS_PASSWORD_ID_MACHINE_SPECIFIED: DOT11_WPS_DEVICE_PASSWORD_ID = DOT11_WPS_DEVICE_PASSWORD_ID(2i32); pub const DOT11_WPS_PASSWORD_ID_REKEY: DOT11_WPS_DEVICE_PASSWORD_ID = DOT11_WPS_DEVICE_PASSWORD_ID(3i32); pub const DOT11_WPS_PASSWORD_ID_PUSHBUTTON: DOT11_WPS_DEVICE_PASSWORD_ID = DOT11_WPS_DEVICE_PASSWORD_ID(4i32); pub const DOT11_WPS_PASSWORD_ID_REGISTRAR_SPECIFIED: DOT11_WPS_DEVICE_PASSWORD_ID = DOT11_WPS_DEVICE_PASSWORD_ID(5i32); pub const DOT11_WPS_PASSWORD_ID_NFC_CONNECTION_HANDOVER: DOT11_WPS_DEVICE_PASSWORD_ID = DOT11_WPS_DEVICE_PASSWORD_ID(7i32); pub const DOT11_WPS_PASSWORD_ID_WFD_SERVICES: DOT11_WPS_DEVICE_PASSWORD_ID = DOT11_WPS_DEVICE_PASSWORD_ID(8i32); pub const DOT11_WPS_PASSWORD_ID_OOB_RANGE_MIN: DOT11_WPS_DEVICE_PASSWORD_ID = DOT11_WPS_DEVICE_PASSWORD_ID(16i32); pub const DOT11_WPS_PASSWORD_ID_OOB_RANGE_MAX: DOT11_WPS_DEVICE_PASSWORD_ID = DOT11_WPS_DEVICE_PASSWORD_ID(65535i32); impl ::core::convert::From<i32> for DOT11_WPS_DEVICE_PASSWORD_ID { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DOT11_WPS_DEVICE_PASSWORD_ID { type Abi = Self; } pub const DOT11_WPS_MAX_MODEL_NAME_LENGTH: u32 = 32u32; pub const DOT11_WPS_MAX_MODEL_NUMBER_LENGTH: u32 = 32u32; pub const DOT11_WPS_MAX_PASSKEY_LENGTH: u32 = 8u32; pub const DOT11_WPS_VERSION_1_0: u32 = 1u32; pub const DOT11_WPS_VERSION_2_0: u32 = 2u32; pub const DevProp_PciDevice_AcsCompatibleUpHierarchy_Enhanced: u32 = 4u32; pub const DevProp_PciDevice_AcsCompatibleUpHierarchy_NoP2PSupported: u32 = 2u32; pub const DevProp_PciDevice_AcsCompatibleUpHierarchy_NotSupported: u32 = 0u32; pub const DevProp_PciDevice_AcsCompatibleUpHierarchy_SingleFunctionSupported: u32 = 1u32; pub const DevProp_PciDevice_AcsCompatibleUpHierarchy_Supported: u32 = 3u32; pub const DevProp_PciDevice_AcsSupport_Missing: u32 = 2u32; pub const DevProp_PciDevice_AcsSupport_NotNeeded: u32 = 1u32; pub const DevProp_PciDevice_AcsSupport_Present: u32 = 0u32; pub const DevProp_PciDevice_BridgeType_PciConventional: u32 = 6u32; pub const DevProp_PciDevice_BridgeType_PciExpressDownstreamSwitchPort: u32 = 10u32; pub const DevProp_PciDevice_BridgeType_PciExpressEventCollector: u32 = 14u32; pub const DevProp_PciDevice_BridgeType_PciExpressRootPort: u32 = 8u32; pub const DevProp_PciDevice_BridgeType_PciExpressToPciXBridge: u32 = 11u32; pub const DevProp_PciDevice_BridgeType_PciExpressTreatedAsPci: u32 = 13u32; pub const DevProp_PciDevice_BridgeType_PciExpressUpstreamSwitchPort: u32 = 9u32; pub const DevProp_PciDevice_BridgeType_PciX: u32 = 7u32; pub const DevProp_PciDevice_BridgeType_PciXToExpressBridge: u32 = 12u32; pub const DevProp_PciDevice_CurrentSpeedAndMode_PciX_Mode1_100Mhz: u32 = 2u32; pub const DevProp_PciDevice_CurrentSpeedAndMode_PciX_Mode1_133MHZ: u32 = 3u32; pub const DevProp_PciDevice_CurrentSpeedAndMode_PciX_Mode1_66Mhz: u32 = 1u32; pub const DevProp_PciDevice_CurrentSpeedAndMode_PciX_Mode1_ECC_100Mhz: u32 = 6u32; pub const DevProp_PciDevice_CurrentSpeedAndMode_PciX_Mode1_ECC_133Mhz: u32 = 7u32; pub const DevProp_PciDevice_CurrentSpeedAndMode_PciX_Mode1_ECC_66Mhz: u32 = 5u32; pub const DevProp_PciDevice_CurrentSpeedAndMode_PciX_Mode2_266_100MHz: u32 = 10u32; pub const DevProp_PciDevice_CurrentSpeedAndMode_PciX_Mode2_266_133MHz: u32 = 11u32; pub const DevProp_PciDevice_CurrentSpeedAndMode_PciX_Mode2_266_66MHz: u32 = 9u32; pub const DevProp_PciDevice_CurrentSpeedAndMode_PciX_Mode2_533_100MHz: u32 = 14u32; pub const DevProp_PciDevice_CurrentSpeedAndMode_PciX_Mode2_533_133MHz: u32 = 15u32; pub const DevProp_PciDevice_CurrentSpeedAndMode_PciX_Mode2_533_66MHz: u32 = 13u32; pub const DevProp_PciDevice_CurrentSpeedAndMode_PciX_Mode_Conventional_Pci: u32 = 0u32; pub const DevProp_PciDevice_CurrentSpeedAndMode_Pci_Conventional_33MHz: u32 = 0u32; pub const DevProp_PciDevice_CurrentSpeedAndMode_Pci_Conventional_66MHz: u32 = 1u32; pub const DevProp_PciDevice_DeviceType_PciConventional: u32 = 0u32; pub const DevProp_PciDevice_DeviceType_PciExpressEndpoint: u32 = 2u32; pub const DevProp_PciDevice_DeviceType_PciExpressLegacyEndpoint: u32 = 3u32; pub const DevProp_PciDevice_DeviceType_PciExpressRootComplexIntegratedEndpoint: u32 = 4u32; pub const DevProp_PciDevice_DeviceType_PciExpressTreatedAsPci: u32 = 5u32; pub const DevProp_PciDevice_DeviceType_PciX: u32 = 1u32; pub const DevProp_PciDevice_InterruptType_LineBased: u32 = 1u32; pub const DevProp_PciDevice_InterruptType_Msi: u32 = 2u32; pub const DevProp_PciDevice_InterruptType_MsiX: u32 = 4u32; pub const DevProp_PciDevice_SriovSupport_DidntGetVfBarSpace: u32 = 4u32; pub const DevProp_PciDevice_SriovSupport_MissingAcs: u32 = 1u32; pub const DevProp_PciDevice_SriovSupport_MissingPfDriver: u32 = 2u32; pub const DevProp_PciDevice_SriovSupport_NoBusResource: u32 = 3u32; pub const DevProp_PciDevice_SriovSupport_Ok: u32 = 0u32; pub const DevProp_PciExpressDevice_LinkSpeed_Five_Gbps: u32 = 2u32; pub const DevProp_PciExpressDevice_LinkSpeed_TwoAndHalf_Gbps: u32 = 1u32; pub const DevProp_PciExpressDevice_LinkWidth_By_1: u32 = 1u32; pub const DevProp_PciExpressDevice_LinkWidth_By_12: u32 = 12u32; pub const DevProp_PciExpressDevice_LinkWidth_By_16: u32 = 16u32; pub const DevProp_PciExpressDevice_LinkWidth_By_2: u32 = 2u32; pub const DevProp_PciExpressDevice_LinkWidth_By_32: u32 = 32u32; pub const DevProp_PciExpressDevice_LinkWidth_By_4: u32 = 4u32; pub const DevProp_PciExpressDevice_LinkWidth_By_8: u32 = 8u32; pub const DevProp_PciExpressDevice_PayloadOrRequestSize_1024Bytes: u32 = 3u32; pub const DevProp_PciExpressDevice_PayloadOrRequestSize_128Bytes: u32 = 0u32; pub const DevProp_PciExpressDevice_PayloadOrRequestSize_2048Bytes: u32 = 4u32; pub const DevProp_PciExpressDevice_PayloadOrRequestSize_256Bytes: u32 = 1u32; pub const DevProp_PciExpressDevice_PayloadOrRequestSize_4096Bytes: u32 = 5u32; pub const DevProp_PciExpressDevice_PayloadOrRequestSize_512Bytes: u32 = 2u32; pub const DevProp_PciExpressDevice_Spec_Version_10: u32 = 1u32; pub const DevProp_PciExpressDevice_Spec_Version_11: u32 = 2u32; pub const DevProp_PciRootBus_BusWidth_32Bits: u32 = 0u32; pub const DevProp_PciRootBus_BusWidth_64Bits: u32 = 1u32; pub const DevProp_PciRootBus_CurrentSpeedAndMode_Pci_Conventional_33Mhz: u32 = 0u32; pub const DevProp_PciRootBus_CurrentSpeedAndMode_Pci_Conventional_66Mhz: u32 = 1u32; pub const DevProp_PciRootBus_CurrentSpeedAndMode_Pci_X_266_Mode2_100Mhz: u32 = 9u32; pub const DevProp_PciRootBus_CurrentSpeedAndMode_Pci_X_266_Mode2_133Mhz: u32 = 10u32; pub const DevProp_PciRootBus_CurrentSpeedAndMode_Pci_X_266_Mode2_66Mhz: u32 = 8u32; pub const DevProp_PciRootBus_CurrentSpeedAndMode_Pci_X_533_Mode2_100Mhz: u32 = 12u32; pub const DevProp_PciRootBus_CurrentSpeedAndMode_Pci_X_533_Mode2_133Mhz: u32 = 13u32; pub const DevProp_PciRootBus_CurrentSpeedAndMode_Pci_X_533_Mode2_66Mhz: u32 = 11u32; pub const DevProp_PciRootBus_CurrentSpeedAndMode_Pci_X_Mode1_100Mhz: u32 = 3u32; pub const DevProp_PciRootBus_CurrentSpeedAndMode_Pci_X_Mode1_133Mhz: u32 = 4u32; pub const DevProp_PciRootBus_CurrentSpeedAndMode_Pci_X_Mode1_66Mhz: u32 = 2u32; pub const DevProp_PciRootBus_CurrentSpeedAndMode_Pci_X_Mode1_ECC_100Mhz: u32 = 6u32; pub const DevProp_PciRootBus_CurrentSpeedAndMode_Pci_X_Mode1_ECC_133Mhz: u32 = 7u32; pub const DevProp_PciRootBus_CurrentSpeedAndMode_Pci_X_Mode1_ECC_66Mhz: u32 = 5u32; pub const DevProp_PciRootBus_SecondaryInterface_PciConventional: u32 = 0u32; pub const DevProp_PciRootBus_SecondaryInterface_PciExpress: u32 = 3u32; pub const DevProp_PciRootBus_SecondaryInterface_PciXMode1: u32 = 1u32; pub const DevProp_PciRootBus_SecondaryInterface_PciXMode2: u32 = 2u32; pub const DevProp_PciRootBus_SupportedSpeedsAndModes_Pci_Conventional_33Mhz: u32 = 1u32; pub const DevProp_PciRootBus_SupportedSpeedsAndModes_Pci_Conventional_66Mhz: u32 = 2u32; pub const DevProp_PciRootBus_SupportedSpeedsAndModes_Pci_X_133Mhz: u32 = 8u32; pub const DevProp_PciRootBus_SupportedSpeedsAndModes_Pci_X_266Mhz: u32 = 16u32; pub const DevProp_PciRootBus_SupportedSpeedsAndModes_Pci_X_533Mhz: u32 = 32u32; pub const DevProp_PciRootBus_SupportedSpeedsAndModes_Pci_X_66Mhz: u32 = 4u32; pub const Dot11AdHocManager: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xdd06a84f_83bd_4d01_8ab9_2389fea0869e); pub const GUID_AEPSERVICE_WIFIDIRECT_DEVICE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcc29827c_9caf_4928_99a9_18f7c2381389); pub const GUID_DEVINTERFACE_ASP_INFRA_DEVICE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xff823995_7a72_4c80_8757_c67ee13d1a49); pub const GUID_DEVINTERFACE_WIFIDIRECT_DEVICE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x439b20af_8955_405b_99f0_a62af0c68d43); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IDot11AdHocInterface(pub ::windows::core::IUnknown); impl IDot11AdHocInterface { pub unsafe fn GetDeviceSignature(&self, psignature: *mut ::windows::core::GUID) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(psignature)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetFriendlyName(&self) -> ::windows::core::Result<super::super::Foundation::PWSTR> { let mut result__: <super::super::Foundation::PWSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__) } pub unsafe fn IsDot11d(&self, pf11d: *mut u8) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(pf11d)).ok() } pub unsafe fn IsAdHocCapable(&self, pfadhoccapable: *mut u8) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(pfadhoccapable)).ok() } pub unsafe fn IsRadioOn(&self, pfisradioon: *mut u8) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(pfisradioon)).ok() } pub unsafe fn GetActiveNetwork(&self) -> ::windows::core::Result<IDot11AdHocNetwork> { let mut result__: <IDot11AdHocNetwork as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IDot11AdHocNetwork>(result__) } pub unsafe fn GetIEnumSecuritySettings(&self) -> ::windows::core::Result<IEnumDot11AdHocSecuritySettings> { let mut result__: <IEnumDot11AdHocSecuritySettings as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IEnumDot11AdHocSecuritySettings>(result__) } pub unsafe fn GetIEnumDot11AdHocNetworks(&self, pfilterguid: *const ::windows::core::GUID) -> ::windows::core::Result<IEnumDot11AdHocNetworks> { let mut result__: <IEnumDot11AdHocNetworks as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(pfilterguid), &mut result__).from_abi::<IEnumDot11AdHocNetworks>(result__) } pub unsafe fn GetStatus(&self, pstate: *mut DOT11_ADHOC_NETWORK_CONNECTION_STATUS) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(pstate)).ok() } } unsafe impl ::windows::core::Interface for IDot11AdHocInterface { type Vtable = IDot11AdHocInterface_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8f10cc2b_cf0d_42a0_acbe_e2de7007384d); } impl ::core::convert::From<IDot11AdHocInterface> for ::windows::core::IUnknown { fn from(value: IDot11AdHocInterface) -> Self { value.0 } } impl ::core::convert::From<&IDot11AdHocInterface> for ::windows::core::IUnknown { fn from(value: &IDot11AdHocInterface) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IDot11AdHocInterface { 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 IDot11AdHocInterface { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IDot11AdHocInterface_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, psignature: *mut ::windows::core::GUID) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppszname: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pf11d: *mut u8) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfadhoccapable: *mut u8) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfisradioon: *mut u8) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppnetwork: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfilterguid: *const ::windows::core::GUID, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pstate: *mut DOT11_ADHOC_NETWORK_CONNECTION_STATUS) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IDot11AdHocInterfaceNotificationSink(pub ::windows::core::IUnknown); impl IDot11AdHocInterfaceNotificationSink { pub unsafe fn OnConnectionStatusChange(&self, estatus: DOT11_ADHOC_NETWORK_CONNECTION_STATUS) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(estatus)).ok() } } unsafe impl ::windows::core::Interface for IDot11AdHocInterfaceNotificationSink { type Vtable = IDot11AdHocInterfaceNotificationSink_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8f10cc2f_cf0d_42a0_acbe_e2de7007384d); } impl ::core::convert::From<IDot11AdHocInterfaceNotificationSink> for ::windows::core::IUnknown { fn from(value: IDot11AdHocInterfaceNotificationSink) -> Self { value.0 } } impl ::core::convert::From<&IDot11AdHocInterfaceNotificationSink> for ::windows::core::IUnknown { fn from(value: &IDot11AdHocInterfaceNotificationSink) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IDot11AdHocInterfaceNotificationSink { 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 IDot11AdHocInterfaceNotificationSink { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IDot11AdHocInterfaceNotificationSink_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, estatus: DOT11_ADHOC_NETWORK_CONNECTION_STATUS) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IDot11AdHocManager(pub ::windows::core::IUnknown); impl IDot11AdHocManager { #[cfg(feature = "Win32_Foundation")] pub unsafe fn CreateNetwork<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, IDot11AdHocInterface>, Param4: ::windows::core::IntoParam<'a, IDot11AdHocSecuritySettings>>( &self, name: Param0, password: Param1, geographicalid: i32, pinterface: Param3, psecurity: Param4, pcontextguid: *const ::windows::core::GUID, ) -> ::windows::core::Result<IDot11AdHocNetwork> { let mut result__: <IDot11AdHocNetwork as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), name.into_param().abi(), password.into_param().abi(), ::core::mem::transmute(geographicalid), pinterface.into_param().abi(), psecurity.into_param().abi(), ::core::mem::transmute(pcontextguid), &mut result__).from_abi::<IDot11AdHocNetwork>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn CommitCreatedNetwork<'a, Param0: ::windows::core::IntoParam<'a, IDot11AdHocNetwork>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOLEAN>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BOOLEAN>>(&self, piadhoc: Param0, fsaveprofile: Param1, fmakesavedprofileuserspecific: Param2) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), piadhoc.into_param().abi(), fsaveprofile.into_param().abi(), fmakesavedprofileuserspecific.into_param().abi()).ok() } pub unsafe fn GetIEnumDot11AdHocNetworks(&self, pcontextguid: *const ::windows::core::GUID) -> ::windows::core::Result<IEnumDot11AdHocNetworks> { let mut result__: <IEnumDot11AdHocNetworks as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(pcontextguid), &mut result__).from_abi::<IEnumDot11AdHocNetworks>(result__) } pub unsafe fn GetIEnumDot11AdHocInterfaces(&self) -> ::windows::core::Result<IEnumDot11AdHocInterfaces> { let mut result__: <IEnumDot11AdHocInterfaces as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IEnumDot11AdHocInterfaces>(result__) } pub unsafe fn GetNetwork(&self, networksignature: *const ::windows::core::GUID) -> ::windows::core::Result<IDot11AdHocNetwork> { let mut result__: <IDot11AdHocNetwork as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(networksignature), &mut result__).from_abi::<IDot11AdHocNetwork>(result__) } } unsafe impl ::windows::core::Interface for IDot11AdHocManager { type Vtable = IDot11AdHocManager_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8f10cc26_cf0d_42a0_acbe_e2de7007384d); } impl ::core::convert::From<IDot11AdHocManager> for ::windows::core::IUnknown { fn from(value: IDot11AdHocManager) -> Self { value.0 } } impl ::core::convert::From<&IDot11AdHocManager> for ::windows::core::IUnknown { fn from(value: &IDot11AdHocManager) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IDot11AdHocManager { 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 IDot11AdHocManager { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IDot11AdHocManager_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, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, name: super::super::Foundation::PWSTR, password: super::super::Foundation::PWSTR, geographicalid: i32, pinterface: ::windows::core::RawPtr, psecurity: ::windows::core::RawPtr, pcontextguid: *const ::windows::core::GUID, piadhoc: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, piadhoc: ::windows::core::RawPtr, fsaveprofile: super::super::Foundation::BOOLEAN, fmakesavedprofileuserspecific: super::super::Foundation::BOOLEAN) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcontextguid: *const ::windows::core::GUID, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, networksignature: *const ::windows::core::GUID, pnetwork: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IDot11AdHocManagerNotificationSink(pub ::windows::core::IUnknown); impl IDot11AdHocManagerNotificationSink { pub unsafe fn OnNetworkAdd<'a, Param0: ::windows::core::IntoParam<'a, IDot11AdHocNetwork>>(&self, piadhocnetwork: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), piadhocnetwork.into_param().abi()).ok() } pub unsafe fn OnNetworkRemove(&self, signature: *const ::windows::core::GUID) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(signature)).ok() } pub unsafe fn OnInterfaceAdd<'a, Param0: ::windows::core::IntoParam<'a, IDot11AdHocInterface>>(&self, piadhocinterface: Param0) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), piadhocinterface.into_param().abi()).ok() } pub unsafe fn OnInterfaceRemove(&self, signature: *const ::windows::core::GUID) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(signature)).ok() } } unsafe impl ::windows::core::Interface for IDot11AdHocManagerNotificationSink { type Vtable = IDot11AdHocManagerNotificationSink_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8f10cc27_cf0d_42a0_acbe_e2de7007384d); } impl ::core::convert::From<IDot11AdHocManagerNotificationSink> for ::windows::core::IUnknown { fn from(value: IDot11AdHocManagerNotificationSink) -> Self { value.0 } } impl ::core::convert::From<&IDot11AdHocManagerNotificationSink> for ::windows::core::IUnknown { fn from(value: &IDot11AdHocManagerNotificationSink) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IDot11AdHocManagerNotificationSink { 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 IDot11AdHocManagerNotificationSink { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IDot11AdHocManagerNotificationSink_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, piadhocnetwork: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, signature: *const ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, piadhocinterface: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, signature: *const ::windows::core::GUID) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IDot11AdHocNetwork(pub ::windows::core::IUnknown); impl IDot11AdHocNetwork { pub unsafe fn GetStatus(&self, estatus: *mut DOT11_ADHOC_NETWORK_CONNECTION_STATUS) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(estatus)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetSSID(&self) -> ::windows::core::Result<super::super::Foundation::PWSTR> { let mut result__: <super::super::Foundation::PWSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__) } pub unsafe fn HasProfile(&self, pf11d: *mut u8) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(pf11d)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetProfileName(&self) -> ::windows::core::Result<super::super::Foundation::PWSTR> { let mut result__: <super::super::Foundation::PWSTR as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__) } pub unsafe fn DeleteProfile(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn GetSignalQuality(&self, pustrengthvalue: *mut u32, pustrengthmax: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(pustrengthvalue), ::core::mem::transmute(pustrengthmax)).ok() } pub unsafe fn GetSecuritySetting(&self) -> ::windows::core::Result<IDot11AdHocSecuritySettings> { let mut result__: <IDot11AdHocSecuritySettings as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IDot11AdHocSecuritySettings>(result__) } pub unsafe fn GetContextGuid(&self, pcontextguid: *mut ::windows::core::GUID) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(pcontextguid)).ok() } pub unsafe fn GetSignature(&self, psignature: *mut ::windows::core::GUID) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(psignature)).ok() } pub unsafe fn GetInterface(&self) -> ::windows::core::Result<IDot11AdHocInterface> { let mut result__: <IDot11AdHocInterface as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IDot11AdHocInterface>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Connect<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BOOLEAN>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BOOLEAN>>(&self, passphrase: Param0, geographicalid: i32, fsaveprofile: Param2, fmakesavedprofileuserspecific: Param3) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).13)(::core::mem::transmute_copy(self), passphrase.into_param().abi(), ::core::mem::transmute(geographicalid), fsaveprofile.into_param().abi(), fmakesavedprofileuserspecific.into_param().abi()).ok() } pub unsafe fn Disconnect(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self)).ok() } } unsafe impl ::windows::core::Interface for IDot11AdHocNetwork { type Vtable = IDot11AdHocNetwork_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8f10cc29_cf0d_42a0_acbe_e2de7007384d); } impl ::core::convert::From<IDot11AdHocNetwork> for ::windows::core::IUnknown { fn from(value: IDot11AdHocNetwork) -> Self { value.0 } } impl ::core::convert::From<&IDot11AdHocNetwork> for ::windows::core::IUnknown { fn from(value: &IDot11AdHocNetwork) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IDot11AdHocNetwork { 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 IDot11AdHocNetwork { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IDot11AdHocNetwork_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, estatus: *mut DOT11_ADHOC_NETWORK_CONNECTION_STATUS) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppszwssid: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pf11d: *mut u8) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppszwprofilename: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pustrengthvalue: *mut u32, pustrengthmax: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, padhocsecuritysetting: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcontextguid: *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, psignature: *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, padhocinterface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, passphrase: super::super::Foundation::PWSTR, geographicalid: i32, fsaveprofile: super::super::Foundation::BOOLEAN, fmakesavedprofileuserspecific: super::super::Foundation::BOOLEAN) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, 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 IDot11AdHocNetworkNotificationSink(pub ::windows::core::IUnknown); impl IDot11AdHocNetworkNotificationSink { pub unsafe fn OnStatusChange(&self, estatus: DOT11_ADHOC_NETWORK_CONNECTION_STATUS) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(estatus)).ok() } pub unsafe fn OnConnectFail(&self, efailreason: DOT11_ADHOC_CONNECT_FAIL_REASON) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(efailreason)).ok() } } unsafe impl ::windows::core::Interface for IDot11AdHocNetworkNotificationSink { type Vtable = IDot11AdHocNetworkNotificationSink_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8f10cc2a_cf0d_42a0_acbe_e2de7007384d); } impl ::core::convert::From<IDot11AdHocNetworkNotificationSink> for ::windows::core::IUnknown { fn from(value: IDot11AdHocNetworkNotificationSink) -> Self { value.0 } } impl ::core::convert::From<&IDot11AdHocNetworkNotificationSink> for ::windows::core::IUnknown { fn from(value: &IDot11AdHocNetworkNotificationSink) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IDot11AdHocNetworkNotificationSink { 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 IDot11AdHocNetworkNotificationSink { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IDot11AdHocNetworkNotificationSink_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, estatus: DOT11_ADHOC_NETWORK_CONNECTION_STATUS) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, efailreason: DOT11_ADHOC_CONNECT_FAIL_REASON) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IDot11AdHocSecuritySettings(pub ::windows::core::IUnknown); impl IDot11AdHocSecuritySettings { pub unsafe fn GetDot11AuthAlgorithm(&self, pauth: *mut DOT11_ADHOC_AUTH_ALGORITHM) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(pauth)).ok() } pub unsafe fn GetDot11CipherAlgorithm(&self, pcipher: *mut DOT11_ADHOC_CIPHER_ALGORITHM) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(pcipher)).ok() } } unsafe impl ::windows::core::Interface for IDot11AdHocSecuritySettings { type Vtable = IDot11AdHocSecuritySettings_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8f10cc2e_cf0d_42a0_acbe_e2de7007384d); } impl ::core::convert::From<IDot11AdHocSecuritySettings> for ::windows::core::IUnknown { fn from(value: IDot11AdHocSecuritySettings) -> Self { value.0 } } impl ::core::convert::From<&IDot11AdHocSecuritySettings> for ::windows::core::IUnknown { fn from(value: &IDot11AdHocSecuritySettings) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IDot11AdHocSecuritySettings { 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 IDot11AdHocSecuritySettings { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IDot11AdHocSecuritySettings_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, pauth: *mut DOT11_ADHOC_AUTH_ALGORITHM) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pcipher: *mut DOT11_ADHOC_CIPHER_ALGORITHM) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IEnumDot11AdHocInterfaces(pub ::windows::core::IUnknown); impl IEnumDot11AdHocInterfaces { pub unsafe fn Next(&self, celt: u32, rgelt: *mut ::core::option::Option<IDot11AdHocInterface>, pceltfetched: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt), ::core::mem::transmute(rgelt), ::core::mem::transmute(pceltfetched)).ok() } pub unsafe fn Skip(&self, celt: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt)).ok() } pub unsafe fn Reset(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Clone(&self) -> ::windows::core::Result<IEnumDot11AdHocInterfaces> { let mut result__: <IEnumDot11AdHocInterfaces as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IEnumDot11AdHocInterfaces>(result__) } } unsafe impl ::windows::core::Interface for IEnumDot11AdHocInterfaces { type Vtable = IEnumDot11AdHocInterfaces_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8f10cc2c_cf0d_42a0_acbe_e2de7007384d); } impl ::core::convert::From<IEnumDot11AdHocInterfaces> for ::windows::core::IUnknown { fn from(value: IEnumDot11AdHocInterfaces) -> Self { value.0 } } impl ::core::convert::From<&IEnumDot11AdHocInterfaces> for ::windows::core::IUnknown { fn from(value: &IEnumDot11AdHocInterfaces) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IEnumDot11AdHocInterfaces { 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 IEnumDot11AdHocInterfaces { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IEnumDot11AdHocInterfaces_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, celt: u32, rgelt: *mut ::windows::core::RawPtr, pceltfetched: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IEnumDot11AdHocNetworks(pub ::windows::core::IUnknown); impl IEnumDot11AdHocNetworks { pub unsafe fn Next(&self, celt: u32, rgelt: *mut ::core::option::Option<IDot11AdHocNetwork>, pceltfetched: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt), ::core::mem::transmute(rgelt), ::core::mem::transmute(pceltfetched)).ok() } pub unsafe fn Skip(&self, celt: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt)).ok() } pub unsafe fn Reset(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Clone(&self) -> ::windows::core::Result<IEnumDot11AdHocNetworks> { let mut result__: <IEnumDot11AdHocNetworks as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IEnumDot11AdHocNetworks>(result__) } } unsafe impl ::windows::core::Interface for IEnumDot11AdHocNetworks { type Vtable = IEnumDot11AdHocNetworks_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8f10cc28_cf0d_42a0_acbe_e2de7007384d); } impl ::core::convert::From<IEnumDot11AdHocNetworks> for ::windows::core::IUnknown { fn from(value: IEnumDot11AdHocNetworks) -> Self { value.0 } } impl ::core::convert::From<&IEnumDot11AdHocNetworks> for ::windows::core::IUnknown { fn from(value: &IEnumDot11AdHocNetworks) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IEnumDot11AdHocNetworks { 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 IEnumDot11AdHocNetworks { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IEnumDot11AdHocNetworks_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, celt: u32, rgelt: *mut ::windows::core::RawPtr, pceltfetched: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IEnumDot11AdHocSecuritySettings(pub ::windows::core::IUnknown); impl IEnumDot11AdHocSecuritySettings { pub unsafe fn Next(&self, celt: u32, rgelt: *mut ::core::option::Option<IDot11AdHocSecuritySettings>, pceltfetched: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt), ::core::mem::transmute(rgelt), ::core::mem::transmute(pceltfetched)).ok() } pub unsafe fn Skip(&self, celt: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(celt)).ok() } pub unsafe fn Reset(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Clone(&self) -> ::windows::core::Result<IEnumDot11AdHocSecuritySettings> { let mut result__: <IEnumDot11AdHocSecuritySettings as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IEnumDot11AdHocSecuritySettings>(result__) } } unsafe impl ::windows::core::Interface for IEnumDot11AdHocSecuritySettings { type Vtable = IEnumDot11AdHocSecuritySettings_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8f10cc2d_cf0d_42a0_acbe_e2de7007384d); } impl ::core::convert::From<IEnumDot11AdHocSecuritySettings> for ::windows::core::IUnknown { fn from(value: IEnumDot11AdHocSecuritySettings) -> Self { value.0 } } impl ::core::convert::From<&IEnumDot11AdHocSecuritySettings> for ::windows::core::IUnknown { fn from(value: &IEnumDot11AdHocSecuritySettings) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IEnumDot11AdHocSecuritySettings { 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 IEnumDot11AdHocSecuritySettings { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IEnumDot11AdHocSecuritySettings_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, celt: u32, rgelt: *mut ::windows::core::RawPtr, pceltfetched: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, celt: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppenum: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); pub const L2_NOTIFICATION_CODE_GROUP_SIZE: u32 = 4096u32; pub const L2_NOTIFICATION_CODE_PUBLIC_BEGIN: u32 = 0u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct L2_NOTIFICATION_DATA { pub NotificationSource: u32, pub NotificationCode: u32, pub InterfaceGuid: ::windows::core::GUID, pub dwDataSize: u32, pub pData: *mut ::core::ffi::c_void, } impl L2_NOTIFICATION_DATA {} impl ::core::default::Default for L2_NOTIFICATION_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for L2_NOTIFICATION_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("L2_NOTIFICATION_DATA").field("NotificationSource", &self.NotificationSource).field("NotificationCode", &self.NotificationCode).field("InterfaceGuid", &self.InterfaceGuid).field("dwDataSize", &self.dwDataSize).field("pData", &self.pData).finish() } } impl ::core::cmp::PartialEq for L2_NOTIFICATION_DATA { fn eq(&self, other: &Self) -> bool { self.NotificationSource == other.NotificationSource && self.NotificationCode == other.NotificationCode && self.InterfaceGuid == other.InterfaceGuid && self.dwDataSize == other.dwDataSize && self.pData == other.pData } } impl ::core::cmp::Eq for L2_NOTIFICATION_DATA {} unsafe impl ::windows::core::Abi for L2_NOTIFICATION_DATA { type Abi = Self; } pub const L2_NOTIFICATION_SOURCE_ALL: u32 = 65535u32; pub const L2_NOTIFICATION_SOURCE_DOT3_AUTO_CONFIG: u32 = 1u32; pub const L2_NOTIFICATION_SOURCE_NONE: u32 = 0u32; pub const L2_NOTIFICATION_SOURCE_ONEX: u32 = 4u32; pub const L2_NOTIFICATION_SOURCE_SECURITY: u32 = 2u32; pub const L2_NOTIFICATION_SOURCE_WCM: u32 = 256u32; pub const L2_NOTIFICATION_SOURCE_WCM_CSP: u32 = 512u32; pub const L2_NOTIFICATION_SOURCE_WFD: u32 = 1024u32; pub const L2_NOTIFICATION_SOURCE_WLAN_ACM: u32 = 8u32; pub const L2_NOTIFICATION_SOURCE_WLAN_DEVICE_SERVICE: u32 = 2048u32; pub const L2_NOTIFICATION_SOURCE_WLAN_HNWK: u32 = 128u32; pub const L2_NOTIFICATION_SOURCE_WLAN_IHV: u32 = 64u32; pub const L2_NOTIFICATION_SOURCE_WLAN_MSM: u32 = 16u32; pub const L2_NOTIFICATION_SOURCE_WLAN_SECURITY: u32 = 32u32; pub const L2_PROFILE_MAX_NAME_LENGTH: u32 = 256u32; pub const L2_REASON_CODE_DOT11_AC_BASE: u32 = 131072u32; pub const L2_REASON_CODE_DOT11_MSM_BASE: u32 = 196608u32; pub const L2_REASON_CODE_DOT11_SECURITY_BASE: u32 = 262144u32; pub const L2_REASON_CODE_DOT3_AC_BASE: u32 = 393216u32; pub const L2_REASON_CODE_DOT3_MSM_BASE: u32 = 458752u32; pub const L2_REASON_CODE_GEN_BASE: u32 = 65536u32; pub const L2_REASON_CODE_GROUP_SIZE: u32 = 65536u32; pub const L2_REASON_CODE_IHV_BASE: u32 = 589824u32; pub const L2_REASON_CODE_ONEX_BASE: u32 = 327680u32; pub const L2_REASON_CODE_PROFILE_BASE: u32 = 524288u32; pub const L2_REASON_CODE_PROFILE_MISSING: u32 = 1u32; pub const L2_REASON_CODE_RESERVED_BASE: u32 = 720896u32; pub const L2_REASON_CODE_SUCCESS: u32 = 0u32; pub const L2_REASON_CODE_UNKNOWN: u32 = 65537u32; pub const L2_REASON_CODE_WIMAX_BASE: u32 = 655360u32; pub const MAX_NUM_SUPPORTED_RATES: u32 = 8u32; pub const MAX_NUM_SUPPORTED_RATES_V2: u32 = 255u32; pub const NDIS_PACKET_TYPE_802_11_ALL_MULTICAST_DATA: u32 = 4u32; pub const NDIS_PACKET_TYPE_802_11_BROADCAST_DATA: u32 = 8u32; pub const NDIS_PACKET_TYPE_802_11_DIRECTED_DATA: u32 = 1u32; pub const NDIS_PACKET_TYPE_802_11_MULTICAST_DATA: u32 = 2u32; pub const NDIS_PACKET_TYPE_802_11_PROMISCUOUS_DATA: u32 = 32u32; pub const OID_DOT11_AP_JOIN_REQUEST: u32 = 218170205u32; pub const OID_DOT11_ATIM_WINDOW: u32 = 218170122u32; pub const OID_DOT11_BEACON_PERIOD: u32 = 218170139u32; pub const OID_DOT11_CCA_MODE_SUPPORTED: u32 = 218170166u32; pub const OID_DOT11_CCA_WATCHDOG_COUNT_MAX: u32 = 218170170u32; pub const OID_DOT11_CCA_WATCHDOG_COUNT_MIN: u32 = 218170172u32; pub const OID_DOT11_CCA_WATCHDOG_TIMER_MAX: u32 = 218170169u32; pub const OID_DOT11_CCA_WATCHDOG_TIMER_MIN: u32 = 218170171u32; pub const OID_DOT11_CFP_MAX_DURATION: u32 = 218170136u32; pub const OID_DOT11_CFP_PERIOD: u32 = 218170135u32; pub const OID_DOT11_CF_POLLABLE: u32 = 218170134u32; pub const OID_DOT11_CHANNEL_AGILITY_ENABLED: u32 = 218170184u32; pub const OID_DOT11_CHANNEL_AGILITY_PRESENT: u32 = 218170183u32; pub const OID_DOT11_COUNTERS_ENTRY: u32 = 218170149u32; pub const OID_DOT11_COUNTRY_STRING: u32 = 218170188u32; pub const OID_DOT11_CURRENT_ADDRESS: u32 = 218171138u32; pub const OID_DOT11_CURRENT_CCA_MODE: u32 = 218170167u32; pub const OID_DOT11_CURRENT_CHANNEL: u32 = 218170165u32; pub const OID_DOT11_CURRENT_CHANNEL_NUMBER: u32 = 218170159u32; pub const OID_DOT11_CURRENT_DWELL_TIME: u32 = 218170161u32; pub const OID_DOT11_CURRENT_FREQUENCY: u32 = 218170178u32; pub const OID_DOT11_CURRENT_INDEX: u32 = 218170164u32; pub const OID_DOT11_CURRENT_OFFLOAD_CAPABILITY: u32 = 218170113u32; pub const OID_DOT11_CURRENT_OPERATION_MODE: u32 = 218170120u32; pub const OID_DOT11_CURRENT_OPTIONAL_CAPABILITY: u32 = 218170131u32; pub const OID_DOT11_CURRENT_PACKET_FILTER: u32 = 218170121u32; pub const OID_DOT11_CURRENT_PATTERN: u32 = 218170163u32; pub const OID_DOT11_CURRENT_PHY_TYPE: u32 = 218170124u32; pub const OID_DOT11_CURRENT_REG_DOMAIN: u32 = 218170151u32; pub const OID_DOT11_CURRENT_RX_ANTENNA: u32 = 218170155u32; pub const OID_DOT11_CURRENT_SET: u32 = 218170162u32; pub const OID_DOT11_CURRENT_TX_ANTENNA: u32 = 218170153u32; pub const OID_DOT11_CURRENT_TX_POWER_LEVEL: u32 = 218170157u32; pub const OID_DOT11_DEFAULT_WEP_OFFLOAD: u32 = 218170116u32; pub const OID_DOT11_DEFAULT_WEP_UPLOAD: u32 = 218170117u32; pub const OID_DOT11_DIVERSITY_SELECTION_RX: u32 = 218170176u32; pub const OID_DOT11_DIVERSITY_SUPPORT: u32 = 218170154u32; pub const OID_DOT11_DSSS_OFDM_OPTION_ENABLED: u32 = 218170209u32; pub const OID_DOT11_DSSS_OFDM_OPTION_IMPLEMENTED: u32 = 218170208u32; pub const OID_DOT11_DTIM_PERIOD: u32 = 218170140u32; pub const OID_DOT11_ED_THRESHOLD: u32 = 218170168u32; pub const OID_DOT11_EHCC_CAPABILITY_ENABLED: u32 = 218170193u32; pub const OID_DOT11_EHCC_CAPABILITY_IMPLEMENTED: u32 = 218170192u32; pub const OID_DOT11_EHCC_NUMBER_OF_CHANNELS_FAMILY_INDEX: u32 = 218170191u32; pub const OID_DOT11_EHCC_PRIME_RADIX: u32 = 218170190u32; pub const OID_DOT11_ERP_PBCC_OPTION_ENABLED: u32 = 218170207u32; pub const OID_DOT11_ERP_PBCC_OPTION_IMPLEMENTED: u32 = 218170206u32; pub const OID_DOT11_FRAGMENTATION_THRESHOLD: u32 = 218170146u32; pub const OID_DOT11_FREQUENCY_BANDS_SUPPORTED: u32 = 218170180u32; pub const OID_DOT11_HOPPING_PATTERN: u32 = 218170199u32; pub const OID_DOT11_HOP_ALGORITHM_ADOPTED: u32 = 218170194u32; pub const OID_DOT11_HOP_MODULUS: u32 = 218170197u32; pub const OID_DOT11_HOP_OFFSET: u32 = 218170198u32; pub const OID_DOT11_HOP_TIME: u32 = 218170158u32; pub const OID_DOT11_HR_CCA_MODE_SUPPORTED: u32 = 218170185u32; pub const OID_DOT11_JOIN_REQUEST: u32 = 218170125u32; pub const OID_DOT11_LONG_RETRY_LIMIT: u32 = 218170145u32; pub const OID_DOT11_MAC_ADDRESS: u32 = 218170142u32; pub const OID_DOT11_MAXIMUM_LIST_SIZE: u32 = 218171141u32; pub const OID_DOT11_MAX_DWELL_TIME: u32 = 218170160u32; pub const OID_DOT11_MAX_MAC_ADDRESS_STATES: u32 = 218170212u32; pub const OID_DOT11_MAX_RECEIVE_LIFETIME: u32 = 218170148u32; pub const OID_DOT11_MAX_TRANSMIT_MSDU_LIFETIME: u32 = 218170147u32; pub const OID_DOT11_MEDIUM_OCCUPANCY_LIMIT: u32 = 218170133u32; pub const OID_DOT11_MPDU_MAX_LENGTH: u32 = 218170118u32; pub const OID_DOT11_MULTICAST_LIST: u32 = 218171140u32; pub const OID_DOT11_MULTI_DOMAIN_CAPABILITY: u32 = 218170189u32; pub const OID_DOT11_MULTI_DOMAIN_CAPABILITY_ENABLED: u32 = 218170187u32; pub const OID_DOT11_MULTI_DOMAIN_CAPABILITY_IMPLEMENTED: u32 = 218170186u32; pub const OID_DOT11_NDIS_START: u32 = 218170112u32; pub const OID_DOT11_NIC_POWER_STATE: u32 = 218170129u32; pub const OID_DOT11_NIC_SPECIFIC_EXTENSION: u32 = 218170204u32; pub const OID_DOT11_NUMBER_OF_HOPPING_SETS: u32 = 218170196u32; pub const OID_DOT11_OFFLOAD_CAPABILITY: u32 = 218170112u32; pub const OID_DOT11_OPERATIONAL_RATE_SET: u32 = 218170138u32; pub const OID_DOT11_OPERATION_MODE_CAPABILITY: u32 = 218170119u32; pub const OID_DOT11_OPTIONAL_CAPABILITY: u32 = 218170130u32; pub const OID_DOT11_PBCC_OPTION_IMPLEMENTED: u32 = 218170182u32; pub const OID_DOT11_PERMANENT_ADDRESS: u32 = 218171139u32; pub const OID_DOT11_POWER_MGMT_MODE: u32 = 218170137u32; pub const OID_DOT11_PRIVATE_OIDS_START: u32 = 218171136u32; pub const OID_DOT11_QOS_TX_DURATION: u32 = 218170219u32; pub const OID_DOT11_QOS_TX_MEDIUM_TIME: u32 = 218170220u32; pub const OID_DOT11_QOS_TX_QUEUES_SUPPORTED: u32 = 218170218u32; pub const OID_DOT11_RANDOM_TABLE_FIELD_NUMBER: u32 = 218170200u32; pub const OID_DOT11_RANDOM_TABLE_FLAG: u32 = 218170195u32; pub const OID_DOT11_RECV_SENSITIVITY_LIST: u32 = 218170213u32; pub const OID_DOT11_REG_DOMAINS_SUPPORT_VALUE: u32 = 218170173u32; pub const OID_DOT11_RESET_REQUEST: u32 = 218170128u32; pub const OID_DOT11_RF_USAGE: u32 = 218170203u32; pub const OID_DOT11_RSSI_RANGE: u32 = 218170202u32; pub const OID_DOT11_RTS_THRESHOLD: u32 = 218170143u32; pub const OID_DOT11_SCAN_REQUEST: u32 = 218170123u32; pub const OID_DOT11_SHORT_PREAMBLE_OPTION_IMPLEMENTED: u32 = 218170181u32; pub const OID_DOT11_SHORT_RETRY_LIMIT: u32 = 218170144u32; pub const OID_DOT11_SHORT_SLOT_TIME_OPTION_ENABLED: u32 = 218170211u32; pub const OID_DOT11_SHORT_SLOT_TIME_OPTION_IMPLEMENTED: u32 = 218170210u32; pub const OID_DOT11_START_REQUEST: u32 = 218170126u32; pub const OID_DOT11_STATION_ID: u32 = 218170132u32; pub const OID_DOT11_SUPPORTED_DATA_RATES_VALUE: u32 = 218170177u32; pub const OID_DOT11_SUPPORTED_DSSS_CHANNEL_LIST: u32 = 218170222u32; pub const OID_DOT11_SUPPORTED_OFDM_FREQUENCY_LIST: u32 = 218170221u32; pub const OID_DOT11_SUPPORTED_PHY_TYPES: u32 = 218170150u32; pub const OID_DOT11_SUPPORTED_POWER_LEVELS: u32 = 218170156u32; pub const OID_DOT11_SUPPORTED_RX_ANTENNA: u32 = 218170175u32; pub const OID_DOT11_SUPPORTED_TX_ANTENNA: u32 = 218170174u32; pub const OID_DOT11_TEMP_TYPE: u32 = 218170152u32; pub const OID_DOT11_TI_THRESHOLD: u32 = 218170179u32; pub const OID_DOT11_UPDATE_IE: u32 = 218170127u32; pub const OID_DOT11_WEP_ICV_ERROR_COUNT: u32 = 218170141u32; pub const OID_DOT11_WEP_OFFLOAD: u32 = 218170114u32; pub const OID_DOT11_WEP_UPLOAD: u32 = 218170115u32; pub const OID_DOT11_WME_AC_PARAMETERS: u32 = 218170216u32; pub const OID_DOT11_WME_ENABLED: u32 = 218170215u32; pub const OID_DOT11_WME_IMPLEMENTED: u32 = 218170214u32; pub const OID_DOT11_WME_UPDATE_IE: u32 = 218170217u32; pub const OID_DOT11_WPA_TSC: u32 = 218170201u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct ONEX_AUTH_IDENTITY(pub i32); pub const OneXAuthIdentityNone: ONEX_AUTH_IDENTITY = ONEX_AUTH_IDENTITY(0i32); pub const OneXAuthIdentityMachine: ONEX_AUTH_IDENTITY = ONEX_AUTH_IDENTITY(1i32); pub const OneXAuthIdentityUser: ONEX_AUTH_IDENTITY = ONEX_AUTH_IDENTITY(2i32); pub const OneXAuthIdentityExplicitUser: ONEX_AUTH_IDENTITY = ONEX_AUTH_IDENTITY(3i32); pub const OneXAuthIdentityGuest: ONEX_AUTH_IDENTITY = ONEX_AUTH_IDENTITY(4i32); pub const OneXAuthIdentityInvalid: ONEX_AUTH_IDENTITY = ONEX_AUTH_IDENTITY(5i32); impl ::core::convert::From<i32> for ONEX_AUTH_IDENTITY { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for ONEX_AUTH_IDENTITY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct ONEX_AUTH_PARAMS { pub fUpdatePending: super::super::Foundation::BOOL, pub oneXConnProfile: ONEX_VARIABLE_BLOB, pub authIdentity: ONEX_AUTH_IDENTITY, pub dwQuarantineState: u32, pub _bitfield: u32, pub dwSessionId: u32, pub hUserToken: super::super::Foundation::HANDLE, pub OneXUserProfile: ONEX_VARIABLE_BLOB, pub Identity: ONEX_VARIABLE_BLOB, pub UserName: ONEX_VARIABLE_BLOB, pub Domain: ONEX_VARIABLE_BLOB, } #[cfg(feature = "Win32_Foundation")] impl ONEX_AUTH_PARAMS {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for ONEX_AUTH_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for ONEX_AUTH_PARAMS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ONEX_AUTH_PARAMS") .field("fUpdatePending", &self.fUpdatePending) .field("oneXConnProfile", &self.oneXConnProfile) .field("authIdentity", &self.authIdentity) .field("dwQuarantineState", &self.dwQuarantineState) .field("_bitfield", &self._bitfield) .field("dwSessionId", &self.dwSessionId) .field("hUserToken", &self.hUserToken) .field("OneXUserProfile", &self.OneXUserProfile) .field("Identity", &self.Identity) .field("UserName", &self.UserName) .field("Domain", &self.Domain) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for ONEX_AUTH_PARAMS { fn eq(&self, other: &Self) -> bool { self.fUpdatePending == other.fUpdatePending && self.oneXConnProfile == other.oneXConnProfile && self.authIdentity == other.authIdentity && self.dwQuarantineState == other.dwQuarantineState && self._bitfield == other._bitfield && self.dwSessionId == other.dwSessionId && self.hUserToken == other.hUserToken && self.OneXUserProfile == other.OneXUserProfile && self.Identity == other.Identity && self.UserName == other.UserName && self.Domain == other.Domain } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for ONEX_AUTH_PARAMS {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for ONEX_AUTH_PARAMS { 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 ONEX_AUTH_RESTART_REASON(pub i32); pub const OneXRestartReasonPeerInitiated: ONEX_AUTH_RESTART_REASON = ONEX_AUTH_RESTART_REASON(0i32); pub const OneXRestartReasonMsmInitiated: ONEX_AUTH_RESTART_REASON = ONEX_AUTH_RESTART_REASON(1i32); pub const OneXRestartReasonOneXHeldStateTimeout: ONEX_AUTH_RESTART_REASON = ONEX_AUTH_RESTART_REASON(2i32); pub const OneXRestartReasonOneXAuthTimeout: ONEX_AUTH_RESTART_REASON = ONEX_AUTH_RESTART_REASON(3i32); pub const OneXRestartReasonOneXConfigurationChanged: ONEX_AUTH_RESTART_REASON = ONEX_AUTH_RESTART_REASON(4i32); pub const OneXRestartReasonOneXUserChanged: ONEX_AUTH_RESTART_REASON = ONEX_AUTH_RESTART_REASON(5i32); pub const OneXRestartReasonQuarantineStateChanged: ONEX_AUTH_RESTART_REASON = ONEX_AUTH_RESTART_REASON(6i32); pub const OneXRestartReasonAltCredsTrial: ONEX_AUTH_RESTART_REASON = ONEX_AUTH_RESTART_REASON(7i32); pub const OneXRestartReasonInvalid: ONEX_AUTH_RESTART_REASON = ONEX_AUTH_RESTART_REASON(8i32); impl ::core::convert::From<i32> for ONEX_AUTH_RESTART_REASON { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for ONEX_AUTH_RESTART_REASON { 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 ONEX_AUTH_STATUS(pub i32); pub const OneXAuthNotStarted: ONEX_AUTH_STATUS = ONEX_AUTH_STATUS(0i32); pub const OneXAuthInProgress: ONEX_AUTH_STATUS = ONEX_AUTH_STATUS(1i32); pub const OneXAuthNoAuthenticatorFound: ONEX_AUTH_STATUS = ONEX_AUTH_STATUS(2i32); pub const OneXAuthSuccess: ONEX_AUTH_STATUS = ONEX_AUTH_STATUS(3i32); pub const OneXAuthFailure: ONEX_AUTH_STATUS = ONEX_AUTH_STATUS(4i32); pub const OneXAuthInvalid: ONEX_AUTH_STATUS = ONEX_AUTH_STATUS(5i32); impl ::core::convert::From<i32> for ONEX_AUTH_STATUS { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for ONEX_AUTH_STATUS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Security_ExtensibleAuthenticationProtocol")] pub struct ONEX_EAP_ERROR { pub dwWinError: u32, pub r#type: super::super::Security::ExtensibleAuthenticationProtocol::EAP_METHOD_TYPE, pub dwReasonCode: u32, pub rootCauseGuid: ::windows::core::GUID, pub repairGuid: ::windows::core::GUID, pub helpLinkGuid: ::windows::core::GUID, pub _bitfield: u32, pub RootCauseString: ONEX_VARIABLE_BLOB, pub RepairString: ONEX_VARIABLE_BLOB, } #[cfg(feature = "Win32_Security_ExtensibleAuthenticationProtocol")] impl ONEX_EAP_ERROR {} #[cfg(feature = "Win32_Security_ExtensibleAuthenticationProtocol")] impl ::core::default::Default for ONEX_EAP_ERROR { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Security_ExtensibleAuthenticationProtocol")] impl ::core::fmt::Debug for ONEX_EAP_ERROR { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ONEX_EAP_ERROR") .field("dwWinError", &self.dwWinError) .field("r#type", &self.r#type) .field("dwReasonCode", &self.dwReasonCode) .field("rootCauseGuid", &self.rootCauseGuid) .field("repairGuid", &self.repairGuid) .field("helpLinkGuid", &self.helpLinkGuid) .field("_bitfield", &self._bitfield) .field("RootCauseString", &self.RootCauseString) .field("RepairString", &self.RepairString) .finish() } } #[cfg(feature = "Win32_Security_ExtensibleAuthenticationProtocol")] impl ::core::cmp::PartialEq for ONEX_EAP_ERROR { fn eq(&self, other: &Self) -> bool { self.dwWinError == other.dwWinError && self.r#type == other.r#type && self.dwReasonCode == other.dwReasonCode && self.rootCauseGuid == other.rootCauseGuid && self.repairGuid == other.repairGuid && self.helpLinkGuid == other.helpLinkGuid && self._bitfield == other._bitfield && self.RootCauseString == other.RootCauseString && self.RepairString == other.RepairString } } #[cfg(feature = "Win32_Security_ExtensibleAuthenticationProtocol")] impl ::core::cmp::Eq for ONEX_EAP_ERROR {} #[cfg(feature = "Win32_Security_ExtensibleAuthenticationProtocol")] unsafe impl ::windows::core::Abi for ONEX_EAP_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 ONEX_EAP_METHOD_BACKEND_SUPPORT(pub i32); pub const OneXEapMethodBackendSupportUnknown: ONEX_EAP_METHOD_BACKEND_SUPPORT = ONEX_EAP_METHOD_BACKEND_SUPPORT(0i32); pub const OneXEapMethodBackendSupported: ONEX_EAP_METHOD_BACKEND_SUPPORT = ONEX_EAP_METHOD_BACKEND_SUPPORT(1i32); pub const OneXEapMethodBackendUnsupported: ONEX_EAP_METHOD_BACKEND_SUPPORT = ONEX_EAP_METHOD_BACKEND_SUPPORT(2i32); impl ::core::convert::From<i32> for ONEX_EAP_METHOD_BACKEND_SUPPORT { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for ONEX_EAP_METHOD_BACKEND_SUPPORT { 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 ONEX_NOTIFICATION_TYPE(pub i32); pub const OneXPublicNotificationBase: ONEX_NOTIFICATION_TYPE = ONEX_NOTIFICATION_TYPE(0i32); pub const OneXNotificationTypeResultUpdate: ONEX_NOTIFICATION_TYPE = ONEX_NOTIFICATION_TYPE(1i32); pub const OneXNotificationTypeAuthRestarted: ONEX_NOTIFICATION_TYPE = ONEX_NOTIFICATION_TYPE(2i32); pub const OneXNotificationTypeEventInvalid: ONEX_NOTIFICATION_TYPE = ONEX_NOTIFICATION_TYPE(3i32); pub const OneXNumNotifications: ONEX_NOTIFICATION_TYPE = ONEX_NOTIFICATION_TYPE(3i32); impl ::core::convert::From<i32> for ONEX_NOTIFICATION_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for ONEX_NOTIFICATION_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 ONEX_REASON_CODE(pub i32); pub const ONEX_REASON_CODE_SUCCESS: ONEX_REASON_CODE = ONEX_REASON_CODE(0i32); pub const ONEX_REASON_START: ONEX_REASON_CODE = ONEX_REASON_CODE(327680i32); pub const ONEX_UNABLE_TO_IDENTIFY_USER: ONEX_REASON_CODE = ONEX_REASON_CODE(327681i32); pub const ONEX_IDENTITY_NOT_FOUND: ONEX_REASON_CODE = ONEX_REASON_CODE(327682i32); pub const ONEX_UI_DISABLED: ONEX_REASON_CODE = ONEX_REASON_CODE(327683i32); pub const ONEX_UI_FAILURE: ONEX_REASON_CODE = ONEX_REASON_CODE(327684i32); pub const ONEX_EAP_FAILURE_RECEIVED: ONEX_REASON_CODE = ONEX_REASON_CODE(327685i32); pub const ONEX_AUTHENTICATOR_NO_LONGER_PRESENT: ONEX_REASON_CODE = ONEX_REASON_CODE(327686i32); pub const ONEX_NO_RESPONSE_TO_IDENTITY: ONEX_REASON_CODE = ONEX_REASON_CODE(327687i32); pub const ONEX_PROFILE_VERSION_NOT_SUPPORTED: ONEX_REASON_CODE = ONEX_REASON_CODE(327688i32); pub const ONEX_PROFILE_INVALID_LENGTH: ONEX_REASON_CODE = ONEX_REASON_CODE(327689i32); pub const ONEX_PROFILE_DISALLOWED_EAP_TYPE: ONEX_REASON_CODE = ONEX_REASON_CODE(327690i32); pub const ONEX_PROFILE_INVALID_EAP_TYPE_OR_FLAG: ONEX_REASON_CODE = ONEX_REASON_CODE(327691i32); pub const ONEX_PROFILE_INVALID_ONEX_FLAGS: ONEX_REASON_CODE = ONEX_REASON_CODE(327692i32); pub const ONEX_PROFILE_INVALID_TIMER_VALUE: ONEX_REASON_CODE = ONEX_REASON_CODE(327693i32); pub const ONEX_PROFILE_INVALID_SUPPLICANT_MODE: ONEX_REASON_CODE = ONEX_REASON_CODE(327694i32); pub const ONEX_PROFILE_INVALID_AUTH_MODE: ONEX_REASON_CODE = ONEX_REASON_CODE(327695i32); pub const ONEX_PROFILE_INVALID_EAP_CONNECTION_PROPERTIES: ONEX_REASON_CODE = ONEX_REASON_CODE(327696i32); pub const ONEX_UI_CANCELLED: ONEX_REASON_CODE = ONEX_REASON_CODE(327697i32); pub const ONEX_PROFILE_INVALID_EXPLICIT_CREDENTIALS: ONEX_REASON_CODE = ONEX_REASON_CODE(327698i32); pub const ONEX_PROFILE_EXPIRED_EXPLICIT_CREDENTIALS: ONEX_REASON_CODE = ONEX_REASON_CODE(327699i32); pub const ONEX_UI_NOT_PERMITTED: ONEX_REASON_CODE = ONEX_REASON_CODE(327700i32); impl ::core::convert::From<i32> for ONEX_REASON_CODE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for ONEX_REASON_CODE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct ONEX_RESULT_UPDATE_DATA { pub oneXStatus: ONEX_STATUS, pub BackendSupport: ONEX_EAP_METHOD_BACKEND_SUPPORT, pub fBackendEngaged: super::super::Foundation::BOOL, pub _bitfield: u32, pub authParams: ONEX_VARIABLE_BLOB, pub eapError: ONEX_VARIABLE_BLOB, } #[cfg(feature = "Win32_Foundation")] impl ONEX_RESULT_UPDATE_DATA {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for ONEX_RESULT_UPDATE_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for ONEX_RESULT_UPDATE_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ONEX_RESULT_UPDATE_DATA").field("oneXStatus", &self.oneXStatus).field("BackendSupport", &self.BackendSupport).field("fBackendEngaged", &self.fBackendEngaged).field("_bitfield", &self._bitfield).field("authParams", &self.authParams).field("eapError", &self.eapError).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for ONEX_RESULT_UPDATE_DATA { fn eq(&self, other: &Self) -> bool { self.oneXStatus == other.oneXStatus && self.BackendSupport == other.BackendSupport && self.fBackendEngaged == other.fBackendEngaged && self._bitfield == other._bitfield && self.authParams == other.authParams && self.eapError == other.eapError } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for ONEX_RESULT_UPDATE_DATA {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for ONEX_RESULT_UPDATE_DATA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ONEX_STATUS { pub authStatus: ONEX_AUTH_STATUS, pub dwReason: u32, pub dwError: u32, } impl ONEX_STATUS {} impl ::core::default::Default for ONEX_STATUS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ONEX_STATUS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ONEX_STATUS").field("authStatus", &self.authStatus).field("dwReason", &self.dwReason).field("dwError", &self.dwError).finish() } } impl ::core::cmp::PartialEq for ONEX_STATUS { fn eq(&self, other: &Self) -> bool { self.authStatus == other.authStatus && self.dwReason == other.dwReason && self.dwError == other.dwError } } impl ::core::cmp::Eq for ONEX_STATUS {} unsafe impl ::windows::core::Abi for ONEX_STATUS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ONEX_USER_INFO { pub authIdentity: ONEX_AUTH_IDENTITY, pub _bitfield: u32, pub UserName: ONEX_VARIABLE_BLOB, pub DomainName: ONEX_VARIABLE_BLOB, } impl ONEX_USER_INFO {} impl ::core::default::Default for ONEX_USER_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ONEX_USER_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ONEX_USER_INFO").field("authIdentity", &self.authIdentity).field("_bitfield", &self._bitfield).field("UserName", &self.UserName).field("DomainName", &self.DomainName).finish() } } impl ::core::cmp::PartialEq for ONEX_USER_INFO { fn eq(&self, other: &Self) -> bool { self.authIdentity == other.authIdentity && self._bitfield == other._bitfield && self.UserName == other.UserName && self.DomainName == other.DomainName } } impl ::core::cmp::Eq for ONEX_USER_INFO {} unsafe impl ::windows::core::Abi for ONEX_USER_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ONEX_VARIABLE_BLOB { pub dwSize: u32, pub dwOffset: u32, } impl ONEX_VARIABLE_BLOB {} impl ::core::default::Default for ONEX_VARIABLE_BLOB { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ONEX_VARIABLE_BLOB { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ONEX_VARIABLE_BLOB").field("dwSize", &self.dwSize).field("dwOffset", &self.dwOffset).finish() } } impl ::core::cmp::PartialEq for ONEX_VARIABLE_BLOB { fn eq(&self, other: &Self) -> bool { self.dwSize == other.dwSize && self.dwOffset == other.dwOffset } } impl ::core::cmp::Eq for ONEX_VARIABLE_BLOB {} unsafe impl ::windows::core::Abi for ONEX_VARIABLE_BLOB { type Abi = Self; } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WFDCancelOpenSession<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hsessionhandle: Param0) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WFDCancelOpenSession(hsessionhandle: super::super::Foundation::HANDLE) -> u32; } ::core::mem::transmute(WFDCancelOpenSession(hsessionhandle.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WFDCloseHandle<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WFDCloseHandle(hclienthandle: super::super::Foundation::HANDLE) -> u32; } ::core::mem::transmute(WFDCloseHandle(hclienthandle.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WFDCloseSession<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hsessionhandle: Param0) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WFDCloseSession(hsessionhandle: super::super::Foundation::HANDLE) -> u32; } ::core::mem::transmute(WFDCloseSession(hsessionhandle.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WFDOpenHandle(dwclientversion: u32, pdwnegotiatedversion: *mut u32, phclienthandle: *mut super::super::Foundation::HANDLE) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WFDOpenHandle(dwclientversion: u32, pdwnegotiatedversion: *mut u32, phclienthandle: *mut super::super::Foundation::HANDLE) -> u32; } ::core::mem::transmute(WFDOpenHandle(::core::mem::transmute(dwclientversion), ::core::mem::transmute(pdwnegotiatedversion), ::core::mem::transmute(phclienthandle))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WFDOpenLegacySession<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, plegacymacaddress: *const *const u8, phsessionhandle: *mut super::super::Foundation::HANDLE, pguidsessioninterface: *mut ::windows::core::GUID) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WFDOpenLegacySession(hclienthandle: super::super::Foundation::HANDLE, plegacymacaddress: *const *const u8, phsessionhandle: *mut super::super::Foundation::HANDLE, pguidsessioninterface: *mut ::windows::core::GUID) -> u32; } ::core::mem::transmute(WFDOpenLegacySession(hclienthandle.into_param().abi(), ::core::mem::transmute(plegacymacaddress), ::core::mem::transmute(phsessionhandle), ::core::mem::transmute(pguidsessioninterface))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WFDSVC_CONNECTION_CAPABILITY { pub bNew: super::super::Foundation::BOOLEAN, pub bClient: super::super::Foundation::BOOLEAN, pub bGO: super::super::Foundation::BOOLEAN, } #[cfg(feature = "Win32_Foundation")] impl WFDSVC_CONNECTION_CAPABILITY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for WFDSVC_CONNECTION_CAPABILITY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for WFDSVC_CONNECTION_CAPABILITY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WFDSVC_CONNECTION_CAPABILITY").field("bNew", &self.bNew).field("bClient", &self.bClient).field("bGO", &self.bGO).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for WFDSVC_CONNECTION_CAPABILITY { fn eq(&self, other: &Self) -> bool { self.bNew == other.bNew && self.bClient == other.bClient && self.bGO == other.bGO } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for WFDSVC_CONNECTION_CAPABILITY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for WFDSVC_CONNECTION_CAPABILITY { type Abi = Self; } pub const WFDSVC_CONNECTION_CAPABILITY_CLIENT: u32 = 2u32; pub const WFDSVC_CONNECTION_CAPABILITY_GO: u32 = 4u32; pub const WFDSVC_CONNECTION_CAPABILITY_NEW: u32 = 1u32; #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WFDStartOpenSession<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pdeviceaddress: *const *const u8, pvcontext: *const ::core::ffi::c_void, pfncallback: ::core::option::Option<WFD_OPEN_SESSION_COMPLETE_CALLBACK>, phsessionhandle: *mut super::super::Foundation::HANDLE) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WFDStartOpenSession(hclienthandle: super::super::Foundation::HANDLE, pdeviceaddress: *const *const u8, pvcontext: *const ::core::ffi::c_void, pfncallback: ::windows::core::RawPtr, phsessionhandle: *mut super::super::Foundation::HANDLE) -> u32; } ::core::mem::transmute(WFDStartOpenSession(hclienthandle.into_param().abi(), ::core::mem::transmute(pdeviceaddress), ::core::mem::transmute(pvcontext), ::core::mem::transmute(pfncallback), ::core::mem::transmute(phsessionhandle))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn WFDUpdateDeviceVisibility(pdeviceaddress: *const *const u8) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WFDUpdateDeviceVisibility(pdeviceaddress: *const *const u8) -> u32; } ::core::mem::transmute(WFDUpdateDeviceVisibility(::core::mem::transmute(pdeviceaddress))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const WFD_API_VERSION: u32 = 1u32; pub const WFD_API_VERSION_1_0: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WFD_GROUP_ID { pub DeviceAddress: [u8; 6], pub GroupSSID: DOT11_SSID, } impl WFD_GROUP_ID {} impl ::core::default::Default for WFD_GROUP_ID { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WFD_GROUP_ID { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WFD_GROUP_ID").field("DeviceAddress", &self.DeviceAddress).field("GroupSSID", &self.GroupSSID).finish() } } impl ::core::cmp::PartialEq for WFD_GROUP_ID { fn eq(&self, other: &Self) -> bool { self.DeviceAddress == other.DeviceAddress && self.GroupSSID == other.GroupSSID } } impl ::core::cmp::Eq for WFD_GROUP_ID {} unsafe impl ::windows::core::Abi for WFD_GROUP_ID { type Abi = Self; } #[cfg(feature = "Win32_Foundation")] pub type WFD_OPEN_SESSION_COMPLETE_CALLBACK = unsafe extern "system" fn(hsessionhandle: super::super::Foundation::HANDLE, pvcontext: *const ::core::ffi::c_void, guidsessioninterface: ::windows::core::GUID, dwerror: u32, dwreasoncode: u32); #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WFD_ROLE_TYPE(pub i32); pub const WFD_ROLE_TYPE_NONE: WFD_ROLE_TYPE = WFD_ROLE_TYPE(0i32); pub const WFD_ROLE_TYPE_DEVICE: WFD_ROLE_TYPE = WFD_ROLE_TYPE(1i32); pub const WFD_ROLE_TYPE_GROUP_OWNER: WFD_ROLE_TYPE = WFD_ROLE_TYPE(2i32); pub const WFD_ROLE_TYPE_CLIENT: WFD_ROLE_TYPE = WFD_ROLE_TYPE(4i32); pub const WFD_ROLE_TYPE_MAX: WFD_ROLE_TYPE = WFD_ROLE_TYPE(5i32); impl ::core::convert::From<i32> for WFD_ROLE_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WFD_ROLE_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 WLAN_ADHOC_NETWORK_STATE(pub i32); pub const wlan_adhoc_network_state_formed: WLAN_ADHOC_NETWORK_STATE = WLAN_ADHOC_NETWORK_STATE(0i32); pub const wlan_adhoc_network_state_connected: WLAN_ADHOC_NETWORK_STATE = WLAN_ADHOC_NETWORK_STATE(1i32); impl ::core::convert::From<i32> for WLAN_ADHOC_NETWORK_STATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_ADHOC_NETWORK_STATE { type Abi = Self; } pub const WLAN_API_VERSION: u32 = 2u32; pub const WLAN_API_VERSION_1_0: u32 = 1u32; pub const WLAN_API_VERSION_2_0: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_ASSOCIATION_ATTRIBUTES { pub dot11Ssid: DOT11_SSID, pub dot11BssType: DOT11_BSS_TYPE, pub dot11Bssid: [u8; 6], pub dot11PhyType: DOT11_PHY_TYPE, pub uDot11PhyIndex: u32, pub wlanSignalQuality: u32, pub ulRxRate: u32, pub ulTxRate: u32, } impl WLAN_ASSOCIATION_ATTRIBUTES {} impl ::core::default::Default for WLAN_ASSOCIATION_ATTRIBUTES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_ASSOCIATION_ATTRIBUTES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_ASSOCIATION_ATTRIBUTES") .field("dot11Ssid", &self.dot11Ssid) .field("dot11BssType", &self.dot11BssType) .field("dot11Bssid", &self.dot11Bssid) .field("dot11PhyType", &self.dot11PhyType) .field("uDot11PhyIndex", &self.uDot11PhyIndex) .field("wlanSignalQuality", &self.wlanSignalQuality) .field("ulRxRate", &self.ulRxRate) .field("ulTxRate", &self.ulTxRate) .finish() } } impl ::core::cmp::PartialEq for WLAN_ASSOCIATION_ATTRIBUTES { fn eq(&self, other: &Self) -> bool { self.dot11Ssid == other.dot11Ssid && self.dot11BssType == other.dot11BssType && self.dot11Bssid == other.dot11Bssid && self.dot11PhyType == other.dot11PhyType && self.uDot11PhyIndex == other.uDot11PhyIndex && self.wlanSignalQuality == other.wlanSignalQuality && self.ulRxRate == other.ulRxRate && self.ulTxRate == other.ulTxRate } } impl ::core::cmp::Eq for WLAN_ASSOCIATION_ATTRIBUTES {} unsafe impl ::windows::core::Abi for WLAN_ASSOCIATION_ATTRIBUTES { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_AUTH_CIPHER_PAIR_LIST { pub dwNumberOfItems: u32, pub pAuthCipherPairList: [DOT11_AUTH_CIPHER_PAIR; 1], } impl WLAN_AUTH_CIPHER_PAIR_LIST {} impl ::core::default::Default for WLAN_AUTH_CIPHER_PAIR_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_AUTH_CIPHER_PAIR_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_AUTH_CIPHER_PAIR_LIST").field("dwNumberOfItems", &self.dwNumberOfItems).field("pAuthCipherPairList", &self.pAuthCipherPairList).finish() } } impl ::core::cmp::PartialEq for WLAN_AUTH_CIPHER_PAIR_LIST { fn eq(&self, other: &Self) -> bool { self.dwNumberOfItems == other.dwNumberOfItems && self.pAuthCipherPairList == other.pAuthCipherPairList } } impl ::core::cmp::Eq for WLAN_AUTH_CIPHER_PAIR_LIST {} unsafe impl ::windows::core::Abi for WLAN_AUTH_CIPHER_PAIR_LIST { 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 WLAN_AUTOCONF_OPCODE(pub i32); pub const wlan_autoconf_opcode_start: WLAN_AUTOCONF_OPCODE = WLAN_AUTOCONF_OPCODE(0i32); pub const wlan_autoconf_opcode_show_denied_networks: WLAN_AUTOCONF_OPCODE = WLAN_AUTOCONF_OPCODE(1i32); pub const wlan_autoconf_opcode_power_setting: WLAN_AUTOCONF_OPCODE = WLAN_AUTOCONF_OPCODE(2i32); pub const wlan_autoconf_opcode_only_use_gp_profiles_for_allowed_networks: WLAN_AUTOCONF_OPCODE = WLAN_AUTOCONF_OPCODE(3i32); pub const wlan_autoconf_opcode_allow_explicit_creds: WLAN_AUTOCONF_OPCODE = WLAN_AUTOCONF_OPCODE(4i32); pub const wlan_autoconf_opcode_block_period: WLAN_AUTOCONF_OPCODE = WLAN_AUTOCONF_OPCODE(5i32); pub const wlan_autoconf_opcode_allow_virtual_station_extensibility: WLAN_AUTOCONF_OPCODE = WLAN_AUTOCONF_OPCODE(6i32); pub const wlan_autoconf_opcode_end: WLAN_AUTOCONF_OPCODE = WLAN_AUTOCONF_OPCODE(7i32); impl ::core::convert::From<i32> for WLAN_AUTOCONF_OPCODE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_AUTOCONF_OPCODE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WLAN_AVAILABLE_NETWORK { pub strProfileName: [u16; 256], pub dot11Ssid: DOT11_SSID, pub dot11BssType: DOT11_BSS_TYPE, pub uNumberOfBssids: u32, pub bNetworkConnectable: super::super::Foundation::BOOL, pub wlanNotConnectableReason: u32, pub uNumberOfPhyTypes: u32, pub dot11PhyTypes: [DOT11_PHY_TYPE; 8], pub bMorePhyTypes: super::super::Foundation::BOOL, pub wlanSignalQuality: u32, pub bSecurityEnabled: super::super::Foundation::BOOL, pub dot11DefaultAuthAlgorithm: DOT11_AUTH_ALGORITHM, pub dot11DefaultCipherAlgorithm: DOT11_CIPHER_ALGORITHM, pub dwFlags: u32, pub dwReserved: u32, } #[cfg(feature = "Win32_Foundation")] impl WLAN_AVAILABLE_NETWORK {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for WLAN_AVAILABLE_NETWORK { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for WLAN_AVAILABLE_NETWORK { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_AVAILABLE_NETWORK") .field("strProfileName", &self.strProfileName) .field("dot11Ssid", &self.dot11Ssid) .field("dot11BssType", &self.dot11BssType) .field("uNumberOfBssids", &self.uNumberOfBssids) .field("bNetworkConnectable", &self.bNetworkConnectable) .field("wlanNotConnectableReason", &self.wlanNotConnectableReason) .field("uNumberOfPhyTypes", &self.uNumberOfPhyTypes) .field("dot11PhyTypes", &self.dot11PhyTypes) .field("bMorePhyTypes", &self.bMorePhyTypes) .field("wlanSignalQuality", &self.wlanSignalQuality) .field("bSecurityEnabled", &self.bSecurityEnabled) .field("dot11DefaultAuthAlgorithm", &self.dot11DefaultAuthAlgorithm) .field("dot11DefaultCipherAlgorithm", &self.dot11DefaultCipherAlgorithm) .field("dwFlags", &self.dwFlags) .field("dwReserved", &self.dwReserved) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for WLAN_AVAILABLE_NETWORK { fn eq(&self, other: &Self) -> bool { self.strProfileName == other.strProfileName && self.dot11Ssid == other.dot11Ssid && self.dot11BssType == other.dot11BssType && self.uNumberOfBssids == other.uNumberOfBssids && self.bNetworkConnectable == other.bNetworkConnectable && self.wlanNotConnectableReason == other.wlanNotConnectableReason && self.uNumberOfPhyTypes == other.uNumberOfPhyTypes && self.dot11PhyTypes == other.dot11PhyTypes && self.bMorePhyTypes == other.bMorePhyTypes && self.wlanSignalQuality == other.wlanSignalQuality && self.bSecurityEnabled == other.bSecurityEnabled && self.dot11DefaultAuthAlgorithm == other.dot11DefaultAuthAlgorithm && self.dot11DefaultCipherAlgorithm == other.dot11DefaultCipherAlgorithm && self.dwFlags == other.dwFlags && self.dwReserved == other.dwReserved } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for WLAN_AVAILABLE_NETWORK {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for WLAN_AVAILABLE_NETWORK { type Abi = Self; } pub const WLAN_AVAILABLE_NETWORK_ANQP_SUPPORTED: u32 = 32u32; pub const WLAN_AVAILABLE_NETWORK_AUTO_CONNECT_FAILED: u32 = 256u32; pub const WLAN_AVAILABLE_NETWORK_CONNECTED: u32 = 1u32; pub const WLAN_AVAILABLE_NETWORK_CONSOLE_USER_PROFILE: u32 = 4u32; pub const WLAN_AVAILABLE_NETWORK_HAS_PROFILE: u32 = 2u32; pub const WLAN_AVAILABLE_NETWORK_HOTSPOT2_DOMAIN: u32 = 64u32; pub const WLAN_AVAILABLE_NETWORK_HOTSPOT2_ENABLED: u32 = 16u32; pub const WLAN_AVAILABLE_NETWORK_HOTSPOT2_ROAMING: u32 = 128u32; pub const WLAN_AVAILABLE_NETWORK_INCLUDE_ALL_ADHOC_PROFILES: u32 = 1u32; pub const WLAN_AVAILABLE_NETWORK_INCLUDE_ALL_MANUAL_HIDDEN_PROFILES: u32 = 2u32; pub const WLAN_AVAILABLE_NETWORK_INTERWORKING_SUPPORTED: u32 = 8u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WLAN_AVAILABLE_NETWORK_LIST { pub dwNumberOfItems: u32, pub dwIndex: u32, pub Network: [WLAN_AVAILABLE_NETWORK; 1], } #[cfg(feature = "Win32_Foundation")] impl WLAN_AVAILABLE_NETWORK_LIST {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for WLAN_AVAILABLE_NETWORK_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for WLAN_AVAILABLE_NETWORK_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_AVAILABLE_NETWORK_LIST").field("dwNumberOfItems", &self.dwNumberOfItems).field("dwIndex", &self.dwIndex).field("Network", &self.Network).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for WLAN_AVAILABLE_NETWORK_LIST { fn eq(&self, other: &Self) -> bool { self.dwNumberOfItems == other.dwNumberOfItems && self.dwIndex == other.dwIndex && self.Network == other.Network } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for WLAN_AVAILABLE_NETWORK_LIST {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for WLAN_AVAILABLE_NETWORK_LIST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WLAN_AVAILABLE_NETWORK_LIST_V2 { pub dwNumberOfItems: u32, pub dwIndex: u32, pub Network: [WLAN_AVAILABLE_NETWORK_V2; 1], } #[cfg(feature = "Win32_Foundation")] impl WLAN_AVAILABLE_NETWORK_LIST_V2 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for WLAN_AVAILABLE_NETWORK_LIST_V2 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for WLAN_AVAILABLE_NETWORK_LIST_V2 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_AVAILABLE_NETWORK_LIST_V2").field("dwNumberOfItems", &self.dwNumberOfItems).field("dwIndex", &self.dwIndex).field("Network", &self.Network).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for WLAN_AVAILABLE_NETWORK_LIST_V2 { fn eq(&self, other: &Self) -> bool { self.dwNumberOfItems == other.dwNumberOfItems && self.dwIndex == other.dwIndex && self.Network == other.Network } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for WLAN_AVAILABLE_NETWORK_LIST_V2 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for WLAN_AVAILABLE_NETWORK_LIST_V2 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WLAN_AVAILABLE_NETWORK_V2 { pub strProfileName: [u16; 256], pub dot11Ssid: DOT11_SSID, pub dot11BssType: DOT11_BSS_TYPE, pub uNumberOfBssids: u32, pub bNetworkConnectable: super::super::Foundation::BOOL, pub wlanNotConnectableReason: u32, pub uNumberOfPhyTypes: u32, pub dot11PhyTypes: [DOT11_PHY_TYPE; 8], pub bMorePhyTypes: super::super::Foundation::BOOL, pub wlanSignalQuality: u32, pub bSecurityEnabled: super::super::Foundation::BOOL, pub dot11DefaultAuthAlgorithm: DOT11_AUTH_ALGORITHM, pub dot11DefaultCipherAlgorithm: DOT11_CIPHER_ALGORITHM, pub dwFlags: u32, pub AccessNetworkOptions: DOT11_ACCESSNETWORKOPTIONS, pub dot11HESSID: [u8; 6], pub VenueInfo: DOT11_VENUEINFO, pub dwReserved: u32, } #[cfg(feature = "Win32_Foundation")] impl WLAN_AVAILABLE_NETWORK_V2 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for WLAN_AVAILABLE_NETWORK_V2 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for WLAN_AVAILABLE_NETWORK_V2 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_AVAILABLE_NETWORK_V2") .field("strProfileName", &self.strProfileName) .field("dot11Ssid", &self.dot11Ssid) .field("dot11BssType", &self.dot11BssType) .field("uNumberOfBssids", &self.uNumberOfBssids) .field("bNetworkConnectable", &self.bNetworkConnectable) .field("wlanNotConnectableReason", &self.wlanNotConnectableReason) .field("uNumberOfPhyTypes", &self.uNumberOfPhyTypes) .field("dot11PhyTypes", &self.dot11PhyTypes) .field("bMorePhyTypes", &self.bMorePhyTypes) .field("wlanSignalQuality", &self.wlanSignalQuality) .field("bSecurityEnabled", &self.bSecurityEnabled) .field("dot11DefaultAuthAlgorithm", &self.dot11DefaultAuthAlgorithm) .field("dot11DefaultCipherAlgorithm", &self.dot11DefaultCipherAlgorithm) .field("dwFlags", &self.dwFlags) .field("AccessNetworkOptions", &self.AccessNetworkOptions) .field("dot11HESSID", &self.dot11HESSID) .field("VenueInfo", &self.VenueInfo) .field("dwReserved", &self.dwReserved) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for WLAN_AVAILABLE_NETWORK_V2 { fn eq(&self, other: &Self) -> bool { self.strProfileName == other.strProfileName && self.dot11Ssid == other.dot11Ssid && self.dot11BssType == other.dot11BssType && self.uNumberOfBssids == other.uNumberOfBssids && self.bNetworkConnectable == other.bNetworkConnectable && self.wlanNotConnectableReason == other.wlanNotConnectableReason && self.uNumberOfPhyTypes == other.uNumberOfPhyTypes && self.dot11PhyTypes == other.dot11PhyTypes && self.bMorePhyTypes == other.bMorePhyTypes && self.wlanSignalQuality == other.wlanSignalQuality && self.bSecurityEnabled == other.bSecurityEnabled && self.dot11DefaultAuthAlgorithm == other.dot11DefaultAuthAlgorithm && self.dot11DefaultCipherAlgorithm == other.dot11DefaultCipherAlgorithm && self.dwFlags == other.dwFlags && self.AccessNetworkOptions == other.AccessNetworkOptions && self.dot11HESSID == other.dot11HESSID && self.VenueInfo == other.VenueInfo && self.dwReserved == other.dwReserved } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for WLAN_AVAILABLE_NETWORK_V2 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for WLAN_AVAILABLE_NETWORK_V2 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WLAN_BSS_ENTRY { pub dot11Ssid: DOT11_SSID, pub uPhyId: u32, pub dot11Bssid: [u8; 6], pub dot11BssType: DOT11_BSS_TYPE, pub dot11BssPhyType: DOT11_PHY_TYPE, pub lRssi: i32, pub uLinkQuality: u32, pub bInRegDomain: super::super::Foundation::BOOLEAN, pub usBeaconPeriod: u16, pub ullTimestamp: u64, pub ullHostTimestamp: u64, pub usCapabilityInformation: u16, pub ulChCenterFrequency: u32, pub wlanRateSet: WLAN_RATE_SET, pub ulIeOffset: u32, pub ulIeSize: u32, } #[cfg(feature = "Win32_Foundation")] impl WLAN_BSS_ENTRY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for WLAN_BSS_ENTRY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for WLAN_BSS_ENTRY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_BSS_ENTRY") .field("dot11Ssid", &self.dot11Ssid) .field("uPhyId", &self.uPhyId) .field("dot11Bssid", &self.dot11Bssid) .field("dot11BssType", &self.dot11BssType) .field("dot11BssPhyType", &self.dot11BssPhyType) .field("lRssi", &self.lRssi) .field("uLinkQuality", &self.uLinkQuality) .field("bInRegDomain", &self.bInRegDomain) .field("usBeaconPeriod", &self.usBeaconPeriod) .field("ullTimestamp", &self.ullTimestamp) .field("ullHostTimestamp", &self.ullHostTimestamp) .field("usCapabilityInformation", &self.usCapabilityInformation) .field("ulChCenterFrequency", &self.ulChCenterFrequency) .field("wlanRateSet", &self.wlanRateSet) .field("ulIeOffset", &self.ulIeOffset) .field("ulIeSize", &self.ulIeSize) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for WLAN_BSS_ENTRY { fn eq(&self, other: &Self) -> bool { self.dot11Ssid == other.dot11Ssid && self.uPhyId == other.uPhyId && self.dot11Bssid == other.dot11Bssid && self.dot11BssType == other.dot11BssType && self.dot11BssPhyType == other.dot11BssPhyType && self.lRssi == other.lRssi && self.uLinkQuality == other.uLinkQuality && self.bInRegDomain == other.bInRegDomain && self.usBeaconPeriod == other.usBeaconPeriod && self.ullTimestamp == other.ullTimestamp && self.ullHostTimestamp == other.ullHostTimestamp && self.usCapabilityInformation == other.usCapabilityInformation && self.ulChCenterFrequency == other.ulChCenterFrequency && self.wlanRateSet == other.wlanRateSet && self.ulIeOffset == other.ulIeOffset && self.ulIeSize == other.ulIeSize } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for WLAN_BSS_ENTRY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for WLAN_BSS_ENTRY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WLAN_BSS_LIST { pub dwTotalSize: u32, pub dwNumberOfItems: u32, pub wlanBssEntries: [WLAN_BSS_ENTRY; 1], } #[cfg(feature = "Win32_Foundation")] impl WLAN_BSS_LIST {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for WLAN_BSS_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for WLAN_BSS_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_BSS_LIST").field("dwTotalSize", &self.dwTotalSize).field("dwNumberOfItems", &self.dwNumberOfItems).field("wlanBssEntries", &self.wlanBssEntries).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for WLAN_BSS_LIST { fn eq(&self, other: &Self) -> bool { self.dwTotalSize == other.dwTotalSize && self.dwNumberOfItems == other.dwNumberOfItems && self.wlanBssEntries == other.wlanBssEntries } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for WLAN_BSS_LIST {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for WLAN_BSS_LIST { type Abi = Self; } pub const WLAN_CONNECTION_ADHOC_JOIN_ONLY: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WLAN_CONNECTION_ATTRIBUTES { pub isState: WLAN_INTERFACE_STATE, pub wlanConnectionMode: WLAN_CONNECTION_MODE, pub strProfileName: [u16; 256], pub wlanAssociationAttributes: WLAN_ASSOCIATION_ATTRIBUTES, pub wlanSecurityAttributes: WLAN_SECURITY_ATTRIBUTES, } #[cfg(feature = "Win32_Foundation")] impl WLAN_CONNECTION_ATTRIBUTES {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for WLAN_CONNECTION_ATTRIBUTES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for WLAN_CONNECTION_ATTRIBUTES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_CONNECTION_ATTRIBUTES") .field("isState", &self.isState) .field("wlanConnectionMode", &self.wlanConnectionMode) .field("strProfileName", &self.strProfileName) .field("wlanAssociationAttributes", &self.wlanAssociationAttributes) .field("wlanSecurityAttributes", &self.wlanSecurityAttributes) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for WLAN_CONNECTION_ATTRIBUTES { fn eq(&self, other: &Self) -> bool { self.isState == other.isState && self.wlanConnectionMode == other.wlanConnectionMode && self.strProfileName == other.strProfileName && self.wlanAssociationAttributes == other.wlanAssociationAttributes && self.wlanSecurityAttributes == other.wlanSecurityAttributes } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for WLAN_CONNECTION_ATTRIBUTES {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for WLAN_CONNECTION_ATTRIBUTES { type Abi = Self; } pub const WLAN_CONNECTION_EAPOL_PASSTHROUGH: u32 = 8u32; pub const WLAN_CONNECTION_HIDDEN_NETWORK: u32 = 1u32; pub const WLAN_CONNECTION_IGNORE_PRIVACY_BIT: u32 = 4u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WLAN_CONNECTION_MODE(pub i32); pub const wlan_connection_mode_profile: WLAN_CONNECTION_MODE = WLAN_CONNECTION_MODE(0i32); pub const wlan_connection_mode_temporary_profile: WLAN_CONNECTION_MODE = WLAN_CONNECTION_MODE(1i32); pub const wlan_connection_mode_discovery_secure: WLAN_CONNECTION_MODE = WLAN_CONNECTION_MODE(2i32); pub const wlan_connection_mode_discovery_unsecure: WLAN_CONNECTION_MODE = WLAN_CONNECTION_MODE(3i32); pub const wlan_connection_mode_auto: WLAN_CONNECTION_MODE = WLAN_CONNECTION_MODE(4i32); pub const wlan_connection_mode_invalid: WLAN_CONNECTION_MODE = WLAN_CONNECTION_MODE(5i32); impl ::core::convert::From<i32> for WLAN_CONNECTION_MODE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_CONNECTION_MODE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WLAN_CONNECTION_NOTIFICATION_DATA { pub wlanConnectionMode: WLAN_CONNECTION_MODE, pub strProfileName: [u16; 256], pub dot11Ssid: DOT11_SSID, pub dot11BssType: DOT11_BSS_TYPE, pub bSecurityEnabled: super::super::Foundation::BOOL, pub wlanReasonCode: u32, pub dwFlags: WLAN_CONNECTION_NOTIFICATION_FLAGS, pub strProfileXml: [u16; 1], } #[cfg(feature = "Win32_Foundation")] impl WLAN_CONNECTION_NOTIFICATION_DATA {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for WLAN_CONNECTION_NOTIFICATION_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for WLAN_CONNECTION_NOTIFICATION_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_CONNECTION_NOTIFICATION_DATA") .field("wlanConnectionMode", &self.wlanConnectionMode) .field("strProfileName", &self.strProfileName) .field("dot11Ssid", &self.dot11Ssid) .field("dot11BssType", &self.dot11BssType) .field("bSecurityEnabled", &self.bSecurityEnabled) .field("wlanReasonCode", &self.wlanReasonCode) .field("dwFlags", &self.dwFlags) .field("strProfileXml", &self.strProfileXml) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for WLAN_CONNECTION_NOTIFICATION_DATA { fn eq(&self, other: &Self) -> bool { self.wlanConnectionMode == other.wlanConnectionMode && self.strProfileName == other.strProfileName && self.dot11Ssid == other.dot11Ssid && self.dot11BssType == other.dot11BssType && self.bSecurityEnabled == other.bSecurityEnabled && self.wlanReasonCode == other.wlanReasonCode && self.dwFlags == other.dwFlags && self.strProfileXml == other.strProfileXml } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for WLAN_CONNECTION_NOTIFICATION_DATA {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for WLAN_CONNECTION_NOTIFICATION_DATA { 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 WLAN_CONNECTION_NOTIFICATION_FLAGS(pub u32); pub const WLAN_CONNECTION_NOTIFICATION_ADHOC_NETWORK_FORMED: WLAN_CONNECTION_NOTIFICATION_FLAGS = WLAN_CONNECTION_NOTIFICATION_FLAGS(1u32); pub const WLAN_CONNECTION_NOTIFICATION_CONSOLE_USER_PROFILE: WLAN_CONNECTION_NOTIFICATION_FLAGS = WLAN_CONNECTION_NOTIFICATION_FLAGS(4u32); impl ::core::convert::From<u32> for WLAN_CONNECTION_NOTIFICATION_FLAGS { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_CONNECTION_NOTIFICATION_FLAGS { type Abi = Self; } impl ::core::ops::BitOr for WLAN_CONNECTION_NOTIFICATION_FLAGS { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for WLAN_CONNECTION_NOTIFICATION_FLAGS { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for WLAN_CONNECTION_NOTIFICATION_FLAGS { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for WLAN_CONNECTION_NOTIFICATION_FLAGS { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for WLAN_CONNECTION_NOTIFICATION_FLAGS { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct WLAN_CONNECTION_PARAMETERS { pub wlanConnectionMode: WLAN_CONNECTION_MODE, pub strProfile: super::super::Foundation::PWSTR, pub pDot11Ssid: *mut DOT11_SSID, pub pDesiredBssidList: *mut DOT11_BSSID_LIST, pub dot11BssType: DOT11_BSS_TYPE, pub dwFlags: u32, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl WLAN_CONNECTION_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for WLAN_CONNECTION_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for WLAN_CONNECTION_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_CONNECTION_PARAMETERS") .field("wlanConnectionMode", &self.wlanConnectionMode) .field("strProfile", &self.strProfile) .field("pDot11Ssid", &self.pDot11Ssid) .field("pDesiredBssidList", &self.pDesiredBssidList) .field("dot11BssType", &self.dot11BssType) .field("dwFlags", &self.dwFlags) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for WLAN_CONNECTION_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.wlanConnectionMode == other.wlanConnectionMode && self.strProfile == other.strProfile && self.pDot11Ssid == other.pDot11Ssid && self.pDesiredBssidList == other.pDesiredBssidList && self.dot11BssType == other.dot11BssType && self.dwFlags == other.dwFlags } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for WLAN_CONNECTION_PARAMETERS {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for WLAN_CONNECTION_PARAMETERS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] pub struct WLAN_CONNECTION_PARAMETERS_V2 { pub wlanConnectionMode: WLAN_CONNECTION_MODE, pub strProfile: super::super::Foundation::PWSTR, pub pDot11Ssid: *mut DOT11_SSID, pub pDot11Hessid: *mut u8, pub pDesiredBssidList: *mut DOT11_BSSID_LIST, pub dot11BssType: DOT11_BSS_TYPE, pub dwFlags: u32, pub pDot11AccessNetworkOptions: *mut DOT11_ACCESSNETWORKOPTIONS, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl WLAN_CONNECTION_PARAMETERS_V2 {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::default::Default for WLAN_CONNECTION_PARAMETERS_V2 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::fmt::Debug for WLAN_CONNECTION_PARAMETERS_V2 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_CONNECTION_PARAMETERS_V2") .field("wlanConnectionMode", &self.wlanConnectionMode) .field("strProfile", &self.strProfile) .field("pDot11Ssid", &self.pDot11Ssid) .field("pDot11Hessid", &self.pDot11Hessid) .field("pDesiredBssidList", &self.pDesiredBssidList) .field("dot11BssType", &self.dot11BssType) .field("dwFlags", &self.dwFlags) .field("pDot11AccessNetworkOptions", &self.pDot11AccessNetworkOptions) .finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::PartialEq for WLAN_CONNECTION_PARAMETERS_V2 { fn eq(&self, other: &Self) -> bool { self.wlanConnectionMode == other.wlanConnectionMode && self.strProfile == other.strProfile && self.pDot11Ssid == other.pDot11Ssid && self.pDot11Hessid == other.pDot11Hessid && self.pDesiredBssidList == other.pDesiredBssidList && self.dot11BssType == other.dot11BssType && self.dwFlags == other.dwFlags && self.pDot11AccessNetworkOptions == other.pDot11AccessNetworkOptions } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] impl ::core::cmp::Eq for WLAN_CONNECTION_PARAMETERS_V2 {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] unsafe impl ::windows::core::Abi for WLAN_CONNECTION_PARAMETERS_V2 { type Abi = Self; } pub const WLAN_CONNECTION_PERSIST_DISCOVERY_PROFILE: u32 = 16u32; pub const WLAN_CONNECTION_PERSIST_DISCOVERY_PROFILE_CONNECTION_MODE_AUTO: u32 = 32u32; pub const WLAN_CONNECTION_PERSIST_DISCOVERY_PROFILE_OVERWRITE_EXISTING: u32 = 64u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_COUNTRY_OR_REGION_STRING_LIST { pub dwNumberOfItems: u32, pub pCountryOrRegionStringList: [u8; 3], } impl WLAN_COUNTRY_OR_REGION_STRING_LIST {} impl ::core::default::Default for WLAN_COUNTRY_OR_REGION_STRING_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_COUNTRY_OR_REGION_STRING_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_COUNTRY_OR_REGION_STRING_LIST").field("dwNumberOfItems", &self.dwNumberOfItems).field("pCountryOrRegionStringList", &self.pCountryOrRegionStringList).finish() } } impl ::core::cmp::PartialEq for WLAN_COUNTRY_OR_REGION_STRING_LIST { fn eq(&self, other: &Self) -> bool { self.dwNumberOfItems == other.dwNumberOfItems && self.pCountryOrRegionStringList == other.pCountryOrRegionStringList } } impl ::core::cmp::Eq for WLAN_COUNTRY_OR_REGION_STRING_LIST {} unsafe impl ::windows::core::Abi for WLAN_COUNTRY_OR_REGION_STRING_LIST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_DEVICE_SERVICE_GUID_LIST { pub dwNumberOfItems: u32, pub dwIndex: u32, pub DeviceService: [::windows::core::GUID; 1], } impl WLAN_DEVICE_SERVICE_GUID_LIST {} impl ::core::default::Default for WLAN_DEVICE_SERVICE_GUID_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_DEVICE_SERVICE_GUID_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_DEVICE_SERVICE_GUID_LIST").field("dwNumberOfItems", &self.dwNumberOfItems).field("dwIndex", &self.dwIndex).field("DeviceService", &self.DeviceService).finish() } } impl ::core::cmp::PartialEq for WLAN_DEVICE_SERVICE_GUID_LIST { fn eq(&self, other: &Self) -> bool { self.dwNumberOfItems == other.dwNumberOfItems && self.dwIndex == other.dwIndex && self.DeviceService == other.DeviceService } } impl ::core::cmp::Eq for WLAN_DEVICE_SERVICE_GUID_LIST {} unsafe impl ::windows::core::Abi for WLAN_DEVICE_SERVICE_GUID_LIST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_DEVICE_SERVICE_NOTIFICATION_DATA { pub DeviceService: ::windows::core::GUID, pub dwOpCode: u32, pub dwDataSize: u32, pub DataBlob: [u8; 1], } impl WLAN_DEVICE_SERVICE_NOTIFICATION_DATA {} impl ::core::default::Default for WLAN_DEVICE_SERVICE_NOTIFICATION_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_DEVICE_SERVICE_NOTIFICATION_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_DEVICE_SERVICE_NOTIFICATION_DATA").field("DeviceService", &self.DeviceService).field("dwOpCode", &self.dwOpCode).field("dwDataSize", &self.dwDataSize).field("DataBlob", &self.DataBlob).finish() } } impl ::core::cmp::PartialEq for WLAN_DEVICE_SERVICE_NOTIFICATION_DATA { fn eq(&self, other: &Self) -> bool { self.DeviceService == other.DeviceService && self.dwOpCode == other.dwOpCode && self.dwDataSize == other.dwDataSize && self.DataBlob == other.DataBlob } } impl ::core::cmp::Eq for WLAN_DEVICE_SERVICE_NOTIFICATION_DATA {} unsafe impl ::windows::core::Abi for WLAN_DEVICE_SERVICE_NOTIFICATION_DATA { 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 WLAN_FILTER_LIST_TYPE(pub i32); pub const wlan_filter_list_type_gp_permit: WLAN_FILTER_LIST_TYPE = WLAN_FILTER_LIST_TYPE(0i32); pub const wlan_filter_list_type_gp_deny: WLAN_FILTER_LIST_TYPE = WLAN_FILTER_LIST_TYPE(1i32); pub const wlan_filter_list_type_user_permit: WLAN_FILTER_LIST_TYPE = WLAN_FILTER_LIST_TYPE(2i32); pub const wlan_filter_list_type_user_deny: WLAN_FILTER_LIST_TYPE = WLAN_FILTER_LIST_TYPE(3i32); impl ::core::convert::From<i32> for WLAN_FILTER_LIST_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_FILTER_LIST_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS { pub hostedNetworkSSID: DOT11_SSID, pub dwMaxNumberOfPeers: u32, } impl WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS {} impl ::core::default::Default for WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS").field("hostedNetworkSSID", &self.hostedNetworkSSID).field("dwMaxNumberOfPeers", &self.dwMaxNumberOfPeers).finish() } } impl ::core::cmp::PartialEq for WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS { fn eq(&self, other: &Self) -> bool { self.hostedNetworkSSID == other.hostedNetworkSSID && self.dwMaxNumberOfPeers == other.dwMaxNumberOfPeers } } impl ::core::cmp::Eq for WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS {} unsafe impl ::windows::core::Abi for WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_HOSTED_NETWORK_DATA_PEER_STATE_CHANGE { pub OldState: WLAN_HOSTED_NETWORK_PEER_STATE, pub NewState: WLAN_HOSTED_NETWORK_PEER_STATE, pub PeerStateChangeReason: WLAN_HOSTED_NETWORK_REASON, } impl WLAN_HOSTED_NETWORK_DATA_PEER_STATE_CHANGE {} impl ::core::default::Default for WLAN_HOSTED_NETWORK_DATA_PEER_STATE_CHANGE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_HOSTED_NETWORK_DATA_PEER_STATE_CHANGE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_HOSTED_NETWORK_DATA_PEER_STATE_CHANGE").field("OldState", &self.OldState).field("NewState", &self.NewState).field("PeerStateChangeReason", &self.PeerStateChangeReason).finish() } } impl ::core::cmp::PartialEq for WLAN_HOSTED_NETWORK_DATA_PEER_STATE_CHANGE { fn eq(&self, other: &Self) -> bool { self.OldState == other.OldState && self.NewState == other.NewState && self.PeerStateChangeReason == other.PeerStateChangeReason } } impl ::core::cmp::Eq for WLAN_HOSTED_NETWORK_DATA_PEER_STATE_CHANGE {} unsafe impl ::windows::core::Abi for WLAN_HOSTED_NETWORK_DATA_PEER_STATE_CHANGE { 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 WLAN_HOSTED_NETWORK_NOTIFICATION_CODE(pub i32); pub const wlan_hosted_network_state_change: WLAN_HOSTED_NETWORK_NOTIFICATION_CODE = WLAN_HOSTED_NETWORK_NOTIFICATION_CODE(4096i32); pub const wlan_hosted_network_peer_state_change: WLAN_HOSTED_NETWORK_NOTIFICATION_CODE = WLAN_HOSTED_NETWORK_NOTIFICATION_CODE(4097i32); pub const wlan_hosted_network_radio_state_change: WLAN_HOSTED_NETWORK_NOTIFICATION_CODE = WLAN_HOSTED_NETWORK_NOTIFICATION_CODE(4098i32); impl ::core::convert::From<i32> for WLAN_HOSTED_NETWORK_NOTIFICATION_CODE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_HOSTED_NETWORK_NOTIFICATION_CODE { 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 WLAN_HOSTED_NETWORK_OPCODE(pub i32); pub const wlan_hosted_network_opcode_connection_settings: WLAN_HOSTED_NETWORK_OPCODE = WLAN_HOSTED_NETWORK_OPCODE(0i32); pub const wlan_hosted_network_opcode_security_settings: WLAN_HOSTED_NETWORK_OPCODE = WLAN_HOSTED_NETWORK_OPCODE(1i32); pub const wlan_hosted_network_opcode_station_profile: WLAN_HOSTED_NETWORK_OPCODE = WLAN_HOSTED_NETWORK_OPCODE(2i32); pub const wlan_hosted_network_opcode_enable: WLAN_HOSTED_NETWORK_OPCODE = WLAN_HOSTED_NETWORK_OPCODE(3i32); impl ::core::convert::From<i32> for WLAN_HOSTED_NETWORK_OPCODE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_HOSTED_NETWORK_OPCODE { 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 WLAN_HOSTED_NETWORK_PEER_AUTH_STATE(pub i32); pub const wlan_hosted_network_peer_state_invalid: WLAN_HOSTED_NETWORK_PEER_AUTH_STATE = WLAN_HOSTED_NETWORK_PEER_AUTH_STATE(0i32); pub const wlan_hosted_network_peer_state_authenticated: WLAN_HOSTED_NETWORK_PEER_AUTH_STATE = WLAN_HOSTED_NETWORK_PEER_AUTH_STATE(1i32); impl ::core::convert::From<i32> for WLAN_HOSTED_NETWORK_PEER_AUTH_STATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_HOSTED_NETWORK_PEER_AUTH_STATE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_HOSTED_NETWORK_PEER_STATE { pub PeerMacAddress: [u8; 6], pub PeerAuthState: WLAN_HOSTED_NETWORK_PEER_AUTH_STATE, } impl WLAN_HOSTED_NETWORK_PEER_STATE {} impl ::core::default::Default for WLAN_HOSTED_NETWORK_PEER_STATE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_HOSTED_NETWORK_PEER_STATE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_HOSTED_NETWORK_PEER_STATE").field("PeerMacAddress", &self.PeerMacAddress).field("PeerAuthState", &self.PeerAuthState).finish() } } impl ::core::cmp::PartialEq for WLAN_HOSTED_NETWORK_PEER_STATE { fn eq(&self, other: &Self) -> bool { self.PeerMacAddress == other.PeerMacAddress && self.PeerAuthState == other.PeerAuthState } } impl ::core::cmp::Eq for WLAN_HOSTED_NETWORK_PEER_STATE {} unsafe impl ::windows::core::Abi for WLAN_HOSTED_NETWORK_PEER_STATE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_HOSTED_NETWORK_RADIO_STATE { pub dot11SoftwareRadioState: DOT11_RADIO_STATE, pub dot11HardwareRadioState: DOT11_RADIO_STATE, } impl WLAN_HOSTED_NETWORK_RADIO_STATE {} impl ::core::default::Default for WLAN_HOSTED_NETWORK_RADIO_STATE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_HOSTED_NETWORK_RADIO_STATE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_HOSTED_NETWORK_RADIO_STATE").field("dot11SoftwareRadioState", &self.dot11SoftwareRadioState).field("dot11HardwareRadioState", &self.dot11HardwareRadioState).finish() } } impl ::core::cmp::PartialEq for WLAN_HOSTED_NETWORK_RADIO_STATE { fn eq(&self, other: &Self) -> bool { self.dot11SoftwareRadioState == other.dot11SoftwareRadioState && self.dot11HardwareRadioState == other.dot11HardwareRadioState } } impl ::core::cmp::Eq for WLAN_HOSTED_NETWORK_RADIO_STATE {} unsafe impl ::windows::core::Abi for WLAN_HOSTED_NETWORK_RADIO_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 WLAN_HOSTED_NETWORK_REASON(pub i32); pub const wlan_hosted_network_reason_success: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(0i32); pub const wlan_hosted_network_reason_unspecified: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(1i32); pub const wlan_hosted_network_reason_bad_parameters: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(2i32); pub const wlan_hosted_network_reason_service_shutting_down: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(3i32); pub const wlan_hosted_network_reason_insufficient_resources: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(4i32); pub const wlan_hosted_network_reason_elevation_required: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(5i32); pub const wlan_hosted_network_reason_read_only: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(6i32); pub const wlan_hosted_network_reason_persistence_failed: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(7i32); pub const wlan_hosted_network_reason_crypt_error: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(8i32); pub const wlan_hosted_network_reason_impersonation: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(9i32); pub const wlan_hosted_network_reason_stop_before_start: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(10i32); pub const wlan_hosted_network_reason_interface_available: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(11i32); pub const wlan_hosted_network_reason_interface_unavailable: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(12i32); pub const wlan_hosted_network_reason_miniport_stopped: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(13i32); pub const wlan_hosted_network_reason_miniport_started: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(14i32); pub const wlan_hosted_network_reason_incompatible_connection_started: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(15i32); pub const wlan_hosted_network_reason_incompatible_connection_stopped: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(16i32); pub const wlan_hosted_network_reason_user_action: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(17i32); pub const wlan_hosted_network_reason_client_abort: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(18i32); pub const wlan_hosted_network_reason_ap_start_failed: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(19i32); pub const wlan_hosted_network_reason_peer_arrived: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(20i32); pub const wlan_hosted_network_reason_peer_departed: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(21i32); pub const wlan_hosted_network_reason_peer_timeout: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(22i32); pub const wlan_hosted_network_reason_gp_denied: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(23i32); pub const wlan_hosted_network_reason_service_unavailable: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(24i32); pub const wlan_hosted_network_reason_device_change: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(25i32); pub const wlan_hosted_network_reason_properties_change: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(26i32); pub const wlan_hosted_network_reason_virtual_station_blocking_use: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(27i32); pub const wlan_hosted_network_reason_service_available_on_virtual_station: WLAN_HOSTED_NETWORK_REASON = WLAN_HOSTED_NETWORK_REASON(28i32); impl ::core::convert::From<i32> for WLAN_HOSTED_NETWORK_REASON { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_HOSTED_NETWORK_REASON { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_HOSTED_NETWORK_SECURITY_SETTINGS { pub dot11AuthAlgo: DOT11_AUTH_ALGORITHM, pub dot11CipherAlgo: DOT11_CIPHER_ALGORITHM, } impl WLAN_HOSTED_NETWORK_SECURITY_SETTINGS {} impl ::core::default::Default for WLAN_HOSTED_NETWORK_SECURITY_SETTINGS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_HOSTED_NETWORK_SECURITY_SETTINGS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_HOSTED_NETWORK_SECURITY_SETTINGS").field("dot11AuthAlgo", &self.dot11AuthAlgo).field("dot11CipherAlgo", &self.dot11CipherAlgo).finish() } } impl ::core::cmp::PartialEq for WLAN_HOSTED_NETWORK_SECURITY_SETTINGS { fn eq(&self, other: &Self) -> bool { self.dot11AuthAlgo == other.dot11AuthAlgo && self.dot11CipherAlgo == other.dot11CipherAlgo } } impl ::core::cmp::Eq for WLAN_HOSTED_NETWORK_SECURITY_SETTINGS {} unsafe impl ::windows::core::Abi for WLAN_HOSTED_NETWORK_SECURITY_SETTINGS { 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 WLAN_HOSTED_NETWORK_STATE(pub i32); pub const wlan_hosted_network_unavailable: WLAN_HOSTED_NETWORK_STATE = WLAN_HOSTED_NETWORK_STATE(0i32); pub const wlan_hosted_network_idle: WLAN_HOSTED_NETWORK_STATE = WLAN_HOSTED_NETWORK_STATE(1i32); pub const wlan_hosted_network_active: WLAN_HOSTED_NETWORK_STATE = WLAN_HOSTED_NETWORK_STATE(2i32); impl ::core::convert::From<i32> for WLAN_HOSTED_NETWORK_STATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_HOSTED_NETWORK_STATE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_HOSTED_NETWORK_STATE_CHANGE { pub OldState: WLAN_HOSTED_NETWORK_STATE, pub NewState: WLAN_HOSTED_NETWORK_STATE, pub StateChangeReason: WLAN_HOSTED_NETWORK_REASON, } impl WLAN_HOSTED_NETWORK_STATE_CHANGE {} impl ::core::default::Default for WLAN_HOSTED_NETWORK_STATE_CHANGE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_HOSTED_NETWORK_STATE_CHANGE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_HOSTED_NETWORK_STATE_CHANGE").field("OldState", &self.OldState).field("NewState", &self.NewState).field("StateChangeReason", &self.StateChangeReason).finish() } } impl ::core::cmp::PartialEq for WLAN_HOSTED_NETWORK_STATE_CHANGE { fn eq(&self, other: &Self) -> bool { self.OldState == other.OldState && self.NewState == other.NewState && self.StateChangeReason == other.StateChangeReason } } impl ::core::cmp::Eq for WLAN_HOSTED_NETWORK_STATE_CHANGE {} unsafe impl ::windows::core::Abi for WLAN_HOSTED_NETWORK_STATE_CHANGE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_HOSTED_NETWORK_STATUS { pub HostedNetworkState: WLAN_HOSTED_NETWORK_STATE, pub IPDeviceID: ::windows::core::GUID, pub wlanHostedNetworkBSSID: [u8; 6], pub dot11PhyType: DOT11_PHY_TYPE, pub ulChannelFrequency: u32, pub dwNumberOfPeers: u32, pub PeerList: [WLAN_HOSTED_NETWORK_PEER_STATE; 1], } impl WLAN_HOSTED_NETWORK_STATUS {} impl ::core::default::Default for WLAN_HOSTED_NETWORK_STATUS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_HOSTED_NETWORK_STATUS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_HOSTED_NETWORK_STATUS") .field("HostedNetworkState", &self.HostedNetworkState) .field("IPDeviceID", &self.IPDeviceID) .field("wlanHostedNetworkBSSID", &self.wlanHostedNetworkBSSID) .field("dot11PhyType", &self.dot11PhyType) .field("ulChannelFrequency", &self.ulChannelFrequency) .field("dwNumberOfPeers", &self.dwNumberOfPeers) .field("PeerList", &self.PeerList) .finish() } } impl ::core::cmp::PartialEq for WLAN_HOSTED_NETWORK_STATUS { fn eq(&self, other: &Self) -> bool { self.HostedNetworkState == other.HostedNetworkState && self.IPDeviceID == other.IPDeviceID && self.wlanHostedNetworkBSSID == other.wlanHostedNetworkBSSID && self.dot11PhyType == other.dot11PhyType && self.ulChannelFrequency == other.ulChannelFrequency && self.dwNumberOfPeers == other.dwNumberOfPeers && self.PeerList == other.PeerList } } impl ::core::cmp::Eq for WLAN_HOSTED_NETWORK_STATUS {} unsafe impl ::windows::core::Abi for WLAN_HOSTED_NETWORK_STATUS { 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 WLAN_IHV_CONTROL_TYPE(pub i32); pub const wlan_ihv_control_type_service: WLAN_IHV_CONTROL_TYPE = WLAN_IHV_CONTROL_TYPE(0i32); pub const wlan_ihv_control_type_driver: WLAN_IHV_CONTROL_TYPE = WLAN_IHV_CONTROL_TYPE(1i32); impl ::core::convert::From<i32> for WLAN_IHV_CONTROL_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_IHV_CONTROL_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WLAN_INTERFACE_CAPABILITY { pub interfaceType: WLAN_INTERFACE_TYPE, pub bDot11DSupported: super::super::Foundation::BOOL, pub dwMaxDesiredSsidListSize: u32, pub dwMaxDesiredBssidListSize: u32, pub dwNumberOfSupportedPhys: u32, pub dot11PhyTypes: [DOT11_PHY_TYPE; 64], } #[cfg(feature = "Win32_Foundation")] impl WLAN_INTERFACE_CAPABILITY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for WLAN_INTERFACE_CAPABILITY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for WLAN_INTERFACE_CAPABILITY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_INTERFACE_CAPABILITY") .field("interfaceType", &self.interfaceType) .field("bDot11DSupported", &self.bDot11DSupported) .field("dwMaxDesiredSsidListSize", &self.dwMaxDesiredSsidListSize) .field("dwMaxDesiredBssidListSize", &self.dwMaxDesiredBssidListSize) .field("dwNumberOfSupportedPhys", &self.dwNumberOfSupportedPhys) .field("dot11PhyTypes", &self.dot11PhyTypes) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for WLAN_INTERFACE_CAPABILITY { fn eq(&self, other: &Self) -> bool { self.interfaceType == other.interfaceType && self.bDot11DSupported == other.bDot11DSupported && self.dwMaxDesiredSsidListSize == other.dwMaxDesiredSsidListSize && self.dwMaxDesiredBssidListSize == other.dwMaxDesiredBssidListSize && self.dwNumberOfSupportedPhys == other.dwNumberOfSupportedPhys && self.dot11PhyTypes == other.dot11PhyTypes } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for WLAN_INTERFACE_CAPABILITY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for WLAN_INTERFACE_CAPABILITY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_INTERFACE_INFO { pub InterfaceGuid: ::windows::core::GUID, pub strInterfaceDescription: [u16; 256], pub isState: WLAN_INTERFACE_STATE, } impl WLAN_INTERFACE_INFO {} impl ::core::default::Default for WLAN_INTERFACE_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_INTERFACE_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_INTERFACE_INFO").field("InterfaceGuid", &self.InterfaceGuid).field("strInterfaceDescription", &self.strInterfaceDescription).field("isState", &self.isState).finish() } } impl ::core::cmp::PartialEq for WLAN_INTERFACE_INFO { fn eq(&self, other: &Self) -> bool { self.InterfaceGuid == other.InterfaceGuid && self.strInterfaceDescription == other.strInterfaceDescription && self.isState == other.isState } } impl ::core::cmp::Eq for WLAN_INTERFACE_INFO {} unsafe impl ::windows::core::Abi for WLAN_INTERFACE_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_INTERFACE_INFO_LIST { pub dwNumberOfItems: u32, pub dwIndex: u32, pub InterfaceInfo: [WLAN_INTERFACE_INFO; 1], } impl WLAN_INTERFACE_INFO_LIST {} impl ::core::default::Default for WLAN_INTERFACE_INFO_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_INTERFACE_INFO_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_INTERFACE_INFO_LIST").field("dwNumberOfItems", &self.dwNumberOfItems).field("dwIndex", &self.dwIndex).field("InterfaceInfo", &self.InterfaceInfo).finish() } } impl ::core::cmp::PartialEq for WLAN_INTERFACE_INFO_LIST { fn eq(&self, other: &Self) -> bool { self.dwNumberOfItems == other.dwNumberOfItems && self.dwIndex == other.dwIndex && self.InterfaceInfo == other.InterfaceInfo } } impl ::core::cmp::Eq for WLAN_INTERFACE_INFO_LIST {} unsafe impl ::windows::core::Abi for WLAN_INTERFACE_INFO_LIST { 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 WLAN_INTERFACE_STATE(pub i32); pub const wlan_interface_state_not_ready: WLAN_INTERFACE_STATE = WLAN_INTERFACE_STATE(0i32); pub const wlan_interface_state_connected: WLAN_INTERFACE_STATE = WLAN_INTERFACE_STATE(1i32); pub const wlan_interface_state_ad_hoc_network_formed: WLAN_INTERFACE_STATE = WLAN_INTERFACE_STATE(2i32); pub const wlan_interface_state_disconnecting: WLAN_INTERFACE_STATE = WLAN_INTERFACE_STATE(3i32); pub const wlan_interface_state_disconnected: WLAN_INTERFACE_STATE = WLAN_INTERFACE_STATE(4i32); pub const wlan_interface_state_associating: WLAN_INTERFACE_STATE = WLAN_INTERFACE_STATE(5i32); pub const wlan_interface_state_discovering: WLAN_INTERFACE_STATE = WLAN_INTERFACE_STATE(6i32); pub const wlan_interface_state_authenticating: WLAN_INTERFACE_STATE = WLAN_INTERFACE_STATE(7i32); impl ::core::convert::From<i32> for WLAN_INTERFACE_STATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_INTERFACE_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 WLAN_INTERFACE_TYPE(pub i32); pub const wlan_interface_type_emulated_802_11: WLAN_INTERFACE_TYPE = WLAN_INTERFACE_TYPE(0i32); pub const wlan_interface_type_native_802_11: WLAN_INTERFACE_TYPE = WLAN_INTERFACE_TYPE(1i32); pub const wlan_interface_type_invalid: WLAN_INTERFACE_TYPE = WLAN_INTERFACE_TYPE(2i32); impl ::core::convert::From<i32> for WLAN_INTERFACE_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_INTERFACE_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 WLAN_INTF_OPCODE(pub i32); pub const wlan_intf_opcode_autoconf_start: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(0i32); pub const wlan_intf_opcode_autoconf_enabled: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(1i32); pub const wlan_intf_opcode_background_scan_enabled: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(2i32); pub const wlan_intf_opcode_media_streaming_mode: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(3i32); pub const wlan_intf_opcode_radio_state: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(4i32); pub const wlan_intf_opcode_bss_type: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(5i32); pub const wlan_intf_opcode_interface_state: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(6i32); pub const wlan_intf_opcode_current_connection: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(7i32); pub const wlan_intf_opcode_channel_number: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(8i32); pub const wlan_intf_opcode_supported_infrastructure_auth_cipher_pairs: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(9i32); pub const wlan_intf_opcode_supported_adhoc_auth_cipher_pairs: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(10i32); pub const wlan_intf_opcode_supported_country_or_region_string_list: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(11i32); pub const wlan_intf_opcode_current_operation_mode: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(12i32); pub const wlan_intf_opcode_supported_safe_mode: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(13i32); pub const wlan_intf_opcode_certified_safe_mode: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(14i32); pub const wlan_intf_opcode_hosted_network_capable: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(15i32); pub const wlan_intf_opcode_management_frame_protection_capable: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(16i32); pub const wlan_intf_opcode_secondary_sta_interfaces: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(17i32); pub const wlan_intf_opcode_secondary_sta_synchronized_connections: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(18i32); pub const wlan_intf_opcode_autoconf_end: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(268435455i32); pub const wlan_intf_opcode_msm_start: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(268435712i32); pub const wlan_intf_opcode_statistics: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(268435713i32); pub const wlan_intf_opcode_rssi: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(268435714i32); pub const wlan_intf_opcode_msm_end: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(536870911i32); pub const wlan_intf_opcode_security_start: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(536936448i32); pub const wlan_intf_opcode_security_end: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(805306367i32); pub const wlan_intf_opcode_ihv_start: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(805306368i32); pub const wlan_intf_opcode_ihv_end: WLAN_INTF_OPCODE = WLAN_INTF_OPCODE(1073741823i32); impl ::core::convert::From<i32> for WLAN_INTF_OPCODE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_INTF_OPCODE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_MAC_FRAME_STATISTICS { pub ullTransmittedFrameCount: u64, pub ullReceivedFrameCount: u64, pub ullWEPExcludedCount: u64, pub ullTKIPLocalMICFailures: u64, pub ullTKIPReplays: u64, pub ullTKIPICVErrorCount: u64, pub ullCCMPReplays: u64, pub ullCCMPDecryptErrors: u64, pub ullWEPUndecryptableCount: u64, pub ullWEPICVErrorCount: u64, pub ullDecryptSuccessCount: u64, pub ullDecryptFailureCount: u64, } impl WLAN_MAC_FRAME_STATISTICS {} impl ::core::default::Default for WLAN_MAC_FRAME_STATISTICS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_MAC_FRAME_STATISTICS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_MAC_FRAME_STATISTICS") .field("ullTransmittedFrameCount", &self.ullTransmittedFrameCount) .field("ullReceivedFrameCount", &self.ullReceivedFrameCount) .field("ullWEPExcludedCount", &self.ullWEPExcludedCount) .field("ullTKIPLocalMICFailures", &self.ullTKIPLocalMICFailures) .field("ullTKIPReplays", &self.ullTKIPReplays) .field("ullTKIPICVErrorCount", &self.ullTKIPICVErrorCount) .field("ullCCMPReplays", &self.ullCCMPReplays) .field("ullCCMPDecryptErrors", &self.ullCCMPDecryptErrors) .field("ullWEPUndecryptableCount", &self.ullWEPUndecryptableCount) .field("ullWEPICVErrorCount", &self.ullWEPICVErrorCount) .field("ullDecryptSuccessCount", &self.ullDecryptSuccessCount) .field("ullDecryptFailureCount", &self.ullDecryptFailureCount) .finish() } } impl ::core::cmp::PartialEq for WLAN_MAC_FRAME_STATISTICS { fn eq(&self, other: &Self) -> bool { self.ullTransmittedFrameCount == other.ullTransmittedFrameCount && self.ullReceivedFrameCount == other.ullReceivedFrameCount && self.ullWEPExcludedCount == other.ullWEPExcludedCount && self.ullTKIPLocalMICFailures == other.ullTKIPLocalMICFailures && self.ullTKIPReplays == other.ullTKIPReplays && self.ullTKIPICVErrorCount == other.ullTKIPICVErrorCount && self.ullCCMPReplays == other.ullCCMPReplays && self.ullCCMPDecryptErrors == other.ullCCMPDecryptErrors && self.ullWEPUndecryptableCount == other.ullWEPUndecryptableCount && self.ullWEPICVErrorCount == other.ullWEPICVErrorCount && self.ullDecryptSuccessCount == other.ullDecryptSuccessCount && self.ullDecryptFailureCount == other.ullDecryptFailureCount } } impl ::core::cmp::Eq for WLAN_MAC_FRAME_STATISTICS {} unsafe impl ::windows::core::Abi for WLAN_MAC_FRAME_STATISTICS { type Abi = Self; } pub const WLAN_MAX_NAME_LENGTH: u32 = 256u32; pub const WLAN_MAX_PHY_INDEX: u32 = 64u32; pub const WLAN_MAX_PHY_TYPE_NUMBER: u32 = 8u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WLAN_MSM_NOTIFICATION_DATA { pub wlanConnectionMode: WLAN_CONNECTION_MODE, pub strProfileName: [u16; 256], pub dot11Ssid: DOT11_SSID, pub dot11BssType: DOT11_BSS_TYPE, pub dot11MacAddr: [u8; 6], pub bSecurityEnabled: super::super::Foundation::BOOL, pub bFirstPeer: super::super::Foundation::BOOL, pub bLastPeer: super::super::Foundation::BOOL, pub wlanReasonCode: u32, } #[cfg(feature = "Win32_Foundation")] impl WLAN_MSM_NOTIFICATION_DATA {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for WLAN_MSM_NOTIFICATION_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for WLAN_MSM_NOTIFICATION_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_MSM_NOTIFICATION_DATA") .field("wlanConnectionMode", &self.wlanConnectionMode) .field("strProfileName", &self.strProfileName) .field("dot11Ssid", &self.dot11Ssid) .field("dot11BssType", &self.dot11BssType) .field("dot11MacAddr", &self.dot11MacAddr) .field("bSecurityEnabled", &self.bSecurityEnabled) .field("bFirstPeer", &self.bFirstPeer) .field("bLastPeer", &self.bLastPeer) .field("wlanReasonCode", &self.wlanReasonCode) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for WLAN_MSM_NOTIFICATION_DATA { fn eq(&self, other: &Self) -> bool { self.wlanConnectionMode == other.wlanConnectionMode && self.strProfileName == other.strProfileName && self.dot11Ssid == other.dot11Ssid && self.dot11BssType == other.dot11BssType && self.dot11MacAddr == other.dot11MacAddr && self.bSecurityEnabled == other.bSecurityEnabled && self.bFirstPeer == other.bFirstPeer && self.bLastPeer == other.bLastPeer && self.wlanReasonCode == other.wlanReasonCode } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for WLAN_MSM_NOTIFICATION_DATA {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for WLAN_MSM_NOTIFICATION_DATA { 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 WLAN_NOTIFICATION_ACM(pub i32); pub const wlan_notification_acm_start: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(0i32); pub const wlan_notification_acm_autoconf_enabled: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(1i32); pub const wlan_notification_acm_autoconf_disabled: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(2i32); pub const wlan_notification_acm_background_scan_enabled: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(3i32); pub const wlan_notification_acm_background_scan_disabled: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(4i32); pub const wlan_notification_acm_bss_type_change: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(5i32); pub const wlan_notification_acm_power_setting_change: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(6i32); pub const wlan_notification_acm_scan_complete: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(7i32); pub const wlan_notification_acm_scan_fail: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(8i32); pub const wlan_notification_acm_connection_start: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(9i32); pub const wlan_notification_acm_connection_complete: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(10i32); pub const wlan_notification_acm_connection_attempt_fail: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(11i32); pub const wlan_notification_acm_filter_list_change: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(12i32); pub const wlan_notification_acm_interface_arrival: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(13i32); pub const wlan_notification_acm_interface_removal: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(14i32); pub const wlan_notification_acm_profile_change: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(15i32); pub const wlan_notification_acm_profile_name_change: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(16i32); pub const wlan_notification_acm_profiles_exhausted: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(17i32); pub const wlan_notification_acm_network_not_available: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(18i32); pub const wlan_notification_acm_network_available: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(19i32); pub const wlan_notification_acm_disconnecting: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(20i32); pub const wlan_notification_acm_disconnected: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(21i32); pub const wlan_notification_acm_adhoc_network_state_change: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(22i32); pub const wlan_notification_acm_profile_unblocked: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(23i32); pub const wlan_notification_acm_screen_power_change: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(24i32); pub const wlan_notification_acm_profile_blocked: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(25i32); pub const wlan_notification_acm_scan_list_refresh: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(26i32); pub const wlan_notification_acm_operational_state_change: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(27i32); pub const wlan_notification_acm_end: WLAN_NOTIFICATION_ACM = WLAN_NOTIFICATION_ACM(28i32); impl ::core::convert::From<i32> for WLAN_NOTIFICATION_ACM { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_NOTIFICATION_ACM { type Abi = Self; } pub type WLAN_NOTIFICATION_CALLBACK = unsafe extern "system" fn(param0: *mut L2_NOTIFICATION_DATA, param1: *mut ::core::ffi::c_void); #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WLAN_NOTIFICATION_MSM(pub i32); pub const wlan_notification_msm_start: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(0i32); pub const wlan_notification_msm_associating: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(1i32); pub const wlan_notification_msm_associated: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(2i32); pub const wlan_notification_msm_authenticating: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(3i32); pub const wlan_notification_msm_connected: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(4i32); pub const wlan_notification_msm_roaming_start: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(5i32); pub const wlan_notification_msm_roaming_end: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(6i32); pub const wlan_notification_msm_radio_state_change: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(7i32); pub const wlan_notification_msm_signal_quality_change: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(8i32); pub const wlan_notification_msm_disassociating: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(9i32); pub const wlan_notification_msm_disconnected: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(10i32); pub const wlan_notification_msm_peer_join: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(11i32); pub const wlan_notification_msm_peer_leave: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(12i32); pub const wlan_notification_msm_adapter_removal: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(13i32); pub const wlan_notification_msm_adapter_operation_mode_change: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(14i32); pub const wlan_notification_msm_link_degraded: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(15i32); pub const wlan_notification_msm_link_improved: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(16i32); pub const wlan_notification_msm_end: WLAN_NOTIFICATION_MSM = WLAN_NOTIFICATION_MSM(17i32); impl ::core::convert::From<i32> for WLAN_NOTIFICATION_MSM { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_NOTIFICATION_MSM { 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 WLAN_NOTIFICATION_SECURITY(pub i32); pub const wlan_notification_security_start: WLAN_NOTIFICATION_SECURITY = WLAN_NOTIFICATION_SECURITY(0i32); pub const wlan_notification_security_end: WLAN_NOTIFICATION_SECURITY = WLAN_NOTIFICATION_SECURITY(1i32); impl ::core::convert::From<i32> for WLAN_NOTIFICATION_SECURITY { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_NOTIFICATION_SECURITY { type Abi = Self; } pub const WLAN_NOTIFICATION_SOURCE_ACM: u32 = 8u32; pub const WLAN_NOTIFICATION_SOURCE_ALL: u32 = 65535u32; pub const WLAN_NOTIFICATION_SOURCE_DEVICE_SERVICE: u32 = 2048u32; pub const WLAN_NOTIFICATION_SOURCE_HNWK: u32 = 128u32; pub const WLAN_NOTIFICATION_SOURCE_IHV: u32 = 64u32; pub const WLAN_NOTIFICATION_SOURCE_MSM: u32 = 16u32; pub const WLAN_NOTIFICATION_SOURCE_NONE: u32 = 0u32; pub const WLAN_NOTIFICATION_SOURCE_ONEX: u32 = 4u32; pub const WLAN_NOTIFICATION_SOURCE_SECURITY: u32 = 32u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WLAN_OPCODE_VALUE_TYPE(pub i32); pub const wlan_opcode_value_type_query_only: WLAN_OPCODE_VALUE_TYPE = WLAN_OPCODE_VALUE_TYPE(0i32); pub const wlan_opcode_value_type_set_by_group_policy: WLAN_OPCODE_VALUE_TYPE = WLAN_OPCODE_VALUE_TYPE(1i32); pub const wlan_opcode_value_type_set_by_user: WLAN_OPCODE_VALUE_TYPE = WLAN_OPCODE_VALUE_TYPE(2i32); pub const wlan_opcode_value_type_invalid: WLAN_OPCODE_VALUE_TYPE = WLAN_OPCODE_VALUE_TYPE(3i32); impl ::core::convert::From<i32> for WLAN_OPCODE_VALUE_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_OPCODE_VALUE_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 WLAN_OPERATIONAL_STATE(pub i32); pub const wlan_operational_state_unknown: WLAN_OPERATIONAL_STATE = WLAN_OPERATIONAL_STATE(0i32); pub const wlan_operational_state_off: WLAN_OPERATIONAL_STATE = WLAN_OPERATIONAL_STATE(1i32); pub const wlan_operational_state_on: WLAN_OPERATIONAL_STATE = WLAN_OPERATIONAL_STATE(2i32); pub const wlan_operational_state_going_off: WLAN_OPERATIONAL_STATE = WLAN_OPERATIONAL_STATE(3i32); pub const wlan_operational_state_going_on: WLAN_OPERATIONAL_STATE = WLAN_OPERATIONAL_STATE(4i32); impl ::core::convert::From<i32> for WLAN_OPERATIONAL_STATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_OPERATIONAL_STATE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_PHY_FRAME_STATISTICS { pub ullTransmittedFrameCount: u64, pub ullMulticastTransmittedFrameCount: u64, pub ullFailedCount: u64, pub ullRetryCount: u64, pub ullMultipleRetryCount: u64, pub ullMaxTXLifetimeExceededCount: u64, pub ullTransmittedFragmentCount: u64, pub ullRTSSuccessCount: u64, pub ullRTSFailureCount: u64, pub ullACKFailureCount: u64, pub ullReceivedFrameCount: u64, pub ullMulticastReceivedFrameCount: u64, pub ullPromiscuousReceivedFrameCount: u64, pub ullMaxRXLifetimeExceededCount: u64, pub ullFrameDuplicateCount: u64, pub ullReceivedFragmentCount: u64, pub ullPromiscuousReceivedFragmentCount: u64, pub ullFCSErrorCount: u64, } impl WLAN_PHY_FRAME_STATISTICS {} impl ::core::default::Default for WLAN_PHY_FRAME_STATISTICS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_PHY_FRAME_STATISTICS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_PHY_FRAME_STATISTICS") .field("ullTransmittedFrameCount", &self.ullTransmittedFrameCount) .field("ullMulticastTransmittedFrameCount", &self.ullMulticastTransmittedFrameCount) .field("ullFailedCount", &self.ullFailedCount) .field("ullRetryCount", &self.ullRetryCount) .field("ullMultipleRetryCount", &self.ullMultipleRetryCount) .field("ullMaxTXLifetimeExceededCount", &self.ullMaxTXLifetimeExceededCount) .field("ullTransmittedFragmentCount", &self.ullTransmittedFragmentCount) .field("ullRTSSuccessCount", &self.ullRTSSuccessCount) .field("ullRTSFailureCount", &self.ullRTSFailureCount) .field("ullACKFailureCount", &self.ullACKFailureCount) .field("ullReceivedFrameCount", &self.ullReceivedFrameCount) .field("ullMulticastReceivedFrameCount", &self.ullMulticastReceivedFrameCount) .field("ullPromiscuousReceivedFrameCount", &self.ullPromiscuousReceivedFrameCount) .field("ullMaxRXLifetimeExceededCount", &self.ullMaxRXLifetimeExceededCount) .field("ullFrameDuplicateCount", &self.ullFrameDuplicateCount) .field("ullReceivedFragmentCount", &self.ullReceivedFragmentCount) .field("ullPromiscuousReceivedFragmentCount", &self.ullPromiscuousReceivedFragmentCount) .field("ullFCSErrorCount", &self.ullFCSErrorCount) .finish() } } impl ::core::cmp::PartialEq for WLAN_PHY_FRAME_STATISTICS { fn eq(&self, other: &Self) -> bool { self.ullTransmittedFrameCount == other.ullTransmittedFrameCount && self.ullMulticastTransmittedFrameCount == other.ullMulticastTransmittedFrameCount && self.ullFailedCount == other.ullFailedCount && self.ullRetryCount == other.ullRetryCount && self.ullMultipleRetryCount == other.ullMultipleRetryCount && self.ullMaxTXLifetimeExceededCount == other.ullMaxTXLifetimeExceededCount && self.ullTransmittedFragmentCount == other.ullTransmittedFragmentCount && self.ullRTSSuccessCount == other.ullRTSSuccessCount && self.ullRTSFailureCount == other.ullRTSFailureCount && self.ullACKFailureCount == other.ullACKFailureCount && self.ullReceivedFrameCount == other.ullReceivedFrameCount && self.ullMulticastReceivedFrameCount == other.ullMulticastReceivedFrameCount && self.ullPromiscuousReceivedFrameCount == other.ullPromiscuousReceivedFrameCount && self.ullMaxRXLifetimeExceededCount == other.ullMaxRXLifetimeExceededCount && self.ullFrameDuplicateCount == other.ullFrameDuplicateCount && self.ullReceivedFragmentCount == other.ullReceivedFragmentCount && self.ullPromiscuousReceivedFragmentCount == other.ullPromiscuousReceivedFragmentCount && self.ullFCSErrorCount == other.ullFCSErrorCount } } impl ::core::cmp::Eq for WLAN_PHY_FRAME_STATISTICS {} unsafe impl ::windows::core::Abi for WLAN_PHY_FRAME_STATISTICS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_PHY_RADIO_STATE { pub dwPhyIndex: u32, pub dot11SoftwareRadioState: DOT11_RADIO_STATE, pub dot11HardwareRadioState: DOT11_RADIO_STATE, } impl WLAN_PHY_RADIO_STATE {} impl ::core::default::Default for WLAN_PHY_RADIO_STATE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_PHY_RADIO_STATE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_PHY_RADIO_STATE").field("dwPhyIndex", &self.dwPhyIndex).field("dot11SoftwareRadioState", &self.dot11SoftwareRadioState).field("dot11HardwareRadioState", &self.dot11HardwareRadioState).finish() } } impl ::core::cmp::PartialEq for WLAN_PHY_RADIO_STATE { fn eq(&self, other: &Self) -> bool { self.dwPhyIndex == other.dwPhyIndex && self.dot11SoftwareRadioState == other.dot11SoftwareRadioState && self.dot11HardwareRadioState == other.dot11HardwareRadioState } } impl ::core::cmp::Eq for WLAN_PHY_RADIO_STATE {} unsafe impl ::windows::core::Abi for WLAN_PHY_RADIO_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 WLAN_POWER_SETTING(pub i32); pub const wlan_power_setting_no_saving: WLAN_POWER_SETTING = WLAN_POWER_SETTING(0i32); pub const wlan_power_setting_low_saving: WLAN_POWER_SETTING = WLAN_POWER_SETTING(1i32); pub const wlan_power_setting_medium_saving: WLAN_POWER_SETTING = WLAN_POWER_SETTING(2i32); pub const wlan_power_setting_maximum_saving: WLAN_POWER_SETTING = WLAN_POWER_SETTING(3i32); pub const wlan_power_setting_invalid: WLAN_POWER_SETTING = WLAN_POWER_SETTING(4i32); impl ::core::convert::From<i32> for WLAN_POWER_SETTING { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_POWER_SETTING { type Abi = Self; } pub const WLAN_PROFILE_CONNECTION_MODE_AUTO: u32 = 131072u32; pub const WLAN_PROFILE_CONNECTION_MODE_SET_BY_CLIENT: u32 = 65536u32; pub const WLAN_PROFILE_GET_PLAINTEXT_KEY: u32 = 4u32; pub const WLAN_PROFILE_GROUP_POLICY: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_PROFILE_INFO { pub strProfileName: [u16; 256], pub dwFlags: u32, } impl WLAN_PROFILE_INFO {} impl ::core::default::Default for WLAN_PROFILE_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_PROFILE_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_PROFILE_INFO").field("strProfileName", &self.strProfileName).field("dwFlags", &self.dwFlags).finish() } } impl ::core::cmp::PartialEq for WLAN_PROFILE_INFO { fn eq(&self, other: &Self) -> bool { self.strProfileName == other.strProfileName && self.dwFlags == other.dwFlags } } impl ::core::cmp::Eq for WLAN_PROFILE_INFO {} unsafe impl ::windows::core::Abi for WLAN_PROFILE_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_PROFILE_INFO_LIST { pub dwNumberOfItems: u32, pub dwIndex: u32, pub ProfileInfo: [WLAN_PROFILE_INFO; 1], } impl WLAN_PROFILE_INFO_LIST {} impl ::core::default::Default for WLAN_PROFILE_INFO_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_PROFILE_INFO_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_PROFILE_INFO_LIST").field("dwNumberOfItems", &self.dwNumberOfItems).field("dwIndex", &self.dwIndex).field("ProfileInfo", &self.ProfileInfo).finish() } } impl ::core::cmp::PartialEq for WLAN_PROFILE_INFO_LIST { fn eq(&self, other: &Self) -> bool { self.dwNumberOfItems == other.dwNumberOfItems && self.dwIndex == other.dwIndex && self.ProfileInfo == other.ProfileInfo } } impl ::core::cmp::Eq for WLAN_PROFILE_INFO_LIST {} unsafe impl ::windows::core::Abi for WLAN_PROFILE_INFO_LIST { type Abi = Self; } pub const WLAN_PROFILE_USER: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_RADIO_STATE { pub dwNumberOfPhys: u32, pub PhyRadioState: [WLAN_PHY_RADIO_STATE; 64], } impl WLAN_RADIO_STATE {} impl ::core::default::Default for WLAN_RADIO_STATE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_RADIO_STATE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_RADIO_STATE").field("dwNumberOfPhys", &self.dwNumberOfPhys).field("PhyRadioState", &self.PhyRadioState).finish() } } impl ::core::cmp::PartialEq for WLAN_RADIO_STATE { fn eq(&self, other: &Self) -> bool { self.dwNumberOfPhys == other.dwNumberOfPhys && self.PhyRadioState == other.PhyRadioState } } impl ::core::cmp::Eq for WLAN_RADIO_STATE {} unsafe impl ::windows::core::Abi for WLAN_RADIO_STATE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_RATE_SET { pub uRateSetLength: u32, pub usRateSet: [u16; 126], } impl WLAN_RATE_SET {} impl ::core::default::Default for WLAN_RATE_SET { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_RATE_SET { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_RATE_SET").field("uRateSetLength", &self.uRateSetLength).field("usRateSet", &self.usRateSet).finish() } } impl ::core::cmp::PartialEq for WLAN_RATE_SET { fn eq(&self, other: &Self) -> bool { self.uRateSetLength == other.uRateSetLength && self.usRateSet == other.usRateSet } } impl ::core::cmp::Eq for WLAN_RATE_SET {} unsafe impl ::windows::core::Abi for WLAN_RATE_SET { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_RAW_DATA { pub dwDataSize: u32, pub DataBlob: [u8; 1], } impl WLAN_RAW_DATA {} impl ::core::default::Default for WLAN_RAW_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_RAW_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_RAW_DATA").field("dwDataSize", &self.dwDataSize).field("DataBlob", &self.DataBlob).finish() } } impl ::core::cmp::PartialEq for WLAN_RAW_DATA { fn eq(&self, other: &Self) -> bool { self.dwDataSize == other.dwDataSize && self.DataBlob == other.DataBlob } } impl ::core::cmp::Eq for WLAN_RAW_DATA {} unsafe impl ::windows::core::Abi for WLAN_RAW_DATA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_RAW_DATA_LIST { pub dwTotalSize: u32, pub dwNumberOfItems: u32, pub DataList: [WLAN_RAW_DATA_LIST_0; 1], } impl WLAN_RAW_DATA_LIST {} impl ::core::default::Default for WLAN_RAW_DATA_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_RAW_DATA_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_RAW_DATA_LIST").field("dwTotalSize", &self.dwTotalSize).field("dwNumberOfItems", &self.dwNumberOfItems).field("DataList", &self.DataList).finish() } } impl ::core::cmp::PartialEq for WLAN_RAW_DATA_LIST { fn eq(&self, other: &Self) -> bool { self.dwTotalSize == other.dwTotalSize && self.dwNumberOfItems == other.dwNumberOfItems && self.DataList == other.DataList } } impl ::core::cmp::Eq for WLAN_RAW_DATA_LIST {} unsafe impl ::windows::core::Abi for WLAN_RAW_DATA_LIST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_RAW_DATA_LIST_0 { pub dwDataOffset: u32, pub dwDataSize: u32, } impl WLAN_RAW_DATA_LIST_0 {} impl ::core::default::Default for WLAN_RAW_DATA_LIST_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_RAW_DATA_LIST_0 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("_Anonymous_e__Struct").field("dwDataOffset", &self.dwDataOffset).field("dwDataSize", &self.dwDataSize).finish() } } impl ::core::cmp::PartialEq for WLAN_RAW_DATA_LIST_0 { fn eq(&self, other: &Self) -> bool { self.dwDataOffset == other.dwDataOffset && self.dwDataSize == other.dwDataSize } } impl ::core::cmp::Eq for WLAN_RAW_DATA_LIST_0 {} unsafe impl ::windows::core::Abi for WLAN_RAW_DATA_LIST_0 { type Abi = Self; } pub const WLAN_REASON_CODE_AC_BASE: u32 = 131072u32; pub const WLAN_REASON_CODE_AC_CONNECT_BASE: u32 = 163840u32; pub const WLAN_REASON_CODE_AC_END: u32 = 196607u32; pub const WLAN_REASON_CODE_ADHOC_SECURITY_FAILURE: u32 = 229386u32; pub const WLAN_REASON_CODE_AP_PROFILE_NOT_ALLOWED: u32 = 163856u32; pub const WLAN_REASON_CODE_AP_PROFILE_NOT_ALLOWED_FOR_CLIENT: u32 = 163855u32; pub const WLAN_REASON_CODE_AP_STARTING_FAILURE: u32 = 229395u32; pub const WLAN_REASON_CODE_ASSOCIATION_FAILURE: u32 = 229378u32; pub const WLAN_REASON_CODE_ASSOCIATION_TIMEOUT: u32 = 229379u32; pub const WLAN_REASON_CODE_AUTO_AP_PROFILE_NOT_ALLOWED: u32 = 524313u32; pub const WLAN_REASON_CODE_AUTO_CONNECTION_NOT_ALLOWED: u32 = 524314u32; pub const WLAN_REASON_CODE_AUTO_SWITCH_SET_FOR_ADHOC: u32 = 524304u32; pub const WLAN_REASON_CODE_AUTO_SWITCH_SET_FOR_MANUAL_CONNECTION: u32 = 524305u32; pub const WLAN_REASON_CODE_BAD_MAX_NUMBER_OF_CLIENTS_FOR_AP: u32 = 524310u32; pub const WLAN_REASON_CODE_BASE: u32 = 131072u32; pub const WLAN_REASON_CODE_BSS_TYPE_NOT_ALLOWED: u32 = 163845u32; pub const WLAN_REASON_CODE_BSS_TYPE_UNMATCH: u32 = 196611u32; pub const WLAN_REASON_CODE_CONFLICT_SECURITY: u32 = 524299u32; pub const WLAN_REASON_CODE_CONNECT_CALL_FAIL: u32 = 163849u32; pub const WLAN_REASON_CODE_DATARATE_UNMATCH: u32 = 196613u32; pub const WLAN_REASON_CODE_DISCONNECT_TIMEOUT: u32 = 229391u32; pub const WLAN_REASON_CODE_DRIVER_DISCONNECTED: u32 = 229387u32; pub const WLAN_REASON_CODE_DRIVER_OPERATION_FAILURE: u32 = 229388u32; pub const WLAN_REASON_CODE_GP_DENIED: u32 = 163843u32; pub const WLAN_REASON_CODE_HOTSPOT2_PROFILE_DENIED: u32 = 163857u32; pub const WLAN_REASON_CODE_HOTSPOT2_PROFILE_NOT_ALLOWED: u32 = 524315u32; pub const WLAN_REASON_CODE_IHV_CONNECTIVITY_NOT_SUPPORTED: u32 = 524309u32; pub const WLAN_REASON_CODE_IHV_NOT_AVAILABLE: u32 = 229389u32; pub const WLAN_REASON_CODE_IHV_NOT_RESPONDING: u32 = 229390u32; pub const WLAN_REASON_CODE_IHV_OUI_MISMATCH: u32 = 524296u32; pub const WLAN_REASON_CODE_IHV_OUI_MISSING: u32 = 524297u32; pub const WLAN_REASON_CODE_IHV_SECURITY_NOT_SUPPORTED: u32 = 524295u32; pub const WLAN_REASON_CODE_IHV_SECURITY_ONEX_MISSING: u32 = 524306u32; pub const WLAN_REASON_CODE_IHV_SETTINGS_MISSING: u32 = 524298u32; pub const WLAN_REASON_CODE_INTERNAL_FAILURE: u32 = 229392u32; pub const WLAN_REASON_CODE_INVALID_ADHOC_CONNECTION_MODE: u32 = 524302u32; pub const WLAN_REASON_CODE_INVALID_BSS_TYPE: u32 = 524301u32; pub const WLAN_REASON_CODE_INVALID_CHANNEL: u32 = 524311u32; pub const WLAN_REASON_CODE_INVALID_PHY_TYPE: u32 = 524293u32; pub const WLAN_REASON_CODE_INVALID_PROFILE_NAME: u32 = 524291u32; pub const WLAN_REASON_CODE_INVALID_PROFILE_SCHEMA: u32 = 524289u32; pub const WLAN_REASON_CODE_INVALID_PROFILE_TYPE: u32 = 524292u32; pub const WLAN_REASON_CODE_IN_BLOCKED_LIST: u32 = 163847u32; pub const WLAN_REASON_CODE_IN_FAILED_LIST: u32 = 163846u32; pub const WLAN_REASON_CODE_KEY_MISMATCH: u32 = 163853u32; pub const WLAN_REASON_CODE_MSMSEC_AUTH_START_TIMEOUT: u32 = 294914u32; pub const WLAN_REASON_CODE_MSMSEC_AUTH_SUCCESS_TIMEOUT: u32 = 294915u32; pub const WLAN_REASON_CODE_MSMSEC_AUTH_WCN_COMPLETED: u32 = 294937u32; pub const WLAN_REASON_CODE_MSMSEC_BASE: u32 = 262144u32; pub const WLAN_REASON_CODE_MSMSEC_CANCELLED: u32 = 294929u32; pub const WLAN_REASON_CODE_MSMSEC_CAPABILITY_DISCOVERY: u32 = 262165u32; pub const WLAN_REASON_CODE_MSMSEC_CAPABILITY_MFP_NW_NIC: u32 = 262181u32; pub const WLAN_REASON_CODE_MSMSEC_CAPABILITY_NETWORK: u32 = 262162u32; pub const WLAN_REASON_CODE_MSMSEC_CAPABILITY_NIC: u32 = 262163u32; pub const WLAN_REASON_CODE_MSMSEC_CAPABILITY_PROFILE: u32 = 262164u32; pub const WLAN_REASON_CODE_MSMSEC_CAPABILITY_PROFILE_AUTH: u32 = 262174u32; pub const WLAN_REASON_CODE_MSMSEC_CAPABILITY_PROFILE_CIPHER: u32 = 262175u32; pub const WLAN_REASON_CODE_MSMSEC_CAPABILITY_PROFILE_SAFE_MODE_NIC: u32 = 262177u32; pub const WLAN_REASON_CODE_MSMSEC_CAPABILITY_PROFILE_SAFE_MODE_NW: u32 = 262178u32; pub const WLAN_REASON_CODE_MSMSEC_CONNECT_BASE: u32 = 294912u32; pub const WLAN_REASON_CODE_MSMSEC_DOWNGRADE_DETECTED: u32 = 294931u32; pub const WLAN_REASON_CODE_MSMSEC_END: u32 = 327679u32; pub const WLAN_REASON_CODE_MSMSEC_FORCED_FAILURE: u32 = 294933u32; pub const WLAN_REASON_CODE_MSMSEC_G1_MISSING_GRP_KEY: u32 = 294925u32; pub const WLAN_REASON_CODE_MSMSEC_G1_MISSING_KEY_DATA: u32 = 294924u32; pub const WLAN_REASON_CODE_MSMSEC_G1_MISSING_MGMT_GRP_KEY: u32 = 294939u32; pub const WLAN_REASON_CODE_MSMSEC_KEY_FORMAT: u32 = 294930u32; pub const WLAN_REASON_CODE_MSMSEC_KEY_START_TIMEOUT: u32 = 294916u32; pub const WLAN_REASON_CODE_MSMSEC_KEY_SUCCESS_TIMEOUT: u32 = 294917u32; pub const WLAN_REASON_CODE_MSMSEC_M2_MISSING_IE: u32 = 294936u32; pub const WLAN_REASON_CODE_MSMSEC_M2_MISSING_KEY_DATA: u32 = 294935u32; pub const WLAN_REASON_CODE_MSMSEC_M3_MISSING_GRP_KEY: u32 = 294920u32; pub const WLAN_REASON_CODE_MSMSEC_M3_MISSING_IE: u32 = 294919u32; pub const WLAN_REASON_CODE_MSMSEC_M3_MISSING_KEY_DATA: u32 = 294918u32; pub const WLAN_REASON_CODE_MSMSEC_M3_MISSING_MGMT_GRP_KEY: u32 = 294938u32; pub const WLAN_REASON_CODE_MSMSEC_M3_TOO_MANY_RSNIE: u32 = 294934u32; pub const WLAN_REASON_CODE_MSMSEC_MAX: u32 = 327679u32; pub const WLAN_REASON_CODE_MSMSEC_MIN: u32 = 262144u32; pub const WLAN_REASON_CODE_MSMSEC_MIXED_CELL: u32 = 262169u32; pub const WLAN_REASON_CODE_MSMSEC_NIC_FAILURE: u32 = 294928u32; pub const WLAN_REASON_CODE_MSMSEC_NO_AUTHENTICATOR: u32 = 294927u32; pub const WLAN_REASON_CODE_MSMSEC_NO_PAIRWISE_KEY: u32 = 294923u32; pub const WLAN_REASON_CODE_MSMSEC_PEER_INDICATED_INSECURE: u32 = 294926u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_AUTH_TIMERS_INVALID: u32 = 262170u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_DUPLICATE_AUTH_CIPHER: u32 = 262151u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_INVALID_AUTH_CIPHER: u32 = 262153u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_INVALID_GKEY_INTV: u32 = 262171u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_INVALID_KEY_INDEX: u32 = 262145u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_INVALID_PMKCACHE_MODE: u32 = 262156u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_INVALID_PMKCACHE_SIZE: u32 = 262157u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_INVALID_PMKCACHE_TTL: u32 = 262158u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_INVALID_PREAUTH_MODE: u32 = 262159u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_INVALID_PREAUTH_THROTTLE: u32 = 262160u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_KEYMATERIAL_CHAR: u32 = 262167u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_KEY_LENGTH: u32 = 262147u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_KEY_UNMAPPED_CHAR: u32 = 262173u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_NO_AUTH_CIPHER_SPECIFIED: u32 = 262149u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_ONEX_DISABLED: u32 = 262154u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_ONEX_ENABLED: u32 = 262155u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_PASSPHRASE_CHAR: u32 = 262166u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_PREAUTH_ONLY_ENABLED: u32 = 262161u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_PSK_LENGTH: u32 = 262148u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_PSK_PRESENT: u32 = 262146u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_RAWDATA_INVALID: u32 = 262152u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_SAFE_MODE: u32 = 262176u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_TOO_MANY_AUTH_CIPHER_SPECIFIED: u32 = 262150u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_UNSUPPORTED_AUTH: u32 = 262179u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_UNSUPPORTED_CIPHER: u32 = 262180u32; pub const WLAN_REASON_CODE_MSMSEC_PROFILE_WRONG_KEYTYPE: u32 = 262168u32; pub const WLAN_REASON_CODE_MSMSEC_PR_IE_MATCHING: u32 = 294921u32; pub const WLAN_REASON_CODE_MSMSEC_PSK_MISMATCH_SUSPECTED: u32 = 294932u32; pub const WLAN_REASON_CODE_MSMSEC_SEC_IE_MATCHING: u32 = 294922u32; pub const WLAN_REASON_CODE_MSMSEC_TRANSITION_NETWORK: u32 = 262172u32; pub const WLAN_REASON_CODE_MSMSEC_UI_REQUEST_FAILURE: u32 = 294913u32; pub const WLAN_REASON_CODE_MSM_BASE: u32 = 196608u32; pub const WLAN_REASON_CODE_MSM_CONNECT_BASE: u32 = 229376u32; pub const WLAN_REASON_CODE_MSM_END: u32 = 262143u32; pub const WLAN_REASON_CODE_MSM_SECURITY_MISSING: u32 = 524294u32; pub const WLAN_REASON_CODE_NETWORK_NOT_AVAILABLE: u32 = 163851u32; pub const WLAN_REASON_CODE_NETWORK_NOT_COMPATIBLE: u32 = 131073u32; pub const WLAN_REASON_CODE_NON_BROADCAST_SET_FOR_ADHOC: u32 = 524303u32; pub const WLAN_REASON_CODE_NOT_VISIBLE: u32 = 163842u32; pub const WLAN_REASON_CODE_NO_AUTO_CONNECTION: u32 = 163841u32; pub const WLAN_REASON_CODE_NO_VISIBLE_AP: u32 = 229396u32; pub const WLAN_REASON_CODE_OPERATION_MODE_NOT_SUPPORTED: u32 = 524312u32; pub const WLAN_REASON_CODE_PHY_TYPE_UNMATCH: u32 = 196612u32; pub const WLAN_REASON_CODE_PRE_SECURITY_FAILURE: u32 = 229380u32; pub const WLAN_REASON_CODE_PROFILE_BASE: u32 = 524288u32; pub const WLAN_REASON_CODE_PROFILE_CHANGED_OR_DELETED: u32 = 163852u32; pub const WLAN_REASON_CODE_PROFILE_CONNECT_BASE: u32 = 557056u32; pub const WLAN_REASON_CODE_PROFILE_END: u32 = 589823u32; pub const WLAN_REASON_CODE_PROFILE_MISSING: u32 = 524290u32; pub const WLAN_REASON_CODE_PROFILE_NOT_COMPATIBLE: u32 = 131074u32; pub const WLAN_REASON_CODE_PROFILE_SSID_INVALID: u32 = 524307u32; pub const WLAN_REASON_CODE_RANGE_SIZE: u32 = 65536u32; pub const WLAN_REASON_CODE_RESERVED_BASE: u32 = 720896u32; pub const WLAN_REASON_CODE_RESERVED_END: u32 = 786431u32; pub const WLAN_REASON_CODE_ROAMING_FAILURE: u32 = 229384u32; pub const WLAN_REASON_CODE_ROAMING_SECURITY_FAILURE: u32 = 229385u32; pub const WLAN_REASON_CODE_SCAN_CALL_FAIL: u32 = 163850u32; pub const WLAN_REASON_CODE_SECURITY_FAILURE: u32 = 229382u32; pub const WLAN_REASON_CODE_SECURITY_MISSING: u32 = 524300u32; pub const WLAN_REASON_CODE_SECURITY_TIMEOUT: u32 = 229383u32; pub const WLAN_REASON_CODE_SSID_LIST_TOO_LONG: u32 = 163848u32; pub const WLAN_REASON_CODE_START_SECURITY_FAILURE: u32 = 229381u32; pub const WLAN_REASON_CODE_SUCCESS: u32 = 0u32; pub const WLAN_REASON_CODE_TOO_MANY_SECURITY_ATTEMPTS: u32 = 229394u32; pub const WLAN_REASON_CODE_TOO_MANY_SSID: u32 = 524308u32; pub const WLAN_REASON_CODE_UI_REQUEST_TIMEOUT: u32 = 229393u32; pub const WLAN_REASON_CODE_UNKNOWN: u32 = 65537u32; pub const WLAN_REASON_CODE_UNSUPPORTED_SECURITY_SET: u32 = 196610u32; pub const WLAN_REASON_CODE_UNSUPPORTED_SECURITY_SET_BY_OS: u32 = 196609u32; pub const WLAN_REASON_CODE_USER_CANCELLED: u32 = 229377u32; pub const WLAN_REASON_CODE_USER_DENIED: u32 = 163844u32; pub const WLAN_REASON_CODE_USER_NOT_RESPOND: u32 = 163854u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WLAN_SECURABLE_OBJECT(pub i32); pub const wlan_secure_permit_list: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(0i32); pub const wlan_secure_deny_list: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(1i32); pub const wlan_secure_ac_enabled: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(2i32); pub const wlan_secure_bc_scan_enabled: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(3i32); pub const wlan_secure_bss_type: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(4i32); pub const wlan_secure_show_denied: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(5i32); pub const wlan_secure_interface_properties: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(6i32); pub const wlan_secure_ihv_control: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(7i32); pub const wlan_secure_all_user_profiles_order: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(8i32); pub const wlan_secure_add_new_all_user_profiles: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(9i32); pub const wlan_secure_add_new_per_user_profiles: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(10i32); pub const wlan_secure_media_streaming_mode_enabled: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(11i32); pub const wlan_secure_current_operation_mode: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(12i32); pub const wlan_secure_get_plaintext_key: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(13i32); pub const wlan_secure_hosted_network_elevated_access: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(14i32); pub const wlan_secure_virtual_station_extensibility: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(15i32); pub const wlan_secure_wfd_elevated_access: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(16i32); pub const WLAN_SECURABLE_OBJECT_COUNT: WLAN_SECURABLE_OBJECT = WLAN_SECURABLE_OBJECT(17i32); impl ::core::convert::From<i32> for WLAN_SECURABLE_OBJECT { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_SECURABLE_OBJECT { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct WLAN_SECURITY_ATTRIBUTES { pub bSecurityEnabled: super::super::Foundation::BOOL, pub bOneXEnabled: super::super::Foundation::BOOL, pub dot11AuthAlgorithm: DOT11_AUTH_ALGORITHM, pub dot11CipherAlgorithm: DOT11_CIPHER_ALGORITHM, } #[cfg(feature = "Win32_Foundation")] impl WLAN_SECURITY_ATTRIBUTES {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for WLAN_SECURITY_ATTRIBUTES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for WLAN_SECURITY_ATTRIBUTES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_SECURITY_ATTRIBUTES").field("bSecurityEnabled", &self.bSecurityEnabled).field("bOneXEnabled", &self.bOneXEnabled).field("dot11AuthAlgorithm", &self.dot11AuthAlgorithm).field("dot11CipherAlgorithm", &self.dot11CipherAlgorithm).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for WLAN_SECURITY_ATTRIBUTES { fn eq(&self, other: &Self) -> bool { self.bSecurityEnabled == other.bSecurityEnabled && self.bOneXEnabled == other.bOneXEnabled && self.dot11AuthAlgorithm == other.dot11AuthAlgorithm && self.dot11CipherAlgorithm == other.dot11CipherAlgorithm } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for WLAN_SECURITY_ATTRIBUTES {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for WLAN_SECURITY_ATTRIBUTES { 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 WLAN_SET_EAPHOST_FLAGS(pub u32); pub const WLAN_SET_EAPHOST_DATA_ALL_USERS: WLAN_SET_EAPHOST_FLAGS = WLAN_SET_EAPHOST_FLAGS(1u32); impl ::core::convert::From<u32> for WLAN_SET_EAPHOST_FLAGS { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WLAN_SET_EAPHOST_FLAGS { type Abi = Self; } impl ::core::ops::BitOr for WLAN_SET_EAPHOST_FLAGS { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for WLAN_SET_EAPHOST_FLAGS { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for WLAN_SET_EAPHOST_FLAGS { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for WLAN_SET_EAPHOST_FLAGS { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for WLAN_SET_EAPHOST_FLAGS { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct WLAN_STATISTICS { pub ullFourWayHandshakeFailures: u64, pub ullTKIPCounterMeasuresInvoked: u64, pub ullReserved: u64, pub MacUcastCounters: WLAN_MAC_FRAME_STATISTICS, pub MacMcastCounters: WLAN_MAC_FRAME_STATISTICS, pub dwNumberOfPhys: u32, pub PhyCounters: [WLAN_PHY_FRAME_STATISTICS; 1], } impl WLAN_STATISTICS {} impl ::core::default::Default for WLAN_STATISTICS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for WLAN_STATISTICS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("WLAN_STATISTICS") .field("ullFourWayHandshakeFailures", &self.ullFourWayHandshakeFailures) .field("ullTKIPCounterMeasuresInvoked", &self.ullTKIPCounterMeasuresInvoked) .field("ullReserved", &self.ullReserved) .field("MacUcastCounters", &self.MacUcastCounters) .field("MacMcastCounters", &self.MacMcastCounters) .field("dwNumberOfPhys", &self.dwNumberOfPhys) .field("PhyCounters", &self.PhyCounters) .finish() } } impl ::core::cmp::PartialEq for WLAN_STATISTICS { fn eq(&self, other: &Self) -> bool { self.ullFourWayHandshakeFailures == other.ullFourWayHandshakeFailures && self.ullTKIPCounterMeasuresInvoked == other.ullTKIPCounterMeasuresInvoked && self.ullReserved == other.ullReserved && self.MacUcastCounters == other.MacUcastCounters && self.MacMcastCounters == other.MacMcastCounters && self.dwNumberOfPhys == other.dwNumberOfPhys && self.PhyCounters == other.PhyCounters } } impl ::core::cmp::Eq for WLAN_STATISTICS {} unsafe impl ::windows::core::Abi for WLAN_STATISTICS { type Abi = Self; } pub const WLAN_UI_API_INITIAL_VERSION: u32 = 1u32; pub const WLAN_UI_API_VERSION: u32 = 1u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct WL_DISPLAY_PAGES(pub i32); pub const WLConnectionPage: WL_DISPLAY_PAGES = WL_DISPLAY_PAGES(0i32); pub const WLSecurityPage: WL_DISPLAY_PAGES = WL_DISPLAY_PAGES(1i32); pub const WLAdvPage: WL_DISPLAY_PAGES = WL_DISPLAY_PAGES(2i32); impl ::core::convert::From<i32> for WL_DISPLAY_PAGES { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WL_DISPLAY_PAGES { type Abi = Self; } #[inline] pub unsafe fn WlanAllocateMemory(dwmemorysize: u32) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanAllocateMemory(dwmemorysize: u32) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(WlanAllocateMemory(::core::mem::transmute(dwmemorysize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanCloseHandle<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanCloseHandle(hclienthandle: super::super::Foundation::HANDLE, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanCloseHandle(hclienthandle.into_param().abi(), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] #[inline] pub unsafe fn WlanConnect<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, pconnectionparameters: *const WLAN_CONNECTION_PARAMETERS, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanConnect(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, pconnectionparameters: *const WLAN_CONNECTION_PARAMETERS, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanConnect(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), ::core::mem::transmute(pconnectionparameters), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_NetworkManagement_Ndis"))] #[inline] pub unsafe fn WlanConnect2<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, pconnectionparameters: *const WLAN_CONNECTION_PARAMETERS_V2, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanConnect2(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, pconnectionparameters: *const WLAN_CONNECTION_PARAMETERS_V2, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanConnect2(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), ::core::mem::transmute(pconnectionparameters), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanDeleteProfile<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, strprofilename: Param2, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanDeleteProfile(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, strprofilename: super::super::Foundation::PWSTR, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanDeleteProfile(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), strprofilename.into_param().abi(), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanDeviceServiceCommand<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, pdeviceserviceguid: *const ::windows::core::GUID, dwopcode: u32, dwinbuffersize: u32, pinbuffer: *const ::core::ffi::c_void, dwoutbuffersize: u32, poutbuffer: *mut ::core::ffi::c_void, pdwbytesreturned: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanDeviceServiceCommand(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, pdeviceserviceguid: *const ::windows::core::GUID, dwopcode: u32, dwinbuffersize: u32, pinbuffer: *const ::core::ffi::c_void, dwoutbuffersize: u32, poutbuffer: *mut ::core::ffi::c_void, pdwbytesreturned: *mut u32) -> u32; } ::core::mem::transmute(WlanDeviceServiceCommand( hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), ::core::mem::transmute(pdeviceserviceguid), ::core::mem::transmute(dwopcode), ::core::mem::transmute(dwinbuffersize), ::core::mem::transmute(pinbuffer), ::core::mem::transmute(dwoutbuffersize), ::core::mem::transmute(poutbuffer), ::core::mem::transmute(pdwbytesreturned), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanDisconnect<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanDisconnect(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanDisconnect(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanEnumInterfaces<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, preserved: *mut ::core::ffi::c_void, ppinterfacelist: *mut *mut WLAN_INTERFACE_INFO_LIST) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanEnumInterfaces(hclienthandle: super::super::Foundation::HANDLE, preserved: *mut ::core::ffi::c_void, ppinterfacelist: *mut *mut WLAN_INTERFACE_INFO_LIST) -> u32; } ::core::mem::transmute(WlanEnumInterfaces(hclienthandle.into_param().abi(), ::core::mem::transmute(preserved), ::core::mem::transmute(ppinterfacelist))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanExtractPsdIEDataList<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hclienthandle: Param0, dwiedatasize: u32, prawiedata: *const u8, strformat: Param3, preserved: *mut ::core::ffi::c_void, pppsdiedatalist: *mut *mut WLAN_RAW_DATA_LIST) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanExtractPsdIEDataList(hclienthandle: super::super::Foundation::HANDLE, dwiedatasize: u32, prawiedata: *const u8, strformat: super::super::Foundation::PWSTR, preserved: *mut ::core::ffi::c_void, pppsdiedatalist: *mut *mut WLAN_RAW_DATA_LIST) -> u32; } ::core::mem::transmute(WlanExtractPsdIEDataList(hclienthandle.into_param().abi(), ::core::mem::transmute(dwiedatasize), ::core::mem::transmute(prawiedata), strformat.into_param().abi(), ::core::mem::transmute(preserved), ::core::mem::transmute(pppsdiedatalist))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn WlanFreeMemory(pmemory: *const ::core::ffi::c_void) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanFreeMemory(pmemory: *const ::core::ffi::c_void); } ::core::mem::transmute(WlanFreeMemory(::core::mem::transmute(pmemory))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanGetAvailableNetworkList<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, dwflags: u32, preserved: *mut ::core::ffi::c_void, ppavailablenetworklist: *mut *mut WLAN_AVAILABLE_NETWORK_LIST) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanGetAvailableNetworkList(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, dwflags: u32, preserved: *mut ::core::ffi::c_void, ppavailablenetworklist: *mut *mut WLAN_AVAILABLE_NETWORK_LIST) -> u32; } ::core::mem::transmute(WlanGetAvailableNetworkList(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), ::core::mem::transmute(dwflags), ::core::mem::transmute(preserved), ::core::mem::transmute(ppavailablenetworklist))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanGetAvailableNetworkList2<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, dwflags: u32, preserved: *mut ::core::ffi::c_void, ppavailablenetworklist: *mut *mut WLAN_AVAILABLE_NETWORK_LIST_V2) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanGetAvailableNetworkList2(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, dwflags: u32, preserved: *mut ::core::ffi::c_void, ppavailablenetworklist: *mut *mut WLAN_AVAILABLE_NETWORK_LIST_V2) -> u32; } ::core::mem::transmute(WlanGetAvailableNetworkList2(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), ::core::mem::transmute(dwflags), ::core::mem::transmute(preserved), ::core::mem::transmute(ppavailablenetworklist))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanGetFilterList<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, wlanfilterlisttype: WLAN_FILTER_LIST_TYPE, preserved: *mut ::core::ffi::c_void, ppnetworklist: *mut *mut DOT11_NETWORK_LIST) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanGetFilterList(hclienthandle: super::super::Foundation::HANDLE, wlanfilterlisttype: WLAN_FILTER_LIST_TYPE, preserved: *mut ::core::ffi::c_void, ppnetworklist: *mut *mut DOT11_NETWORK_LIST) -> u32; } ::core::mem::transmute(WlanGetFilterList(hclienthandle.into_param().abi(), ::core::mem::transmute(wlanfilterlisttype), ::core::mem::transmute(preserved), ::core::mem::transmute(ppnetworklist))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanGetInterfaceCapability<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, preserved: *mut ::core::ffi::c_void, ppcapability: *mut *mut WLAN_INTERFACE_CAPABILITY) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanGetInterfaceCapability(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, preserved: *mut ::core::ffi::c_void, ppcapability: *mut *mut WLAN_INTERFACE_CAPABILITY) -> u32; } ::core::mem::transmute(WlanGetInterfaceCapability(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), ::core::mem::transmute(preserved), ::core::mem::transmute(ppcapability))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanGetNetworkBssList<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, pdot11ssid: *const DOT11_SSID, dot11bsstype: DOT11_BSS_TYPE, bsecurityenabled: Param4, preserved: *mut ::core::ffi::c_void, ppwlanbsslist: *mut *mut WLAN_BSS_LIST) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanGetNetworkBssList(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, pdot11ssid: *const DOT11_SSID, dot11bsstype: DOT11_BSS_TYPE, bsecurityenabled: super::super::Foundation::BOOL, preserved: *mut ::core::ffi::c_void, ppwlanbsslist: *mut *mut WLAN_BSS_LIST) -> u32; } ::core::mem::transmute(WlanGetNetworkBssList(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), ::core::mem::transmute(pdot11ssid), ::core::mem::transmute(dot11bsstype), bsecurityenabled.into_param().abi(), ::core::mem::transmute(preserved), ::core::mem::transmute(ppwlanbsslist))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanGetProfile<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, strprofilename: Param2, preserved: *mut ::core::ffi::c_void, pstrprofilexml: *mut super::super::Foundation::PWSTR, pdwflags: *mut u32, pdwgrantedaccess: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanGetProfile(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, strprofilename: super::super::Foundation::PWSTR, preserved: *mut ::core::ffi::c_void, pstrprofilexml: *mut super::super::Foundation::PWSTR, pdwflags: *mut u32, pdwgrantedaccess: *mut u32) -> u32; } ::core::mem::transmute(WlanGetProfile(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), strprofilename.into_param().abi(), ::core::mem::transmute(preserved), ::core::mem::transmute(pstrprofilexml), ::core::mem::transmute(pdwflags), ::core::mem::transmute(pdwgrantedaccess))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanGetProfileCustomUserData<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, strprofilename: Param2, preserved: *mut ::core::ffi::c_void, pdwdatasize: *mut u32, ppdata: *mut *mut u8) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanGetProfileCustomUserData(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, strprofilename: super::super::Foundation::PWSTR, preserved: *mut ::core::ffi::c_void, pdwdatasize: *mut u32, ppdata: *mut *mut u8) -> u32; } ::core::mem::transmute(WlanGetProfileCustomUserData(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), strprofilename.into_param().abi(), ::core::mem::transmute(preserved), ::core::mem::transmute(pdwdatasize), ::core::mem::transmute(ppdata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanGetProfileList<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, preserved: *mut ::core::ffi::c_void, ppprofilelist: *mut *mut WLAN_PROFILE_INFO_LIST) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanGetProfileList(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, preserved: *mut ::core::ffi::c_void, ppprofilelist: *mut *mut WLAN_PROFILE_INFO_LIST) -> u32; } ::core::mem::transmute(WlanGetProfileList(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), ::core::mem::transmute(preserved), ::core::mem::transmute(ppprofilelist))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanGetSecuritySettings<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, securableobject: WLAN_SECURABLE_OBJECT, pvaluetype: *mut WLAN_OPCODE_VALUE_TYPE, pstrcurrentsddl: *mut super::super::Foundation::PWSTR, pdwgrantedaccess: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanGetSecuritySettings(hclienthandle: super::super::Foundation::HANDLE, securableobject: WLAN_SECURABLE_OBJECT, pvaluetype: *mut WLAN_OPCODE_VALUE_TYPE, pstrcurrentsddl: *mut super::super::Foundation::PWSTR, pdwgrantedaccess: *mut u32) -> u32; } ::core::mem::transmute(WlanGetSecuritySettings(hclienthandle.into_param().abi(), ::core::mem::transmute(securableobject), ::core::mem::transmute(pvaluetype), ::core::mem::transmute(pstrcurrentsddl), ::core::mem::transmute(pdwgrantedaccess))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanGetSupportedDeviceServices<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, ppdevsvcguidlist: *mut *mut WLAN_DEVICE_SERVICE_GUID_LIST) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanGetSupportedDeviceServices(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, ppdevsvcguidlist: *mut *mut WLAN_DEVICE_SERVICE_GUID_LIST) -> u32; } ::core::mem::transmute(WlanGetSupportedDeviceServices(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), ::core::mem::transmute(ppdevsvcguidlist))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanHostedNetworkForceStart<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanHostedNetworkForceStart(hclienthandle: super::super::Foundation::HANDLE, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanHostedNetworkForceStart(hclienthandle.into_param().abi(), ::core::mem::transmute(pfailreason), ::core::mem::transmute(pvreserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanHostedNetworkForceStop<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanHostedNetworkForceStop(hclienthandle: super::super::Foundation::HANDLE, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanHostedNetworkForceStop(hclienthandle.into_param().abi(), ::core::mem::transmute(pfailreason), ::core::mem::transmute(pvreserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanHostedNetworkInitSettings<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanHostedNetworkInitSettings(hclienthandle: super::super::Foundation::HANDLE, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanHostedNetworkInitSettings(hclienthandle.into_param().abi(), ::core::mem::transmute(pfailreason), ::core::mem::transmute(pvreserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanHostedNetworkQueryProperty<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, opcode: WLAN_HOSTED_NETWORK_OPCODE, pdwdatasize: *mut u32, ppvdata: *mut *mut ::core::ffi::c_void, pwlanopcodevaluetype: *mut WLAN_OPCODE_VALUE_TYPE, pvreserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanHostedNetworkQueryProperty(hclienthandle: super::super::Foundation::HANDLE, opcode: WLAN_HOSTED_NETWORK_OPCODE, pdwdatasize: *mut u32, ppvdata: *mut *mut ::core::ffi::c_void, pwlanopcodevaluetype: *mut WLAN_OPCODE_VALUE_TYPE, pvreserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanHostedNetworkQueryProperty(hclienthandle.into_param().abi(), ::core::mem::transmute(opcode), ::core::mem::transmute(pdwdatasize), ::core::mem::transmute(ppvdata), ::core::mem::transmute(pwlanopcodevaluetype), ::core::mem::transmute(pvreserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanHostedNetworkQuerySecondaryKey<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pdwkeylength: *mut u32, ppuckeydata: *mut *mut u8, pbispassphrase: *mut super::super::Foundation::BOOL, pbpersistent: *mut super::super::Foundation::BOOL, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanHostedNetworkQuerySecondaryKey(hclienthandle: super::super::Foundation::HANDLE, pdwkeylength: *mut u32, ppuckeydata: *mut *mut u8, pbispassphrase: *mut super::super::Foundation::BOOL, pbpersistent: *mut super::super::Foundation::BOOL, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanHostedNetworkQuerySecondaryKey(hclienthandle.into_param().abi(), ::core::mem::transmute(pdwkeylength), ::core::mem::transmute(ppuckeydata), ::core::mem::transmute(pbispassphrase), ::core::mem::transmute(pbpersistent), ::core::mem::transmute(pfailreason), ::core::mem::transmute(pvreserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanHostedNetworkQueryStatus<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, ppwlanhostednetworkstatus: *mut *mut WLAN_HOSTED_NETWORK_STATUS, pvreserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanHostedNetworkQueryStatus(hclienthandle: super::super::Foundation::HANDLE, ppwlanhostednetworkstatus: *mut *mut WLAN_HOSTED_NETWORK_STATUS, pvreserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanHostedNetworkQueryStatus(hclienthandle.into_param().abi(), ::core::mem::transmute(ppwlanhostednetworkstatus), ::core::mem::transmute(pvreserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanHostedNetworkRefreshSecuritySettings<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanHostedNetworkRefreshSecuritySettings(hclienthandle: super::super::Foundation::HANDLE, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanHostedNetworkRefreshSecuritySettings(hclienthandle.into_param().abi(), ::core::mem::transmute(pfailreason), ::core::mem::transmute(pvreserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanHostedNetworkSetProperty<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, opcode: WLAN_HOSTED_NETWORK_OPCODE, dwdatasize: u32, pvdata: *const ::core::ffi::c_void, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanHostedNetworkSetProperty(hclienthandle: super::super::Foundation::HANDLE, opcode: WLAN_HOSTED_NETWORK_OPCODE, dwdatasize: u32, pvdata: *const ::core::ffi::c_void, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanHostedNetworkSetProperty(hclienthandle.into_param().abi(), ::core::mem::transmute(opcode), ::core::mem::transmute(dwdatasize), ::core::mem::transmute(pvdata), ::core::mem::transmute(pfailreason), ::core::mem::transmute(pvreserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanHostedNetworkSetSecondaryKey<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(hclienthandle: Param0, dwkeylength: u32, puckeydata: *const u8, bispassphrase: Param3, bpersistent: Param4, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanHostedNetworkSetSecondaryKey(hclienthandle: super::super::Foundation::HANDLE, dwkeylength: u32, puckeydata: *const u8, bispassphrase: super::super::Foundation::BOOL, bpersistent: super::super::Foundation::BOOL, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanHostedNetworkSetSecondaryKey(hclienthandle.into_param().abi(), ::core::mem::transmute(dwkeylength), ::core::mem::transmute(puckeydata), bispassphrase.into_param().abi(), bpersistent.into_param().abi(), ::core::mem::transmute(pfailreason), ::core::mem::transmute(pvreserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanHostedNetworkStartUsing<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanHostedNetworkStartUsing(hclienthandle: super::super::Foundation::HANDLE, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanHostedNetworkStartUsing(hclienthandle.into_param().abi(), ::core::mem::transmute(pfailreason), ::core::mem::transmute(pvreserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanHostedNetworkStopUsing<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanHostedNetworkStopUsing(hclienthandle: super::super::Foundation::HANDLE, pfailreason: *mut WLAN_HOSTED_NETWORK_REASON, pvreserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanHostedNetworkStopUsing(hclienthandle.into_param().abi(), ::core::mem::transmute(pfailreason), ::core::mem::transmute(pvreserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanIhvControl<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, r#type: WLAN_IHV_CONTROL_TYPE, dwinbuffersize: u32, pinbuffer: *const ::core::ffi::c_void, dwoutbuffersize: u32, poutbuffer: *mut ::core::ffi::c_void, pdwbytesreturned: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanIhvControl(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, r#type: WLAN_IHV_CONTROL_TYPE, dwinbuffersize: u32, pinbuffer: *const ::core::ffi::c_void, dwoutbuffersize: u32, poutbuffer: *mut ::core::ffi::c_void, pdwbytesreturned: *mut u32) -> u32; } ::core::mem::transmute(WlanIhvControl( hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), ::core::mem::transmute(r#type), ::core::mem::transmute(dwinbuffersize), ::core::mem::transmute(pinbuffer), ::core::mem::transmute(dwoutbuffersize), ::core::mem::transmute(poutbuffer), ::core::mem::transmute(pdwbytesreturned), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanOpenHandle(dwclientversion: u32, preserved: *mut ::core::ffi::c_void, pdwnegotiatedversion: *mut u32, phclienthandle: *mut super::super::Foundation::HANDLE) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanOpenHandle(dwclientversion: u32, preserved: *mut ::core::ffi::c_void, pdwnegotiatedversion: *mut u32, phclienthandle: *mut super::super::Foundation::HANDLE) -> u32; } ::core::mem::transmute(WlanOpenHandle(::core::mem::transmute(dwclientversion), ::core::mem::transmute(preserved), ::core::mem::transmute(pdwnegotiatedversion), ::core::mem::transmute(phclienthandle))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanQueryAutoConfigParameter<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, opcode: WLAN_AUTOCONF_OPCODE, preserved: *mut ::core::ffi::c_void, pdwdatasize: *mut u32, ppdata: *mut *mut ::core::ffi::c_void, pwlanopcodevaluetype: *mut WLAN_OPCODE_VALUE_TYPE) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanQueryAutoConfigParameter(hclienthandle: super::super::Foundation::HANDLE, opcode: WLAN_AUTOCONF_OPCODE, preserved: *mut ::core::ffi::c_void, pdwdatasize: *mut u32, ppdata: *mut *mut ::core::ffi::c_void, pwlanopcodevaluetype: *mut WLAN_OPCODE_VALUE_TYPE) -> u32; } ::core::mem::transmute(WlanQueryAutoConfigParameter(hclienthandle.into_param().abi(), ::core::mem::transmute(opcode), ::core::mem::transmute(preserved), ::core::mem::transmute(pdwdatasize), ::core::mem::transmute(ppdata), ::core::mem::transmute(pwlanopcodevaluetype))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanQueryInterface<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, opcode: WLAN_INTF_OPCODE, preserved: *mut ::core::ffi::c_void, pdwdatasize: *mut u32, ppdata: *mut *mut ::core::ffi::c_void, pwlanopcodevaluetype: *mut WLAN_OPCODE_VALUE_TYPE) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanQueryInterface(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, opcode: WLAN_INTF_OPCODE, preserved: *mut ::core::ffi::c_void, pdwdatasize: *mut u32, ppdata: *mut *mut ::core::ffi::c_void, pwlanopcodevaluetype: *mut WLAN_OPCODE_VALUE_TYPE) -> u32; } ::core::mem::transmute(WlanQueryInterface(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), ::core::mem::transmute(opcode), ::core::mem::transmute(preserved), ::core::mem::transmute(pdwdatasize), ::core::mem::transmute(ppdata), ::core::mem::transmute(pwlanopcodevaluetype))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanReasonCodeToString<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(dwreasoncode: u32, dwbuffersize: u32, pstringbuffer: Param2, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanReasonCodeToString(dwreasoncode: u32, dwbuffersize: u32, pstringbuffer: super::super::Foundation::PWSTR, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanReasonCodeToString(::core::mem::transmute(dwreasoncode), ::core::mem::transmute(dwbuffersize), pstringbuffer.into_param().abi(), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanRegisterDeviceServiceNotification<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pdevsvcguidlist: *const WLAN_DEVICE_SERVICE_GUID_LIST) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanRegisterDeviceServiceNotification(hclienthandle: super::super::Foundation::HANDLE, pdevsvcguidlist: *const WLAN_DEVICE_SERVICE_GUID_LIST) -> u32; } ::core::mem::transmute(WlanRegisterDeviceServiceNotification(hclienthandle.into_param().abi(), ::core::mem::transmute(pdevsvcguidlist))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanRegisterNotification<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(hclienthandle: Param0, dwnotifsource: u32, bignoreduplicate: Param2, funccallback: ::core::option::Option<WLAN_NOTIFICATION_CALLBACK>, pcallbackcontext: *const ::core::ffi::c_void, preserved: *mut ::core::ffi::c_void, pdwprevnotifsource: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanRegisterNotification(hclienthandle: super::super::Foundation::HANDLE, dwnotifsource: u32, bignoreduplicate: super::super::Foundation::BOOL, funccallback: ::windows::core::RawPtr, pcallbackcontext: *const ::core::ffi::c_void, preserved: *mut ::core::ffi::c_void, pdwprevnotifsource: *mut u32) -> u32; } ::core::mem::transmute(WlanRegisterNotification(hclienthandle.into_param().abi(), ::core::mem::transmute(dwnotifsource), bignoreduplicate.into_param().abi(), ::core::mem::transmute(funccallback), ::core::mem::transmute(pcallbackcontext), ::core::mem::transmute(preserved), ::core::mem::transmute(pdwprevnotifsource))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanRegisterVirtualStationNotification<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(hclienthandle: Param0, bregister: Param1, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanRegisterVirtualStationNotification(hclienthandle: super::super::Foundation::HANDLE, bregister: super::super::Foundation::BOOL, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanRegisterVirtualStationNotification(hclienthandle.into_param().abi(), bregister.into_param().abi(), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanRenameProfile<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, stroldprofilename: Param2, strnewprofilename: Param3, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanRenameProfile(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, stroldprofilename: super::super::Foundation::PWSTR, strnewprofilename: super::super::Foundation::PWSTR, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanRenameProfile(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), stroldprofilename.into_param().abi(), strnewprofilename.into_param().abi(), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanSaveTemporaryProfile<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>( hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, strprofilename: Param2, stralluserprofilesecurity: Param3, dwflags: u32, boverwrite: Param5, preserved: *mut ::core::ffi::c_void, ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanSaveTemporaryProfile(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, strprofilename: super::super::Foundation::PWSTR, stralluserprofilesecurity: super::super::Foundation::PWSTR, dwflags: u32, boverwrite: super::super::Foundation::BOOL, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanSaveTemporaryProfile(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), strprofilename.into_param().abi(), stralluserprofilesecurity.into_param().abi(), ::core::mem::transmute(dwflags), boverwrite.into_param().abi(), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanScan<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, pdot11ssid: *const DOT11_SSID, piedata: *const WLAN_RAW_DATA, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanScan(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, pdot11ssid: *const DOT11_SSID, piedata: *const WLAN_RAW_DATA, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanScan(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), ::core::mem::transmute(pdot11ssid), ::core::mem::transmute(piedata), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanSetAutoConfigParameter<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, opcode: WLAN_AUTOCONF_OPCODE, dwdatasize: u32, pdata: *const ::core::ffi::c_void, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanSetAutoConfigParameter(hclienthandle: super::super::Foundation::HANDLE, opcode: WLAN_AUTOCONF_OPCODE, dwdatasize: u32, pdata: *const ::core::ffi::c_void, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanSetAutoConfigParameter(hclienthandle.into_param().abi(), ::core::mem::transmute(opcode), ::core::mem::transmute(dwdatasize), ::core::mem::transmute(pdata), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanSetFilterList<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, wlanfilterlisttype: WLAN_FILTER_LIST_TYPE, pnetworklist: *const DOT11_NETWORK_LIST, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanSetFilterList(hclienthandle: super::super::Foundation::HANDLE, wlanfilterlisttype: WLAN_FILTER_LIST_TYPE, pnetworklist: *const DOT11_NETWORK_LIST, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanSetFilterList(hclienthandle.into_param().abi(), ::core::mem::transmute(wlanfilterlisttype), ::core::mem::transmute(pnetworklist), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanSetInterface<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, opcode: WLAN_INTF_OPCODE, dwdatasize: u32, pdata: *const ::core::ffi::c_void, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanSetInterface(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, opcode: WLAN_INTF_OPCODE, dwdatasize: u32, pdata: *const ::core::ffi::c_void, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanSetInterface(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), ::core::mem::transmute(opcode), ::core::mem::transmute(dwdatasize), ::core::mem::transmute(pdata), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanSetProfile<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>( hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, dwflags: u32, strprofilexml: Param3, stralluserprofilesecurity: Param4, boverwrite: Param5, preserved: *mut ::core::ffi::c_void, pdwreasoncode: *mut u32, ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanSetProfile(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, dwflags: u32, strprofilexml: super::super::Foundation::PWSTR, stralluserprofilesecurity: super::super::Foundation::PWSTR, boverwrite: super::super::Foundation::BOOL, preserved: *mut ::core::ffi::c_void, pdwreasoncode: *mut u32) -> u32; } ::core::mem::transmute(WlanSetProfile( hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), ::core::mem::transmute(dwflags), strprofilexml.into_param().abi(), stralluserprofilesecurity.into_param().abi(), boverwrite.into_param().abi(), ::core::mem::transmute(preserved), ::core::mem::transmute(pdwreasoncode), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanSetProfileCustomUserData<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, strprofilename: Param2, dwdatasize: u32, pdata: *const u8, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanSetProfileCustomUserData(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, strprofilename: super::super::Foundation::PWSTR, dwdatasize: u32, pdata: *const u8, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanSetProfileCustomUserData(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), strprofilename.into_param().abi(), ::core::mem::transmute(dwdatasize), ::core::mem::transmute(pdata), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Security_ExtensibleAuthenticationProtocol"))] #[inline] pub unsafe fn WlanSetProfileEapUserData<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Security::ExtensibleAuthenticationProtocol::EAP_METHOD_TYPE>>( hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, strprofilename: Param2, eaptype: Param3, dwflags: WLAN_SET_EAPHOST_FLAGS, dweapuserdatasize: u32, pbeapuserdata: *const u8, preserved: *mut ::core::ffi::c_void, ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanSetProfileEapUserData(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, strprofilename: super::super::Foundation::PWSTR, eaptype: super::super::Security::ExtensibleAuthenticationProtocol::EAP_METHOD_TYPE, dwflags: WLAN_SET_EAPHOST_FLAGS, dweapuserdatasize: u32, pbeapuserdata: *const u8, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanSetProfileEapUserData( hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), strprofilename.into_param().abi(), eaptype.into_param().abi(), ::core::mem::transmute(dwflags), ::core::mem::transmute(dweapuserdatasize), ::core::mem::transmute(pbeapuserdata), ::core::mem::transmute(preserved), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanSetProfileEapXmlUserData<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, strprofilename: Param2, dwflags: WLAN_SET_EAPHOST_FLAGS, streapxmluserdata: Param4, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanSetProfileEapXmlUserData(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, strprofilename: super::super::Foundation::PWSTR, dwflags: WLAN_SET_EAPHOST_FLAGS, streapxmluserdata: super::super::Foundation::PWSTR, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanSetProfileEapXmlUserData(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), strprofilename.into_param().abi(), ::core::mem::transmute(dwflags), streapxmluserdata.into_param().abi(), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanSetProfileList<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, dwitems: u32, strprofilenames: *const super::super::Foundation::PWSTR, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanSetProfileList(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, dwitems: u32, strprofilenames: *const super::super::Foundation::PWSTR, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanSetProfileList(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), ::core::mem::transmute(dwitems), ::core::mem::transmute(strprofilenames), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanSetProfilePosition<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hclienthandle: Param0, pinterfaceguid: *const ::windows::core::GUID, strprofilename: Param2, dwposition: u32, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanSetProfilePosition(hclienthandle: super::super::Foundation::HANDLE, pinterfaceguid: *const ::windows::core::GUID, strprofilename: super::super::Foundation::PWSTR, dwposition: u32, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanSetProfilePosition(hclienthandle.into_param().abi(), ::core::mem::transmute(pinterfaceguid), strprofilename.into_param().abi(), ::core::mem::transmute(dwposition), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanSetPsdIEDataList<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hclienthandle: Param0, strformat: Param1, ppsdiedatalist: *const WLAN_RAW_DATA_LIST, preserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanSetPsdIEDataList(hclienthandle: super::super::Foundation::HANDLE, strformat: super::super::Foundation::PWSTR, ppsdiedatalist: *const WLAN_RAW_DATA_LIST, preserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(WlanSetPsdIEDataList(hclienthandle.into_param().abi(), strformat.into_param().abi(), ::core::mem::transmute(ppsdiedatalist), ::core::mem::transmute(preserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanSetSecuritySettings<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hclienthandle: Param0, securableobject: WLAN_SECURABLE_OBJECT, strmodifiedsddl: Param2) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanSetSecuritySettings(hclienthandle: super::super::Foundation::HANDLE, securableobject: WLAN_SECURABLE_OBJECT, strmodifiedsddl: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(WlanSetSecuritySettings(hclienthandle.into_param().abi(), ::core::mem::transmute(securableobject), strmodifiedsddl.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn WlanUIEditProfile<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(dwclientversion: u32, wstrprofilename: Param1, pinterfaceguid: *const ::windows::core::GUID, hwnd: Param3, wlstartpage: WL_DISPLAY_PAGES, preserved: *mut ::core::ffi::c_void, pwlanreasoncode: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn WlanUIEditProfile(dwclientversion: u32, wstrprofilename: super::super::Foundation::PWSTR, pinterfaceguid: *const ::windows::core::GUID, hwnd: super::super::Foundation::HWND, wlstartpage: WL_DISPLAY_PAGES, preserved: *mut ::core::ffi::c_void, pwlanreasoncode: *mut u32) -> u32; } ::core::mem::transmute(WlanUIEditProfile(::core::mem::transmute(dwclientversion), wstrprofilename.into_param().abi(), ::core::mem::transmute(pinterfaceguid), hwnd.into_param().abi(), ::core::mem::transmute(wlstartpage), ::core::mem::transmute(preserved), ::core::mem::transmute(pwlanreasoncode))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct _DOT11_WME_AC_PARAMTERS_LIST { pub uNumOfEntries: u32, pub uTotalNumOfEntries: u32, pub dot11WMEACParameters: [DOT11_WME_AC_PARAMETERS; 1], } impl _DOT11_WME_AC_PARAMTERS_LIST {} impl ::core::default::Default for _DOT11_WME_AC_PARAMTERS_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for _DOT11_WME_AC_PARAMTERS_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("_DOT11_WME_AC_PARAMTERS_LIST").field("uNumOfEntries", &self.uNumOfEntries).field("uTotalNumOfEntries", &self.uTotalNumOfEntries).field("dot11WMEACParameters", &self.dot11WMEACParameters).finish() } } impl ::core::cmp::PartialEq for _DOT11_WME_AC_PARAMTERS_LIST { fn eq(&self, other: &Self) -> bool { self.uNumOfEntries == other.uNumOfEntries && self.uTotalNumOfEntries == other.uTotalNumOfEntries && self.dot11WMEACParameters == other.dot11WMEACParameters } } impl ::core::cmp::Eq for _DOT11_WME_AC_PARAMTERS_LIST {} unsafe impl ::windows::core::Abi for _DOT11_WME_AC_PARAMTERS_LIST { type Abi = Self; }
#[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } } #[cfg(any(feature="mysql_async", feature="mysql_pool_async"))] pub mod mysqlaccessor; #[cfg(feature="mysql_async")] pub mod mysqlaccessor_async; #[cfg(feature="mysql_pool_async")] pub mod mysqlaccessor_pool_async; #[cfg(feature="http_async")] pub mod httpaccessor; #[cfg(any(feature="redis_async", feature="redis_actix"))] pub mod redisaccessor; #[cfg(feature="redis_async")] pub mod redisaccessor_async; #[cfg(feature="redis_actix")] pub mod redisaccessor_actix;
#[doc = r" Value read from the register"] pub struct R { bits: u32, } #[doc = r" Value to write to the register"] pub struct W { bits: u32, } impl super::RXADDRESSES { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W, { let bits = self.register.get(); let r = R { bits: bits }; let mut w = W { bits: bits }; f(&r, &mut w); self.register.set(w.bits); } #[doc = r" Reads the contents of the register"] #[inline] pub fn read(&self) -> R { R { bits: self.register.get(), } } #[doc = r" Writes to the register"] #[inline] pub fn write<F>(&self, f: F) where F: FnOnce(&mut W) -> &mut W, { let mut w = W::reset_value(); f(&mut w); self.register.set(w.bits); } #[doc = r" Writes the reset value to the register"] #[inline] pub fn reset(&self) { self.write(|w| w) } } #[doc = "Possible values of the field `ADDR0`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum ADDR0R { #[doc = "Reception disabled."] DISABLED, #[doc = "Reception enabled."] ENABLED, } impl ADDR0R { #[doc = r" Returns `true` if the bit is clear (0)"] #[inline] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r" Returns `true` if the bit is set (1)"] #[inline] pub fn bit_is_set(&self) -> bool { self.bit() } #[doc = r" Value of the field as raw bits"] #[inline] pub fn bit(&self) -> bool { match *self { ADDR0R::DISABLED => false, ADDR0R::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> ADDR0R { match value { false => ADDR0R::DISABLED, true => ADDR0R::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == ADDR0R::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == ADDR0R::ENABLED } } #[doc = "Possible values of the field `ADDR1`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum ADDR1R { #[doc = "Reception disabled."] DISABLED, #[doc = "Reception enabled."] ENABLED, } impl ADDR1R { #[doc = r" Returns `true` if the bit is clear (0)"] #[inline] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r" Returns `true` if the bit is set (1)"] #[inline] pub fn bit_is_set(&self) -> bool { self.bit() } #[doc = r" Value of the field as raw bits"] #[inline] pub fn bit(&self) -> bool { match *self { ADDR1R::DISABLED => false, ADDR1R::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> ADDR1R { match value { false => ADDR1R::DISABLED, true => ADDR1R::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == ADDR1R::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == ADDR1R::ENABLED } } #[doc = "Possible values of the field `ADDR2`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum ADDR2R { #[doc = "Reception disabled."] DISABLED, #[doc = "Reception enabled."] ENABLED, } impl ADDR2R { #[doc = r" Returns `true` if the bit is clear (0)"] #[inline] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r" Returns `true` if the bit is set (1)"] #[inline] pub fn bit_is_set(&self) -> bool { self.bit() } #[doc = r" Value of the field as raw bits"] #[inline] pub fn bit(&self) -> bool { match *self { ADDR2R::DISABLED => false, ADDR2R::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> ADDR2R { match value { false => ADDR2R::DISABLED, true => ADDR2R::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == ADDR2R::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == ADDR2R::ENABLED } } #[doc = "Possible values of the field `ADDR3`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum ADDR3R { #[doc = "Reception disabled."] DISABLED, #[doc = "Reception enabled."] ENABLED, } impl ADDR3R { #[doc = r" Returns `true` if the bit is clear (0)"] #[inline] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r" Returns `true` if the bit is set (1)"] #[inline] pub fn bit_is_set(&self) -> bool { self.bit() } #[doc = r" Value of the field as raw bits"] #[inline] pub fn bit(&self) -> bool { match *self { ADDR3R::DISABLED => false, ADDR3R::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> ADDR3R { match value { false => ADDR3R::DISABLED, true => ADDR3R::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == ADDR3R::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == ADDR3R::ENABLED } } #[doc = "Possible values of the field `ADDR4`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum ADDR4R { #[doc = "Reception disabled."] DISABLED, #[doc = "Reception enabled."] ENABLED, } impl ADDR4R { #[doc = r" Returns `true` if the bit is clear (0)"] #[inline] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r" Returns `true` if the bit is set (1)"] #[inline] pub fn bit_is_set(&self) -> bool { self.bit() } #[doc = r" Value of the field as raw bits"] #[inline] pub fn bit(&self) -> bool { match *self { ADDR4R::DISABLED => false, ADDR4R::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> ADDR4R { match value { false => ADDR4R::DISABLED, true => ADDR4R::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == ADDR4R::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == ADDR4R::ENABLED } } #[doc = "Possible values of the field `ADDR5`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum ADDR5R { #[doc = "Reception disabled."] DISABLED, #[doc = "Reception enabled."] ENABLED, } impl ADDR5R { #[doc = r" Returns `true` if the bit is clear (0)"] #[inline] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r" Returns `true` if the bit is set (1)"] #[inline] pub fn bit_is_set(&self) -> bool { self.bit() } #[doc = r" Value of the field as raw bits"] #[inline] pub fn bit(&self) -> bool { match *self { ADDR5R::DISABLED => false, ADDR5R::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> ADDR5R { match value { false => ADDR5R::DISABLED, true => ADDR5R::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == ADDR5R::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == ADDR5R::ENABLED } } #[doc = "Possible values of the field `ADDR6`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum ADDR6R { #[doc = "Reception disabled."] DISABLED, #[doc = "Reception enabled."] ENABLED, } impl ADDR6R { #[doc = r" Returns `true` if the bit is clear (0)"] #[inline] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r" Returns `true` if the bit is set (1)"] #[inline] pub fn bit_is_set(&self) -> bool { self.bit() } #[doc = r" Value of the field as raw bits"] #[inline] pub fn bit(&self) -> bool { match *self { ADDR6R::DISABLED => false, ADDR6R::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> ADDR6R { match value { false => ADDR6R::DISABLED, true => ADDR6R::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == ADDR6R::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == ADDR6R::ENABLED } } #[doc = "Possible values of the field `ADDR7`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum ADDR7R { #[doc = "Reception disabled."] DISABLED, #[doc = "Reception enabled."] ENABLED, } impl ADDR7R { #[doc = r" Returns `true` if the bit is clear (0)"] #[inline] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r" Returns `true` if the bit is set (1)"] #[inline] pub fn bit_is_set(&self) -> bool { self.bit() } #[doc = r" Value of the field as raw bits"] #[inline] pub fn bit(&self) -> bool { match *self { ADDR7R::DISABLED => false, ADDR7R::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> ADDR7R { match value { false => ADDR7R::DISABLED, true => ADDR7R::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == ADDR7R::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == ADDR7R::ENABLED } } #[doc = "Values that can be written to the field `ADDR0`"] pub enum ADDR0W { #[doc = "Reception disabled."] DISABLED, #[doc = "Reception enabled."] ENABLED, } impl ADDR0W { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { ADDR0W::DISABLED => false, ADDR0W::ENABLED => true, } } } #[doc = r" Proxy"] pub struct _ADDR0W<'a> { w: &'a mut W, } impl<'a> _ADDR0W<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: ADDR0W) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Reception disabled."] #[inline] pub fn disabled(self) -> &'a mut W { self.variant(ADDR0W::DISABLED) } #[doc = "Reception enabled."] #[inline] pub fn enabled(self) -> &'a mut W { self.variant(ADDR0W::ENABLED) } #[doc = r" Sets the field bit"] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r" Clears the field bit"] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r" Writes raw bits to the field"] #[inline] pub fn bit(self, value: bool) -> &'a mut W { const MASK: bool = true; const OFFSET: u8 = 0; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } #[doc = "Values that can be written to the field `ADDR1`"] pub enum ADDR1W { #[doc = "Reception disabled."] DISABLED, #[doc = "Reception enabled."] ENABLED, } impl ADDR1W { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { ADDR1W::DISABLED => false, ADDR1W::ENABLED => true, } } } #[doc = r" Proxy"] pub struct _ADDR1W<'a> { w: &'a mut W, } impl<'a> _ADDR1W<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: ADDR1W) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Reception disabled."] #[inline] pub fn disabled(self) -> &'a mut W { self.variant(ADDR1W::DISABLED) } #[doc = "Reception enabled."] #[inline] pub fn enabled(self) -> &'a mut W { self.variant(ADDR1W::ENABLED) } #[doc = r" Sets the field bit"] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r" Clears the field bit"] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r" Writes raw bits to the field"] #[inline] pub fn bit(self, value: bool) -> &'a mut W { const MASK: bool = true; const OFFSET: u8 = 1; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } #[doc = "Values that can be written to the field `ADDR2`"] pub enum ADDR2W { #[doc = "Reception disabled."] DISABLED, #[doc = "Reception enabled."] ENABLED, } impl ADDR2W { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { ADDR2W::DISABLED => false, ADDR2W::ENABLED => true, } } } #[doc = r" Proxy"] pub struct _ADDR2W<'a> { w: &'a mut W, } impl<'a> _ADDR2W<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: ADDR2W) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Reception disabled."] #[inline] pub fn disabled(self) -> &'a mut W { self.variant(ADDR2W::DISABLED) } #[doc = "Reception enabled."] #[inline] pub fn enabled(self) -> &'a mut W { self.variant(ADDR2W::ENABLED) } #[doc = r" Sets the field bit"] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r" Clears the field bit"] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r" Writes raw bits to the field"] #[inline] pub fn bit(self, value: bool) -> &'a mut W { const MASK: bool = true; const OFFSET: u8 = 2; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } #[doc = "Values that can be written to the field `ADDR3`"] pub enum ADDR3W { #[doc = "Reception disabled."] DISABLED, #[doc = "Reception enabled."] ENABLED, } impl ADDR3W { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { ADDR3W::DISABLED => false, ADDR3W::ENABLED => true, } } } #[doc = r" Proxy"] pub struct _ADDR3W<'a> { w: &'a mut W, } impl<'a> _ADDR3W<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: ADDR3W) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Reception disabled."] #[inline] pub fn disabled(self) -> &'a mut W { self.variant(ADDR3W::DISABLED) } #[doc = "Reception enabled."] #[inline] pub fn enabled(self) -> &'a mut W { self.variant(ADDR3W::ENABLED) } #[doc = r" Sets the field bit"] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r" Clears the field bit"] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r" Writes raw bits to the field"] #[inline] pub fn bit(self, value: bool) -> &'a mut W { const MASK: bool = true; const OFFSET: u8 = 3; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } #[doc = "Values that can be written to the field `ADDR4`"] pub enum ADDR4W { #[doc = "Reception disabled."] DISABLED, #[doc = "Reception enabled."] ENABLED, } impl ADDR4W { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { ADDR4W::DISABLED => false, ADDR4W::ENABLED => true, } } } #[doc = r" Proxy"] pub struct _ADDR4W<'a> { w: &'a mut W, } impl<'a> _ADDR4W<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: ADDR4W) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Reception disabled."] #[inline] pub fn disabled(self) -> &'a mut W { self.variant(ADDR4W::DISABLED) } #[doc = "Reception enabled."] #[inline] pub fn enabled(self) -> &'a mut W { self.variant(ADDR4W::ENABLED) } #[doc = r" Sets the field bit"] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r" Clears the field bit"] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r" Writes raw bits to the field"] #[inline] pub fn bit(self, value: bool) -> &'a mut W { const MASK: bool = true; const OFFSET: u8 = 4; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } #[doc = "Values that can be written to the field `ADDR5`"] pub enum ADDR5W { #[doc = "Reception disabled."] DISABLED, #[doc = "Reception enabled."] ENABLED, } impl ADDR5W { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { ADDR5W::DISABLED => false, ADDR5W::ENABLED => true, } } } #[doc = r" Proxy"] pub struct _ADDR5W<'a> { w: &'a mut W, } impl<'a> _ADDR5W<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: ADDR5W) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Reception disabled."] #[inline] pub fn disabled(self) -> &'a mut W { self.variant(ADDR5W::DISABLED) } #[doc = "Reception enabled."] #[inline] pub fn enabled(self) -> &'a mut W { self.variant(ADDR5W::ENABLED) } #[doc = r" Sets the field bit"] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r" Clears the field bit"] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r" Writes raw bits to the field"] #[inline] pub fn bit(self, value: bool) -> &'a mut W { const MASK: bool = true; const OFFSET: u8 = 5; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } #[doc = "Values that can be written to the field `ADDR6`"] pub enum ADDR6W { #[doc = "Reception disabled."] DISABLED, #[doc = "Reception enabled."] ENABLED, } impl ADDR6W { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { ADDR6W::DISABLED => false, ADDR6W::ENABLED => true, } } } #[doc = r" Proxy"] pub struct _ADDR6W<'a> { w: &'a mut W, } impl<'a> _ADDR6W<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: ADDR6W) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Reception disabled."] #[inline] pub fn disabled(self) -> &'a mut W { self.variant(ADDR6W::DISABLED) } #[doc = "Reception enabled."] #[inline] pub fn enabled(self) -> &'a mut W { self.variant(ADDR6W::ENABLED) } #[doc = r" Sets the field bit"] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r" Clears the field bit"] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r" Writes raw bits to the field"] #[inline] pub fn bit(self, value: bool) -> &'a mut W { const MASK: bool = true; const OFFSET: u8 = 6; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } #[doc = "Values that can be written to the field `ADDR7`"] pub enum ADDR7W { #[doc = "Reception disabled."] DISABLED, #[doc = "Reception enabled."] ENABLED, } impl ADDR7W { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { ADDR7W::DISABLED => false, ADDR7W::ENABLED => true, } } } #[doc = r" Proxy"] pub struct _ADDR7W<'a> { w: &'a mut W, } impl<'a> _ADDR7W<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: ADDR7W) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Reception disabled."] #[inline] pub fn disabled(self) -> &'a mut W { self.variant(ADDR7W::DISABLED) } #[doc = "Reception enabled."] #[inline] pub fn enabled(self) -> &'a mut W { self.variant(ADDR7W::ENABLED) } #[doc = r" Sets the field bit"] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r" Clears the field bit"] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r" Writes raw bits to the field"] #[inline] pub fn bit(self, value: bool) -> &'a mut W { const MASK: bool = true; const OFFSET: u8 = 7; self.w.bits &= !((MASK as u32) << OFFSET); self.w.bits |= ((value & MASK) as u32) << OFFSET; self.w } } impl R { #[doc = r" Value of the register as raw bits"] #[inline] pub fn bits(&self) -> u32 { self.bits } #[doc = "Bit 0 - Enable reception on logical address 0. Decision point: START task."] #[inline] pub fn addr0(&self) -> ADDR0R { ADDR0R::_from({ const MASK: bool = true; const OFFSET: u8 = 0; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 1 - Enable reception on logical address 1. Decision point: START task."] #[inline] pub fn addr1(&self) -> ADDR1R { ADDR1R::_from({ const MASK: bool = true; const OFFSET: u8 = 1; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 2 - Enable reception on logical address 2. Decision point: START task."] #[inline] pub fn addr2(&self) -> ADDR2R { ADDR2R::_from({ const MASK: bool = true; const OFFSET: u8 = 2; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 3 - Enable reception on logical address 3. Decision point: START task."] #[inline] pub fn addr3(&self) -> ADDR3R { ADDR3R::_from({ const MASK: bool = true; const OFFSET: u8 = 3; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 4 - Enable reception on logical address 4. Decision point: START task."] #[inline] pub fn addr4(&self) -> ADDR4R { ADDR4R::_from({ const MASK: bool = true; const OFFSET: u8 = 4; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 5 - Enable reception on logical address 5. Decision point: START task."] #[inline] pub fn addr5(&self) -> ADDR5R { ADDR5R::_from({ const MASK: bool = true; const OFFSET: u8 = 5; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 6 - Enable reception on logical address 6. Decision point: START task."] #[inline] pub fn addr6(&self) -> ADDR6R { ADDR6R::_from({ const MASK: bool = true; const OFFSET: u8 = 6; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 7 - Enable reception on logical address 7. Decision point: START task."] #[inline] pub fn addr7(&self) -> ADDR7R { ADDR7R::_from({ const MASK: bool = true; const OFFSET: u8 = 7; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } } impl W { #[doc = r" Reset value of the register"] #[inline] pub fn reset_value() -> W { W { bits: 0 } } #[doc = r" Writes raw bits to the register"] #[inline] pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { self.bits = bits; self } #[doc = "Bit 0 - Enable reception on logical address 0. Decision point: START task."] #[inline] pub fn addr0(&mut self) -> _ADDR0W { _ADDR0W { w: self } } #[doc = "Bit 1 - Enable reception on logical address 1. Decision point: START task."] #[inline] pub fn addr1(&mut self) -> _ADDR1W { _ADDR1W { w: self } } #[doc = "Bit 2 - Enable reception on logical address 2. Decision point: START task."] #[inline] pub fn addr2(&mut self) -> _ADDR2W { _ADDR2W { w: self } } #[doc = "Bit 3 - Enable reception on logical address 3. Decision point: START task."] #[inline] pub fn addr3(&mut self) -> _ADDR3W { _ADDR3W { w: self } } #[doc = "Bit 4 - Enable reception on logical address 4. Decision point: START task."] #[inline] pub fn addr4(&mut self) -> _ADDR4W { _ADDR4W { w: self } } #[doc = "Bit 5 - Enable reception on logical address 5. Decision point: START task."] #[inline] pub fn addr5(&mut self) -> _ADDR5W { _ADDR5W { w: self } } #[doc = "Bit 6 - Enable reception on logical address 6. Decision point: START task."] #[inline] pub fn addr6(&mut self) -> _ADDR6W { _ADDR6W { w: self } } #[doc = "Bit 7 - Enable reception on logical address 7. Decision point: START task."] #[inline] pub fn addr7(&mut self) -> _ADDR7W { _ADDR7W { w: self } } }
use anyhow::{anyhow, Result}; use pathdiff::diff_paths; use std::path::{Component, PathBuf}; use std::vec; pub fn normalize(path: &PathBuf) -> Result<PathBuf> { let mut skip = 0; let mut components = vec![]; for component in path.components().into_iter().rev() { match component { Component::Normal(_) => { if skip > 0 { skip -= 1; } else { components.push(component); } } Component::CurDir => (), Component::ParentDir => { skip += 1; } _ => { components.push(component); } } } match skip { 0 => Ok(components.into_iter().rev().collect()), _ => Err(anyhow!("Failed to normalize path {:?}", path)), } } pub fn diff(from_path: &PathBuf, to_path: &PathBuf) -> Result<PathBuf> { let normalized_from_path = normalize(from_path)?; let normalized_to_path = normalize(to_path)?; diff_paths(normalized_to_path, normalized_from_path).ok_or_else(|| { anyhow!( "Failed to get relative path from {:?} to {:?}", from_path, to_path, ) }) } pub fn get_parent(path: &PathBuf) -> PathBuf { let mut path = path.clone(); path.pop(); path } pub fn join(dir: &PathBuf, path: &PathBuf) -> Result<PathBuf> { let full_path = dir.join(path); normalize(&full_path) } #[cfg(test)] mod tests { use std::path::PathBuf; macro_rules! normalize_path_tests { ($($name:ident: $value:expr,)*) => { $( #[test] fn $name() { let (path, expected) = $value; let expected: PathBuf = expected.into(); let path: PathBuf = path.into(); let result = super::normalize(&path).unwrap(); assert_eq!(expected, result); } )* } } normalize_path_tests! { strips_0: ("a/b/../c", "a/c"), strips_1: ("a/b/./../c", "a/c"), strips_2: ("a/b/./../c/d", "a/c/d"), strips_3: ("a/b/./../c/d/e/../f", "a/c/d/f"), strips_4: ("/a/b/./../c/d/e/../f", "/a/c/d/f"), strips_5: ("/a/b/./../c/d/e/../f.svg", "/a/c/d/f.svg"), } }
pub use VkColorSpaceKHR::*; #[repr(u32)] #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum VkColorSpaceKHR { VK_COLOR_SPACE_SRGB_NONLINEAR_KHR = 0, VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT = 1000104001, VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT = 1000104002, VK_COLOR_SPACE_SCRGB_LINEAR_EXT = 1000104003, VK_COLOR_SPACE_SCRGB_NONLINEAR_EXT = 1000104004, VK_COLOR_SPACE_DCI_P3_LINEAR_EXT = 1000104005, VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT = 1000104006, VK_COLOR_SPACE_BT709_LINEAR_EXT = 1000104007, VK_COLOR_SPACE_BT709_NONLINEAR_EXT = 1000104008, VK_COLOR_SPACE_BT2020_LINEAR_EXT = 1000104009, VK_COLOR_SPACE_BT2020_NONLINEAR_EXT = 1000104010, VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT = 1000104011, VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT = 1000104012, } impl Default for VkColorSpaceKHR { fn default() -> Self { VK_COLOR_SPACE_SRGB_NONLINEAR_KHR } }
use crate::context::Context; use crate::position::{lsp_position_to_kakoune, lsp_range_to_kakoune}; use crate::types::{EditorMeta, EditorParams, KakounePosition}; use crate::util::{apply_text_edits, editor_quote}; use crate::workspace; use lsp_types::request::Request; use lsp_types::ExecuteCommandParams; use lsp_types::InsertTextFormat; use lsp_types::TextEdit; use lsp_types::VersionedTextDocumentIdentifier; use lsp_types::{Range, ResourceOp, TextDocumentIdentifier, TextDocumentPositionParams}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use url::Url; pub enum InlayHints {} impl Request for InlayHints { type Params = InlayHintsParams; type Result = Vec<InlayHint>; const METHOD: &'static str = "rust-analyzer/inlayHints"; } #[derive(Serialize, Deserialize, Debug)] #[serde(rename_all = "camelCase")] pub struct InlayHintsParams { pub text_document: TextDocumentIdentifier, } #[derive(Debug, PartialEq, Eq, Deserialize, Serialize)] pub enum InlayKind { TypeHint, ParameterHint, ChainingHint, } #[derive(Debug, Deserialize, Serialize)] pub struct InlayHint { pub range: Range, pub kind: InlayKind, pub label: String, } pub fn inlay_hints(meta: EditorMeta, _params: EditorParams, ctx: &mut Context) { let req_params = InlayHintsParams { text_document: TextDocumentIdentifier { uri: Url::from_file_path(&meta.buffile).unwrap(), }, }; ctx.call::<InlayHints, _>(meta, req_params, move |ctx, meta, response| { inlay_hints_response(meta, response, ctx) }); } pub fn inlay_hints_response(meta: EditorMeta, inlay_hints: Vec<InlayHint>, ctx: &mut Context) { let document = match ctx.documents.get(&meta.buffile) { Some(document) => document, None => return, }; let ranges = inlay_hints .into_iter() .map(|InlayHint { range, kind, label }| { let range = lsp_range_to_kakoune(&range, &document.text, ctx.offset_encoding); let label = label.replace("|", "\\|"); match kind { InlayKind::TypeHint => { let pos = KakounePosition { line: range.end.line, column: range.end.column + 1, }; editor_quote(&format!("{}+0|{{InlayHint}}{{\\}}: {}", pos, label)) } InlayKind::ParameterHint => { editor_quote(&format!("{}+0|{{InlayHint}}{{\\}}{}: ", range.start, label)) } InlayKind::ChainingHint => { let pos = KakounePosition { line: range.end.line, column: range.end.column + 1, }; editor_quote(&format!("{}+0|{{InlayHint}}{{\\}} {}", pos, label)) } } }) .collect::<Vec<String>>() .join(" "); let command = format!( "set buffer rust_analyzer_inlay_hints {} {}", meta.version, ranges ); let command = format!( "eval -buffer {} -verbatim -- {}", editor_quote(&meta.buffile), command ); ctx.exec(meta, command) } #[derive(Deserialize, Serialize, Debug)] #[serde(rename_all = "camelCase")] pub struct SourceChange { pub label: String, pub workspace_edit: SnippetWorkspaceEdit, pub cursor_position: Option<lsp_types::TextDocumentPositionParams>, } #[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SnippetWorkspaceEdit { #[serde(skip_serializing_if = "Option::is_none")] pub changes: Option<HashMap<Url, Vec<TextEdit>>>, #[serde(skip_serializing_if = "Option::is_none")] pub document_changes: Option<Vec<SnippetDocumentChangeOperation>>, } #[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] #[serde(untagged, rename_all = "lowercase")] pub enum SnippetDocumentChangeOperation { Op(ResourceOp), Edit(SnippetTextDocumentEdit), } #[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SnippetTextDocumentEdit { pub text_document: VersionedTextDocumentIdentifier, pub edits: Vec<SnippetTextEdit>, } #[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct SnippetTextEdit { pub range: Range, pub new_text: String, #[serde(skip_serializing_if = "Option::is_none")] pub insert_text_format: Option<InsertTextFormat>, } pub fn apply_source_change(meta: EditorMeta, params: ExecuteCommandParams, ctx: &mut Context) { let arg = params .arguments .into_iter() .next() .expect("Missing source change"); let SourceChange { workspace_edit: SnippetWorkspaceEdit { changes, document_changes, }, cursor_position, .. } = serde_json::from_value(arg).expect("Invalid source change"); if let Some(document_changes) = document_changes { for op in document_changes { match op { SnippetDocumentChangeOperation::Op(resource_op) => { if let Err(e) = workspace::apply_document_resource_op(&meta, resource_op, ctx) { error!("failed to apply document change: {}", e); } } SnippetDocumentChangeOperation::Edit(SnippetTextDocumentEdit { text_document: VersionedTextDocumentIdentifier { uri, .. }, edits, }) => { let edits: Vec<TextEdit> = edits .into_iter() .map( |SnippetTextEdit { range, new_text, insert_text_format: _, // TODO }| TextEdit { range, new_text }, ) .collect(); apply_text_edits(&meta, &uri, edits, ctx); } } } } else if let Some(changes) = changes { for (uri, change) in changes { apply_text_edits(&meta, &uri, change, ctx); } } if let ( Some(client), Some(TextDocumentPositionParams { text_document: TextDocumentIdentifier { uri }, position, }), ) = (&meta.client, &cursor_position) { let buffile = uri.to_file_path().unwrap(); let buffile = buffile.to_str().unwrap(); let position = match ctx.documents.get(buffile) { Some(document) => { lsp_position_to_kakoune(position, &document.text, ctx.offset_encoding) } _ => KakounePosition { line: position.line + 1, column: position.character + 1, }, }; let command = format!( "eval -try-client %opt{{jumpclient}} -verbatim -- edit -existing {} {} {}", editor_quote(buffile), position.line, position.column - 1 ); let command = format!( "eval -client {} -verbatim -- {}", editor_quote(client), command ); ctx.exec(meta, command); } }
pub use crate::clump::*; pub use crate::kmer::*; pub use crate::nucl::Nucl::{self, *}; pub use std::collections::{btree_map::Entry, BTreeMap, HashSet}; pub use std::{fmt, str};
extern crate failure; extern crate log; extern crate packt_core; #[macro_use] extern crate quicli; extern crate csv; extern crate serde; extern crate tokio; extern crate tokio_core; extern crate tokio_io; extern crate tokio_process; #[macro_use] extern crate serde_derive; use packt_core::{problem::Problem, runner, solution::Evaluation}; use quicli::prelude::*; use std::{ fs::{self, OpenOptions}, io, path::PathBuf, time::Duration, }; use tokio_core::reactor::Core; #[derive(Debug, StructOpt)] struct Cli { /// Solver jar-file to solve with #[structopt(parse(from_os_str))] solver: PathBuf, /// Location of the directory with the input files #[structopt(parse(from_os_str))] input: PathBuf, /// Output file, stdout if not present #[structopt(parse(from_os_str))] output: Option<PathBuf>, /// Timeout to run the solver with, in seconds. /// Defaults to 300 seconds if not present #[structopt(long = "timeout", short = "t")] timeout: Option<u64>, #[structopt(flatten)] verbosity: Verbosity, } main!(|args: Cli, log_level: verbosity| { let output: Box<dyn io::Write> = match args.output { Some(path) => Box::new(OpenOptions::new().append(true).create(true).open(path)?), None => Box::new(io::stdout()), }; let mut writer = csv::Writer::from_writer(output); let timeout = args.timeout.unwrap_or(300); let deadline = Duration::from_secs(timeout); let mut core = Core::new().unwrap(); for entry in args.input.read_dir()? { let entry = entry?; let filename = entry.file_name(); let filestr = filename.to_string_lossy().to_owned(); eprintln!("\nRunning {}", filestr); let mut input = fs::read_to_string(entry.path())?; let problem = input.parse::<Problem>()?; let handle = core.handle(); let child = runner::solve_async(&args.solver, problem.clone(), handle, deadline); let evaluation = core.run(child); let record = Record::new(&problem, evaluation, &filestr); writer.serialize(record)?; } writer.flush()?; }); #[derive(Debug, Serialize)] struct Record<'a> { filename: &'a str, n: usize, variant: String, rotation_allowed: bool, perfect_packing: bool, error: Option<String>, container: Option<String>, min_area: Option<u64>, empty_area: Option<i64>, filling_rate: Option<f32>, duration: Option<String>, } impl<'a> Record<'a> { fn new<'b>(problem: &'b Problem, evaluation: Result<Evaluation>, filename: &'a str) -> Self { let &Problem { variant, allow_rotation, ref rectangles, .. } = problem; let n = rectangles.len(); let (container, min_area, empty_area, filling_rate, duration, error) = match evaluation { Ok(eval) => { let Evaluation { min_area, empty_area, filling_rate, duration, container, .. } = eval; ( Some(container.to_string()), Some(min_area), Some(empty_area), Some(filling_rate), Some(format!( "{}.{:.3}", duration.as_secs(), duration.subsec_millis(), )), None, ) } Err(e) => (None, None, None, None, None, Some(e.to_string())), }; Record { filename, n, variant: variant.to_string(), rotation_allowed: allow_rotation, perfect_packing: filename.contains("packt"), container, min_area, empty_area, filling_rate, duration, error, } } }
mod lex; mod parse; use std::str; fn main() { let fhp = std::fs::File::open("xyz.txt"); //let pr = parse::parse_from_file(fhp); //pr.dump(); //if let parse::ParserResult::Parsed(ref pd) = pr { // if pd.rest.is_empty() { // println!("file fully parsed!"); // } //} let fh = readfilez::read_from_file(fhp).expect("unable to open file"); let data = str::from_utf8(fh.as_slice()).expect("file contains invalid data"); let lxt: Vec<lex::TokenData> = lex::LexerIter::new(data).collect(); println!("{:?}", lxt); }
use nom::{Offset, AsBytes, Compare, CompareResult, InputLength, InputIter, InputTake, Slice, AtEof, UnspecializedInput}; use std::ops::{Range, RangeFrom, RangeTo, RangeFull}; use istring::IString; #[macro_export] macro_rules! slug { (__internal Done, $log:ident, $r:ident, ($rem:expr, $out:expr)) => { { use nom::Compare; match $r { nom::IResult::Done(rem, out) => { let mut failed = false; if rem.compare($rem) != nom::CompareResult::Ok { let expected: &str = $rem.into(); let found: &str = rem.into(); println!("expected {:?}, found {:?}", expected, found); failed = true; } if !out.eq(&$out) { println!("different output: {:?} != {:?}", out, $out); failed = true; } if failed { panic!(); } println!("ok"); }, nom::IResult::Error(e) => { println!("error: {:?}", e); panic!(); }, nom::IResult::Incomplete(e) => { println!("incomplete: {:?}", e); panic!(); } } } }; (__internal Error, $log:ident, $r:ident, ) => { match $r { nom::IResult::Done(_, _) => { println!("did not fail"); panic!(); }, nom::IResult::Error(_) => println!("ok"), nom::IResult::Incomplete(e) => { println!("incomplete: {:?}", e); panic!(); } } }; ( $( $parser:ident ($case:expr $(, $arg:expr)* ) => $d:tt $( ( $e:expr, $f:expr ) )* ; )* ) => { $( println!("{}({})", stringify!($parser), stringify!($case $(,$arg)*)); let b = $crate::slug::wrap($case.into()); let r = $parser(b.clone() $(,$arg)*); slug!(__internal $d, b, r, $( ($e, $f) )* ); )* } } use std; #[derive(Clone)] pub struct Slug<'a> { // full input data data: &'a str, // current slice slice: &'a str, line: usize } impl<'a> Slug<'a> { pub fn parse<F>(&self) -> Result<F, F::Err> where F: std::str::FromStr { self.slice.parse() } pub fn show(&self) { use std::iter::{repeat}; // offset of slice into data let offset = self.slice.as_ptr() as usize - self.data.as_ptr() as usize; let line_start = self.data[.. offset] .rfind('\n') .map(|p| p+1) .unwrap_or_else(|| 0); let (line, endl) = match self.data[offset ..].find('\n') { Some(end) => (&self.data[line_start .. end+offset], '\u{21B5}'), None => (&self.data[line_start ..], '\u{2016}') }; let cursor = self.data[line_start .. offset].chars().count(); let marker: String = repeat(" ").take(cursor).collect(); println!("line {}\n{}{}\n{}^ position", self.line, line, endl, marker); } pub fn len(&self) -> usize { self.slice.len() } } impl<'a> PartialEq for Slug<'a> { #[inline(always)] fn eq(&self, other: &Slug<'a>) -> bool { self.slice.eq(other.slice) } } impl<'a> PartialEq<str> for Slug<'a> { #[inline(always)] fn eq(&self, other: &str) -> bool { self.slice.eq(other) } } impl<'a, 'b> PartialEq<&'b str> for Slug<'a> { #[inline(always)] fn eq(&self, other: &&'b str) -> bool { self.slice.eq(*other) } } impl<'a> Into<&'a str> for Slug<'a> { #[inline(always)] fn into(self) -> &'a str { self.slice } } impl<'a> Into<String> for Slug<'a> { fn into(self) -> String { self.slice.to_owned() } } impl<'a> Into<IString> for Slug<'a> { fn into(self) -> IString { self.slice.into() } } impl<'a> std::fmt::Debug for Slug<'a> { fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> { self.slice.fmt(f) } } impl<'a> AsBytes for Slug<'a> { #[inline(always)] fn as_bytes(&self) -> &[u8] { self.data.as_bytes() } } impl<'a, 'b> Compare<&'b str> for Slug<'a> { #[inline(always)] fn compare(&self, o: &'b str) -> CompareResult { self.slice.compare(o) } #[inline(always)] fn compare_no_case(&self, o: &'b str) -> CompareResult { self.slice.compare_no_case(o) } } impl<'a> Slice<Range<usize>> for Slug<'a> { #[inline(always)] fn slice(&self, r: Range<usize>) -> Slug<'a> { let lines = self.slice[.. r.start].chars().filter(|&c| c == '\n').count(); Slug { data: self.data, slice: self.slice.slice(r), line: self.line + lines } } } impl<'a> Slice<RangeFrom<usize>> for Slug<'a> { #[inline(always)] fn slice(&self, r: RangeFrom<usize>) -> Slug<'a> { let lines = self.slice[.. r.start].chars().filter(|&c| c == '\n').count(); Slug { data: self.data, slice: self.slice.slice(r), line: self.line + lines } } } impl<'a> Slice<RangeTo<usize>> for Slug<'a> { #[inline(always)] fn slice(&self, r: RangeTo<usize>) -> Slug<'a> { Slug { data: self.data, slice: self.slice.slice(r), line: self.line } } } impl<'a> Slice<RangeFull> for Slug<'a> { #[inline(always)] fn slice(&self, _r: RangeFull) -> Slug<'a> { Slug { data: self.data, slice: self.slice, line: self.line } } } impl<'a> Offset for Slug<'a> { #[inline(always)] fn offset(&self, second: &Slug) -> usize { let start = self.slice.as_ptr() as usize; let end = second.slice.as_ptr() as usize; assert!(end >= start, "negative offset"); end - start } } impl<'a> InputLength for Slug<'a> { #[inline(always)] fn input_len(&self) -> usize { self.slice.len() } } impl<'a> InputTake for Slug<'a> { fn take(&self, count: usize) -> Self { self.slice(..count) } fn take_split(&self, count: usize) -> (Self, Self) { (self.slice(..count), self.slice(count..)) } } impl<'a> AtEof for Slug<'a> { fn at_eof(&self) -> bool { self.slice.at_eof() } } impl<'a> InputIter for Slug<'a> { type Item = char; type RawItem = char; type Iter = std::str::CharIndices<'a>; type IterElem = std::str::Chars<'a>; #[inline] fn iter_indices(&self) -> std::str::CharIndices<'a> { self.slice.char_indices() } #[inline] fn iter_elements(&self) -> std::str::Chars<'a> { self.slice.chars() } fn position<P>(&self, predicate: P) -> Option<usize> where P: Fn(Self::RawItem) -> bool { for (o,c) in self.slice.char_indices() { if predicate(c) { return Some(o) } } None } #[inline] fn slice_index(&self, count: usize) -> Option<usize> { let mut cnt = 0; for (index, _) in self.slice.char_indices() { if cnt == count { return Some(index) } cnt += 1; } None } } impl<'a> UnspecializedInput for Slug<'a> {} pub fn wrap(data: &str) -> Slug { Slug { data: data, slice: data, line: 1 } }
// 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. // check that we don't have linear stack usage with multiple calls to `push` #![feature(test)] extern crate test; use std::mem; fn meal() -> Big { if test::black_box(false) { panic!() } Big { drop_me: [ None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ]} } pub struct Big { drop_me: [Option<Box<u8>>; 48], } #[inline] fn push(out: &mut Vec<Big>) { out.push(meal()); } #[inline(never)] pub fn supersize_me(out: &mut Vec<Big>) { push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); // 16 calls to `push` verify_stack_usage(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); push(out); // 16 calls to `push` } #[inline(never)] fn verify_stack_usage(before_ptr: *mut Vec<Big>) { // to check stack usage, create locals before and after // and check the difference in addresses between them. let mut stack_var: Vec<Big> = vec![]; test::black_box(&mut stack_var); let stack_usage = isize::abs( (&mut stack_var as *mut _ as isize) - (before_ptr as isize)) as usize; // give space for 2 copies of `Big` + 128 "misc" bytes. if stack_usage > mem::size_of::<Big>() * 2 + 128 { panic!("used {} bytes of stack, but `struct Big` is only {} bytes", stack_usage, mem::size_of::<Big>()); } } pub fn main() { let mut v = vec![]; test::black_box(&mut v); supersize_me(&mut v); }
// A standard scoring function pub fn score_func(a: char, b: char) -> f32 { if a == b { 3.0 } else { -3.0 } } // A standard gap-penalty function pub fn gap_penalty(gap: u32) -> f32 { if gap == 1 { 2.0 } else { (gap as f32) * gap_penalty(1) } }