text
stringlengths
8
4.13M
#[derive(Copy, Clone, Eq, PartialEq)] struct Edge(pub usize, pub usize, pub usize); impl Ord for Edge { fn cmp(&self, other: &Self) -> std::cmp::Ordering { other.2.cmp(&self.2) } } impl PartialOrd for Edge { fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { Some(self.cmp(other)) } } pub fn oranges_rotting(grid: Vec<Vec<i32>>) -> i32 { let mut rotten_oranges = std::collections::BinaryHeap::new(); grid.iter().enumerate().for_each(|(x, row)| { row.iter() .enumerate() .filter(|(_, &orange)| orange == 2) .for_each(|(y, _)| rotten_oranges.push(Edge(x, y, 0))) }); let mut total = 0; let (width, height) = (grid.len(), grid[0].len()); let grid = std::cell::RefCell::new(grid); while let Some(Edge(r, c, d)) = rotten_oranges.pop() { total = total.max(d); [(-1, 0), (0, -1), (1, 0), (0, 1)] .iter() .map(|(dx, dy)| ((dx + r as i32) as usize, (dy + c as i32) as usize)) .filter(|&(x, y)| x < width && y < height && grid.borrow()[x][y] == 1) .for_each(|(x, y)| { rotten_oranges.push(Edge(x, y, d + 1)); grid.borrow_mut()[x][y] = 2; }) } if grid .into_inner() .into_iter() .flatten() .filter(|&x| x > 0) .all(|b| b == 2) { total as i32 } else { -1 } } #[cfg(test)] mod oranges_rotting_tests { use super::*; #[test] fn oranges_rotting_test_one() { assert_eq!( oranges_rotting(vec![vec![2, 1, 1], vec![1, 1, 0], vec![0, 1, 1],]), 4 ); } #[test] fn oranges_rotting_test_two() { assert_eq!( oranges_rotting(vec![vec![2, 1, 1], vec![1, 1, 1], vec![0, 1, 2],]), 2 ); } #[test] fn oranges_rotting_test_three() { assert_eq!( oranges_rotting(vec![vec![2, 2], vec![1, 1], vec![0, 0], vec![2, 0],]), 1 ); } }
pub mod navtop; pub mod landing_page_navtop; pub mod sidebar;
extern crate hex; #[inline(always)] pub fn u64to8(mut num: u64) -> [u8; 8] { let mut out: [u8; 8] = [0; 8]; for i in 0..8 { out[i] = (num & 0b11111111) as u8; num >>= 8; } out } #[inline(always)] pub fn u8to64(nums: [u8; 8]) -> u64 { let mut res: u64 = 0; for i in 0..8 { res <<= 8; res |= nums[7 - i] as u64; } res } pub fn proof2str(proof:(([u64; 6], [u64; 6], bool), (([u64; 6], [u64; 6]), ([u64; 6], [u64; 6]), bool), ([u64; 6], [u64; 6], bool)))->String{ let mut res = String::with_capacity(770); for i in 0..6{ res.push_str(hex::encode(u64to8(((proof.0).0)[i]).as_ref()).as_ref()); } for i in 0..6{ res.push_str(hex::encode(u64to8(((proof.0).1)[i]).as_ref()).as_ref()); } for i in 0..6{ res.push_str(hex::encode(u64to8((((proof.1).0).0)[i]).as_ref()).as_ref()); } for i in 0..6{ res.push_str(hex::encode(u64to8((((proof.1).0).1)[i]).as_ref()).as_ref()); } for i in 0..6{ res.push_str(hex::encode(u64to8((((proof.1).1).0)[i]).as_ref()).as_ref()); } for i in 0..6{ res.push_str(hex::encode(u64to8((((proof.1).1).1)[i]).as_ref()).as_ref()); } for i in 0..6{ res.push_str(hex::encode(u64to8(((proof.2).0)[i]).as_ref()).as_ref()); } for i in 0..6{ res.push_str(hex::encode(u64to8(((proof.2).1)[i]).as_ref()).as_ref()); } let mut b:u8 =0; if (proof.0).2 {b+=1;} b<<=1; if (proof.1).2 {b+=1;} b<<=1; if (proof.2).2 {b+=1;} res.push_str(hex::encode([b].as_ref()).as_ref()); res } #[inline(always)] pub fn u8sto64(nums: &[u8]) -> u64 { let mut res: u64 = 0; for i in 0..8 { res <<= 8; res |= nums[7 - i] as u64; } res } pub fn str2proof(serial:String)->(([u64; 6], [u64; 6], bool), (([u64; 6], [u64; 6]), ([u64; 6], [u64; 6]), bool), ([u64; 6], [u64; 6], bool)){ let mut proof:(([u64; 6], [u64; 6], bool), (([u64; 6], [u64; 6]), ([u64; 6], [u64; 6]), bool), ([u64; 6], [u64; 6], bool)) = (([0; 6], [0; 6], false), (([0; 6], [0; 6]), ([0; 6], [0; 6]), false), ([0; 6], [0; 6], false)); let v:Vec<u8> = hex::decode(serial).unwrap(); for i in 0..6{ ((proof.0).0)[i] = u8sto64(&v[i*8..(i+1)*8]); } for i in 6..12{ ((proof.0).1)[i-6] = u8sto64(&v[i*8..(i+1)*8]); } for i in 12..18{ (((proof.1).0).0)[i-12] = u8sto64(&v[i*8..(i+1)*8]); } for i in 18..24{ (((proof.1).0).1)[i-18] = u8sto64(&v[i*8..(i+1)*8]); } for i in 24..30{ (((proof.1).1).0)[i-24] = u8sto64(&v[i*8..(i+1)*8]); } for i in 30..36{ (((proof.1).1).1)[i-30] = u8sto64(&v[i*8..(i+1)*8]); } for i in 36..42{ ((proof.2).0)[i-36] = u8sto64(&v[i*8..(i+1)*8]); } for i in 42..48{ ((proof.2).1)[i-42] = u8sto64(&v[i*8..(i+1)*8]); } let b =v[384]; (proof.0).2 = b&0b00000100 != 0; (proof.1).2 = b&0b00000010 != 0; (proof.2).2 = b&0b00000001 != 0; proof } use std::num::ParseIntError; pub fn str2value(st:String)->Result<([u64;2],bool),ParseIntError>{ let st:&str = st.as_ref(); let mut res:([u64;2],bool) = ([0;2],true); if st.get(0..1) == Some("-") { res.1 = false; res.0[0] = u64::from_str_radix(&st[1..],10)?; }else{ res.0[0] = u64::from_str_radix(st,10)?; } Ok(res) } pub fn u6442str(u644:[u64;4]) ->String{ let mut res = String::with_capacity(64); for i in 0..4{ res.push_str(hex::encode(u64to8(u644[i]).as_ref()).as_ref()); } res } pub fn str2u644(serial:String) ->[u64;4]{ let mut coin:[u64;4] = [0;4]; let v:Vec<u8> = hex::decode(serial).unwrap(); for i in 0..4{ coin[i] = u8sto64(&v[i*8..(i+1)*8]); } coin } pub fn point2str(point:([u64;4],[u64;4]))->String{ let mut res = String::with_capacity(128); for i in 0..4{ res.push_str(hex::encode(u64to8((point.0)[i]).as_ref()).as_ref()); } for i in 0..4{ res.push_str(hex::encode(u64to8((point.1)[i]).as_ref()).as_ref()); } res } pub fn str2point(serial:String)->([u64;4],[u64;4]){ let mut point:([u64;4],[u64;4]) = ([0;4],[0;4]); let v:Vec<u8> = hex::decode(serial).unwrap(); for i in 0..4{ (point.0)[i] = u8sto64(&v[i*8..(i+1)*8]); } for i in 4..8{ (point.1)[i-4] = u8sto64(&v[i*8..(i+1)*8]); } point } pub fn enc2str(enc:([u64;4],[u64;4],[u64;4]))->String{ let mut res = String::with_capacity(192); for i in 0..4{ res.push_str(hex::encode(u64to8((enc.0)[i]).as_ref()).as_ref()); } for i in 0..4{ res.push_str(hex::encode(u64to8((enc.1)[i]).as_ref()).as_ref()); } for i in 0..4{ res.push_str(hex::encode(u64to8((enc.2)[i]).as_ref()).as_ref()); } res } pub fn str2enc(serial:String)->([u64;4],[u64;4],[u64;4]){ let mut enc:([u64;4],[u64;4],[u64;4]) = ([0;4],[0;4],[0;4]); let v:Vec<u8> = hex::decode(serial).unwrap(); for i in 0..4{ (enc.0)[i] = u8sto64(&v[i*8..(i+1)*8]); } for i in 4..8{ (enc.1)[i-4] = u8sto64(&v[i*8..(i+1)*8]); } for i in 8..12{ (enc.2)[i-8] = u8sto64(&v[i*8..(i+1)*8]); } enc } pub fn sk2str(sk:Vec<bool>)->String{ assert_eq!(sk.len(),256); let mut u8s:Vec<u8> = Vec::with_capacity(32); for u in sk.chunks(8){ let mut num:u8 = 0; for i in 0..8{ num<<=1; num += { if u[i]{1} else{0} }; } u8s.push(num); } hex::encode(u8s) } pub fn str2sk(serial:String)->Vec<bool>{ let serial:Vec<u8> = hex::decode(serial).unwrap(); let mut res:Vec<bool> = Vec::with_capacity(256); for u in serial.iter(){ let mut num = *u; for _ in 0..8{ res.push(num & 0b10000000 == 0b10000000); num<<=1; } } res }
//! Testing whether Tokio doesn't display timeouts correctly on Windows //! //! # Examples //! //! ``` //! // tbi //! ``` #![forbid(unsafe_code, future_incompatible, rust_2018_idioms)] #![deny(missing_debug_implementations, nonstandard_style)] #![warn(missing_docs, missing_doc_code_examples, unreachable_pub)] use tokio::net::TcpStream; use std::time::Duration; #[tokio::main] async fn main() -> std::io::Result<()> { let stream = TcpStream::connect("104.198.14.52:80").await?; println!("{:?}", stream.keepalive()?); stream.set_keepalive(Some(Duration::from_secs(1)))?; println!("{:?}", stream.keepalive()?); Ok(()) }
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors. // // 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 lazy_static::lazy_static; use alloc::collections::btree_map::BTreeMap; use super::super::super::qlib::common::*; use super::super::super::qlib::linux_def::*; use super::super::super::qlib::path::*; use super::super::oci::*; use super::specutils::*; #[derive(Copy, Clone)] pub struct Mapping { pub set: bool, pub val: u32, } lazy_static! { // optionsMap maps mount propagation-related OCI filesystem options to mount(2) // syscall flags. static ref OPTIONS_MAP : BTreeMap<&'static str, Mapping> = [ ("acl", Mapping{set: true, val: LibcConst::MS_POSIXACL as u32}), ("async", Mapping{set: false, val: LibcConst::MS_SYNCHRONOUS as u32}), ("atime", Mapping{set: false, val: LibcConst::MS_NOATIME as u32}), ("bind", Mapping{set: true, val: LibcConst::MS_BIND as u32}), ("defaults", Mapping{set: true, val: 0 as u32}), ("dev", Mapping{set: false, val: LibcConst::MS_NODEV as u32}), ("diratime", Mapping{set: false, val: LibcConst::MS_NODIRATIME as u32}), ("dirsync", Mapping{set: true, val: LibcConst::MS_DIRSYNC as u32}), ("exec", Mapping{set: false, val: LibcConst::MS_NOEXEC as u32}), ("noexec", Mapping{set: true, val: LibcConst::MS_NOEXEC as u32}), ("iversion", Mapping{set: true, val: LibcConst::MS_I_VERSION as u32}), ("loud", Mapping{set: false, val: LibcConst::MS_SILENT as u32}), ("mand", Mapping{set: true, val: LibcConst::MS_MANDLOCK as u32}), ("noacl", Mapping{set: false, val: LibcConst::MS_POSIXACL as u32}), ("noatime", Mapping{set: true, val: LibcConst::MS_NOATIME as u32}), ("nodev", Mapping{set: true, val: LibcConst::MS_NODEV as u32}), ("nodiratime", Mapping{set: true, val: LibcConst::MS_NODIRATIME as u32}), ("noiversion", Mapping{set: false, val: LibcConst::MS_I_VERSION as u32}), ("nomand", Mapping{set: false, val: LibcConst::MS_MANDLOCK as u32}), ("norelatime", Mapping{set: false, val: LibcConst::MS_RELATIME as u32}), ("nostrictatime", Mapping{set: false, val: LibcConst::MS_STRICTATIME as u32}), ("nosuid", Mapping{set: true, val: LibcConst::MS_NOSUID as u32}), ("rbind", Mapping{set: true, val: (LibcConst::MS_BIND | LibcConst::MS_REC) as u32}), ("relatime", Mapping{set: true, val: LibcConst::MS_RELATIME as u32}), ("remount", Mapping{set: true, val: LibcConst::MS_REMOUNT as u32}), ("ro", Mapping{set: true, val: LibcConst::MS_RDONLY as u32}), ("rw", Mapping{set: false, val: LibcConst::MS_RDONLY as u32}), ("silent", Mapping{set: true, val: LibcConst::MS_SILENT as u32}), ("strictatime", Mapping{set: true, val: LibcConst::MS_STRICTATIME as u32}), ("suid", Mapping{set: false, val: LibcConst::MS_NOSUID as u32}), ("sync", Mapping{set: true, val: LibcConst::MS_SYNCHRONOUS as u32}), ].iter().cloned().collect(); // propOptionsMap is similar to optionsMap, but it lists propagation options // that cannot be used together with other flags. static ref PROP_OPTIONS_MAP : BTreeMap<&'static str, Mapping> = [ ("private", Mapping{set: true, val: LibcConst::MS_PRIVATE as u32}), ("rprivate", Mapping{set: true, val: LibcConst::MS_PRIVATE as u32 | LibcConst::MS_REC as u32}), ("slave", Mapping{set: true, val: LibcConst::MS_SLAVE as u32}), ("rslave", Mapping{set: true, val: LibcConst::MS_SLAVE as u32 | LibcConst::MS_REC as u32}), ("unbindable", Mapping{set: true, val: LibcConst::MS_UNBINDABLE as u32}), ("runbindable", Mapping{set: true, val: LibcConst::MS_UNBINDABLE as u32 | LibcConst::MS_REC as u32}), ].iter().cloned().collect(); // invalidOptions list options not allowed. // - shared: sandbox must be isolated from the host. Propagating mount changes // from the sandbox to the host breaks the isolation. static ref INVALID_OPTIONS : [&'static str; 2] = ["shared", "rshared"]; } // OptionsToFlags converts mount options to syscall flags. pub fn OptionsToFlags(opts: &[&str]) -> u32 { return optionsToFlags(opts, &OPTIONS_MAP) } // PropOptionsToFlags converts propagation mount options to syscall flags. // Propagation options cannot be set other with other options and must be // handled separatedly. pub fn PropOptionsToFlags(opts: &[&str]) -> u32 { return optionsToFlags(opts, &PROP_OPTIONS_MAP) } fn optionsToFlags(options: &[&str], source: &BTreeMap<&str, Mapping>) -> u32 { let mut rv : u32 = 0; for opt in options { match source.get(opt) { None => (), Some(m) => { if m.set { rv |= m.val; } else { rv ^= m.val; } } } } return rv; } // ValidateMount validates that spec mounts are correct. pub fn ValidateMount(mnt: &Mount) -> Result<()> { if !IsAbs(&mnt.destination) { return Err(Error::Common(format!("Mount.Destination must be an absolute path: {:?}", mnt))); } if mnt.typ.as_str() == "bind" { for o in &mnt.options { let o : &str = o; if ContainsStr(&*INVALID_OPTIONS, o) { return Err(Error::Common(format!("mount option {:?} is not supported: {:?}", o, mnt))); } let ok1 = OPTIONS_MAP.contains_key(o); let ok2 = PROP_OPTIONS_MAP.contains_key(o); if !ok1 && !ok2 { return Err(Error::Common(format!("unknown mount option {:?}", o))); } } } return Ok(()) } // ValidateRootfsPropagation validates that rootfs propagation options are // correct. pub fn ValidateRootfsPropagation(opt: &str) -> Result<()> { let flags = PropOptionsToFlags(&[opt]); if flags & (LibcConst::MS_SLAVE as u32 | LibcConst::MS_PRIVATE as u32) == 0 { return Err(Error::Common(format!("root mount propagation option must specify private or slave: {:?}", opt))); } return Ok(()) }
// use crate::members; use hdk::prelude::*; pub fn get_admin_members() -> ZomeApiResult<Vec<Address>> { let initial_members_json = hdk::property("initial_members")?; let initial_members: Result<Vec<Address>, _> = serde_json::from_str(&initial_members_json.to_string()); match initial_members { Ok(initial_members_addresses) => Ok(initial_members_addresses), Err(_) => Err(ZomeApiError::from(String::from( "Could not get the initial valid members for this app", ))), } } pub fn get_minimum_required_vouches() -> ZomeApiResult<u8> { let necessary_vouches_json = hdk::property("necessary_vouches")?; let necessary_vouches: Result<u8, _> = serde_json::from_str(&necessary_vouches_json.to_string()); match necessary_vouches { Ok(vouches) => Ok(vouches), Err(_) => Err(ZomeApiError::from(String::from( "Could not get the necessary vouches", ))), } } pub fn get_all_settings() -> ZomeApiResult<String> { let necessary_vouches_json = hdk::property("necessary_vouches")?; let initial_members_json = hdk::property("initial_members")?; return Ok(format!( "Admin_Members:{} Minimum_Required_Vouch:{}", initial_members_json.to_string(), necessary_vouches_json.to_string() )); }
pub mod geometry; pub mod parse; pub mod render;
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Flash Memory Address"] pub fma: FMA, #[doc = "0x04 - Flash Memory Data"] pub fmd: FMD, #[doc = "0x08 - Flash Memory Control"] pub fmc: FMC, #[doc = "0x0c - Flash Controller Raw Interrupt Status"] pub fcris: FCRIS, #[doc = "0x10 - Flash Controller Interrupt Mask"] pub fcim: FCIM, #[doc = "0x14 - Flash Controller Masked Interrupt Status and Clear"] pub fcmisc: FCMISC, _reserved6: [u8; 8usize], #[doc = "0x20 - Flash Memory Control 2"] pub fmc2: FMC2, _reserved7: [u8; 12usize], #[doc = "0x30 - Flash Write Buffer Valid"] pub fwbval: FWBVAL, _reserved8: [u8; 8usize], #[doc = "0x3c - Flash Program/Erase Key"] pub flpekey: FLPEKEY, _reserved9: [u8; 192usize], #[doc = "0x100 - Flash Write Buffer n"] pub fwbn: FWBN, _reserved10: [u8; 3772usize], #[doc = "0xfc0 - Flash Peripheral Properties"] pub pp: PP, #[doc = "0xfc4 - SRAM Size"] pub ssize: SSIZE, #[doc = "0xfc8 - Flash Configuration Register"] pub conf: CONF, #[doc = "0xfcc - ROM Software Map"] pub romswmap: ROMSWMAP, #[doc = "0xfd0 - Flash DMA Address Size"] pub dmasz: DMASZ, #[doc = "0xfd4 - Flash DMA Starting Address"] pub dmast: DMAST, _reserved16: [u8; 252usize], #[doc = "0x10d4 - Reset Vector Pointer"] pub rvp: RVP, _reserved17: [u8; 248usize], #[doc = "0x11d0 - Boot Configuration"] pub bootcfg: BOOTCFG, _reserved18: [u8; 12usize], #[doc = "0x11e0 - User Register 0"] pub userreg0: USERREG0, #[doc = "0x11e4 - User Register 1"] pub userreg1: USERREG1, #[doc = "0x11e8 - User Register 2"] pub userreg2: USERREG2, #[doc = "0x11ec - User Register 3"] pub userreg3: USERREG3, _reserved22: [u8; 16usize], #[doc = "0x1200 - Flash Memory Protection Read Enable 0"] pub fmpre0: FMPRE0, #[doc = "0x1204 - Flash Memory Protection Read Enable 1"] pub fmpre1: FMPRE1, #[doc = "0x1208 - Flash Memory Protection Read Enable 2"] pub fmpre2: FMPRE2, #[doc = "0x120c - Flash Memory Protection Read Enable 3"] pub fmpre3: FMPRE3, #[doc = "0x1210 - Flash Memory Protection Read Enable 4"] pub fmpre4: FMPRE4, #[doc = "0x1214 - Flash Memory Protection Read Enable 5"] pub fmpre5: FMPRE5, #[doc = "0x1218 - Flash Memory Protection Read Enable 6"] pub fmpre6: FMPRE6, #[doc = "0x121c - Flash Memory Protection Read Enable 7"] pub fmpre7: FMPRE7, #[doc = "0x1220 - Flash Memory Protection Read Enable 8"] pub fmpre8: FMPRE8, #[doc = "0x1224 - Flash Memory Protection Read Enable 9"] pub fmpre9: FMPRE9, #[doc = "0x1228 - Flash Memory Protection Read Enable 10"] pub fmpre10: FMPRE10, #[doc = "0x122c - Flash Memory Protection Read Enable 11"] pub fmpre11: FMPRE11, #[doc = "0x1230 - Flash Memory Protection Read Enable 12"] pub fmpre12: FMPRE12, #[doc = "0x1234 - Flash Memory Protection Read Enable 13"] pub fmpre13: FMPRE13, #[doc = "0x1238 - Flash Memory Protection Read Enable 14"] pub fmpre14: FMPRE14, #[doc = "0x123c - Flash Memory Protection Read Enable 15"] pub fmpre15: FMPRE15, _reserved38: [u8; 448usize], #[doc = "0x1400 - Flash Memory Protection Program Enable 0"] pub fmppe0: FMPPE0, #[doc = "0x1404 - Flash Memory Protection Program Enable 1"] pub fmppe1: FMPPE1, #[doc = "0x1408 - Flash Memory Protection Program Enable 2"] pub fmppe2: FMPPE2, #[doc = "0x140c - Flash Memory Protection Program Enable 3"] pub fmppe3: FMPPE3, #[doc = "0x1410 - Flash Memory Protection Program Enable 4"] pub fmppe4: FMPPE4, #[doc = "0x1414 - Flash Memory Protection Program Enable 5"] pub fmppe5: FMPPE5, #[doc = "0x1418 - Flash Memory Protection Program Enable 6"] pub fmppe6: FMPPE6, #[doc = "0x141c - Flash Memory Protection Program Enable 7"] pub fmppe7: FMPPE7, #[doc = "0x1420 - Flash Memory Protection Program Enable 8"] pub fmppe8: FMPPE8, #[doc = "0x1424 - Flash Memory Protection Program Enable 9"] pub fmppe9: FMPPE9, #[doc = "0x1428 - Flash Memory Protection Program Enable 10"] pub fmppe10: FMPPE10, #[doc = "0x142c - Flash Memory Protection Program Enable 11"] pub fmppe11: FMPPE11, #[doc = "0x1430 - Flash Memory Protection Program Enable 12"] pub fmppe12: FMPPE12, #[doc = "0x1434 - Flash Memory Protection Program Enable 13"] pub fmppe13: FMPPE13, #[doc = "0x1438 - Flash Memory Protection Program Enable 14"] pub fmppe14: FMPPE14, #[doc = "0x143c - Flash Memory Protection Program Enable 15"] pub fmppe15: FMPPE15, } #[doc = "Flash Memory Address\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fma](fma) module"] pub type FMA = crate::Reg<u32, _FMA>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMA; #[doc = "`read()` method returns [fma::R](fma::R) reader structure"] impl crate::Readable for FMA {} #[doc = "`write(|w| ..)` method takes [fma::W](fma::W) writer structure"] impl crate::Writable for FMA {} #[doc = "Flash Memory Address"] pub mod fma; #[doc = "Flash Memory Data\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmd](fmd) module"] pub type FMD = crate::Reg<u32, _FMD>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMD; #[doc = "`read()` method returns [fmd::R](fmd::R) reader structure"] impl crate::Readable for FMD {} #[doc = "`write(|w| ..)` method takes [fmd::W](fmd::W) writer structure"] impl crate::Writable for FMD {} #[doc = "Flash Memory Data"] pub mod fmd; #[doc = "Flash Memory Control\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmc](fmc) module"] pub type FMC = crate::Reg<u32, _FMC>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMC; #[doc = "`read()` method returns [fmc::R](fmc::R) reader structure"] impl crate::Readable for FMC {} #[doc = "`write(|w| ..)` method takes [fmc::W](fmc::W) writer structure"] impl crate::Writable for FMC {} #[doc = "Flash Memory Control"] pub mod fmc; #[doc = "Flash Controller Raw Interrupt Status\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fcris](fcris) module"] pub type FCRIS = crate::Reg<u32, _FCRIS>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FCRIS; #[doc = "`read()` method returns [fcris::R](fcris::R) reader structure"] impl crate::Readable for FCRIS {} #[doc = "Flash Controller Raw Interrupt Status"] pub mod fcris; #[doc = "Flash Controller Interrupt Mask\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fcim](fcim) module"] pub type FCIM = crate::Reg<u32, _FCIM>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FCIM; #[doc = "`read()` method returns [fcim::R](fcim::R) reader structure"] impl crate::Readable for FCIM {} #[doc = "`write(|w| ..)` method takes [fcim::W](fcim::W) writer structure"] impl crate::Writable for FCIM {} #[doc = "Flash Controller Interrupt Mask"] pub mod fcim; #[doc = "Flash Controller Masked Interrupt Status and Clear\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fcmisc](fcmisc) module"] pub type FCMISC = crate::Reg<u32, _FCMISC>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FCMISC; #[doc = "`read()` method returns [fcmisc::R](fcmisc::R) reader structure"] impl crate::Readable for FCMISC {} #[doc = "`write(|w| ..)` method takes [fcmisc::W](fcmisc::W) writer structure"] impl crate::Writable for FCMISC {} #[doc = "Flash Controller Masked Interrupt Status and Clear"] pub mod fcmisc; #[doc = "Flash Memory Control 2\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmc2](fmc2) module"] pub type FMC2 = crate::Reg<u32, _FMC2>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMC2; #[doc = "`read()` method returns [fmc2::R](fmc2::R) reader structure"] impl crate::Readable for FMC2 {} #[doc = "`write(|w| ..)` method takes [fmc2::W](fmc2::W) writer structure"] impl crate::Writable for FMC2 {} #[doc = "Flash Memory Control 2"] pub mod fmc2; #[doc = "Flash Write Buffer Valid\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fwbval](fwbval) module"] pub type FWBVAL = crate::Reg<u32, _FWBVAL>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FWBVAL; #[doc = "`read()` method returns [fwbval::R](fwbval::R) reader structure"] impl crate::Readable for FWBVAL {} #[doc = "`write(|w| ..)` method takes [fwbval::W](fwbval::W) writer structure"] impl crate::Writable for FWBVAL {} #[doc = "Flash Write Buffer Valid"] pub mod fwbval; #[doc = "Flash Program/Erase Key\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [flpekey](flpekey) module"] pub type FLPEKEY = crate::Reg<u32, _FLPEKEY>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FLPEKEY; #[doc = "`read()` method returns [flpekey::R](flpekey::R) reader structure"] impl crate::Readable for FLPEKEY {} #[doc = "`write(|w| ..)` method takes [flpekey::W](flpekey::W) writer structure"] impl crate::Writable for FLPEKEY {} #[doc = "Flash Program/Erase Key"] pub mod flpekey; #[doc = "Flash Write Buffer n\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fwbn](fwbn) module"] pub type FWBN = crate::Reg<u32, _FWBN>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FWBN; #[doc = "`read()` method returns [fwbn::R](fwbn::R) reader structure"] impl crate::Readable for FWBN {} #[doc = "`write(|w| ..)` method takes [fwbn::W](fwbn::W) writer structure"] impl crate::Writable for FWBN {} #[doc = "Flash Write Buffer n"] pub mod fwbn; #[doc = "Flash Peripheral Properties\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [pp](pp) module"] pub type PP = crate::Reg<u32, _PP>; #[allow(missing_docs)] #[doc(hidden)] pub struct _PP; #[doc = "`read()` method returns [pp::R](pp::R) reader structure"] impl crate::Readable for PP {} #[doc = "Flash Peripheral Properties"] pub mod pp; #[doc = "SRAM Size\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [ssize](ssize) module"] pub type SSIZE = crate::Reg<u32, _SSIZE>; #[allow(missing_docs)] #[doc(hidden)] pub struct _SSIZE; #[doc = "`read()` method returns [ssize::R](ssize::R) reader structure"] impl crate::Readable for SSIZE {} #[doc = "SRAM Size"] pub mod ssize; #[doc = "Flash Configuration Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [conf](conf) module"] pub type CONF = crate::Reg<u32, _CONF>; #[allow(missing_docs)] #[doc(hidden)] pub struct _CONF; #[doc = "`read()` method returns [conf::R](conf::R) reader structure"] impl crate::Readable for CONF {} #[doc = "`write(|w| ..)` method takes [conf::W](conf::W) writer structure"] impl crate::Writable for CONF {} #[doc = "Flash Configuration Register"] pub mod conf; #[doc = "ROM Software Map\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [romswmap](romswmap) module"] pub type ROMSWMAP = crate::Reg<u32, _ROMSWMAP>; #[allow(missing_docs)] #[doc(hidden)] pub struct _ROMSWMAP; #[doc = "`read()` method returns [romswmap::R](romswmap::R) reader structure"] impl crate::Readable for ROMSWMAP {} #[doc = "ROM Software Map"] pub mod romswmap; #[doc = "Flash DMA Address Size\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [dmasz](dmasz) module"] pub type DMASZ = crate::Reg<u32, _DMASZ>; #[allow(missing_docs)] #[doc(hidden)] pub struct _DMASZ; #[doc = "`read()` method returns [dmasz::R](dmasz::R) reader structure"] impl crate::Readable for DMASZ {} #[doc = "`write(|w| ..)` method takes [dmasz::W](dmasz::W) writer structure"] impl crate::Writable for DMASZ {} #[doc = "Flash DMA Address Size"] pub mod dmasz; #[doc = "Flash DMA Starting Address\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [dmast](dmast) module"] pub type DMAST = crate::Reg<u32, _DMAST>; #[allow(missing_docs)] #[doc(hidden)] pub struct _DMAST; #[doc = "`read()` method returns [dmast::R](dmast::R) reader structure"] impl crate::Readable for DMAST {} #[doc = "`write(|w| ..)` method takes [dmast::W](dmast::W) writer structure"] impl crate::Writable for DMAST {} #[doc = "Flash DMA Starting Address"] pub mod dmast; #[doc = "Reset Vector Pointer\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [rvp](rvp) module"] pub type RVP = crate::Reg<u32, _RVP>; #[allow(missing_docs)] #[doc(hidden)] pub struct _RVP; #[doc = "`read()` method returns [rvp::R](rvp::R) reader structure"] impl crate::Readable for RVP {} #[doc = "`write(|w| ..)` method takes [rvp::W](rvp::W) writer structure"] impl crate::Writable for RVP {} #[doc = "Reset Vector Pointer"] pub mod rvp; #[doc = "Boot Configuration\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [bootcfg](bootcfg) module"] pub type BOOTCFG = crate::Reg<u32, _BOOTCFG>; #[allow(missing_docs)] #[doc(hidden)] pub struct _BOOTCFG; #[doc = "`read()` method returns [bootcfg::R](bootcfg::R) reader structure"] impl crate::Readable for BOOTCFG {} #[doc = "Boot Configuration"] pub mod bootcfg; #[doc = "User Register 0\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [userreg0](userreg0) module"] pub type USERREG0 = crate::Reg<u32, _USERREG0>; #[allow(missing_docs)] #[doc(hidden)] pub struct _USERREG0; #[doc = "`read()` method returns [userreg0::R](userreg0::R) reader structure"] impl crate::Readable for USERREG0 {} #[doc = "`write(|w| ..)` method takes [userreg0::W](userreg0::W) writer structure"] impl crate::Writable for USERREG0 {} #[doc = "User Register 0"] pub mod userreg0; #[doc = "User Register 1\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [userreg1](userreg1) module"] pub type USERREG1 = crate::Reg<u32, _USERREG1>; #[allow(missing_docs)] #[doc(hidden)] pub struct _USERREG1; #[doc = "`read()` method returns [userreg1::R](userreg1::R) reader structure"] impl crate::Readable for USERREG1 {} #[doc = "`write(|w| ..)` method takes [userreg1::W](userreg1::W) writer structure"] impl crate::Writable for USERREG1 {} #[doc = "User Register 1"] pub mod userreg1; #[doc = "User Register 2\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [userreg2](userreg2) module"] pub type USERREG2 = crate::Reg<u32, _USERREG2>; #[allow(missing_docs)] #[doc(hidden)] pub struct _USERREG2; #[doc = "`read()` method returns [userreg2::R](userreg2::R) reader structure"] impl crate::Readable for USERREG2 {} #[doc = "`write(|w| ..)` method takes [userreg2::W](userreg2::W) writer structure"] impl crate::Writable for USERREG2 {} #[doc = "User Register 2"] pub mod userreg2; #[doc = "User Register 3\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [userreg3](userreg3) module"] pub type USERREG3 = crate::Reg<u32, _USERREG3>; #[allow(missing_docs)] #[doc(hidden)] pub struct _USERREG3; #[doc = "`read()` method returns [userreg3::R](userreg3::R) reader structure"] impl crate::Readable for USERREG3 {} #[doc = "`write(|w| ..)` method takes [userreg3::W](userreg3::W) writer structure"] impl crate::Writable for USERREG3 {} #[doc = "User Register 3"] pub mod userreg3; #[doc = "Flash Memory Protection Read Enable 0\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmpre0](fmpre0) module"] pub type FMPRE0 = crate::Reg<u32, _FMPRE0>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPRE0; #[doc = "`read()` method returns [fmpre0::R](fmpre0::R) reader structure"] impl crate::Readable for FMPRE0 {} #[doc = "`write(|w| ..)` method takes [fmpre0::W](fmpre0::W) writer structure"] impl crate::Writable for FMPRE0 {} #[doc = "Flash Memory Protection Read Enable 0"] pub mod fmpre0; #[doc = "Flash Memory Protection Read Enable 1\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmpre1](fmpre1) module"] pub type FMPRE1 = crate::Reg<u32, _FMPRE1>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPRE1; #[doc = "`read()` method returns [fmpre1::R](fmpre1::R) reader structure"] impl crate::Readable for FMPRE1 {} #[doc = "`write(|w| ..)` method takes [fmpre1::W](fmpre1::W) writer structure"] impl crate::Writable for FMPRE1 {} #[doc = "Flash Memory Protection Read Enable 1"] pub mod fmpre1; #[doc = "Flash Memory Protection Read Enable 2\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmpre2](fmpre2) module"] pub type FMPRE2 = crate::Reg<u32, _FMPRE2>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPRE2; #[doc = "`read()` method returns [fmpre2::R](fmpre2::R) reader structure"] impl crate::Readable for FMPRE2 {} #[doc = "`write(|w| ..)` method takes [fmpre2::W](fmpre2::W) writer structure"] impl crate::Writable for FMPRE2 {} #[doc = "Flash Memory Protection Read Enable 2"] pub mod fmpre2; #[doc = "Flash Memory Protection Read Enable 3\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmpre3](fmpre3) module"] pub type FMPRE3 = crate::Reg<u32, _FMPRE3>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPRE3; #[doc = "`read()` method returns [fmpre3::R](fmpre3::R) reader structure"] impl crate::Readable for FMPRE3 {} #[doc = "`write(|w| ..)` method takes [fmpre3::W](fmpre3::W) writer structure"] impl crate::Writable for FMPRE3 {} #[doc = "Flash Memory Protection Read Enable 3"] pub mod fmpre3; #[doc = "Flash Memory Protection Read Enable 4\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmpre4](fmpre4) module"] pub type FMPRE4 = crate::Reg<u32, _FMPRE4>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPRE4; #[doc = "`read()` method returns [fmpre4::R](fmpre4::R) reader structure"] impl crate::Readable for FMPRE4 {} #[doc = "`write(|w| ..)` method takes [fmpre4::W](fmpre4::W) writer structure"] impl crate::Writable for FMPRE4 {} #[doc = "Flash Memory Protection Read Enable 4"] pub mod fmpre4; #[doc = "Flash Memory Protection Read Enable 5\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmpre5](fmpre5) module"] pub type FMPRE5 = crate::Reg<u32, _FMPRE5>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPRE5; #[doc = "`read()` method returns [fmpre5::R](fmpre5::R) reader structure"] impl crate::Readable for FMPRE5 {} #[doc = "`write(|w| ..)` method takes [fmpre5::W](fmpre5::W) writer structure"] impl crate::Writable for FMPRE5 {} #[doc = "Flash Memory Protection Read Enable 5"] pub mod fmpre5; #[doc = "Flash Memory Protection Read Enable 6\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmpre6](fmpre6) module"] pub type FMPRE6 = crate::Reg<u32, _FMPRE6>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPRE6; #[doc = "`read()` method returns [fmpre6::R](fmpre6::R) reader structure"] impl crate::Readable for FMPRE6 {} #[doc = "`write(|w| ..)` method takes [fmpre6::W](fmpre6::W) writer structure"] impl crate::Writable for FMPRE6 {} #[doc = "Flash Memory Protection Read Enable 6"] pub mod fmpre6; #[doc = "Flash Memory Protection Read Enable 7\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmpre7](fmpre7) module"] pub type FMPRE7 = crate::Reg<u32, _FMPRE7>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPRE7; #[doc = "`read()` method returns [fmpre7::R](fmpre7::R) reader structure"] impl crate::Readable for FMPRE7 {} #[doc = "`write(|w| ..)` method takes [fmpre7::W](fmpre7::W) writer structure"] impl crate::Writable for FMPRE7 {} #[doc = "Flash Memory Protection Read Enable 7"] pub mod fmpre7; #[doc = "Flash Memory Protection Read Enable 8\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmpre8](fmpre8) module"] pub type FMPRE8 = crate::Reg<u32, _FMPRE8>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPRE8; #[doc = "`read()` method returns [fmpre8::R](fmpre8::R) reader structure"] impl crate::Readable for FMPRE8 {} #[doc = "`write(|w| ..)` method takes [fmpre8::W](fmpre8::W) writer structure"] impl crate::Writable for FMPRE8 {} #[doc = "Flash Memory Protection Read Enable 8"] pub mod fmpre8; #[doc = "Flash Memory Protection Read Enable 9\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmpre9](fmpre9) module"] pub type FMPRE9 = crate::Reg<u32, _FMPRE9>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPRE9; #[doc = "`read()` method returns [fmpre9::R](fmpre9::R) reader structure"] impl crate::Readable for FMPRE9 {} #[doc = "`write(|w| ..)` method takes [fmpre9::W](fmpre9::W) writer structure"] impl crate::Writable for FMPRE9 {} #[doc = "Flash Memory Protection Read Enable 9"] pub mod fmpre9; #[doc = "Flash Memory Protection Read Enable 10\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmpre10](fmpre10) module"] pub type FMPRE10 = crate::Reg<u32, _FMPRE10>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPRE10; #[doc = "`read()` method returns [fmpre10::R](fmpre10::R) reader structure"] impl crate::Readable for FMPRE10 {} #[doc = "`write(|w| ..)` method takes [fmpre10::W](fmpre10::W) writer structure"] impl crate::Writable for FMPRE10 {} #[doc = "Flash Memory Protection Read Enable 10"] pub mod fmpre10; #[doc = "Flash Memory Protection Read Enable 11\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmpre11](fmpre11) module"] pub type FMPRE11 = crate::Reg<u32, _FMPRE11>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPRE11; #[doc = "`read()` method returns [fmpre11::R](fmpre11::R) reader structure"] impl crate::Readable for FMPRE11 {} #[doc = "`write(|w| ..)` method takes [fmpre11::W](fmpre11::W) writer structure"] impl crate::Writable for FMPRE11 {} #[doc = "Flash Memory Protection Read Enable 11"] pub mod fmpre11; #[doc = "Flash Memory Protection Read Enable 12\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmpre12](fmpre12) module"] pub type FMPRE12 = crate::Reg<u32, _FMPRE12>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPRE12; #[doc = "`read()` method returns [fmpre12::R](fmpre12::R) reader structure"] impl crate::Readable for FMPRE12 {} #[doc = "`write(|w| ..)` method takes [fmpre12::W](fmpre12::W) writer structure"] impl crate::Writable for FMPRE12 {} #[doc = "Flash Memory Protection Read Enable 12"] pub mod fmpre12; #[doc = "Flash Memory Protection Read Enable 13\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmpre13](fmpre13) module"] pub type FMPRE13 = crate::Reg<u32, _FMPRE13>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPRE13; #[doc = "`read()` method returns [fmpre13::R](fmpre13::R) reader structure"] impl crate::Readable for FMPRE13 {} #[doc = "`write(|w| ..)` method takes [fmpre13::W](fmpre13::W) writer structure"] impl crate::Writable for FMPRE13 {} #[doc = "Flash Memory Protection Read Enable 13"] pub mod fmpre13; #[doc = "Flash Memory Protection Read Enable 14\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmpre14](fmpre14) module"] pub type FMPRE14 = crate::Reg<u32, _FMPRE14>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPRE14; #[doc = "`read()` method returns [fmpre14::R](fmpre14::R) reader structure"] impl crate::Readable for FMPRE14 {} #[doc = "`write(|w| ..)` method takes [fmpre14::W](fmpre14::W) writer structure"] impl crate::Writable for FMPRE14 {} #[doc = "Flash Memory Protection Read Enable 14"] pub mod fmpre14; #[doc = "Flash Memory Protection Read Enable 15\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmpre15](fmpre15) module"] pub type FMPRE15 = crate::Reg<u32, _FMPRE15>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPRE15; #[doc = "`read()` method returns [fmpre15::R](fmpre15::R) reader structure"] impl crate::Readable for FMPRE15 {} #[doc = "`write(|w| ..)` method takes [fmpre15::W](fmpre15::W) writer structure"] impl crate::Writable for FMPRE15 {} #[doc = "Flash Memory Protection Read Enable 15"] pub mod fmpre15; #[doc = "Flash Memory Protection Program Enable 0\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmppe0](fmppe0) module"] pub type FMPPE0 = crate::Reg<u32, _FMPPE0>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPPE0; #[doc = "`read()` method returns [fmppe0::R](fmppe0::R) reader structure"] impl crate::Readable for FMPPE0 {} #[doc = "`write(|w| ..)` method takes [fmppe0::W](fmppe0::W) writer structure"] impl crate::Writable for FMPPE0 {} #[doc = "Flash Memory Protection Program Enable 0"] pub mod fmppe0; #[doc = "Flash Memory Protection Program Enable 1\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmppe1](fmppe1) module"] pub type FMPPE1 = crate::Reg<u32, _FMPPE1>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPPE1; #[doc = "`read()` method returns [fmppe1::R](fmppe1::R) reader structure"] impl crate::Readable for FMPPE1 {} #[doc = "`write(|w| ..)` method takes [fmppe1::W](fmppe1::W) writer structure"] impl crate::Writable for FMPPE1 {} #[doc = "Flash Memory Protection Program Enable 1"] pub mod fmppe1; #[doc = "Flash Memory Protection Program Enable 2\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmppe2](fmppe2) module"] pub type FMPPE2 = crate::Reg<u32, _FMPPE2>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPPE2; #[doc = "`read()` method returns [fmppe2::R](fmppe2::R) reader structure"] impl crate::Readable for FMPPE2 {} #[doc = "`write(|w| ..)` method takes [fmppe2::W](fmppe2::W) writer structure"] impl crate::Writable for FMPPE2 {} #[doc = "Flash Memory Protection Program Enable 2"] pub mod fmppe2; #[doc = "Flash Memory Protection Program Enable 3\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmppe3](fmppe3) module"] pub type FMPPE3 = crate::Reg<u32, _FMPPE3>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPPE3; #[doc = "`read()` method returns [fmppe3::R](fmppe3::R) reader structure"] impl crate::Readable for FMPPE3 {} #[doc = "`write(|w| ..)` method takes [fmppe3::W](fmppe3::W) writer structure"] impl crate::Writable for FMPPE3 {} #[doc = "Flash Memory Protection Program Enable 3"] pub mod fmppe3; #[doc = "Flash Memory Protection Program Enable 4\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmppe4](fmppe4) module"] pub type FMPPE4 = crate::Reg<u32, _FMPPE4>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPPE4; #[doc = "`read()` method returns [fmppe4::R](fmppe4::R) reader structure"] impl crate::Readable for FMPPE4 {} #[doc = "`write(|w| ..)` method takes [fmppe4::W](fmppe4::W) writer structure"] impl crate::Writable for FMPPE4 {} #[doc = "Flash Memory Protection Program Enable 4"] pub mod fmppe4; #[doc = "Flash Memory Protection Program Enable 5\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmppe5](fmppe5) module"] pub type FMPPE5 = crate::Reg<u32, _FMPPE5>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPPE5; #[doc = "`read()` method returns [fmppe5::R](fmppe5::R) reader structure"] impl crate::Readable for FMPPE5 {} #[doc = "`write(|w| ..)` method takes [fmppe5::W](fmppe5::W) writer structure"] impl crate::Writable for FMPPE5 {} #[doc = "Flash Memory Protection Program Enable 5"] pub mod fmppe5; #[doc = "Flash Memory Protection Program Enable 6\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmppe6](fmppe6) module"] pub type FMPPE6 = crate::Reg<u32, _FMPPE6>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPPE6; #[doc = "`read()` method returns [fmppe6::R](fmppe6::R) reader structure"] impl crate::Readable for FMPPE6 {} #[doc = "`write(|w| ..)` method takes [fmppe6::W](fmppe6::W) writer structure"] impl crate::Writable for FMPPE6 {} #[doc = "Flash Memory Protection Program Enable 6"] pub mod fmppe6; #[doc = "Flash Memory Protection Program Enable 7\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmppe7](fmppe7) module"] pub type FMPPE7 = crate::Reg<u32, _FMPPE7>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPPE7; #[doc = "`read()` method returns [fmppe7::R](fmppe7::R) reader structure"] impl crate::Readable for FMPPE7 {} #[doc = "`write(|w| ..)` method takes [fmppe7::W](fmppe7::W) writer structure"] impl crate::Writable for FMPPE7 {} #[doc = "Flash Memory Protection Program Enable 7"] pub mod fmppe7; #[doc = "Flash Memory Protection Program Enable 8\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmppe8](fmppe8) module"] pub type FMPPE8 = crate::Reg<u32, _FMPPE8>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPPE8; #[doc = "`read()` method returns [fmppe8::R](fmppe8::R) reader structure"] impl crate::Readable for FMPPE8 {} #[doc = "`write(|w| ..)` method takes [fmppe8::W](fmppe8::W) writer structure"] impl crate::Writable for FMPPE8 {} #[doc = "Flash Memory Protection Program Enable 8"] pub mod fmppe8; #[doc = "Flash Memory Protection Program Enable 9\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmppe9](fmppe9) module"] pub type FMPPE9 = crate::Reg<u32, _FMPPE9>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPPE9; #[doc = "`read()` method returns [fmppe9::R](fmppe9::R) reader structure"] impl crate::Readable for FMPPE9 {} #[doc = "`write(|w| ..)` method takes [fmppe9::W](fmppe9::W) writer structure"] impl crate::Writable for FMPPE9 {} #[doc = "Flash Memory Protection Program Enable 9"] pub mod fmppe9; #[doc = "Flash Memory Protection Program Enable 10\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmppe10](fmppe10) module"] pub type FMPPE10 = crate::Reg<u32, _FMPPE10>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPPE10; #[doc = "`read()` method returns [fmppe10::R](fmppe10::R) reader structure"] impl crate::Readable for FMPPE10 {} #[doc = "`write(|w| ..)` method takes [fmppe10::W](fmppe10::W) writer structure"] impl crate::Writable for FMPPE10 {} #[doc = "Flash Memory Protection Program Enable 10"] pub mod fmppe10; #[doc = "Flash Memory Protection Program Enable 11\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmppe11](fmppe11) module"] pub type FMPPE11 = crate::Reg<u32, _FMPPE11>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPPE11; #[doc = "`read()` method returns [fmppe11::R](fmppe11::R) reader structure"] impl crate::Readable for FMPPE11 {} #[doc = "`write(|w| ..)` method takes [fmppe11::W](fmppe11::W) writer structure"] impl crate::Writable for FMPPE11 {} #[doc = "Flash Memory Protection Program Enable 11"] pub mod fmppe11; #[doc = "Flash Memory Protection Program Enable 12\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmppe12](fmppe12) module"] pub type FMPPE12 = crate::Reg<u32, _FMPPE12>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPPE12; #[doc = "`read()` method returns [fmppe12::R](fmppe12::R) reader structure"] impl crate::Readable for FMPPE12 {} #[doc = "`write(|w| ..)` method takes [fmppe12::W](fmppe12::W) writer structure"] impl crate::Writable for FMPPE12 {} #[doc = "Flash Memory Protection Program Enable 12"] pub mod fmppe12; #[doc = "Flash Memory Protection Program Enable 13\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmppe13](fmppe13) module"] pub type FMPPE13 = crate::Reg<u32, _FMPPE13>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPPE13; #[doc = "`read()` method returns [fmppe13::R](fmppe13::R) reader structure"] impl crate::Readable for FMPPE13 {} #[doc = "`write(|w| ..)` method takes [fmppe13::W](fmppe13::W) writer structure"] impl crate::Writable for FMPPE13 {} #[doc = "Flash Memory Protection Program Enable 13"] pub mod fmppe13; #[doc = "Flash Memory Protection Program Enable 14\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmppe14](fmppe14) module"] pub type FMPPE14 = crate::Reg<u32, _FMPPE14>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPPE14; #[doc = "`read()` method returns [fmppe14::R](fmppe14::R) reader structure"] impl crate::Readable for FMPPE14 {} #[doc = "`write(|w| ..)` method takes [fmppe14::W](fmppe14::W) writer structure"] impl crate::Writable for FMPPE14 {} #[doc = "Flash Memory Protection Program Enable 14"] pub mod fmppe14; #[doc = "Flash Memory Protection Program Enable 15\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fmppe15](fmppe15) module"] pub type FMPPE15 = crate::Reg<u32, _FMPPE15>; #[allow(missing_docs)] #[doc(hidden)] pub struct _FMPPE15; #[doc = "`read()` method returns [fmppe15::R](fmppe15::R) reader structure"] impl crate::Readable for FMPPE15 {} #[doc = "`write(|w| ..)` method takes [fmppe15::W](fmppe15::W) writer structure"] impl crate::Writable for FMPPE15 {} #[doc = "Flash Memory Protection Program Enable 15"] pub mod fmppe15;
use crate::MessageType; /// A method for obtaining the field ID a specified `MessageType` uses for its timestamp. Usually it's 253 but unfortunately not always. pub fn get_message_timestamp_field(mt: MessageType) -> Option<usize> { match mt { MessageType::AccelerometerData => Some(253), MessageType::Activity => Some(253), MessageType::AntRx => Some(253), MessageType::AntTx => Some(253), MessageType::AviationAttitude => Some(253), MessageType::BarometerData => Some(253), MessageType::BloodPressure => Some(253), MessageType::CameraEvent => Some(253), MessageType::ClimbPro => Some(253), MessageType::CoursePoint => Some(1), MessageType::DeviceAuxBatteryInfo => Some(253), MessageType::DeviceInfo => Some(253), MessageType::DiveSummary => Some(253), MessageType::Event => Some(253), MessageType::GpsMetadata => Some(253), MessageType::GyroscopeData => Some(253), MessageType::Hr => Some(253), MessageType::Jump => Some(253), MessageType::Lap => Some(253), MessageType::Length => Some(253), MessageType::MagnetometerData => Some(253), MessageType::Monitoring => Some(253), MessageType::MonitoringInfo => Some(253), MessageType::NmeaSentence => Some(253), MessageType::ObdiiData => Some(253), MessageType::OhrSettings => Some(253), MessageType::OneDSensorCalibration => Some(253), MessageType::Record => Some(253), MessageType::SegmentLap => Some(253), MessageType::Session => Some(253), MessageType::Set => Some(254), MessageType::ThreeDSensorCalibration => Some(253), MessageType::TimestampCorrelation => Some(253), MessageType::Totals => Some(253), MessageType::TrainingFile => Some(253), MessageType::VideoClip => Some(1), MessageType::VideoFrame => Some(253), MessageType::WeatherAlert => Some(253), MessageType::WeatherConditions => Some(253), MessageType::WeightScale => Some(253), _ => None } }
use std::io; use std::io::prelude::*; use std::io::{BufRead, BufReader, BufWriter}; use std::net::TcpStream; pub struct BufTcpStream { pub input: BufReader<TcpStream>, pub output: BufWriter<TcpStream>, } impl BufTcpStream { pub fn new(stream: TcpStream) -> io::Result<Self> { let input = BufReader::new(stream.try_clone()?); let output = BufWriter::new(stream); Ok(Self { input, output }) } pub fn read(&mut self) -> String { let mut buffer = String::new(); self.input.read_line(&mut buffer).unwrap(); if buffer.len() == 0 { panic!() } buffer = buffer.replace("\r", ""); buffer = buffer.replace("\n", ""); buffer } } pub trait Print<T> { fn print(&mut self, s: T); } impl Print<String> for BufTcpStream { fn print(&mut self, s: String) { write!(self.output, "{}", s).unwrap(); self.output.flush().unwrap(); } } impl Print<i32> for BufTcpStream { fn print(&mut self, s: i32) { write!(self.output, "{}", s).unwrap(); self.output.flush().unwrap(); } } impl Print<&str> for BufTcpStream { fn print(&mut self, s: &str) { write!(self.output, "{}", s).unwrap(); self.output.flush().unwrap(); } }
use std::io; use std::num::ParseIntError; pub fn read_integer() -> Result<i32, ParseIntError> { let mut input_text = String::new(); io::stdin().read_line(&mut input_text).expect("Failed to read from stdin."); let trimmed = input_text.trim(); return trimmed.parse::<i32>(); }
use std::collections::HashMap; fn evolve(prev_state: String, rules: &HashMap<String, char>) -> String { let state = "....".to_owned() + &prev_state + "...."; let mut result = String::new(); for i in 2..(state.len() - 2) { result.push(*rules.get(state[(i - 2)..(i + 3)].into()).unwrap_or(&'.')); } result } fn sum(state: &String, gens: usize) -> isize { state .chars() .enumerate() .filter_map(|(i, x)| match x { '#' => Some(i as isize - (2 * gens as isize)), _ => None, }) .sum() } fn converges(diffs: &Vec<isize>) -> bool { // We can assume it has converged if the last 100 diffs are the same let len = diffs.len(); let last = diffs[len - 1]; for i in 1..=100 { if diffs[len - i - 1] != last { return false; } } true } fn solve(initial_state: String, raw_rules: String) -> isize { let rules: HashMap<String, char> = raw_rules .split("\n") .map(|x| { let pattern: String = x[0..5].into(); let replacement: char = x.chars().next_back().unwrap(); (pattern, replacement) }) .collect(); let mut state = initial_state; let mut last_sum = sum(&state, 0); let mut diffs = vec![]; let gens: usize = 50000000000; for i in 0..gens { state = evolve(state, &rules); let sum = sum(&state, i + 1); let diff = sum - last_sum; last_sum = sum; diffs.push(diff); if i > 100 && converges(&diffs) { return sum + (gens - (i + 1)) as isize * diff; } } panic!("it did not converge") } fn main() { let initial_state = ".##..##..####..#.#.#.###....#...#..#.#.#..#...#....##.#.#.#.#.#..######.##....##.###....##..#.####.#"; println!( "{}", solve(initial_state.into(), include_str!("input.txt").into()) ); }
pub trait Argmax { type Maximum; fn argmax(self) -> Option<(usize, Self::Maximum)>; } impl<I> Argmax for I where I: Iterator, I::Item: std::cmp::PartialOrd, { type Maximum = I::Item; fn argmax(mut self) -> Option<(usize, Self::Maximum)> { let v0 = self.next()?; Some( self.enumerate() .fold((0, v0), |(i_max, val_max), (i, val)| { if val > val_max { (i + 1, val) // Add 1 as index is one off due to next() above } else { (i_max, val_max) } }), ) } } #[cfg(test)] mod tests { use super::*; #[test] fn test_max_in_array() { assert_eq!(Some((3, &4.)), [1., 2., 3., 4., 3., 2., 1.].iter().argmax()); } #[test] fn test_max_start_of_array() { assert_eq!( Some((0, &100.)), [100., 2., 3., 4., 3., 2., 1.].iter().argmax() ); } #[test] fn empty_array() { let v: [u32; 0] = []; assert_eq!( None, v.iter().argmax() ); } #[test] fn finds_first_maximum_array() { let v = [1, 1, 1, 1, 1]; assert_eq!( Some((0, &1)), v.iter().argmax() ); } }
mod graph; mod graph_traversal_algorithms; pub use crate::{graph::DirectedLabelGraph, graph_traversal_algorithms::*};
use crate::{ Result, backend::{Backend, ImageData, instance}, error::QuicksilverError, file::load_file, geom::{Rectangle, Transform, Vector}, }; use futures::{Future, future}; use std::{ error::Error, fmt, io::Error as IOError, path::Path, rc::Rc }; ///Pixel formats for use with loading raw images #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] pub enum PixelFormat { /// Red, Green, and Blue RGB, /// Red, Green, Blue, and Alpha RGBA } #[derive(Clone, Debug)] ///An image that can be drawn to the screen pub struct Image { source: Rc<ImageData>, region: Rectangle, } impl Image { pub(crate) fn new(data: ImageData) -> Image { let region = Rectangle::new_sized((data.width, data.height)); Image { source: Rc::new(data), region } } /// Start loading a texture from a given path pub fn load<P: AsRef<Path>>(path: P) -> impl Future<Item = Image, Error = QuicksilverError> { load_file(path) .map(|data| Image::from_bytes(data.as_slice())) .and_then(future::result) } pub(crate) fn new_null(width: u32, height: u32, format: PixelFormat) -> Result<Image> { Image::from_raw(&[], width, height, format) } /// Load an image from pixel values in a byte array pub fn from_raw(data: &[u8], width: u32, height: u32, format: PixelFormat) -> Result<Image> { Ok(unsafe { Image::new(instance().create_texture(data, width, height, format)?) }) } /// Load an image directly from an encoded byte array pub fn from_bytes(raw: &[u8]) -> Result<Image> { let img = image::load_from_memory(raw)?.to_rgba(); let width = img.width(); let height = img.height(); Image::from_raw(img.into_raw().as_slice(), width, height, PixelFormat::RGBA) } pub(crate) fn get_id(&self) -> u32 { self.source.id } pub(crate) fn source_width(&self) -> u32 { self.source.width } pub(crate) fn source_height(&self) -> u32 { self.source.height } ///The area of the source image this subimage takes up pub fn area(&self) -> Rectangle { self.region } ///Find a subimage of a larger image pub fn subimage(&self, rect: Rectangle) -> Image { Image { source: self.source.clone(), region: Rectangle::new( (self.region.pos.x + rect.pos.x, self.region.pos.y + rect.pos.y), (rect.width(), rect.height()) ) } } /// Create a projection matrix for a given region onto the Image pub fn projection(&self, region: Rectangle) -> Transform { let source_size: Vector = (self.source_width(), self.source_height()).into(); let recip_size = source_size.recip(); let normalized_pos = self.region.top_left().times(recip_size); let normalized_size = self.region.size().times(recip_size); Transform::translate(normalized_pos) * Transform::scale(normalized_size) * Transform::scale(region.size().recip()) * Transform::translate(-region.top_left()) } } #[derive(Debug)] ///An error generated while loading an image pub enum ImageError { /// There was an error decoding the bytes of the image DecodingError(image::ImageError), ///There was some error reading the image file IOError(IOError) } #[doc(hidden)] impl From<IOError> for ImageError { fn from(err: IOError) -> ImageError { ImageError::IOError(err) } } #[doc(hidden)] impl From<image::ImageError> for ImageError { fn from(img: image::ImageError) -> ImageError { ImageError::DecodingError(img) } } impl fmt::Display for ImageError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.description()) } } impl Error for ImageError { fn description(&self) -> &str { match self { &ImageError::DecodingError(ref err) => err.description(), &ImageError::IOError(ref err) => err.description(), } } fn cause(&self) -> Option<&dyn Error> { match self { &ImageError::DecodingError(ref err) => Some(err), &ImageError::IOError(ref err) => Some(err), } } }
mod renderer; pub use renderer::*; pub use httpserver::*; pub use database::*; #[cfg(test)] mod tests { }
pub struct Math {} impl Math { pub fn clamp<T: PartialOrd>(v: T, min: T, max: T) -> T { if v < min { min } else if v > max { max } else { v } } }
extern crate inflector; extern crate serde; extern crate serde_yaml; #[macro_use] extern crate serde_derive; extern crate try_from; extern crate range; extern crate rand; #[macro_use] extern crate lazy_static; extern crate rustache; // Keep the #[macro use] utils first #[macro_use] pub mod utils; pub mod item; pub mod combat; pub mod character; pub mod display; pub mod monster; pub mod theme; pub mod dungeon; #[cfg(test)] mod tests; pub use item::*; pub use combat::*; pub use character::*; pub use utils::*; pub use theme::*; pub use display::*; pub use monster::*; pub use dungeon::*;
use crate::TimeTrackerError; use std::convert::TryFrom; use std::fmt; use std::fmt::Display; use std::fmt::Formatter; #[derive(PartialEq, Debug)] pub struct RawLog { pub name: String, pub timestamp: u64, } pub fn raw_logs_from(raw_data: &str) -> Result<Vec<RawLog>, TimeTrackerError> { let mut raw_logs = vec![]; for line in raw_data.lines() { let raw_log = RawLog::try_from(line)?; raw_logs.push(raw_log); } Ok(raw_logs) } impl<'a> TryFrom<&'a str> for RawLog { type Error = TimeTrackerError; fn try_from(raw_data: &'a str) -> Result<Self, Self::Error> { let mut parts = raw_data.split('/'); let name = match parts.next() { Some(v) => v.to_string(), None => return Err(TimeTrackerError::InvalidLineError(raw_data.to_string())), }; let timestamp = match parts.next() { Some(v) => match v.parse::<u64>() { Ok(parsed) => parsed, Err(_) => return Err(TimeTrackerError::InvalidTimestampError(v.to_string())), }, None => return Err(TimeTrackerError::InvalidLineError(raw_data.to_string())), }; Ok(RawLog { name, timestamp }) } } impl Display for RawLog { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "{}/{}", self.name, self.timestamp,) } } #[cfg(test)] mod tests { use super::*; #[test] fn raw_logs_from_string() { let raw_data = "testproj1/123\ntestproj2/456\n"; let raw_logs = raw_logs_from(raw_data); assert_eq!(2, raw_logs.unwrap().len()); } #[test] fn raw_log_from_str() { let raw_data = "josh/123"; assert_eq!( RawLog { name: String::from("josh"), timestamp: 123u64 }, RawLog::try_from(raw_data).unwrap() ); } #[test] fn raw_log_display() { let raw_log = RawLog { name: String::from("testproj1"), timestamp: 123, }; assert_eq!("testproj1/123", format!("{}", raw_log)); } }
use clap::{App, Arg}; use csvchk::{Config, MyResult}; // -------------------------------------------------- fn main() { if let Err(err) = get_args().and_then(run) { eprintln!("{}", err); std::process::exit(1); } } // -------------------------------------------------- pub fn get_args() -> MyResult<Config> { let matches = App::new("tabchk") .version("0.1.0") .author("Ken Youens-Clark <kyclark@gmail.com>") .about("Rust cal") .arg( Arg::with_name("files") .value_name("FILE") .help("Input filename") .min_values(1) .takes_value(true), ) .arg( Arg::with_name("delimiter") .value_name("DELIM") .short("d") .long("delim") .help("Field delimiter") .default_value("\t"), ) .arg( Arg::with_name("no_headers") .value_name("NO_HEADERS") .short("n") .long("no-headers") .help("Input file has no headers") .takes_value(false), ) .get_matches(); let delimiter = matches.value_of("delimiter").unwrap().as_bytes(); if delimiter.len() != 1 { return Err("--delimiter must be a single byte/character".into()); } Ok(Config { files: matches.values_of_lossy("files").unwrap(), delimiter: delimiter[0], has_headers: !matches.is_present("no_headers"), }) } // -------------------------------------------------- fn run(config: Config) -> MyResult<()> { println!("{:?}", config); for filename in config.files { csvchk::process(&filename, &config.delimiter, config.has_headers)?; } Ok(()) }
extern crate circular_buffer; #[allow(unused_must_use)] mod tests { use circular_buffer::{CircularBuffer, Error}; #[test] fn error_on_read_empty_buffer() { let mut buffer = CircularBuffer::new(1); assert_eq!(Err(Error::EmptyBuffer), buffer.read()); } #[test] #[ignore] fn write_and_read_back_item() { let mut buffer = CircularBuffer::new(1); buffer.write('1'); assert_eq!('1', buffer.read().unwrap()); assert_eq!(Err(Error::EmptyBuffer), buffer.read()); } #[test] #[ignore] fn write_and_read_back_multiple_items() { let mut buffer = CircularBuffer::new(2); buffer.write('1'); buffer.write('2'); assert_eq!('1', buffer.read().unwrap()); assert_eq!('2', buffer.read().unwrap()); assert_eq!(Err(Error::EmptyBuffer), buffer.read()); } #[test] #[ignore] fn alternate_write_and_read() { let mut buffer = CircularBuffer::new(2); buffer.write('1'); assert_eq!('1', buffer.read().unwrap()); buffer.write('2'); assert_eq!('2', buffer.read().unwrap()); } #[test] #[ignore] fn clear_buffer() { let mut buffer = CircularBuffer::new(3); buffer.write('1'); buffer.write('2'); buffer.write('3'); buffer.clear(); assert_eq!(Err(Error::EmptyBuffer), buffer.read()); buffer.write('1'); buffer.write('2'); assert_eq!('1', buffer.read().unwrap()); buffer.write('3'); assert_eq!('2', buffer.read().unwrap()); } #[test] #[ignore] fn full_buffer_error() { let mut buffer = CircularBuffer::new(2); buffer.write('1'); buffer.write('2'); assert_eq!(Err(Error::FullBuffer), buffer.write('3')); } #[test] #[ignore] fn overwrite_item_in_non_full_buffer() { let mut buffer = CircularBuffer::new(2); buffer.write('1'); buffer.overwrite('2'); assert_eq!('1', buffer.read().unwrap()); assert_eq!('2', buffer.read().unwrap()); assert_eq!(Err(Error::EmptyBuffer), buffer.read()); } #[test] #[ignore] fn overwrite_item_in_full_buffer() { let mut buffer = CircularBuffer::new(2); buffer.write('1'); buffer.write('2'); buffer.overwrite('A'); assert_eq!('2', buffer.read().unwrap()); assert_eq!('A', buffer.read().unwrap()); } }
use md5::Digest; fn zerohash(input: &str, zerocheck: impl Fn(&Digest) -> bool) -> i32 { let mut num = 0; let orig_len = input.len(); let mut hash_input = input.as_bytes().to_owned(); loop { let _ = itoa::write(&mut hash_input, num); let digest = md5::compute(&hash_input); hash_input.truncate(orig_len); if zerocheck(&digest) { return num; } num += 1; } } fn part1(input: &str) -> i32 { zerohash(input, |digest| { digest[0] == 0 && digest[1] == 0 && digest[2] < 16 }) } fn part2(input: &str) -> i32 { zerohash(input, |digest| { digest[0] == 0 && digest[1] == 0 && digest[2] == 0 }) } aoc::tests! { fn part1: "abcdef" => 609043; "pqrstuv" => 1048970; in => 117946; fn part2: in => 3938038; } aoc::main!(part1, part2);
use std::slice; // Helper to forward slice-optimized iterator functions. macro_rules! forward { () => { #[inline] fn next(&mut self) -> Option<Self::Item> { self.iter.next() } #[inline] fn nth(&mut self, n: usize) -> Option<Self::Item> { self.iter.nth(n) } #[inline] fn last(self) -> Option<Self::Item> { self.iter.last() } #[inline] fn find<P>(&mut self, predicate: P) -> Option<Self::Item> where Self: Sized, P: FnMut(&Self::Item) -> bool, { self.iter.find(predicate) } #[inline] fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() } #[inline] fn count(self) -> usize { self.iter.count() } #[inline] fn for_each<F>(self, f: F) where Self: Sized, F: FnMut(Self::Item), { self.iter.for_each(f); } #[inline] fn all<F>(&mut self, f: F) -> bool where Self: Sized, F: FnMut(Self::Item) -> bool, { self.iter.all(f) } #[inline] fn any<F>(&mut self, f: F) -> bool where Self: Sized, F: FnMut(Self::Item) -> bool, { self.iter.any(f) } #[inline] fn find_map<B, F>(&mut self, f: F) -> Option<B> where Self: Sized, F: FnMut(Self::Item) -> Option<B>, { self.iter.find_map(f) } #[inline] fn position<P>(&mut self, predicate: P) -> Option<usize> where Self: Sized, P: FnMut(Self::Item) -> bool, { self.iter.position(predicate) } #[inline] fn rposition<P>(&mut self, predicate: P) -> Option<usize> where P: FnMut(Self::Item) -> bool, Self: Sized, { self.iter.rposition(predicate) } }; } /// An iterator over the channels in the buffer. /// /// Created with [Sequential::iter][super::Sequential::iter]. pub struct Iter<'a, T> { iter: slice::ChunksExact<'a, T>, } impl<'a, T> Iter<'a, T> { #[inline] pub(super) fn new(data: &'a [T], frames: usize) -> Self { Self { iter: data.chunks_exact(frames), } } } impl<'a, T> Iterator for Iter<'a, T> { type Item = &'a [T]; forward!(); } impl<'a, T> DoubleEndedIterator for Iter<'a, T> { #[inline] fn next_back(&mut self) -> Option<Self::Item> { self.iter.next_back() } #[inline] fn nth_back(&mut self, n: usize) -> Option<Self::Item> { self.iter.nth_back(n) } } impl<'a, T> ExactSizeIterator for Iter<'a, T> { fn len(&self) -> usize { self.iter.len() } } /// A mutable iterator over the channels in the buffer. /// /// Created with [Sequential::iter_mut][super::Sequential::iter_mut]. pub struct IterMut<'a, T> { iter: slice::ChunksExactMut<'a, T>, } impl<'a, T> IterMut<'a, T> { #[inline] pub(super) fn new(data: &'a mut [T], frames: usize) -> Self { Self { iter: data.chunks_exact_mut(frames), } } } impl<'a, T> Iterator for IterMut<'a, T> { type Item = &'a mut [T]; forward!(); } impl<'a, T> DoubleEndedIterator for IterMut<'a, T> { #[inline] fn next_back(&mut self) -> Option<Self::Item> { self.iter.next_back() } #[inline] fn nth_back(&mut self, n: usize) -> Option<Self::Item> { self.iter.nth_back(n) } } impl<'a, T> ExactSizeIterator for IterMut<'a, T> { fn len(&self) -> usize { self.iter.len() } }
use std::io::BufRead; #[derive(Debug)] pub struct Tile(usize); #[derive(Debug)] pub struct Map { pub width: u32, pub height: u32, tiles: Vec<Tile>, } impl Map { pub fn get_tile(&self, x: u32, y: u32) -> Option<&Tile> { self.tiles.get((y * self.width + x) as usize) } pub fn read<R: BufRead>(mut reader: R) -> Result<Self, anyhow::Error> { let mut header = String::new(); reader.read_line(&mut header)?; let (width, height) = { let mut splat = header.split_whitespace(); let width = splat .next() .map(|s| s.parse::<usize>()) .ok_or_else(|| anyhow::Error::msg("invalid map header"))??; let height = splat .next() .map(|s| s.parse::<usize>()) .ok_or_else(|| anyhow::Error::msg("invalid map header"))??; if splat.next().is_some() { return Err(anyhow::Error::msg("invalid map header")); } (width, height) }; // Read the tiles themselves let mut tiles = Vec::new(); let mut lines = reader.lines(); for _ in 0..height { let line = match lines.next() { Some(Ok(line)) => line, Some(Err(err)) => return Err(err.into()), None => return Err(anyhow::Error::msg("too few map lines")), }; let mut splat = line.split_whitespace(); for _ in 0..width { let tile = match splat.next() { Some(tile) => tile, None => return Err(anyhow::Error::msg("map line too short")), }; let tile = tile.parse::<usize>()?; tiles.push(Tile(tile)); } if splat.next().is_some() { return Err(anyhow::Error::msg("map line too long")); } } if lines.next().is_some() { return Err(anyhow::Error::msg("too many map lines")); } Ok(Map { width: width as u32, height: height as u32, tiles, }) } } #[cfg(test)] mod tests { use super::*; #[test] fn test_read() { let map = Map::read(std::io::Cursor::new( "2 2 0 1 2 3")).unwrap(); assert_eq!(map.width, 2); assert_eq!(map.height, 2); assert_eq!(4, map.tiles.len()); assert_eq!(map.get_tile(0, 0).unwrap().0, 0); assert_eq!(map.get_tile(1, 0).unwrap().0, 1); assert_eq!(map.get_tile(0, 1).unwrap().0, 2); assert_eq!(map.get_tile(1, 1).unwrap().0, 3); } #[test] fn test_invalid_header() { let err = Map::read(std::io::Cursor::new("1")).unwrap_err(); assert_eq!(err.to_string(), "invalid map header"); let err = Map::read(std::io::Cursor::new("1 2 3")).unwrap_err(); assert_eq!(err.to_string(), "invalid map header"); let err = Map::read(std::io::Cursor::new("1 a")).unwrap_err(); assert_eq!(err.to_string(), "invalid digit found in string"); } #[test] fn test_line_too_long() { let err = Map::read(std::io::Cursor::new("1 1 1 2 3")).unwrap_err(); assert_eq!(err.to_string(), "map line too long"); } #[test] fn test_line_too_short() { let err = Map::read(std::io::Cursor::new("4 1 1 2 3")).unwrap_err(); assert_eq!(err.to_string(), "map line too short"); } #[test] fn test_too_few_lines() { let err = Map::read(std::io::Cursor::new("1 3 1 2")).unwrap_err(); assert_eq!(err.to_string(), "too few map lines"); } #[test] fn test_too_many_lines() { let err = Map::read(std::io::Cursor::new("1 1 1 2")).unwrap_err(); assert_eq!(err.to_string(), "too many map lines"); } }
mod error; use gstreamer::event::Step; use gstreamer::format::Buffers; use gstreamer::prelude::*; use gstreamer::*; use std::iter::Iterator; /* Send seek event to change rate */ fn send_seek_event(pipeline: &Element, video_sink: &mut Option<Element>, rate: f64) { /* Obtain the current position, needed for the seek event */ if let Some(position) = pipeline.query_position::<ClockTime>() { /* Create the seek event */ let seek_event = if rate > 0.0 { event::Seek::new( rate, SeekFlags::FLUSH | SeekFlags::ACCURATE, SeekType::Set, position, SeekType::End, ClockTime::ZERO, ) } else { event::Seek::new( rate, SeekFlags::FLUSH | SeekFlags::ACCURATE, SeekType::Set, ClockTime::ZERO, SeekType::Set, position, ) }; if video_sink.is_none() { /* If we have not done so, obtain the sink through which we will send the seek events */ *video_sink = pipeline.property("video-sink"); } /* Send the event */ video_sink.as_ref().unwrap().send_event(seek_event); println!("Current rate: {}", rate); } else { eprintln!("Unable to retrieve current position."); } } /* Process keyboard input */ fn handle_keyboard( main_loop: &glib::MainLoop, playing: &mut bool, rate: &mut f64, pipeline: &Element, video_sink: &mut Option<Element>, ) { loop { let mut str = String::new(); match std::io::stdin().read_line(&mut str) { Ok(size) if 0 < size => { let c = str.chars().next().unwrap(); match c.to_lowercase().to_string().as_str() { "p" => { *playing = !*playing; let state = if *playing { let _ = pipeline.set_state(State::Playing); "PLAYING" } else { let _ = pipeline.set_state(State::Paused); "PAUSED" }; println!("Setting state to {}", state); } "s" => { if c.is_uppercase() { *rate *= 2.0; } else { *rate /= 2.0; } send_seek_event(pipeline, video_sink, *rate); } "d" => { *rate *= -1.0; send_seek_event(pipeline, video_sink, *rate); } "n" => { if video_sink.is_none() { /* If we have not done so, obtain the sink through which we will send the step events */ *video_sink = pipeline.property("video-sink"); } video_sink.as_ref().unwrap().send_event(Step::new( Buffers::ONE, rate.abs(), true, false, )); println!("Stepping one frame"); } "q" => { main_loop.quit(); break; } _ => {} } } _ => {} } } } fn main() -> Result<(), error::Error> { /* Initialize GStreamer */ gstreamer::init().unwrap(); /* Print usage map */ println!("USAGE: Choose one of the following options, then press enter:"); println!(" 'P' to toggle between PAUSE and PLAY"); println!(" 'S' to increase playback speed, 's' to decrease playback speed"); println!(" 'D' to toggle playback direction"); println!(" 'N' to move to next frame (in the current direction, better in PAUSE)"); println!(" 'Q' to quit"); /* Build the pipeline */ let pipeline = parse_launch("playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm").unwrap(); /* Start playing */ if pipeline.set_state(State::Playing).is_err() { eprintln!("Unable to set the pipeline to the playing state."); panic!(); } let main_loop = glib::MainLoop::new(None, false); /* Add a keyboard watch so we get notified of keystrokes */ let main_loop_for_keyboard = main_loop.clone(); let pipeline_for_keyboard = pipeline.clone(); std::thread::spawn(move || { let mut playing = true; /* Playing or Paused */ let mut rate = 1.0; /* Current playback rate (can be negative) */ let mut video_sink = None; handle_keyboard( &main_loop_for_keyboard, &mut playing, &mut rate, &pipeline_for_keyboard, &mut video_sink, ); }); main_loop.run(); /* Free resources */ let _ = pipeline.set_state(State::Null); Ok(()) }
#[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::NMIENSET { #[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 `REGION0WA`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum REGION0WAR { #[doc = "Read: Disabled"] DISABLED, #[doc = "Read: Enabled"] ENABLED, } impl REGION0WAR { #[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 { REGION0WAR::DISABLED => false, REGION0WAR::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> REGION0WAR { match value { false => REGION0WAR::DISABLED, true => REGION0WAR::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == REGION0WAR::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == REGION0WAR::ENABLED } } #[doc = "Possible values of the field `REGION0RA`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum REGION0RAR { #[doc = "Read: Disabled"] DISABLED, #[doc = "Read: Enabled"] ENABLED, } impl REGION0RAR { #[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 { REGION0RAR::DISABLED => false, REGION0RAR::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> REGION0RAR { match value { false => REGION0RAR::DISABLED, true => REGION0RAR::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == REGION0RAR::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == REGION0RAR::ENABLED } } #[doc = "Possible values of the field `REGION1WA`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum REGION1WAR { #[doc = "Read: Disabled"] DISABLED, #[doc = "Read: Enabled"] ENABLED, } impl REGION1WAR { #[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 { REGION1WAR::DISABLED => false, REGION1WAR::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> REGION1WAR { match value { false => REGION1WAR::DISABLED, true => REGION1WAR::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == REGION1WAR::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == REGION1WAR::ENABLED } } #[doc = "Possible values of the field `REGION1RA`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum REGION1RAR { #[doc = "Read: Disabled"] DISABLED, #[doc = "Read: Enabled"] ENABLED, } impl REGION1RAR { #[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 { REGION1RAR::DISABLED => false, REGION1RAR::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> REGION1RAR { match value { false => REGION1RAR::DISABLED, true => REGION1RAR::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == REGION1RAR::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == REGION1RAR::ENABLED } } #[doc = "Possible values of the field `REGION2WA`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum REGION2WAR { #[doc = "Read: Disabled"] DISABLED, #[doc = "Read: Enabled"] ENABLED, } impl REGION2WAR { #[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 { REGION2WAR::DISABLED => false, REGION2WAR::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> REGION2WAR { match value { false => REGION2WAR::DISABLED, true => REGION2WAR::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == REGION2WAR::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == REGION2WAR::ENABLED } } #[doc = "Possible values of the field `REGION2RA`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum REGION2RAR { #[doc = "Read: Disabled"] DISABLED, #[doc = "Read: Enabled"] ENABLED, } impl REGION2RAR { #[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 { REGION2RAR::DISABLED => false, REGION2RAR::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> REGION2RAR { match value { false => REGION2RAR::DISABLED, true => REGION2RAR::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == REGION2RAR::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == REGION2RAR::ENABLED } } #[doc = "Possible values of the field `REGION3WA`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum REGION3WAR { #[doc = "Read: Disabled"] DISABLED, #[doc = "Read: Enabled"] ENABLED, } impl REGION3WAR { #[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 { REGION3WAR::DISABLED => false, REGION3WAR::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> REGION3WAR { match value { false => REGION3WAR::DISABLED, true => REGION3WAR::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == REGION3WAR::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == REGION3WAR::ENABLED } } #[doc = "Possible values of the field `REGION3RA`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum REGION3RAR { #[doc = "Read: Disabled"] DISABLED, #[doc = "Read: Enabled"] ENABLED, } impl REGION3RAR { #[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 { REGION3RAR::DISABLED => false, REGION3RAR::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> REGION3RAR { match value { false => REGION3RAR::DISABLED, true => REGION3RAR::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == REGION3RAR::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == REGION3RAR::ENABLED } } #[doc = "Possible values of the field `PREGION0WA`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum PREGION0WAR { #[doc = "Read: Disabled"] DISABLED, #[doc = "Read: Enabled"] ENABLED, } impl PREGION0WAR { #[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 { PREGION0WAR::DISABLED => false, PREGION0WAR::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> PREGION0WAR { match value { false => PREGION0WAR::DISABLED, true => PREGION0WAR::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == PREGION0WAR::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == PREGION0WAR::ENABLED } } #[doc = "Possible values of the field `PREGION0RA`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum PREGION0RAR { #[doc = "Read: Disabled"] DISABLED, #[doc = "Read: Enabled"] ENABLED, } impl PREGION0RAR { #[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 { PREGION0RAR::DISABLED => false, PREGION0RAR::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> PREGION0RAR { match value { false => PREGION0RAR::DISABLED, true => PREGION0RAR::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == PREGION0RAR::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == PREGION0RAR::ENABLED } } #[doc = "Possible values of the field `PREGION1WA`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum PREGION1WAR { #[doc = "Read: Disabled"] DISABLED, #[doc = "Read: Enabled"] ENABLED, } impl PREGION1WAR { #[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 { PREGION1WAR::DISABLED => false, PREGION1WAR::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> PREGION1WAR { match value { false => PREGION1WAR::DISABLED, true => PREGION1WAR::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == PREGION1WAR::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == PREGION1WAR::ENABLED } } #[doc = "Possible values of the field `PREGION1RA`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum PREGION1RAR { #[doc = "Read: Disabled"] DISABLED, #[doc = "Read: Enabled"] ENABLED, } impl PREGION1RAR { #[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 { PREGION1RAR::DISABLED => false, PREGION1RAR::ENABLED => true, } } #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _from(value: bool) -> PREGION1RAR { match value { false => PREGION1RAR::DISABLED, true => PREGION1RAR::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline] pub fn is_disabled(&self) -> bool { *self == PREGION1RAR::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline] pub fn is_enabled(&self) -> bool { *self == PREGION1RAR::ENABLED } } #[doc = "Values that can be written to the field `REGION0WA`"] pub enum REGION0WAW { #[doc = "Enable"] SET, } impl REGION0WAW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { REGION0WAW::SET => true, } } } #[doc = r" Proxy"] pub struct _REGION0WAW<'a> { w: &'a mut W, } impl<'a> _REGION0WAW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: REGION0WAW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Enable"] #[inline] pub fn set(self) -> &'a mut W { self.variant(REGION0WAW::SET) } #[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 `REGION0RA`"] pub enum REGION0RAW { #[doc = "Enable"] SET, } impl REGION0RAW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { REGION0RAW::SET => true, } } } #[doc = r" Proxy"] pub struct _REGION0RAW<'a> { w: &'a mut W, } impl<'a> _REGION0RAW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: REGION0RAW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Enable"] #[inline] pub fn set(self) -> &'a mut W { self.variant(REGION0RAW::SET) } #[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 `REGION1WA`"] pub enum REGION1WAW { #[doc = "Enable"] SET, } impl REGION1WAW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { REGION1WAW::SET => true, } } } #[doc = r" Proxy"] pub struct _REGION1WAW<'a> { w: &'a mut W, } impl<'a> _REGION1WAW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: REGION1WAW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Enable"] #[inline] pub fn set(self) -> &'a mut W { self.variant(REGION1WAW::SET) } #[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 `REGION1RA`"] pub enum REGION1RAW { #[doc = "Enable"] SET, } impl REGION1RAW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { REGION1RAW::SET => true, } } } #[doc = r" Proxy"] pub struct _REGION1RAW<'a> { w: &'a mut W, } impl<'a> _REGION1RAW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: REGION1RAW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Enable"] #[inline] pub fn set(self) -> &'a mut W { self.variant(REGION1RAW::SET) } #[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 `REGION2WA`"] pub enum REGION2WAW { #[doc = "Enable"] SET, } impl REGION2WAW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { REGION2WAW::SET => true, } } } #[doc = r" Proxy"] pub struct _REGION2WAW<'a> { w: &'a mut W, } impl<'a> _REGION2WAW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: REGION2WAW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Enable"] #[inline] pub fn set(self) -> &'a mut W { self.variant(REGION2WAW::SET) } #[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 `REGION2RA`"] pub enum REGION2RAW { #[doc = "Enable"] SET, } impl REGION2RAW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { REGION2RAW::SET => true, } } } #[doc = r" Proxy"] pub struct _REGION2RAW<'a> { w: &'a mut W, } impl<'a> _REGION2RAW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: REGION2RAW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Enable"] #[inline] pub fn set(self) -> &'a mut W { self.variant(REGION2RAW::SET) } #[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 `REGION3WA`"] pub enum REGION3WAW { #[doc = "Enable"] SET, } impl REGION3WAW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { REGION3WAW::SET => true, } } } #[doc = r" Proxy"] pub struct _REGION3WAW<'a> { w: &'a mut W, } impl<'a> _REGION3WAW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: REGION3WAW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Enable"] #[inline] pub fn set(self) -> &'a mut W { self.variant(REGION3WAW::SET) } #[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 `REGION3RA`"] pub enum REGION3RAW { #[doc = "Enable"] SET, } impl REGION3RAW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { REGION3RAW::SET => true, } } } #[doc = r" Proxy"] pub struct _REGION3RAW<'a> { w: &'a mut W, } impl<'a> _REGION3RAW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: REGION3RAW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Enable"] #[inline] pub fn set(self) -> &'a mut W { self.variant(REGION3RAW::SET) } #[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 } } #[doc = "Values that can be written to the field `PREGION0WA`"] pub enum PREGION0WAW { #[doc = "Enable"] SET, } impl PREGION0WAW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { PREGION0WAW::SET => true, } } } #[doc = r" Proxy"] pub struct _PREGION0WAW<'a> { w: &'a mut W, } impl<'a> _PREGION0WAW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: PREGION0WAW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Enable"] #[inline] pub fn set(self) -> &'a mut W { self.variant(PREGION0WAW::SET) } #[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 = 24; 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 `PREGION0RA`"] pub enum PREGION0RAW { #[doc = "Enable"] SET, } impl PREGION0RAW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { PREGION0RAW::SET => true, } } } #[doc = r" Proxy"] pub struct _PREGION0RAW<'a> { w: &'a mut W, } impl<'a> _PREGION0RAW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: PREGION0RAW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Enable"] #[inline] pub fn set(self) -> &'a mut W { self.variant(PREGION0RAW::SET) } #[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 = 25; 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 `PREGION1WA`"] pub enum PREGION1WAW { #[doc = "Enable"] SET, } impl PREGION1WAW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { PREGION1WAW::SET => true, } } } #[doc = r" Proxy"] pub struct _PREGION1WAW<'a> { w: &'a mut W, } impl<'a> _PREGION1WAW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: PREGION1WAW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Enable"] #[inline] pub fn set(self) -> &'a mut W { self.variant(PREGION1WAW::SET) } #[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 = 26; 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 `PREGION1RA`"] pub enum PREGION1RAW { #[doc = "Enable"] SET, } impl PREGION1RAW { #[allow(missing_docs)] #[doc(hidden)] #[inline] pub fn _bits(&self) -> bool { match *self { PREGION1RAW::SET => true, } } } #[doc = r" Proxy"] pub struct _PREGION1RAW<'a> { w: &'a mut W, } impl<'a> _PREGION1RAW<'a> { #[doc = r" Writes `variant` to the field"] #[inline] pub fn variant(self, variant: PREGION1RAW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "Enable"] #[inline] pub fn set(self) -> &'a mut W { self.variant(PREGION1RAW::SET) } #[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 = 27; 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 - Write '1' to enable non-maskable interrupt for REGION[0].WA event"] #[inline] pub fn region0wa(&self) -> REGION0WAR { REGION0WAR::_from({ const MASK: bool = true; const OFFSET: u8 = 0; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 1 - Write '1' to enable non-maskable interrupt for REGION[0].RA event"] #[inline] pub fn region0ra(&self) -> REGION0RAR { REGION0RAR::_from({ const MASK: bool = true; const OFFSET: u8 = 1; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 2 - Write '1' to enable non-maskable interrupt for REGION[1].WA event"] #[inline] pub fn region1wa(&self) -> REGION1WAR { REGION1WAR::_from({ const MASK: bool = true; const OFFSET: u8 = 2; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 3 - Write '1' to enable non-maskable interrupt for REGION[1].RA event"] #[inline] pub fn region1ra(&self) -> REGION1RAR { REGION1RAR::_from({ const MASK: bool = true; const OFFSET: u8 = 3; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 4 - Write '1' to enable non-maskable interrupt for REGION[2].WA event"] #[inline] pub fn region2wa(&self) -> REGION2WAR { REGION2WAR::_from({ const MASK: bool = true; const OFFSET: u8 = 4; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 5 - Write '1' to enable non-maskable interrupt for REGION[2].RA event"] #[inline] pub fn region2ra(&self) -> REGION2RAR { REGION2RAR::_from({ const MASK: bool = true; const OFFSET: u8 = 5; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 6 - Write '1' to enable non-maskable interrupt for REGION[3].WA event"] #[inline] pub fn region3wa(&self) -> REGION3WAR { REGION3WAR::_from({ const MASK: bool = true; const OFFSET: u8 = 6; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 7 - Write '1' to enable non-maskable interrupt for REGION[3].RA event"] #[inline] pub fn region3ra(&self) -> REGION3RAR { REGION3RAR::_from({ const MASK: bool = true; const OFFSET: u8 = 7; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 24 - Write '1' to enable non-maskable interrupt for PREGION[0].WA event"] #[inline] pub fn pregion0wa(&self) -> PREGION0WAR { PREGION0WAR::_from({ const MASK: bool = true; const OFFSET: u8 = 24; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 25 - Write '1' to enable non-maskable interrupt for PREGION[0].RA event"] #[inline] pub fn pregion0ra(&self) -> PREGION0RAR { PREGION0RAR::_from({ const MASK: bool = true; const OFFSET: u8 = 25; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 26 - Write '1' to enable non-maskable interrupt for PREGION[1].WA event"] #[inline] pub fn pregion1wa(&self) -> PREGION1WAR { PREGION1WAR::_from({ const MASK: bool = true; const OFFSET: u8 = 26; ((self.bits >> OFFSET) & MASK as u32) != 0 }) } #[doc = "Bit 27 - Write '1' to enable non-maskable interrupt for PREGION[1].RA event"] #[inline] pub fn pregion1ra(&self) -> PREGION1RAR { PREGION1RAR::_from({ const MASK: bool = true; const OFFSET: u8 = 27; ((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 - Write '1' to enable non-maskable interrupt for REGION[0].WA event"] #[inline] pub fn region0wa(&mut self) -> _REGION0WAW { _REGION0WAW { w: self } } #[doc = "Bit 1 - Write '1' to enable non-maskable interrupt for REGION[0].RA event"] #[inline] pub fn region0ra(&mut self) -> _REGION0RAW { _REGION0RAW { w: self } } #[doc = "Bit 2 - Write '1' to enable non-maskable interrupt for REGION[1].WA event"] #[inline] pub fn region1wa(&mut self) -> _REGION1WAW { _REGION1WAW { w: self } } #[doc = "Bit 3 - Write '1' to enable non-maskable interrupt for REGION[1].RA event"] #[inline] pub fn region1ra(&mut self) -> _REGION1RAW { _REGION1RAW { w: self } } #[doc = "Bit 4 - Write '1' to enable non-maskable interrupt for REGION[2].WA event"] #[inline] pub fn region2wa(&mut self) -> _REGION2WAW { _REGION2WAW { w: self } } #[doc = "Bit 5 - Write '1' to enable non-maskable interrupt for REGION[2].RA event"] #[inline] pub fn region2ra(&mut self) -> _REGION2RAW { _REGION2RAW { w: self } } #[doc = "Bit 6 - Write '1' to enable non-maskable interrupt for REGION[3].WA event"] #[inline] pub fn region3wa(&mut self) -> _REGION3WAW { _REGION3WAW { w: self } } #[doc = "Bit 7 - Write '1' to enable non-maskable interrupt for REGION[3].RA event"] #[inline] pub fn region3ra(&mut self) -> _REGION3RAW { _REGION3RAW { w: self } } #[doc = "Bit 24 - Write '1' to enable non-maskable interrupt for PREGION[0].WA event"] #[inline] pub fn pregion0wa(&mut self) -> _PREGION0WAW { _PREGION0WAW { w: self } } #[doc = "Bit 25 - Write '1' to enable non-maskable interrupt for PREGION[0].RA event"] #[inline] pub fn pregion0ra(&mut self) -> _PREGION0RAW { _PREGION0RAW { w: self } } #[doc = "Bit 26 - Write '1' to enable non-maskable interrupt for PREGION[1].WA event"] #[inline] pub fn pregion1wa(&mut self) -> _PREGION1WAW { _PREGION1WAW { w: self } } #[doc = "Bit 27 - Write '1' to enable non-maskable interrupt for PREGION[1].RA event"] #[inline] pub fn pregion1ra(&mut self) -> _PREGION1RAW { _PREGION1RAW { w: self } } }
#![allow(dead_code)] use chrono::{DateTime, Local}; use rand::{self, distributions::Uniform, Rng}; use crate::controller; use crate::model_config::{self, Config}; use crate::model_gamemode::{self, BoardSaved, GameMode}; use crate::view::AlertFailure; use crate::view::{self, ViewCommand}; use std::cell::Cell; use std::collections::BTreeSet; use std::ops; use std::path::PathBuf; use std::rc::Rc; #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum BlockStatus { Normal, Open, MarkedMine, MarkedQuestionable, } impl Default for BlockStatus { fn default() -> Self { BlockStatus::Normal } } #[derive(Clone, Default, Debug)] pub struct Block { pub has_mine: bool, pub cached_number: Cell<Option<u8>>, pub status: BlockStatus, } pub enum BlockShape { DeltaLike, RevDeltaLike, } pub enum GameButtonDisplayKind { Normal, Pushed, Danger, Finished, Died, } pub enum BlockDisplayKind { Normal, MarkedMine, MarkedQuestionable, ExplodedMine, WrongMarkedMine, NotMarkedMine, PushMarkedQuestionable, OpenWithNumber(u8), PushNormal, } #[derive(Clone, PartialEq, Eq, Debug)] pub enum BoardStatus { Ready, Going(DateTime<Local>), Finished(DateTime<Local>, DateTime<Local>), Died(DateTime<Local>, DateTime<Local>), } pub struct Board { size: (usize, usize), count: usize, rest_count: usize, mark_count: usize, status: BoardStatus, blocks: Vec<Block>, fixed_mine_pos: Option<Rc<Vec<usize>>>, allow_marks: bool, } impl Board { pub(crate) fn new(y: usize, x: usize, c: usize) -> Board { Board { size: (y, x), count: c, rest_count: y * x, mark_count: 0, status: BoardStatus::Ready, blocks: vec![Default::default(); y * x], fixed_mine_pos: None, allow_marks: true, } } pub(crate) fn renew(&self) -> Board { let size = self.size(); let count = self.goal_mark_count(); let fixed_mine_pos = self.fixed_mine_pos.clone(); let mut board = Board::new(size.0, size.1, count); board.fixed_mine_pos = fixed_mine_pos; board } pub fn size(&self) -> (usize, usize) { self.size } pub fn goal_mark_count(&self) -> usize { self.count } pub fn rest_count(&self) -> usize { self.rest_count } pub fn cur_mark_count(&self) -> usize { self.mark_count } pub fn status(&self) -> BoardStatus { self.status.clone() } pub fn fixed_mine_pos_list(&self) -> Option<&Rc<Vec<usize>>> { self.fixed_mine_pos.as_ref() } pub fn update_fixed_mine_pos_list(&mut self, list: Option<Rc<Vec<usize>>>) { self.fixed_mine_pos = list; } pub fn snapshot_mine_pos_list(&self) -> Option<Vec<usize>> { if self.status == BoardStatus::Ready { None } else { let mut result = Vec::new(); for (mine_idx, block) in self.blocks.iter().enumerate() { if block.has_mine { result.push(mine_idx); } } Some(result) } } pub fn allocate_mine_pos_list(&self, exclude_pos: Option<(usize, usize)>) -> Vec<usize> { let mapsize = self.size.0 * self.size.1; let mut exclude_set = BTreeSet::new(); if let Some((y, x)) = exclude_pos { exclude_set.insert(self.block_data_idx(y, x)); }; let mut rng = rand::thread_rng(); let mut result = Vec::new(); for mine_idx in Rng::sample_iter(&mut rng, &Uniform::new_inclusive(0, mapsize - 1)) { if exclude_set.replace(mine_idx).is_none() { result.push(mine_idx); } if result.len() == self.count { break; } } result } #[inline] fn block_data_idx(&self, y: usize, x: usize) -> usize { self.size.1 * y + x } pub fn block(&self, y: usize, x: usize) -> &Block { let idx = self.block_data_idx(y, x); &self.blocks[idx] } fn block_mut(&mut self, y: usize, x: usize) -> &mut Block { let idx = self.block_data_idx(y, x); &mut self.blocks[idx] } fn start_game_with(&mut self, y: usize, x: usize) { debug_assert!(y < self.size.0); debug_assert!(x < self.size.1); debug_assert!(self.status == BoardStatus::Ready); assert_eq!(self.blocks.len(), self.size.0 * self.size.1); if let Some(fixed_mine_pos) = self.fixed_mine_pos.as_ref() { for &mine_idx in fixed_mine_pos.iter() { assert!(self.blocks[mine_idx].status == BlockStatus::Normal); if self.blocks[mine_idx].has_mine { continue; } self.blocks[mine_idx].has_mine = true; } } else { let mine_pos_list = self.allocate_mine_pos_list(Some((y, x))); for mine_idx in mine_pos_list { assert!(self.blocks[mine_idx].status == BlockStatus::Normal); if self.blocks[mine_idx].has_mine { continue; } self.blocks[mine_idx].has_mine = true; } } for block in self.blocks.iter_mut() { if !block.has_mine { block.cached_number.set(None); } } //self.blocks = vec![Default::default()] } pub fn block_shape(y: usize, x: usize) -> BlockShape { match (y + x) % 2 { 0 => BlockShape::RevDeltaLike, _ => BlockShape::DeltaLike, } } fn is_surrounding(pos: (usize, usize), check: (usize, usize)) -> bool { let (y, x) = pos; let (check_y, check_x) = check; let shape = Self::block_shape(y, x); if check_y == y || match shape { BlockShape::DeltaLike => check_y == y + 1, BlockShape::RevDeltaLike => check_y + 1 == y, } { if check_x + 2 >= x && x + 2 >= check_x { return true; } } else if match shape { BlockShape::DeltaLike => check_y + 1 == y, BlockShape::RevDeltaLike => check_y == y + 1, } { if check_x + 1 >= x && x + 1 >= check_x { return true; } } false } fn surrounding_blocks(y: isize, x: isize) -> [(isize, isize); 12] { [ (y - 1, x - 1), (y - 1, x + 0), (y - 1, x + 1), ( match Self::block_shape(y as usize, x as usize) { BlockShape::DeltaLike => y + 1, BlockShape::RevDeltaLike => y - 1, }, x - 2, ), (y + 0, x - 2), (y + 0, x - 1), (y + 0, x + 1), (y + 0, x + 2), ( match Self::block_shape(y as usize, x as usize) { BlockShape::DeltaLike => y + 1, BlockShape::RevDeltaLike => y - 1, }, x + 2, ), (y + 1, x - 1), (y + 1, x + 0), (y + 1, x + 1), ] } fn is_index_in_range(board: &Board, y: isize, x: isize) -> bool { return y >= 0 && y < board.size.0 as isize && x >= 0 && x < board.size.1 as isize; } pub(crate) fn block_status(&self, y: usize, x: usize) -> BlockStatus { debug_assert!(y < self.size.0); debug_assert!(x < self.size.1); let idx = self.block_data_idx(y, x); self.blocks[idx].status } fn prepare_for_finish(&mut self) { for block in self.blocks.iter_mut() { match block.status { BlockStatus::Normal | BlockStatus::MarkedQuestionable => { block.status = BlockStatus::MarkedMine; self.mark_count += 1; } _ => {} } } } pub(crate) fn block_display_number(&self, y: usize, x: usize) -> Option<u8> { debug_assert!(y < self.size.0); debug_assert!(x < self.size.1); let idx = self.block_data_idx(y, x); if self.blocks[idx].has_mine { return None; } if self.blocks[idx].cached_number.get().is_none() { let mut number = 0_u8; for &(y, x) in &Self::surrounding_blocks(y as isize, x as isize) { if !Self::is_index_in_range(&self, y, x) { continue; } if self.block(y as usize, x as usize).has_mine { number += 1; } } self.blocks[idx].cached_number.set(Some(number)); return Some(number); } return self.blocks[idx].cached_number.get(); } pub(crate) fn blast_block(&mut self, y: usize, x: usize) { use std::collections::VecDeque; match self.status { BoardStatus::Finished(..) | BoardStatus::Died(..) => return, _ => {} }; match self.block_status(y, x) { BlockStatus::Open => {} _ => return, } let mut marked_number = 0; for &(y, x) in &Self::surrounding_blocks(y as isize, x as isize) { if !Self::is_index_in_range(&self, y, x) { continue; } if self.block(y as usize, x as usize).status == BlockStatus::MarkedMine { marked_number += 1; } } if self.block_display_number(y, x) != Some(marked_number) { return; } let mut queue = VecDeque::new(); for &(y, x) in &Self::surrounding_blocks(y as isize, x as isize) { if !Self::is_index_in_range(&self, y, x) { continue; } queue.push_back((y as usize, x as usize)); } let mut exploded = false; while let Some((y, x)) = queue.pop_front() { let n = self.block_display_number(y, x); if self.block(y, x).status != BlockStatus::Normal { continue; } self.block_mut(y, x).status = BlockStatus::Open; self.rest_count -= 1; if n == Some(0) { for &(y, x) in &Self::surrounding_blocks(y as isize, x as isize) { if !Self::is_index_in_range(&self, y, x) { continue; } queue.push_back((y as usize, x as usize)); } } else if n == None { exploded = true; } } if let BoardStatus::Going(start_time) = self.status { if self.rest_count == self.count { self.prepare_for_finish(); self.status = BoardStatus::Finished(start_time, Local::now()); } else if exploded { self.status = BoardStatus::Died(start_time, Local::now()); } } } pub(crate) fn open_block(&mut self, y: usize, x: usize) { debug_assert!(y < self.size.0); debug_assert!(x < self.size.1); if self.status == BoardStatus::Ready { self.start_game_with(y, x); self.status = BoardStatus::Going(Local::now()); } if let BoardStatus::Going(_) = self.status { match self.block_status(y, x) { BlockStatus::Normal | BlockStatus::MarkedQuestionable => {} _ => return, } if let Some(n) = self.block_display_number(y, x) { self.block_mut(y, x).status = BlockStatus::Open; self.rest_count -= 1; if let BoardStatus::Going(start_time) = self.status { if self.rest_count == self.count { self.prepare_for_finish(); self.status = BoardStatus::Finished(start_time, Local::now()); } } if n == 0 { self.blast_block(y, x); } } else { self.block_mut(y, x).status = BlockStatus::Open; if let BoardStatus::Going(start_time) = self.status { self.status = BoardStatus::Died(start_time, Local::now()); } else { unreachable!() } } } } pub(crate) fn set_allow_marks(&mut self, allow_marks: bool) { self.allow_marks = allow_marks; } pub(crate) fn rotate_block_state(&mut self, y: usize, x: usize) { let idx = self.block_data_idx(y, x); match self.status { BoardStatus::Finished(..) | BoardStatus::Died(..) => return, _ => {} }; match self.blocks[idx].status { BlockStatus::Normal => { self.blocks[idx].status = BlockStatus::MarkedMine; self.mark_count += 1; } BlockStatus::MarkedMine if self.allow_marks == true => { self.blocks[idx].status = BlockStatus::MarkedQuestionable; self.mark_count -= 1; } BlockStatus::MarkedMine if self.allow_marks == false => { self.blocks[idx].status = BlockStatus::Normal; self.mark_count -= 1; } BlockStatus::MarkedQuestionable => { self.blocks[idx].status = BlockStatus::Normal; } _ => {} } } pub(crate) fn block_display_kind( &self, pos: (usize, usize), focus: Option<(usize, usize, bool)>, ) -> BlockDisplayKind { let (y, x) = pos; let board_status = self.status(); let block_display_number = self.block_display_number(y, x); let block_status = self.block_status(y, x); let (pressed, blast, focus_pos) = focus .as_ref() .map(|(focus_y, focus_x, blast)| (true, *blast, Some((*focus_y, *focus_x)))) .unwrap_or((false, false, None)); match block_status { BlockStatus::Normal => match board_status { BoardStatus::Died(..) => { if block_display_number.is_none() { BlockDisplayKind::NotMarkedMine } else { BlockDisplayKind::Normal } } BoardStatus::Finished(..) => BlockDisplayKind::Normal, _ => { if pressed { if blast { if Self::is_surrounding((y, x), focus_pos.unwrap()) { BlockDisplayKind::PushNormal } else { BlockDisplayKind::Normal } } else { if Some((y, x)) == focus_pos { BlockDisplayKind::PushNormal } else { BlockDisplayKind::Normal } } } else { BlockDisplayKind::Normal } } }, BlockStatus::Open => { if let Some(n) = block_display_number { BlockDisplayKind::OpenWithNumber(n) } else { BlockDisplayKind::ExplodedMine } } BlockStatus::MarkedMine => match board_status { BoardStatus::Died(..) => { if let Some(_) = block_display_number { BlockDisplayKind::WrongMarkedMine } else { BlockDisplayKind::MarkedMine } } _ => BlockDisplayKind::MarkedMine, }, BlockStatus::MarkedQuestionable => match board_status { BoardStatus::Died(..) => { if block_display_number.is_none() { BlockDisplayKind::NotMarkedMine } else { BlockDisplayKind::MarkedQuestionable } } BoardStatus::Finished(..) => BlockDisplayKind::MarkedQuestionable, _ => { if pressed { if blast { if Self::is_surrounding((y, x), focus_pos.unwrap()) { BlockDisplayKind::PushMarkedQuestionable } else { BlockDisplayKind::MarkedQuestionable } } else { if Some((y, x)) == focus_pos { BlockDisplayKind::PushMarkedQuestionable } else { BlockDisplayKind::MarkedQuestionable } } } else { BlockDisplayKind::MarkedQuestionable } } }, } } pub(crate) fn game_button_display_kind( &self, pressed: bool, captured: bool, ) -> GameButtonDisplayKind { if pressed { GameButtonDisplayKind::Pushed } else { match self.status { BoardStatus::Finished(..) => GameButtonDisplayKind::Finished, BoardStatus::Died(..) => GameButtonDisplayKind::Died, _ => { if captured { GameButtonDisplayKind::Danger } else { GameButtonDisplayKind::Normal } } } } } } pub struct Model { config: Config, game_mode: GameMode, board: Board, } impl Model { pub fn new() -> Model { let config = Config::new(); let game_mode = GameMode::Normal; let board = { let board_setting = &config.board_setting; let mut board = Board::new(board_setting.y, board_setting.x, board_setting.c); let allow_marks = &config.allow_marks; board.allow_marks = allow_marks.0; board }; Model { config, board, game_mode, } } pub fn config(&self) -> &Config { &self.config } pub fn game_mode(&self) -> GameMode { self.game_mode.clone() } } #[derive(Clone, Debug)] pub enum ModelCommand { Initialize, NewGame, NewGameWithBoard(model_config::BoardSetting), OpenBlock(usize, usize), BlastBlock(usize, usize), RotateBlockState(usize, usize), ToggleAllowMarks, UpdateZoomRatio(model_config::ZoomRatio), SaveMap(PathBuf), LoadMap(PathBuf), RestartGame, EffectNewGameButtonDown, EffectNewGameButtonUp, EffectPushBlock { x: usize, y: usize }, EffectPopBlock { x: usize, y: usize }, EffectBlastDownBlock { x: usize, y: usize }, EffectBlastUpBlock { x: usize, y: usize }, EffectCapture, EffectUnCapture, } impl ops::Deref for Model { type Target = Board; fn deref(&self) -> &Board { &self.board } } impl ops::DerefMut for Model { fn deref_mut(&mut self) -> &mut Board { &mut self.board } } type ModelToken<'a> = ::domino::mvc::ModelToken<'a, Model, view::View, controller::Controller>; impl ::domino::mvc::Model<view::View, controller::Controller> for Model { type Command = ModelCommand; type Notification = view::ViewCommand; fn process_command(mut token: ModelToken, command: ModelCommand) { match command { ModelCommand::Initialize => { token.update_view_next(ViewCommand::Initialize); } ModelCommand::NewGameWithBoard(v) => { { let model = token.model_mut(); model.board = Board::new(v.y, v.x, v.c); } token.update_view_next(ViewCommand::UpdateUIBoardSetting(v.clone())); } ModelCommand::NewGame => { let model = token.model_mut(); let size = model.board.size(); let count = model.board.goal_mark_count(); model.board = Board::new(size.0, size.1, count); } ModelCommand::LoadMap(path) => { let new_gamemode; { let board_saved = if let Some(board_saved) = BoardSaved::import_from_file(&path) { board_saved } else { token .update_view_next(ViewCommand::AlertFailure(AlertFailure::FileIOError)); return; }; let model = token.model_mut(); model.board = Board::new( board_saved.board_size.0, board_saved.board_size.1, board_saved.mine_pos.len(), ); model.fixed_mine_pos = Some(board_saved.mine_pos.clone()); model.game_mode = GameMode::BoardPredefined(board_saved); new_gamemode = model.game_mode(); } token.update_view_next(ViewCommand::UpdateUIGameMode(new_gamemode)); } ModelCommand::SaveMap(path) => { let new_gamemode; { if !token.model_mut().game_mode.is_predefined() { let model = token.model_mut(); let board_saved = BoardSaved::import_from_board(&mut model.board); model.game_mode = GameMode::BoardPredefined(board_saved); } new_gamemode = token.model_mut().game_mode(); if !new_gamemode .board_saved() .unwrap() .export_to_file(&path) .is_err() { token .update_view_next(ViewCommand::AlertFailure(AlertFailure::FileIOError)); } } token.update_view_next(ViewCommand::UpdateUIGameMode(new_gamemode)); } ModelCommand::RestartGame => { let new_gamemode; { let model = token.model_mut(); if !model.game_mode.is_predefined() { let board_saved = BoardSaved::import_from_board(&mut model.board); model.game_mode = GameMode::BoardPredefined(board_saved); } new_gamemode = model.game_mode(); model.board = model.board.renew(); } token.update_view_next(ViewCommand::UpdateUIGameMode(new_gamemode)); } ModelCommand::OpenBlock(y, x) => { let model = token.model_mut(); model.open_block(y, x); } ModelCommand::BlastBlock(y, x) => { let model = token.model_mut(); model.blast_block(y, x); } ModelCommand::RotateBlockState(y, x) => { let model = token.model_mut(); model.rotate_block_state(y, x); } ModelCommand::ToggleAllowMarks => { let new_state; { let model = token.model_mut(); new_state = !model.config.allow_marks.0; model.board.set_allow_marks(new_state); model.config.allow_marks = model_config::AllowMarks(new_state); } token.update_view_next(ViewCommand::UpdateUIAllowMarks(model_config::AllowMarks( new_state, ))); } ModelCommand::UpdateZoomRatio(r) => { { let model = token.model_mut(); model.config.zoom_ratio = r; } token.update_view_next(ViewCommand::UpdateZoomRatio(r)); token.update_view_next(ViewCommand::UpdateUIZoomRatio(r)); } ModelCommand::EffectNewGameButtonDown => { token.update_view_next(ViewCommand::SetButtonPressed(true)); } ModelCommand::EffectNewGameButtonUp => { token.update_view_next(ViewCommand::SetButtonPressed(false)); } ModelCommand::EffectPushBlock { y, x } => { token.update_view_next(ViewCommand::SetBlockPressed(y, x, false)); } ModelCommand::EffectPopBlock { y, x } => { token.update_view_next(ViewCommand::UnsetBlockPressed(y, x, false)); } ModelCommand::EffectBlastDownBlock { y, x } => { token.update_view_next(ViewCommand::SetBlockPressed(y, x, true)); } ModelCommand::EffectBlastUpBlock { y, x } => { token.update_view_next(ViewCommand::UnsetBlockPressed(y, x, true)); } ModelCommand::EffectCapture => { token.update_view_next(ViewCommand::SetCapture); } ModelCommand::EffectUnCapture => { token.update_view_next(ViewCommand::ReleaseCapture); } } token.update_view_next(ViewCommand::Refresh); } fn translate_controller_notification( controller_notification: ModelCommand, ) -> Option<Self::Command> { Some(controller_notification) } }
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] pub const ADMINDATA_MAX_NAME_LEN: u32 = 256u32; pub const APPCTR_MD_ID_BEGIN_RESERVED: u32 = 57344u32; pub const APPCTR_MD_ID_END_RESERVED: u32 = 61439u32; pub const APPSTATUS_NOTDEFINED: u32 = 2u32; pub const APPSTATUS_RUNNING: u32 = 1u32; pub const APPSTATUS_STOPPED: u32 = 0u32; pub const ASP_MD_ID_BEGIN_RESERVED: u32 = 28672u32; pub const ASP_MD_ID_END_RESERVED: u32 = 29951u32; pub const ASP_MD_SERVER_BASE: u32 = 7000u32; pub const ASP_MD_UT_APP: u32 = 101u32; #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AsyncIFtpAuthenticationProvider(pub ::windows::core::IUnknown); impl AsyncIFtpAuthenticationProvider { #[cfg(feature = "Win32_Foundation")] pub unsafe fn Begin_AuthenticateUser<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszsessionid: Param0, pszsitename: Param1, pszusername: Param2, pszpassword: Param3) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pszsessionid.into_param().abi(), pszsitename.into_param().abi(), pszusername.into_param().abi(), pszpassword.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Finish_AuthenticateUser(&self, ppszcanonicalusername: *mut super::super::Foundation::PWSTR, pfauthenticated: *mut super::super::Foundation::BOOL) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(ppszcanonicalusername), ::core::mem::transmute(pfauthenticated)).ok() } } unsafe impl ::windows::core::Interface for AsyncIFtpAuthenticationProvider { type Vtable = AsyncIFtpAuthenticationProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc24efb65_9f3e_4996_8fb1_ce166916bab5); } impl ::core::convert::From<AsyncIFtpAuthenticationProvider> for ::windows::core::IUnknown { fn from(value: AsyncIFtpAuthenticationProvider) -> Self { value.0 } } impl ::core::convert::From<&AsyncIFtpAuthenticationProvider> for ::windows::core::IUnknown { fn from(value: &AsyncIFtpAuthenticationProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AsyncIFtpAuthenticationProvider { 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 AsyncIFtpAuthenticationProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct AsyncIFtpAuthenticationProvider_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, pszsessionid: super::super::Foundation::PWSTR, pszsitename: super::super::Foundation::PWSTR, pszusername: super::super::Foundation::PWSTR, pszpassword: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppszcanonicalusername: *mut super::super::Foundation::PWSTR, pfauthenticated: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AsyncIFtpAuthorizationProvider(pub ::windows::core::IUnknown); impl AsyncIFtpAuthorizationProvider { #[cfg(feature = "Win32_Foundation")] pub unsafe fn Begin_GetUserAccessPermission<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszsessionid: Param0, pszsitename: Param1, pszvirtualpath: Param2, pszusername: Param3) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pszsessionid.into_param().abi(), pszsitename.into_param().abi(), pszvirtualpath.into_param().abi(), pszusername.into_param().abi()).ok() } pub unsafe fn Finish_GetUserAccessPermission(&self) -> ::windows::core::Result<FTP_ACCESS> { let mut result__: <FTP_ACCESS as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<FTP_ACCESS>(result__) } } unsafe impl ::windows::core::Interface for AsyncIFtpAuthorizationProvider { type Vtable = AsyncIFtpAuthorizationProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x860dc339_07e5_4a5c_9c61_8820cea012bc); } impl ::core::convert::From<AsyncIFtpAuthorizationProvider> for ::windows::core::IUnknown { fn from(value: AsyncIFtpAuthorizationProvider) -> Self { value.0 } } impl ::core::convert::From<&AsyncIFtpAuthorizationProvider> for ::windows::core::IUnknown { fn from(value: &AsyncIFtpAuthorizationProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AsyncIFtpAuthorizationProvider { 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 AsyncIFtpAuthorizationProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct AsyncIFtpAuthorizationProvider_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, pszsessionid: super::super::Foundation::PWSTR, pszsitename: super::super::Foundation::PWSTR, pszvirtualpath: super::super::Foundation::PWSTR, pszusername: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pftpaccess: *mut FTP_ACCESS) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AsyncIFtpHomeDirectoryProvider(pub ::windows::core::IUnknown); impl AsyncIFtpHomeDirectoryProvider { #[cfg(feature = "Win32_Foundation")] pub unsafe fn Begin_GetUserHomeDirectoryData<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszsessionid: Param0, pszsitename: Param1, pszusername: Param2) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pszsessionid.into_param().abi(), pszsitename.into_param().abi(), pszusername.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Finish_GetUserHomeDirectoryData(&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__) } } unsafe impl ::windows::core::Interface for AsyncIFtpHomeDirectoryProvider { type Vtable = AsyncIFtpHomeDirectoryProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x73f81638_6295_42bd_a2be_4a657f7c479c); } impl ::core::convert::From<AsyncIFtpHomeDirectoryProvider> for ::windows::core::IUnknown { fn from(value: AsyncIFtpHomeDirectoryProvider) -> Self { value.0 } } impl ::core::convert::From<&AsyncIFtpHomeDirectoryProvider> for ::windows::core::IUnknown { fn from(value: &AsyncIFtpHomeDirectoryProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AsyncIFtpHomeDirectoryProvider { 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 AsyncIFtpHomeDirectoryProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct AsyncIFtpHomeDirectoryProvider_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, pszsessionid: super::super::Foundation::PWSTR, pszsitename: super::super::Foundation::PWSTR, pszusername: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, ppszhomedirectorydata: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AsyncIFtpLogProvider(pub ::windows::core::IUnknown); impl AsyncIFtpLogProvider { #[cfg(feature = "Win32_Foundation")] pub unsafe fn Begin_Log(&self, ploggingparameters: *const LOGGING_PARAMETERS) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(ploggingparameters)).ok() } pub unsafe fn Finish_Log(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok() } } unsafe impl ::windows::core::Interface for AsyncIFtpLogProvider { type Vtable = AsyncIFtpLogProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x00a0ae46_2498_48b2_95e6_df678ed7d49f); } impl ::core::convert::From<AsyncIFtpLogProvider> for ::windows::core::IUnknown { fn from(value: AsyncIFtpLogProvider) -> Self { value.0 } } impl ::core::convert::From<&AsyncIFtpLogProvider> for ::windows::core::IUnknown { fn from(value: &AsyncIFtpLogProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AsyncIFtpLogProvider { 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 AsyncIFtpLogProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct AsyncIFtpLogProvider_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, ploggingparameters: *const LOGGING_PARAMETERS) -> ::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 AsyncIFtpPostprocessProvider(pub ::windows::core::IUnknown); impl AsyncIFtpPostprocessProvider { #[cfg(feature = "Win32_Foundation")] pub unsafe fn Begin_HandlePostprocess(&self, ppostprocessparameters: *const POST_PROCESS_PARAMETERS) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(ppostprocessparameters)).ok() } pub unsafe fn Finish_HandlePostprocess(&self) -> ::windows::core::Result<FTP_PROCESS_STATUS> { let mut result__: <FTP_PROCESS_STATUS as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<FTP_PROCESS_STATUS>(result__) } } unsafe impl ::windows::core::Interface for AsyncIFtpPostprocessProvider { type Vtable = AsyncIFtpPostprocessProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa16b2542_9694_4eb1_a564_6c2e91fdc133); } impl ::core::convert::From<AsyncIFtpPostprocessProvider> for ::windows::core::IUnknown { fn from(value: AsyncIFtpPostprocessProvider) -> Self { value.0 } } impl ::core::convert::From<&AsyncIFtpPostprocessProvider> for ::windows::core::IUnknown { fn from(value: &AsyncIFtpPostprocessProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AsyncIFtpPostprocessProvider { 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 AsyncIFtpPostprocessProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct AsyncIFtpPostprocessProvider_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, ppostprocessparameters: *const POST_PROCESS_PARAMETERS) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pftpprocessstatus: *mut FTP_PROCESS_STATUS) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AsyncIFtpPreprocessProvider(pub ::windows::core::IUnknown); impl AsyncIFtpPreprocessProvider { #[cfg(feature = "Win32_Foundation")] pub unsafe fn Begin_HandlePreprocess(&self, ppreprocessparameters: *const PRE_PROCESS_PARAMETERS) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(ppreprocessparameters)).ok() } pub unsafe fn Finish_HandlePreprocess(&self) -> ::windows::core::Result<FTP_PROCESS_STATUS> { let mut result__: <FTP_PROCESS_STATUS as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), &mut result__).from_abi::<FTP_PROCESS_STATUS>(result__) } } unsafe impl ::windows::core::Interface for AsyncIFtpPreprocessProvider { type Vtable = AsyncIFtpPreprocessProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6ff5fd8f_fd8e_48b1_a3e0_bf7073db4db5); } impl ::core::convert::From<AsyncIFtpPreprocessProvider> for ::windows::core::IUnknown { fn from(value: AsyncIFtpPreprocessProvider) -> Self { value.0 } } impl ::core::convert::From<&AsyncIFtpPreprocessProvider> for ::windows::core::IUnknown { fn from(value: &AsyncIFtpPreprocessProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AsyncIFtpPreprocessProvider { 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 AsyncIFtpPreprocessProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct AsyncIFtpPreprocessProvider_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, ppreprocessparameters: *const PRE_PROCESS_PARAMETERS) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pftpprocessstatus: *mut FTP_PROCESS_STATUS) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AsyncIFtpRoleProvider(pub ::windows::core::IUnknown); impl AsyncIFtpRoleProvider { #[cfg(feature = "Win32_Foundation")] pub unsafe fn Begin_IsUserInRole<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszsessionid: Param0, pszsitename: Param1, pszusername: Param2, pszrole: Param3) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pszsessionid.into_param().abi(), pszsitename.into_param().abi(), pszusername.into_param().abi(), pszrole.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Finish_IsUserInRole(&self) -> ::windows::core::Result<super::super::Foundation::BOOL> { let mut result__: <super::super::Foundation::BOOL 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::BOOL>(result__) } } unsafe impl ::windows::core::Interface for AsyncIFtpRoleProvider { type Vtable = AsyncIFtpRoleProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3e83bf99_70ec_41ca_84b6_aca7c7a62caf); } impl ::core::convert::From<AsyncIFtpRoleProvider> for ::windows::core::IUnknown { fn from(value: AsyncIFtpRoleProvider) -> Self { value.0 } } impl ::core::convert::From<&AsyncIFtpRoleProvider> for ::windows::core::IUnknown { fn from(value: &AsyncIFtpRoleProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AsyncIFtpRoleProvider { 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 AsyncIFtpRoleProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct AsyncIFtpRoleProvider_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, pszsessionid: super::super::Foundation::PWSTR, pszsitename: super::super::Foundation::PWSTR, pszusername: super::super::Foundation::PWSTR, pszrole: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pfisinrole: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AsyncIMSAdminBaseSinkW(pub ::windows::core::IUnknown); impl AsyncIMSAdminBaseSinkW { #[cfg(feature = "Win32_Foundation")] pub unsafe fn Begin_SinkNotify(&self, dwmdnumelements: u32, pcochangelist: *const MD_CHANGE_OBJECT_W) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwmdnumelements), ::core::mem::transmute(pcochangelist)).ok() } pub unsafe fn Finish_SinkNotify(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Begin_ShutdownNotify(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn Finish_ShutdownNotify(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self)).ok() } } unsafe impl ::windows::core::Interface for AsyncIMSAdminBaseSinkW { type Vtable = AsyncIMSAdminBaseSinkW_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa9e69613_b80d_11d0_b9b9_00a0c922e750); } impl ::core::convert::From<AsyncIMSAdminBaseSinkW> for ::windows::core::IUnknown { fn from(value: AsyncIMSAdminBaseSinkW) -> Self { value.0 } } impl ::core::convert::From<&AsyncIMSAdminBaseSinkW> for ::windows::core::IUnknown { fn from(value: &AsyncIMSAdminBaseSinkW) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AsyncIMSAdminBaseSinkW { 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 AsyncIMSAdminBaseSinkW { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct AsyncIMSAdminBaseSinkW_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, dwmdnumelements: u32, pcochangelist: *const MD_CHANGE_OBJECT_W) -> ::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) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Security_Cryptography"))] pub struct CERT_CONTEXT_EX { pub CertContext: super::super::Security::Cryptography::CERT_CONTEXT, pub cbAllocated: u32, pub dwCertificateFlags: u32, } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Security_Cryptography"))] impl CERT_CONTEXT_EX {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Security_Cryptography"))] impl ::core::default::Default for CERT_CONTEXT_EX { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Security_Cryptography"))] impl ::core::fmt::Debug for CERT_CONTEXT_EX { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("CERT_CONTEXT_EX").field("CertContext", &self.CertContext).field("cbAllocated", &self.cbAllocated).field("dwCertificateFlags", &self.dwCertificateFlags).finish() } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Security_Cryptography"))] impl ::core::cmp::PartialEq for CERT_CONTEXT_EX { fn eq(&self, other: &Self) -> bool { self.CertContext == other.CertContext && self.cbAllocated == other.cbAllocated && self.dwCertificateFlags == other.dwCertificateFlags } } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Security_Cryptography"))] impl ::core::cmp::Eq for CERT_CONTEXT_EX {} #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Security_Cryptography"))] unsafe impl ::windows::core::Abi for CERT_CONTEXT_EX { type Abi = Self; } pub const CLSID_IImgCtx: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3050f3d6_98b5_11cf_bb82_00aa00bdce0b); pub const CLSID_IisServiceControl: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe8fb8621_588f_11d2_9d61_00c04f79c5fe); pub const CLSID_MSAdminBase_W: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa9e69610_b80d_11d0_b9b9_00a0c922e750); pub const CLSID_Request: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x920c25d0_25d9_11d0_a55f_00a0c90c2091); pub const CLSID_Response: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x46e19ba0_25dd_11d0_a55f_00a0c90c2091); pub const CLSID_ScriptingContext: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd97a6da0_a868_11cf_83ae_11b0c90c2bd8); pub const CLSID_Server: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa506d160_25e0_11d0_a55f_00a0c90c2091); pub const CLSID_Session: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x509f8f20_25de_11d0_a55f_00a0c90c2091); pub const CLSID_WamAdmin: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x61738644_f196_11d0_9953_00c04fd919c1); #[derive(:: core :: clone :: Clone)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct CONFIGURATION_ENTRY { pub bstrKey: super::super::Foundation::BSTR, pub bstrValue: super::super::Foundation::BSTR, } #[cfg(feature = "Win32_Foundation")] impl CONFIGURATION_ENTRY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for CONFIGURATION_ENTRY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for CONFIGURATION_ENTRY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("CONFIGURATION_ENTRY").field("bstrKey", &self.bstrKey).field("bstrValue", &self.bstrValue).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for CONFIGURATION_ENTRY { fn eq(&self, other: &Self) -> bool { self.bstrKey == other.bstrKey && self.bstrValue == other.bstrValue } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for CONFIGURATION_ENTRY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for CONFIGURATION_ENTRY { type Abi = ::core::mem::ManuallyDrop<Self>; } pub const DISPID_HTTPREQUEST_ABORT: u32 = 12u32; pub const DISPID_HTTPREQUEST_BASE: u32 = 1u32; pub const DISPID_HTTPREQUEST_GETALLRESPONSEHEADERS: u32 = 4u32; pub const DISPID_HTTPREQUEST_GETRESPONSEHEADER: u32 = 3u32; pub const DISPID_HTTPREQUEST_OPEN: u32 = 1u32; pub const DISPID_HTTPREQUEST_OPTION: u32 = 6u32; pub const DISPID_HTTPREQUEST_RESPONSEBODY: u32 = 10u32; pub const DISPID_HTTPREQUEST_RESPONSESTREAM: u32 = 11u32; pub const DISPID_HTTPREQUEST_RESPONSETEXT: u32 = 9u32; pub const DISPID_HTTPREQUEST_SEND: u32 = 5u32; pub const DISPID_HTTPREQUEST_SETAUTOLOGONPOLICY: u32 = 18u32; pub const DISPID_HTTPREQUEST_SETCLIENTCERTIFICATE: u32 = 17u32; pub const DISPID_HTTPREQUEST_SETCREDENTIALS: u32 = 14u32; pub const DISPID_HTTPREQUEST_SETPROXY: u32 = 13u32; pub const DISPID_HTTPREQUEST_SETREQUESTHEADER: u32 = 2u32; pub const DISPID_HTTPREQUEST_SETTIMEOUTS: u32 = 16u32; pub const DISPID_HTTPREQUEST_STATUS: u32 = 7u32; pub const DISPID_HTTPREQUEST_STATUSTEXT: u32 = 8u32; pub const DISPID_HTTPREQUEST_WAITFORRESPONSE: u32 = 15u32; pub const DWN_COLORMODE: u32 = 63u32; pub const DWN_DOWNLOADONLY: u32 = 64u32; pub const DWN_FORCEDITHER: u32 = 128u32; pub const DWN_MIRRORIMAGE: u32 = 512u32; pub const DWN_RAWIMAGE: u32 = 256u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct EXTENSION_CONTROL_BLOCK { pub cbSize: u32, pub dwVersion: u32, pub ConnID: *mut ::core::ffi::c_void, pub dwHttpStatusCode: u32, pub lpszLogData: [super::super::Foundation::CHAR; 80], pub lpszMethod: super::super::Foundation::PSTR, pub lpszQueryString: super::super::Foundation::PSTR, pub lpszPathInfo: super::super::Foundation::PSTR, pub lpszPathTranslated: super::super::Foundation::PSTR, pub cbTotalBytes: u32, pub cbAvailable: u32, pub lpbData: *mut u8, pub lpszContentType: super::super::Foundation::PSTR, pub GetServerVariable: isize, pub WriteClient: isize, pub ReadClient: isize, pub ServerSupportFunction: isize, } #[cfg(feature = "Win32_Foundation")] impl EXTENSION_CONTROL_BLOCK {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for EXTENSION_CONTROL_BLOCK { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for EXTENSION_CONTROL_BLOCK { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("EXTENSION_CONTROL_BLOCK") .field("cbSize", &self.cbSize) .field("dwVersion", &self.dwVersion) .field("ConnID", &self.ConnID) .field("dwHttpStatusCode", &self.dwHttpStatusCode) .field("lpszLogData", &self.lpszLogData) .field("lpszMethod", &self.lpszMethod) .field("lpszQueryString", &self.lpszQueryString) .field("lpszPathInfo", &self.lpszPathInfo) .field("lpszPathTranslated", &self.lpszPathTranslated) .field("cbTotalBytes", &self.cbTotalBytes) .field("cbAvailable", &self.cbAvailable) .field("lpbData", &self.lpbData) .field("lpszContentType", &self.lpszContentType) .field("GetServerVariable", &self.GetServerVariable) .field("WriteClient", &self.WriteClient) .field("ReadClient", &self.ReadClient) .field("ServerSupportFunction", &self.ServerSupportFunction) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for EXTENSION_CONTROL_BLOCK { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.dwVersion == other.dwVersion && self.ConnID == other.ConnID && self.dwHttpStatusCode == other.dwHttpStatusCode && self.lpszLogData == other.lpszLogData && self.lpszMethod == other.lpszMethod && self.lpszQueryString == other.lpszQueryString && self.lpszPathInfo == other.lpszPathInfo && self.lpszPathTranslated == other.lpszPathTranslated && self.cbTotalBytes == other.cbTotalBytes && self.cbAvailable == other.cbAvailable && self.lpbData == other.lpbData && self.lpszContentType == other.lpszContentType && self.GetServerVariable == other.GetServerVariable && self.WriteClient == other.WriteClient && self.ReadClient == other.ReadClient && self.ServerSupportFunction == other.ServerSupportFunction } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for EXTENSION_CONTROL_BLOCK {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for EXTENSION_CONTROL_BLOCK { type Abi = Self; } pub const FP_MD_ID_BEGIN_RESERVED: u32 = 32768u32; pub const FP_MD_ID_END_RESERVED: u32 = 36863u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct FTP_ACCESS(pub i32); pub const FTP_ACCESS_NONE: FTP_ACCESS = FTP_ACCESS(0i32); pub const FTP_ACCESS_READ: FTP_ACCESS = FTP_ACCESS(1i32); pub const FTP_ACCESS_WRITE: FTP_ACCESS = FTP_ACCESS(2i32); pub const FTP_ACCESS_READ_WRITE: FTP_ACCESS = FTP_ACCESS(3i32); impl ::core::convert::From<i32> for FTP_ACCESS { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for FTP_ACCESS { 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 FTP_PROCESS_STATUS(pub i32); pub const FTP_PROCESS_CONTINUE: FTP_PROCESS_STATUS = FTP_PROCESS_STATUS(0i32); pub const FTP_PROCESS_CLOSE_SESSION: FTP_PROCESS_STATUS = FTP_PROCESS_STATUS(1i32); pub const FTP_PROCESS_TERMINATE_SESSION: FTP_PROCESS_STATUS = FTP_PROCESS_STATUS(2i32); pub const FTP_PROCESS_REJECT_COMMAND: FTP_PROCESS_STATUS = FTP_PROCESS_STATUS(3i32); impl ::core::convert::From<i32> for FTP_PROCESS_STATUS { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for FTP_PROCESS_STATUS { type Abi = Self; } pub const FtpProvider: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x70bdc667_33b2_45f0_ac52_c3ca46f7a656); pub const GUID_IIS_ALL_TRACE_PROVIDERS: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x00000000_0000_0000_0000_000000000000); pub const GUID_IIS_ASPNET_TRACE_PROVIDER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xaff081fe_0247_4275_9c4e_021f3dc1da35); pub const GUID_IIS_ASP_TRACE_TRACE_PROVIDER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x06b94d9a_b15e_456e_a4ef_37c984a2cb4b); pub const GUID_IIS_ISAPI_TRACE_PROVIDER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa1c2040e_8840_4c31_ba11_9871031a19ea); pub const GUID_IIS_WWW_GLOBAL_TRACE_PROVIDER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd55d3bc9_cba9_44df_827e_132d3a4596c2); pub const GUID_IIS_WWW_SERVER_TRACE_PROVIDER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3a2a4e84_4c21_4981_ae10_3fda0d9b0f83); pub const GUID_IIS_WWW_SERVER_V2_TRACE_PROVIDER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xde4649c9_15e8_4fea_9d85_1cdda520c334); #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetExtensionVersion(pver: *mut HSE_VERSION_INFO) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetExtensionVersion(pver: *mut HSE_VERSION_INFO) -> super::super::Foundation::BOOL; } ::core::mem::transmute(GetExtensionVersion(::core::mem::transmute(pver))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetFilterVersion(pver: *mut HTTP_FILTER_VERSION) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetFilterVersion(pver: *mut HTTP_FILTER_VERSION) -> super::super::Foundation::BOOL; } ::core::mem::transmute(GetFilterVersion(::core::mem::transmute(pver))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const HSE_APPEND_LOG_PARAMETER: u32 = 1003u32; pub const HSE_APP_FLAG_IN_PROCESS: u32 = 0u32; pub const HSE_APP_FLAG_ISOLATED_OOP: u32 = 1u32; pub const HSE_APP_FLAG_POOLED_OOP: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HSE_CUSTOM_ERROR_INFO { pub pszStatus: super::super::Foundation::PSTR, pub uHttpSubError: u16, pub fAsync: super::super::Foundation::BOOL, } #[cfg(feature = "Win32_Foundation")] impl HSE_CUSTOM_ERROR_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HSE_CUSTOM_ERROR_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HSE_CUSTOM_ERROR_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HSE_CUSTOM_ERROR_INFO").field("pszStatus", &self.pszStatus).field("uHttpSubError", &self.uHttpSubError).field("fAsync", &self.fAsync).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HSE_CUSTOM_ERROR_INFO { fn eq(&self, other: &Self) -> bool { self.pszStatus == other.pszStatus && self.uHttpSubError == other.uHttpSubError && self.fAsync == other.fAsync } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HSE_CUSTOM_ERROR_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HSE_CUSTOM_ERROR_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HSE_EXEC_UNICODE_URL_INFO { pub pszUrl: super::super::Foundation::PWSTR, pub pszMethod: super::super::Foundation::PSTR, pub pszChildHeaders: super::super::Foundation::PSTR, pub pUserInfo: *mut HSE_EXEC_UNICODE_URL_USER_INFO, pub pEntity: *mut HSE_EXEC_URL_ENTITY_INFO, pub dwExecUrlFlags: u32, } #[cfg(feature = "Win32_Foundation")] impl HSE_EXEC_UNICODE_URL_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HSE_EXEC_UNICODE_URL_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HSE_EXEC_UNICODE_URL_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HSE_EXEC_UNICODE_URL_INFO").field("pszUrl", &self.pszUrl).field("pszMethod", &self.pszMethod).field("pszChildHeaders", &self.pszChildHeaders).field("pUserInfo", &self.pUserInfo).field("pEntity", &self.pEntity).field("dwExecUrlFlags", &self.dwExecUrlFlags).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HSE_EXEC_UNICODE_URL_INFO { fn eq(&self, other: &Self) -> bool { self.pszUrl == other.pszUrl && self.pszMethod == other.pszMethod && self.pszChildHeaders == other.pszChildHeaders && self.pUserInfo == other.pUserInfo && self.pEntity == other.pEntity && self.dwExecUrlFlags == other.dwExecUrlFlags } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HSE_EXEC_UNICODE_URL_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HSE_EXEC_UNICODE_URL_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HSE_EXEC_UNICODE_URL_USER_INFO { pub hImpersonationToken: super::super::Foundation::HANDLE, pub pszCustomUserName: super::super::Foundation::PWSTR, pub pszCustomAuthType: super::super::Foundation::PSTR, } #[cfg(feature = "Win32_Foundation")] impl HSE_EXEC_UNICODE_URL_USER_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HSE_EXEC_UNICODE_URL_USER_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HSE_EXEC_UNICODE_URL_USER_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HSE_EXEC_UNICODE_URL_USER_INFO").field("hImpersonationToken", &self.hImpersonationToken).field("pszCustomUserName", &self.pszCustomUserName).field("pszCustomAuthType", &self.pszCustomAuthType).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HSE_EXEC_UNICODE_URL_USER_INFO { fn eq(&self, other: &Self) -> bool { self.hImpersonationToken == other.hImpersonationToken && self.pszCustomUserName == other.pszCustomUserName && self.pszCustomAuthType == other.pszCustomAuthType } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HSE_EXEC_UNICODE_URL_USER_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HSE_EXEC_UNICODE_URL_USER_INFO { type Abi = Self; } pub const HSE_EXEC_URL_DISABLE_CUSTOM_ERROR: u32 = 32u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct HSE_EXEC_URL_ENTITY_INFO { pub cbAvailable: u32, pub lpbData: *mut ::core::ffi::c_void, } impl HSE_EXEC_URL_ENTITY_INFO {} impl ::core::default::Default for HSE_EXEC_URL_ENTITY_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for HSE_EXEC_URL_ENTITY_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HSE_EXEC_URL_ENTITY_INFO").field("cbAvailable", &self.cbAvailable).field("lpbData", &self.lpbData).finish() } } impl ::core::cmp::PartialEq for HSE_EXEC_URL_ENTITY_INFO { fn eq(&self, other: &Self) -> bool { self.cbAvailable == other.cbAvailable && self.lpbData == other.lpbData } } impl ::core::cmp::Eq for HSE_EXEC_URL_ENTITY_INFO {} unsafe impl ::windows::core::Abi for HSE_EXEC_URL_ENTITY_INFO { type Abi = Self; } pub const HSE_EXEC_URL_HTTP_CACHE_ELIGIBLE: u32 = 128u32; pub const HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR: u32 = 4u32; pub const HSE_EXEC_URL_IGNORE_VALIDATION_AND_RANGE: u32 = 16u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HSE_EXEC_URL_INFO { pub pszUrl: super::super::Foundation::PSTR, pub pszMethod: super::super::Foundation::PSTR, pub pszChildHeaders: super::super::Foundation::PSTR, pub pUserInfo: *mut HSE_EXEC_URL_USER_INFO, pub pEntity: *mut HSE_EXEC_URL_ENTITY_INFO, pub dwExecUrlFlags: u32, } #[cfg(feature = "Win32_Foundation")] impl HSE_EXEC_URL_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HSE_EXEC_URL_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HSE_EXEC_URL_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HSE_EXEC_URL_INFO").field("pszUrl", &self.pszUrl).field("pszMethod", &self.pszMethod).field("pszChildHeaders", &self.pszChildHeaders).field("pUserInfo", &self.pUserInfo).field("pEntity", &self.pEntity).field("dwExecUrlFlags", &self.dwExecUrlFlags).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HSE_EXEC_URL_INFO { fn eq(&self, other: &Self) -> bool { self.pszUrl == other.pszUrl && self.pszMethod == other.pszMethod && self.pszChildHeaders == other.pszChildHeaders && self.pUserInfo == other.pUserInfo && self.pEntity == other.pEntity && self.dwExecUrlFlags == other.dwExecUrlFlags } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HSE_EXEC_URL_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HSE_EXEC_URL_INFO { type Abi = Self; } pub const HSE_EXEC_URL_NO_HEADERS: u32 = 2u32; pub const HSE_EXEC_URL_SSI_CMD: u32 = 64u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct HSE_EXEC_URL_STATUS { pub uHttpStatusCode: u16, pub uHttpSubStatus: u16, pub dwWin32Error: u32, } impl HSE_EXEC_URL_STATUS {} impl ::core::default::Default for HSE_EXEC_URL_STATUS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for HSE_EXEC_URL_STATUS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HSE_EXEC_URL_STATUS").field("uHttpStatusCode", &self.uHttpStatusCode).field("uHttpSubStatus", &self.uHttpSubStatus).field("dwWin32Error", &self.dwWin32Error).finish() } } impl ::core::cmp::PartialEq for HSE_EXEC_URL_STATUS { fn eq(&self, other: &Self) -> bool { self.uHttpStatusCode == other.uHttpStatusCode && self.uHttpSubStatus == other.uHttpSubStatus && self.dwWin32Error == other.dwWin32Error } } impl ::core::cmp::Eq for HSE_EXEC_URL_STATUS {} unsafe impl ::windows::core::Abi for HSE_EXEC_URL_STATUS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HSE_EXEC_URL_USER_INFO { pub hImpersonationToken: super::super::Foundation::HANDLE, pub pszCustomUserName: super::super::Foundation::PSTR, pub pszCustomAuthType: super::super::Foundation::PSTR, } #[cfg(feature = "Win32_Foundation")] impl HSE_EXEC_URL_USER_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HSE_EXEC_URL_USER_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HSE_EXEC_URL_USER_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HSE_EXEC_URL_USER_INFO").field("hImpersonationToken", &self.hImpersonationToken).field("pszCustomUserName", &self.pszCustomUserName).field("pszCustomAuthType", &self.pszCustomAuthType).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HSE_EXEC_URL_USER_INFO { fn eq(&self, other: &Self) -> bool { self.hImpersonationToken == other.hImpersonationToken && self.pszCustomUserName == other.pszCustomUserName && self.pszCustomAuthType == other.pszCustomAuthType } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HSE_EXEC_URL_USER_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HSE_EXEC_URL_USER_INFO { type Abi = Self; } pub const HSE_LOG_BUFFER_LEN: u32 = 80u32; pub const HSE_MAX_EXT_DLL_NAME_LEN: u32 = 256u32; pub const HSE_REQ_ABORTIVE_CLOSE: u32 = 1014u32; pub const HSE_REQ_ASYNC_READ_CLIENT: u32 = 1010u32; pub const HSE_REQ_BASE: u32 = 0u32; pub const HSE_REQ_CANCEL_IO: u32 = 1049u32; pub const HSE_REQ_CLOSE_CONNECTION: u32 = 1017u32; pub const HSE_REQ_DONE_WITH_SESSION: u32 = 4u32; pub const HSE_REQ_END_RESERVED: u32 = 1000u32; pub const HSE_REQ_EXEC_UNICODE_URL: u32 = 1025u32; pub const HSE_REQ_EXEC_URL: u32 = 1026u32; pub const HSE_REQ_GET_ANONYMOUS_TOKEN: u32 = 1038u32; pub const HSE_REQ_GET_CACHE_INVALIDATION_CALLBACK: u32 = 1040u32; pub const HSE_REQ_GET_CERT_INFO_EX: u32 = 1015u32; pub const HSE_REQ_GET_CHANNEL_BINDING_TOKEN: u32 = 1050u32; pub const HSE_REQ_GET_CONFIG_OBJECT: u32 = 1046u32; pub const HSE_REQ_GET_EXEC_URL_STATUS: u32 = 1027u32; pub const HSE_REQ_GET_IMPERSONATION_TOKEN: u32 = 1011u32; pub const HSE_REQ_GET_PROTOCOL_MANAGER_CUSTOM_INTERFACE_CALLBACK: u32 = 1048u32; pub const HSE_REQ_GET_SSPI_INFO: u32 = 1002u32; pub const HSE_REQ_GET_TRACE_INFO: u32 = 1042u32; pub const HSE_REQ_GET_TRACE_INFO_EX: u32 = 1044u32; pub const HSE_REQ_GET_UNICODE_ANONYMOUS_TOKEN: u32 = 1041u32; pub const HSE_REQ_GET_WORKER_PROCESS_SETTINGS: u32 = 1047u32; pub const HSE_REQ_IO_COMPLETION: u32 = 1005u32; pub const HSE_REQ_IS_CONNECTED: u32 = 1018u32; pub const HSE_REQ_IS_IN_PROCESS: u32 = 1030u32; pub const HSE_REQ_IS_KEEP_CONN: u32 = 1008u32; pub const HSE_REQ_MAP_UNICODE_URL_TO_PATH: u32 = 1023u32; pub const HSE_REQ_MAP_UNICODE_URL_TO_PATH_EX: u32 = 1024u32; pub const HSE_REQ_MAP_URL_TO_PATH: u32 = 1001u32; pub const HSE_REQ_MAP_URL_TO_PATH_EX: u32 = 1012u32; pub const HSE_REQ_NORMALIZE_URL: u32 = 1033u32; pub const HSE_REQ_RAISE_TRACE_EVENT: u32 = 1045u32; pub const HSE_REQ_REFRESH_ISAPI_ACL: u32 = 1007u32; pub const HSE_REQ_REPORT_UNHEALTHY: u32 = 1032u32; pub const HSE_REQ_SEND_CUSTOM_ERROR: u32 = 1028u32; pub const HSE_REQ_SEND_RESPONSE_HEADER: u32 = 3u32; pub const HSE_REQ_SEND_RESPONSE_HEADER_EX: u32 = 1016u32; pub const HSE_REQ_SEND_URL: u32 = 2u32; pub const HSE_REQ_SEND_URL_REDIRECT_RESP: u32 = 1u32; pub const HSE_REQ_SET_FLUSH_FLAG: u32 = 1043u32; pub const HSE_REQ_TRANSMIT_FILE: u32 = 1006u32; pub const HSE_REQ_VECTOR_SEND: u32 = 1037u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HSE_RESPONSE_VECTOR { pub dwFlags: u32, pub pszStatus: super::super::Foundation::PSTR, pub pszHeaders: super::super::Foundation::PSTR, pub nElementCount: u32, pub lpElementArray: *mut HSE_VECTOR_ELEMENT, } #[cfg(feature = "Win32_Foundation")] impl HSE_RESPONSE_VECTOR {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HSE_RESPONSE_VECTOR { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HSE_RESPONSE_VECTOR { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HSE_RESPONSE_VECTOR").field("dwFlags", &self.dwFlags).field("pszStatus", &self.pszStatus).field("pszHeaders", &self.pszHeaders).field("nElementCount", &self.nElementCount).field("lpElementArray", &self.lpElementArray).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HSE_RESPONSE_VECTOR { fn eq(&self, other: &Self) -> bool { self.dwFlags == other.dwFlags && self.pszStatus == other.pszStatus && self.pszHeaders == other.pszHeaders && self.nElementCount == other.nElementCount && self.lpElementArray == other.lpElementArray } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HSE_RESPONSE_VECTOR {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HSE_RESPONSE_VECTOR { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HSE_SEND_HEADER_EX_INFO { pub pszStatus: super::super::Foundation::PSTR, pub pszHeader: super::super::Foundation::PSTR, pub cchStatus: u32, pub cchHeader: u32, pub fKeepConn: super::super::Foundation::BOOL, } #[cfg(feature = "Win32_Foundation")] impl HSE_SEND_HEADER_EX_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HSE_SEND_HEADER_EX_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HSE_SEND_HEADER_EX_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HSE_SEND_HEADER_EX_INFO").field("pszStatus", &self.pszStatus).field("pszHeader", &self.pszHeader).field("cchStatus", &self.cchStatus).field("cchHeader", &self.cchHeader).field("fKeepConn", &self.fKeepConn).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HSE_SEND_HEADER_EX_INFO { fn eq(&self, other: &Self) -> bool { self.pszStatus == other.pszStatus && self.pszHeader == other.pszHeader && self.cchStatus == other.cchStatus && self.cchHeader == other.cchHeader && self.fKeepConn == other.fKeepConn } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HSE_SEND_HEADER_EX_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HSE_SEND_HEADER_EX_INFO { type Abi = Self; } pub const HSE_STATUS_ERROR: u32 = 4u32; pub const HSE_STATUS_PENDING: u32 = 3u32; pub const HSE_STATUS_SUCCESS: u32 = 1u32; pub const HSE_STATUS_SUCCESS_AND_KEEP_CONN: u32 = 2u32; pub const HSE_TERM_ADVISORY_UNLOAD: u32 = 1u32; pub const HSE_TERM_MUST_UNLOAD: u32 = 2u32; #[derive(:: core :: clone :: Clone)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HSE_TF_INFO { pub pfnHseIO: ::core::option::Option<PFN_HSE_IO_COMPLETION>, pub pContext: *mut ::core::ffi::c_void, pub hFile: super::super::Foundation::HANDLE, pub pszStatusCode: super::super::Foundation::PSTR, pub BytesToWrite: u32, pub Offset: u32, pub pHead: *mut ::core::ffi::c_void, pub HeadLength: u32, pub pTail: *mut ::core::ffi::c_void, pub TailLength: u32, pub dwFlags: u32, } #[cfg(feature = "Win32_Foundation")] impl HSE_TF_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HSE_TF_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HSE_TF_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HSE_TF_INFO") .field("pContext", &self.pContext) .field("hFile", &self.hFile) .field("pszStatusCode", &self.pszStatusCode) .field("BytesToWrite", &self.BytesToWrite) .field("Offset", &self.Offset) .field("pHead", &self.pHead) .field("HeadLength", &self.HeadLength) .field("pTail", &self.pTail) .field("TailLength", &self.TailLength) .field("dwFlags", &self.dwFlags) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HSE_TF_INFO { fn eq(&self, other: &Self) -> bool { self.pfnHseIO.map(|f| f as usize) == other.pfnHseIO.map(|f| f as usize) && self.pContext == other.pContext && self.hFile == other.hFile && self.pszStatusCode == other.pszStatusCode && self.BytesToWrite == other.BytesToWrite && self.Offset == other.Offset && self.pHead == other.pHead && self.HeadLength == other.HeadLength && self.pTail == other.pTail && self.TailLength == other.TailLength && self.dwFlags == other.dwFlags } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HSE_TF_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HSE_TF_INFO { type Abi = ::core::mem::ManuallyDrop<Self>; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HSE_TRACE_INFO { pub fTraceRequest: super::super::Foundation::BOOL, pub TraceContextId: [u8; 16], pub dwReserved1: u32, pub dwReserved2: u32, } #[cfg(feature = "Win32_Foundation")] impl HSE_TRACE_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HSE_TRACE_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HSE_TRACE_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HSE_TRACE_INFO").field("fTraceRequest", &self.fTraceRequest).field("TraceContextId", &self.TraceContextId).field("dwReserved1", &self.dwReserved1).field("dwReserved2", &self.dwReserved2).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HSE_TRACE_INFO { fn eq(&self, other: &Self) -> bool { self.fTraceRequest == other.fTraceRequest && self.TraceContextId == other.TraceContextId && self.dwReserved1 == other.dwReserved1 && self.dwReserved2 == other.dwReserved2 } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HSE_TRACE_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HSE_TRACE_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct HSE_UNICODE_URL_MAPEX_INFO { pub lpszPath: [u16; 260], pub dwFlags: u32, pub cchMatchingPath: u32, pub cchMatchingURL: u32, } impl HSE_UNICODE_URL_MAPEX_INFO {} impl ::core::default::Default for HSE_UNICODE_URL_MAPEX_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for HSE_UNICODE_URL_MAPEX_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HSE_UNICODE_URL_MAPEX_INFO").field("lpszPath", &self.lpszPath).field("dwFlags", &self.dwFlags).field("cchMatchingPath", &self.cchMatchingPath).field("cchMatchingURL", &self.cchMatchingURL).finish() } } impl ::core::cmp::PartialEq for HSE_UNICODE_URL_MAPEX_INFO { fn eq(&self, other: &Self) -> bool { self.lpszPath == other.lpszPath && self.dwFlags == other.dwFlags && self.cchMatchingPath == other.cchMatchingPath && self.cchMatchingURL == other.cchMatchingURL } } impl ::core::cmp::Eq for HSE_UNICODE_URL_MAPEX_INFO {} unsafe impl ::windows::core::Abi for HSE_UNICODE_URL_MAPEX_INFO { type Abi = Self; } pub const HSE_URL_FLAGS_DONT_CACHE: u32 = 16u32; pub const HSE_URL_FLAGS_EXECUTE: u32 = 4u32; pub const HSE_URL_FLAGS_MAP_CERT: u32 = 128u32; pub const HSE_URL_FLAGS_MASK: u32 = 1023u32; pub const HSE_URL_FLAGS_NEGO_CERT: u32 = 32u32; pub const HSE_URL_FLAGS_READ: u32 = 1u32; pub const HSE_URL_FLAGS_REQUIRE_CERT: u32 = 64u32; pub const HSE_URL_FLAGS_SCRIPT: u32 = 512u32; pub const HSE_URL_FLAGS_SSL: u32 = 8u32; pub const HSE_URL_FLAGS_SSL128: u32 = 256u32; pub const HSE_URL_FLAGS_WRITE: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HSE_URL_MAPEX_INFO { pub lpszPath: [super::super::Foundation::CHAR; 260], pub dwFlags: u32, pub cchMatchingPath: u32, pub cchMatchingURL: u32, pub dwReserved1: u32, pub dwReserved2: u32, } #[cfg(feature = "Win32_Foundation")] impl HSE_URL_MAPEX_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HSE_URL_MAPEX_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HSE_URL_MAPEX_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HSE_URL_MAPEX_INFO").field("lpszPath", &self.lpszPath).field("dwFlags", &self.dwFlags).field("cchMatchingPath", &self.cchMatchingPath).field("cchMatchingURL", &self.cchMatchingURL).field("dwReserved1", &self.dwReserved1).field("dwReserved2", &self.dwReserved2).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HSE_URL_MAPEX_INFO { fn eq(&self, other: &Self) -> bool { self.lpszPath == other.lpszPath && self.dwFlags == other.dwFlags && self.cchMatchingPath == other.cchMatchingPath && self.cchMatchingURL == other.cchMatchingURL && self.dwReserved1 == other.dwReserved1 && self.dwReserved2 == other.dwReserved2 } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HSE_URL_MAPEX_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HSE_URL_MAPEX_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct HSE_VECTOR_ELEMENT { pub ElementType: u32, pub pvContext: *mut ::core::ffi::c_void, pub cbOffset: u64, pub cbSize: u64, } impl HSE_VECTOR_ELEMENT {} impl ::core::default::Default for HSE_VECTOR_ELEMENT { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for HSE_VECTOR_ELEMENT { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HSE_VECTOR_ELEMENT").field("ElementType", &self.ElementType).field("pvContext", &self.pvContext).field("cbOffset", &self.cbOffset).field("cbSize", &self.cbSize).finish() } } impl ::core::cmp::PartialEq for HSE_VECTOR_ELEMENT { fn eq(&self, other: &Self) -> bool { self.ElementType == other.ElementType && self.pvContext == other.pvContext && self.cbOffset == other.cbOffset && self.cbSize == other.cbSize } } impl ::core::cmp::Eq for HSE_VECTOR_ELEMENT {} unsafe impl ::windows::core::Abi for HSE_VECTOR_ELEMENT { type Abi = Self; } pub const HSE_VECTOR_ELEMENT_TYPE_FILE_HANDLE: u32 = 1u32; pub const HSE_VECTOR_ELEMENT_TYPE_MEMORY_BUFFER: u32 = 0u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HSE_VERSION_INFO { pub dwExtensionVersion: u32, pub lpszExtensionDesc: [super::super::Foundation::CHAR; 256], } #[cfg(feature = "Win32_Foundation")] impl HSE_VERSION_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HSE_VERSION_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HSE_VERSION_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HSE_VERSION_INFO").field("dwExtensionVersion", &self.dwExtensionVersion).field("lpszExtensionDesc", &self.lpszExtensionDesc).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HSE_VERSION_INFO { fn eq(&self, other: &Self) -> bool { self.dwExtensionVersion == other.dwExtensionVersion && self.lpszExtensionDesc == other.lpszExtensionDesc } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HSE_VERSION_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HSE_VERSION_INFO { type Abi = Self; } pub const HSE_VERSION_MAJOR: u32 = 8u32; pub const HSE_VERSION_MINOR: u32 = 0u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HTTP_FILTER_ACCESS_DENIED { pub pszURL: super::super::Foundation::PSTR, pub pszPhysicalPath: super::super::Foundation::PSTR, pub dwReason: u32, } #[cfg(feature = "Win32_Foundation")] impl HTTP_FILTER_ACCESS_DENIED {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HTTP_FILTER_ACCESS_DENIED { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HTTP_FILTER_ACCESS_DENIED { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HTTP_FILTER_ACCESS_DENIED").field("pszURL", &self.pszURL).field("pszPhysicalPath", &self.pszPhysicalPath).field("dwReason", &self.dwReason).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HTTP_FILTER_ACCESS_DENIED { fn eq(&self, other: &Self) -> bool { self.pszURL == other.pszURL && self.pszPhysicalPath == other.pszPhysicalPath && self.dwReason == other.dwReason } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HTTP_FILTER_ACCESS_DENIED {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HTTP_FILTER_ACCESS_DENIED { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HTTP_FILTER_AUTHENT { pub pszUser: super::super::Foundation::PSTR, pub cbUserBuff: u32, pub pszPassword: super::super::Foundation::PSTR, pub cbPasswordBuff: u32, } #[cfg(feature = "Win32_Foundation")] impl HTTP_FILTER_AUTHENT {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HTTP_FILTER_AUTHENT { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HTTP_FILTER_AUTHENT { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HTTP_FILTER_AUTHENT").field("pszUser", &self.pszUser).field("cbUserBuff", &self.cbUserBuff).field("pszPassword", &self.pszPassword).field("cbPasswordBuff", &self.cbPasswordBuff).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HTTP_FILTER_AUTHENT { fn eq(&self, other: &Self) -> bool { self.pszUser == other.pszUser && self.cbUserBuff == other.cbUserBuff && self.pszPassword == other.pszPassword && self.cbPasswordBuff == other.cbPasswordBuff } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HTTP_FILTER_AUTHENT {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HTTP_FILTER_AUTHENT { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HTTP_FILTER_AUTH_COMPLETE_INFO { pub GetHeader: isize, pub SetHeader: isize, pub AddHeader: isize, pub GetUserToken: isize, pub HttpStatus: u32, pub fResetAuth: super::super::Foundation::BOOL, pub dwReserved: u32, } #[cfg(feature = "Win32_Foundation")] impl HTTP_FILTER_AUTH_COMPLETE_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HTTP_FILTER_AUTH_COMPLETE_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HTTP_FILTER_AUTH_COMPLETE_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HTTP_FILTER_AUTH_COMPLETE_INFO") .field("GetHeader", &self.GetHeader) .field("SetHeader", &self.SetHeader) .field("AddHeader", &self.AddHeader) .field("GetUserToken", &self.GetUserToken) .field("HttpStatus", &self.HttpStatus) .field("fResetAuth", &self.fResetAuth) .field("dwReserved", &self.dwReserved) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HTTP_FILTER_AUTH_COMPLETE_INFO { fn eq(&self, other: &Self) -> bool { self.GetHeader == other.GetHeader && self.SetHeader == other.SetHeader && self.AddHeader == other.AddHeader && self.GetUserToken == other.GetUserToken && self.HttpStatus == other.HttpStatus && self.fResetAuth == other.fResetAuth && self.dwReserved == other.dwReserved } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HTTP_FILTER_AUTH_COMPLETE_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HTTP_FILTER_AUTH_COMPLETE_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HTTP_FILTER_CONTEXT { pub cbSize: u32, pub Revision: u32, pub ServerContext: *mut ::core::ffi::c_void, pub ulReserved: u32, pub fIsSecurePort: super::super::Foundation::BOOL, pub pFilterContext: *mut ::core::ffi::c_void, pub GetServerVariable: isize, pub AddResponseHeaders: isize, pub WriteClient: isize, pub AllocMem: isize, pub ServerSupportFunction: isize, } #[cfg(feature = "Win32_Foundation")] impl HTTP_FILTER_CONTEXT {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HTTP_FILTER_CONTEXT { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HTTP_FILTER_CONTEXT { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HTTP_FILTER_CONTEXT") .field("cbSize", &self.cbSize) .field("Revision", &self.Revision) .field("ServerContext", &self.ServerContext) .field("ulReserved", &self.ulReserved) .field("fIsSecurePort", &self.fIsSecurePort) .field("pFilterContext", &self.pFilterContext) .field("GetServerVariable", &self.GetServerVariable) .field("AddResponseHeaders", &self.AddResponseHeaders) .field("WriteClient", &self.WriteClient) .field("AllocMem", &self.AllocMem) .field("ServerSupportFunction", &self.ServerSupportFunction) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HTTP_FILTER_CONTEXT { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.Revision == other.Revision && self.ServerContext == other.ServerContext && self.ulReserved == other.ulReserved && self.fIsSecurePort == other.fIsSecurePort && self.pFilterContext == other.pFilterContext && self.GetServerVariable == other.GetServerVariable && self.AddResponseHeaders == other.AddResponseHeaders && self.WriteClient == other.WriteClient && self.AllocMem == other.AllocMem && self.ServerSupportFunction == other.ServerSupportFunction } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HTTP_FILTER_CONTEXT {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HTTP_FILTER_CONTEXT { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HTTP_FILTER_LOG { pub pszClientHostName: super::super::Foundation::PSTR, pub pszClientUserName: super::super::Foundation::PSTR, pub pszServerName: super::super::Foundation::PSTR, pub pszOperation: super::super::Foundation::PSTR, pub pszTarget: super::super::Foundation::PSTR, pub pszParameters: super::super::Foundation::PSTR, pub dwHttpStatus: u32, pub dwWin32Status: u32, pub dwBytesSent: u32, pub dwBytesRecvd: u32, pub msTimeForProcessing: u32, } #[cfg(feature = "Win32_Foundation")] impl HTTP_FILTER_LOG {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HTTP_FILTER_LOG { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HTTP_FILTER_LOG { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HTTP_FILTER_LOG") .field("pszClientHostName", &self.pszClientHostName) .field("pszClientUserName", &self.pszClientUserName) .field("pszServerName", &self.pszServerName) .field("pszOperation", &self.pszOperation) .field("pszTarget", &self.pszTarget) .field("pszParameters", &self.pszParameters) .field("dwHttpStatus", &self.dwHttpStatus) .field("dwWin32Status", &self.dwWin32Status) .field("dwBytesSent", &self.dwBytesSent) .field("dwBytesRecvd", &self.dwBytesRecvd) .field("msTimeForProcessing", &self.msTimeForProcessing) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HTTP_FILTER_LOG { fn eq(&self, other: &Self) -> bool { self.pszClientHostName == other.pszClientHostName && self.pszClientUserName == other.pszClientUserName && self.pszServerName == other.pszServerName && self.pszOperation == other.pszOperation && self.pszTarget == other.pszTarget && self.pszParameters == other.pszParameters && self.dwHttpStatus == other.dwHttpStatus && self.dwWin32Status == other.dwWin32Status && self.dwBytesSent == other.dwBytesSent && self.dwBytesRecvd == other.dwBytesRecvd && self.msTimeForProcessing == other.msTimeForProcessing } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HTTP_FILTER_LOG {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HTTP_FILTER_LOG { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct HTTP_FILTER_PREPROC_HEADERS { pub GetHeader: isize, pub SetHeader: isize, pub AddHeader: isize, pub HttpStatus: u32, pub dwReserved: u32, } impl HTTP_FILTER_PREPROC_HEADERS {} impl ::core::default::Default for HTTP_FILTER_PREPROC_HEADERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for HTTP_FILTER_PREPROC_HEADERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HTTP_FILTER_PREPROC_HEADERS").field("GetHeader", &self.GetHeader).field("SetHeader", &self.SetHeader).field("AddHeader", &self.AddHeader).field("HttpStatus", &self.HttpStatus).field("dwReserved", &self.dwReserved).finish() } } impl ::core::cmp::PartialEq for HTTP_FILTER_PREPROC_HEADERS { fn eq(&self, other: &Self) -> bool { self.GetHeader == other.GetHeader && self.SetHeader == other.SetHeader && self.AddHeader == other.AddHeader && self.HttpStatus == other.HttpStatus && self.dwReserved == other.dwReserved } } impl ::core::cmp::Eq for HTTP_FILTER_PREPROC_HEADERS {} unsafe impl ::windows::core::Abi for HTTP_FILTER_PREPROC_HEADERS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct HTTP_FILTER_RAW_DATA { pub pvInData: *mut ::core::ffi::c_void, pub cbInData: u32, pub cbInBuffer: u32, pub dwReserved: u32, } impl HTTP_FILTER_RAW_DATA {} impl ::core::default::Default for HTTP_FILTER_RAW_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for HTTP_FILTER_RAW_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HTTP_FILTER_RAW_DATA").field("pvInData", &self.pvInData).field("cbInData", &self.cbInData).field("cbInBuffer", &self.cbInBuffer).field("dwReserved", &self.dwReserved).finish() } } impl ::core::cmp::PartialEq for HTTP_FILTER_RAW_DATA { fn eq(&self, other: &Self) -> bool { self.pvInData == other.pvInData && self.cbInData == other.cbInData && self.cbInBuffer == other.cbInBuffer && self.dwReserved == other.dwReserved } } impl ::core::cmp::Eq for HTTP_FILTER_RAW_DATA {} unsafe impl ::windows::core::Abi for HTTP_FILTER_RAW_DATA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HTTP_FILTER_URL_MAP { pub pszURL: super::super::Foundation::PSTR, pub pszPhysicalPath: super::super::Foundation::PSTR, pub cbPathBuff: u32, } #[cfg(feature = "Win32_Foundation")] impl HTTP_FILTER_URL_MAP {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HTTP_FILTER_URL_MAP { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HTTP_FILTER_URL_MAP { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HTTP_FILTER_URL_MAP").field("pszURL", &self.pszURL).field("pszPhysicalPath", &self.pszPhysicalPath).field("cbPathBuff", &self.cbPathBuff).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HTTP_FILTER_URL_MAP { fn eq(&self, other: &Self) -> bool { self.pszURL == other.pszURL && self.pszPhysicalPath == other.pszPhysicalPath && self.cbPathBuff == other.cbPathBuff } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HTTP_FILTER_URL_MAP {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HTTP_FILTER_URL_MAP { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HTTP_FILTER_URL_MAP_EX { pub pszURL: super::super::Foundation::PSTR, pub pszPhysicalPath: super::super::Foundation::PSTR, pub cbPathBuff: u32, pub dwFlags: u32, pub cchMatchingPath: u32, pub cchMatchingURL: u32, pub pszScriptMapEntry: super::super::Foundation::PSTR, } #[cfg(feature = "Win32_Foundation")] impl HTTP_FILTER_URL_MAP_EX {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HTTP_FILTER_URL_MAP_EX { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HTTP_FILTER_URL_MAP_EX { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HTTP_FILTER_URL_MAP_EX") .field("pszURL", &self.pszURL) .field("pszPhysicalPath", &self.pszPhysicalPath) .field("cbPathBuff", &self.cbPathBuff) .field("dwFlags", &self.dwFlags) .field("cchMatchingPath", &self.cchMatchingPath) .field("cchMatchingURL", &self.cchMatchingURL) .field("pszScriptMapEntry", &self.pszScriptMapEntry) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HTTP_FILTER_URL_MAP_EX { fn eq(&self, other: &Self) -> bool { self.pszURL == other.pszURL && self.pszPhysicalPath == other.pszPhysicalPath && self.cbPathBuff == other.cbPathBuff && self.dwFlags == other.dwFlags && self.cchMatchingPath == other.cchMatchingPath && self.cchMatchingURL == other.cchMatchingURL && self.pszScriptMapEntry == other.pszScriptMapEntry } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HTTP_FILTER_URL_MAP_EX {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HTTP_FILTER_URL_MAP_EX { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HTTP_FILTER_VERSION { pub dwServerFilterVersion: u32, pub dwFilterVersion: u32, pub lpszFilterDesc: [super::super::Foundation::CHAR; 257], pub dwFlags: u32, } #[cfg(feature = "Win32_Foundation")] impl HTTP_FILTER_VERSION {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HTTP_FILTER_VERSION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HTTP_FILTER_VERSION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HTTP_FILTER_VERSION").field("dwServerFilterVersion", &self.dwServerFilterVersion).field("dwFilterVersion", &self.dwFilterVersion).field("lpszFilterDesc", &self.lpszFilterDesc).field("dwFlags", &self.dwFlags).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HTTP_FILTER_VERSION { fn eq(&self, other: &Self) -> bool { self.dwServerFilterVersion == other.dwServerFilterVersion && self.dwFilterVersion == other.dwFilterVersion && self.lpszFilterDesc == other.lpszFilterDesc && self.dwFlags == other.dwFlags } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HTTP_FILTER_VERSION {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HTTP_FILTER_VERSION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HTTP_TRACE_CONFIGURATION { pub pProviderGuid: *mut ::windows::core::GUID, pub dwAreas: u32, pub dwVerbosity: u32, pub fProviderEnabled: super::super::Foundation::BOOL, } #[cfg(feature = "Win32_Foundation")] impl HTTP_TRACE_CONFIGURATION {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HTTP_TRACE_CONFIGURATION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HTTP_TRACE_CONFIGURATION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HTTP_TRACE_CONFIGURATION").field("pProviderGuid", &self.pProviderGuid).field("dwAreas", &self.dwAreas).field("dwVerbosity", &self.dwVerbosity).field("fProviderEnabled", &self.fProviderEnabled).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HTTP_TRACE_CONFIGURATION { fn eq(&self, other: &Self) -> bool { self.pProviderGuid == other.pProviderGuid && self.dwAreas == other.dwAreas && self.dwVerbosity == other.dwVerbosity && self.fProviderEnabled == other.fProviderEnabled } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HTTP_TRACE_CONFIGURATION {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HTTP_TRACE_CONFIGURATION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HTTP_TRACE_EVENT { pub pProviderGuid: *mut ::windows::core::GUID, pub dwArea: u32, pub pAreaGuid: *mut ::windows::core::GUID, pub dwEvent: u32, pub pszEventName: super::super::Foundation::PWSTR, pub dwEventVersion: u32, pub dwVerbosity: u32, pub pActivityGuid: *mut ::windows::core::GUID, pub pRelatedActivityGuid: *mut ::windows::core::GUID, pub dwTimeStamp: u32, pub dwFlags: u32, pub cEventItems: u32, pub pEventItems: *mut HTTP_TRACE_EVENT_ITEM, } #[cfg(feature = "Win32_Foundation")] impl HTTP_TRACE_EVENT {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HTTP_TRACE_EVENT { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HTTP_TRACE_EVENT { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HTTP_TRACE_EVENT") .field("pProviderGuid", &self.pProviderGuid) .field("dwArea", &self.dwArea) .field("pAreaGuid", &self.pAreaGuid) .field("dwEvent", &self.dwEvent) .field("pszEventName", &self.pszEventName) .field("dwEventVersion", &self.dwEventVersion) .field("dwVerbosity", &self.dwVerbosity) .field("pActivityGuid", &self.pActivityGuid) .field("pRelatedActivityGuid", &self.pRelatedActivityGuid) .field("dwTimeStamp", &self.dwTimeStamp) .field("dwFlags", &self.dwFlags) .field("cEventItems", &self.cEventItems) .field("pEventItems", &self.pEventItems) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HTTP_TRACE_EVENT { fn eq(&self, other: &Self) -> bool { self.pProviderGuid == other.pProviderGuid && self.dwArea == other.dwArea && self.pAreaGuid == other.pAreaGuid && self.dwEvent == other.dwEvent && self.pszEventName == other.pszEventName && self.dwEventVersion == other.dwEventVersion && self.dwVerbosity == other.dwVerbosity && self.pActivityGuid == other.pActivityGuid && self.pRelatedActivityGuid == other.pRelatedActivityGuid && self.dwTimeStamp == other.dwTimeStamp && self.dwFlags == other.dwFlags && self.cEventItems == other.cEventItems && self.pEventItems == other.pEventItems } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HTTP_TRACE_EVENT {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HTTP_TRACE_EVENT { type Abi = Self; } pub const HTTP_TRACE_EVENT_FLAG_STATIC_DESCRIPTIVE_FIELDS: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct HTTP_TRACE_EVENT_ITEM { pub pszName: super::super::Foundation::PWSTR, pub dwDataType: HTTP_TRACE_TYPE, pub pbData: *mut u8, pub cbData: u32, pub pszDataDescription: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl HTTP_TRACE_EVENT_ITEM {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HTTP_TRACE_EVENT_ITEM { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for HTTP_TRACE_EVENT_ITEM { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("HTTP_TRACE_EVENT_ITEM").field("pszName", &self.pszName).field("dwDataType", &self.dwDataType).field("pbData", &self.pbData).field("cbData", &self.cbData).field("pszDataDescription", &self.pszDataDescription).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HTTP_TRACE_EVENT_ITEM { fn eq(&self, other: &Self) -> bool { self.pszName == other.pszName && self.dwDataType == other.dwDataType && self.pbData == other.pbData && self.cbData == other.cbData && self.pszDataDescription == other.pszDataDescription } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HTTP_TRACE_EVENT_ITEM {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HTTP_TRACE_EVENT_ITEM { type Abi = Self; } pub const HTTP_TRACE_LEVEL_END: u32 = 7u32; pub const HTTP_TRACE_LEVEL_START: u32 = 6u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct HTTP_TRACE_TYPE(pub i32); pub const HTTP_TRACE_TYPE_BYTE: HTTP_TRACE_TYPE = HTTP_TRACE_TYPE(17i32); pub const HTTP_TRACE_TYPE_USHORT: HTTP_TRACE_TYPE = HTTP_TRACE_TYPE(18i32); pub const HTTP_TRACE_TYPE_ULONG: HTTP_TRACE_TYPE = HTTP_TRACE_TYPE(19i32); pub const HTTP_TRACE_TYPE_ULONGLONG: HTTP_TRACE_TYPE = HTTP_TRACE_TYPE(21i32); pub const HTTP_TRACE_TYPE_CHAR: HTTP_TRACE_TYPE = HTTP_TRACE_TYPE(16i32); pub const HTTP_TRACE_TYPE_SHORT: HTTP_TRACE_TYPE = HTTP_TRACE_TYPE(2i32); pub const HTTP_TRACE_TYPE_LONG: HTTP_TRACE_TYPE = HTTP_TRACE_TYPE(3i32); pub const HTTP_TRACE_TYPE_LONGLONG: HTTP_TRACE_TYPE = HTTP_TRACE_TYPE(20i32); pub const HTTP_TRACE_TYPE_LPCWSTR: HTTP_TRACE_TYPE = HTTP_TRACE_TYPE(31i32); pub const HTTP_TRACE_TYPE_LPCSTR: HTTP_TRACE_TYPE = HTTP_TRACE_TYPE(30i32); pub const HTTP_TRACE_TYPE_LPCGUID: HTTP_TRACE_TYPE = HTTP_TRACE_TYPE(72i32); pub const HTTP_TRACE_TYPE_BOOL: HTTP_TRACE_TYPE = HTTP_TRACE_TYPE(11i32); impl ::core::convert::From<i32> for HTTP_TRACE_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for HTTP_TRACE_TYPE { type Abi = Self; } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn HttpExtensionProc(pecb: *const EXTENSION_CONTROL_BLOCK) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn HttpExtensionProc(pecb: *const EXTENSION_CONTROL_BLOCK) -> u32; } ::core::mem::transmute(HttpExtensionProc(::core::mem::transmute(pecb))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn HttpFilterProc(pfc: *mut HTTP_FILTER_CONTEXT, notificationtype: u32, pvnotification: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn HttpFilterProc(pfc: *mut HTTP_FILTER_CONTEXT, notificationtype: u32, pvnotification: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(HttpFilterProc(::core::mem::transmute(pfc), ::core::mem::transmute(notificationtype), ::core::mem::transmute(pvnotification))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IADMEXT(pub ::windows::core::IUnknown); impl IADMEXT { pub unsafe fn Initialize(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn EnumDcomCLSIDs(&self, pclsiddcom: *mut ::windows::core::GUID, dwenumindex: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(pclsiddcom), ::core::mem::transmute(dwenumindex)).ok() } pub unsafe fn Terminate(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self)).ok() } } unsafe impl ::windows::core::Interface for IADMEXT { type Vtable = IADMEXT_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x51dfe970_f6f2_11d0_b9bd_00a0c922e750); } impl ::core::convert::From<IADMEXT> for ::windows::core::IUnknown { fn from(value: IADMEXT) -> Self { value.0 } } impl ::core::convert::From<&IADMEXT> for ::windows::core::IUnknown { fn from(value: &IADMEXT) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IADMEXT { 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 IADMEXT { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IADMEXT_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pclsiddcom: *mut ::windows::core::GUID, dwenumindex: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IFtpAuthenticationProvider(pub ::windows::core::IUnknown); impl IFtpAuthenticationProvider { #[cfg(feature = "Win32_Foundation")] pub unsafe fn AuthenticateUser<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>( &self, pszsessionid: Param0, pszsitename: Param1, pszusername: Param2, pszpassword: Param3, ppszcanonicalusername: *mut super::super::Foundation::PWSTR, pfauthenticated: *mut super::super::Foundation::BOOL, ) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pszsessionid.into_param().abi(), pszsitename.into_param().abi(), pszusername.into_param().abi(), pszpassword.into_param().abi(), ::core::mem::transmute(ppszcanonicalusername), ::core::mem::transmute(pfauthenticated)).ok() } } unsafe impl ::windows::core::Interface for IFtpAuthenticationProvider { type Vtable = IFtpAuthenticationProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4659f95c_d5a8_4707_b2fc_6fd5794246cf); } impl ::core::convert::From<IFtpAuthenticationProvider> for ::windows::core::IUnknown { fn from(value: IFtpAuthenticationProvider) -> Self { value.0 } } impl ::core::convert::From<&IFtpAuthenticationProvider> for ::windows::core::IUnknown { fn from(value: &IFtpAuthenticationProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IFtpAuthenticationProvider { 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 IFtpAuthenticationProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IFtpAuthenticationProvider_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, pszsessionid: super::super::Foundation::PWSTR, pszsitename: super::super::Foundation::PWSTR, pszusername: super::super::Foundation::PWSTR, pszpassword: super::super::Foundation::PWSTR, ppszcanonicalusername: *mut super::super::Foundation::PWSTR, pfauthenticated: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IFtpAuthorizationProvider(pub ::windows::core::IUnknown); impl IFtpAuthorizationProvider { #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetUserAccessPermission<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszsessionid: Param0, pszsitename: Param1, pszvirtualpath: Param2, pszusername: Param3) -> ::windows::core::Result<FTP_ACCESS> { let mut result__: <FTP_ACCESS as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pszsessionid.into_param().abi(), pszsitename.into_param().abi(), pszvirtualpath.into_param().abi(), pszusername.into_param().abi(), &mut result__).from_abi::<FTP_ACCESS>(result__) } } unsafe impl ::windows::core::Interface for IFtpAuthorizationProvider { type Vtable = IFtpAuthorizationProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa50ae7a1_a35a_42b4_a4f3_f4f7057a05d1); } impl ::core::convert::From<IFtpAuthorizationProvider> for ::windows::core::IUnknown { fn from(value: IFtpAuthorizationProvider) -> Self { value.0 } } impl ::core::convert::From<&IFtpAuthorizationProvider> for ::windows::core::IUnknown { fn from(value: &IFtpAuthorizationProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IFtpAuthorizationProvider { 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 IFtpAuthorizationProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IFtpAuthorizationProvider_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, pszsessionid: super::super::Foundation::PWSTR, pszsitename: super::super::Foundation::PWSTR, pszvirtualpath: super::super::Foundation::PWSTR, pszusername: super::super::Foundation::PWSTR, pftpaccess: *mut FTP_ACCESS) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IFtpHomeDirectoryProvider(pub ::windows::core::IUnknown); impl IFtpHomeDirectoryProvider { #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetUserHomeDirectoryData<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszsessionid: Param0, pszsitename: Param1, pszusername: Param2) -> ::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).3)(::core::mem::transmute_copy(self), pszsessionid.into_param().abi(), pszsitename.into_param().abi(), pszusername.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::PWSTR>(result__) } } unsafe impl ::windows::core::Interface for IFtpHomeDirectoryProvider { type Vtable = IFtpHomeDirectoryProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0933b392_18dd_4097_8b9c_83325c35d9a6); } impl ::core::convert::From<IFtpHomeDirectoryProvider> for ::windows::core::IUnknown { fn from(value: IFtpHomeDirectoryProvider) -> Self { value.0 } } impl ::core::convert::From<&IFtpHomeDirectoryProvider> for ::windows::core::IUnknown { fn from(value: &IFtpHomeDirectoryProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IFtpHomeDirectoryProvider { 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 IFtpHomeDirectoryProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IFtpHomeDirectoryProvider_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, pszsessionid: super::super::Foundation::PWSTR, pszsitename: super::super::Foundation::PWSTR, pszusername: super::super::Foundation::PWSTR, ppszhomedirectorydata: *mut super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IFtpLogProvider(pub ::windows::core::IUnknown); impl IFtpLogProvider { #[cfg(feature = "Win32_Foundation")] pub unsafe fn Log(&self, ploggingparameters: *const LOGGING_PARAMETERS) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(ploggingparameters)).ok() } } unsafe impl ::windows::core::Interface for IFtpLogProvider { type Vtable = IFtpLogProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa18a94cc_8299_4408_816c_7c3baca1a40e); } impl ::core::convert::From<IFtpLogProvider> for ::windows::core::IUnknown { fn from(value: IFtpLogProvider) -> Self { value.0 } } impl ::core::convert::From<&IFtpLogProvider> for ::windows::core::IUnknown { fn from(value: &IFtpLogProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IFtpLogProvider { 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 IFtpLogProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IFtpLogProvider_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, ploggingparameters: *const LOGGING_PARAMETERS) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IFtpPostprocessProvider(pub ::windows::core::IUnknown); impl IFtpPostprocessProvider { #[cfg(feature = "Win32_Foundation")] pub unsafe fn HandlePostprocess(&self, ppostprocessparameters: *const POST_PROCESS_PARAMETERS) -> ::windows::core::Result<FTP_PROCESS_STATUS> { let mut result__: <FTP_PROCESS_STATUS as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(ppostprocessparameters), &mut result__).from_abi::<FTP_PROCESS_STATUS>(result__) } } unsafe impl ::windows::core::Interface for IFtpPostprocessProvider { type Vtable = IFtpPostprocessProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4522cbc6_16cd_49ad_8653_9a2c579e4280); } impl ::core::convert::From<IFtpPostprocessProvider> for ::windows::core::IUnknown { fn from(value: IFtpPostprocessProvider) -> Self { value.0 } } impl ::core::convert::From<&IFtpPostprocessProvider> for ::windows::core::IUnknown { fn from(value: &IFtpPostprocessProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IFtpPostprocessProvider { 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 IFtpPostprocessProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IFtpPostprocessProvider_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, ppostprocessparameters: *const POST_PROCESS_PARAMETERS, pftpprocessstatus: *mut FTP_PROCESS_STATUS) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IFtpPreprocessProvider(pub ::windows::core::IUnknown); impl IFtpPreprocessProvider { #[cfg(feature = "Win32_Foundation")] pub unsafe fn HandlePreprocess(&self, ppreprocessparameters: *const PRE_PROCESS_PARAMETERS) -> ::windows::core::Result<FTP_PROCESS_STATUS> { let mut result__: <FTP_PROCESS_STATUS as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(ppreprocessparameters), &mut result__).from_abi::<FTP_PROCESS_STATUS>(result__) } } unsafe impl ::windows::core::Interface for IFtpPreprocessProvider { type Vtable = IFtpPreprocessProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa3c19b60_5a28_471a_8f93_ab30411cee82); } impl ::core::convert::From<IFtpPreprocessProvider> for ::windows::core::IUnknown { fn from(value: IFtpPreprocessProvider) -> Self { value.0 } } impl ::core::convert::From<&IFtpPreprocessProvider> for ::windows::core::IUnknown { fn from(value: &IFtpPreprocessProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IFtpPreprocessProvider { 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 IFtpPreprocessProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IFtpPreprocessProvider_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, ppreprocessparameters: *const PRE_PROCESS_PARAMETERS, pftpprocessstatus: *mut FTP_PROCESS_STATUS) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IFtpProviderConstruct(pub ::windows::core::IUnknown); impl IFtpProviderConstruct { #[cfg(feature = "Win32_System_Com")] pub unsafe fn Construct(&self, configurationentries: *const super::Com::SAFEARRAY) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(configurationentries)).ok() } } unsafe impl ::windows::core::Interface for IFtpProviderConstruct { type Vtable = IFtpProviderConstruct_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d1a3f7b_412d_447c_b199_64f967e9a2da); } impl ::core::convert::From<IFtpProviderConstruct> for ::windows::core::IUnknown { fn from(value: IFtpProviderConstruct) -> Self { value.0 } } impl ::core::convert::From<&IFtpProviderConstruct> for ::windows::core::IUnknown { fn from(value: &IFtpProviderConstruct) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IFtpProviderConstruct { 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 IFtpProviderConstruct { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IFtpProviderConstruct_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_System_Com")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, configurationentries: *const super::Com::SAFEARRAY) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_System_Com"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IFtpRoleProvider(pub ::windows::core::IUnknown); impl IFtpRoleProvider { #[cfg(feature = "Win32_Foundation")] pub unsafe fn IsUserInRole<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszsessionid: Param0, pszsitename: Param1, pszusername: Param2, pszrole: Param3) -> ::windows::core::Result<super::super::Foundation::BOOL> { let mut result__: <super::super::Foundation::BOOL as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pszsessionid.into_param().abi(), pszsitename.into_param().abi(), pszusername.into_param().abi(), pszrole.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::BOOL>(result__) } } unsafe impl ::windows::core::Interface for IFtpRoleProvider { type Vtable = IFtpRoleProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x909c850d_8ca0_4674_96b8_cc2941535725); } impl ::core::convert::From<IFtpRoleProvider> for ::windows::core::IUnknown { fn from(value: IFtpRoleProvider) -> Self { value.0 } } impl ::core::convert::From<&IFtpRoleProvider> for ::windows::core::IUnknown { fn from(value: &IFtpRoleProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IFtpRoleProvider { 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 IFtpRoleProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IFtpRoleProvider_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, pszsessionid: super::super::Foundation::PWSTR, pszsitename: super::super::Foundation::PWSTR, pszusername: super::super::Foundation::PWSTR, pszrole: super::super::Foundation::PWSTR, pfisinrole: *mut super::super::Foundation::BOOL) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); pub const IIS_MD_ADSI_METAID_BEGIN: u32 = 130000u32; pub const IIS_MD_APPPOOL_BASE: u32 = 9000u32; pub const IIS_MD_APP_BASE: u32 = 9100u32; pub const IIS_MD_FILE_PROP_BASE: u32 = 6000u32; pub const IIS_MD_FTP_BASE: u32 = 5000u32; pub const IIS_MD_GLOBAL_BASE: u32 = 9200u32; pub const IIS_MD_HTTP_BASE: u32 = 2000u32; pub const IIS_MD_ID_BEGIN_RESERVED: u32 = 1u32; pub const IIS_MD_ID_END_RESERVED: u32 = 32767u32; pub const IIS_MD_LOGCUSTOM_BASE: u32 = 4500u32; pub const IIS_MD_LOGCUSTOM_LAST: u32 = 4508u32; pub const IIS_MD_LOG_BASE: u32 = 4000u32; pub const IIS_MD_LOG_LAST: u32 = 4015u32; pub const IIS_MD_SERVER_BASE: u32 = 1000u32; pub const IIS_MD_SSL_BASE: u32 = 5500u32; pub const IIS_MD_UT_END_RESERVED: u32 = 2000u32; pub const IIS_MD_UT_FILE: u32 = 2u32; pub const IIS_MD_UT_SERVER: u32 = 1u32; pub const IIS_MD_UT_WAM: u32 = 100u32; pub const IIS_MD_VR_BASE: u32 = 3000u32; pub const IMAP_MD_ID_BEGIN_RESERVED: u32 = 49152u32; pub const IMAP_MD_ID_END_RESERVED: u32 = 53247u32; pub const IMGANIM_ANIMATED: u32 = 268435456u32; pub const IMGANIM_MASK: u32 = 268435456u32; pub const IMGBITS_MASK: u32 = 234881024u32; pub const IMGBITS_NONE: u32 = 33554432u32; pub const IMGBITS_PARTIAL: u32 = 67108864u32; pub const IMGBITS_TOTAL: u32 = 134217728u32; pub const IMGCHG_ANIMATE: u32 = 8u32; pub const IMGCHG_COMPLETE: u32 = 4u32; pub const IMGCHG_MASK: u32 = 15u32; pub const IMGCHG_SIZE: u32 = 1u32; pub const IMGCHG_VIEW: u32 = 2u32; pub const IMGLOAD_COMPLETE: u32 = 16777216u32; pub const IMGLOAD_ERROR: u32 = 8388608u32; pub const IMGLOAD_LOADING: u32 = 2097152u32; pub const IMGLOAD_MASK: u32 = 32505856u32; pub const IMGLOAD_NOTLOADED: u32 = 1048576u32; pub const IMGLOAD_STOPPED: u32 = 4194304u32; pub const IMGTRANS_MASK: u32 = 536870912u32; pub const IMGTRANS_OPAQUE: u32 = 536870912u32; #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IMSAdminBase2W(pub ::windows::core::IUnknown); impl IMSAdminBase2W { #[cfg(feature = "Win32_Foundation")] pub unsafe fn AddKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn DeleteKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn DeleteChildKeys<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn EnumKeys<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, pszmdname: super::super::Foundation::PWSTR, dwmdenumobjectindex: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pszmdname), ::core::mem::transmute(dwmdenumobjectindex)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn CopyKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, hmdsourcehandle: u32, pszmdsourcepath: Param1, hmddesthandle: u32, pszmddestpath: Param3, bmdoverwriteflag: Param4, bmdcopyflag: Param5) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdsourcehandle), pszmdsourcepath.into_param().abi(), ::core::mem::transmute(hmddesthandle), pszmddestpath.into_param().abi(), bmdoverwriteflag.into_param().abi(), bmdcopyflag.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn RenameKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, pszmdnewname: Param2) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), pszmdnewname.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, pmdrmddata: *mut METADATA_RECORD) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pmdrmddata)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, pmdrmddata: *mut METADATA_RECORD, pdwmdrequireddatalen: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pmdrmddata), ::core::mem::transmute(pdwmdrequireddatalen)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn DeleteData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, dwmdidentifier: u32, dwmddatatype: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(dwmdidentifier), ::core::mem::transmute(dwmddatatype)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn EnumData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, pmdrmddata: *mut METADATA_RECORD, dwmdenumdataindex: u32, pdwmdrequireddatalen: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pmdrmddata), ::core::mem::transmute(dwmdenumdataindex), ::core::mem::transmute(pdwmdrequireddatalen)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetAllData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, dwmdattributes: u32, dwmdusertype: u32, dwmddatatype: u32, pdwmdnumdataentries: *mut u32, pdwmddatasetnumber: *mut u32, dwmdbuffersize: u32, pbmdbuffer: *mut u8, pdwmdrequiredbuffersize: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).13)( ::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(dwmdattributes), ::core::mem::transmute(dwmdusertype), ::core::mem::transmute(dwmddatatype), ::core::mem::transmute(pdwmdnumdataentries), ::core::mem::transmute(pdwmddatasetnumber), ::core::mem::transmute(dwmdbuffersize), ::core::mem::transmute(pbmdbuffer), ::core::mem::transmute(pdwmdrequiredbuffersize), ) .ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn DeleteAllData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, dwmdusertype: u32, dwmddatatype: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(dwmdusertype), ::core::mem::transmute(dwmddatatype)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn CopyData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param7: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, hmdsourcehandle: u32, pszmdsourcepath: Param1, hmddesthandle: u32, pszmddestpath: Param3, dwmdattributes: u32, dwmdusertype: u32, dwmddatatype: u32, bmdcopyflag: Param7) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).15)( ::core::mem::transmute_copy(self), ::core::mem::transmute(hmdsourcehandle), pszmdsourcepath.into_param().abi(), ::core::mem::transmute(hmddesthandle), pszmddestpath.into_param().abi(), ::core::mem::transmute(dwmdattributes), ::core::mem::transmute(dwmdusertype), ::core::mem::transmute(dwmddatatype), bmdcopyflag.into_param().abi(), ) .ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetDataPaths<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, dwmdidentifier: u32, dwmddatatype: u32, dwmdbuffersize: u32, pszbuffer: super::super::Foundation::PWSTR, pdwmdrequiredbuffersize: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(dwmdidentifier), ::core::mem::transmute(dwmddatatype), ::core::mem::transmute(dwmdbuffersize), ::core::mem::transmute(pszbuffer), ::core::mem::transmute(pdwmdrequiredbuffersize)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn OpenKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, dwmdaccessrequested: u32, dwmdtimeout: u32) -> ::windows::core::Result<u32> { let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(dwmdaccessrequested), ::core::mem::transmute(dwmdtimeout), &mut result__).from_abi::<u32>(result__) } pub unsafe fn CloseKey(&self, hmdhandle: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle)).ok() } pub unsafe fn ChangePermissions(&self, hmdhandle: u32, dwmdtimeout: u32, dwmdaccessrequested: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), ::core::mem::transmute(dwmdtimeout), ::core::mem::transmute(dwmdaccessrequested)).ok() } pub unsafe fn SaveData(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn GetHandleInfo(&self, hmdhandle: u32) -> ::windows::core::Result<METADATA_HANDLE_INFO> { let mut result__: <METADATA_HANDLE_INFO as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).21)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), &mut result__).from_abi::<METADATA_HANDLE_INFO>(result__) } pub unsafe fn GetSystemChangeNumber(&self) -> ::windows::core::Result<u32> { let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).22)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetDataSetNumber<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1) -> ::windows::core::Result<u32> { let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).23)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), &mut result__).from_abi::<u32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetLastChangeTime<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, hmdhandle: u32, pszmdpath: Param1, pftmdlastchangetime: *const super::super::Foundation::FILETIME, blocaltime: Param3) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).24)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pftmdlastchangetime), blocaltime.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetLastChangeTime<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, hmdhandle: u32, pszmdpath: Param1, pftmdlastchangetime: *mut super::super::Foundation::FILETIME, blocaltime: Param3) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).25)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pftmdlastchangetime), blocaltime.into_param().abi()).ok() } pub unsafe fn KeyExchangePhase1(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).26)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn KeyExchangePhase2(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).27)(::core::mem::transmute_copy(self)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Backup<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdbackuplocation: Param0, dwmdversion: u32, dwmdflags: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).28)(::core::mem::transmute_copy(self), pszmdbackuplocation.into_param().abi(), ::core::mem::transmute(dwmdversion), ::core::mem::transmute(dwmdflags)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Restore<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdbackuplocation: Param0, dwmdversion: u32, dwmdflags: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).29)(::core::mem::transmute_copy(self), pszmdbackuplocation.into_param().abi(), ::core::mem::transmute(dwmdversion), ::core::mem::transmute(dwmdflags)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn EnumBackups<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdbackuplocation: Param0, pdwmdversion: *mut u32, pftmdbackuptime: *mut super::super::Foundation::FILETIME, dwmdenumindex: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).30)(::core::mem::transmute_copy(self), pszmdbackuplocation.into_param().abi(), ::core::mem::transmute(pdwmdversion), ::core::mem::transmute(pftmdbackuptime), ::core::mem::transmute(dwmdenumindex)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn DeleteBackup<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdbackuplocation: Param0, dwmdversion: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).31)(::core::mem::transmute_copy(self), pszmdbackuplocation.into_param().abi(), ::core::mem::transmute(dwmdversion)).ok() } pub unsafe fn UnmarshalInterface(&self) -> ::windows::core::Result<IMSAdminBaseW> { let mut result__: <IMSAdminBaseW as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).32)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IMSAdminBaseW>(result__) } pub unsafe fn GetServerGuid(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).33)(::core::mem::transmute_copy(self)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn BackupWithPasswd<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdbackuplocation: Param0, dwmdversion: u32, dwmdflags: u32, pszpasswd: Param3) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).34)(::core::mem::transmute_copy(self), pszmdbackuplocation.into_param().abi(), ::core::mem::transmute(dwmdversion), ::core::mem::transmute(dwmdflags), pszpasswd.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn RestoreWithPasswd<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdbackuplocation: Param0, dwmdversion: u32, dwmdflags: u32, pszpasswd: Param3) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).35)(::core::mem::transmute_copy(self), pszmdbackuplocation.into_param().abi(), ::core::mem::transmute(dwmdversion), ::core::mem::transmute(dwmdflags), pszpasswd.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Export<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszpasswd: Param0, pszfilename: Param1, pszsourcepath: Param2, dwmdflags: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).36)(::core::mem::transmute_copy(self), pszpasswd.into_param().abi(), pszfilename.into_param().abi(), pszsourcepath.into_param().abi(), ::core::mem::transmute(dwmdflags)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Import<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszpasswd: Param0, pszfilename: Param1, pszsourcepath: Param2, pszdestpath: Param3, dwmdflags: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).37)(::core::mem::transmute_copy(self), pszpasswd.into_param().abi(), pszfilename.into_param().abi(), pszsourcepath.into_param().abi(), pszdestpath.into_param().abi(), ::core::mem::transmute(dwmdflags)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn RestoreHistory<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdhistorylocation: Param0, dwmdmajorversion: u32, dwmdminorversion: u32, dwmdflags: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).38)(::core::mem::transmute_copy(self), pszmdhistorylocation.into_param().abi(), ::core::mem::transmute(dwmdmajorversion), ::core::mem::transmute(dwmdminorversion), ::core::mem::transmute(dwmdflags)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn EnumHistory<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdhistorylocation: Param0, pdwmdmajorversion: *mut u32, pdwmdminorversion: *mut u32, pftmdhistorytime: *mut super::super::Foundation::FILETIME, dwmdenumindex: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).39)(::core::mem::transmute_copy(self), pszmdhistorylocation.into_param().abi(), ::core::mem::transmute(pdwmdmajorversion), ::core::mem::transmute(pdwmdminorversion), ::core::mem::transmute(pftmdhistorytime), ::core::mem::transmute(dwmdenumindex)).ok() } } unsafe impl ::windows::core::Interface for IMSAdminBase2W { type Vtable = IMSAdminBase2W_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8298d101_f992_43b7_8eca_5052d885b995); } impl ::core::convert::From<IMSAdminBase2W> for ::windows::core::IUnknown { fn from(value: IMSAdminBase2W) -> Self { value.0 } } impl ::core::convert::From<&IMSAdminBase2W> for ::windows::core::IUnknown { fn from(value: &IMSAdminBase2W) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMSAdminBase2W { 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 IMSAdminBase2W { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<IMSAdminBase2W> for IMSAdminBaseW { fn from(value: IMSAdminBase2W) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IMSAdminBase2W> for IMSAdminBaseW { fn from(value: &IMSAdminBase2W) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IMSAdminBaseW> for IMSAdminBase2W { fn into_param(self) -> ::windows::core::Param<'a, IMSAdminBaseW> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IMSAdminBaseW> for &IMSAdminBase2W { fn into_param(self) -> ::windows::core::Param<'a, IMSAdminBaseW> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IMSAdminBase2W_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, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pszmdname: super::super::Foundation::PWSTR, dwmdenumobjectindex: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdsourcehandle: u32, pszmdsourcepath: super::super::Foundation::PWSTR, hmddesthandle: u32, pszmddestpath: super::super::Foundation::PWSTR, bmdoverwriteflag: super::super::Foundation::BOOL, bmdcopyflag: super::super::Foundation::BOOL) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pszmdnewname: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pmdrmddata: *mut METADATA_RECORD) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pmdrmddata: *mut METADATA_RECORD, pdwmdrequireddatalen: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, dwmdidentifier: u32, dwmddatatype: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pmdrmddata: *mut METADATA_RECORD, dwmdenumdataindex: u32, pdwmdrequireddatalen: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, dwmdattributes: u32, dwmdusertype: u32, dwmddatatype: u32, pdwmdnumdataentries: *mut u32, pdwmddatasetnumber: *mut u32, dwmdbuffersize: u32, pbmdbuffer: *mut u8, pdwmdrequiredbuffersize: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, dwmdusertype: u32, dwmddatatype: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdsourcehandle: u32, pszmdsourcepath: super::super::Foundation::PWSTR, hmddesthandle: u32, pszmddestpath: super::super::Foundation::PWSTR, dwmdattributes: u32, dwmdusertype: u32, dwmddatatype: u32, bmdcopyflag: super::super::Foundation::BOOL) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, dwmdidentifier: u32, dwmddatatype: u32, dwmdbuffersize: u32, pszbuffer: super::super::Foundation::PWSTR, pdwmdrequiredbuffersize: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, dwmdaccessrequested: u32, dwmdtimeout: u32, phmdnewhandle: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, dwmdtimeout: u32, dwmdaccessrequested: 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, hmdhandle: u32, pmdhiinfo: *mut METADATA_HANDLE_INFO) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pdwsystemchangenumber: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pdwmddatasetnumber: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pftmdlastchangetime: *const super::super::Foundation::FILETIME, blocaltime: super::super::Foundation::BOOL) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pftmdlastchangetime: *mut super::super::Foundation::FILETIME, blocaltime: super::super::Foundation::BOOL) -> ::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) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdbackuplocation: super::super::Foundation::PWSTR, dwmdversion: u32, dwmdflags: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdbackuplocation: super::super::Foundation::PWSTR, dwmdversion: u32, dwmdflags: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdbackuplocation: super::super::Foundation::PWSTR, pdwmdversion: *mut u32, pftmdbackuptime: *mut super::super::Foundation::FILETIME, dwmdenumindex: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdbackuplocation: super::super::Foundation::PWSTR, dwmdversion: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, piadmbwinterface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdbackuplocation: super::super::Foundation::PWSTR, dwmdversion: u32, dwmdflags: u32, pszpasswd: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdbackuplocation: super::super::Foundation::PWSTR, dwmdversion: u32, dwmdflags: u32, pszpasswd: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszpasswd: super::super::Foundation::PWSTR, pszfilename: super::super::Foundation::PWSTR, pszsourcepath: super::super::Foundation::PWSTR, dwmdflags: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszpasswd: super::super::Foundation::PWSTR, pszfilename: super::super::Foundation::PWSTR, pszsourcepath: super::super::Foundation::PWSTR, pszdestpath: super::super::Foundation::PWSTR, dwmdflags: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdhistorylocation: super::super::Foundation::PWSTR, dwmdmajorversion: u32, dwmdminorversion: u32, dwmdflags: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdhistorylocation: super::super::Foundation::PWSTR, pdwmdmajorversion: *mut u32, pdwmdminorversion: *mut u32, pftmdhistorytime: *mut super::super::Foundation::FILETIME, dwmdenumindex: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IMSAdminBase3W(pub ::windows::core::IUnknown); impl IMSAdminBase3W { #[cfg(feature = "Win32_Foundation")] pub unsafe fn AddKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn DeleteKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn DeleteChildKeys<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn EnumKeys<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, pszmdname: super::super::Foundation::PWSTR, dwmdenumobjectindex: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pszmdname), ::core::mem::transmute(dwmdenumobjectindex)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn CopyKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, hmdsourcehandle: u32, pszmdsourcepath: Param1, hmddesthandle: u32, pszmddestpath: Param3, bmdoverwriteflag: Param4, bmdcopyflag: Param5) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdsourcehandle), pszmdsourcepath.into_param().abi(), ::core::mem::transmute(hmddesthandle), pszmddestpath.into_param().abi(), bmdoverwriteflag.into_param().abi(), bmdcopyflag.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn RenameKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, pszmdnewname: Param2) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), pszmdnewname.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, pmdrmddata: *mut METADATA_RECORD) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pmdrmddata)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, pmdrmddata: *mut METADATA_RECORD, pdwmdrequireddatalen: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pmdrmddata), ::core::mem::transmute(pdwmdrequireddatalen)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn DeleteData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, dwmdidentifier: u32, dwmddatatype: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(dwmdidentifier), ::core::mem::transmute(dwmddatatype)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn EnumData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, pmdrmddata: *mut METADATA_RECORD, dwmdenumdataindex: u32, pdwmdrequireddatalen: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pmdrmddata), ::core::mem::transmute(dwmdenumdataindex), ::core::mem::transmute(pdwmdrequireddatalen)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetAllData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, dwmdattributes: u32, dwmdusertype: u32, dwmddatatype: u32, pdwmdnumdataentries: *mut u32, pdwmddatasetnumber: *mut u32, dwmdbuffersize: u32, pbmdbuffer: *mut u8, pdwmdrequiredbuffersize: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).13)( ::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(dwmdattributes), ::core::mem::transmute(dwmdusertype), ::core::mem::transmute(dwmddatatype), ::core::mem::transmute(pdwmdnumdataentries), ::core::mem::transmute(pdwmddatasetnumber), ::core::mem::transmute(dwmdbuffersize), ::core::mem::transmute(pbmdbuffer), ::core::mem::transmute(pdwmdrequiredbuffersize), ) .ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn DeleteAllData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, dwmdusertype: u32, dwmddatatype: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(dwmdusertype), ::core::mem::transmute(dwmddatatype)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn CopyData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param7: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, hmdsourcehandle: u32, pszmdsourcepath: Param1, hmddesthandle: u32, pszmddestpath: Param3, dwmdattributes: u32, dwmdusertype: u32, dwmddatatype: u32, bmdcopyflag: Param7) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).15)( ::core::mem::transmute_copy(self), ::core::mem::transmute(hmdsourcehandle), pszmdsourcepath.into_param().abi(), ::core::mem::transmute(hmddesthandle), pszmddestpath.into_param().abi(), ::core::mem::transmute(dwmdattributes), ::core::mem::transmute(dwmdusertype), ::core::mem::transmute(dwmddatatype), bmdcopyflag.into_param().abi(), ) .ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetDataPaths<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, dwmdidentifier: u32, dwmddatatype: u32, dwmdbuffersize: u32, pszbuffer: super::super::Foundation::PWSTR, pdwmdrequiredbuffersize: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(dwmdidentifier), ::core::mem::transmute(dwmddatatype), ::core::mem::transmute(dwmdbuffersize), ::core::mem::transmute(pszbuffer), ::core::mem::transmute(pdwmdrequiredbuffersize)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn OpenKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, dwmdaccessrequested: u32, dwmdtimeout: u32) -> ::windows::core::Result<u32> { let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(dwmdaccessrequested), ::core::mem::transmute(dwmdtimeout), &mut result__).from_abi::<u32>(result__) } pub unsafe fn CloseKey(&self, hmdhandle: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle)).ok() } pub unsafe fn ChangePermissions(&self, hmdhandle: u32, dwmdtimeout: u32, dwmdaccessrequested: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), ::core::mem::transmute(dwmdtimeout), ::core::mem::transmute(dwmdaccessrequested)).ok() } pub unsafe fn SaveData(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn GetHandleInfo(&self, hmdhandle: u32) -> ::windows::core::Result<METADATA_HANDLE_INFO> { let mut result__: <METADATA_HANDLE_INFO as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).21)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), &mut result__).from_abi::<METADATA_HANDLE_INFO>(result__) } pub unsafe fn GetSystemChangeNumber(&self) -> ::windows::core::Result<u32> { let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).22)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetDataSetNumber<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1) -> ::windows::core::Result<u32> { let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).23)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), &mut result__).from_abi::<u32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetLastChangeTime<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, hmdhandle: u32, pszmdpath: Param1, pftmdlastchangetime: *const super::super::Foundation::FILETIME, blocaltime: Param3) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).24)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pftmdlastchangetime), blocaltime.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetLastChangeTime<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, hmdhandle: u32, pszmdpath: Param1, pftmdlastchangetime: *mut super::super::Foundation::FILETIME, blocaltime: Param3) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).25)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pftmdlastchangetime), blocaltime.into_param().abi()).ok() } pub unsafe fn KeyExchangePhase1(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).26)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn KeyExchangePhase2(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).27)(::core::mem::transmute_copy(self)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Backup<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdbackuplocation: Param0, dwmdversion: u32, dwmdflags: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).28)(::core::mem::transmute_copy(self), pszmdbackuplocation.into_param().abi(), ::core::mem::transmute(dwmdversion), ::core::mem::transmute(dwmdflags)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Restore<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdbackuplocation: Param0, dwmdversion: u32, dwmdflags: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).29)(::core::mem::transmute_copy(self), pszmdbackuplocation.into_param().abi(), ::core::mem::transmute(dwmdversion), ::core::mem::transmute(dwmdflags)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn EnumBackups<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdbackuplocation: Param0, pdwmdversion: *mut u32, pftmdbackuptime: *mut super::super::Foundation::FILETIME, dwmdenumindex: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).30)(::core::mem::transmute_copy(self), pszmdbackuplocation.into_param().abi(), ::core::mem::transmute(pdwmdversion), ::core::mem::transmute(pftmdbackuptime), ::core::mem::transmute(dwmdenumindex)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn DeleteBackup<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdbackuplocation: Param0, dwmdversion: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).31)(::core::mem::transmute_copy(self), pszmdbackuplocation.into_param().abi(), ::core::mem::transmute(dwmdversion)).ok() } pub unsafe fn UnmarshalInterface(&self) -> ::windows::core::Result<IMSAdminBaseW> { let mut result__: <IMSAdminBaseW as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).32)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IMSAdminBaseW>(result__) } pub unsafe fn GetServerGuid(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).33)(::core::mem::transmute_copy(self)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn BackupWithPasswd<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdbackuplocation: Param0, dwmdversion: u32, dwmdflags: u32, pszpasswd: Param3) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).34)(::core::mem::transmute_copy(self), pszmdbackuplocation.into_param().abi(), ::core::mem::transmute(dwmdversion), ::core::mem::transmute(dwmdflags), pszpasswd.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn RestoreWithPasswd<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdbackuplocation: Param0, dwmdversion: u32, dwmdflags: u32, pszpasswd: Param3) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).35)(::core::mem::transmute_copy(self), pszmdbackuplocation.into_param().abi(), ::core::mem::transmute(dwmdversion), ::core::mem::transmute(dwmdflags), pszpasswd.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Export<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszpasswd: Param0, pszfilename: Param1, pszsourcepath: Param2, dwmdflags: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).36)(::core::mem::transmute_copy(self), pszpasswd.into_param().abi(), pszfilename.into_param().abi(), pszsourcepath.into_param().abi(), ::core::mem::transmute(dwmdflags)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Import<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszpasswd: Param0, pszfilename: Param1, pszsourcepath: Param2, pszdestpath: Param3, dwmdflags: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).37)(::core::mem::transmute_copy(self), pszpasswd.into_param().abi(), pszfilename.into_param().abi(), pszsourcepath.into_param().abi(), pszdestpath.into_param().abi(), ::core::mem::transmute(dwmdflags)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn RestoreHistory<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdhistorylocation: Param0, dwmdmajorversion: u32, dwmdminorversion: u32, dwmdflags: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).38)(::core::mem::transmute_copy(self), pszmdhistorylocation.into_param().abi(), ::core::mem::transmute(dwmdmajorversion), ::core::mem::transmute(dwmdminorversion), ::core::mem::transmute(dwmdflags)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn EnumHistory<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdhistorylocation: Param0, pdwmdmajorversion: *mut u32, pdwmdminorversion: *mut u32, pftmdhistorytime: *mut super::super::Foundation::FILETIME, dwmdenumindex: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).39)(::core::mem::transmute_copy(self), pszmdhistorylocation.into_param().abi(), ::core::mem::transmute(pdwmdmajorversion), ::core::mem::transmute(pdwmdminorversion), ::core::mem::transmute(pftmdhistorytime), ::core::mem::transmute(dwmdenumindex)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetChildPaths<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, cchmdbuffersize: u32, pszbuffer: Param3, pcchmdrequiredbuffersize: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).40)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(cchmdbuffersize), pszbuffer.into_param().abi(), ::core::mem::transmute(pcchmdrequiredbuffersize)).ok() } } unsafe impl ::windows::core::Interface for IMSAdminBase3W { type Vtable = IMSAdminBase3W_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf612954d_3b0b_4c56_9563_227b7be624b4); } impl ::core::convert::From<IMSAdminBase3W> for ::windows::core::IUnknown { fn from(value: IMSAdminBase3W) -> Self { value.0 } } impl ::core::convert::From<&IMSAdminBase3W> for ::windows::core::IUnknown { fn from(value: &IMSAdminBase3W) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMSAdminBase3W { 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 IMSAdminBase3W { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<IMSAdminBase3W> for IMSAdminBase2W { fn from(value: IMSAdminBase3W) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IMSAdminBase3W> for IMSAdminBase2W { fn from(value: &IMSAdminBase3W) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IMSAdminBase2W> for IMSAdminBase3W { fn into_param(self) -> ::windows::core::Param<'a, IMSAdminBase2W> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IMSAdminBase2W> for &IMSAdminBase3W { fn into_param(self) -> ::windows::core::Param<'a, IMSAdminBase2W> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } impl ::core::convert::From<IMSAdminBase3W> for IMSAdminBaseW { fn from(value: IMSAdminBase3W) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&IMSAdminBase3W> for IMSAdminBaseW { fn from(value: &IMSAdminBase3W) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IMSAdminBaseW> for IMSAdminBase3W { fn into_param(self) -> ::windows::core::Param<'a, IMSAdminBaseW> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IMSAdminBaseW> for &IMSAdminBase3W { fn into_param(self) -> ::windows::core::Param<'a, IMSAdminBaseW> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[repr(C)] #[doc(hidden)] pub struct IMSAdminBase3W_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, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pszmdname: super::super::Foundation::PWSTR, dwmdenumobjectindex: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdsourcehandle: u32, pszmdsourcepath: super::super::Foundation::PWSTR, hmddesthandle: u32, pszmddestpath: super::super::Foundation::PWSTR, bmdoverwriteflag: super::super::Foundation::BOOL, bmdcopyflag: super::super::Foundation::BOOL) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pszmdnewname: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pmdrmddata: *mut METADATA_RECORD) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pmdrmddata: *mut METADATA_RECORD, pdwmdrequireddatalen: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, dwmdidentifier: u32, dwmddatatype: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pmdrmddata: *mut METADATA_RECORD, dwmdenumdataindex: u32, pdwmdrequireddatalen: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, dwmdattributes: u32, dwmdusertype: u32, dwmddatatype: u32, pdwmdnumdataentries: *mut u32, pdwmddatasetnumber: *mut u32, dwmdbuffersize: u32, pbmdbuffer: *mut u8, pdwmdrequiredbuffersize: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, dwmdusertype: u32, dwmddatatype: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdsourcehandle: u32, pszmdsourcepath: super::super::Foundation::PWSTR, hmddesthandle: u32, pszmddestpath: super::super::Foundation::PWSTR, dwmdattributes: u32, dwmdusertype: u32, dwmddatatype: u32, bmdcopyflag: super::super::Foundation::BOOL) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, dwmdidentifier: u32, dwmddatatype: u32, dwmdbuffersize: u32, pszbuffer: super::super::Foundation::PWSTR, pdwmdrequiredbuffersize: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, dwmdaccessrequested: u32, dwmdtimeout: u32, phmdnewhandle: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, dwmdtimeout: u32, dwmdaccessrequested: 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, hmdhandle: u32, pmdhiinfo: *mut METADATA_HANDLE_INFO) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pdwsystemchangenumber: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pdwmddatasetnumber: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pftmdlastchangetime: *const super::super::Foundation::FILETIME, blocaltime: super::super::Foundation::BOOL) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pftmdlastchangetime: *mut super::super::Foundation::FILETIME, blocaltime: super::super::Foundation::BOOL) -> ::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) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdbackuplocation: super::super::Foundation::PWSTR, dwmdversion: u32, dwmdflags: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdbackuplocation: super::super::Foundation::PWSTR, dwmdversion: u32, dwmdflags: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdbackuplocation: super::super::Foundation::PWSTR, pdwmdversion: *mut u32, pftmdbackuptime: *mut super::super::Foundation::FILETIME, dwmdenumindex: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdbackuplocation: super::super::Foundation::PWSTR, dwmdversion: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, piadmbwinterface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdbackuplocation: super::super::Foundation::PWSTR, dwmdversion: u32, dwmdflags: u32, pszpasswd: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdbackuplocation: super::super::Foundation::PWSTR, dwmdversion: u32, dwmdflags: u32, pszpasswd: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszpasswd: super::super::Foundation::PWSTR, pszfilename: super::super::Foundation::PWSTR, pszsourcepath: super::super::Foundation::PWSTR, dwmdflags: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszpasswd: super::super::Foundation::PWSTR, pszfilename: super::super::Foundation::PWSTR, pszsourcepath: super::super::Foundation::PWSTR, pszdestpath: super::super::Foundation::PWSTR, dwmdflags: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdhistorylocation: super::super::Foundation::PWSTR, dwmdmajorversion: u32, dwmdminorversion: u32, dwmdflags: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdhistorylocation: super::super::Foundation::PWSTR, pdwmdmajorversion: *mut u32, pdwmdminorversion: *mut u32, pftmdhistorytime: *mut super::super::Foundation::FILETIME, dwmdenumindex: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, cchmdbuffersize: u32, pszbuffer: super::super::Foundation::PWSTR, pcchmdrequiredbuffersize: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IMSAdminBaseSinkW(pub ::windows::core::IUnknown); impl IMSAdminBaseSinkW { #[cfg(feature = "Win32_Foundation")] pub unsafe fn SinkNotify(&self, dwmdnumelements: u32, pcochangelist: *const MD_CHANGE_OBJECT_W) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(dwmdnumelements), ::core::mem::transmute(pcochangelist)).ok() } pub unsafe fn ShutdownNotify(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self)).ok() } } unsafe impl ::windows::core::Interface for IMSAdminBaseSinkW { type Vtable = IMSAdminBaseSinkW_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa9e69612_b80d_11d0_b9b9_00a0c922e750); } impl ::core::convert::From<IMSAdminBaseSinkW> for ::windows::core::IUnknown { fn from(value: IMSAdminBaseSinkW) -> Self { value.0 } } impl ::core::convert::From<&IMSAdminBaseSinkW> for ::windows::core::IUnknown { fn from(value: &IMSAdminBaseSinkW) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMSAdminBaseSinkW { 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 IMSAdminBaseSinkW { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IMSAdminBaseSinkW_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, dwmdnumelements: u32, pcochangelist: *const MD_CHANGE_OBJECT_W) -> ::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 IMSAdminBaseW(pub ::windows::core::IUnknown); impl IMSAdminBaseW { #[cfg(feature = "Win32_Foundation")] pub unsafe fn AddKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn DeleteKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).4)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn DeleteChildKeys<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).5)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn EnumKeys<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, pszmdname: super::super::Foundation::PWSTR, dwmdenumobjectindex: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).6)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pszmdname), ::core::mem::transmute(dwmdenumobjectindex)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn CopyKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, hmdsourcehandle: u32, pszmdsourcepath: Param1, hmddesthandle: u32, pszmddestpath: Param3, bmdoverwriteflag: Param4, bmdcopyflag: Param5) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).7)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdsourcehandle), pszmdsourcepath.into_param().abi(), ::core::mem::transmute(hmddesthandle), pszmddestpath.into_param().abi(), bmdoverwriteflag.into_param().abi(), bmdcopyflag.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn RenameKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, pszmdnewname: Param2) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).8)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), pszmdnewname.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, pmdrmddata: *mut METADATA_RECORD) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).9)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pmdrmddata)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, pmdrmddata: *mut METADATA_RECORD, pdwmdrequireddatalen: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).10)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pmdrmddata), ::core::mem::transmute(pdwmdrequireddatalen)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn DeleteData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, dwmdidentifier: u32, dwmddatatype: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).11)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(dwmdidentifier), ::core::mem::transmute(dwmddatatype)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn EnumData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, pmdrmddata: *mut METADATA_RECORD, dwmdenumdataindex: u32, pdwmdrequireddatalen: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).12)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pmdrmddata), ::core::mem::transmute(dwmdenumdataindex), ::core::mem::transmute(pdwmdrequireddatalen)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetAllData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, dwmdattributes: u32, dwmdusertype: u32, dwmddatatype: u32, pdwmdnumdataentries: *mut u32, pdwmddatasetnumber: *mut u32, dwmdbuffersize: u32, pbmdbuffer: *mut u8, pdwmdrequiredbuffersize: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).13)( ::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(dwmdattributes), ::core::mem::transmute(dwmdusertype), ::core::mem::transmute(dwmddatatype), ::core::mem::transmute(pdwmdnumdataentries), ::core::mem::transmute(pdwmddatasetnumber), ::core::mem::transmute(dwmdbuffersize), ::core::mem::transmute(pbmdbuffer), ::core::mem::transmute(pdwmdrequiredbuffersize), ) .ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn DeleteAllData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, dwmdusertype: u32, dwmddatatype: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).14)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(dwmdusertype), ::core::mem::transmute(dwmddatatype)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn CopyData<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param7: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, hmdsourcehandle: u32, pszmdsourcepath: Param1, hmddesthandle: u32, pszmddestpath: Param3, dwmdattributes: u32, dwmdusertype: u32, dwmddatatype: u32, bmdcopyflag: Param7) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).15)( ::core::mem::transmute_copy(self), ::core::mem::transmute(hmdsourcehandle), pszmdsourcepath.into_param().abi(), ::core::mem::transmute(hmddesthandle), pszmddestpath.into_param().abi(), ::core::mem::transmute(dwmdattributes), ::core::mem::transmute(dwmdusertype), ::core::mem::transmute(dwmddatatype), bmdcopyflag.into_param().abi(), ) .ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetDataPaths<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, dwmdidentifier: u32, dwmddatatype: u32, dwmdbuffersize: u32, pszbuffer: super::super::Foundation::PWSTR, pdwmdrequiredbuffersize: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).16)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(dwmdidentifier), ::core::mem::transmute(dwmddatatype), ::core::mem::transmute(dwmdbuffersize), ::core::mem::transmute(pszbuffer), ::core::mem::transmute(pdwmdrequiredbuffersize)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn OpenKey<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1, dwmdaccessrequested: u32, dwmdtimeout: u32) -> ::windows::core::Result<u32> { let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).17)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(dwmdaccessrequested), ::core::mem::transmute(dwmdtimeout), &mut result__).from_abi::<u32>(result__) } pub unsafe fn CloseKey(&self, hmdhandle: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).18)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle)).ok() } pub unsafe fn ChangePermissions(&self, hmdhandle: u32, dwmdtimeout: u32, dwmdaccessrequested: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).19)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), ::core::mem::transmute(dwmdtimeout), ::core::mem::transmute(dwmdaccessrequested)).ok() } pub unsafe fn SaveData(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).20)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn GetHandleInfo(&self, hmdhandle: u32) -> ::windows::core::Result<METADATA_HANDLE_INFO> { let mut result__: <METADATA_HANDLE_INFO as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).21)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), &mut result__).from_abi::<METADATA_HANDLE_INFO>(result__) } pub unsafe fn GetSystemChangeNumber(&self) -> ::windows::core::Result<u32> { let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).22)(::core::mem::transmute_copy(self), &mut result__).from_abi::<u32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetDataSetNumber<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, hmdhandle: u32, pszmdpath: Param1) -> ::windows::core::Result<u32> { let mut result__: <u32 as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).23)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), &mut result__).from_abi::<u32>(result__) } #[cfg(feature = "Win32_Foundation")] pub unsafe fn SetLastChangeTime<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, hmdhandle: u32, pszmdpath: Param1, pftmdlastchangetime: *const super::super::Foundation::FILETIME, blocaltime: Param3) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).24)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pftmdlastchangetime), blocaltime.into_param().abi()).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn GetLastChangeTime<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(&self, hmdhandle: u32, pszmdpath: Param1, pftmdlastchangetime: *mut super::super::Foundation::FILETIME, blocaltime: Param3) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).25)(::core::mem::transmute_copy(self), ::core::mem::transmute(hmdhandle), pszmdpath.into_param().abi(), ::core::mem::transmute(pftmdlastchangetime), blocaltime.into_param().abi()).ok() } pub unsafe fn KeyExchangePhase1(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).26)(::core::mem::transmute_copy(self)).ok() } pub unsafe fn KeyExchangePhase2(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).27)(::core::mem::transmute_copy(self)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Backup<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdbackuplocation: Param0, dwmdversion: u32, dwmdflags: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).28)(::core::mem::transmute_copy(self), pszmdbackuplocation.into_param().abi(), ::core::mem::transmute(dwmdversion), ::core::mem::transmute(dwmdflags)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn Restore<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdbackuplocation: Param0, dwmdversion: u32, dwmdflags: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).29)(::core::mem::transmute_copy(self), pszmdbackuplocation.into_param().abi(), ::core::mem::transmute(dwmdversion), ::core::mem::transmute(dwmdflags)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn EnumBackups<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdbackuplocation: Param0, pdwmdversion: *mut u32, pftmdbackuptime: *mut super::super::Foundation::FILETIME, dwmdenumindex: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).30)(::core::mem::transmute_copy(self), pszmdbackuplocation.into_param().abi(), ::core::mem::transmute(pdwmdversion), ::core::mem::transmute(pftmdbackuptime), ::core::mem::transmute(dwmdenumindex)).ok() } #[cfg(feature = "Win32_Foundation")] pub unsafe fn DeleteBackup<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszmdbackuplocation: Param0, dwmdversion: u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).31)(::core::mem::transmute_copy(self), pszmdbackuplocation.into_param().abi(), ::core::mem::transmute(dwmdversion)).ok() } pub unsafe fn UnmarshalInterface(&self) -> ::windows::core::Result<IMSAdminBaseW> { let mut result__: <IMSAdminBaseW as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); (::windows::core::Interface::vtable(self).32)(::core::mem::transmute_copy(self), &mut result__).from_abi::<IMSAdminBaseW>(result__) } pub unsafe fn GetServerGuid(&self) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).33)(::core::mem::transmute_copy(self)).ok() } } unsafe impl ::windows::core::Interface for IMSAdminBaseW { type Vtable = IMSAdminBaseW_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x70b51430_b6ca_11d0_b9b9_00a0c922e750); } impl ::core::convert::From<IMSAdminBaseW> for ::windows::core::IUnknown { fn from(value: IMSAdminBaseW) -> Self { value.0 } } impl ::core::convert::From<&IMSAdminBaseW> for ::windows::core::IUnknown { fn from(value: &IMSAdminBaseW) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMSAdminBaseW { 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 IMSAdminBaseW { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IMSAdminBaseW_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, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pszmdname: super::super::Foundation::PWSTR, dwmdenumobjectindex: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdsourcehandle: u32, pszmdsourcepath: super::super::Foundation::PWSTR, hmddesthandle: u32, pszmddestpath: super::super::Foundation::PWSTR, bmdoverwriteflag: super::super::Foundation::BOOL, bmdcopyflag: super::super::Foundation::BOOL) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pszmdnewname: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pmdrmddata: *mut METADATA_RECORD) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pmdrmddata: *mut METADATA_RECORD, pdwmdrequireddatalen: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, dwmdidentifier: u32, dwmddatatype: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pmdrmddata: *mut METADATA_RECORD, dwmdenumdataindex: u32, pdwmdrequireddatalen: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, dwmdattributes: u32, dwmdusertype: u32, dwmddatatype: u32, pdwmdnumdataentries: *mut u32, pdwmddatasetnumber: *mut u32, dwmdbuffersize: u32, pbmdbuffer: *mut u8, pdwmdrequiredbuffersize: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, dwmdusertype: u32, dwmddatatype: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdsourcehandle: u32, pszmdsourcepath: super::super::Foundation::PWSTR, hmddesthandle: u32, pszmddestpath: super::super::Foundation::PWSTR, dwmdattributes: u32, dwmdusertype: u32, dwmddatatype: u32, bmdcopyflag: super::super::Foundation::BOOL) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, dwmdidentifier: u32, dwmddatatype: u32, dwmdbuffersize: u32, pszbuffer: super::super::Foundation::PWSTR, pdwmdrequiredbuffersize: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, dwmdaccessrequested: u32, dwmdtimeout: u32, phmdnewhandle: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, dwmdtimeout: u32, dwmdaccessrequested: 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, hmdhandle: u32, pmdhiinfo: *mut METADATA_HANDLE_INFO) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pdwsystemchangenumber: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pdwmddatasetnumber: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pftmdlastchangetime: *const super::super::Foundation::FILETIME, blocaltime: super::super::Foundation::BOOL) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hmdhandle: u32, pszmdpath: super::super::Foundation::PWSTR, pftmdlastchangetime: *mut super::super::Foundation::FILETIME, blocaltime: super::super::Foundation::BOOL) -> ::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) -> ::windows::core::HRESULT, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdbackuplocation: super::super::Foundation::PWSTR, dwmdversion: u32, dwmdflags: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdbackuplocation: super::super::Foundation::PWSTR, dwmdversion: u32, dwmdflags: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdbackuplocation: super::super::Foundation::PWSTR, pdwmdversion: *mut u32, pftmdbackuptime: *mut super::super::Foundation::FILETIME, dwmdenumindex: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, #[cfg(feature = "Win32_Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, pszmdbackuplocation: super::super::Foundation::PWSTR, dwmdversion: u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, piadmbwinterface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IMSImpExpHelpW(pub ::windows::core::IUnknown); impl IMSImpExpHelpW { #[cfg(feature = "Win32_Foundation")] pub unsafe fn EnumeratePathsInFile<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(&self, pszfilename: Param0, pszkeytype: Param1, dwmdbuffersize: u32, pszbuffer: Param3, pdwmdrequiredbuffersize: *mut u32) -> ::windows::core::Result<()> { (::windows::core::Interface::vtable(self).3)(::core::mem::transmute_copy(self), pszfilename.into_param().abi(), pszkeytype.into_param().abi(), ::core::mem::transmute(dwmdbuffersize), pszbuffer.into_param().abi(), ::core::mem::transmute(pdwmdrequiredbuffersize)).ok() } } unsafe impl ::windows::core::Interface for IMSImpExpHelpW { type Vtable = IMSImpExpHelpW_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x29ff67ff_8050_480f_9f30_cc41635f2f9d); } impl ::core::convert::From<IMSImpExpHelpW> for ::windows::core::IUnknown { fn from(value: IMSImpExpHelpW) -> Self { value.0 } } impl ::core::convert::From<&IMSImpExpHelpW> for ::windows::core::IUnknown { fn from(value: &IMSImpExpHelpW) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMSImpExpHelpW { 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 IMSImpExpHelpW { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IMSImpExpHelpW_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, pszfilename: super::super::Foundation::PWSTR, pszkeytype: super::super::Foundation::PWSTR, dwmdbuffersize: u32, pszbuffer: super::super::Foundation::PWSTR, pdwmdrequiredbuffersize: *mut u32) -> ::windows::core::HRESULT, #[cfg(not(feature = "Win32_Foundation"))] usize, ); pub const LIBID_ASPTypeLibrary: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd97a6da0_a85c_11cf_83ae_00a0c90c2bd8); pub const LIBID_IISRSTALib: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe8fb8614_588f_11d2_9d61_00c04f79c5fe); pub const LIBID_WAMREGLib: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x29822aa8_f302_11d0_9953_00c04fd919c1); #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct LOGGING_PARAMETERS { pub pszSessionId: super::super::Foundation::PWSTR, pub pszSiteName: super::super::Foundation::PWSTR, pub pszUserName: super::super::Foundation::PWSTR, pub pszHostName: super::super::Foundation::PWSTR, pub pszRemoteIpAddress: super::super::Foundation::PWSTR, pub dwRemoteIpPort: u32, pub pszLocalIpAddress: super::super::Foundation::PWSTR, pub dwLocalIpPort: u32, pub BytesSent: u64, pub BytesReceived: u64, pub pszCommand: super::super::Foundation::PWSTR, pub pszCommandParameters: super::super::Foundation::PWSTR, pub pszFullPath: super::super::Foundation::PWSTR, pub dwElapsedMilliseconds: u32, pub FtpStatus: u32, pub FtpSubStatus: u32, pub hrStatus: ::windows::core::HRESULT, pub pszInformation: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl LOGGING_PARAMETERS {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for LOGGING_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for LOGGING_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("LOGGING_PARAMETERS") .field("pszSessionId", &self.pszSessionId) .field("pszSiteName", &self.pszSiteName) .field("pszUserName", &self.pszUserName) .field("pszHostName", &self.pszHostName) .field("pszRemoteIpAddress", &self.pszRemoteIpAddress) .field("dwRemoteIpPort", &self.dwRemoteIpPort) .field("pszLocalIpAddress", &self.pszLocalIpAddress) .field("dwLocalIpPort", &self.dwLocalIpPort) .field("BytesSent", &self.BytesSent) .field("BytesReceived", &self.BytesReceived) .field("pszCommand", &self.pszCommand) .field("pszCommandParameters", &self.pszCommandParameters) .field("pszFullPath", &self.pszFullPath) .field("dwElapsedMilliseconds", &self.dwElapsedMilliseconds) .field("FtpStatus", &self.FtpStatus) .field("FtpSubStatus", &self.FtpSubStatus) .field("hrStatus", &self.hrStatus) .field("pszInformation", &self.pszInformation) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for LOGGING_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.pszSessionId == other.pszSessionId && self.pszSiteName == other.pszSiteName && self.pszUserName == other.pszUserName && self.pszHostName == other.pszHostName && self.pszRemoteIpAddress == other.pszRemoteIpAddress && self.dwRemoteIpPort == other.dwRemoteIpPort && self.pszLocalIpAddress == other.pszLocalIpAddress && self.dwLocalIpPort == other.dwLocalIpPort && self.BytesSent == other.BytesSent && self.BytesReceived == other.BytesReceived && self.pszCommand == other.pszCommand && self.pszCommandParameters == other.pszCommandParameters && self.pszFullPath == other.pszFullPath && self.dwElapsedMilliseconds == other.dwElapsedMilliseconds && self.FtpStatus == other.FtpStatus && self.FtpSubStatus == other.FtpSubStatus && self.hrStatus == other.hrStatus && self.pszInformation == other.pszInformation } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for LOGGING_PARAMETERS {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for LOGGING_PARAMETERS { type Abi = Self; } pub const MB_DONT_IMPERSONATE: u32 = 9033u32; pub const MD_ACCESS_EXECUTE: u32 = 4u32; pub const MD_ACCESS_MAP_CERT: u32 = 128u32; pub const MD_ACCESS_MASK: u32 = 65535u32; pub const MD_ACCESS_NEGO_CERT: u32 = 32u32; pub const MD_ACCESS_NO_PHYSICAL_DIR: u32 = 32768u32; pub const MD_ACCESS_NO_REMOTE_EXECUTE: u32 = 8192u32; pub const MD_ACCESS_NO_REMOTE_READ: u32 = 4096u32; pub const MD_ACCESS_NO_REMOTE_SCRIPT: u32 = 16384u32; pub const MD_ACCESS_NO_REMOTE_WRITE: u32 = 1024u32; pub const MD_ACCESS_PERM: u32 = 6016u32; pub const MD_ACCESS_READ: u32 = 1u32; pub const MD_ACCESS_REQUIRE_CERT: u32 = 64u32; pub const MD_ACCESS_SCRIPT: u32 = 512u32; pub const MD_ACCESS_SOURCE: u32 = 16u32; pub const MD_ACCESS_SSL: u32 = 8u32; pub const MD_ACCESS_SSL128: u32 = 256u32; pub const MD_ACCESS_WRITE: u32 = 2u32; pub const MD_ACR_ENUM_KEYS: u32 = 8u32; pub const MD_ACR_READ: u32 = 1u32; pub const MD_ACR_RESTRICTED_WRITE: u32 = 32u32; pub const MD_ACR_UNSECURE_PROPS_READ: u32 = 128u32; pub const MD_ACR_WRITE: u32 = 2u32; pub const MD_ACR_WRITE_DAC: u32 = 262144u32; pub const MD_ADMIN_ACL: u32 = 6027u32; pub const MD_ADMIN_INSTANCE: u32 = 2115u32; pub const MD_ADV_CACHE_TTL: u32 = 2064u32; pub const MD_ADV_NOTIFY_PWD_EXP_IN_DAYS: u32 = 2063u32; pub const MD_AD_CONNECTIONS_PASSWORD: u32 = 5015u32; pub const MD_AD_CONNECTIONS_USERNAME: u32 = 5014u32; pub const MD_ALLOW_ANONYMOUS: u32 = 5005u32; pub const MD_ALLOW_KEEPALIVES: u32 = 6038u32; pub const MD_ALLOW_PATH_INFO_FOR_SCRIPT_MAPPINGS: u32 = 2095u32; pub const MD_ALLOW_REPLACE_ON_RENAME: u32 = 5009u32; pub const MD_ANONYMOUS_ONLY: u32 = 5006u32; pub const MD_ANONYMOUS_PWD: u32 = 6021u32; pub const MD_ANONYMOUS_USER_NAME: u32 = 6020u32; pub const MD_ANONYMOUS_USE_SUBAUTH: u32 = 6022u32; pub const MD_APPPOOL_32_BIT_APP_ON_WIN64: u32 = 9040u32; pub const MD_APPPOOL_ALLOW_TRANSIENT_REGISTRATION: u32 = 9202u32; pub const MD_APPPOOL_APPPOOL_ID: u32 = 9201u32; pub const MD_APPPOOL_AUTO_SHUTDOWN_EXE: u32 = 9035u32; pub const MD_APPPOOL_AUTO_SHUTDOWN_PARAMS: u32 = 9036u32; pub const MD_APPPOOL_AUTO_START: u32 = 9028u32; pub const MD_APPPOOL_COMMAND: u32 = 9026u32; pub const MD_APPPOOL_COMMAND_START: u32 = 1u32; pub const MD_APPPOOL_COMMAND_STOP: u32 = 2u32; pub const MD_APPPOOL_DISALLOW_OVERLAPPING_ROTATION: u32 = 9015u32; pub const MD_APPPOOL_DISALLOW_ROTATION_ON_CONFIG_CHANGE: u32 = 9018u32; pub const MD_APPPOOL_IDENTITY_TYPE: u32 = 9021u32; pub const MD_APPPOOL_IDENTITY_TYPE_LOCALSERVICE: u32 = 1u32; pub const MD_APPPOOL_IDENTITY_TYPE_LOCALSYSTEM: u32 = 0u32; pub const MD_APPPOOL_IDENTITY_TYPE_NETWORKSERVICE: u32 = 2u32; pub const MD_APPPOOL_IDENTITY_TYPE_SPECIFICUSER: u32 = 3u32; pub const MD_APPPOOL_IDLE_TIMEOUT: u32 = 9005u32; pub const MD_APPPOOL_MANAGED_PIPELINE_MODE: u32 = 9041u32; pub const MD_APPPOOL_MANAGED_RUNTIME_VERSION: u32 = 9039u32; pub const MD_APPPOOL_MAX_PROCESS_COUNT: u32 = 9003u32; pub const MD_APPPOOL_ORPHAN_ACTION_EXE: u32 = 9031u32; pub const MD_APPPOOL_ORPHAN_ACTION_PARAMS: u32 = 9032u32; pub const MD_APPPOOL_ORPHAN_PROCESSES_FOR_DEBUGGING: u32 = 9009u32; pub const MD_APPPOOL_PERIODIC_RESTART_CONNECTIONS: u32 = 9104u32; pub const MD_APPPOOL_PERIODIC_RESTART_MEMORY: u32 = 9024u32; pub const MD_APPPOOL_PERIODIC_RESTART_PRIVATE_MEMORY: u32 = 9038u32; pub const MD_APPPOOL_PERIODIC_RESTART_REQUEST_COUNT: u32 = 9002u32; pub const MD_APPPOOL_PERIODIC_RESTART_SCHEDULE: u32 = 9020u32; pub const MD_APPPOOL_PERIODIC_RESTART_TIME: u32 = 9001u32; pub const MD_APPPOOL_PINGING_ENABLED: u32 = 9004u32; pub const MD_APPPOOL_PING_INTERVAL: u32 = 9013u32; pub const MD_APPPOOL_PING_RESPONSE_TIMELIMIT: u32 = 9014u32; pub const MD_APPPOOL_RAPID_FAIL_PROTECTION_ENABLED: u32 = 9006u32; pub const MD_APPPOOL_SHUTDOWN_TIMELIMIT: u32 = 9012u32; pub const MD_APPPOOL_SMP_AFFINITIZED: u32 = 9007u32; pub const MD_APPPOOL_SMP_AFFINITIZED_PROCESSOR_MASK: u32 = 9008u32; pub const MD_APPPOOL_STARTUP_TIMELIMIT: u32 = 9011u32; pub const MD_APPPOOL_STATE: u32 = 9027u32; pub const MD_APPPOOL_STATE_STARTED: u32 = 2u32; pub const MD_APPPOOL_STATE_STARTING: u32 = 1u32; pub const MD_APPPOOL_STATE_STOPPED: u32 = 4u32; pub const MD_APPPOOL_STATE_STOPPING: u32 = 3u32; pub const MD_APPPOOL_UL_APPPOOL_QUEUE_LENGTH: u32 = 9017u32; pub const MD_APP_ALLOW_TRANSIENT_REGISTRATION: u32 = 9102u32; pub const MD_APP_APPPOOL_ID: u32 = 9101u32; pub const MD_APP_AUTO_START: u32 = 9103u32; pub const MD_APP_DEPENDENCIES: u32 = 2167u32; pub const MD_APP_FRIENDLY_NAME: u32 = 2102u32; pub const MD_APP_ISOLATED: u32 = 2104u32; pub const MD_APP_OOP_RECOVER_LIMIT: u32 = 2110u32; pub const MD_APP_PACKAGE_ID: u32 = 2106u32; pub const MD_APP_PACKAGE_NAME: u32 = 2107u32; pub const MD_APP_PERIODIC_RESTART_REQUESTS: u32 = 2112u32; pub const MD_APP_PERIODIC_RESTART_SCHEDULE: u32 = 2113u32; pub const MD_APP_PERIODIC_RESTART_TIME: u32 = 2111u32; pub const MD_APP_POOL_LOG_EVENT_ON_PROCESSMODEL: u32 = 9042u32; pub const MD_APP_POOL_LOG_EVENT_ON_RECYCLE: u32 = 9037u32; pub const MD_APP_POOL_PROCESSMODEL_IDLE_TIMEOUT: u32 = 1u32; pub const MD_APP_POOL_RECYCLE_CONFIG_CHANGE: u32 = 64u32; pub const MD_APP_POOL_RECYCLE_ISAPI_UNHEALTHY: u32 = 16u32; pub const MD_APP_POOL_RECYCLE_MEMORY: u32 = 8u32; pub const MD_APP_POOL_RECYCLE_ON_DEMAND: u32 = 32u32; pub const MD_APP_POOL_RECYCLE_PRIVATE_MEMORY: u32 = 128u32; pub const MD_APP_POOL_RECYCLE_REQUESTS: u32 = 2u32; pub const MD_APP_POOL_RECYCLE_SCHEDULE: u32 = 4u32; pub const MD_APP_POOL_RECYCLE_TIME: u32 = 1u32; pub const MD_APP_ROOT: u32 = 2103u32; pub const MD_APP_SHUTDOWN_TIME_LIMIT: u32 = 2114u32; pub const MD_APP_TRACE_URL_LIST: u32 = 2118u32; pub const MD_APP_WAM_CLSID: u32 = 2105u32; pub const MD_ASP_ALLOWOUTOFPROCCMPNTS: u32 = 7014u32; pub const MD_ASP_ALLOWOUTOFPROCCOMPONENTS: u32 = 7014u32; pub const MD_ASP_ALLOWSESSIONSTATE: u32 = 7011u32; pub const MD_ASP_BUFFERINGON: u32 = 7000u32; pub const MD_ASP_BUFFER_LIMIT: u32 = 7052u32; pub const MD_ASP_CALCLINENUMBER: u32 = 7050u32; pub const MD_ASP_CODEPAGE: u32 = 7016u32; pub const MD_ASP_DISKTEMPLATECACHEDIRECTORY: u32 = 7036u32; pub const MD_ASP_ENABLEAPPLICATIONRESTART: u32 = 7027u32; pub const MD_ASP_ENABLEASPHTMLFALLBACK: u32 = 7021u32; pub const MD_ASP_ENABLECHUNKEDENCODING: u32 = 7022u32; pub const MD_ASP_ENABLECLIENTDEBUG: u32 = 7019u32; pub const MD_ASP_ENABLEPARENTPATHS: u32 = 7008u32; pub const MD_ASP_ENABLESERVERDEBUG: u32 = 7018u32; pub const MD_ASP_ENABLETYPELIBCACHE: u32 = 7023u32; pub const MD_ASP_ERRORSTONTLOG: u32 = 7024u32; pub const MD_ASP_EXCEPTIONCATCHENABLE: u32 = 7015u32; pub const MD_ASP_EXECUTEINMTA: u32 = 7041u32; pub const MD_ASP_ID_LAST: u32 = 7053u32; pub const MD_ASP_KEEPSESSIONIDSECURE: u32 = 7043u32; pub const MD_ASP_LCID: u32 = 7042u32; pub const MD_ASP_LOGERRORREQUESTS: u32 = 7001u32; pub const MD_ASP_MAXDISKTEMPLATECACHEFILES: u32 = 7040u32; pub const MD_ASP_MAXREQUESTENTITY: u32 = 7053u32; pub const MD_ASP_MAX_REQUEST_ENTITY_ALLOWED: u32 = 7053u32; pub const MD_ASP_MEMFREEFACTOR: u32 = 7009u32; pub const MD_ASP_MINUSEDBLOCKS: u32 = 7010u32; pub const MD_ASP_PROCESSORTHREADMAX: u32 = 7025u32; pub const MD_ASP_QUEUECONNECTIONTESTTIME: u32 = 7028u32; pub const MD_ASP_QUEUETIMEOUT: u32 = 7013u32; pub const MD_ASP_REQEUSTQUEUEMAX: u32 = 7026u32; pub const MD_ASP_RUN_ONEND_ANON: u32 = 7051u32; pub const MD_ASP_SCRIPTENGINECACHEMAX: u32 = 7005u32; pub const MD_ASP_SCRIPTERRORMESSAGE: u32 = 7003u32; pub const MD_ASP_SCRIPTERRORSSENTTOBROWSER: u32 = 7002u32; pub const MD_ASP_SCRIPTFILECACHESIZE: u32 = 7004u32; pub const MD_ASP_SCRIPTLANGUAGE: u32 = 7012u32; pub const MD_ASP_SCRIPTLANGUAGELIST: u32 = 7017u32; pub const MD_ASP_SCRIPTTIMEOUT: u32 = 7006u32; pub const MD_ASP_SERVICE_ENABLE_SXS: u32 = 2u32; pub const MD_ASP_SERVICE_ENABLE_TRACKER: u32 = 1u32; pub const MD_ASP_SERVICE_FLAGS: u32 = 7044u32; pub const MD_ASP_SERVICE_FLAG_FUSION: u32 = 7046u32; pub const MD_ASP_SERVICE_FLAG_PARTITIONS: u32 = 7047u32; pub const MD_ASP_SERVICE_FLAG_TRACKER: u32 = 7045u32; pub const MD_ASP_SERVICE_PARTITION_ID: u32 = 7048u32; pub const MD_ASP_SERVICE_SXS_NAME: u32 = 7049u32; pub const MD_ASP_SERVICE_USE_PARTITION: u32 = 4u32; pub const MD_ASP_SESSIONMAX: u32 = 7029u32; pub const MD_ASP_SESSIONTIMEOUT: u32 = 7007u32; pub const MD_ASP_THREADGATEENABLED: u32 = 7030u32; pub const MD_ASP_THREADGATELOADHIGH: u32 = 7035u32; pub const MD_ASP_THREADGATELOADLOW: u32 = 7034u32; pub const MD_ASP_THREADGATESLEEPDELAY: u32 = 7032u32; pub const MD_ASP_THREADGATESLEEPMAX: u32 = 7033u32; pub const MD_ASP_THREADGATETIMESLICE: u32 = 7031u32; pub const MD_ASP_TRACKTHREADINGMODEL: u32 = 7020u32; pub const MD_AUTHORIZATION: u32 = 6000u32; pub const MD_AUTHORIZATION_PERSISTENCE: u32 = 6031u32; pub const MD_AUTH_ADVNOTIFY_DISABLE: u32 = 4u32; pub const MD_AUTH_ANONYMOUS: u32 = 1u32; pub const MD_AUTH_BASIC: u32 = 2u32; pub const MD_AUTH_CHANGE_DISABLE: u32 = 2u32; pub const MD_AUTH_CHANGE_FLAGS: u32 = 2068u32; pub const MD_AUTH_CHANGE_UNSECURE: u32 = 1u32; pub const MD_AUTH_CHANGE_URL: u32 = 2060u32; pub const MD_AUTH_EXPIRED_UNSECUREURL: u32 = 2067u32; pub const MD_AUTH_EXPIRED_URL: u32 = 2061u32; pub const MD_AUTH_MD5: u32 = 16u32; pub const MD_AUTH_NT: u32 = 4u32; pub const MD_AUTH_PASSPORT: u32 = 64u32; pub const MD_AUTH_SINGLEREQUEST: u32 = 64u32; pub const MD_AUTH_SINGLEREQUESTALWAYSIFPROXY: u32 = 256u32; pub const MD_AUTH_SINGLEREQUESTIFPROXY: u32 = 128u32; pub const MD_BACKUP_FORCE_BACKUP: u32 = 4u32; pub const MD_BACKUP_HIGHEST_VERSION: u32 = 4294967294u32; pub const MD_BACKUP_MAX_LEN: u32 = 100u32; pub const MD_BACKUP_MAX_VERSION: u32 = 9999u32; pub const MD_BACKUP_NEXT_VERSION: u32 = 4294967295u32; pub const MD_BACKUP_OVERWRITE: u32 = 1u32; pub const MD_BACKUP_SAVE_FIRST: u32 = 2u32; pub const MD_BANNER_MESSAGE: u32 = 5011u32; pub const MD_BINDINGS: u32 = 2022u32; pub const MD_CACHE_EXTENSIONS: u32 = 6034u32; pub const MD_CAL_AUTH_RESERVE_TIMEOUT: u32 = 2131u32; pub const MD_CAL_SSL_RESERVE_TIMEOUT: u32 = 2132u32; pub const MD_CAL_VC_PER_CONNECT: u32 = 2130u32; pub const MD_CAL_W3_ERROR: u32 = 2133u32; pub const MD_CC_MAX_AGE: u32 = 6042u32; pub const MD_CC_NO_CACHE: u32 = 6041u32; pub const MD_CC_OTHER: u32 = 6043u32; pub const MD_CENTRAL_W3C_LOGGING_ENABLED: u32 = 2119u32; pub const MD_CERT_CACHE_RETRIEVAL_ONLY: u32 = 2u32; pub const MD_CERT_CHECK_REVOCATION_FRESHNESS_TIME: u32 = 4u32; pub const MD_CERT_NO_REVOC_CHECK: u32 = 1u32; pub const MD_CERT_NO_USAGE_CHECK: u32 = 65536u32; pub const MD_CGI_RESTRICTION_LIST: u32 = 2164u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct MD_CHANGE_OBJECT_W { pub pszMDPath: super::super::Foundation::PWSTR, pub dwMDChangeType: u32, pub dwMDNumDataIDs: u32, pub pdwMDDataIDs: *mut u32, } #[cfg(feature = "Win32_Foundation")] impl MD_CHANGE_OBJECT_W {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for MD_CHANGE_OBJECT_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for MD_CHANGE_OBJECT_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("MD_CHANGE_OBJECT_W").field("pszMDPath", &self.pszMDPath).field("dwMDChangeType", &self.dwMDChangeType).field("dwMDNumDataIDs", &self.dwMDNumDataIDs).field("pdwMDDataIDs", &self.pdwMDDataIDs).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for MD_CHANGE_OBJECT_W { fn eq(&self, other: &Self) -> bool { self.pszMDPath == other.pszMDPath && self.dwMDChangeType == other.dwMDChangeType && self.dwMDNumDataIDs == other.dwMDNumDataIDs && self.pdwMDDataIDs == other.pdwMDDataIDs } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for MD_CHANGE_OBJECT_W {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for MD_CHANGE_OBJECT_W { type Abi = Self; } pub const MD_CHANGE_TYPE_ADD_OBJECT: u32 = 2u32; pub const MD_CHANGE_TYPE_DELETE_DATA: u32 = 8u32; pub const MD_CHANGE_TYPE_DELETE_OBJECT: u32 = 1u32; pub const MD_CHANGE_TYPE_RENAME_OBJECT: u32 = 16u32; pub const MD_CHANGE_TYPE_RESTORE: u32 = 32u32; pub const MD_CHANGE_TYPE_SET_DATA: u32 = 4u32; pub const MD_COMMENTS: u32 = 9990u32; pub const MD_CONNECTION_TIMEOUT: u32 = 1013u32; pub const MD_CPU_ACTION: u32 = 9022u32; pub const MD_CPU_APP_ENABLED: u32 = 2141u32; pub const MD_CPU_CGI_ENABLED: u32 = 2140u32; pub const MD_CPU_CGI_LIMIT: u32 = 2148u32; pub const MD_CPU_DISABLE_ALL_LOGGING: u32 = 0u32; pub const MD_CPU_ENABLE_ACTIVE_PROCS: u32 = 64u32; pub const MD_CPU_ENABLE_ALL_PROC_LOGGING: u32 = 1u32; pub const MD_CPU_ENABLE_APP_LOGGING: u32 = 4u32; pub const MD_CPU_ENABLE_CGI_LOGGING: u32 = 2u32; pub const MD_CPU_ENABLE_EVENT: u32 = 1u32; pub const MD_CPU_ENABLE_KERNEL_TIME: u32 = 8u32; pub const MD_CPU_ENABLE_LOGGING: u32 = 2147483648u32; pub const MD_CPU_ENABLE_PAGE_FAULTS: u32 = 16u32; pub const MD_CPU_ENABLE_PROC_TYPE: u32 = 2u32; pub const MD_CPU_ENABLE_TERMINATED_PROCS: u32 = 128u32; pub const MD_CPU_ENABLE_TOTAL_PROCS: u32 = 32u32; pub const MD_CPU_ENABLE_USER_TIME: u32 = 4u32; pub const MD_CPU_KILL_W3WP: u32 = 1u32; pub const MD_CPU_LIMIT: u32 = 9023u32; pub const MD_CPU_LIMITS_ENABLED: u32 = 2143u32; pub const MD_CPU_LIMIT_LOGEVENT: u32 = 2149u32; pub const MD_CPU_LIMIT_PAUSE: u32 = 2152u32; pub const MD_CPU_LIMIT_PRIORITY: u32 = 2150u32; pub const MD_CPU_LIMIT_PROCSTOP: u32 = 2151u32; pub const MD_CPU_LOGGING_INTERVAL: u32 = 2145u32; pub const MD_CPU_LOGGING_MASK: u32 = 4507u32; pub const MD_CPU_LOGGING_OPTIONS: u32 = 2146u32; pub const MD_CPU_NO_ACTION: u32 = 0u32; pub const MD_CPU_RESET_INTERVAL: u32 = 2144u32; pub const MD_CPU_THROTTLE: u32 = 3u32; pub const MD_CPU_TRACE: u32 = 2u32; pub const MD_CREATE_PROCESS_AS_USER: u32 = 6035u32; pub const MD_CREATE_PROC_NEW_CONSOLE: u32 = 6036u32; pub const MD_CUSTOM_DEPLOYMENT_DATA: u32 = 6055u32; pub const MD_CUSTOM_ERROR: u32 = 6008u32; pub const MD_CUSTOM_ERROR_DESC: u32 = 2120u32; pub const MD_DEFAULT_LOAD_FILE: u32 = 6006u32; pub const MD_DEFAULT_LOGON_DOMAIN: u32 = 6012u32; pub const MD_DEMAND_START_THRESHOLD: u32 = 9207u32; pub const MD_DIRBROW_ENABLED: u32 = 2147483648u32; pub const MD_DIRBROW_LOADDEFAULT: u32 = 1073741824u32; pub const MD_DIRBROW_LONG_DATE: u32 = 32u32; pub const MD_DIRBROW_SHOW_DATE: u32 = 2u32; pub const MD_DIRBROW_SHOW_EXTENSION: u32 = 16u32; pub const MD_DIRBROW_SHOW_SIZE: u32 = 8u32; pub const MD_DIRBROW_SHOW_TIME: u32 = 4u32; pub const MD_DIRECTORY_BROWSING: u32 = 6005u32; pub const MD_DISABLE_SOCKET_POOLING: u32 = 1029u32; pub const MD_DONT_LOG: u32 = 6023u32; pub const MD_DOWNLEVEL_ADMIN_INSTANCE: u32 = 1021u32; pub const MD_DO_REVERSE_DNS: u32 = 6029u32; pub const MD_ENABLEDPROTOCOLS: u32 = 2023u32; pub const MD_ENABLE_URL_AUTHORIZATION: u32 = 6048u32; pub const MD_ERROR_CANNOT_REMOVE_SECURE_ATTRIBUTE: i32 = -2146646008i32; pub const MD_ERROR_DATA_NOT_FOUND: i32 = -2146646015i32; pub const MD_ERROR_IISAO_INVALID_SCHEMA: i32 = -2146646000i32; pub const MD_ERROR_INVALID_VERSION: i32 = -2146646014i32; pub const MD_ERROR_NOT_INITIALIZED: i32 = -2146646016i32; pub const MD_ERROR_NO_SESSION_KEY: i32 = -2146645987i32; pub const MD_ERROR_READ_METABASE_FILE: i32 = -2146645991i32; pub const MD_ERROR_SECURE_CHANNEL_FAILURE: i32 = -2146646010i32; pub const MD_ERROR_SUB400_INVALID_CONTENT_LENGTH: u32 = 7u32; pub const MD_ERROR_SUB400_INVALID_DEPTH: u32 = 2u32; pub const MD_ERROR_SUB400_INVALID_DESTINATION: u32 = 1u32; pub const MD_ERROR_SUB400_INVALID_IF: u32 = 3u32; pub const MD_ERROR_SUB400_INVALID_LOCK_TOKEN: u32 = 9u32; pub const MD_ERROR_SUB400_INVALID_OVERWRITE: u32 = 4u32; pub const MD_ERROR_SUB400_INVALID_REQUEST_BODY: u32 = 6u32; pub const MD_ERROR_SUB400_INVALID_TIMEOUT: u32 = 8u32; pub const MD_ERROR_SUB400_INVALID_TRANSLATE: u32 = 5u32; pub const MD_ERROR_SUB400_INVALID_WEBSOCKET_REQUEST: u32 = 11u32; pub const MD_ERROR_SUB400_INVALID_XFF_HEADER: u32 = 10u32; pub const MD_ERROR_SUB401_APPLICATION: u32 = 5u32; pub const MD_ERROR_SUB401_FILTER: u32 = 4u32; pub const MD_ERROR_SUB401_LOGON: u32 = 1u32; pub const MD_ERROR_SUB401_LOGON_ACL: u32 = 3u32; pub const MD_ERROR_SUB401_LOGON_CONFIG: u32 = 2u32; pub const MD_ERROR_SUB401_URLAUTH_POLICY: u32 = 7u32; pub const MD_ERROR_SUB403_ADDR_REJECT: u32 = 6u32; pub const MD_ERROR_SUB403_APPPOOL_DENIED: u32 = 18u32; pub const MD_ERROR_SUB403_CAL_EXCEEDED: u32 = 15u32; pub const MD_ERROR_SUB403_CERT_BAD: u32 = 16u32; pub const MD_ERROR_SUB403_CERT_REQUIRED: u32 = 7u32; pub const MD_ERROR_SUB403_CERT_REVOKED: u32 = 13u32; pub const MD_ERROR_SUB403_CERT_TIME_INVALID: u32 = 17u32; pub const MD_ERROR_SUB403_DIR_LIST_DENIED: u32 = 14u32; pub const MD_ERROR_SUB403_EXECUTE_ACCESS_DENIED: u32 = 1u32; pub const MD_ERROR_SUB403_INFINITE_DEPTH_DENIED: u32 = 22u32; pub const MD_ERROR_SUB403_INSUFFICIENT_PRIVILEGE_FOR_CGI: u32 = 19u32; pub const MD_ERROR_SUB403_INVALID_CNFG: u32 = 10u32; pub const MD_ERROR_SUB403_LOCK_TOKEN_REQUIRED: u32 = 23u32; pub const MD_ERROR_SUB403_MAPPER_DENY_ACCESS: u32 = 12u32; pub const MD_ERROR_SUB403_PASSPORT_LOGIN_FAILURE: u32 = 20u32; pub const MD_ERROR_SUB403_PWD_CHANGE: u32 = 11u32; pub const MD_ERROR_SUB403_READ_ACCESS_DENIED: u32 = 2u32; pub const MD_ERROR_SUB403_SITE_ACCESS_DENIED: u32 = 8u32; pub const MD_ERROR_SUB403_SOURCE_ACCESS_DENIED: u32 = 21u32; pub const MD_ERROR_SUB403_SSL128_REQUIRED: u32 = 5u32; pub const MD_ERROR_SUB403_SSL_REQUIRED: u32 = 4u32; pub const MD_ERROR_SUB403_TOO_MANY_USERS: u32 = 9u32; pub const MD_ERROR_SUB403_VALIDATION_FAILURE: u32 = 24u32; pub const MD_ERROR_SUB403_WRITE_ACCESS_DENIED: u32 = 3u32; pub const MD_ERROR_SUB404_DENIED_BY_FILTERING_RULE: u32 = 19u32; pub const MD_ERROR_SUB404_DENIED_BY_MIMEMAP: u32 = 3u32; pub const MD_ERROR_SUB404_DENIED_BY_POLICY: u32 = 2u32; pub const MD_ERROR_SUB404_FILE_ATTRIBUTE_HIDDEN: u32 = 9u32; pub const MD_ERROR_SUB404_FILE_EXTENSION_DENIED: u32 = 7u32; pub const MD_ERROR_SUB404_HIDDEN_SEGMENT: u32 = 8u32; pub const MD_ERROR_SUB404_NO_HANDLER: u32 = 4u32; pub const MD_ERROR_SUB404_PRECONDITIONED_HANDLER: u32 = 17u32; pub const MD_ERROR_SUB404_QUERY_STRING_SEQUENCE_DENIED: u32 = 18u32; pub const MD_ERROR_SUB404_QUERY_STRING_TOO_LONG: u32 = 15u32; pub const MD_ERROR_SUB404_SITE_NOT_FOUND: u32 = 1u32; pub const MD_ERROR_SUB404_STATICFILE_DAV: u32 = 16u32; pub const MD_ERROR_SUB404_TOO_MANY_URL_SEGMENTS: u32 = 20u32; pub const MD_ERROR_SUB404_URL_DOUBLE_ESCAPED: u32 = 11u32; pub const MD_ERROR_SUB404_URL_HAS_HIGH_BIT_CHARS: u32 = 12u32; pub const MD_ERROR_SUB404_URL_SEQUENCE_DENIED: u32 = 5u32; pub const MD_ERROR_SUB404_URL_TOO_LONG: u32 = 14u32; pub const MD_ERROR_SUB404_VERB_DENIED: u32 = 6u32; pub const MD_ERROR_SUB413_CONTENT_LENGTH_TOO_LARGE: u32 = 1u32; pub const MD_ERROR_SUB423_LOCK_TOKEN_SUBMITTED: u32 = 1u32; pub const MD_ERROR_SUB423_NO_CONFLICTING_LOCK: u32 = 2u32; pub const MD_ERROR_SUB500_ASPNET_HANDLERS: u32 = 23u32; pub const MD_ERROR_SUB500_ASPNET_IMPERSONATION: u32 = 24u32; pub const MD_ERROR_SUB500_ASPNET_MODULES: u32 = 22u32; pub const MD_ERROR_SUB500_BAD_METADATA: u32 = 19u32; pub const MD_ERROR_SUB500_HANDLERS_MODULE: u32 = 21u32; pub const MD_ERROR_SUB500_UNC_ACCESS: u32 = 16u32; pub const MD_ERROR_SUB500_URLAUTH_NO_SCOPE: u32 = 20u32; pub const MD_ERROR_SUB500_URLAUTH_NO_STORE: u32 = 17u32; pub const MD_ERROR_SUB500_URLAUTH_STORE_ERROR: u32 = 18u32; pub const MD_ERROR_SUB502_ARR_CONNECTION_ERROR: u32 = 3u32; pub const MD_ERROR_SUB502_ARR_NO_SERVER: u32 = 4u32; pub const MD_ERROR_SUB502_PREMATURE_EXIT: u32 = 2u32; pub const MD_ERROR_SUB502_TIMEOUT: u32 = 1u32; pub const MD_ERROR_SUB503_APP_CONCURRENT: u32 = 2u32; pub const MD_ERROR_SUB503_ASPNET_QUEUE_FULL: u32 = 3u32; pub const MD_ERROR_SUB503_CONNECTION_LIMIT: u32 = 5u32; pub const MD_ERROR_SUB503_CPU_LIMIT: u32 = 1u32; pub const MD_ERROR_SUB503_FASTCGI_QUEUE_FULL: u32 = 4u32; pub const MD_EXIT_MESSAGE: u32 = 5001u32; pub const MD_EXPORT_INHERITED: u32 = 1u32; pub const MD_EXPORT_NODE_ONLY: u32 = 2u32; pub const MD_EXTLOG_BYTES_RECV: u32 = 8192u32; pub const MD_EXTLOG_BYTES_SENT: u32 = 4096u32; pub const MD_EXTLOG_CLIENT_IP: u32 = 4u32; pub const MD_EXTLOG_COMPUTER_NAME: u32 = 32u32; pub const MD_EXTLOG_COOKIE: u32 = 131072u32; pub const MD_EXTLOG_DATE: u32 = 1u32; pub const MD_EXTLOG_HOST: u32 = 1048576u32; pub const MD_EXTLOG_HTTP_STATUS: u32 = 1024u32; pub const MD_EXTLOG_HTTP_SUB_STATUS: u32 = 2097152u32; pub const MD_EXTLOG_METHOD: u32 = 128u32; pub const MD_EXTLOG_PROTOCOL_VERSION: u32 = 524288u32; pub const MD_EXTLOG_REFERER: u32 = 262144u32; pub const MD_EXTLOG_SERVER_IP: u32 = 64u32; pub const MD_EXTLOG_SERVER_PORT: u32 = 32768u32; pub const MD_EXTLOG_SITE_NAME: u32 = 16u32; pub const MD_EXTLOG_TIME: u32 = 2u32; pub const MD_EXTLOG_TIME_TAKEN: u32 = 16384u32; pub const MD_EXTLOG_URI_QUERY: u32 = 512u32; pub const MD_EXTLOG_URI_STEM: u32 = 256u32; pub const MD_EXTLOG_USERNAME: u32 = 8u32; pub const MD_EXTLOG_USER_AGENT: u32 = 65536u32; pub const MD_EXTLOG_WIN32_STATUS: u32 = 2048u32; pub const MD_FILTER_DESCRIPTION: u32 = 2045u32; pub const MD_FILTER_ENABLED: u32 = 2043u32; pub const MD_FILTER_ENABLE_CACHE: u32 = 2046u32; pub const MD_FILTER_FLAGS: u32 = 2044u32; pub const MD_FILTER_IMAGE_PATH: u32 = 2041u32; pub const MD_FILTER_LOAD_ORDER: u32 = 2040u32; pub const MD_FILTER_STATE: u32 = 2042u32; pub const MD_FILTER_STATE_LOADED: u32 = 1u32; pub const MD_FILTER_STATE_UNLOADED: u32 = 4u32; pub const MD_FOOTER_DOCUMENT: u32 = 6009u32; pub const MD_FOOTER_ENABLED: u32 = 6010u32; pub const MD_FRONTPAGE_WEB: u32 = 2072u32; pub const MD_FTPS_128_BITS: u32 = 5053u32; pub const MD_FTPS_ALLOW_CCC: u32 = 5054u32; pub const MD_FTPS_SECURE_ANONYMOUS: u32 = 5052u32; pub const MD_FTPS_SECURE_CONTROL_CHANNEL: u32 = 5050u32; pub const MD_FTPS_SECURE_DATA_CHANNEL: u32 = 5051u32; pub const MD_FTP_KEEP_PARTIAL_UPLOADS: u32 = 5019u32; pub const MD_FTP_LOG_IN_UTF_8: u32 = 5013u32; pub const MD_FTP_PASV_RESPONSE_IP: u32 = 5018u32; pub const MD_FTP_UTF8_FILE_NAMES: u32 = 5020u32; pub const MD_GLOBAL_BINARY_LOGGING_ENABLED: u32 = 4016u32; pub const MD_GLOBAL_BINSCHEMATIMESTAMP: u32 = 9991u32; pub const MD_GLOBAL_CHANGE_NUMBER: u32 = 9997u32; pub const MD_GLOBAL_EDIT_WHILE_RUNNING_MAJOR_VERSION_NUMBER: u32 = 9994u32; pub const MD_GLOBAL_EDIT_WHILE_RUNNING_MINOR_VERSION_NUMBER: u32 = 9993u32; pub const MD_GLOBAL_LOG_IN_UTF_8: u32 = 9206u32; pub const MD_GLOBAL_SESSIONKEY: u32 = 9999u32; pub const MD_GLOBAL_STANDARD_APP_MODE_ENABLED: u32 = 9203u32; pub const MD_GLOBAL_XMLSCHEMATIMESTAMP: u32 = 9992u32; pub const MD_GREETING_MESSAGE: u32 = 5002u32; pub const MD_HC_CACHE_CONTROL_HEADER: u32 = 2211u32; pub const MD_HC_COMPRESSION_BUFFER_SIZE: u32 = 2223u32; pub const MD_HC_COMPRESSION_DIRECTORY: u32 = 2210u32; pub const MD_HC_COMPRESSION_DLL: u32 = 2237u32; pub const MD_HC_CREATE_FLAGS: u32 = 2243u32; pub const MD_HC_DO_DISK_SPACE_LIMITING: u32 = 2216u32; pub const MD_HC_DO_DYNAMIC_COMPRESSION: u32 = 2213u32; pub const MD_HC_DO_NAMESPACE_DYNAMIC_COMPRESSION: u32 = 2255u32; pub const MD_HC_DO_NAMESPACE_STATIC_COMPRESSION: u32 = 2256u32; pub const MD_HC_DO_ON_DEMAND_COMPRESSION: u32 = 2215u32; pub const MD_HC_DO_STATIC_COMPRESSION: u32 = 2214u32; pub const MD_HC_DYNAMIC_COMPRESSION_LEVEL: u32 = 2241u32; pub const MD_HC_EXPIRES_HEADER: u32 = 2212u32; pub const MD_HC_FILES_DELETED_PER_DISK_FREE: u32 = 2225u32; pub const MD_HC_FILE_EXTENSIONS: u32 = 2238u32; pub const MD_HC_IO_BUFFER_SIZE: u32 = 2222u32; pub const MD_HC_MAX_DISK_SPACE_USAGE: u32 = 2221u32; pub const MD_HC_MAX_QUEUE_LENGTH: u32 = 2224u32; pub const MD_HC_MIME_TYPE: u32 = 2239u32; pub const MD_HC_MIN_FILE_SIZE_FOR_COMP: u32 = 2226u32; pub const MD_HC_NO_COMPRESSION_FOR_HTTP_10: u32 = 2217u32; pub const MD_HC_NO_COMPRESSION_FOR_PROXIES: u32 = 2218u32; pub const MD_HC_NO_COMPRESSION_FOR_RANGE: u32 = 2219u32; pub const MD_HC_ON_DEMAND_COMP_LEVEL: u32 = 2242u32; pub const MD_HC_PRIORITY: u32 = 2240u32; pub const MD_HC_SCRIPT_FILE_EXTENSIONS: u32 = 2244u32; pub const MD_HC_SEND_CACHE_HEADERS: u32 = 2220u32; pub const MD_HEADER_WAIT_TIMEOUT: u32 = 9204u32; pub const MD_HISTORY_LATEST: u32 = 1u32; pub const MD_HTTPERRORS_EXISTING_RESPONSE: u32 = 6056u32; pub const MD_HTTP_CUSTOM: u32 = 6004u32; pub const MD_HTTP_EXPIRES: u32 = 6002u32; pub const MD_HTTP_FORWARDER_CUSTOM: u32 = 6054u32; pub const MD_HTTP_PICS: u32 = 6003u32; pub const MD_HTTP_REDIRECT: u32 = 6011u32; pub const MD_IISADMIN_EXTENSIONS: u32 = 1028u32; pub const MD_IMPORT_INHERITED: u32 = 1u32; pub const MD_IMPORT_MERGE: u32 = 4u32; pub const MD_IMPORT_NODE_ONLY: u32 = 2u32; pub const MD_IN_PROCESS_ISAPI_APPS: u32 = 2073u32; pub const MD_IP_SEC: u32 = 6019u32; pub const MD_ISAPI_RESTRICTION_LIST: u32 = 2163u32; pub const MD_IS_CONTENT_INDEXED: u32 = 6039u32; pub const MD_KEY_TYPE: u32 = 1002u32; pub const MD_LEVELS_TO_SCAN: u32 = 1022u32; pub const MD_LOAD_BALANCER_CAPABILITIES: u32 = 9034u32; pub const MD_LOAD_BALANCER_CAPABILITIES_BASIC: u32 = 1u32; pub const MD_LOAD_BALANCER_CAPABILITIES_SOPHISTICATED: u32 = 2u32; pub const MD_LOCATION: u32 = 9989u32; pub const MD_LOGCUSTOM_DATATYPE_DOUBLE: u32 = 5u32; pub const MD_LOGCUSTOM_DATATYPE_FLOAT: u32 = 4u32; pub const MD_LOGCUSTOM_DATATYPE_INT: u32 = 0u32; pub const MD_LOGCUSTOM_DATATYPE_LONG: u32 = 2u32; pub const MD_LOGCUSTOM_DATATYPE_LPSTR: u32 = 6u32; pub const MD_LOGCUSTOM_DATATYPE_LPWSTR: u32 = 7u32; pub const MD_LOGCUSTOM_DATATYPE_UINT: u32 = 1u32; pub const MD_LOGCUSTOM_DATATYPE_ULONG: u32 = 3u32; pub const MD_LOGCUSTOM_PROPERTY_DATATYPE: u32 = 4505u32; pub const MD_LOGCUSTOM_PROPERTY_HEADER: u32 = 4502u32; pub const MD_LOGCUSTOM_PROPERTY_ID: u32 = 4503u32; pub const MD_LOGCUSTOM_PROPERTY_MASK: u32 = 4504u32; pub const MD_LOGCUSTOM_PROPERTY_NAME: u32 = 4501u32; pub const MD_LOGCUSTOM_PROPERTY_NODE_ID: u32 = 4508u32; pub const MD_LOGCUSTOM_SERVICES_STRING: u32 = 4506u32; pub const MD_LOGEXT_FIELD_MASK: u32 = 4013u32; pub const MD_LOGEXT_FIELD_MASK2: u32 = 4014u32; pub const MD_LOGFILE_DIRECTORY: u32 = 4001u32; pub const MD_LOGFILE_LOCALTIME_ROLLOVER: u32 = 4015u32; pub const MD_LOGFILE_PERIOD: u32 = 4003u32; pub const MD_LOGFILE_PERIOD_DAILY: u32 = 1u32; pub const MD_LOGFILE_PERIOD_HOURLY: u32 = 4u32; pub const MD_LOGFILE_PERIOD_MAXSIZE: u32 = 0u32; pub const MD_LOGFILE_PERIOD_MONTHLY: u32 = 3u32; pub const MD_LOGFILE_PERIOD_NONE: u32 = 0u32; pub const MD_LOGFILE_PERIOD_WEEKLY: u32 = 2u32; pub const MD_LOGFILE_TRUNCATE_SIZE: u32 = 4004u32; pub const MD_LOGON_BATCH: u32 = 1u32; pub const MD_LOGON_INTERACTIVE: u32 = 0u32; pub const MD_LOGON_METHOD: u32 = 6013u32; pub const MD_LOGON_NETWORK: u32 = 2u32; pub const MD_LOGON_NETWORK_CLEARTEXT: u32 = 3u32; pub const MD_LOGSQL_DATA_SOURCES: u32 = 4007u32; pub const MD_LOGSQL_PASSWORD: u32 = 4010u32; pub const MD_LOGSQL_TABLE_NAME: u32 = 4008u32; pub const MD_LOGSQL_USER_NAME: u32 = 4009u32; pub const MD_LOG_ANONYMOUS: u32 = 5007u32; pub const MD_LOG_NONANONYMOUS: u32 = 5008u32; pub const MD_LOG_PLUGINS_AVAILABLE: u32 = 4012u32; pub const MD_LOG_PLUGIN_MOD_ID: u32 = 4005u32; pub const MD_LOG_PLUGIN_ORDER: u32 = 4011u32; pub const MD_LOG_PLUGIN_UI_ID: u32 = 4006u32; pub const MD_LOG_TYPE: u32 = 4000u32; pub const MD_LOG_TYPE_DISABLED: u32 = 0u32; pub const MD_LOG_TYPE_ENABLED: u32 = 1u32; pub const MD_LOG_UNUSED1: u32 = 4002u32; pub const MD_MAX_BANDWIDTH: u32 = 1000u32; pub const MD_MAX_BANDWIDTH_BLOCKED: u32 = 1003u32; pub const MD_MAX_CHANGE_ENTRIES: u32 = 100u32; pub const MD_MAX_CLIENTS_MESSAGE: u32 = 5003u32; pub const MD_MAX_CONNECTIONS: u32 = 1014u32; pub const MD_MAX_ENDPOINT_CONNECTIONS: u32 = 1024u32; pub const MD_MAX_ERROR_FILES: u32 = 9988u32; pub const MD_MAX_GLOBAL_BANDWIDTH: u32 = 9201u32; pub const MD_MAX_GLOBAL_CONNECTIONS: u32 = 9202u32; pub const MD_MAX_REQUEST_ENTITY_ALLOWED: u32 = 6051u32; pub const MD_MD_SERVER_SS_AUTH_MAPPING: u32 = 2200u32; pub const MD_METADATA_ID_REGISTRATION: u32 = 1030u32; pub const MD_MIME_MAP: u32 = 6015u32; pub const MD_MIN_FILE_BYTES_PER_SEC: u32 = 9205u32; pub const MD_MSDOS_DIR_OUTPUT: u32 = 5004u32; pub const MD_NETLOGON_WKS_DNS: u32 = 2u32; pub const MD_NETLOGON_WKS_IP: u32 = 1u32; pub const MD_NETLOGON_WKS_NONE: u32 = 0u32; pub const MD_NET_LOGON_WKS: u32 = 2065u32; pub const MD_NOTIFEXAUTH_NTLMSSL: u32 = 1u32; pub const MD_NOTIFY_ACCESS_DENIED: u32 = 2048u32; pub const MD_NOTIFY_AUTHENTICATION: u32 = 8192u32; pub const MD_NOTIFY_AUTH_COMPLETE: u32 = 67108864u32; pub const MD_NOTIFY_END_OF_NET_SESSION: u32 = 256u32; pub const MD_NOTIFY_END_OF_REQUEST: u32 = 128u32; pub const MD_NOTIFY_LOG: u32 = 512u32; pub const MD_NOTIFY_NONSECURE_PORT: u32 = 2u32; pub const MD_NOTIFY_ORDER_DEFAULT: u32 = 131072u32; pub const MD_NOTIFY_ORDER_HIGH: u32 = 524288u32; pub const MD_NOTIFY_ORDER_LOW: u32 = 131072u32; pub const MD_NOTIFY_ORDER_MEDIUM: u32 = 262144u32; pub const MD_NOTIFY_PREPROC_HEADERS: u32 = 16384u32; pub const MD_NOTIFY_READ_RAW_DATA: u32 = 32768u32; pub const MD_NOTIFY_SECURE_PORT: u32 = 1u32; pub const MD_NOTIFY_SEND_RAW_DATA: u32 = 1024u32; pub const MD_NOTIFY_SEND_RESPONSE: u32 = 64u32; pub const MD_NOTIFY_URL_MAP: u32 = 4096u32; pub const MD_NOT_DELETABLE: u32 = 2116u32; pub const MD_NTAUTHENTICATION_PROVIDERS: u32 = 6032u32; pub const MD_PASSIVE_PORT_RANGE: u32 = 5016u32; pub const MD_PASSPORT_NEED_MAPPING: u32 = 2u32; pub const MD_PASSPORT_NO_MAPPING: u32 = 0u32; pub const MD_PASSPORT_REQUIRE_AD_MAPPING: u32 = 6052u32; pub const MD_PASSPORT_TRY_MAPPING: u32 = 1u32; pub const MD_POOL_IDC_TIMEOUT: u32 = 6037u32; pub const MD_PROCESS_NTCR_IF_LOGGED_ON: u32 = 2070u32; pub const MD_PUT_READ_SIZE: u32 = 6046u32; pub const MD_RAPID_FAIL_PROTECTION_INTERVAL: u32 = 9029u32; pub const MD_RAPID_FAIL_PROTECTION_MAX_CRASHES: u32 = 9030u32; pub const MD_REALM: u32 = 6001u32; pub const MD_REDIRECT_HEADERS: u32 = 6044u32; pub const MD_RESTRICTION_LIST_CUSTOM_DESC: u32 = 2165u32; pub const MD_ROOT_ENABLE_EDIT_WHILE_RUNNING: u32 = 9998u32; pub const MD_ROOT_ENABLE_HISTORY: u32 = 9996u32; pub const MD_ROOT_MAX_HISTORY_FILES: u32 = 9995u32; pub const MD_SCHEMA_METAID: u32 = 1004u32; pub const MD_SCRIPTMAPFLAG_ALLOWED_ON_READ_DIR: u32 = 1u32; pub const MD_SCRIPTMAPFLAG_CHECK_PATH_INFO: u32 = 4u32; pub const MD_SCRIPTMAPFLAG_SCRIPT: u32 = 1u32; pub const MD_SCRIPT_MAPS: u32 = 6014u32; pub const MD_SCRIPT_TIMEOUT: u32 = 6033u32; pub const MD_SECURE_BINDINGS: u32 = 2021u32; pub const MD_SECURITY_SETUP_REQUIRED: u32 = 2166u32; pub const MD_SERVER_AUTOSTART: u32 = 1017u32; pub const MD_SERVER_BINDINGS: u32 = 1023u32; pub const MD_SERVER_COMMAND: u32 = 1012u32; pub const MD_SERVER_COMMAND_CONTINUE: u32 = 4u32; pub const MD_SERVER_COMMAND_PAUSE: u32 = 3u32; pub const MD_SERVER_COMMAND_START: u32 = 1u32; pub const MD_SERVER_COMMAND_STOP: u32 = 2u32; pub const MD_SERVER_COMMENT: u32 = 1015u32; pub const MD_SERVER_CONFIGURATION_INFO: u32 = 1027u32; pub const MD_SERVER_CONFIG_ALLOW_ENCRYPT: u32 = 4u32; pub const MD_SERVER_CONFIG_AUTO_PW_SYNC: u32 = 8u32; pub const MD_SERVER_CONFIG_SSL_128: u32 = 2u32; pub const MD_SERVER_CONFIG_SSL_40: u32 = 1u32; pub const MD_SERVER_LISTEN_BACKLOG: u32 = 1019u32; pub const MD_SERVER_LISTEN_TIMEOUT: u32 = 1020u32; pub const MD_SERVER_SIZE: u32 = 1018u32; pub const MD_SERVER_SIZE_LARGE: u32 = 2u32; pub const MD_SERVER_SIZE_MEDIUM: u32 = 1u32; pub const MD_SERVER_SIZE_SMALL: u32 = 0u32; pub const MD_SERVER_STATE: u32 = 1016u32; pub const MD_SERVER_STATE_CONTINUING: u32 = 7u32; pub const MD_SERVER_STATE_PAUSED: u32 = 6u32; pub const MD_SERVER_STATE_PAUSING: u32 = 5u32; pub const MD_SERVER_STATE_STARTED: u32 = 2u32; pub const MD_SERVER_STATE_STARTING: u32 = 1u32; pub const MD_SERVER_STATE_STOPPED: u32 = 4u32; pub const MD_SERVER_STATE_STOPPING: u32 = 3u32; pub const MD_SET_HOST_NAME: u32 = 2154u32; pub const MD_SHOW_4_DIGIT_YEAR: u32 = 5010u32; pub const MD_SSI_EXEC_DISABLED: u32 = 6028u32; pub const MD_SSL_ACCESS_PERM: u32 = 6030u32; pub const MD_SSL_ALWAYS_NEGO_CLIENT_CERT: u32 = 5521u32; pub const MD_SSL_KEY_PASSWORD: u32 = 5502u32; pub const MD_SSL_KEY_REQUEST: u32 = 5503u32; pub const MD_SSL_PRIVATE_KEY: u32 = 5501u32; pub const MD_SSL_PUBLIC_KEY: u32 = 5500u32; pub const MD_SSL_USE_DS_MAPPER: u32 = 5519u32; pub const MD_STOP_LISTENING: u32 = 9987u32; pub const MD_SUPPRESS_DEFAULT_BANNER: u32 = 5017u32; pub const MD_UPLOAD_READAHEAD_SIZE: u32 = 6045u32; pub const MD_URL_AUTHORIZATION_IMPERSONATION_LEVEL: u32 = 6053u32; pub const MD_URL_AUTHORIZATION_SCOPE_NAME: u32 = 6050u32; pub const MD_URL_AUTHORIZATION_STORE_NAME: u32 = 6049u32; pub const MD_USER_ISOLATION: u32 = 5012u32; pub const MD_USER_ISOLATION_AD: u32 = 2u32; pub const MD_USER_ISOLATION_BASIC: u32 = 1u32; pub const MD_USER_ISOLATION_LAST: u32 = 2u32; pub const MD_USER_ISOLATION_NONE: u32 = 0u32; pub const MD_USE_DIGEST_SSP: u32 = 6047u32; pub const MD_USE_HOST_NAME: u32 = 2066u32; pub const MD_VR_IGNORE_TRANSLATE: u32 = 3008u32; pub const MD_VR_NO_CACHE: u32 = 3007u32; pub const MD_VR_PASSTHROUGH: u32 = 3006u32; pub const MD_VR_PASSWORD: u32 = 3003u32; pub const MD_VR_PATH: u32 = 3001u32; pub const MD_VR_USERNAME: u32 = 3002u32; pub const MD_WAM_PWD: u32 = 7502u32; pub const MD_WAM_USER_NAME: u32 = 7501u32; pub const MD_WARNING_DUP_NAME: i32 = 837636i32; pub const MD_WARNING_INVALID_DATA: i32 = 837637i32; pub const MD_WARNING_PATH_NOT_FOUND: i32 = 837635i32; pub const MD_WARNING_PATH_NOT_INSERTED: i32 = 837639i32; pub const MD_WARNING_SAVE_FAILED: i32 = 837641i32; pub const MD_WEBDAV_MAX_ATTRIBUTES_PER_ELEMENT: u32 = 8501u32; pub const MD_WEB_SVC_EXT_RESTRICTION_LIST: u32 = 2168u32; pub const MD_WIN32_ERROR: u32 = 1099u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct METADATATYPES(pub i32); pub const ALL_METADATA: METADATATYPES = METADATATYPES(0i32); pub const DWORD_METADATA: METADATATYPES = METADATATYPES(1i32); pub const STRING_METADATA: METADATATYPES = METADATATYPES(2i32); pub const BINARY_METADATA: METADATATYPES = METADATATYPES(3i32); pub const EXPANDSZ_METADATA: METADATATYPES = METADATATYPES(4i32); pub const MULTISZ_METADATA: METADATATYPES = METADATATYPES(5i32); pub const INVALID_END_METADATA: METADATATYPES = METADATATYPES(6i32); impl ::core::convert::From<i32> for METADATATYPES { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for METADATATYPES { type Abi = Self; } pub const METADATA_DONT_EXPAND: u32 = 512u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct METADATA_GETALL_INTERNAL_RECORD { pub dwMDIdentifier: u32, pub dwMDAttributes: u32, pub dwMDUserType: u32, pub dwMDDataType: u32, pub dwMDDataLen: u32, pub Anonymous: METADATA_GETALL_INTERNAL_RECORD_0, pub dwMDDataTag: u32, } impl METADATA_GETALL_INTERNAL_RECORD {} impl ::core::default::Default for METADATA_GETALL_INTERNAL_RECORD { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for METADATA_GETALL_INTERNAL_RECORD { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for METADATA_GETALL_INTERNAL_RECORD {} unsafe impl ::windows::core::Abi for METADATA_GETALL_INTERNAL_RECORD { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub union METADATA_GETALL_INTERNAL_RECORD_0 { pub dwMDDataOffset: usize, pub pbMDData: *mut u8, } impl METADATA_GETALL_INTERNAL_RECORD_0 {} impl ::core::default::Default for METADATA_GETALL_INTERNAL_RECORD_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for METADATA_GETALL_INTERNAL_RECORD_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for METADATA_GETALL_INTERNAL_RECORD_0 {} unsafe impl ::windows::core::Abi for METADATA_GETALL_INTERNAL_RECORD_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct METADATA_GETALL_RECORD { pub dwMDIdentifier: u32, pub dwMDAttributes: u32, pub dwMDUserType: u32, pub dwMDDataType: u32, pub dwMDDataLen: u32, pub dwMDDataOffset: u32, pub dwMDDataTag: u32, } impl METADATA_GETALL_RECORD {} impl ::core::default::Default for METADATA_GETALL_RECORD { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for METADATA_GETALL_RECORD { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("METADATA_GETALL_RECORD") .field("dwMDIdentifier", &self.dwMDIdentifier) .field("dwMDAttributes", &self.dwMDAttributes) .field("dwMDUserType", &self.dwMDUserType) .field("dwMDDataType", &self.dwMDDataType) .field("dwMDDataLen", &self.dwMDDataLen) .field("dwMDDataOffset", &self.dwMDDataOffset) .field("dwMDDataTag", &self.dwMDDataTag) .finish() } } impl ::core::cmp::PartialEq for METADATA_GETALL_RECORD { fn eq(&self, other: &Self) -> bool { self.dwMDIdentifier == other.dwMDIdentifier && self.dwMDAttributes == other.dwMDAttributes && self.dwMDUserType == other.dwMDUserType && self.dwMDDataType == other.dwMDDataType && self.dwMDDataLen == other.dwMDDataLen && self.dwMDDataOffset == other.dwMDDataOffset && self.dwMDDataTag == other.dwMDDataTag } } impl ::core::cmp::Eq for METADATA_GETALL_RECORD {} unsafe impl ::windows::core::Abi for METADATA_GETALL_RECORD { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct METADATA_HANDLE_INFO { pub dwMDPermissions: u32, pub dwMDSystemChangeNumber: u32, } impl METADATA_HANDLE_INFO {} impl ::core::default::Default for METADATA_HANDLE_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for METADATA_HANDLE_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("METADATA_HANDLE_INFO").field("dwMDPermissions", &self.dwMDPermissions).field("dwMDSystemChangeNumber", &self.dwMDSystemChangeNumber).finish() } } impl ::core::cmp::PartialEq for METADATA_HANDLE_INFO { fn eq(&self, other: &Self) -> bool { self.dwMDPermissions == other.dwMDPermissions && self.dwMDSystemChangeNumber == other.dwMDSystemChangeNumber } } impl ::core::cmp::Eq for METADATA_HANDLE_INFO {} unsafe impl ::windows::core::Abi for METADATA_HANDLE_INFO { type Abi = Self; } pub const METADATA_INHERIT: u32 = 1u32; pub const METADATA_INSERT_PATH: u32 = 64u32; pub const METADATA_ISINHERITED: u32 = 32u32; pub const METADATA_LOCAL_MACHINE_ONLY: u32 = 128u32; pub const METADATA_MASTER_ROOT_HANDLE: u32 = 0u32; pub const METADATA_MAX_NAME_LEN: u32 = 256u32; pub const METADATA_NON_SECURE_ONLY: u32 = 256u32; pub const METADATA_NO_ATTRIBUTES: u32 = 0u32; pub const METADATA_PARTIAL_PATH: u32 = 2u32; pub const METADATA_PERMISSION_READ: u32 = 1u32; pub const METADATA_PERMISSION_WRITE: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct METADATA_RECORD { pub dwMDIdentifier: u32, pub dwMDAttributes: u32, pub dwMDUserType: u32, pub dwMDDataType: u32, pub dwMDDataLen: u32, pub pbMDData: *mut u8, pub dwMDDataTag: u32, } impl METADATA_RECORD {} impl ::core::default::Default for METADATA_RECORD { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for METADATA_RECORD { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("METADATA_RECORD") .field("dwMDIdentifier", &self.dwMDIdentifier) .field("dwMDAttributes", &self.dwMDAttributes) .field("dwMDUserType", &self.dwMDUserType) .field("dwMDDataType", &self.dwMDDataType) .field("dwMDDataLen", &self.dwMDDataLen) .field("pbMDData", &self.pbMDData) .field("dwMDDataTag", &self.dwMDDataTag) .finish() } } impl ::core::cmp::PartialEq for METADATA_RECORD { fn eq(&self, other: &Self) -> bool { self.dwMDIdentifier == other.dwMDIdentifier && self.dwMDAttributes == other.dwMDAttributes && self.dwMDUserType == other.dwMDUserType && self.dwMDDataType == other.dwMDDataType && self.dwMDDataLen == other.dwMDDataLen && self.pbMDData == other.pbMDData && self.dwMDDataTag == other.dwMDDataTag } } impl ::core::cmp::Eq for METADATA_RECORD {} unsafe impl ::windows::core::Abi for METADATA_RECORD { type Abi = Self; } pub const METADATA_REFERENCE: u32 = 8u32; pub const METADATA_SECURE: u32 = 4u32; pub const METADATA_VOLATILE: u32 = 16u32; pub const MSCS_MD_ID_BEGIN_RESERVED: u32 = 53248u32; pub const MSCS_MD_ID_END_RESERVED: u32 = 57343u32; pub const NNTP_MD_ID_BEGIN_RESERVED: u32 = 45056u32; pub const NNTP_MD_ID_END_RESERVED: u32 = 49151u32; #[cfg(feature = "Win32_Foundation")] pub type PFN_GETEXTENSIONVERSION = unsafe extern "system" fn(pver: *mut HSE_VERSION_INFO) -> super::super::Foundation::BOOL; #[cfg(feature = "Win32_Foundation")] pub type PFN_HSE_CACHE_INVALIDATION_CALLBACK = unsafe extern "system" fn(pszurl: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT; #[cfg(feature = "Win32_Foundation")] pub type PFN_HSE_GET_PROTOCOL_MANAGER_CUSTOM_INTERFACE_CALLBACK = unsafe extern "system" fn(pszprotocolmanagerdll: super::super::Foundation::PWSTR, pszprotocolmanagerdllinitfunction: super::super::Foundation::PWSTR, dwcustominterfaceid: u32, ppcustominterface: *mut *mut ::core::ffi::c_void) -> ::windows::core::HRESULT; #[cfg(feature = "Win32_Foundation")] pub type PFN_HSE_IO_COMPLETION = unsafe extern "system" fn(pecb: *mut EXTENSION_CONTROL_BLOCK, pcontext: *mut ::core::ffi::c_void, cbio: u32, dwerror: u32); #[cfg(feature = "Win32_Foundation")] pub type PFN_HTTPEXTENSIONPROC = unsafe extern "system" fn(pecb: *mut EXTENSION_CONTROL_BLOCK) -> u32; #[cfg(feature = "Win32_Foundation")] pub type PFN_TERMINATEEXTENSION = unsafe extern "system" fn(dwflags: u32) -> super::super::Foundation::BOOL; #[cfg(feature = "Win32_Foundation")] pub type PFN_WEB_CORE_ACTIVATE = unsafe extern "system" fn(pszapphostconfigfile: super::super::Foundation::PWSTR, pszrootwebconfigfile: super::super::Foundation::PWSTR, pszinstancename: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT; #[cfg(feature = "Win32_Foundation")] pub type PFN_WEB_CORE_SET_METADATA_DLL_ENTRY = unsafe extern "system" fn(pszmetadatatype: super::super::Foundation::PWSTR, pszvalue: super::super::Foundation::PWSTR) -> ::windows::core::HRESULT; pub type PFN_WEB_CORE_SHUTDOWN = unsafe extern "system" fn(fimmediate: u32) -> ::windows::core::HRESULT; pub const POP3_MD_ID_BEGIN_RESERVED: u32 = 40960u32; pub const POP3_MD_ID_END_RESERVED: u32 = 45055u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct POST_PROCESS_PARAMETERS { pub pszSessionId: super::super::Foundation::PWSTR, pub pszSiteName: super::super::Foundation::PWSTR, pub pszUserName: super::super::Foundation::PWSTR, pub pszHostName: super::super::Foundation::PWSTR, pub pszRemoteIpAddress: super::super::Foundation::PWSTR, pub dwRemoteIpPort: u32, pub pszLocalIpAddress: super::super::Foundation::PWSTR, pub dwLocalIpPort: u32, pub BytesSent: u64, pub BytesReceived: u64, pub pszCommand: super::super::Foundation::PWSTR, pub pszCommandParameters: super::super::Foundation::PWSTR, pub pszFullPath: super::super::Foundation::PWSTR, pub pszPhysicalPath: super::super::Foundation::PWSTR, pub FtpStatus: u32, pub FtpSubStatus: u32, pub hrStatus: ::windows::core::HRESULT, pub SessionStartTime: super::super::Foundation::FILETIME, pub BytesSentPerSession: u64, pub BytesReceivedPerSession: u64, } #[cfg(feature = "Win32_Foundation")] impl POST_PROCESS_PARAMETERS {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for POST_PROCESS_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for POST_PROCESS_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("POST_PROCESS_PARAMETERS") .field("pszSessionId", &self.pszSessionId) .field("pszSiteName", &self.pszSiteName) .field("pszUserName", &self.pszUserName) .field("pszHostName", &self.pszHostName) .field("pszRemoteIpAddress", &self.pszRemoteIpAddress) .field("dwRemoteIpPort", &self.dwRemoteIpPort) .field("pszLocalIpAddress", &self.pszLocalIpAddress) .field("dwLocalIpPort", &self.dwLocalIpPort) .field("BytesSent", &self.BytesSent) .field("BytesReceived", &self.BytesReceived) .field("pszCommand", &self.pszCommand) .field("pszCommandParameters", &self.pszCommandParameters) .field("pszFullPath", &self.pszFullPath) .field("pszPhysicalPath", &self.pszPhysicalPath) .field("FtpStatus", &self.FtpStatus) .field("FtpSubStatus", &self.FtpSubStatus) .field("hrStatus", &self.hrStatus) .field("SessionStartTime", &self.SessionStartTime) .field("BytesSentPerSession", &self.BytesSentPerSession) .field("BytesReceivedPerSession", &self.BytesReceivedPerSession) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for POST_PROCESS_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.pszSessionId == other.pszSessionId && self.pszSiteName == other.pszSiteName && self.pszUserName == other.pszUserName && self.pszHostName == other.pszHostName && self.pszRemoteIpAddress == other.pszRemoteIpAddress && self.dwRemoteIpPort == other.dwRemoteIpPort && self.pszLocalIpAddress == other.pszLocalIpAddress && self.dwLocalIpPort == other.dwLocalIpPort && self.BytesSent == other.BytesSent && self.BytesReceived == other.BytesReceived && self.pszCommand == other.pszCommand && self.pszCommandParameters == other.pszCommandParameters && self.pszFullPath == other.pszFullPath && self.pszPhysicalPath == other.pszPhysicalPath && self.FtpStatus == other.FtpStatus && self.FtpSubStatus == other.FtpSubStatus && self.hrStatus == other.hrStatus && self.SessionStartTime == other.SessionStartTime && self.BytesSentPerSession == other.BytesSentPerSession && self.BytesReceivedPerSession == other.BytesReceivedPerSession } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for POST_PROCESS_PARAMETERS {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for POST_PROCESS_PARAMETERS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct PRE_PROCESS_PARAMETERS { pub pszSessionId: super::super::Foundation::PWSTR, pub pszSiteName: super::super::Foundation::PWSTR, pub pszUserName: super::super::Foundation::PWSTR, pub pszHostName: super::super::Foundation::PWSTR, pub pszRemoteIpAddress: super::super::Foundation::PWSTR, pub dwRemoteIpPort: u32, pub pszLocalIpAddress: super::super::Foundation::PWSTR, pub dwLocalIpPort: u32, pub pszCommand: super::super::Foundation::PWSTR, pub pszCommandParameters: super::super::Foundation::PWSTR, pub SessionStartTime: super::super::Foundation::FILETIME, pub BytesSentPerSession: u64, pub BytesReceivedPerSession: u64, } #[cfg(feature = "Win32_Foundation")] impl PRE_PROCESS_PARAMETERS {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for PRE_PROCESS_PARAMETERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for PRE_PROCESS_PARAMETERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("PRE_PROCESS_PARAMETERS") .field("pszSessionId", &self.pszSessionId) .field("pszSiteName", &self.pszSiteName) .field("pszUserName", &self.pszUserName) .field("pszHostName", &self.pszHostName) .field("pszRemoteIpAddress", &self.pszRemoteIpAddress) .field("dwRemoteIpPort", &self.dwRemoteIpPort) .field("pszLocalIpAddress", &self.pszLocalIpAddress) .field("dwLocalIpPort", &self.dwLocalIpPort) .field("pszCommand", &self.pszCommand) .field("pszCommandParameters", &self.pszCommandParameters) .field("SessionStartTime", &self.SessionStartTime) .field("BytesSentPerSession", &self.BytesSentPerSession) .field("BytesReceivedPerSession", &self.BytesReceivedPerSession) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for PRE_PROCESS_PARAMETERS { fn eq(&self, other: &Self) -> bool { self.pszSessionId == other.pszSessionId && self.pszSiteName == other.pszSiteName && self.pszUserName == other.pszUserName && self.pszHostName == other.pszHostName && self.pszRemoteIpAddress == other.pszRemoteIpAddress && self.dwRemoteIpPort == other.dwRemoteIpPort && self.pszLocalIpAddress == other.pszLocalIpAddress && self.dwLocalIpPort == other.dwLocalIpPort && self.pszCommand == other.pszCommand && self.pszCommandParameters == other.pszCommandParameters && self.SessionStartTime == other.SessionStartTime && self.BytesSentPerSession == other.BytesSentPerSession && self.BytesReceivedPerSession == other.BytesReceivedPerSession } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for PRE_PROCESS_PARAMETERS {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for PRE_PROCESS_PARAMETERS { type Abi = Self; } pub const SF_DENIED_APPLICATION: u32 = 8u32; pub const SF_DENIED_BY_CONFIG: u32 = 65536u32; pub const SF_DENIED_FILTER: u32 = 4u32; pub const SF_DENIED_LOGON: u32 = 1u32; pub const SF_DENIED_RESOURCE: u32 = 2u32; pub const SF_MAX_AUTH_TYPE: u32 = 33u32; pub const SF_MAX_FILTER_DESC_LEN: u32 = 257u32; pub const SF_MAX_PASSWORD: u32 = 257u32; pub const SF_MAX_USERNAME: u32 = 257u32; pub const SF_NOTIFY_ACCESS_DENIED: u32 = 2048u32; pub const SF_NOTIFY_AUTHENTICATION: u32 = 8192u32; pub const SF_NOTIFY_AUTH_COMPLETE: u32 = 67108864u32; pub const SF_NOTIFY_END_OF_NET_SESSION: u32 = 256u32; pub const SF_NOTIFY_END_OF_REQUEST: u32 = 128u32; pub const SF_NOTIFY_LOG: u32 = 512u32; pub const SF_NOTIFY_NONSECURE_PORT: u32 = 2u32; pub const SF_NOTIFY_ORDER_DEFAULT: u32 = 131072u32; pub const SF_NOTIFY_ORDER_HIGH: u32 = 524288u32; pub const SF_NOTIFY_ORDER_LOW: u32 = 131072u32; pub const SF_NOTIFY_ORDER_MEDIUM: u32 = 262144u32; pub const SF_NOTIFY_PREPROC_HEADERS: u32 = 16384u32; pub const SF_NOTIFY_READ_RAW_DATA: u32 = 32768u32; pub const SF_NOTIFY_SECURE_PORT: u32 = 1u32; pub const SF_NOTIFY_SEND_RAW_DATA: u32 = 1024u32; pub const SF_NOTIFY_SEND_RESPONSE: u32 = 64u32; pub const SF_NOTIFY_URL_MAP: u32 = 4096u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct SF_PROPERTY_IIS(pub i32); pub const SF_PROPERTY_SSL_CTXT: SF_PROPERTY_IIS = SF_PROPERTY_IIS(0i32); pub const SF_PROPERTY_INSTANCE_NUM_ID: SF_PROPERTY_IIS = SF_PROPERTY_IIS(1i32); impl ::core::convert::From<i32> for SF_PROPERTY_IIS { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SF_PROPERTY_IIS { 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 SF_REQ_TYPE(pub i32); pub const SF_REQ_SEND_RESPONSE_HEADER: SF_REQ_TYPE = SF_REQ_TYPE(0i32); pub const SF_REQ_ADD_HEADERS_ON_DENIAL: SF_REQ_TYPE = SF_REQ_TYPE(1i32); pub const SF_REQ_SET_NEXT_READ_SIZE: SF_REQ_TYPE = SF_REQ_TYPE(2i32); pub const SF_REQ_SET_PROXY_INFO: SF_REQ_TYPE = SF_REQ_TYPE(3i32); pub const SF_REQ_GET_CONNID: SF_REQ_TYPE = SF_REQ_TYPE(4i32); pub const SF_REQ_SET_CERTIFICATE_INFO: SF_REQ_TYPE = SF_REQ_TYPE(5i32); pub const SF_REQ_GET_PROPERTY: SF_REQ_TYPE = SF_REQ_TYPE(6i32); pub const SF_REQ_NORMALIZE_URL: SF_REQ_TYPE = SF_REQ_TYPE(7i32); pub const SF_REQ_DISABLE_NOTIFICATIONS: SF_REQ_TYPE = SF_REQ_TYPE(8i32); impl ::core::convert::From<i32> for SF_REQ_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SF_REQ_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 SF_STATUS_TYPE(pub i32); pub const SF_STATUS_REQ_FINISHED: SF_STATUS_TYPE = SF_STATUS_TYPE(134217728i32); pub const SF_STATUS_REQ_FINISHED_KEEP_CONN: SF_STATUS_TYPE = SF_STATUS_TYPE(134217729i32); pub const SF_STATUS_REQ_NEXT_NOTIFICATION: SF_STATUS_TYPE = SF_STATUS_TYPE(134217730i32); pub const SF_STATUS_REQ_HANDLED_NOTIFICATION: SF_STATUS_TYPE = SF_STATUS_TYPE(134217731i32); pub const SF_STATUS_REQ_ERROR: SF_STATUS_TYPE = SF_STATUS_TYPE(134217732i32); pub const SF_STATUS_REQ_READ_NEXT: SF_STATUS_TYPE = SF_STATUS_TYPE(134217733i32); impl ::core::convert::From<i32> for SF_STATUS_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SF_STATUS_TYPE { type Abi = Self; } pub const SMTP_MD_ID_BEGIN_RESERVED: u32 = 36864u32; pub const SMTP_MD_ID_END_RESERVED: u32 = 40959u32; pub const USER_MD_ID_BASE_RESERVED: u32 = 65535u32; pub const WAM_MD_ID_BEGIN_RESERVED: u32 = 29952u32; pub const WAM_MD_ID_END_RESERVED: u32 = 32767u32; pub const WAM_MD_SERVER_BASE: u32 = 7500u32; pub const WEBDAV_MD_SERVER_BASE: u32 = 8500u32; #[repr(C)] #[derive(:: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy)] pub struct _IIS_CRYPTO_BLOB(pub u8);
use super::ema::rma_func; use super::VarResult; use crate::ast::stat_expr_types::VarIndex; use crate::ast::syntax_type::{FunctionType, FunctionTypes, SimpleSyntaxType, SyntaxType}; use crate::helper::{ ensure_srcs, float_abs, float_max, ge1_param_i64, move_element, pine_ref_to_bool, pine_ref_to_f64, pine_ref_to_f64_series, pine_ref_to_i64, series_index, }; use crate::runtime::context::{downcast_ctx, Ctx}; use crate::runtime::InputSrc; use crate::types::{ downcast_pf_ref, int2float, Arithmetic, Callable, CallableCreator, CallableFactory, Float, Int, ParamCollectCall, PineRef, RefData, RuntimeErr, Series, SeriesCall, }; use std::mem; use std::rc::Rc; type GenIndexFunc<'a> = fn(&mut dyn Ctx<'a>) -> VarIndex; type GetValFunc = fn(&Option<RefData<Series<Float>>>, i64) -> Float; fn gen_high_index<'a>(ctx: &mut dyn Ctx<'a>) -> VarIndex { VarIndex::new(*ctx.get_varname_index("high").unwrap(), 0) } pub fn get_max_val<'a>(source: &Option<RefData<Series<Float>>>, length: i64) -> Float { let mut max_val = Some(0f64); for i in 0..length as usize { let cur_val = series_index(source, i); if cur_val.is_some() && cur_val > max_val { max_val = cur_val; } } max_val } #[derive(Debug, Clone, PartialEq)] struct AtrVal { src_name: &'static str, run_func: *mut (), dest_index: VarIndex, } impl AtrVal { pub fn new(src_name: &'static str, run_func: *mut ()) -> AtrVal { AtrVal { src_name, run_func, dest_index: VarIndex::new(0, 0), } } } impl<'a> SeriesCall<'a> for AtrVal { fn step( &mut self, ctx: &mut dyn Ctx<'a>, mut param: Vec<Option<PineRef<'a>>>, _func_type: FunctionType<'a>, ) -> Result<PineRef<'a>, RuntimeErr> { let source; let length; let runner = unsafe { mem::transmute::<_, GetValFunc>(self.run_func) }; if _func_type.signature.0.len() == 1 { ensure_srcs(ctx, vec![self.src_name], |indexs| { self.dest_index = indexs[0]; }); source = pine_ref_to_f64_series(ctx.get_var(self.dest_index).clone()); length = ge1_param_i64("length", pine_ref_to_i64(mem::replace(&mut param[0], None)))?; } else { source = pine_ref_to_f64_series(mem::replace(&mut param[0], None)); length = ge1_param_i64("length", pine_ref_to_i64(mem::replace(&mut param[1], None)))?; } let max_val = runner(&source, length); Ok(PineRef::new_rc(Series::from(max_val))) } fn copy(&self) -> Box<dyn SeriesCall<'a> + 'a> { Box::new(self.clone()) } } #[derive(Debug, Clone, PartialEq)] struct SmaCreator { src_name: &'static str, handle: *mut (), } impl SmaCreator { pub fn new(src_name: &'static str, handle: *mut ()) -> SmaCreator { SmaCreator { src_name, handle } } } impl<'a> CallableCreator<'a> for SmaCreator { fn create(&self) -> Callable<'a> { Callable::new( None, Some(Box::new(ParamCollectCall::new_with_caller(Box::new( AtrVal::new(self.src_name, self.handle), )))), ) } fn copy(&self) -> Box<dyn CallableCreator<'a>> { Box::new(self.clone()) } } pub fn declare_s_var<'a>( name: &'static str, src_name: &'static str, run_func: GetValFunc, ) -> VarResult<'a> { let value = PineRef::new(CallableFactory::new_with_creator(Box::new( SmaCreator::new(src_name, run_func as *mut ()), ))); let func_type = FunctionTypes(vec![ FunctionType::new(( vec![("length", SyntaxType::int())], SyntaxType::float_series(), )), FunctionType::new(( vec![ ("source", SyntaxType::float_series()), ("length", SyntaxType::int()), ], SyntaxType::float_series(), )), ]); let syntax_type = SyntaxType::Function(Rc::new(func_type)); VarResult::new(value, syntax_type, name) } pub fn declare_var<'a>() -> VarResult<'a> { declare_s_var("highest", "high", get_max_val) } #[cfg(test)] mod tests { use super::*; use crate::ast::syntax_type::SyntaxType; use crate::runtime::VarOperate; use crate::runtime::{AnySeries, NoneCallback}; use crate::types::Series; use crate::{LibInfo, PineParser, PineRunner}; #[test] fn accdist_test() { let lib_info = LibInfo::new( vec![declare_var()], vec![ ("close", SyntaxType::float_series()), ("high", SyntaxType::float_series()), ], ); let src = "m1 = highest(2)\nm2 = highest(close, 2)"; let blk = PineParser::new(src, &lib_info).parse_blk().unwrap(); let mut runner = PineRunner::new(&lib_info, &blk, &NoneCallback()); runner .run( &vec![ ( "close", AnySeries::from_float_vec(vec![Some(10f64), Some(20f64), Some(5f64)]), ), ( "high", AnySeries::from_float_vec(vec![Some(19f64), Some(25f64), Some(10f64)]), ), ], None, ) .unwrap(); assert_eq!( runner.get_context().get_var(VarIndex::new(0, 0)), &Some(PineRef::new(Series::from_vec(vec![ Some(19f64), Some(25f64), Some(25f64) ]))) ); assert_eq!( runner.get_context().get_var(VarIndex::new(1, 0)), &Some(PineRef::new(Series::from_vec(vec![ Some(10f64), Some(20f64), Some(20f64) ]))) ); } }
#[cfg_attr(rustfmt, rustfmt_skip)] #[allow(nonstandard_style, non_upper_case_globals)] pub mod atoms { // During the build step, `build.rs` will output the generated atoms to `OUT_DIR` to avoid // adding it to the source directory, so we just directly include the generated code here. include!(concat!(env!("OUT_DIR"), "/atoms.rs")); } mod table; pub use self::table::AtomData; use core::convert::AsRef; use core::fmt::{self, Debug, Display}; use core::hash::{Hash, Hasher}; use core::mem; use core::ptr::{self, NonNull}; use core::str::{self, FromStr, Utf8Error}; use firefly_binary::Encoding; use super::OpaqueTerm; /// The maximum length of an atom (255) pub const MAX_ATOM_LENGTH: usize = u16::max_value() as usize; /// Produced by operations which create atoms #[derive(Debug)] pub enum AtomError { InvalidLength(usize), NonExistent, InvalidString(Utf8Error), } #[cfg(feature = "std")] impl std::error::Error for AtomError { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { match self { Self::InvalidString(ref err) => Some(err), _ => None, } } } impl From<Utf8Error> for AtomError { #[inline] fn from(err: Utf8Error) -> Self { Self::InvalidString(err) } } impl Display for AtomError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Self::InvalidLength(len) => write!( f, "invalid atom, length is {}, maximum length is {}", len, MAX_ATOM_LENGTH ), Self::NonExistent => f.write_str("tried to convert to an atom that doesn't exist"), Self::InvalidString(err) => write!(f, "invalid utf-8 bytes: {}", &err), } } } impl Eq for AtomError {} impl PartialEq for AtomError { fn eq(&self, other: &AtomError) -> bool { mem::discriminant(self) == mem::discriminant(other) } } /// An atom is an interned string value with fast, constant-time equality comparison, /// can be encoded as an immediate value, and only requires allocation once over the lifetime /// of the program. #[repr(transparent)] #[derive(Copy, Clone, PartialEq, Eq)] pub struct Atom(*const AtomData); unsafe impl Send for Atom {} unsafe impl Sync for Atom {} impl Atom { /// Creates a new atom from a slice of bytes interpreted as Latin-1. /// /// Returns `Err` if the atom does not exist #[inline] pub fn try_from_latin1_bytes_existing(name: &[u8]) -> Result<Self, AtomError> { Self::try_from_str_existing(str::from_utf8(name)?) } /// Creates a new atom from a `str`, but only if the atom already exists /// /// Returns `Err` if the atom does not exist #[inline] pub fn try_from_str_existing<S: AsRef<str>>(s: S) -> Result<Self, AtomError> { let name = s.as_ref(); match name { "false" => Ok(atoms::False), "true" => Ok(atoms::True), name => { Self::validate(name)?; if let Some(data) = table::get_data(name) { return Ok(Self(data.as_ptr() as *const AtomData)); } Err(AtomError::NonExistent) } } } /// For convenience, this function takes a `str`, creates an atom /// from it, and immediately encodes the resulting `Atom` as an `OpaqueTerm` /// /// Panics if the name is invalid, the table overflows, or term encoding fails #[inline] pub fn str_to_term<S: AsRef<str>>(s: S) -> OpaqueTerm { Self::from_str(s.as_ref()).unwrap().into() } /// This function is intended for internal use only. /// /// # Safety /// /// You must ensure the following is true of the given pointer: /// /// * It points to a null-terminated C-string /// * The content of the string is valid UTF-8 data /// * The pointer is valid for the entire lifetime of the program /// /// If any of these constraints are violated, the behavior is undefined. #[inline] pub(crate) unsafe fn from_raw_cstr(ptr: *const core::ffi::c_char) -> Self { use core::ffi::CStr; let cs = CStr::from_ptr::<'static>(ptr); let name = cs.to_str().unwrap_or_else(|error| { panic!( "unable to construct atom from cstr `{}` due to invalid utf-8: {:?}", cs.to_string_lossy(), error, ) }); match name { "false" => atoms::False, "true" => atoms::True, name => { let ptr = table::get_data_or_insert_static(name).unwrap(); Self(ptr.as_ptr() as *const AtomData) } } } /// Returns `true` if this atom represents a boolean pub fn is_boolean(self) -> bool { self == atoms::False || self == atoms::True } /// Converts this atom to a boolean /// /// This function will panic if the atom is not a boolean value pub fn as_boolean(self) -> bool { debug_assert!(self.is_boolean()); self != atoms::False } /// Gets the string value of this atom pub fn as_str(&self) -> &'static str { // SAFETY: Atom contents are validated when creating the raw atom data, so converting back to str is safe match self { &atoms::False => "false", &atoms::True => "true", _ => unsafe { (&*self.0).as_str().unwrap() }, } } #[inline(always)] pub(crate) unsafe fn as_ptr(&self) -> *const AtomData { self.0 } /// Returns true if this atom requires quotes when printing as an Erlang term pub fn needs_quotes(&self) -> bool { // See https://github.com/erlang/otp/blob/ca83f680aab717fe65634247d16f18a8cbfc6d8d/erts/emulator/beam/erl_printf_term.c#L193-L212 let mut chars = self.as_str().chars(); match chars.next() { Some(first_char) => { // https://github.com/erlang/otp/blob/ca83f680aab717fe65634247d16f18a8cbfc6d8d/erts/emulator/beam/erl_printf_term.c#L198-L199 // -> https://github.com/erlang/otp/blob/ca83f680aab717fe65634247d16f18a8cbfc6d8d/erts/emulator/beam/erl_printf_term.c#L98 !first_char.is_ascii_lowercase() || { // https://github.com/erlang/otp/blob/ca83f680aab717fe65634247d16f18a8cbfc6d8d/erts/emulator/beam/erl_printf_term.c#L201-L200 // -> https://github.com/erlang/otp/blob/ca83f680aab717fe65634247d16f18a8cbfc6d8d/erts/emulator/beam/erl_printf_term.c#L102 // -> https://github.com/erlang/otp/blob/ca83f680aab717fe65634247d16f18a8cbfc6d8d/erts/emulator/beam/erl_printf_term.c#L91 // -> https://github.com/erlang/otp/blob/ca83f680aab717fe65634247d16f18a8cbfc6d8d/erts/emulator/beam/erl_printf_term.c#L91 // -> https://github.com/erlang/otp/blob/ca83f680aab717fe65634247d16f18a8cbfc6d8d/erts/emulator/beam/erl_printf_term.c#L99 chars.any(|c| (!c.is_ascii_alphanumeric() && c != '_')) } } // https://github.com/erlang/otp/blob/ca83f680aab717fe65634247d16f18a8cbfc6d8d/erts/emulator/beam/erl_printf_term.c#L187-L190 None => true, } } fn validate(name: &str) -> Result<(), AtomError> { let len = name.len(); if len > MAX_ATOM_LENGTH { return Err(AtomError::InvalidLength(len)); } Ok(()) } } impl From<NonNull<AtomData>> for Atom { #[inline] fn from(ptr: NonNull<AtomData>) -> Self { Self(ptr.as_ptr() as *const AtomData) } } impl From<bool> for Atom { #[inline] fn from(b: bool) -> Self { if b { atoms::True } else { atoms::False } } } impl TryFrom<&str> for Atom { type Error = AtomError; fn try_from(s: &str) -> Result<Self, Self::Error> { match s { "false" => Ok(atoms::False), "true" => Ok(atoms::True), s => { Self::validate(s)?; if let Some(data) = table::get_data(s) { return Ok(Self(data.as_ptr() as *const AtomData)); } let ptr = unsafe { table::get_data_or_insert(s)? }; Ok(Self(ptr.as_ptr() as *const AtomData)) } } } } impl TryFrom<&[u8]> for Atom { type Error = AtomError; #[inline] fn try_from(bytes: &[u8]) -> Result<Self, Self::Error> { Atom::try_from(str::from_utf8(bytes)?) } } // Support converting from atom terms to `Encoding` type impl TryInto<Encoding> for Atom { type Error = anyhow::Error; #[inline] fn try_into(self) -> Result<Encoding, Self::Error> { self.as_str().parse() } } impl FromStr for Atom { type Err = AtomError; /// Creates a new atom from a `str`. /// /// Returns `Err` if the atom name is invalid or the table overflows #[inline(always)] fn from_str(s: &str) -> Result<Self, Self::Err> { Atom::try_from(s) } } impl PartialOrd for Atom { fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> { Some(self.cmp(other)) } } impl PartialEq<str> for Atom { fn eq(&self, other: &str) -> bool { self.as_str() == other } } impl Ord for Atom { fn cmp(&self, other: &Self) -> core::cmp::Ordering { self.as_str().cmp(other.as_str()) } } impl Debug for Atom { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Atom({:p})", self.0) } } impl fmt::Pointer for Atom { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:p}", self.0) } } impl Display for Atom { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { use core::fmt::Write; let needs_quotes = self.needs_quotes(); if needs_quotes { f.write_char('\'')?; } for c in self.as_str().chars() { // https://github.com/erlang/otp/blob/dbf25321bdfdc3f4aae422b8ba2c0f31429eba61/erts/emulator/beam/erl_printf_term.c#L215-L232 match c { '\'' => f.write_str("\\'")?, '\\' => f.write_str("\\\\")?, '\n' => f.write_str("\\n")?, '\u{C}' => f.write_str("\\f")?, '\t' => f.write_str("\\t")?, '\r' => f.write_str("\\r")?, '\u{8}' => f.write_str("\\b")?, '\u{B}' => f.write_str("\\v")?, _ if c.is_control() => write!(f, "\\{:o}", c as u8)?, _ => f.write_char(c)?, } } if needs_quotes { f.write_char('\'')?; } Ok(()) } } impl Hash for Atom { fn hash<H: Hasher>(&self, state: &mut H) { ptr::hash(self.0, state); } } /// This is a helper which allows compiled code to convert a pointer to a C string value into an atom directly. #[export_name = "__firefly_builtin_atom_from_cstr"] pub unsafe extern "C-unwind" fn atom_from_cstr(ptr: *const core::ffi::c_char) -> OpaqueTerm { let atom = Atom::from_raw_cstr(ptr); atom.into() }
use crate::context::RpcContext; use crate::v04::types::TransactionWithHash; crate::error::generate_rpc_error_subset!(PendingTransactionsError:); pub async fn pending_transactions( context: RpcContext, ) -> Result<Vec<TransactionWithHash>, PendingTransactionsError> { let transactions = match context.pending_data { Some(data) => match data.block().await { Some(block) => block .transactions .iter() .map(|x| { let common_tx = pathfinder_common::transaction::Transaction::from(x.clone()); common_tx.into() }) .collect(), None => Vec::new(), }, None => Vec::new(), }; Ok(transactions) } #[cfg(test)] mod tests { use crate::v04::types::Transaction; use super::*; use pathfinder_common::macro_prelude::*; use pathfinder_common::transaction::DeployTransaction; use pathfinder_common::transaction::EntryPointType::External; use pathfinder_common::transaction::InvokeTransactionV0; use pathfinder_common::transaction::TransactionVariant; use pretty_assertions::assert_eq; #[tokio::test] async fn pending() { // Transcribed from the `RpcContext::for_tests_with_pending` transactions. let tx0 = TransactionWithHash { transaction_hash: transaction_hash_bytes!(b"pending tx hash 0"), txn: Transaction(TransactionVariant::InvokeV0(InvokeTransactionV0 { sender_address: contract_address_bytes!(b"pending contract addr 0"), entry_point_selector: entry_point_bytes!(b"entry point 0"), entry_point_type: Some(External), ..Default::default() })), }; let tx1 = TransactionWithHash { transaction_hash: transaction_hash_bytes!(b"pending tx hash 1"), txn: Transaction(TransactionVariant::Deploy(DeployTransaction { contract_address: contract_address!("0x1122355"), class_hash: class_hash_bytes!(b"pending class hash 1"), contract_address_salt: contract_address_salt_bytes!(b"salty"), ..Default::default() })), }; let tx2 = TransactionWithHash { transaction_hash: transaction_hash_bytes!(b"pending reverted"), txn: Transaction(TransactionVariant::InvokeV0(InvokeTransactionV0 { sender_address: contract_address_bytes!(b"pending contract addr 0"), entry_point_selector: entry_point_bytes!(b"entry point 0"), entry_point_type: Some(External), ..Default::default() })), }; let expected = vec![tx0, tx1, tx2]; let context = RpcContext::for_tests_with_pending().await; let result = pending_transactions(context).await.unwrap(); assert_eq!(result, expected); } }
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // compile-flags:-Zborrowck=mir -Zverbose #![allow(warnings)] use std::fmt::Debug; fn no_region<'a, T>(x: Box<T>) -> impl Debug + 'a //~^ WARNING not reporting region error due to nll where T: Debug, { x //~^ ERROR the parameter type `T` may not live long enough [E0309] } fn correct_region<'a, T>(x: Box<T>) -> impl Debug + 'a where T: 'a + Debug, { x } fn wrong_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a //~^ WARNING not reporting region error due to nll where T: 'b + Debug, { x //~^ ERROR the parameter type `T` may not live long enough [E0309] } fn outlives_region<'a, 'b, T>(x: Box<T>) -> impl Debug + 'a where T: 'b + Debug, 'b: 'a, { x } fn main() {}
extern crate math; use math::round; use std::vec::Vec; // Sorts array a[0..n-1] by recursive mergesort // Input: An array a[0..n-1] of orderable elements // Output: Array a[0..n-1] sorted in nondecreasing order fn mergesort(a: &mut Vec<u8>) { let n = a.len(); if n > 1 { let nh: usize = round::floor(n as f64 / 2.0, 0) as usize; let mut b = Vec::from(&a[0..nh]); let mut c = Vec::from(&a[nh..n]); mergesort(&mut b); mergesort(&mut c); merge(&b, &c, a); } } // Merges two sorted array into one sorted array // Input: Arrays b[0..p-1] and c[0..q-1] both sorted // Output: Sorted array a[0..p+q-1] of the elements of b and c fn merge(b: &Vec<u8>, c: &Vec<u8>, a: &mut Vec<u8>) { let p = b.len(); let q = c.len(); let mut i = 0; let mut j = 0; let mut k = 0; while i < p && j < q { if b[i] <= c[j] { a[k] = b[i]; i = i + 1; } else { a[k] = c[j]; j = j + 1; } k = k + 1; } if i == p { for x in j..q { a[(x - j) + k] = c[x]; } } else { for x in i..p { a[(x - i) + k] = b[x]; } } } fn main() { // sort example array from book let mut a: Vec<u8> = vec![8, 3, 2, 9, 7, 1, 5, 4]; println!("Array before mergesort: {:?}", a); mergesort(&mut a); println!("Array after mergesort: {:?}", a); }
use diesel::mysql::MysqlConnection; use hyper::{Body, Request, StatusCode, Chunk}; use futures::{future, Future, Stream}; use crate::types::response::*; use crate::utils::{response::{create_response, create_error_message}, validator::parse_form}; use crate::consts::ErrorCode; use crate::models::book::{Book, NewBook}; use crate::dto::{IdDto, NewBookDto}; pub fn get_book_by_id(req: Request<Body>, db_conn: &MysqlConnection) -> ResponseFuture { let books = vec!["Anna Karenina", "Kobsar"]; let response = req.into_body() .concat2() .and_then(move |chunk: Chunk| parse_form::<IdDto>(&chunk)) .and_then(move |result| { let response = match result { Ok(data) => { info!("Preparing to succesfull server response, {:#?}", data); // create_response(StatusCode::CREATED, books.get(0).unwrap()) unimplemented!() } Err(error) => { error!("Preparing to send bad_request server response"); create_response::<String>(StatusCode::BAD_REQUEST, create_error_message(error)) } }; Ok(response) }); Box::new(response) } pub fn get_all_books(req: Request<Body>, db_conn: &MysqlConnection) -> ResponseFuture { let books = Book::find_all(db_conn); let response = if let Ok(json) = serde_json::to_string(&books) { create_response(StatusCode::OK, json) } else { create_response(StatusCode::INTERNAL_SERVER_ERROR, create_error_message(ErrorCode::INTERNAL)) }; Box::new(future::ok(response)) } pub fn create_book(req: Request<Body>, db_conn: &MysqlConnection) -> ResponseFuture { let response = req.into_body() .concat2() .and_then(move |chunk: Chunk| parse_form::<NewBookDto>(&chunk)) .and_then(move |result| { let response = match result { Ok(data) => { let book = Book::insert(&NewBook::from(data) , db_conn); info!("Book inserted, {:#?}", book); create_response(StatusCode::CREATED, vec!(book as u8)) } Err(error) => { error!("Preparing to send bad_request server response"); create_response::<String>(StatusCode::BAD_REQUEST, create_error_message(error)) } }; Ok(response) }); Box::new(response) }
extern crate cc; fn main() { cc::Build::new() .file("src/unix/extern_seccomp.c") .compile("seccomp"); cc::Build::new() .file("src/unix/extern_open.c") .compile("open"); }
use charter::chart::{HorizontalBarChart, BarData}; #[test] fn plot_horizontal_bar_graph_internals() { let mut hbc = HorizontalBarChart::new(false); hbc.push(BarData("five".to_string(), 5)); hbc.push(BarData("nine".to_string(), 9)); hbc.push(BarData("three".to_string(), 3)); let plotted = hbc.plot_internal(); assert_eq!("#####\n#########\n###", plotted.join("\n")); } #[test] fn plot_horizontal_bar_graph_internals_padded() { let mut hbc = HorizontalBarChart::new(true); hbc.push(BarData("five".to_string(), 5)); hbc.push(BarData("nine".to_string(), 9)); hbc.push(BarData("three".to_string(), 3)); let plotted = hbc.plot_internal(); assert_eq!("#####\n\n#########\n\n###", plotted.join("\n")); } #[test] fn plot_bar_labels_horizontal_bar_graph_internals() { let mut hbc = HorizontalBarChart::new(false); hbc.push(BarData("five".to_string(), 5)); hbc.push(BarData("nine".to_string(), 9)); hbc.push(BarData("three".to_string(), 3)); let plotted = hbc.plot_bar_labels(); assert_eq!("five | #####\nnine | #########\nthree | ###", plotted.join("\n")); } #[test] fn plot_bar_labels_horizontal_bar_graph_internals_padded() { let mut hbc = HorizontalBarChart::new(true); hbc.push(BarData("five".to_string(), 5)); hbc.push(BarData("nine".to_string(), 9)); hbc.push(BarData("three".to_string(), 3)); let plotted = hbc.plot_bar_labels(); assert_eq!("five | #####\n |\nnine | #########\n |\nthree | ###", plotted.join("\n")); } #[test] fn plot_bar_labels_horizontal_bar_graph_scaled() { let mut hbc = HorizontalBarChart::new(false); hbc.push(BarData("testvalue".to_string(), 16)); hbc.push(BarData("testval".to_string(), 5)); hbc.push(BarData("testval2".to_string(), 10)); hbc.width = 20; let plotted = hbc.plot_bar_labels(); assert_eq!("testvalue | ########\ntestval | ##\ntestval2 | #####", plotted.join("\n")); }
use std::collections::{HashMap, BTreeMap}; pub struct Version { pub value: String, pub dependencies: Vec<String>, pub timestamp: i64, } pub struct Item { versions: BTreeMap<i64, Version>, current: i64 } impl Item { pub fn new() -> Item { Item{ versions: BTreeMap::new(), current: 0 } } pub fn get(&self) -> Option<&Version> { // returns the latest committed version if self.current > 0 { let version = self.versions.get(&self.current).unwrap(); return Some(version); } None } pub fn insert(&mut self, value: String, dependencies: Vec<String>, timestamp: i64) { let v = Version{value: value, dependencies: dependencies, timestamp:timestamp }; self.versions.insert(timestamp, v); } pub fn commit(&mut self, timestamp: i64) { if timestamp > self.current { self.current = timestamp; } } pub fn get_version(&self, timestamp: i64) -> Option<&Version> { if let Some(version) = self.versions.get(&timestamp) { return Some(version); } None } } #[test] fn test_get_item_version() { let mut i = Item::new(); i.insert("tiny baby".to_string(), deps(), 2); assert_eq!(0, i.current); i.commit(2); assert_eq!(2, i.current); i.insert("tiny baby foot".to_string(), deps(), 1); i.commit(1); assert_eq!(2, i.current); // } pub struct Database { items: HashMap<String, Item>, open_transactions: HashMap<i64, Transaction>, } struct Transaction { keys: Vec<String> } impl Transaction { pub fn new() -> Transaction { Transaction{ keys: Vec::new() } } } impl Database { // not thread safe. you need to wrap the db with a channel // last write wins databse pub fn new() -> Database { let x = HashMap::new(); let t = HashMap::new(); Database{items:x, open_transactions: t} } pub fn prepare(&mut self, key: String, value: String, dependencies: Vec<String>, timestamp: i64) { // set up a Transaction instance if it doesn't exist if !self.open_transactions.contains_key(&timestamp) { let t = Transaction::new(); self.open_transactions.insert(timestamp, t); } // this will always be Some(x) if let Some(x) = self.open_transactions.get_mut(&timestamp) { x.keys.push(key.clone()); } // does the item exist in items? if !self.items.contains_key(&key) { self.items.insert(key.clone(), Item::new()); } let item = self.items.get_mut(&key).unwrap(); println!("Preparing {} with {}", key, value); item.insert(value, dependencies, timestamp); } pub fn exists(&self, key: String ) -> bool { self.items.contains_key(&key) } pub fn open_transaction_count(&self) -> i64 { self.open_transactions.len() as i64 } pub fn commit(&mut self, timestamp: i64) { // commits all items in the transaction if let Some(x) = self.open_transactions.get(&timestamp) { // X is our Item // get and commit each of the transactions for key in x.keys.iter() { println!("Checking key {}", key); let item = self.items.get_mut(&key.clone()).unwrap(); item.current = timestamp; } } println!("Cleaning up open transaction"); self.open_transactions.remove(&timestamp); println!("Transaction cleaned"); } pub fn versions(&self, key: String) { } pub fn get(&self, key: String) -> Option<&Version> { // returns latest committed Version // returns None if value has just been prepared if let Some(x) = self.items.get(&key) { if x.current > 0 { return x.versions.get(&x.current); } return None; } None } pub fn get_version(&self, key: String, timestamp: i64) -> Option<&Version> { if let Some(item) = self.items.get(&key) { return item.get_version(timestamp); } None } pub fn get_item(&self, key: String) -> Option<&Item> { self.items.get(&key) } } fn deps() -> Vec<String> { vec!("a".to_string(), "b".to_string()) } #[test] fn test_commit_flow() { let mut db = Database::new(); assert_eq!(false, db.exists("test".to_string())); db.prepare("test".to_string(), "value".to_string(), deps(), 1); // we should have a new open transaction assert_eq!(1, db.open_transaction_count()); assert_eq!(true, db.exists("test".to_string())); match db.get("test".to_string()) { None => {}, Some(version) => { panic!("should not have a version yet ")} } { let item = db.get_item("test".to_string()).unwrap(); assert_eq!(item.current, 0); } // is there a new item? db.commit(1); { let item = db.get_item("test".to_string()).unwrap(); assert_eq!(item.current, 1); } match db.get("test".to_string()) { None => panic!("failed to find the value"), Some(version) => { } } // i should now be able to get the value out of the DB // once the transaction is committed we should no longer have it in the open list assert_eq!(0, db.open_transaction_count()); db.prepare("test".to_string(), "value".to_string(), deps(), 2); db.commit(2); { let item = db.get_item("test".to_string()).unwrap(); assert_eq!(item.current, 2); } }
use mav::{ChainType, WalletType, NetType}; pub trait Chain2WalletType { fn chain_type(wallet_type: &WalletType,net_type:&NetType) -> ChainType; /// 减少调用时把类型给错,而增加的方法,但不是每次都有实例,所以还保留了无 self的方法 //fn to_chain_type(&self, wallet_type: &WalletType) -> ChainType; fn wallet_type(chain_type: &ChainType) -> WalletType { match chain_type { ChainType::ETH | ChainType::BTC | ChainType::EEE => WalletType::Normal, ChainType::EthTest | ChainType::BtcTest | ChainType::EeeTest=>WalletType::Test, ChainType::EthPrivate | ChainType::BtcPrivate | ChainType::EeePrivate => WalletType::Test, ChainType::EthPrivateTest | ChainType::BtcPrivateTest | ChainType::EeePrivateTest => WalletType::Test, } } }
use super::{types, util, Context}; use anyhow::{anyhow, Context as _, Result}; use ethers_core::abi::ParamType; use ethers_core::{ abi::{Function, FunctionExt, Param, StateMutability}, types::Selector, }; use inflector::Inflector; use proc_macro2::{Literal, TokenStream}; use quote::quote; use std::collections::BTreeMap; use syn::Ident; /// Expands a context into a method struct containing all the generated bindings /// to the Solidity contract methods. impl Context { pub(crate) fn methods(&self) -> Result<TokenStream> { let mut aliases = self.method_aliases.clone(); let sorted_functions: BTreeMap<_, _> = self.abi.functions.clone().into_iter().collect(); let functions = sorted_functions .values() .flatten() .map(|function| { let signature = function.abi_signature(); expand_function(function, aliases.remove(&signature)) .with_context(|| format!("error expanding function '{}'", signature)) }) .collect::<Result<Vec<_>>>()?; Ok(quote! { #( #functions )* }) } } #[allow(unused)] fn expand_function(function: &Function, alias: Option<Ident>) -> Result<TokenStream> { let name = alias.unwrap_or_else(|| util::safe_ident(&function.name.to_snake_case())); let selector = expand_selector(function.selector()); let input = expand_inputs(&function.inputs)?; let outputs = expand_fn_outputs(&function.outputs)?; let result = quote! { ethers_contract::builders::ContractCall<M, #outputs> }; let arg = expand_inputs_call_arg(&function.inputs); let doc = util::expand_doc(&format!( "Calls the contract's `{}` (0x{}) function", function.name, hex::encode(function.selector()) )); Ok(quote! { #doc pub fn #name(&self #input) -> #result { self.0.method_hash(#selector, #arg) .expect("method not found (this should never happen)") } }) } // converts the function params to name/type pairs pub(crate) fn expand_inputs(inputs: &[Param]) -> Result<TokenStream> { let params = inputs .iter() .enumerate() .map(|(i, param)| { let name = util::expand_input_name(i, &param.name); let kind = types::expand(&param.kind)?; Ok(quote! { #name: #kind }) }) .collect::<Result<Vec<_>>>()?; Ok(quote! { #( , #params )* }) } // packs the argument in a tuple to be used for the contract call pub(crate) fn expand_inputs_call_arg(inputs: &[Param]) -> TokenStream { let names = inputs .iter() .enumerate() .map(|(i, param)| { let name = util::expand_input_name(i, &param.name); match param.kind { // this is awkward edge case where the function inputs are a single struct // we need to force this argument into a tuple so it gets expanded to `((#name,))` // this is currently necessary because internally `flatten_tokens` is called which removes the outermost `tuple` level // and since `((#name))` is not a rust tuple it doesn't get wrapped into another tuple that will be peeled off by `flatten_tokens` ParamType::Tuple(_) if inputs.len() == 1 => { // make sure the tuple gets converted to `Token::Tuple` quote! {(#name,)} } _ => name, } }) .collect::<Vec<TokenStream>>(); match names.len() { 0 => quote! { () }, 1 => quote! { #( #names )* }, _ => quote! { ( #(#names, )* ) }, } } fn expand_fn_outputs(outputs: &[Param]) -> Result<TokenStream> { match outputs.len() { 0 => Ok(quote! { () }), 1 => types::expand(&outputs[0].kind), _ => { let types = outputs .iter() .map(|param| types::expand(&param.kind)) .collect::<Result<Vec<_>>>()?; Ok(quote! { (#( #types ),*) }) } } } fn expand_selector(selector: Selector) -> TokenStream { let bytes = selector.iter().copied().map(Literal::u8_unsuffixed); quote! { [#( #bytes ),*] } } #[cfg(test)] mod tests { use super::*; use ethers_core::abi::ParamType; #[test] fn test_expand_inputs_call_arg() { // no inputs let params = vec![]; let token_stream = expand_inputs_call_arg(&params); assert_eq!(token_stream.to_string(), "()"); // single input let params = vec![Param { name: "arg_a".to_string(), kind: ParamType::Address, }]; let token_stream = expand_inputs_call_arg(&params); assert_eq!(token_stream.to_string(), "arg_a"); // two inputs let params = vec![ Param { name: "arg_a".to_string(), kind: ParamType::Address, }, Param { name: "arg_b".to_string(), kind: ParamType::Uint(256usize), }, ]; let token_stream = expand_inputs_call_arg(&params); assert_eq!(token_stream.to_string(), "(arg_a , arg_b ,)"); // three inputs let params = vec![ Param { name: "arg_a".to_string(), kind: ParamType::Address, }, Param { name: "arg_b".to_string(), kind: ParamType::Uint(128usize), }, Param { name: "arg_c".to_string(), kind: ParamType::Bool, }, ]; let token_stream = expand_inputs_call_arg(&params); assert_eq!(token_stream.to_string(), "(arg_a , arg_b , arg_c ,)"); } #[test] fn expand_inputs_empty() { assert_quote!(expand_inputs(&[]).unwrap().to_string(), {},); } #[test] fn expand_inputs_() { assert_quote!( expand_inputs( &[ Param { name: "a".to_string(), kind: ParamType::Bool, }, Param { name: "b".to_string(), kind: ParamType::Address, }, ], ) .unwrap(), { , a: bool, b: ethers_core::types::Address }, ); } #[test] fn expand_fn_outputs_empty() { assert_quote!(expand_fn_outputs(&[],).unwrap(), { () }); } #[test] fn expand_fn_outputs_single() { assert_quote!( expand_fn_outputs(&[Param { name: "a".to_string(), kind: ParamType::Bool, }]) .unwrap(), { bool }, ); } #[test] fn expand_fn_outputs_multiple() { assert_quote!( expand_fn_outputs(&[ Param { name: "a".to_string(), kind: ParamType::Bool, }, Param { name: "b".to_string(), kind: ParamType::Address, }, ],) .unwrap(), { (bool, ethers_core::types::Address) }, ); } }
pub mod bitboard; pub mod perceptron; pub mod vec_math; use { bitboard::{Bitboard, ChessPiece}, perceptron::Perceptron, rand, }; fn main() { bitboard_example(); perceptron_example(); } fn bitboard_example() { let mut bitboard = Bitboard::new(); let maybe_capture: Option<ChessPiece> = bitboard.move_piece((3, 1), (3, 3)); assert!(maybe_capture.is_none()); println!("{}", &bitboard); } fn perceptron_example() { let mut perceptron = Perceptron::from_rng( vec![ vec![0.0, 0.0, 1.0], vec![1.0, 1.0, 1.0], vec![1.0, 0.0, 1.0], vec![0.0, 1.0, 0.0], ], vec![0.0, 1.0, 1.0, 0.0], 0.0, 1_000, false, rand::thread_rng(), ); perceptron.train(); let test = vec![1.0, 1.0, 1.0]; println!("Prediction of {:?} : {}", &test, perceptron.predict(&test)); }
use std::collections::HashMap; use std::hash::{Hash, Hasher}; use std::sync::{Arc, Mutex}; use std::cmp::Ordering; use std::thread; use std::usize; use std::sync::mpsc; #[derive(Debug, Clone, Copy)] struct Pos { no1: usize, no2: usize, } impl PartialEq for Pos { fn eq(&self, other: &Self) -> bool { self.no1 == other.no1 && self.no2 == other.no2 } } impl Eq for Pos {} impl Hash for Pos { fn hash<H: Hasher>(&self, state: &mut H) { self.no1.hash(state); self.no2.hash(state); } } #[derive(Eq, PartialEq)] struct State { no : usize, cost: usize, prev: usize, } impl Ord for State { fn cmp(&self, other: &State) -> Ordering { other.cost.cmp(&self.cost) .then_with(|| self.no.cmp(&other.no)) } } impl PartialOrd for State { fn partial_cmp(&self, other: &State) -> Option<Ordering> { Some(self.cmp(other)) } } struct WorldMap { nodes: HashMap<usize, Vec<usize>>, costs: HashMap<Pos, usize>, visited: Arc<Mutex<HashMap<Pos, usize>>>, all: Arc<Mutex<usize>>, } impl WorldMap { fn new(map: &Vec<Vec<String>>) -> WorldMap { let mut nodes: HashMap<usize, Vec<usize>> = HashMap::new(); let mut costs: HashMap<Pos, usize> = HashMap::new(); for (_, l) in map.iter().enumerate() { let no1 = l[0].parse::<usize>().unwrap(); let no2 = l[1].parse::<usize>().unwrap(); let cost = l[2].parse::<usize>().unwrap(); nodes.entry(no1).or_insert(Vec::new()).push(no2); nodes.entry(no2).or_insert(Vec::new()).push(no1); let pos = WorldMap::make_pos(no1, no2); costs.entry(pos).or_insert(cost); } WorldMap { nodes, costs, visited: Arc::new(Mutex::new(HashMap::new())), all: Arc::new(Mutex::new(0)), } } fn make_pos(no1: usize, no2: usize) -> Pos { Pos {no1: std::cmp::min(no1, no2), no2: std::cmp::max(no1, no2)} } fn calc(&self, start_no: usize) { let mut status: Vec<State> = Vec::new(); status.push(State {no: start_no, cost: 0, prev: 0}); while let Some(State {no, cost, prev}) = status.pop() { if no > start_no { self.visit(&WorldMap::make_pos(start_no, no), cost); } let nexts = self.nodes.get(&no).unwrap().iter().filter(|x| **x != prev); for next_no in nexts { let pos = WorldMap::make_pos(no, *next_no); let next_cost = self.costs.get(&pos).unwrap(); status.push(State {no: *next_no, cost: (cost + *next_cost), prev: no}); } } } fn visit(&self, pos: &Pos, cost: usize) { #[cfg(test)] { println!("pos: {:?}, cost {}", pos, cost); // let mut visited = self.visited.lock().unwrap(); // visited.insert(*pos, cost); } *self.all.lock().unwrap() += cost; } fn cost(&self) -> usize { *self.all.lock().unwrap() } fn avg(&self) -> f64 { let cost = self.cost(); let len = self.nodes.len(); let num = (len * (len-1)) / 2; (cost as f64) / (num as f64) } } fn calc(wmap: &Arc<WorldMap>, thread: usize) { let keys: Vec<usize> = wmap.nodes.keys().map(|x| *x).collect(); let chunk_size = (keys.len() as f64 / thread as f64).ceil() as usize; let mut handles = Vec::new(); for chunk in keys.chunks(chunk_size) { let wmap = wmap.clone(); let chunk = chunk.to_vec(); let handle = thread::spawn(move || { for c in chunk { wmap.calc(c); } }); handles.push(handle); } for handle in handles { handle.join(); } } fn main() { let map = read_map(); let wmap = Arc::new(WorldMap::new(&map)); calc(&wmap, 8); let avg = wmap.avg(); println!("{}", avg); } fn read_map() -> Vec<Vec<String>> { let h = read::<String>(); let map = read_vec2::<String>(h.parse::<u32>().unwrap()-1); map } fn read<T: std::str::FromStr>() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec<T: std::str::FromStr>() -> Vec<T> { read::<String>().split_whitespace() .map(|e| e.parse().ok().unwrap()).collect() } fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> { (0..n).map(|_| read_vec()).collect() } #[cfg(test)] mod tests { use super::*; fn make_map(s: &str) -> Vec<Vec<String>> { let mut lines = s.lines(); let _n: Vec<String> = lines.next().unwrap().split_whitespace() .map(|e| e.parse().ok().unwrap()).collect(); let map: Vec<Vec<String>> = lines.map(|l| l.split_whitespace() .map(|e| e.parse().ok().unwrap()).collect()).collect(); map } #[test] fn test_1() { let s = "\ 4 1 3 4 2 1 6 4 2 3"; let map = make_map(s); let wmap = Arc::new(WorldMap::new(&map)); calc(&wmap, 8); assert_eq!(wmap.cost(), 6+4+9+10+3+13); assert_eq!(wmap.avg(), 7.5); } #[test] fn test_2() { let s = "\ 9 3 4 11 8 2 12 6 5 5 9 6 6 6 1 3 8 3 11 6 4 10 8 7 3"; let map = make_map(s); let wmap = Arc::new(WorldMap::new(&map)); calc(&wmap, 8); assert_eq!(wmap.cost(), 850); assert_eq!(wmap.avg(), 23.61111111111111); } #[test] fn test_big_auto() { let size: usize = 100_000; let mut map: Vec<Vec<String>> = Vec::new(); let mut cost: usize = 0; for i in 0..size { let mut v = Vec::new(); v.push((i+1).to_string()); v.push((i+2).to_string()); v.push((i+1).to_string()); map.push(v); } let wmap = Arc::new(WorldMap::new(&map)); //println!("hoge"); calc(&wmap, 8); assert_eq!(wmap.cost(), 8670850); assert_eq!(wmap.avg(), 1717.0); } }
//! Convert values to [`ArgReg`] and from [`RetReg`]. //! //! System call arguments and return values are all communicated with inline //! asm and FFI as `*mut Opaque`. To protect these raw pointers from escaping //! or being accidentally misused as they travel through the code, we wrap //! them in [`ArgReg`] and [`RetReg`] structs. This file provides `From` //! implementations and explicit conversion functions for converting values //! into and out of these wrapper structs. //! //! # Safety //! //! Some of this code is `unsafe` in order to work with raw file descriptors, //! and some is `unsafe` to interpret the values in a `RetReg`. #![allow(unsafe_code)] use super::c; use super::fd::{AsRawFd, BorrowedFd, FromRawFd, RawFd}; #[cfg(feature = "runtime")] use super::io::errno::try_decode_error; #[cfg(target_pointer_width = "64")] use super::io::errno::try_decode_u64; #[cfg(not(debug_assertions))] use super::io::errno::{ decode_c_int_infallible, decode_c_uint_infallible, decode_usize_infallible, }; use super::io::errno::{ try_decode_c_int, try_decode_c_uint, try_decode_raw_fd, try_decode_usize, try_decode_void, try_decode_void_star, }; use super::reg::{raw_arg, ArgNumber, ArgReg, RetReg, R0}; #[cfg(feature = "time")] use super::time::types::TimerfdClockId; #[cfg(any(feature = "thread", feature = "time", target_arch = "x86"))] use crate::clockid::ClockId; use crate::fd::OwnedFd; use crate::ffi::CStr; use crate::io; #[cfg(any(feature = "process", feature = "runtime", feature = "termios"))] use crate::pid::Pid; #[cfg(feature = "process")] use crate::process::Resource; #[cfg(any(feature = "process", feature = "runtime"))] use crate::signal::Signal; use crate::utils::{as_mut_ptr, as_ptr}; use core::mem::MaybeUninit; use core::ptr::null_mut; #[cfg(any(feature = "thread", feature = "time", target_arch = "x86"))] use linux_raw_sys::general::__kernel_clockid_t; #[cfg(target_pointer_width = "64")] use linux_raw_sys::general::__kernel_loff_t; #[cfg(feature = "net")] use linux_raw_sys::net::socklen_t; /// Convert `SYS_*` constants for socketcall. #[cfg(target_arch = "x86")] #[inline] pub(super) fn x86_sys<'a, Num: ArgNumber>(sys: u32) -> ArgReg<'a, Num> { pass_usize(sys as usize) } /// Pass the "low" half of the endian-specific memory encoding of a `u64`, for /// 32-bit architectures. #[cfg(target_pointer_width = "32")] #[inline] pub(super) fn lo<'a, Num: ArgNumber>(x: u64) -> ArgReg<'a, Num> { #[cfg(target_endian = "little")] let x = x >> 32; #[cfg(target_endian = "big")] let x = x & 0xffff_ffff; pass_usize(x as usize) } /// Pass the "high" half of the endian-specific memory encoding of a `u64`, for /// 32-bit architectures. #[cfg(target_pointer_width = "32")] #[inline] pub(super) fn hi<'a, Num: ArgNumber>(x: u64) -> ArgReg<'a, Num> { #[cfg(target_endian = "little")] let x = x & 0xffff_ffff; #[cfg(target_endian = "big")] let x = x >> 32; pass_usize(x as usize) } /// Pass a zero, or null, argument. #[inline] pub(super) fn zero<'a, Num: ArgNumber>() -> ArgReg<'a, Num> { raw_arg(null_mut()) } /// Pass the `mem::size_of` of a type. #[inline] pub(super) fn size_of<'a, T: Sized, Num: ArgNumber>() -> ArgReg<'a, Num> { pass_usize(core::mem::size_of::<T>()) } /// Pass an arbitrary `usize` value. /// /// For passing pointers, use `void_star` or other functions which take a raw /// pointer instead of casting to `usize`, so that provenance is preserved. #[inline] pub(super) fn pass_usize<'a, Num: ArgNumber>(t: usize) -> ArgReg<'a, Num> { raw_arg(t as *mut _) } impl<'a, Num: ArgNumber, T> From<*mut T> for ArgReg<'a, Num> { #[inline] fn from(c: *mut T) -> ArgReg<'a, Num> { raw_arg(c.cast()) } } impl<'a, Num: ArgNumber, T> From<*const T> for ArgReg<'a, Num> { #[inline] fn from(c: *const T) -> ArgReg<'a, Num> { let mut_ptr = c as *mut T; raw_arg(mut_ptr.cast()) } } impl<'a, Num: ArgNumber> From<&'a CStr> for ArgReg<'a, Num> { #[inline] fn from(c: &'a CStr) -> Self { let mut_ptr = c.as_ptr() as *mut u8; raw_arg(mut_ptr.cast()) } } impl<'a, Num: ArgNumber> From<Option<&'a CStr>> for ArgReg<'a, Num> { #[inline] fn from(t: Option<&'a CStr>) -> Self { raw_arg(match t { Some(s) => { let mut_ptr = s.as_ptr() as *mut u8; mut_ptr.cast() } None => null_mut(), }) } } /// Pass a borrowed file-descriptor argument. impl<'a, Num: ArgNumber> From<BorrowedFd<'a>> for ArgReg<'a, Num> { #[inline] fn from(fd: BorrowedFd<'a>) -> Self { // SAFETY: `BorrowedFd` ensures that the file descriptor is valid, and // the lifetime parameter on the resulting `ArgReg` ensures that the // result is bounded by the `BorrowedFd`'s lifetime. unsafe { raw_fd(fd.as_raw_fd()) } } } /// Pass a raw file-descriptor argument. Most users should use [`ArgReg::from`] /// instead, to preserve I/O safety as long as possible. /// /// # Safety /// /// `fd` must be a valid open file descriptor. #[inline] pub(super) unsafe fn raw_fd<'a, Num: ArgNumber>(fd: RawFd) -> ArgReg<'a, Num> { // Use `no_fd` when passing `-1` is intended. #[cfg(feature = "fs")] debug_assert!(fd == crate::fs::CWD.as_raw_fd() || fd >= 0); // Don't pass the `io_uring_register_files_skip` sentry value this way. #[cfg(feature = "io_uring")] debug_assert_ne!( fd, crate::io_uring::io_uring_register_files_skip().as_raw_fd() ); // Linux doesn't look at the high bits beyond the `c_int`, so use // zero-extension rather than sign-extension because it's a smaller // instruction. let fd: c::c_int = fd; pass_usize(fd as c::c_uint as usize) } /// Deliberately pass `-1` to a file-descriptor argument, for system calls /// like `mmap` where this indicates the argument is omitted. #[inline] pub(super) fn no_fd<'a, Num: ArgNumber>() -> ArgReg<'a, Num> { pass_usize(!0_usize) } #[inline] pub(super) fn slice_just_addr<T: Sized, Num: ArgNumber>(v: &[T]) -> ArgReg<Num> { let mut_ptr = v.as_ptr() as *mut T; raw_arg(mut_ptr.cast()) } #[inline] pub(super) fn slice_just_addr_mut<T: Sized, Num: ArgNumber>(v: &mut [T]) -> ArgReg<Num> { raw_arg(v.as_mut_ptr().cast()) } #[inline] pub(super) fn slice<T: Sized, Num0: ArgNumber, Num1: ArgNumber>( v: &[T], ) -> (ArgReg<Num0>, ArgReg<Num1>) { (slice_just_addr(v), pass_usize(v.len())) } #[inline] pub(super) fn slice_mut<T: Sized, Num0: ArgNumber, Num1: ArgNumber>( v: &mut [T], ) -> (ArgReg<Num0>, ArgReg<Num1>) { (raw_arg(v.as_mut_ptr().cast()), pass_usize(v.len())) } #[inline] pub(super) fn by_ref<T: Sized, Num: ArgNumber>(t: &T) -> ArgReg<Num> { let mut_ptr = as_ptr(t) as *mut T; raw_arg(mut_ptr.cast()) } #[inline] pub(super) fn by_mut<T: Sized, Num: ArgNumber>(t: &mut T) -> ArgReg<Num> { raw_arg(as_mut_ptr(t).cast()) } /// Convert an optional mutable reference into a `usize` for passing to a /// syscall. #[inline] pub(super) fn opt_mut<T: Sized, Num: ArgNumber>(t: Option<&mut T>) -> ArgReg<Num> { // This optimizes into the equivalent of `transmute(t)`, and has the // advantage of not requiring `unsafe`. match t { Some(t) => by_mut(t), None => raw_arg(null_mut()), } } /// Convert an optional immutable reference into a `usize` for passing to a /// syscall. #[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))] #[inline] pub(super) fn opt_ref<T: Sized, Num: ArgNumber>(t: Option<&T>) -> ArgReg<Num> { // This optimizes into the equivalent of `transmute(t)`, and has the // advantage of not requiring `unsafe`. match t { Some(t) => by_ref(t), None => raw_arg(null_mut()), } } /// Convert a `c_int` into an `ArgReg`. /// /// Be sure to use `raw_fd` to pass `RawFd` values. #[inline] pub(super) fn c_int<'a, Num: ArgNumber>(i: c::c_int) -> ArgReg<'a, Num> { pass_usize(i as usize) } /// Convert a `c_uint` into an `ArgReg`. #[inline] pub(super) fn c_uint<'a, Num: ArgNumber>(i: c::c_uint) -> ArgReg<'a, Num> { pass_usize(i as usize) } #[cfg(target_pointer_width = "64")] #[inline] pub(super) fn loff_t<'a, Num: ArgNumber>(i: __kernel_loff_t) -> ArgReg<'a, Num> { pass_usize(i as usize) } #[cfg(target_pointer_width = "64")] #[inline] pub(super) fn loff_t_from_u64<'a, Num: ArgNumber>(i: u64) -> ArgReg<'a, Num> { // `loff_t` is signed, but syscalls which expect `loff_t` return `EINVAL` // if it's outside the signed `i64` range, so we can silently cast. pass_usize(i as usize) } #[cfg(any(feature = "thread", feature = "time", target_arch = "x86"))] impl<'a, Num: ArgNumber> From<ClockId> for ArgReg<'a, Num> { #[inline] fn from(i: ClockId) -> Self { pass_usize(i as __kernel_clockid_t as usize) } } #[cfg(feature = "time")] impl<'a, Num: ArgNumber> From<TimerfdClockId> for ArgReg<'a, Num> { #[inline] fn from(i: TimerfdClockId) -> Self { pass_usize(i as __kernel_clockid_t as usize) } } #[cfg(feature = "net")] #[inline] pub(super) fn socklen_t<'a, Num: ArgNumber>(i: socklen_t) -> ArgReg<'a, Num> { pass_usize(i as usize) } #[cfg(any( feature = "fs", all( not(feature = "use-libc-auxv"), not(target_vendor = "mustang"), any( feature = "param", feature = "runtime", feature = "time", target_arch = "x86", ) ) ))] pub(crate) mod fs { use super::*; use crate::fs::{FileType, Mode, OFlags}; #[cfg(target_pointer_width = "32")] use linux_raw_sys::general::O_LARGEFILE; impl<'a, Num: ArgNumber> From<Mode> for ArgReg<'a, Num> { #[inline] fn from(mode: Mode) -> Self { pass_usize(mode.bits() as usize) } } impl<'a, Num: ArgNumber> From<(Mode, FileType)> for ArgReg<'a, Num> { #[inline] fn from(pair: (Mode, FileType)) -> Self { pass_usize(pair.0.as_raw_mode() as usize | pair.1.as_raw_mode() as usize) } } impl<'a, Num: ArgNumber> From<crate::fs::AtFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::fs::AtFlags) -> Self { c_uint(flags.bits()) } } impl<'a, Num: ArgNumber> From<crate::fs::XattrFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::fs::XattrFlags) -> Self { c_uint(flags.bits()) } } impl<'a, Num: ArgNumber> From<crate::fs::inotify::CreateFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::fs::inotify::CreateFlags) -> Self { c_uint(flags.bits()) } } impl<'a, Num: ArgNumber> From<crate::fs::inotify::WatchFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::fs::inotify::WatchFlags) -> Self { c_uint(flags.bits()) } } impl<'a, Num: ArgNumber> From<crate::fs::MemfdFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::fs::MemfdFlags) -> Self { c_uint(flags.bits()) } } impl<'a, Num: ArgNumber> From<crate::fs::RenameFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::fs::RenameFlags) -> Self { c_uint(flags.bits()) } } impl<'a, Num: ArgNumber> From<crate::fs::StatxFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::fs::StatxFlags) -> Self { c_uint(flags.bits()) } } #[cfg(target_pointer_width = "32")] #[inline] fn oflags_bits(oflags: OFlags) -> c::c_uint { let mut bits = oflags.bits(); // Add `O_LARGEFILE`, unless `O_PATH` is set, as Linux returns `EINVAL` // when both are set. if !oflags.contains(OFlags::PATH) { bits |= O_LARGEFILE; } bits } #[cfg(target_pointer_width = "64")] #[inline] const fn oflags_bits(oflags: OFlags) -> c::c_uint { oflags.bits() } impl<'a, Num: ArgNumber> From<OFlags> for ArgReg<'a, Num> { #[inline] fn from(oflags: OFlags) -> Self { pass_usize(oflags_bits(oflags) as usize) } } /// Convert an `OFlags` into a `u64` for use in the `open_how` struct. #[inline] pub(crate) fn oflags_for_open_how(oflags: OFlags) -> u64 { u64::from(oflags_bits(oflags)) } impl<'a, Num: ArgNumber> From<crate::fs::FallocateFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::fs::FallocateFlags) -> Self { c_uint(flags.bits()) } } impl<'a, Num: ArgNumber> From<crate::fs::Advice> for ArgReg<'a, Num> { #[inline] fn from(advice: crate::fs::Advice) -> Self { c_uint(advice as c::c_uint) } } impl<'a, Num: ArgNumber> From<crate::fs::SealFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::fs::SealFlags) -> Self { c_uint(flags.bits()) } } impl<'a, Num: ArgNumber> From<crate::fs::Access> for ArgReg<'a, Num> { #[inline] fn from(access: crate::fs::Access) -> Self { c_uint(access.bits()) } } } #[cfg(any(feature = "fs", feature = "mount"))] impl<'a, Num: ArgNumber> From<crate::backend::mount::types::MountFlagsArg> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::backend::mount::types::MountFlagsArg) -> Self { c_uint(flags.0) } } // When the deprecated "fs" aliases are removed, we can remove the "fs" // here too. #[cfg(any(feature = "fs", feature = "mount"))] impl<'a, Num: ArgNumber> From<crate::backend::mount::types::UnmountFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::backend::mount::types::UnmountFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "mount")] impl<'a, Num: ArgNumber> From<crate::mount::FsConfigCmd> for ArgReg<'a, Num> { #[inline] fn from(cmd: crate::mount::FsConfigCmd) -> Self { c_uint(cmd as c::c_uint) } } #[cfg(feature = "mount")] impl<'a, Num: ArgNumber> From<crate::backend::mount::types::FsOpenFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::backend::mount::types::FsOpenFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "mount")] impl<'a, Num: ArgNumber> From<crate::backend::mount::types::FsMountFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::backend::mount::types::FsMountFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "mount")] impl<'a, Num: ArgNumber> From<crate::backend::mount::types::MountAttrFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::backend::mount::types::MountAttrFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "mount")] impl<'a, Num: ArgNumber> From<crate::backend::mount::types::OpenTreeFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::backend::mount::types::OpenTreeFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "mount")] impl<'a, Num: ArgNumber> From<crate::backend::mount::types::FsPickFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::backend::mount::types::FsPickFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "mount")] impl<'a, Num: ArgNumber> From<crate::backend::mount::types::MoveMountFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::backend::mount::types::MoveMountFlags) -> Self { c_uint(flags.bits()) } } impl<'a, Num: ArgNumber> From<crate::io::FdFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::io::FdFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "pipe")] impl<'a, Num: ArgNumber> From<crate::pipe::PipeFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::pipe::PipeFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "pipe")] impl<'a, Num: ArgNumber> From<crate::pipe::SpliceFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::pipe::SpliceFlags) -> Self { c_uint(flags.bits()) } } impl<'a, Num: ArgNumber> From<crate::io::DupFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::io::DupFlags) -> Self { c_uint(flags.bits()) } } impl<'a, Num: ArgNumber> From<crate::io::ReadWriteFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::io::ReadWriteFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "process")] impl<'a, Num: ArgNumber> From<crate::process::PidfdFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::process::PidfdFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "pty")] impl<'a, Num: ArgNumber> From<crate::pty::OpenptFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::pty::OpenptFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "thread")] impl<'a, Num: ArgNumber> From<crate::thread::UnshareFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::thread::UnshareFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "event")] impl<'a, Num: ArgNumber> From<crate::event::EventfdFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::event::EventfdFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "event")] impl<'a, Num: ArgNumber> From<crate::event::epoll::CreateFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::event::epoll::CreateFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "mm")] impl<'a, Num: ArgNumber> From<crate::backend::mm::types::ProtFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::backend::mm::types::ProtFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "mm")] impl<'a, Num: ArgNumber> From<crate::backend::mm::types::MsyncFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::backend::mm::types::MsyncFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "mm")] impl<'a, Num: ArgNumber> From<crate::backend::mm::types::MremapFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::backend::mm::types::MremapFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "mm")] impl<'a, Num: ArgNumber> From<crate::backend::mm::types::MlockFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::backend::mm::types::MlockFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "mm")] impl<'a, Num: ArgNumber> From<crate::backend::mm::types::MapFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::backend::mm::types::MapFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "mm")] impl<'a, Num: ArgNumber> From<crate::backend::mm::types::MprotectFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::backend::mm::types::MprotectFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "mm")] impl<'a, Num: ArgNumber> From<crate::backend::mm::types::UserfaultfdFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::backend::mm::types::UserfaultfdFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "process")] impl<'a, Num: ArgNumber> From<crate::backend::process::types::MembarrierCommand> for ArgReg<'a, Num> { #[inline] fn from(cmd: crate::backend::process::types::MembarrierCommand) -> Self { c_uint(cmd as u32) } } #[cfg(feature = "process")] impl<'a, Num: ArgNumber> From<crate::process::Cpuid> for ArgReg<'a, Num> { #[inline] fn from(cpuid: crate::process::Cpuid) -> Self { c_uint(cpuid.as_raw()) } } #[cfg(target_pointer_width = "64")] #[inline] pub(super) fn dev_t<'a, Num: ArgNumber>(dev: u64) -> ArgReg<'a, Num> { pass_usize(dev as usize) } #[cfg(target_pointer_width = "32")] #[inline] pub(super) fn dev_t<'a, Num: ArgNumber>(dev: u64) -> io::Result<ArgReg<'a, Num>> { Ok(pass_usize(dev.try_into().map_err(|_err| io::Errno::INVAL)?)) } /// Convert a `Resource` into a syscall argument. #[cfg(feature = "process")] impl<'a, Num: ArgNumber> From<Resource> for ArgReg<'a, Num> { #[inline] fn from(resource: Resource) -> Self { c_uint(resource as c::c_uint) } } #[cfg(any(feature = "process", feature = "runtime", feature = "termios"))] impl<'a, Num: ArgNumber> From<Pid> for ArgReg<'a, Num> { #[inline] fn from(pid: Pid) -> Self { pass_usize(pid.as_raw_nonzero().get() as usize) } } #[cfg(feature = "process")] #[inline] pub(super) fn negative_pid<'a, Num: ArgNumber>(pid: Pid) -> ArgReg<'a, Num> { pass_usize(pid.as_raw_nonzero().get().wrapping_neg() as usize) } #[cfg(any(feature = "process", feature = "runtime"))] impl<'a, Num: ArgNumber> From<Signal> for ArgReg<'a, Num> { #[inline] fn from(sig: Signal) -> Self { pass_usize(sig as usize) } } #[cfg(feature = "io_uring")] impl<'a, Num: ArgNumber> From<crate::io_uring::IoringEnterFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::io_uring::IoringEnterFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "time")] impl<'a, Num: ArgNumber> From<crate::time::TimerfdFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::time::TimerfdFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "time")] impl<'a, Num: ArgNumber> From<crate::time::TimerfdTimerFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::time::TimerfdTimerFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "rand")] impl<'a, Num: ArgNumber> From<crate::rand::GetRandomFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::rand::GetRandomFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "net")] impl<'a, Num: ArgNumber> From<crate::net::RecvFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::net::RecvFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "net")] impl<'a, Num: ArgNumber> From<crate::net::SendFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::net::SendFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "net")] impl<'a, Num: ArgNumber> From<crate::net::SocketFlags> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::net::SocketFlags) -> Self { c_uint(flags.bits()) } } #[cfg(feature = "net")] impl<'a, Num: ArgNumber> From<crate::net::AddressFamily> for ArgReg<'a, Num> { #[inline] fn from(family: crate::net::AddressFamily) -> Self { c_uint(family.0.into()) } } #[cfg(feature = "net")] impl<'a, Num: ArgNumber> From<(crate::net::SocketType, crate::net::SocketFlags)> for ArgReg<'a, Num> { #[inline] fn from(pair: (crate::net::SocketType, crate::net::SocketFlags)) -> Self { c_uint(pair.0 .0 | pair.1.bits()) } } #[cfg(feature = "thread")] impl<'a, Num: ArgNumber> From<(crate::thread::FutexOperation, crate::thread::FutexFlags)> for ArgReg<'a, Num> { #[inline] fn from(pair: (crate::thread::FutexOperation, crate::thread::FutexFlags)) -> Self { c_uint(pair.0 as u32 | pair.1.bits()) } } #[cfg(feature = "net")] impl<'a, Num: ArgNumber> From<crate::net::SocketType> for ArgReg<'a, Num> { #[inline] fn from(type_: crate::net::SocketType) -> Self { c_uint(type_.0) } } #[cfg(feature = "net")] impl<'a, Num: ArgNumber> From<Option<crate::net::Protocol>> for ArgReg<'a, Num> { #[inline] fn from(protocol: Option<crate::net::Protocol>) -> Self { c_uint(match protocol { Some(p) => p.0.get(), None => 0, }) } } impl<'a, Num: ArgNumber, T> From<&'a mut MaybeUninit<T>> for ArgReg<'a, Num> { #[inline] fn from(t: &'a mut MaybeUninit<T>) -> Self { raw_arg(t.as_mut_ptr().cast()) } } impl<'a, Num: ArgNumber, T> From<&'a mut [MaybeUninit<T>]> for ArgReg<'a, Num> { #[inline] fn from(t: &'a mut [MaybeUninit<T>]) -> Self { raw_arg(t.as_mut_ptr().cast()) } } #[cfg(any(feature = "process", feature = "thread"))] impl<'a, Num: ArgNumber> From<crate::ugid::Uid> for ArgReg<'a, Num> { #[inline] fn from(t: crate::ugid::Uid) -> Self { c_uint(t.as_raw()) } } #[cfg(any(feature = "process", feature = "thread"))] impl<'a, Num: ArgNumber> From<crate::ugid::Gid> for ArgReg<'a, Num> { #[inline] fn from(t: crate::ugid::Gid) -> Self { c_uint(t.as_raw()) } } #[cfg(feature = "runtime")] impl<'a, Num: ArgNumber> From<crate::runtime::How> for ArgReg<'a, Num> { #[inline] fn from(flags: crate::runtime::How) -> Self { c_uint(flags as u32) } } /// Convert a `usize` returned from a syscall that effectively returns `()` on /// success. /// /// # Safety /// /// The caller must ensure that this is the return value of a syscall which /// just returns 0 on success. #[inline] pub(super) unsafe fn ret(raw: RetReg<R0>) -> io::Result<()> { try_decode_void(raw) } /// Convert a `usize` returned from a syscall that doesn't return on success. /// /// # Safety /// /// The caller must ensure that this is the return value of a syscall which /// doesn't return on success. #[cfg(feature = "runtime")] #[inline] pub(super) unsafe fn ret_error(raw: RetReg<R0>) -> io::Errno { try_decode_error(raw) } /// Convert a `usize` returned from a syscall that effectively always returns /// `()`. /// /// # Safety /// /// The caller must ensure that this is the return value of a syscall which /// always returns `()`. #[inline] pub(super) unsafe fn ret_infallible(raw: RetReg<R0>) { #[cfg(debug_assertions)] { try_decode_void(raw).unwrap() } #[cfg(not(debug_assertions))] drop(raw); } /// Convert a `usize` returned from a syscall that effectively returns a /// `c_int` on success. #[inline] pub(super) fn ret_c_int(raw: RetReg<R0>) -> io::Result<c::c_int> { try_decode_c_int(raw) } /// Convert a `usize` returned from a syscall that effectively returns a /// `c_uint` on success. #[inline] pub(super) fn ret_c_uint(raw: RetReg<R0>) -> io::Result<c::c_uint> { try_decode_c_uint(raw) } /// Convert a `usize` returned from a syscall that effectively returns a `u64` /// on success. #[cfg(target_pointer_width = "64")] #[inline] pub(super) fn ret_u64(raw: RetReg<R0>) -> io::Result<u64> { try_decode_u64(raw) } /// Convert a `usize` returned from a syscall that effectively returns a /// `usize` on success. #[inline] pub(super) fn ret_usize(raw: RetReg<R0>) -> io::Result<usize> { try_decode_usize(raw) } /// Convert a `usize` returned from a syscall that effectively always /// returns a `usize`. /// /// # Safety /// /// This function must only be used with return values from infallible /// syscalls. #[inline] pub(super) unsafe fn ret_usize_infallible(raw: RetReg<R0>) -> usize { #[cfg(debug_assertions)] { try_decode_usize(raw).unwrap() } #[cfg(not(debug_assertions))] { decode_usize_infallible(raw) } } /// Convert a `c_int` returned from a syscall that effectively always /// returns a `c_int`. /// /// # Safety /// /// This function must only be used with return values from infallible /// syscalls. #[inline] pub(super) unsafe fn ret_c_int_infallible(raw: RetReg<R0>) -> c::c_int { #[cfg(debug_assertions)] { try_decode_c_int(raw).unwrap() } #[cfg(not(debug_assertions))] { decode_c_int_infallible(raw) } } /// Convert a `c_uint` returned from a syscall that effectively always /// returns a `c_uint`. /// /// # Safety /// /// This function must only be used with return values from infallible /// syscalls. #[inline] pub(super) unsafe fn ret_c_uint_infallible(raw: RetReg<R0>) -> c::c_uint { #[cfg(debug_assertions)] { try_decode_c_uint(raw).unwrap() } #[cfg(not(debug_assertions))] { decode_c_uint_infallible(raw) } } /// Convert a `usize` returned from a syscall that effectively returns an /// `OwnedFd` on success. /// /// # Safety /// /// The caller must ensure that this is the return value of a syscall which /// returns an owned file descriptor. #[inline] pub(super) unsafe fn ret_owned_fd(raw: RetReg<R0>) -> io::Result<OwnedFd> { let raw_fd = try_decode_raw_fd(raw)?; Ok(crate::backend::fd::OwnedFd::from_raw_fd(raw_fd)) } /// Convert the return value of `dup2` and `dup3`. /// /// When these functions succeed, they return the same value as their second /// argument, so we don't construct a new `OwnedFd`. /// /// # Safety /// /// The caller must ensure that this is the return value of a syscall which /// returns a file descriptor. #[inline] pub(super) unsafe fn ret_discarded_fd(raw: RetReg<R0>) -> io::Result<()> { let _raw_fd = try_decode_raw_fd(raw)?; Ok(()) } /// Convert a `usize` returned from a syscall that effectively returns a /// `*mut c_void` on success. #[inline] pub(super) fn ret_void_star(raw: RetReg<R0>) -> io::Result<*mut c::c_void> { try_decode_void_star(raw) }
// https://mariadb.com/kb/en/library/resultset/#field-detail-flag // https://dev.mysql.com/doc/dev/mysql-server/8.0.12/group__group__cs__column__definition__flags.html bitflags::bitflags! { pub struct FieldFlags: u16 { /// Field cannot be NULL const NOT_NULL = 1; /// Field is **part of** a primary key const PRIMARY_KEY = 2; /// Field is **part of** a unique key/constraint const UNIQUE_KEY = 4; /// Field is **part of** a unique or primary key const MULTIPLE_KEY = 8; /// Field is a blob. const BLOB = 16; /// Field is unsigned const UNSIGNED = 32; /// Field is zero filled. const ZEROFILL = 64; /// Field is binary (set for strings) const BINARY = 128; /// Field is an enumeration const ENUM = 256; /// Field is an auto-increment field const AUTO_INCREMENT = 512; /// Field is a timestamp const TIMESTAMP = 1024; /// Field is a set const SET = 2048; /// Field does not have a default value const NO_DEFAULT_VALUE = 4096; /// Field is set to NOW on UPDATE const ON_UPDATE_NOW = 8192; /// Field is a number const NUM = 32768; } }
/* * MIT License * * Copyright (c) 2018 Clément SIBILLE * * Permission is hereby Keycode::granted => Key::granted, free of Keycode::charge => Key::charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without Keycode::restriction => Key::restriction, including without limitation the rights * to Keycode::use => Key::use, Keycode::copy => Key::copy, Keycode::modify => Key::modify, Keycode::merge => Key::merge, Keycode::publish => Key::publish, Keycode::distribute => Key::distribute, Keycode::sublicense => Key::sublicense, and/or sell * copies of the Keycode::Software => Key::Software, and to permit persons to whom the Software is * furnished to do Keycode::so => Key::so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY Keycode::KIND => Key::KIND, EXPRESS OR * Keycode::IMPLIED => Key::IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF Keycode::MERCHANTABILITY => Key::MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY Keycode::CLAIM => Key::CLAIM, DAMAGES OR OTHER * Keycode::LIABILITY => Key::LIABILITY, WHETHER IN AN ACTION OF Keycode::CONTRACT => Key::CONTRACT, TORT OR Keycode::OTHERWISE => Key::OTHERWISE, ARISING Keycode::FROM => Key::FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ use sdl2::keyboard::Keycode; use tuber::input::keyboard::Key; pub struct SDLKey(pub Keycode); impl From<SDLKey> for Key { fn from(k: SDLKey) -> Key { let SDLKey(key) = k; match key { Keycode::A => Key::A, Keycode::B => Key::B, Keycode::C => Key::C, Keycode::D => Key::D, Keycode::E => Key::E, Keycode::F => Key::F, Keycode::G => Key::G, Keycode::H => Key::H, Keycode::I => Key::I, Keycode::J => Key::J, Keycode::K => Key::K, Keycode::L => Key::L, Keycode::M => Key::M, Keycode::N => Key::N, Keycode::O => Key::O, Keycode::P => Key::P, Keycode::Q => Key::Q, Keycode::R => Key::R, Keycode::S => Key::S, Keycode::T => Key::T, Keycode::U => Key::U, Keycode::V => Key::V, Keycode::W => Key::W, Keycode::X => Key::X, Keycode::Y => Key::Y, Keycode::Z => Key::Z, Keycode::Return => Key::Return, Keycode::KpEnter => Key::Enter, Keycode::LShift => Key::LShift, Keycode::RShift => Key::RShift, Keycode::LCtrl => Key::LControl, Keycode::RCtrl => Key::RControl, Keycode::Escape => Key::Escape, _ => Key::Unknown } } }
use std::convert::TryInto; use std::io; /// Read a u16 in little endian format from the beginning of the given slice. /// This panics if the slice has length less than 2. pub fn read_u16_le(slice: &[u8]) -> u16 { u16::from_le_bytes(slice[..2].try_into().unwrap()) } /// Read a u24 (returned as a u32 with the most significant 8 bits always set /// to 0) in little endian format from the beginning of the given slice. This /// panics if the slice has length less than 3. pub fn read_u24_le(slice: &[u8]) -> u32 { slice[0] as u32 | (slice[1] as u32) << 8 | (slice[2] as u32) << 16 } /// Read a u32 in little endian format from the beginning of the given slice. /// This panics if the slice has length less than 4. pub fn read_u32_le(slice: &[u8]) -> u32 { u32::from_le_bytes(slice[..4].try_into().unwrap()) } /// Like read_u32_le, but from an io::Read implementation. If io::Read does /// not yield at least 4 bytes, then this returns an unexpected EOF error. pub fn io_read_u32_le<R: io::Read>(mut rdr: R) -> io::Result<u32> { let mut buf = [0; 4]; rdr.read_exact(&mut buf)?; Ok(u32::from_le_bytes(buf)) } /// Write a u16 in little endian format to the beginning of the given slice. /// This panics if the slice has length less than 2. pub fn write_u16_le(n: u16, slice: &mut [u8]) { assert!(slice.len() >= 2); let bytes = n.to_le_bytes(); slice[0] = bytes[0]; slice[1] = bytes[1]; } /// Write a u24 (given as a u32 where the most significant 8 bits are ignored) /// in little endian format to the beginning of the given slice. This panics /// if the slice has length less than 3. pub fn write_u24_le(n: u32, slice: &mut [u8]) { slice[0] = n as u8; slice[1] = (n >> 8) as u8; slice[2] = (n >> 16) as u8; } /// Write a u32 in little endian format to the beginning of the given slice. /// This panics if the slice has length less than 4. pub fn write_u32_le(n: u32, slice: &mut [u8]) { assert!(slice.len() >= 4); let bytes = n.to_le_bytes(); slice[0] = bytes[0]; slice[1] = bytes[1]; slice[2] = bytes[2]; slice[3] = bytes[3]; } /// https://developers.google.com/protocol-buffers/docs/encoding#varints pub fn write_varu64(data: &mut [u8], mut n: u64) -> usize { let mut i = 0; while n >= 0b1000_0000 { data[i] = (n as u8) | 0b1000_0000; n >>= 7; i += 1; } data[i] = n as u8; i + 1 } /// https://developers.google.com/protocol-buffers/docs/encoding#varints pub fn read_varu64(data: &[u8]) -> (u64, usize) { let mut n: u64 = 0; let mut shift: u32 = 0; for (i, &b) in data.iter().enumerate() { if b < 0b1000_0000 { return match (b as u64).checked_shl(shift) { None => (0, 0), Some(b) => (n | b, i + 1), }; } match ((b as u64) & 0b0111_1111).checked_shl(shift) { None => return (0, 0), Some(b) => n |= b, } shift += 7; } (0, 0) } /// Does an unaligned load of a little endian encoded u32. /// /// This is unsafe because `data` must point to some memory of size at least 4. pub unsafe fn loadu_u32_le(data: *const u8) -> u32 { loadu_u32_ne(data).to_le() } /// Does an unaligned load of a native endian encoded u32. /// /// This is unsafe because `data` must point to some memory of size at least 4. pub unsafe fn loadu_u32_ne(data: *const u8) -> u32 { (data as *const u32).read_unaligned() } /// Does an unaligned load of a little endian encoded u64. /// /// This is unsafe because `data` must point to some memory of size at least 8. pub unsafe fn loadu_u64_le(data: *const u8) -> u64 { loadu_u64_ne(data).to_le() } /// Does an unaligned load of a native endian encoded u64. /// /// This is unsafe because `data` must point to some memory of size at least 8. pub unsafe fn loadu_u64_ne(data: *const u8) -> u64 { (data as *const u64).read_unaligned() }
use proconio::input; macro_rules! chmax { ($a: expr, $b: expr) => { $a = $a.max($b); }; } fn main() { input! { n: usize, txa: [(usize, usize, i64); n], }; let s = 1_000_00; let mut bonus = vec![vec![0; 5]; s + 1]; for (t, x, a) in txa { bonus[t][x] = a; } let mut dp = vec![vec![-1; 5]; s + 1]; dp[0][0] = 0; for t in 0..s { for p in 0..5 { if dp[t][p] == -1 { continue; } chmax!(dp[t + 1][p], dp[t][p] + bonus[t + 1][p]); if p >= 1 { chmax!(dp[t + 1][p - 1], dp[t][p] + bonus[t + 1][p - 1]); } if p + 1 < 5 { chmax!(dp[t + 1][p + 1], dp[t][p] + bonus[t + 1][p + 1]); } } } let mut ans = -1; for p in 0..5 { chmax!(ans, dp[s][p]); } assert_ne!(ans, -1); println!("{}", ans); }
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtWidgets/qdialog.h // dst-file: /src/widgets/qdialog.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 super::qwidget::*; // 773 use std::ops::Deref; use super::super::core::qobjectdefs::*; // 771 use super::super::core::qsize::*; // 771 // <= use block end // ext block begin => // #[link(name = "Qt5Core")] // #[link(name = "Qt5Gui")] // #[link(name = "Qt5Widgets")] // #[link(name = "QtInline")] extern { fn QDialog_Class_Size() -> c_int; // proto: void QDialog::setExtension(QWidget * extension); fn C_ZN7QDialog12setExtensionEP7QWidget(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: int QDialog::result(); fn C_ZNK7QDialog6resultEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QDialog::done(int ); fn C_ZN7QDialog4doneEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: void QDialog::open(); fn C_ZN7QDialog4openEv(qthis: u64 /* *mut c_void*/); // proto: void QDialog::~QDialog(); fn C_ZN7QDialogD2Ev(qthis: u64 /* *mut c_void*/); // proto: void QDialog::setResult(int r); fn C_ZN7QDialog9setResultEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: void QDialog::setSizeGripEnabled(bool ); fn C_ZN7QDialog18setSizeGripEnabledEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: void QDialog::showExtension(bool ); fn C_ZN7QDialog13showExtensionEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: const QMetaObject * QDialog::metaObject(); fn C_ZNK7QDialog10metaObjectEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QSize QDialog::minimumSizeHint(); fn C_ZNK7QDialog15minimumSizeHintEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QSize QDialog::sizeHint(); fn C_ZNK7QDialog8sizeHintEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QDialog::accept(); fn C_ZN7QDialog6acceptEv(qthis: u64 /* *mut c_void*/); // proto: void QDialog::setVisible(bool visible); fn C_ZN7QDialog10setVisibleEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: QWidget * QDialog::extension(); fn C_ZNK7QDialog9extensionEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: int QDialog::exec(); fn C_ZN7QDialog4execEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QDialog::reject(); fn C_ZN7QDialog6rejectEv(qthis: u64 /* *mut c_void*/); // proto: bool QDialog::isSizeGripEnabled(); fn C_ZNK7QDialog17isSizeGripEnabledEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: void QDialog::setModal(bool modal); fn C_ZN7QDialog8setModalEb(qthis: u64 /* *mut c_void*/, arg0: c_char); fn QDialog_SlotProxy_connect__ZN7QDialog8rejectedEv(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QDialog_SlotProxy_connect__ZN7QDialog8finishedEi(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QDialog_SlotProxy_connect__ZN7QDialog8acceptedEv(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); } // <= ext block end // body block begin => // class sizeof(QDialog)=1 #[derive(Default)] pub struct QDialog { qbase: QWidget, pub qclsinst: u64 /* *mut c_void*/, pub _finished: QDialog_finished_signal, pub _accepted: QDialog_accepted_signal, pub _rejected: QDialog_rejected_signal, } impl /*struct*/ QDialog { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QDialog { return QDialog{qbase: QWidget::inheritFrom(qthis), qclsinst: qthis, ..Default::default()}; } } impl Deref for QDialog { type Target = QWidget; fn deref(&self) -> &QWidget { return & self.qbase; } } impl AsRef<QWidget> for QDialog { fn as_ref(& self) -> & QWidget { return & self.qbase; } } // proto: void QDialog::setExtension(QWidget * extension); impl /*struct*/ QDialog { pub fn setExtension<RetType, T: QDialog_setExtension<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setExtension(self); // return 1; } } pub trait QDialog_setExtension<RetType> { fn setExtension(self , rsthis: & QDialog) -> RetType; } // proto: void QDialog::setExtension(QWidget * extension); impl<'a> /*trait*/ QDialog_setExtension<()> for (&'a QWidget) { fn setExtension(self , rsthis: & QDialog) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QDialog12setExtensionEP7QWidget()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN7QDialog12setExtensionEP7QWidget(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int QDialog::result(); impl /*struct*/ QDialog { pub fn result<RetType, T: QDialog_result<RetType>>(& self, overload_args: T) -> RetType { return overload_args.result(self); // return 1; } } pub trait QDialog_result<RetType> { fn result(self , rsthis: & QDialog) -> RetType; } // proto: int QDialog::result(); impl<'a> /*trait*/ QDialog_result<i32> for () { fn result(self , rsthis: & QDialog) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QDialog6resultEv()}; let mut ret = unsafe {C_ZNK7QDialog6resultEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QDialog::done(int ); impl /*struct*/ QDialog { pub fn done<RetType, T: QDialog_done<RetType>>(& self, overload_args: T) -> RetType { return overload_args.done(self); // return 1; } } pub trait QDialog_done<RetType> { fn done(self , rsthis: & QDialog) -> RetType; } // proto: void QDialog::done(int ); impl<'a> /*trait*/ QDialog_done<()> for (i32) { fn done(self , rsthis: & QDialog) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QDialog4doneEi()}; let arg0 = self as c_int; unsafe {C_ZN7QDialog4doneEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QDialog::open(); impl /*struct*/ QDialog { pub fn open<RetType, T: QDialog_open<RetType>>(& self, overload_args: T) -> RetType { return overload_args.open(self); // return 1; } } pub trait QDialog_open<RetType> { fn open(self , rsthis: & QDialog) -> RetType; } // proto: void QDialog::open(); impl<'a> /*trait*/ QDialog_open<()> for () { fn open(self , rsthis: & QDialog) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QDialog4openEv()}; unsafe {C_ZN7QDialog4openEv(rsthis.qclsinst)}; // return 1; } } // proto: void QDialog::~QDialog(); impl /*struct*/ QDialog { pub fn free<RetType, T: QDialog_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QDialog_free<RetType> { fn free(self , rsthis: & QDialog) -> RetType; } // proto: void QDialog::~QDialog(); impl<'a> /*trait*/ QDialog_free<()> for () { fn free(self , rsthis: & QDialog) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QDialogD2Ev()}; unsafe {C_ZN7QDialogD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: void QDialog::setResult(int r); impl /*struct*/ QDialog { pub fn setResult<RetType, T: QDialog_setResult<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setResult(self); // return 1; } } pub trait QDialog_setResult<RetType> { fn setResult(self , rsthis: & QDialog) -> RetType; } // proto: void QDialog::setResult(int r); impl<'a> /*trait*/ QDialog_setResult<()> for (i32) { fn setResult(self , rsthis: & QDialog) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QDialog9setResultEi()}; let arg0 = self as c_int; unsafe {C_ZN7QDialog9setResultEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QDialog::setSizeGripEnabled(bool ); impl /*struct*/ QDialog { pub fn setSizeGripEnabled<RetType, T: QDialog_setSizeGripEnabled<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setSizeGripEnabled(self); // return 1; } } pub trait QDialog_setSizeGripEnabled<RetType> { fn setSizeGripEnabled(self , rsthis: & QDialog) -> RetType; } // proto: void QDialog::setSizeGripEnabled(bool ); impl<'a> /*trait*/ QDialog_setSizeGripEnabled<()> for (i8) { fn setSizeGripEnabled(self , rsthis: & QDialog) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QDialog18setSizeGripEnabledEb()}; let arg0 = self as c_char; unsafe {C_ZN7QDialog18setSizeGripEnabledEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QDialog::showExtension(bool ); impl /*struct*/ QDialog { pub fn showExtension<RetType, T: QDialog_showExtension<RetType>>(& self, overload_args: T) -> RetType { return overload_args.showExtension(self); // return 1; } } pub trait QDialog_showExtension<RetType> { fn showExtension(self , rsthis: & QDialog) -> RetType; } // proto: void QDialog::showExtension(bool ); impl<'a> /*trait*/ QDialog_showExtension<()> for (i8) { fn showExtension(self , rsthis: & QDialog) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QDialog13showExtensionEb()}; let arg0 = self as c_char; unsafe {C_ZN7QDialog13showExtensionEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: const QMetaObject * QDialog::metaObject(); impl /*struct*/ QDialog { pub fn metaObject<RetType, T: QDialog_metaObject<RetType>>(& self, overload_args: T) -> RetType { return overload_args.metaObject(self); // return 1; } } pub trait QDialog_metaObject<RetType> { fn metaObject(self , rsthis: & QDialog) -> RetType; } // proto: const QMetaObject * QDialog::metaObject(); impl<'a> /*trait*/ QDialog_metaObject<QMetaObject> for () { fn metaObject(self , rsthis: & QDialog) -> QMetaObject { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QDialog10metaObjectEv()}; let mut ret = unsafe {C_ZNK7QDialog10metaObjectEv(rsthis.qclsinst)}; let mut ret1 = QMetaObject::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QSize QDialog::minimumSizeHint(); impl /*struct*/ QDialog { pub fn minimumSizeHint<RetType, T: QDialog_minimumSizeHint<RetType>>(& self, overload_args: T) -> RetType { return overload_args.minimumSizeHint(self); // return 1; } } pub trait QDialog_minimumSizeHint<RetType> { fn minimumSizeHint(self , rsthis: & QDialog) -> RetType; } // proto: QSize QDialog::minimumSizeHint(); impl<'a> /*trait*/ QDialog_minimumSizeHint<QSize> for () { fn minimumSizeHint(self , rsthis: & QDialog) -> QSize { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QDialog15minimumSizeHintEv()}; let mut ret = unsafe {C_ZNK7QDialog15minimumSizeHintEv(rsthis.qclsinst)}; let mut ret1 = QSize::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QSize QDialog::sizeHint(); impl /*struct*/ QDialog { pub fn sizeHint<RetType, T: QDialog_sizeHint<RetType>>(& self, overload_args: T) -> RetType { return overload_args.sizeHint(self); // return 1; } } pub trait QDialog_sizeHint<RetType> { fn sizeHint(self , rsthis: & QDialog) -> RetType; } // proto: QSize QDialog::sizeHint(); impl<'a> /*trait*/ QDialog_sizeHint<QSize> for () { fn sizeHint(self , rsthis: & QDialog) -> QSize { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QDialog8sizeHintEv()}; let mut ret = unsafe {C_ZNK7QDialog8sizeHintEv(rsthis.qclsinst)}; let mut ret1 = QSize::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QDialog::accept(); impl /*struct*/ QDialog { pub fn accept<RetType, T: QDialog_accept<RetType>>(& self, overload_args: T) -> RetType { return overload_args.accept(self); // return 1; } } pub trait QDialog_accept<RetType> { fn accept(self , rsthis: & QDialog) -> RetType; } // proto: void QDialog::accept(); impl<'a> /*trait*/ QDialog_accept<()> for () { fn accept(self , rsthis: & QDialog) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QDialog6acceptEv()}; unsafe {C_ZN7QDialog6acceptEv(rsthis.qclsinst)}; // return 1; } } // proto: void QDialog::setVisible(bool visible); impl /*struct*/ QDialog { pub fn setVisible<RetType, T: QDialog_setVisible<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setVisible(self); // return 1; } } pub trait QDialog_setVisible<RetType> { fn setVisible(self , rsthis: & QDialog) -> RetType; } // proto: void QDialog::setVisible(bool visible); impl<'a> /*trait*/ QDialog_setVisible<()> for (i8) { fn setVisible(self , rsthis: & QDialog) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QDialog10setVisibleEb()}; let arg0 = self as c_char; unsafe {C_ZN7QDialog10setVisibleEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QWidget * QDialog::extension(); impl /*struct*/ QDialog { pub fn extension<RetType, T: QDialog_extension<RetType>>(& self, overload_args: T) -> RetType { return overload_args.extension(self); // return 1; } } pub trait QDialog_extension<RetType> { fn extension(self , rsthis: & QDialog) -> RetType; } // proto: QWidget * QDialog::extension(); impl<'a> /*trait*/ QDialog_extension<QWidget> for () { fn extension(self , rsthis: & QDialog) -> QWidget { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QDialog9extensionEv()}; let mut ret = unsafe {C_ZNK7QDialog9extensionEv(rsthis.qclsinst)}; let mut ret1 = QWidget::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QDialog::exec(); impl /*struct*/ QDialog { pub fn exec<RetType, T: QDialog_exec<RetType>>(& self, overload_args: T) -> RetType { return overload_args.exec(self); // return 1; } } pub trait QDialog_exec<RetType> { fn exec(self , rsthis: & QDialog) -> RetType; } // proto: int QDialog::exec(); impl<'a> /*trait*/ QDialog_exec<i32> for () { fn exec(self , rsthis: & QDialog) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QDialog4execEv()}; let mut ret = unsafe {C_ZN7QDialog4execEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QDialog::reject(); impl /*struct*/ QDialog { pub fn reject<RetType, T: QDialog_reject<RetType>>(& self, overload_args: T) -> RetType { return overload_args.reject(self); // return 1; } } pub trait QDialog_reject<RetType> { fn reject(self , rsthis: & QDialog) -> RetType; } // proto: void QDialog::reject(); impl<'a> /*trait*/ QDialog_reject<()> for () { fn reject(self , rsthis: & QDialog) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QDialog6rejectEv()}; unsafe {C_ZN7QDialog6rejectEv(rsthis.qclsinst)}; // return 1; } } // proto: bool QDialog::isSizeGripEnabled(); impl /*struct*/ QDialog { pub fn isSizeGripEnabled<RetType, T: QDialog_isSizeGripEnabled<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isSizeGripEnabled(self); // return 1; } } pub trait QDialog_isSizeGripEnabled<RetType> { fn isSizeGripEnabled(self , rsthis: & QDialog) -> RetType; } // proto: bool QDialog::isSizeGripEnabled(); impl<'a> /*trait*/ QDialog_isSizeGripEnabled<i8> for () { fn isSizeGripEnabled(self , rsthis: & QDialog) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QDialog17isSizeGripEnabledEv()}; let mut ret = unsafe {C_ZNK7QDialog17isSizeGripEnabledEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QDialog::setModal(bool modal); impl /*struct*/ QDialog { pub fn setModal<RetType, T: QDialog_setModal<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setModal(self); // return 1; } } pub trait QDialog_setModal<RetType> { fn setModal(self , rsthis: & QDialog) -> RetType; } // proto: void QDialog::setModal(bool modal); impl<'a> /*trait*/ QDialog_setModal<()> for (i8) { fn setModal(self , rsthis: & QDialog) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QDialog8setModalEb()}; let arg0 = self as c_char; unsafe {C_ZN7QDialog8setModalEb(rsthis.qclsinst, arg0)}; // return 1; } } #[derive(Default)] // for QDialog_finished pub struct QDialog_finished_signal{poi:u64} impl /* struct */ QDialog { pub fn finished(&self) -> QDialog_finished_signal { return QDialog_finished_signal{poi:self.qclsinst}; } } impl /* struct */ QDialog_finished_signal { pub fn connect<T: QDialog_finished_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QDialog_finished_signal_connect { fn connect(self, sigthis: QDialog_finished_signal); } #[derive(Default)] // for QDialog_accepted pub struct QDialog_accepted_signal{poi:u64} impl /* struct */ QDialog { pub fn accepted(&self) -> QDialog_accepted_signal { return QDialog_accepted_signal{poi:self.qclsinst}; } } impl /* struct */ QDialog_accepted_signal { pub fn connect<T: QDialog_accepted_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QDialog_accepted_signal_connect { fn connect(self, sigthis: QDialog_accepted_signal); } #[derive(Default)] // for QDialog_rejected pub struct QDialog_rejected_signal{poi:u64} impl /* struct */ QDialog { pub fn rejected(&self) -> QDialog_rejected_signal { return QDialog_rejected_signal{poi:self.qclsinst}; } } impl /* struct */ QDialog_rejected_signal { pub fn connect<T: QDialog_rejected_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QDialog_rejected_signal_connect { fn connect(self, sigthis: QDialog_rejected_signal); } // rejected() extern fn QDialog_rejected_signal_connect_cb_0(rsfptr:fn(), ) { println!("{}:{}", file!(), line!()); rsfptr(); } extern fn QDialog_rejected_signal_connect_cb_box_0(rsfptr_raw:*mut Box<Fn()>, ) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; // rsfptr(); unsafe{(*rsfptr_raw)()}; } impl /* trait */ QDialog_rejected_signal_connect for fn() { fn connect(self, sigthis: QDialog_rejected_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QDialog_rejected_signal_connect_cb_0 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QDialog_SlotProxy_connect__ZN7QDialog8rejectedEv(arg0, arg1, arg2)}; } } impl /* trait */ QDialog_rejected_signal_connect for Box<Fn()> { fn connect(self, sigthis: QDialog_rejected_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QDialog_rejected_signal_connect_cb_box_0 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QDialog_SlotProxy_connect__ZN7QDialog8rejectedEv(arg0, arg1, arg2)}; } } // finished(int) extern fn QDialog_finished_signal_connect_cb_1(rsfptr:fn(i32), arg0: c_int) { println!("{}:{}", file!(), line!()); let rsarg0 = arg0 as i32; rsfptr(rsarg0); } extern fn QDialog_finished_signal_connect_cb_box_1(rsfptr_raw:*mut Box<Fn(i32)>, arg0: c_int) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = arg0 as i32; // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QDialog_finished_signal_connect for fn(i32) { fn connect(self, sigthis: QDialog_finished_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QDialog_finished_signal_connect_cb_1 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QDialog_SlotProxy_connect__ZN7QDialog8finishedEi(arg0, arg1, arg2)}; } } impl /* trait */ QDialog_finished_signal_connect for Box<Fn(i32)> { fn connect(self, sigthis: QDialog_finished_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QDialog_finished_signal_connect_cb_box_1 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QDialog_SlotProxy_connect__ZN7QDialog8finishedEi(arg0, arg1, arg2)}; } } // accepted() extern fn QDialog_accepted_signal_connect_cb_2(rsfptr:fn(), ) { println!("{}:{}", file!(), line!()); rsfptr(); } extern fn QDialog_accepted_signal_connect_cb_box_2(rsfptr_raw:*mut Box<Fn()>, ) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; // rsfptr(); unsafe{(*rsfptr_raw)()}; } impl /* trait */ QDialog_accepted_signal_connect for fn() { fn connect(self, sigthis: QDialog_accepted_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QDialog_accepted_signal_connect_cb_2 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QDialog_SlotProxy_connect__ZN7QDialog8acceptedEv(arg0, arg1, arg2)}; } } impl /* trait */ QDialog_accepted_signal_connect for Box<Fn()> { fn connect(self, sigthis: QDialog_accepted_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QDialog_accepted_signal_connect_cb_box_2 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QDialog_SlotProxy_connect__ZN7QDialog8acceptedEv(arg0, arg1, arg2)}; } } // <= body block end
// Copyright 2022 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. use std::collections::HashSet; use std::collections::VecDeque; use std::fmt::Debug; use std::fmt::Formatter; use std::sync::Arc; use common_ast::ast::Expr; use common_ast::ast::Literal; use common_catalog::plan::InternalColumn; use common_catalog::table::Table; use common_expression::types::DataType; use common_expression::TableDataType; use common_expression::TableField; use parking_lot::RwLock; /// Planner use [`usize`] as it's index type. /// /// This type will be used across the whole planner. pub type IndexType = usize; /// Use IndexType::MAX to represent dummy table. pub static DUMMY_TABLE_INDEX: IndexType = IndexType::MAX; pub static DUMMY_COLUMN_INDEX: IndexType = IndexType::MAX; /// ColumnSet represents a set of columns identified by its IndexType. pub type ColumnSet = HashSet<IndexType>; /// A Send & Send version of [`Metadata`]. /// /// Callers can clone this ref safely and cheaply. pub type MetadataRef = Arc<RwLock<Metadata>>; /// Metadata stores information about columns and tables used in a query. /// Tables and columns are identified with its unique index. /// Notice that index value of a column can be same with that of a table. #[derive(Clone, Debug, Default)] pub struct Metadata { tables: Vec<TableEntry>, columns: Vec<ColumnEntry>, } impl Metadata { pub fn table(&self, index: IndexType) -> &TableEntry { self.tables.get(index).expect("metadata must contain table") } pub fn tables(&self) -> &[TableEntry] { self.tables.as_slice() } pub fn table_index_by_column_indexes(&self, column_indexes: &ColumnSet) -> Option<IndexType> { self.columns.iter().find_map(|v| match v { ColumnEntry::BaseTableColumn(BaseTableColumn { column_index, table_index, .. }) if column_indexes.contains(column_index) => Some(*table_index), _ => None, }) } pub fn get_table_index( &self, database_name: Option<&str>, table_name: &str, ) -> Option<IndexType> { self.tables .iter() .find(|table| match database_name { Some(database_name) => table.database == database_name && table.name == table_name, None => table.name == table_name, }) .map(|table| table.index) } pub fn column(&self, index: IndexType) -> &ColumnEntry { self.columns .get(index) .expect("metadata must contain column") } pub fn columns(&self) -> &[ColumnEntry] { self.columns.as_slice() } pub fn columns_by_table_index(&self, index: IndexType) -> Vec<ColumnEntry> { self.columns .iter() .filter(|column| match column { ColumnEntry::BaseTableColumn(BaseTableColumn { table_index, .. }) => { index == *table_index } ColumnEntry::InternalColumn(TableInternalColumn { table_index, .. }) => { index == *table_index } _ => false, }) .cloned() .collect() } pub fn add_base_table_column( &mut self, name: String, data_type: TableDataType, table_index: IndexType, path_indices: Option<Vec<IndexType>>, leaf_index: Option<IndexType>, ) -> IndexType { let column_index = self.columns.len(); let column_entry = ColumnEntry::BaseTableColumn(BaseTableColumn { column_name: name, data_type, column_index, table_index, path_indices, leaf_index, }); self.columns.push(column_entry); column_index } pub fn add_derived_column(&mut self, alias: String, data_type: DataType) -> IndexType { let column_index = self.columns.len(); let column_entry = ColumnEntry::DerivedColumn(DerivedColumn { column_index, alias, data_type, }); self.columns.push(column_entry); column_index } pub fn add_internal_column( &mut self, table_index: IndexType, internal_column: InternalColumn, ) -> IndexType { let column_index = self.columns.len(); self.columns .push(ColumnEntry::InternalColumn(TableInternalColumn { table_index, column_index, internal_column, })); column_index } pub fn add_table( &mut self, catalog: String, database: String, table_meta: Arc<dyn Table>, table_alias_name: Option<String>, source_of_view: bool, ) -> IndexType { let table_name = table_meta.name().to_string(); let table_index = self.tables.len(); // If exists table alias name, use it instead of origin name let table_entry = TableEntry { index: table_index, name: table_name, database, catalog, table: table_meta.clone(), alias_name: table_alias_name, source_of_view, }; self.tables.push(table_entry); let mut fields = VecDeque::new(); for (i, field) in table_meta.schema().fields().iter().enumerate() { fields.push_back((vec![i], field.clone())); } // build leaf index in DFS order for primitive columns. let mut leaf_index = 0; while let Some((indices, field)) = fields.pop_front() { let path_indices = if indices.len() > 1 { Some(indices.clone()) } else { None }; // TODO handle Tuple inside Array. if let TableDataType::Tuple { fields_name, fields_type, } = field.data_type().remove_nullable() { self.add_base_table_column( field.name().clone(), field.data_type().clone(), table_index, path_indices, None, ); let mut i = fields_type.len(); for (inner_field_name, inner_field_type) in fields_name.iter().zip(fields_type.iter()).rev() { i -= 1; let mut inner_indices = indices.clone(); inner_indices.push(i); // create tuple inner field let inner_name = format!("{}:{}", field.name(), inner_field_name); let inner_field = TableField::new(&inner_name, inner_field_type.clone()); fields.push_front((inner_indices, inner_field)); } } else { self.add_base_table_column( field.name().clone(), field.data_type().clone(), table_index, path_indices, Some(leaf_index), ); leaf_index += 1; } } table_index } } #[derive(Clone)] pub struct TableEntry { catalog: String, database: String, name: String, alias_name: Option<String>, index: IndexType, source_of_view: bool, table: Arc<dyn Table>, } impl Debug for TableEntry { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.debug_struct("TableEntry") .field("catalog", &self.catalog) .field("database", &self.database) .field("name", &self.name) .field("index", &self.index) .finish_non_exhaustive() } } impl TableEntry { pub fn new( index: IndexType, name: String, alias_name: Option<String>, catalog: String, database: String, table: Arc<dyn Table>, ) -> Self { TableEntry { index, name, catalog, database, table, alias_name, source_of_view: false, } } /// Get the catalog name of this table entry. pub fn catalog(&self) -> &str { &self.catalog } /// Get the database name of this table entry. pub fn database(&self) -> &str { &self.database } /// Get the name of this table entry. pub fn name(&self) -> &str { &self.name } /// Get the alias name of this table entry. pub fn alias_name(&self) -> &Option<String> { &self.alias_name } /// Get the index this table entry. pub fn index(&self) -> IndexType { self.index } /// Get the table of this table entry. pub fn table(&self) -> Arc<dyn Table> { self.table.clone() } /// Return true if it is source from view. pub fn is_source_of_view(&self) -> bool { self.source_of_view } } #[derive(Clone, Debug)] pub struct BaseTableColumn { pub table_index: IndexType, pub column_index: IndexType, pub column_name: String, pub data_type: TableDataType, /// Path indices for inner column of struct data type. pub path_indices: Option<Vec<usize>>, /// Leaf index is the primitive column index in Parquet, constructed in DFS order. /// None if the data type of column is struct. pub leaf_index: Option<usize>, } #[derive(Clone, Debug)] pub struct DerivedColumn { pub column_index: IndexType, pub alias: String, pub data_type: DataType, } #[derive(Clone, Debug)] pub struct TableInternalColumn { pub table_index: IndexType, pub column_index: IndexType, pub internal_column: InternalColumn, } #[derive(Clone, Debug)] pub enum ColumnEntry { /// Column from base table, for example `SELECT t.a, t.b FROM t`. BaseTableColumn(BaseTableColumn), /// Column synthesized from other columns, for example `SELECT t.a + t.b AS a FROM t`. DerivedColumn(DerivedColumn), /// Internal columns, such as `_row_id`, `_segment_name`, etc. InternalColumn(TableInternalColumn), } impl ColumnEntry { pub fn index(&self) -> IndexType { match self { ColumnEntry::BaseTableColumn(base) => base.column_index, ColumnEntry::DerivedColumn(derived) => derived.column_index, ColumnEntry::InternalColumn(internal_column) => internal_column.column_index, } } } pub fn optimize_remove_count_args(name: &str, distinct: bool, args: &[&Expr]) -> bool { name.eq_ignore_ascii_case("count") && !distinct && args .iter() .all(|expr| matches!(expr, Expr::Literal{lit,..} if *lit!=Literal::Null)) }
use std::fmt::{Display, Formatter}; use std::fmt; use crate::structs::dim::Dim; use crate::structs::dim::Dim::Size; use crate::structs::offset4::Offset4; pub const NDIMS: usize = 4; #[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq)] pub struct Shape4(Dim, Dim, Dim, Dim); impl Shape4 { pub fn vec4(x: usize, y: usize, z: usize, t: usize) -> Shape4 { Shape4(Size(x), Size(y), Size(z), Size(t)) } pub fn vec3(x: usize, y: usize, z: usize) -> Shape4 { Self::vec4(x, y, z, 1) } pub fn vec2(x: usize, y: usize) -> Shape4 { Self::vec4(x, y, 1, 1) } pub fn vec1(x: usize) -> Shape4 { Self::vec4(x, 1, 1, 1) } } impl Shape4 { #[inline] pub fn x(&self) -> Dim { self.0 } #[inline] pub fn y(&self) -> Dim { self.1 } #[inline] pub fn z(&self) -> Dim { self.2 } #[inline] pub fn t(&self) -> Dim { self.3 } #[inline] pub fn volume(&self) -> Dim { self.x() * self.y() * self.z() * self.t() } #[inline] pub fn len(&self) -> usize { self.volume().unwrap() } } impl Shape4 { pub fn offset4(&self, offset: usize) -> Offset4 { Offset4::from_shape(self, offset) } pub fn index(&self, offset: &Offset4) -> usize { log::trace!("Shape4.index"); offset.index_from(self) } pub fn check(&self, offset: &Offset4) { self.0.check(offset.0); self.1.check(offset.1); self.2.check(offset.2); self.3.check(offset.3); } } impl Display for Shape4 { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "{}x{}x{}x{}", self.0, self.1, self.2, self.3) } } #[cfg(test)] mod tests { use std::mem::size_of; use crate::structs::offset4::Offset4; use crate::structs::shape4::Shape4; #[test] fn test_mem_size() { println!("Offset4 : {}", size_of::<Offset4>()); println!("&Offset4: {}", size_of::<&Offset4>()); println!("Shape4 : {}", size_of::<Shape4>()); println!("&Shape4 : {}", size_of::<&Shape4>()); } #[test] fn test_new() { let x = 2; let y = 3; let z = 5; let t = 53; let shape = Shape4::vec4(x, y, z, t); println!("{} {} {} {}", x, y, z, t); println!("{}", shape); assert_eq!(x, shape.x().unwrap()); assert_eq!(y, shape.y().unwrap()); assert_eq!(z, shape.z().unwrap()); assert_eq!(t, shape.t().unwrap()); let xy = shape.x() * shape.y(); assert_eq!(x * y, xy.unwrap()); let yt = shape.y() * shape.t(); assert_eq!(y * t, yt.unwrap()); } #[test] fn test_shape() { let shape = Shape4::vec4(5, 3, 4, 7); let d0 = shape.x().unwrap(); let d1 = shape.y().unwrap(); let d2 = shape.z().unwrap(); let d3 = shape.t().unwrap(); println!("{} {} {} {}", d0, d1, d2, d3, ); for l in 0..d3 { for k in 0..d2 { for j in 0..d1 { for i in 0..d0 { println!("-[{},{},{},{}]----------------------------------------------------", i, j, k, l); let coord1 = Offset4::new(i, j, k, l); let index1 = shape.index(&coord1); let coord2 = shape.offset4(index1); println!("{:?} -> {} -> {:?}", coord1, index1, coord2); let id2 = shape.index(&coord2); assert_eq!(index1, id2); println!("-----------------------------------------"); } } } } } }
use super::GameboyType; use std::fmt; use std::fmt::Debug; use std::default::Default; #[derive(Copy, Clone)] pub enum Reg8 { A, F, B, C, D, E, H, L, } #[derive(Copy, Clone)] pub enum Reg16 { AF, BC, DE, HL, SP, } pub struct Registers { pub a: u8, pub b: u8, pub c: u8, pub d: u8, pub e: u8, pub h: u8, pub l: u8, pub sp: u16, pub pc: u16, pub zero: bool, pub subtract: bool, pub half_carry: bool, pub carry: bool, } impl Registers { pub fn new(gb_type: GameboyType) -> Registers { match gb_type { GameboyType::Cgb => { Registers { a: 0x11, d: 0xff, e: 0x56, l: 0x0d, zero: true, ..Default::default() } } GameboyType::Dmg => { Registers { a: 0x01, c: 0x13, e: 0xd8, h: 0x01, l: 0x4d, zero: true, half_carry: true, carry: true, ..Default::default() } } } } #[inline(always)] pub fn read_u8(&self, reg: Reg8) -> u8 { use self::Reg8::*; match reg { A => self.a, F => self.get_flags(), B => self.b, C => self.c, D => self.d, E => self.e, H => self.h, L => self.l, } } #[inline(always)] pub fn read_u16(&self, reg: Reg16) -> u16 { use self::Reg8::*; use self::Reg16::*; match reg { AF => ((self.read_u8(A) as u16) << 8) | self.read_u8(F) as u16, BC => ((self.read_u8(B) as u16) << 8) | self.read_u8(C) as u16, DE => ((self.read_u8(D) as u16) << 8) | self.read_u8(E) as u16, HL => ((self.read_u8(H) as u16) << 8) | self.read_u8(L) as u16, SP => self.sp, } } #[inline(always)] pub fn write_u8(&mut self, reg: Reg8, value: u8) { use self::Reg8::*; match reg { A => self.a = value, F => self.set_flags(value), B => self.b = value, C => self.c = value, D => self.d = value, E => self.e = value, H => self.h = value, L => self.l = value, } } #[inline(always)] pub fn write_u16(&mut self, reg: Reg16, value: u16) { use self::Reg8::*; use self::Reg16::*; let high = (value >> 8) as u8; let low = value as u8; match reg { AF => { self.write_u8(A, high); self.write_u8(F, low) } BC => { self.write_u8(B, high); self.write_u8(C, low) } DE => { self.write_u8(D, high); self.write_u8(E, low) } HL => { self.write_u8(H, high); self.write_u8(L, low) } SP => self.sp = value, } } #[inline(always)] fn get_flags(&self) -> u8 { let mut flags = 0; if self.zero { flags |= 0b1000_0000 } if self.subtract { flags |= 0b0100_0000 } if self.half_carry { flags |= 0b0010_0000 } if self.carry { flags |= 0b0001_0000 } flags } #[inline(always)] fn set_flags(&mut self, flags: u8) { self.zero = (flags & 0b1000_0000) != 0; self.subtract = (flags & 0b0100_0000) != 0; self.half_carry = (flags & 0b0010_0000) != 0; self.carry = (flags & 0b0001_0000) != 0; } } impl Default for Registers { fn default() -> Registers { Registers { a: 0, b: 0, c: 0, d: 0, e: 0, h: 0, l: 0, sp: 0xfffe, pc: 0x0100, zero: false, subtract: false, half_carry: false, carry: false, } } } impl Debug for Registers { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Registers {{ af: {:04X} bc: {:04X} de: {:04X} hl: {:04X} sp: {:04X} pc: {:04X} zero: {:#?} subtract: {:#?} half_carry: {:#?} carry: {:#?} }}", self.read_u16(Reg16::AF), self.read_u16(Reg16::BC), self.read_u16(Reg16::DE), self.read_u16(Reg16::HL), self.sp, self.pc, self.zero, self.subtract, self.half_carry, self.carry) } }
use fileutil; use std::collections::{HashMap, HashSet, BTreeSet}; use std::u32; #[derive(Clone, Copy)] struct Edge { src: char, dest: char } // Implementation of Kahn's algorithm for computing a topological sort. fn kahns_algorithm(adj_orig: &HashMap<char, HashSet<char>>) -> Vec<char> { let mut adj = adj_orig.clone(); let mut topolist: Vec<char> = Vec::with_capacity(adj.len()); let mut candset: BTreeSet<char> = adj.iter() .filter(|(dest, srclist)| srclist.is_empty()) .map(|(dest, _)| *dest) .collect(); loop { if candset.is_empty() { break; } let c: char = *candset.iter().next().unwrap(); candset.remove(&c); topolist.push(c); for (_, srcset) in adj.iter_mut() { srcset.remove(&c); } for (dest, srcset) in adj.iter() { if srcset.is_empty() && c != *dest && !candset.contains(dest) && !topolist.contains(dest) { candset.insert(*dest); } } } return topolist; } fn assign(workers: &mut Vec<Option<(char, u32)>>, task: char) -> () { let is_assigned = workers.iter() .any(|worker| { match *worker { Some((worker_task, _)) => worker_task == task, None => false } }); if is_assigned { return; } for worker in workers.iter_mut() { match *worker { Some(_) => { } None => { let work = compute_work(task); *worker = Some((task, work)); return; } } } } fn simulate_work(workers: &mut Vec<Option<(char, u32)>>) -> (HashSet<char>, u32) { let mut ticks_to_adv = u32::MAX; for worker in workers.iter() { match *worker { Some((task, worker_work)) => { ticks_to_adv = ticks_to_adv.min(worker_work); } None => { } } } if ticks_to_adv == u32::MAX { return (HashSet::new(), 0); } let mut completed: HashSet<char> = HashSet::new(); for worker in workers.iter_mut() { match *worker { Some((task, worker_work)) => { if ticks_to_adv >= worker_work { *worker = None; completed.insert(task); } else { *worker = Some((task, worker_work - ticks_to_adv)); } } None => { } } } (completed, ticks_to_adv) } fn compute_work(task: char) -> u32 { let a_digit = 'a' as u32; let task_digit = (task.to_ascii_lowercase()) as u32; task_digit - a_digit + 1 + 60 } fn compute_total_work( adj: &HashMap<char, HashSet<char>>, topolist: &Vec<char>, num_workers: usize) -> u32 { // Each index represents a worker, each value represents ticks left on current work. let mut workers: Vec<Option<(char, u32)>> = Vec::with_capacity(num_workers); workers.resize(num_workers, Option::None); let mut total_ticks = 0; let mut complete: HashSet<char> = HashSet::new(); let mut ticks = 0; loop { if complete.len() == topolist.len() { break; } let (just_completed, ticks_adv) = simulate_work(&mut workers); for just_completed_task in just_completed.iter() { complete.insert(*just_completed_task); } total_ticks += ticks_adv; for task in topolist { match adj.get(task) { Some(deps) => { if !complete.contains(task) && deps.difference(&complete).count() == 0 { assign(&mut workers, *task); } } None => { println!("no deps set! :{}", task) } } } } total_ticks } pub fn run() -> () { match fileutil::read_lines("./data/2018/07.txt") { Ok(lines) => { let edges: Vec<Edge> = lines.iter() .map(|line| { let charvec: Vec<char> = line.chars().collect(); Edge { src: charvec[5], dest: charvec[36] } }).collect(); let mut adj: HashMap<char, HashSet<char>> = HashMap::new(); for Edge { src, dest } in edges.iter() { adj.entry(*src).or_insert(HashSet::new()); adj.entry(*dest).or_insert(HashSet::new()).insert(*src); } let topolist: Vec<char> = kahns_algorithm(&adj); println!("part 1."); println!("topological sort: {:?}", topolist.iter().collect::<String>()); println!("part 2."); println!("total work: {}", compute_total_work(&adj, &topolist, 5)); } Err(e) => { panic!(e); } } }
use std::io; use std::net::{TcpListener, TcpStream}; use std::sync::Arc; use anyhow::Error; use fehler::throws; use log::{debug, info}; use threadpool::ThreadPool; use crate::http_handler::{handle, Handler, Response}; #[throws] fn handle_stream(stream: TcpStream, handler: Arc<impl Handler>) -> Response { let mut out = stream.try_clone()?; let mut reader = io::BufReader::new(stream); handle(&mut reader, &mut out, handler)? } fn uber_handle_stream(stream: io::Result<TcpStream>, handler: Arc<impl Handler>) { match stream { Ok(stream) => { let addr = stream.peer_addr().unwrap(); debug!("Accepted connection: {}", addr); let res = handle_stream(stream, handler); match res { Ok(response) => info!("{} {}", addr, response.status()), Err(e) => info!("An error happened while handling request {}", e), } } Err(e) => { info!("Connection failed: {}", e); } } } pub fn run(listener: TcpListener, pool: ThreadPool, handler: impl Handler + 'static) { info!( "Running server on {} with {} threads", listener.local_addr().unwrap(), pool.max_count() ); let arch = Arc::new(handler); for stream in listener.incoming() { let ahandler = Arc::clone(&arch); pool.execute(move || { uber_handle_stream(stream, ahandler); }); } }
#[derive(Debug,Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Hash)] pub enum GoodEvil { Evil, Neutral, Good, } impl GoodEvil { pub fn opposite(self) -> Self { use GoodEvil::*; match self { Evil => Good, Good => Evil, x => x, } } } #[derive(Debug,Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Hash)] pub enum LawChaos { Chaotic, Neutral, Lawful, } impl LawChaos { pub fn opposite(self) -> Self { use LawChaos::*; match self { Chaotic => Lawful, Lawful => Chaotic, x => x, } } } #[derive(Debug,Clone,Copy,PartialEq,Eq,Hash)] pub struct Alignment { pub ge: GoodEvil, pub lc: LawChaos, }
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} #[repr(C)] pub struct GameControllerVersionInfo { pub Major: u16, pub Minor: u16, pub Build: u16, pub Revision: u16, } impl ::core::marker::Copy for GameControllerVersionInfo {} impl ::core::clone::Clone for GameControllerVersionInfo { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct GipFirmwareUpdateProgress { pub PercentCompleted: f64, pub CurrentComponentId: u32, } impl ::core::marker::Copy for GipFirmwareUpdateProgress {} impl ::core::clone::Clone for GipFirmwareUpdateProgress { fn clone(&self) -> Self { *self } } pub type GipFirmwareUpdateResult = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct GipFirmwareUpdateStatus(pub i32); impl GipFirmwareUpdateStatus { pub const Completed: Self = Self(0i32); pub const UpToDate: Self = Self(1i32); pub const Failed: Self = Self(2i32); } impl ::core::marker::Copy for GipFirmwareUpdateStatus {} impl ::core::clone::Clone for GipFirmwareUpdateStatus { fn clone(&self) -> Self { *self } } pub type GipGameControllerProvider = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct GipMessageClass(pub i32); impl GipMessageClass { pub const Command: Self = Self(0i32); pub const LowLatency: Self = Self(1i32); pub const StandardLatency: Self = Self(2i32); } impl ::core::marker::Copy for GipMessageClass {} impl ::core::clone::Clone for GipMessageClass { fn clone(&self) -> Self { *self } } pub type HidGameControllerProvider = *mut ::core::ffi::c_void; pub type ICustomGameControllerFactory = *mut ::core::ffi::c_void; pub type IGameControllerInputSink = *mut ::core::ffi::c_void; pub type IGameControllerProvider = *mut ::core::ffi::c_void; pub type IGipGameControllerInputSink = *mut ::core::ffi::c_void; pub type IHidGameControllerInputSink = *mut ::core::ffi::c_void; pub type IXusbGameControllerInputSink = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct XusbDeviceSubtype(pub i32); impl XusbDeviceSubtype { pub const Unknown: Self = Self(0i32); pub const Gamepad: Self = Self(1i32); pub const ArcadePad: Self = Self(2i32); pub const ArcadeStick: Self = Self(3i32); pub const FlightStick: Self = Self(4i32); pub const Wheel: Self = Self(5i32); pub const Guitar: Self = Self(6i32); pub const GuitarAlternate: Self = Self(7i32); pub const GuitarBass: Self = Self(8i32); pub const DrumKit: Self = Self(9i32); pub const DancePad: Self = Self(10i32); } impl ::core::marker::Copy for XusbDeviceSubtype {} impl ::core::clone::Clone for XusbDeviceSubtype { fn clone(&self) -> Self { *self } } #[repr(transparent)] pub struct XusbDeviceType(pub i32); impl XusbDeviceType { pub const Unknown: Self = Self(0i32); pub const Gamepad: Self = Self(1i32); } impl ::core::marker::Copy for XusbDeviceType {} impl ::core::clone::Clone for XusbDeviceType { fn clone(&self) -> Self { *self } } pub type XusbGameControllerProvider = *mut ::core::ffi::c_void;
use libc::stat; use std::ffi::CStr; use std::ffi::CString; use std::os::raw::c_char; use std::os::raw::c_int; use std::cell::RefCell; use std::fmt::Debug; use std::path::Path; use std::path::PathBuf; use std::vec::Vec; use crate::fs::constants::*; use super::FileFinderTrait; use crate::dir_entry::StandaloneDirEntry; use crate::fs::StandaloneFileType; #[repr(C)] struct Ftw { base: c_int, level: c_int, } #[allow(unused)] type FtwFn = extern "C" fn(fpath: *const c_char, sb: *const stat, typeflag: c_int) -> c_int; #[allow(unused)] type NftwFn = extern "C" fn( fpath: *const c_char, sb: *const stat, typeflag: c_int, ftwbuf: *const Ftw, ) -> c_int; extern "C" { /// Wrapper for [`nftw`](https://linux.die.net/man/3/nftw) /// int nftw( /// const char *dirpath, /// int (*fn) (const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf), /// int nopenfd, /// int flags /// ); fn nftw(dirpath: *const c_char, f: NftwFn, nopenfd: c_int, flags: c_int) -> c_int; /// Wrapper for [`ftw`](https://linux.die.net/man/3/ftw) /// int ftw( /// const char *dirpath, /// int (*fn) (const char *fpath, const struct stat *sb, int typeflag), /// int nopenfd /// ); #[allow(unused)] fn ftw(dirpath: *const c_char, f: FtwFn, nopenfd: c_int) -> c_int; } // Thread local vector to hold the found paths thread_local! { static FOUND_PATHS: RefCell<Vec<StandaloneDirEntry>> = RefCell::new(vec![]); } /// Callback for [`ftw`](https://linux.die.net/man/3/ftw) #[allow(unused)] extern "C" fn ftw_collector(fpath: *const c_char, _sb: *const stat, typeflag: c_int) -> c_int { unsafe { let path_string = CStr::from_ptr(fpath); let dir_entry = StandaloneDirEntry::from_path_with_file_type( PathBuf::from(path_string.to_string_lossy().into_owned()), StandaloneFileType::from_ftw(typeflag), ); FOUND_PATHS.with(|p| p.borrow_mut().push(dir_entry)); } 0 } /// Callback for [`nftw`](https://linux.die.net/man/3/nftw) extern "C" fn nftw_collector( fpath: *const c_char, _sb: *const stat, typeflag: c_int, _ftwbuf: *const Ftw, ) -> c_int { unsafe { let path_string = CStr::from_ptr(fpath); if typeflag == FTW_F { let dir_entry = StandaloneDirEntry::from_path_with_file_type( path_string.to_string_lossy().into_owned(), StandaloneFileType::from_ftw(typeflag), ); FOUND_PATHS.with(|p| p.borrow_mut().push(dir_entry)); } } 0 } #[derive(Clone)] pub struct FileFinder {} impl FileFinder { #[allow(unused)] pub fn new() -> Self { FileFinder {} } } impl FileFinderTrait for FileFinder { type DirEntry = StandaloneDirEntry; fn walk_dir<P: AsRef<Path> + Debug + Clone, F>(&self, root: P, filter: F) -> Vec<Self::DirEntry> where F: FnMut(&Self::DirEntry) -> bool, { let entries = collect_dir_entries_nftw(&root.as_ref().to_string_lossy().into_owned()); entries.into_iter().filter(filter).collect() } } fn clear_entries() { FOUND_PATHS.with(|p| p.borrow_mut().clear()); } #[allow(unused)] fn collect_dir_entries_ftw(root: &str) -> Vec<StandaloneDirEntry> { clear_entries(); let path = CString::new(root).unwrap(); unsafe { ftw(path.as_ptr(), ftw_collector, 20); } FOUND_PATHS.with(|p| (*p.borrow()).clone()) } fn collect_dir_entries_nftw(root: &str) -> Vec<StandaloneDirEntry> { clear_entries(); let path = CString::new(root).unwrap(); unsafe { nftw(path.as_ptr(), nftw_collector, 20, FTW_PHYS); } FOUND_PATHS.with(|p| (*p.borrow()).clone()) } #[cfg(test)] mod test { use super::*; #[test] fn collect_dir_entries_ftw_test() { let r = collect_dir_entries_ftw(&format!("{}/tests", env!("CARGO_MANIFEST_DIR"))); assert!( 25 < r.len(), "Expected result length to be bigger than 25, got {}", r.len() ); } #[test] fn collect_dir_entries_nftw_test() { let r = collect_dir_entries_nftw(&format!("{}/tests", env!("CARGO_MANIFEST_DIR"))); assert!( 25 < r.len(), "Expected result length to be bigger than 25, got {}", r.len() ); } #[test] fn walk_dir_test() { let r = FileFinder::walk_dir( &FileFinder::new(), &format!("{}/tests", env!("CARGO_MANIFEST_DIR")), |_| true, ); assert!( 25 < r.len(), "Expected result length to be bigger than 25, got {}", r.len() ); } #[test] fn find_test() { let r = FileFinder::walk_dir( &FileFinder::new(), &format!("{}/tests", env!("CARGO_MANIFEST_DIR")), |_| true, ); assert!( 25 < r.len(), "Expected result length to be bigger than 25, got {}", r.len() ); } }
// Copyright (c) 2016 The Rouille developers // 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. All files in the project carrying such // notice may not be copied, modified, or distributed except // according to those terms. /// Evaluates each parameter until one of them evaluates to something else /// than a 404 error code. /// /// This macro supposes that each route returns a `Response`. /// /// # Example /// /// ``` /// # #[macro_use] extern crate rouille; /// # fn main() { /// use rouille::{Request, Response}; /// /// fn handle_request_a(_: &Request) -> Response { /// # panic!() /// // ... /// } /// /// fn handle_request_b(_: &Request) -> Response { /// # panic!() /// // ... /// } /// /// fn handle_request_c(_: &Request) -> Response { /// # panic!() /// // ... /// } /// /// # let request = return; /// // First calls `handle_request_a`. If it returns anything else than a 404 error, then the /// // `response` will contain the return value. /// // /// // Instead if `handle_request_a` returned a 404 error, then `handle_request_b` is tried. /// // If `handle_request_b` also returns a 404 error, then `handle_request_c` is tried. /// let response = find_route!( /// handle_request_a(request), /// handle_request_b(request), /// handle_request_c(request) /// ); /// # } /// ``` /// #[macro_export] macro_rules! find_route { ($($handler:expr),+) => ({ let mut response = $crate::Response::empty_404(); $( if response.status_code == 404 { response = $handler; } )+ response }); }
// Copyright (C) 2019 Robin Krahl <robin.krahl@ireas.org> // SPDX-License-Identifier: MIT use dialog::DialogBox; fn main() -> dialog::Result<()> { let input1 = dialog::Input::new("Please enter something").show()?; let input2 = dialog::Input::new("Please enter something") .title("Input form") .show()?; let input3 = dialog::Input::new("Please enter something with a default") .title("Input form") .default("input") .show()?; println!("Input 1: {:?}", input1); println!("Input 2: {:?}", input2); println!("Input 3: {:?}", input3); Ok(()) }
mod error_kind; mod result; pub use self::error_kind::ErrorKind; pub use self::result::Result; pub use failure::Error;
use std::ops::{Add, Sub, Neg, Mul}; use std::hash::{Hash, Hasher}; use utils::fpoint::FPoint; use utils::irange::IRange; use utils::point::Point; use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Error; use std::fmt::Debug; #[derive(Serialize, Deserialize, Clone, Copy)] pub struct IPoint { pub x: i32, pub y: i32, } impl Debug for IPoint { fn fmt(&self, f: &mut Formatter) -> Result<(), Error> { write!(f, "(x:{}, y:{})", self.x, self.y) } } impl Display for IPoint { fn fmt(&self, f: &mut Formatter) -> Result<(), Error> { write!(f, "(x:{}, y:{})", self.x, self.y) } } impl IPoint { pub fn zero() -> IPoint { IPoint { x: 0, y: 0 } } pub fn bottom(&self, other: IPoint) -> IPoint { IPoint { x: self.x.min(other.x), y: self.y.min(other.y) } } pub fn top(&self, other: IPoint) -> IPoint { IPoint { x: self.x.max(other.x), y: self.y.max(other.y) } } pub fn float(&self) -> FPoint { FPoint { x: self.x as f32, y: self.y as f32 } } pub fn range(self, to: IPoint) -> IRange { IRange {start: self, end: to} } pub fn zrange(self) -> IRange { IRange {start: IPoint::zero(), end: self} } pub fn square_around(self, radius: i32) -> IRange { IRange { start: self - IPoint{x: radius, y: radius}, end: self + IPoint{x: radius + 1, y: radius + 1} } } pub fn neumann_dist(&self, to: IPoint) -> i32 { (self.x - to.x).abs() + (self.y - to.y).abs() } pub fn neumann_surrounding(&self) -> Vec<IPoint> { vec![ IPoint{x: self.x+1, y: self.y}, IPoint{x: self.x, y: self.y+1}, IPoint{x: self.x-1, y: self.y}, IPoint{x: self.x, y: self.y-1}, ] } pub fn abs(self) -> IPoint { IPoint { x: self.x.abs(), y: self.y.abs() } } } impl Point<IPoint> for IPoint { fn dist(self, other: IPoint) -> f32 { let dx = self.x - other.x; let dy = self.y - other.y; ((dx*dx + dy*dy) as f32).sqrt() } } impl Point<FPoint> for IPoint { fn dist(self, other: FPoint) -> f32 { let dx = (self.x as f32) - other.x; let dy = (self.y as f32) - other.y; (dx*dx + dy*dy).sqrt() } } impl Eq for IPoint {} impl PartialEq for IPoint { fn eq(&self, other: &IPoint) -> bool { self.x == other.x && self.y == other.y } } impl Add<IPoint> for IPoint { type Output = IPoint; fn add(self, other: IPoint) -> IPoint { IPoint {x: self.x + other.x, y: self.y + other.y} } } impl Add<FPoint> for IPoint { type Output = FPoint; fn add(self, other: FPoint) -> FPoint { FPoint {x: self.x as f32 + other.x, y: self.y as f32 + other.y} } } impl Sub<IPoint> for IPoint { type Output = IPoint; fn sub(self, other: IPoint) -> IPoint { IPoint {x: self.x - other.x, y: self.y - other.y} } } impl Sub<FPoint> for IPoint { type Output = FPoint; fn sub(self, other: FPoint) -> FPoint { FPoint {x: self.x as f32 - other.x, y: self.y as f32 - other.y} } } impl Neg for IPoint { type Output = IPoint; fn neg(self) -> IPoint { return IPoint {x: -self.x, y: -self.y}; } } impl Mul<IPoint> for IPoint { type Output = IPoint; fn mul(self, other: IPoint) -> IPoint { IPoint {x: self.x * other.x, y: self.y * other.y} } } impl Mul<i32> for IPoint { type Output = IPoint; fn mul(self, other: i32) -> IPoint { IPoint {x: self.x * other, y: self.y * other} } } impl Hash for IPoint { fn hash<H: Hasher>(&self, state: &mut H) { state.write_i32(self.x); state.write_i32(self.y); } }
//! Utilities for actor tests. /// A pair of actors that send messages and increment message counters. pub mod ping_pong { use crate::actor::*; use crate::*; pub struct PingPongActor { serve_to: Option<Id>, } #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub enum PingPongMsg { Ping(u32), Pong(u32), } impl Actor for PingPongActor { type Msg = PingPongMsg; type State = u32; // count type Timer = (); fn on_start(&self, _id: Id, o: &mut Out<Self>) -> Self::State { if let Some(id) = self.serve_to { o.send(id, PingPongMsg::Ping(0)); } 0 } fn on_msg( &self, _id: Id, state: &mut Cow<Self::State>, src: Id, msg: Self::Msg, o: &mut Out<Self>, ) { match msg { PingPongMsg::Pong(msg_value) if **state == msg_value => { o.send(src, PingPongMsg::Ping(msg_value + 1)); *state.to_mut() += 1; } PingPongMsg::Ping(msg_value) if **state == msg_value => { o.send(src, PingPongMsg::Pong(msg_value)); *state.to_mut() += 1; } _ => {} } } } pub struct PingPongCfg { pub maintains_history: bool, pub max_nat: u32, } pub type PingPongHistory = (u32, u32); // (#in, #out) impl PingPongCfg { pub fn into_model(self) -> ActorModel<PingPongActor, PingPongCfg, PingPongHistory> { ActorModel::new(self, (0, 0)) .actor(PingPongActor { serve_to: Some(1.into()), }) .actor(PingPongActor { serve_to: None }) .record_msg_in(|cfg, history, _| { if cfg.maintains_history { let (msg_in_count, msg_out_count) = *history; Some((msg_in_count + 1, msg_out_count)) } else { None } }) .record_msg_out(|cfg, history, _| { if cfg.maintains_history { let (msg_in_count, msg_out_count) = *history; Some((msg_in_count, msg_out_count + 1)) } else { None } }) .within_boundary(|cfg, state| { state .actor_states .iter() .all(|count| **count <= cfg.max_nat) }) .property(Expectation::Always, "delta within 1", |_, state| { let max = state.actor_states.iter().max().unwrap(); let min = state.actor_states.iter().min().unwrap(); **max - **min <= 1 }) .property(Expectation::Sometimes, "can reach max", |model, state| { state .actor_states .iter() .any(|count| **count == model.cfg.max_nat) }) .property(Expectation::Eventually, "must reach max", |model, state| { state .actor_states .iter() .any(|count| **count == model.cfg.max_nat) }) .property( Expectation::Eventually, "must exceed max", |model, state| { // this one is falsifiable due to the boundary state .actor_states .iter() .any(|count| **count == model.cfg.max_nat + 1) }, ) .property(Expectation::Always, "#in <= #out", |_, state| { let (msg_in_count, msg_out_count) = state.history; msg_in_count <= msg_out_count }) .property(Expectation::Eventually, "#out <= #in + 1", |_, state| { let (msg_in_count, msg_out_count) = state.history; msg_out_count <= msg_in_count + 1 }) } } }
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtWidgets/qlistwidget.h // dst-file: /src/widgets/qlistwidget.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block begin => // <= main block end // use block begin => use std::ops::Deref; use super::super::core::qvariant::*; // 771 use super::super::gui::qbrush::*; // 771 use super::super::gui::qfont::*; // 771 // use super::qlistwidget::QListWidget; // 773 use super::super::core::qdatastream::*; // 771 use super::super::core::qstring::*; // 771 use super::super::gui::qicon::*; // 771 use super::super::gui::qcolor::*; // 771 use super::super::core::qsize::*; // 771 use super::qlistview::*; // 773 use super::super::gui::qevent::*; // 771 // use super::qlistwidget::QListWidgetItem; // 773 use super::qwidget::*; // 773 use super::super::core::qpoint::*; // 771 use super::super::core::qstringlist::*; // 771 // use super::qlist::*; // 775 use super::super::core::qobjectdefs::*; // 771 use super::super::core::qrect::*; // 771 // <= use block end // ext block begin => // #[link(name = "Qt5Core")] // #[link(name = "Qt5Gui")] // #[link(name = "Qt5Widgets")] // #[link(name = "QtInline")] extern { fn QListWidgetItem_Class_Size() -> c_int; // proto: void QListWidgetItem::~QListWidgetItem(); fn C_ZN15QListWidgetItemD2Ev(qthis: u64 /* *mut c_void*/); // proto: bool QListWidgetItem::isHidden(); fn C_ZNK15QListWidgetItem8isHiddenEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: void QListWidgetItem::setData(int role, const QVariant & value); fn C_ZN15QListWidgetItem7setDataEiRK8QVariant(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void); // proto: void QListWidgetItem::setBackground(const QBrush & brush); fn C_ZN15QListWidgetItem13setBackgroundERK6QBrush(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QListWidgetItem::setSelected(bool select); fn C_ZN15QListWidgetItem11setSelectedEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: QFont QListWidgetItem::font(); fn C_ZNK15QListWidgetItem4fontEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QListWidgetItem::setTextAlignment(int alignment); fn C_ZN15QListWidgetItem16setTextAlignmentEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: void QListWidgetItem::QListWidgetItem(QListWidget * view, int type); fn C_ZN15QListWidgetItemC2EP11QListWidgeti(arg0: *mut c_void, arg1: c_int) -> u64; // proto: void QListWidgetItem::write(QDataStream & out); fn C_ZNK15QListWidgetItem5writeER11QDataStream(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QString QListWidgetItem::whatsThis(); fn C_ZNK15QListWidgetItem9whatsThisEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: int QListWidgetItem::type(); fn C_ZNK15QListWidgetItem4typeEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QListWidgetItem::QListWidgetItem(const QIcon & icon, const QString & text, QListWidget * view, int type); fn C_ZN15QListWidgetItemC2ERK5QIconRK7QStringP11QListWidgeti(arg0: *mut c_void, arg1: *mut c_void, arg2: *mut c_void, arg3: c_int) -> u64; // proto: QIcon QListWidgetItem::icon(); fn C_ZNK15QListWidgetItem4iconEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QColor QListWidgetItem::textColor(); fn C_ZNK15QListWidgetItem9textColorEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QBrush QListWidgetItem::foreground(); fn C_ZNK15QListWidgetItem10foregroundEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QBrush QListWidgetItem::background(); fn C_ZNK15QListWidgetItem10backgroundEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QListWidgetItem::setStatusTip(const QString & statusTip); fn C_ZN15QListWidgetItem12setStatusTipERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QString QListWidgetItem::text(); fn C_ZNK15QListWidgetItem4textEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QColor QListWidgetItem::backgroundColor(); fn C_ZNK15QListWidgetItem15backgroundColorEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: bool QListWidgetItem::isSelected(); fn C_ZNK15QListWidgetItem10isSelectedEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: void QListWidgetItem::setFont(const QFont & font); fn C_ZN15QListWidgetItem7setFontERK5QFont(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QListWidgetItem::setText(const QString & text); fn C_ZN15QListWidgetItem7setTextERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QListWidgetItem::QListWidgetItem(const QString & text, QListWidget * view, int type); fn C_ZN15QListWidgetItemC2ERK7QStringP11QListWidgeti(arg0: *mut c_void, arg1: *mut c_void, arg2: c_int) -> u64; // proto: QVariant QListWidgetItem::data(int role); fn C_ZNK15QListWidgetItem4dataEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: QSize QListWidgetItem::sizeHint(); fn C_ZNK15QListWidgetItem8sizeHintEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QListWidgetItem::setWhatsThis(const QString & whatsThis); fn C_ZN15QListWidgetItem12setWhatsThisERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QListWidgetItem::read(QDataStream & in); fn C_ZN15QListWidgetItem4readER11QDataStream(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QListWidgetItem::setTextColor(const QColor & color); fn C_ZN15QListWidgetItem12setTextColorERK6QColor(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QListWidgetItem::setSizeHint(const QSize & size); fn C_ZN15QListWidgetItem11setSizeHintERK5QSize(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QListWidget * QListWidgetItem::listWidget(); fn C_ZNK15QListWidgetItem10listWidgetEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QListWidgetItem::setIcon(const QIcon & icon); fn C_ZN15QListWidgetItem7setIconERK5QIcon(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QListWidgetItem * QListWidgetItem::clone(); fn C_ZNK15QListWidgetItem5cloneEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QListWidgetItem::setBackgroundColor(const QColor & color); fn C_ZN15QListWidgetItem18setBackgroundColorERK6QColor(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QListWidgetItem::setForeground(const QBrush & brush); fn C_ZN15QListWidgetItem13setForegroundERK6QBrush(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QListWidgetItem::QListWidgetItem(const QListWidgetItem & other); fn C_ZN15QListWidgetItemC2ERKS_(arg0: *mut c_void) -> u64; // proto: void QListWidgetItem::setHidden(bool hide); fn C_ZN15QListWidgetItem9setHiddenEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: QString QListWidgetItem::toolTip(); fn C_ZNK15QListWidgetItem7toolTipEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: int QListWidgetItem::textAlignment(); fn C_ZNK15QListWidgetItem13textAlignmentEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: QString QListWidgetItem::statusTip(); fn C_ZNK15QListWidgetItem9statusTipEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QListWidgetItem::setToolTip(const QString & toolTip); fn C_ZN15QListWidgetItem10setToolTipERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); fn QListWidget_Class_Size() -> c_int; // proto: void QListWidget::dropEvent(QDropEvent * event); fn C_ZN11QListWidget9dropEventEP10QDropEvent(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QWidget * QListWidget::itemWidget(QListWidgetItem * item); fn C_ZNK11QListWidget10itemWidgetEP15QListWidgetItem(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: void QListWidget::QListWidget(QWidget * parent); fn C_ZN11QListWidgetC2EP7QWidget(arg0: *mut c_void) -> u64; // proto: int QListWidget::currentRow(); fn C_ZNK11QListWidget10currentRowEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: QListWidgetItem * QListWidget::item(int row); fn C_ZNK11QListWidget4itemEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: QListWidgetItem * QListWidget::itemAt(const QPoint & p); fn C_ZNK11QListWidget6itemAtERK6QPoint(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: void QListWidget::insertItem(int row, const QString & label); fn C_ZN11QListWidget10insertItemEiRK7QString(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void); // proto: int QListWidget::row(const QListWidgetItem * item); fn C_ZNK11QListWidget3rowEPK15QListWidgetItem(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_int; // proto: void QListWidget::openPersistentEditor(QListWidgetItem * item); fn C_ZN11QListWidget20openPersistentEditorEP15QListWidgetItem(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QListWidget::clear(); fn C_ZN11QListWidget5clearEv(qthis: u64 /* *mut c_void*/); // proto: void QListWidget::editItem(QListWidgetItem * item); fn C_ZN11QListWidget8editItemEP15QListWidgetItem(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: int QListWidget::count(); fn C_ZNK11QListWidget5countEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QListWidget::setItemHidden(const QListWidgetItem * item, bool hide); fn C_ZN11QListWidget13setItemHiddenEPK15QListWidgetItemb(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_char); // proto: void QListWidget::~QListWidget(); fn C_ZN11QListWidgetD2Ev(qthis: u64 /* *mut c_void*/); // proto: void QListWidget::addItem(QListWidgetItem * item); fn C_ZN11QListWidget7addItemEP15QListWidgetItem(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QListWidgetItem * QListWidget::takeItem(int row); fn C_ZN11QListWidget8takeItemEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: bool QListWidget::isSortingEnabled(); fn C_ZNK11QListWidget16isSortingEnabledEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: void QListWidget::addItems(const QStringList & labels); fn C_ZN11QListWidget8addItemsERK11QStringList(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QList<QListWidgetItem *> QListWidget::selectedItems(); fn C_ZNK11QListWidget13selectedItemsEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: const QMetaObject * QListWidget::metaObject(); fn C_ZNK11QListWidget10metaObjectEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QListWidget::setItemSelected(const QListWidgetItem * item, bool select); fn C_ZN11QListWidget15setItemSelectedEPK15QListWidgetItemb(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_char); // proto: void QListWidget::insertItem(int row, QListWidgetItem * item); fn C_ZN11QListWidget10insertItemEiP15QListWidgetItem(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void); // proto: void QListWidget::setCurrentRow(int row); fn C_ZN11QListWidget13setCurrentRowEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: void QListWidget::setSortingEnabled(bool enable); fn C_ZN11QListWidget17setSortingEnabledEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: QRect QListWidget::visualItemRect(const QListWidgetItem * item); fn C_ZNK11QListWidget14visualItemRectEPK15QListWidgetItem(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: void QListWidget::removeItemWidget(QListWidgetItem * item); fn C_ZN11QListWidget16removeItemWidgetEP15QListWidgetItem(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QListWidget::closePersistentEditor(QListWidgetItem * item); fn C_ZN11QListWidget21closePersistentEditorEP15QListWidgetItem(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: bool QListWidget::isItemHidden(const QListWidgetItem * item); fn C_ZNK11QListWidget12isItemHiddenEPK15QListWidgetItem(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_char; // proto: QListWidgetItem * QListWidget::itemAt(int x, int y); fn C_ZNK11QListWidget6itemAtEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int) -> *mut c_void; // proto: void QListWidget::addItem(const QString & label); fn C_ZN11QListWidget7addItemERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QListWidget::insertItems(int row, const QStringList & labels); fn C_ZN11QListWidget11insertItemsEiRK11QStringList(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void); // proto: QListWidgetItem * QListWidget::currentItem(); fn C_ZNK11QListWidget11currentItemEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QListWidget::setCurrentItem(QListWidgetItem * item); fn C_ZN11QListWidget14setCurrentItemEP15QListWidgetItem(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QListWidget::setItemWidget(QListWidgetItem * item, QWidget * widget); fn C_ZN11QListWidget13setItemWidgetEP15QListWidgetItemP7QWidget(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void); // proto: bool QListWidget::isItemSelected(const QListWidgetItem * item); fn C_ZNK11QListWidget14isItemSelectedEPK15QListWidgetItem(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_char; fn QListWidget_SlotProxy_connect__ZN11QListWidget17itemDoubleClickedEP15QListWidgetItem(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QListWidget_SlotProxy_connect__ZN11QListWidget11itemEnteredEP15QListWidgetItem(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QListWidget_SlotProxy_connect__ZN11QListWidget11itemClickedEP15QListWidgetItem(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QListWidget_SlotProxy_connect__ZN11QListWidget18currentItemChangedEP15QListWidgetItemS1_(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QListWidget_SlotProxy_connect__ZN11QListWidget18currentTextChangedERK7QString(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QListWidget_SlotProxy_connect__ZN11QListWidget11itemChangedEP15QListWidgetItem(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QListWidget_SlotProxy_connect__ZN11QListWidget20itemSelectionChangedEv(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QListWidget_SlotProxy_connect__ZN11QListWidget11itemPressedEP15QListWidgetItem(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QListWidget_SlotProxy_connect__ZN11QListWidget13itemActivatedEP15QListWidgetItem(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QListWidget_SlotProxy_connect__ZN11QListWidget17currentRowChangedEi(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); } // <= ext block end // body block begin => // class sizeof(QListWidgetItem)=1 #[derive(Default)] pub struct QListWidgetItem { // qbase: None, pub qclsinst: u64 /* *mut c_void*/, } // class sizeof(QListWidget)=1 #[derive(Default)] pub struct QListWidget { qbase: QListView, pub qclsinst: u64 /* *mut c_void*/, pub _itemDoubleClicked: QListWidget_itemDoubleClicked_signal, pub _itemClicked: QListWidget_itemClicked_signal, pub _currentItemChanged: QListWidget_currentItemChanged_signal, pub _itemEntered: QListWidget_itemEntered_signal, pub _itemPressed: QListWidget_itemPressed_signal, pub _itemSelectionChanged: QListWidget_itemSelectionChanged_signal, pub _itemActivated: QListWidget_itemActivated_signal, pub _itemChanged: QListWidget_itemChanged_signal, pub _currentRowChanged: QListWidget_currentRowChanged_signal, pub _currentTextChanged: QListWidget_currentTextChanged_signal, } impl /*struct*/ QListWidgetItem { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QListWidgetItem { return QListWidgetItem{qclsinst: qthis, ..Default::default()}; } } // proto: void QListWidgetItem::~QListWidgetItem(); impl /*struct*/ QListWidgetItem { pub fn free<RetType, T: QListWidgetItem_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QListWidgetItem_free<RetType> { fn free(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::~QListWidgetItem(); impl<'a> /*trait*/ QListWidgetItem_free<()> for () { fn free(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItemD2Ev()}; unsafe {C_ZN15QListWidgetItemD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: bool QListWidgetItem::isHidden(); impl /*struct*/ QListWidgetItem { pub fn isHidden<RetType, T: QListWidgetItem_isHidden<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isHidden(self); // return 1; } } pub trait QListWidgetItem_isHidden<RetType> { fn isHidden(self , rsthis: & QListWidgetItem) -> RetType; } // proto: bool QListWidgetItem::isHidden(); impl<'a> /*trait*/ QListWidgetItem_isHidden<i8> for () { fn isHidden(self , rsthis: & QListWidgetItem) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem8isHiddenEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem8isHiddenEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QListWidgetItem::setData(int role, const QVariant & value); impl /*struct*/ QListWidgetItem { pub fn setData<RetType, T: QListWidgetItem_setData<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setData(self); // return 1; } } pub trait QListWidgetItem_setData<RetType> { fn setData(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::setData(int role, const QVariant & value); impl<'a> /*trait*/ QListWidgetItem_setData<()> for (i32, &'a QVariant) { fn setData(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItem7setDataEiRK8QVariant()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; unsafe {C_ZN15QListWidgetItem7setDataEiRK8QVariant(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: void QListWidgetItem::setBackground(const QBrush & brush); impl /*struct*/ QListWidgetItem { pub fn setBackground<RetType, T: QListWidgetItem_setBackground<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setBackground(self); // return 1; } } pub trait QListWidgetItem_setBackground<RetType> { fn setBackground(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::setBackground(const QBrush & brush); impl<'a> /*trait*/ QListWidgetItem_setBackground<()> for (&'a QBrush) { fn setBackground(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItem13setBackgroundERK6QBrush()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN15QListWidgetItem13setBackgroundERK6QBrush(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QListWidgetItem::setSelected(bool select); impl /*struct*/ QListWidgetItem { pub fn setSelected<RetType, T: QListWidgetItem_setSelected<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setSelected(self); // return 1; } } pub trait QListWidgetItem_setSelected<RetType> { fn setSelected(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::setSelected(bool select); impl<'a> /*trait*/ QListWidgetItem_setSelected<()> for (i8) { fn setSelected(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItem11setSelectedEb()}; let arg0 = self as c_char; unsafe {C_ZN15QListWidgetItem11setSelectedEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QFont QListWidgetItem::font(); impl /*struct*/ QListWidgetItem { pub fn font<RetType, T: QListWidgetItem_font<RetType>>(& self, overload_args: T) -> RetType { return overload_args.font(self); // return 1; } } pub trait QListWidgetItem_font<RetType> { fn font(self , rsthis: & QListWidgetItem) -> RetType; } // proto: QFont QListWidgetItem::font(); impl<'a> /*trait*/ QListWidgetItem_font<QFont> for () { fn font(self , rsthis: & QListWidgetItem) -> QFont { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem4fontEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem4fontEv(rsthis.qclsinst)}; let mut ret1 = QFont::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QListWidgetItem::setTextAlignment(int alignment); impl /*struct*/ QListWidgetItem { pub fn setTextAlignment<RetType, T: QListWidgetItem_setTextAlignment<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setTextAlignment(self); // return 1; } } pub trait QListWidgetItem_setTextAlignment<RetType> { fn setTextAlignment(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::setTextAlignment(int alignment); impl<'a> /*trait*/ QListWidgetItem_setTextAlignment<()> for (i32) { fn setTextAlignment(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItem16setTextAlignmentEi()}; let arg0 = self as c_int; unsafe {C_ZN15QListWidgetItem16setTextAlignmentEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QListWidgetItem::QListWidgetItem(QListWidget * view, int type); impl /*struct*/ QListWidgetItem { pub fn new<T: QListWidgetItem_new>(value: T) -> QListWidgetItem { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QListWidgetItem_new { fn new(self) -> QListWidgetItem; } // proto: void QListWidgetItem::QListWidgetItem(QListWidget * view, int type); impl<'a> /*trait*/ QListWidgetItem_new for (Option<&'a QListWidget>, Option<i32>) { fn new(self) -> QListWidgetItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItemC2EP11QListWidgeti()}; let ctysz: c_int = unsafe{QListWidgetItem_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = (if self.0.is_none() {0} else {self.0.unwrap().qclsinst}) as *mut c_void; let arg1 = (if self.1.is_none() {0 as i32} else {self.1.unwrap()}) as c_int; let qthis: u64 = unsafe {C_ZN15QListWidgetItemC2EP11QListWidgeti(arg0, arg1)}; let rsthis = QListWidgetItem{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QListWidgetItem::write(QDataStream & out); impl /*struct*/ QListWidgetItem { pub fn write<RetType, T: QListWidgetItem_write<RetType>>(& self, overload_args: T) -> RetType { return overload_args.write(self); // return 1; } } pub trait QListWidgetItem_write<RetType> { fn write(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::write(QDataStream & out); impl<'a> /*trait*/ QListWidgetItem_write<()> for (&'a QDataStream) { fn write(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem5writeER11QDataStream()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZNK15QListWidgetItem5writeER11QDataStream(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QString QListWidgetItem::whatsThis(); impl /*struct*/ QListWidgetItem { pub fn whatsThis<RetType, T: QListWidgetItem_whatsThis<RetType>>(& self, overload_args: T) -> RetType { return overload_args.whatsThis(self); // return 1; } } pub trait QListWidgetItem_whatsThis<RetType> { fn whatsThis(self , rsthis: & QListWidgetItem) -> RetType; } // proto: QString QListWidgetItem::whatsThis(); impl<'a> /*trait*/ QListWidgetItem_whatsThis<QString> for () { fn whatsThis(self , rsthis: & QListWidgetItem) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem9whatsThisEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem9whatsThisEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QListWidgetItem::type(); impl /*struct*/ QListWidgetItem { pub fn type_<RetType, T: QListWidgetItem_type_<RetType>>(& self, overload_args: T) -> RetType { return overload_args.type_(self); // return 1; } } pub trait QListWidgetItem_type_<RetType> { fn type_(self , rsthis: & QListWidgetItem) -> RetType; } // proto: int QListWidgetItem::type(); impl<'a> /*trait*/ QListWidgetItem_type_<i32> for () { fn type_(self , rsthis: & QListWidgetItem) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem4typeEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem4typeEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QListWidgetItem::QListWidgetItem(const QIcon & icon, const QString & text, QListWidget * view, int type); impl<'a> /*trait*/ QListWidgetItem_new for (&'a QIcon, &'a QString, Option<&'a QListWidget>, Option<i32>) { fn new(self) -> QListWidgetItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItemC2ERK5QIconRK7QStringP11QListWidgeti()}; let ctysz: c_int = unsafe{QListWidgetItem_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let arg2 = (if self.2.is_none() {0} else {self.2.unwrap().qclsinst}) as *mut c_void; let arg3 = (if self.3.is_none() {0 as i32} else {self.3.unwrap()}) as c_int; let qthis: u64 = unsafe {C_ZN15QListWidgetItemC2ERK5QIconRK7QStringP11QListWidgeti(arg0, arg1, arg2, arg3)}; let rsthis = QListWidgetItem{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: QIcon QListWidgetItem::icon(); impl /*struct*/ QListWidgetItem { pub fn icon<RetType, T: QListWidgetItem_icon<RetType>>(& self, overload_args: T) -> RetType { return overload_args.icon(self); // return 1; } } pub trait QListWidgetItem_icon<RetType> { fn icon(self , rsthis: & QListWidgetItem) -> RetType; } // proto: QIcon QListWidgetItem::icon(); impl<'a> /*trait*/ QListWidgetItem_icon<QIcon> for () { fn icon(self , rsthis: & QListWidgetItem) -> QIcon { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem4iconEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem4iconEv(rsthis.qclsinst)}; let mut ret1 = QIcon::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QColor QListWidgetItem::textColor(); impl /*struct*/ QListWidgetItem { pub fn textColor<RetType, T: QListWidgetItem_textColor<RetType>>(& self, overload_args: T) -> RetType { return overload_args.textColor(self); // return 1; } } pub trait QListWidgetItem_textColor<RetType> { fn textColor(self , rsthis: & QListWidgetItem) -> RetType; } // proto: QColor QListWidgetItem::textColor(); impl<'a> /*trait*/ QListWidgetItem_textColor<QColor> for () { fn textColor(self , rsthis: & QListWidgetItem) -> QColor { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem9textColorEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem9textColorEv(rsthis.qclsinst)}; let mut ret1 = QColor::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QBrush QListWidgetItem::foreground(); impl /*struct*/ QListWidgetItem { pub fn foreground<RetType, T: QListWidgetItem_foreground<RetType>>(& self, overload_args: T) -> RetType { return overload_args.foreground(self); // return 1; } } pub trait QListWidgetItem_foreground<RetType> { fn foreground(self , rsthis: & QListWidgetItem) -> RetType; } // proto: QBrush QListWidgetItem::foreground(); impl<'a> /*trait*/ QListWidgetItem_foreground<QBrush> for () { fn foreground(self , rsthis: & QListWidgetItem) -> QBrush { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem10foregroundEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem10foregroundEv(rsthis.qclsinst)}; let mut ret1 = QBrush::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QBrush QListWidgetItem::background(); impl /*struct*/ QListWidgetItem { pub fn background<RetType, T: QListWidgetItem_background<RetType>>(& self, overload_args: T) -> RetType { return overload_args.background(self); // return 1; } } pub trait QListWidgetItem_background<RetType> { fn background(self , rsthis: & QListWidgetItem) -> RetType; } // proto: QBrush QListWidgetItem::background(); impl<'a> /*trait*/ QListWidgetItem_background<QBrush> for () { fn background(self , rsthis: & QListWidgetItem) -> QBrush { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem10backgroundEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem10backgroundEv(rsthis.qclsinst)}; let mut ret1 = QBrush::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QListWidgetItem::setStatusTip(const QString & statusTip); impl /*struct*/ QListWidgetItem { pub fn setStatusTip<RetType, T: QListWidgetItem_setStatusTip<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setStatusTip(self); // return 1; } } pub trait QListWidgetItem_setStatusTip<RetType> { fn setStatusTip(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::setStatusTip(const QString & statusTip); impl<'a> /*trait*/ QListWidgetItem_setStatusTip<()> for (&'a QString) { fn setStatusTip(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItem12setStatusTipERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN15QListWidgetItem12setStatusTipERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QString QListWidgetItem::text(); impl /*struct*/ QListWidgetItem { pub fn text<RetType, T: QListWidgetItem_text<RetType>>(& self, overload_args: T) -> RetType { return overload_args.text(self); // return 1; } } pub trait QListWidgetItem_text<RetType> { fn text(self , rsthis: & QListWidgetItem) -> RetType; } // proto: QString QListWidgetItem::text(); impl<'a> /*trait*/ QListWidgetItem_text<QString> for () { fn text(self , rsthis: & QListWidgetItem) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem4textEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem4textEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QColor QListWidgetItem::backgroundColor(); impl /*struct*/ QListWidgetItem { pub fn backgroundColor<RetType, T: QListWidgetItem_backgroundColor<RetType>>(& self, overload_args: T) -> RetType { return overload_args.backgroundColor(self); // return 1; } } pub trait QListWidgetItem_backgroundColor<RetType> { fn backgroundColor(self , rsthis: & QListWidgetItem) -> RetType; } // proto: QColor QListWidgetItem::backgroundColor(); impl<'a> /*trait*/ QListWidgetItem_backgroundColor<QColor> for () { fn backgroundColor(self , rsthis: & QListWidgetItem) -> QColor { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem15backgroundColorEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem15backgroundColorEv(rsthis.qclsinst)}; let mut ret1 = QColor::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QListWidgetItem::isSelected(); impl /*struct*/ QListWidgetItem { pub fn isSelected<RetType, T: QListWidgetItem_isSelected<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isSelected(self); // return 1; } } pub trait QListWidgetItem_isSelected<RetType> { fn isSelected(self , rsthis: & QListWidgetItem) -> RetType; } // proto: bool QListWidgetItem::isSelected(); impl<'a> /*trait*/ QListWidgetItem_isSelected<i8> for () { fn isSelected(self , rsthis: & QListWidgetItem) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem10isSelectedEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem10isSelectedEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QListWidgetItem::setFont(const QFont & font); impl /*struct*/ QListWidgetItem { pub fn setFont<RetType, T: QListWidgetItem_setFont<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setFont(self); // return 1; } } pub trait QListWidgetItem_setFont<RetType> { fn setFont(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::setFont(const QFont & font); impl<'a> /*trait*/ QListWidgetItem_setFont<()> for (&'a QFont) { fn setFont(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItem7setFontERK5QFont()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN15QListWidgetItem7setFontERK5QFont(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QListWidgetItem::setText(const QString & text); impl /*struct*/ QListWidgetItem { pub fn setText<RetType, T: QListWidgetItem_setText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setText(self); // return 1; } } pub trait QListWidgetItem_setText<RetType> { fn setText(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::setText(const QString & text); impl<'a> /*trait*/ QListWidgetItem_setText<()> for (&'a QString) { fn setText(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItem7setTextERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN15QListWidgetItem7setTextERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QListWidgetItem::QListWidgetItem(const QString & text, QListWidget * view, int type); impl<'a> /*trait*/ QListWidgetItem_new for (&'a QString, Option<&'a QListWidget>, Option<i32>) { fn new(self) -> QListWidgetItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItemC2ERK7QStringP11QListWidgeti()}; let ctysz: c_int = unsafe{QListWidgetItem_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap().qclsinst}) as *mut c_void; let arg2 = (if self.2.is_none() {0 as i32} else {self.2.unwrap()}) as c_int; let qthis: u64 = unsafe {C_ZN15QListWidgetItemC2ERK7QStringP11QListWidgeti(arg0, arg1, arg2)}; let rsthis = QListWidgetItem{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: QVariant QListWidgetItem::data(int role); impl /*struct*/ QListWidgetItem { pub fn data<RetType, T: QListWidgetItem_data<RetType>>(& self, overload_args: T) -> RetType { return overload_args.data(self); // return 1; } } pub trait QListWidgetItem_data<RetType> { fn data(self , rsthis: & QListWidgetItem) -> RetType; } // proto: QVariant QListWidgetItem::data(int role); impl<'a> /*trait*/ QListWidgetItem_data<QVariant> for (i32) { fn data(self , rsthis: & QListWidgetItem) -> QVariant { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem4dataEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK15QListWidgetItem4dataEi(rsthis.qclsinst, arg0)}; let mut ret1 = QVariant::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QSize QListWidgetItem::sizeHint(); impl /*struct*/ QListWidgetItem { pub fn sizeHint<RetType, T: QListWidgetItem_sizeHint<RetType>>(& self, overload_args: T) -> RetType { return overload_args.sizeHint(self); // return 1; } } pub trait QListWidgetItem_sizeHint<RetType> { fn sizeHint(self , rsthis: & QListWidgetItem) -> RetType; } // proto: QSize QListWidgetItem::sizeHint(); impl<'a> /*trait*/ QListWidgetItem_sizeHint<QSize> for () { fn sizeHint(self , rsthis: & QListWidgetItem) -> QSize { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem8sizeHintEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem8sizeHintEv(rsthis.qclsinst)}; let mut ret1 = QSize::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QListWidgetItem::setWhatsThis(const QString & whatsThis); impl /*struct*/ QListWidgetItem { pub fn setWhatsThis<RetType, T: QListWidgetItem_setWhatsThis<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setWhatsThis(self); // return 1; } } pub trait QListWidgetItem_setWhatsThis<RetType> { fn setWhatsThis(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::setWhatsThis(const QString & whatsThis); impl<'a> /*trait*/ QListWidgetItem_setWhatsThis<()> for (&'a QString) { fn setWhatsThis(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItem12setWhatsThisERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN15QListWidgetItem12setWhatsThisERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QListWidgetItem::read(QDataStream & in); impl /*struct*/ QListWidgetItem { pub fn read<RetType, T: QListWidgetItem_read<RetType>>(& self, overload_args: T) -> RetType { return overload_args.read(self); // return 1; } } pub trait QListWidgetItem_read<RetType> { fn read(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::read(QDataStream & in); impl<'a> /*trait*/ QListWidgetItem_read<()> for (&'a QDataStream) { fn read(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItem4readER11QDataStream()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN15QListWidgetItem4readER11QDataStream(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QListWidgetItem::setTextColor(const QColor & color); impl /*struct*/ QListWidgetItem { pub fn setTextColor<RetType, T: QListWidgetItem_setTextColor<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setTextColor(self); // return 1; } } pub trait QListWidgetItem_setTextColor<RetType> { fn setTextColor(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::setTextColor(const QColor & color); impl<'a> /*trait*/ QListWidgetItem_setTextColor<()> for (&'a QColor) { fn setTextColor(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItem12setTextColorERK6QColor()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN15QListWidgetItem12setTextColorERK6QColor(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QListWidgetItem::setSizeHint(const QSize & size); impl /*struct*/ QListWidgetItem { pub fn setSizeHint<RetType, T: QListWidgetItem_setSizeHint<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setSizeHint(self); // return 1; } } pub trait QListWidgetItem_setSizeHint<RetType> { fn setSizeHint(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::setSizeHint(const QSize & size); impl<'a> /*trait*/ QListWidgetItem_setSizeHint<()> for (&'a QSize) { fn setSizeHint(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItem11setSizeHintERK5QSize()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN15QListWidgetItem11setSizeHintERK5QSize(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QListWidget * QListWidgetItem::listWidget(); impl /*struct*/ QListWidgetItem { pub fn listWidget<RetType, T: QListWidgetItem_listWidget<RetType>>(& self, overload_args: T) -> RetType { return overload_args.listWidget(self); // return 1; } } pub trait QListWidgetItem_listWidget<RetType> { fn listWidget(self , rsthis: & QListWidgetItem) -> RetType; } // proto: QListWidget * QListWidgetItem::listWidget(); impl<'a> /*trait*/ QListWidgetItem_listWidget<QListWidget> for () { fn listWidget(self , rsthis: & QListWidgetItem) -> QListWidget { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem10listWidgetEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem10listWidgetEv(rsthis.qclsinst)}; let mut ret1 = QListWidget::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QListWidgetItem::setIcon(const QIcon & icon); impl /*struct*/ QListWidgetItem { pub fn setIcon<RetType, T: QListWidgetItem_setIcon<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setIcon(self); // return 1; } } pub trait QListWidgetItem_setIcon<RetType> { fn setIcon(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::setIcon(const QIcon & icon); impl<'a> /*trait*/ QListWidgetItem_setIcon<()> for (&'a QIcon) { fn setIcon(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItem7setIconERK5QIcon()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN15QListWidgetItem7setIconERK5QIcon(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QListWidgetItem * QListWidgetItem::clone(); impl /*struct*/ QListWidgetItem { pub fn clone<RetType, T: QListWidgetItem_clone<RetType>>(& self, overload_args: T) -> RetType { return overload_args.clone(self); // return 1; } } pub trait QListWidgetItem_clone<RetType> { fn clone(self , rsthis: & QListWidgetItem) -> RetType; } // proto: QListWidgetItem * QListWidgetItem::clone(); impl<'a> /*trait*/ QListWidgetItem_clone<QListWidgetItem> for () { fn clone(self , rsthis: & QListWidgetItem) -> QListWidgetItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem5cloneEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem5cloneEv(rsthis.qclsinst)}; let mut ret1 = QListWidgetItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QListWidgetItem::setBackgroundColor(const QColor & color); impl /*struct*/ QListWidgetItem { pub fn setBackgroundColor<RetType, T: QListWidgetItem_setBackgroundColor<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setBackgroundColor(self); // return 1; } } pub trait QListWidgetItem_setBackgroundColor<RetType> { fn setBackgroundColor(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::setBackgroundColor(const QColor & color); impl<'a> /*trait*/ QListWidgetItem_setBackgroundColor<()> for (&'a QColor) { fn setBackgroundColor(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItem18setBackgroundColorERK6QColor()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN15QListWidgetItem18setBackgroundColorERK6QColor(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QListWidgetItem::setForeground(const QBrush & brush); impl /*struct*/ QListWidgetItem { pub fn setForeground<RetType, T: QListWidgetItem_setForeground<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setForeground(self); // return 1; } } pub trait QListWidgetItem_setForeground<RetType> { fn setForeground(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::setForeground(const QBrush & brush); impl<'a> /*trait*/ QListWidgetItem_setForeground<()> for (&'a QBrush) { fn setForeground(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItem13setForegroundERK6QBrush()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN15QListWidgetItem13setForegroundERK6QBrush(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QListWidgetItem::QListWidgetItem(const QListWidgetItem & other); impl<'a> /*trait*/ QListWidgetItem_new for (&'a QListWidgetItem) { fn new(self) -> QListWidgetItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItemC2ERKS_()}; let ctysz: c_int = unsafe{QListWidgetItem_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_ZN15QListWidgetItemC2ERKS_(arg0)}; let rsthis = QListWidgetItem{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QListWidgetItem::setHidden(bool hide); impl /*struct*/ QListWidgetItem { pub fn setHidden<RetType, T: QListWidgetItem_setHidden<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setHidden(self); // return 1; } } pub trait QListWidgetItem_setHidden<RetType> { fn setHidden(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::setHidden(bool hide); impl<'a> /*trait*/ QListWidgetItem_setHidden<()> for (i8) { fn setHidden(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItem9setHiddenEb()}; let arg0 = self as c_char; unsafe {C_ZN15QListWidgetItem9setHiddenEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QString QListWidgetItem::toolTip(); impl /*struct*/ QListWidgetItem { pub fn toolTip<RetType, T: QListWidgetItem_toolTip<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toolTip(self); // return 1; } } pub trait QListWidgetItem_toolTip<RetType> { fn toolTip(self , rsthis: & QListWidgetItem) -> RetType; } // proto: QString QListWidgetItem::toolTip(); impl<'a> /*trait*/ QListWidgetItem_toolTip<QString> for () { fn toolTip(self , rsthis: & QListWidgetItem) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem7toolTipEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem7toolTipEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QListWidgetItem::textAlignment(); impl /*struct*/ QListWidgetItem { pub fn textAlignment<RetType, T: QListWidgetItem_textAlignment<RetType>>(& self, overload_args: T) -> RetType { return overload_args.textAlignment(self); // return 1; } } pub trait QListWidgetItem_textAlignment<RetType> { fn textAlignment(self , rsthis: & QListWidgetItem) -> RetType; } // proto: int QListWidgetItem::textAlignment(); impl<'a> /*trait*/ QListWidgetItem_textAlignment<i32> for () { fn textAlignment(self , rsthis: & QListWidgetItem) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem13textAlignmentEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem13textAlignmentEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: QString QListWidgetItem::statusTip(); impl /*struct*/ QListWidgetItem { pub fn statusTip<RetType, T: QListWidgetItem_statusTip<RetType>>(& self, overload_args: T) -> RetType { return overload_args.statusTip(self); // return 1; } } pub trait QListWidgetItem_statusTip<RetType> { fn statusTip(self , rsthis: & QListWidgetItem) -> RetType; } // proto: QString QListWidgetItem::statusTip(); impl<'a> /*trait*/ QListWidgetItem_statusTip<QString> for () { fn statusTip(self , rsthis: & QListWidgetItem) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK15QListWidgetItem9statusTipEv()}; let mut ret = unsafe {C_ZNK15QListWidgetItem9statusTipEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QListWidgetItem::setToolTip(const QString & toolTip); impl /*struct*/ QListWidgetItem { pub fn setToolTip<RetType, T: QListWidgetItem_setToolTip<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setToolTip(self); // return 1; } } pub trait QListWidgetItem_setToolTip<RetType> { fn setToolTip(self , rsthis: & QListWidgetItem) -> RetType; } // proto: void QListWidgetItem::setToolTip(const QString & toolTip); impl<'a> /*trait*/ QListWidgetItem_setToolTip<()> for (&'a QString) { fn setToolTip(self , rsthis: & QListWidgetItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN15QListWidgetItem10setToolTipERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN15QListWidgetItem10setToolTipERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } impl /*struct*/ QListWidget { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QListWidget { return QListWidget{qbase: QListView::inheritFrom(qthis), qclsinst: qthis, ..Default::default()}; } } impl Deref for QListWidget { type Target = QListView; fn deref(&self) -> &QListView { return & self.qbase; } } impl AsRef<QListView> for QListWidget { fn as_ref(& self) -> & QListView { return & self.qbase; } } // proto: void QListWidget::dropEvent(QDropEvent * event); impl /*struct*/ QListWidget { pub fn dropEvent<RetType, T: QListWidget_dropEvent<RetType>>(& self, overload_args: T) -> RetType { return overload_args.dropEvent(self); // return 1; } } pub trait QListWidget_dropEvent<RetType> { fn dropEvent(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::dropEvent(QDropEvent * event); impl<'a> /*trait*/ QListWidget_dropEvent<()> for (&'a QDropEvent) { fn dropEvent(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget9dropEventEP10QDropEvent()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN11QListWidget9dropEventEP10QDropEvent(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QWidget * QListWidget::itemWidget(QListWidgetItem * item); impl /*struct*/ QListWidget { pub fn itemWidget<RetType, T: QListWidget_itemWidget<RetType>>(& self, overload_args: T) -> RetType { return overload_args.itemWidget(self); // return 1; } } pub trait QListWidget_itemWidget<RetType> { fn itemWidget(self , rsthis: & QListWidget) -> RetType; } // proto: QWidget * QListWidget::itemWidget(QListWidgetItem * item); impl<'a> /*trait*/ QListWidget_itemWidget<QWidget> for (&'a QListWidgetItem) { fn itemWidget(self , rsthis: & QListWidget) -> QWidget { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QListWidget10itemWidgetEP15QListWidgetItem()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK11QListWidget10itemWidgetEP15QListWidgetItem(rsthis.qclsinst, arg0)}; let mut ret1 = QWidget::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QListWidget::QListWidget(QWidget * parent); impl /*struct*/ QListWidget { pub fn new<T: QListWidget_new>(value: T) -> QListWidget { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QListWidget_new { fn new(self) -> QListWidget; } // proto: void QListWidget::QListWidget(QWidget * parent); impl<'a> /*trait*/ QListWidget_new for (Option<&'a QWidget>) { fn new(self) -> QListWidget { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidgetC2EP7QWidget()}; let ctysz: c_int = unsafe{QListWidget_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = (if self.is_none() {0} else {self.unwrap().qclsinst}) as *mut c_void; let qthis: u64 = unsafe {C_ZN11QListWidgetC2EP7QWidget(arg0)}; let rsthis = QListWidget{qbase: QListView::inheritFrom(qthis), qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: int QListWidget::currentRow(); impl /*struct*/ QListWidget { pub fn currentRow<RetType, T: QListWidget_currentRow<RetType>>(& self, overload_args: T) -> RetType { return overload_args.currentRow(self); // return 1; } } pub trait QListWidget_currentRow<RetType> { fn currentRow(self , rsthis: & QListWidget) -> RetType; } // proto: int QListWidget::currentRow(); impl<'a> /*trait*/ QListWidget_currentRow<i32> for () { fn currentRow(self , rsthis: & QListWidget) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QListWidget10currentRowEv()}; let mut ret = unsafe {C_ZNK11QListWidget10currentRowEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: QListWidgetItem * QListWidget::item(int row); impl /*struct*/ QListWidget { pub fn item<RetType, T: QListWidget_item<RetType>>(& self, overload_args: T) -> RetType { return overload_args.item(self); // return 1; } } pub trait QListWidget_item<RetType> { fn item(self , rsthis: & QListWidget) -> RetType; } // proto: QListWidgetItem * QListWidget::item(int row); impl<'a> /*trait*/ QListWidget_item<QListWidgetItem> for (i32) { fn item(self , rsthis: & QListWidget) -> QListWidgetItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QListWidget4itemEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK11QListWidget4itemEi(rsthis.qclsinst, arg0)}; let mut ret1 = QListWidgetItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QListWidgetItem * QListWidget::itemAt(const QPoint & p); impl /*struct*/ QListWidget { pub fn itemAt<RetType, T: QListWidget_itemAt<RetType>>(& self, overload_args: T) -> RetType { return overload_args.itemAt(self); // return 1; } } pub trait QListWidget_itemAt<RetType> { fn itemAt(self , rsthis: & QListWidget) -> RetType; } // proto: QListWidgetItem * QListWidget::itemAt(const QPoint & p); impl<'a> /*trait*/ QListWidget_itemAt<QListWidgetItem> for (&'a QPoint) { fn itemAt(self , rsthis: & QListWidget) -> QListWidgetItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QListWidget6itemAtERK6QPoint()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK11QListWidget6itemAtERK6QPoint(rsthis.qclsinst, arg0)}; let mut ret1 = QListWidgetItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QListWidget::insertItem(int row, const QString & label); impl /*struct*/ QListWidget { pub fn insertItem<RetType, T: QListWidget_insertItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.insertItem(self); // return 1; } } pub trait QListWidget_insertItem<RetType> { fn insertItem(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::insertItem(int row, const QString & label); impl<'a> /*trait*/ QListWidget_insertItem<()> for (i32, &'a QString) { fn insertItem(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget10insertItemEiRK7QString()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; unsafe {C_ZN11QListWidget10insertItemEiRK7QString(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: int QListWidget::row(const QListWidgetItem * item); impl /*struct*/ QListWidget { pub fn row<RetType, T: QListWidget_row<RetType>>(& self, overload_args: T) -> RetType { return overload_args.row(self); // return 1; } } pub trait QListWidget_row<RetType> { fn row(self , rsthis: & QListWidget) -> RetType; } // proto: int QListWidget::row(const QListWidgetItem * item); impl<'a> /*trait*/ QListWidget_row<i32> for (&'a QListWidgetItem) { fn row(self , rsthis: & QListWidget) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QListWidget3rowEPK15QListWidgetItem()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK11QListWidget3rowEPK15QListWidgetItem(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: void QListWidget::openPersistentEditor(QListWidgetItem * item); impl /*struct*/ QListWidget { pub fn openPersistentEditor<RetType, T: QListWidget_openPersistentEditor<RetType>>(& self, overload_args: T) -> RetType { return overload_args.openPersistentEditor(self); // return 1; } } pub trait QListWidget_openPersistentEditor<RetType> { fn openPersistentEditor(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::openPersistentEditor(QListWidgetItem * item); impl<'a> /*trait*/ QListWidget_openPersistentEditor<()> for (&'a QListWidgetItem) { fn openPersistentEditor(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget20openPersistentEditorEP15QListWidgetItem()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN11QListWidget20openPersistentEditorEP15QListWidgetItem(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QListWidget::clear(); impl /*struct*/ QListWidget { pub fn clear<RetType, T: QListWidget_clear<RetType>>(& self, overload_args: T) -> RetType { return overload_args.clear(self); // return 1; } } pub trait QListWidget_clear<RetType> { fn clear(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::clear(); impl<'a> /*trait*/ QListWidget_clear<()> for () { fn clear(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget5clearEv()}; unsafe {C_ZN11QListWidget5clearEv(rsthis.qclsinst)}; // return 1; } } // proto: void QListWidget::editItem(QListWidgetItem * item); impl /*struct*/ QListWidget { pub fn editItem<RetType, T: QListWidget_editItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.editItem(self); // return 1; } } pub trait QListWidget_editItem<RetType> { fn editItem(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::editItem(QListWidgetItem * item); impl<'a> /*trait*/ QListWidget_editItem<()> for (&'a QListWidgetItem) { fn editItem(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget8editItemEP15QListWidgetItem()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN11QListWidget8editItemEP15QListWidgetItem(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int QListWidget::count(); impl /*struct*/ QListWidget { pub fn count<RetType, T: QListWidget_count<RetType>>(& self, overload_args: T) -> RetType { return overload_args.count(self); // return 1; } } pub trait QListWidget_count<RetType> { fn count(self , rsthis: & QListWidget) -> RetType; } // proto: int QListWidget::count(); impl<'a> /*trait*/ QListWidget_count<i32> for () { fn count(self , rsthis: & QListWidget) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QListWidget5countEv()}; let mut ret = unsafe {C_ZNK11QListWidget5countEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QListWidget::setItemHidden(const QListWidgetItem * item, bool hide); impl /*struct*/ QListWidget { pub fn setItemHidden<RetType, T: QListWidget_setItemHidden<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setItemHidden(self); // return 1; } } pub trait QListWidget_setItemHidden<RetType> { fn setItemHidden(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::setItemHidden(const QListWidgetItem * item, bool hide); impl<'a> /*trait*/ QListWidget_setItemHidden<()> for (&'a QListWidgetItem, i8) { fn setItemHidden(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget13setItemHiddenEPK15QListWidgetItemb()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1 as c_char; unsafe {C_ZN11QListWidget13setItemHiddenEPK15QListWidgetItemb(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: void QListWidget::~QListWidget(); impl /*struct*/ QListWidget { pub fn free<RetType, T: QListWidget_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QListWidget_free<RetType> { fn free(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::~QListWidget(); impl<'a> /*trait*/ QListWidget_free<()> for () { fn free(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidgetD2Ev()}; unsafe {C_ZN11QListWidgetD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: void QListWidget::addItem(QListWidgetItem * item); impl /*struct*/ QListWidget { pub fn addItem<RetType, T: QListWidget_addItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.addItem(self); // return 1; } } pub trait QListWidget_addItem<RetType> { fn addItem(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::addItem(QListWidgetItem * item); impl<'a> /*trait*/ QListWidget_addItem<()> for (&'a QListWidgetItem) { fn addItem(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget7addItemEP15QListWidgetItem()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN11QListWidget7addItemEP15QListWidgetItem(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QListWidgetItem * QListWidget::takeItem(int row); impl /*struct*/ QListWidget { pub fn takeItem<RetType, T: QListWidget_takeItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.takeItem(self); // return 1; } } pub trait QListWidget_takeItem<RetType> { fn takeItem(self , rsthis: & QListWidget) -> RetType; } // proto: QListWidgetItem * QListWidget::takeItem(int row); impl<'a> /*trait*/ QListWidget_takeItem<QListWidgetItem> for (i32) { fn takeItem(self , rsthis: & QListWidget) -> QListWidgetItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget8takeItemEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZN11QListWidget8takeItemEi(rsthis.qclsinst, arg0)}; let mut ret1 = QListWidgetItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QListWidget::isSortingEnabled(); impl /*struct*/ QListWidget { pub fn isSortingEnabled<RetType, T: QListWidget_isSortingEnabled<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isSortingEnabled(self); // return 1; } } pub trait QListWidget_isSortingEnabled<RetType> { fn isSortingEnabled(self , rsthis: & QListWidget) -> RetType; } // proto: bool QListWidget::isSortingEnabled(); impl<'a> /*trait*/ QListWidget_isSortingEnabled<i8> for () { fn isSortingEnabled(self , rsthis: & QListWidget) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QListWidget16isSortingEnabledEv()}; let mut ret = unsafe {C_ZNK11QListWidget16isSortingEnabledEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QListWidget::addItems(const QStringList & labels); impl /*struct*/ QListWidget { pub fn addItems<RetType, T: QListWidget_addItems<RetType>>(& self, overload_args: T) -> RetType { return overload_args.addItems(self); // return 1; } } pub trait QListWidget_addItems<RetType> { fn addItems(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::addItems(const QStringList & labels); impl<'a> /*trait*/ QListWidget_addItems<()> for (&'a QStringList) { fn addItems(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget8addItemsERK11QStringList()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN11QListWidget8addItemsERK11QStringList(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QList<QListWidgetItem *> QListWidget::selectedItems(); impl /*struct*/ QListWidget { pub fn selectedItems<RetType, T: QListWidget_selectedItems<RetType>>(& self, overload_args: T) -> RetType { return overload_args.selectedItems(self); // return 1; } } pub trait QListWidget_selectedItems<RetType> { fn selectedItems(self , rsthis: & QListWidget) -> RetType; } // proto: QList<QListWidgetItem *> QListWidget::selectedItems(); impl<'a> /*trait*/ QListWidget_selectedItems<u64> for () { fn selectedItems(self , rsthis: & QListWidget) -> u64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QListWidget13selectedItemsEv()}; let mut ret = unsafe {C_ZNK11QListWidget13selectedItemsEv(rsthis.qclsinst)}; return ret as u64; // 5 // return 1; } } // proto: const QMetaObject * QListWidget::metaObject(); impl /*struct*/ QListWidget { pub fn metaObject<RetType, T: QListWidget_metaObject<RetType>>(& self, overload_args: T) -> RetType { return overload_args.metaObject(self); // return 1; } } pub trait QListWidget_metaObject<RetType> { fn metaObject(self , rsthis: & QListWidget) -> RetType; } // proto: const QMetaObject * QListWidget::metaObject(); impl<'a> /*trait*/ QListWidget_metaObject<QMetaObject> for () { fn metaObject(self , rsthis: & QListWidget) -> QMetaObject { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QListWidget10metaObjectEv()}; let mut ret = unsafe {C_ZNK11QListWidget10metaObjectEv(rsthis.qclsinst)}; let mut ret1 = QMetaObject::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QListWidget::setItemSelected(const QListWidgetItem * item, bool select); impl /*struct*/ QListWidget { pub fn setItemSelected<RetType, T: QListWidget_setItemSelected<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setItemSelected(self); // return 1; } } pub trait QListWidget_setItemSelected<RetType> { fn setItemSelected(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::setItemSelected(const QListWidgetItem * item, bool select); impl<'a> /*trait*/ QListWidget_setItemSelected<()> for (&'a QListWidgetItem, i8) { fn setItemSelected(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget15setItemSelectedEPK15QListWidgetItemb()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1 as c_char; unsafe {C_ZN11QListWidget15setItemSelectedEPK15QListWidgetItemb(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: void QListWidget::insertItem(int row, QListWidgetItem * item); impl<'a> /*trait*/ QListWidget_insertItem<()> for (i32, &'a QListWidgetItem) { fn insertItem(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget10insertItemEiP15QListWidgetItem()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; unsafe {C_ZN11QListWidget10insertItemEiP15QListWidgetItem(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: void QListWidget::setCurrentRow(int row); impl /*struct*/ QListWidget { pub fn setCurrentRow<RetType, T: QListWidget_setCurrentRow<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setCurrentRow(self); // return 1; } } pub trait QListWidget_setCurrentRow<RetType> { fn setCurrentRow(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::setCurrentRow(int row); impl<'a> /*trait*/ QListWidget_setCurrentRow<()> for (i32) { fn setCurrentRow(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget13setCurrentRowEi()}; let arg0 = self as c_int; unsafe {C_ZN11QListWidget13setCurrentRowEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QListWidget::setSortingEnabled(bool enable); impl /*struct*/ QListWidget { pub fn setSortingEnabled<RetType, T: QListWidget_setSortingEnabled<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setSortingEnabled(self); // return 1; } } pub trait QListWidget_setSortingEnabled<RetType> { fn setSortingEnabled(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::setSortingEnabled(bool enable); impl<'a> /*trait*/ QListWidget_setSortingEnabled<()> for (i8) { fn setSortingEnabled(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget17setSortingEnabledEb()}; let arg0 = self as c_char; unsafe {C_ZN11QListWidget17setSortingEnabledEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QRect QListWidget::visualItemRect(const QListWidgetItem * item); impl /*struct*/ QListWidget { pub fn visualItemRect<RetType, T: QListWidget_visualItemRect<RetType>>(& self, overload_args: T) -> RetType { return overload_args.visualItemRect(self); // return 1; } } pub trait QListWidget_visualItemRect<RetType> { fn visualItemRect(self , rsthis: & QListWidget) -> RetType; } // proto: QRect QListWidget::visualItemRect(const QListWidgetItem * item); impl<'a> /*trait*/ QListWidget_visualItemRect<QRect> for (&'a QListWidgetItem) { fn visualItemRect(self , rsthis: & QListWidget) -> QRect { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QListWidget14visualItemRectEPK15QListWidgetItem()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK11QListWidget14visualItemRectEPK15QListWidgetItem(rsthis.qclsinst, arg0)}; let mut ret1 = QRect::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QListWidget::removeItemWidget(QListWidgetItem * item); impl /*struct*/ QListWidget { pub fn removeItemWidget<RetType, T: QListWidget_removeItemWidget<RetType>>(& self, overload_args: T) -> RetType { return overload_args.removeItemWidget(self); // return 1; } } pub trait QListWidget_removeItemWidget<RetType> { fn removeItemWidget(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::removeItemWidget(QListWidgetItem * item); impl<'a> /*trait*/ QListWidget_removeItemWidget<()> for (&'a QListWidgetItem) { fn removeItemWidget(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget16removeItemWidgetEP15QListWidgetItem()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN11QListWidget16removeItemWidgetEP15QListWidgetItem(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QListWidget::closePersistentEditor(QListWidgetItem * item); impl /*struct*/ QListWidget { pub fn closePersistentEditor<RetType, T: QListWidget_closePersistentEditor<RetType>>(& self, overload_args: T) -> RetType { return overload_args.closePersistentEditor(self); // return 1; } } pub trait QListWidget_closePersistentEditor<RetType> { fn closePersistentEditor(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::closePersistentEditor(QListWidgetItem * item); impl<'a> /*trait*/ QListWidget_closePersistentEditor<()> for (&'a QListWidgetItem) { fn closePersistentEditor(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget21closePersistentEditorEP15QListWidgetItem()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN11QListWidget21closePersistentEditorEP15QListWidgetItem(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QListWidget::isItemHidden(const QListWidgetItem * item); impl /*struct*/ QListWidget { pub fn isItemHidden<RetType, T: QListWidget_isItemHidden<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isItemHidden(self); // return 1; } } pub trait QListWidget_isItemHidden<RetType> { fn isItemHidden(self , rsthis: & QListWidget) -> RetType; } // proto: bool QListWidget::isItemHidden(const QListWidgetItem * item); impl<'a> /*trait*/ QListWidget_isItemHidden<i8> for (&'a QListWidgetItem) { fn isItemHidden(self , rsthis: & QListWidget) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QListWidget12isItemHiddenEPK15QListWidgetItem()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK11QListWidget12isItemHiddenEPK15QListWidgetItem(rsthis.qclsinst, arg0)}; return ret as i8; // 1 // return 1; } } // proto: QListWidgetItem * QListWidget::itemAt(int x, int y); impl<'a> /*trait*/ QListWidget_itemAt<QListWidgetItem> for (i32, i32) { fn itemAt(self , rsthis: & QListWidget) -> QListWidgetItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QListWidget6itemAtEii()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let mut ret = unsafe {C_ZNK11QListWidget6itemAtEii(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QListWidgetItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QListWidget::addItem(const QString & label); impl<'a> /*trait*/ QListWidget_addItem<()> for (&'a QString) { fn addItem(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget7addItemERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN11QListWidget7addItemERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QListWidget::insertItems(int row, const QStringList & labels); impl /*struct*/ QListWidget { pub fn insertItems<RetType, T: QListWidget_insertItems<RetType>>(& self, overload_args: T) -> RetType { return overload_args.insertItems(self); // return 1; } } pub trait QListWidget_insertItems<RetType> { fn insertItems(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::insertItems(int row, const QStringList & labels); impl<'a> /*trait*/ QListWidget_insertItems<()> for (i32, &'a QStringList) { fn insertItems(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget11insertItemsEiRK11QStringList()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; unsafe {C_ZN11QListWidget11insertItemsEiRK11QStringList(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: QListWidgetItem * QListWidget::currentItem(); impl /*struct*/ QListWidget { pub fn currentItem<RetType, T: QListWidget_currentItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.currentItem(self); // return 1; } } pub trait QListWidget_currentItem<RetType> { fn currentItem(self , rsthis: & QListWidget) -> RetType; } // proto: QListWidgetItem * QListWidget::currentItem(); impl<'a> /*trait*/ QListWidget_currentItem<QListWidgetItem> for () { fn currentItem(self , rsthis: & QListWidget) -> QListWidgetItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QListWidget11currentItemEv()}; let mut ret = unsafe {C_ZNK11QListWidget11currentItemEv(rsthis.qclsinst)}; let mut ret1 = QListWidgetItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QListWidget::setCurrentItem(QListWidgetItem * item); impl /*struct*/ QListWidget { pub fn setCurrentItem<RetType, T: QListWidget_setCurrentItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setCurrentItem(self); // return 1; } } pub trait QListWidget_setCurrentItem<RetType> { fn setCurrentItem(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::setCurrentItem(QListWidgetItem * item); impl<'a> /*trait*/ QListWidget_setCurrentItem<()> for (&'a QListWidgetItem) { fn setCurrentItem(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget14setCurrentItemEP15QListWidgetItem()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN11QListWidget14setCurrentItemEP15QListWidgetItem(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QListWidget::setItemWidget(QListWidgetItem * item, QWidget * widget); impl /*struct*/ QListWidget { pub fn setItemWidget<RetType, T: QListWidget_setItemWidget<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setItemWidget(self); // return 1; } } pub trait QListWidget_setItemWidget<RetType> { fn setItemWidget(self , rsthis: & QListWidget) -> RetType; } // proto: void QListWidget::setItemWidget(QListWidgetItem * item, QWidget * widget); impl<'a> /*trait*/ QListWidget_setItemWidget<()> for (&'a QListWidgetItem, &'a QWidget) { fn setItemWidget(self , rsthis: & QListWidget) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QListWidget13setItemWidgetEP15QListWidgetItemP7QWidget()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; unsafe {C_ZN11QListWidget13setItemWidgetEP15QListWidgetItemP7QWidget(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: bool QListWidget::isItemSelected(const QListWidgetItem * item); impl /*struct*/ QListWidget { pub fn isItemSelected<RetType, T: QListWidget_isItemSelected<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isItemSelected(self); // return 1; } } pub trait QListWidget_isItemSelected<RetType> { fn isItemSelected(self , rsthis: & QListWidget) -> RetType; } // proto: bool QListWidget::isItemSelected(const QListWidgetItem * item); impl<'a> /*trait*/ QListWidget_isItemSelected<i8> for (&'a QListWidgetItem) { fn isItemSelected(self , rsthis: & QListWidget) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QListWidget14isItemSelectedEPK15QListWidgetItem()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK11QListWidget14isItemSelectedEPK15QListWidgetItem(rsthis.qclsinst, arg0)}; return ret as i8; // 1 // return 1; } } #[derive(Default)] // for QListWidget_itemDoubleClicked pub struct QListWidget_itemDoubleClicked_signal{poi:u64} impl /* struct */ QListWidget { pub fn itemDoubleClicked(&self) -> QListWidget_itemDoubleClicked_signal { return QListWidget_itemDoubleClicked_signal{poi:self.qclsinst}; } } impl /* struct */ QListWidget_itemDoubleClicked_signal { pub fn connect<T: QListWidget_itemDoubleClicked_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QListWidget_itemDoubleClicked_signal_connect { fn connect(self, sigthis: QListWidget_itemDoubleClicked_signal); } #[derive(Default)] // for QListWidget_itemClicked pub struct QListWidget_itemClicked_signal{poi:u64} impl /* struct */ QListWidget { pub fn itemClicked(&self) -> QListWidget_itemClicked_signal { return QListWidget_itemClicked_signal{poi:self.qclsinst}; } } impl /* struct */ QListWidget_itemClicked_signal { pub fn connect<T: QListWidget_itemClicked_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QListWidget_itemClicked_signal_connect { fn connect(self, sigthis: QListWidget_itemClicked_signal); } #[derive(Default)] // for QListWidget_currentItemChanged pub struct QListWidget_currentItemChanged_signal{poi:u64} impl /* struct */ QListWidget { pub fn currentItemChanged(&self) -> QListWidget_currentItemChanged_signal { return QListWidget_currentItemChanged_signal{poi:self.qclsinst}; } } impl /* struct */ QListWidget_currentItemChanged_signal { pub fn connect<T: QListWidget_currentItemChanged_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QListWidget_currentItemChanged_signal_connect { fn connect(self, sigthis: QListWidget_currentItemChanged_signal); } #[derive(Default)] // for QListWidget_itemEntered pub struct QListWidget_itemEntered_signal{poi:u64} impl /* struct */ QListWidget { pub fn itemEntered(&self) -> QListWidget_itemEntered_signal { return QListWidget_itemEntered_signal{poi:self.qclsinst}; } } impl /* struct */ QListWidget_itemEntered_signal { pub fn connect<T: QListWidget_itemEntered_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QListWidget_itemEntered_signal_connect { fn connect(self, sigthis: QListWidget_itemEntered_signal); } #[derive(Default)] // for QListWidget_itemPressed pub struct QListWidget_itemPressed_signal{poi:u64} impl /* struct */ QListWidget { pub fn itemPressed(&self) -> QListWidget_itemPressed_signal { return QListWidget_itemPressed_signal{poi:self.qclsinst}; } } impl /* struct */ QListWidget_itemPressed_signal { pub fn connect<T: QListWidget_itemPressed_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QListWidget_itemPressed_signal_connect { fn connect(self, sigthis: QListWidget_itemPressed_signal); } #[derive(Default)] // for QListWidget_itemSelectionChanged pub struct QListWidget_itemSelectionChanged_signal{poi:u64} impl /* struct */ QListWidget { pub fn itemSelectionChanged(&self) -> QListWidget_itemSelectionChanged_signal { return QListWidget_itemSelectionChanged_signal{poi:self.qclsinst}; } } impl /* struct */ QListWidget_itemSelectionChanged_signal { pub fn connect<T: QListWidget_itemSelectionChanged_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QListWidget_itemSelectionChanged_signal_connect { fn connect(self, sigthis: QListWidget_itemSelectionChanged_signal); } #[derive(Default)] // for QListWidget_itemActivated pub struct QListWidget_itemActivated_signal{poi:u64} impl /* struct */ QListWidget { pub fn itemActivated(&self) -> QListWidget_itemActivated_signal { return QListWidget_itemActivated_signal{poi:self.qclsinst}; } } impl /* struct */ QListWidget_itemActivated_signal { pub fn connect<T: QListWidget_itemActivated_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QListWidget_itemActivated_signal_connect { fn connect(self, sigthis: QListWidget_itemActivated_signal); } #[derive(Default)] // for QListWidget_itemChanged pub struct QListWidget_itemChanged_signal{poi:u64} impl /* struct */ QListWidget { pub fn itemChanged(&self) -> QListWidget_itemChanged_signal { return QListWidget_itemChanged_signal{poi:self.qclsinst}; } } impl /* struct */ QListWidget_itemChanged_signal { pub fn connect<T: QListWidget_itemChanged_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QListWidget_itemChanged_signal_connect { fn connect(self, sigthis: QListWidget_itemChanged_signal); } #[derive(Default)] // for QListWidget_currentRowChanged pub struct QListWidget_currentRowChanged_signal{poi:u64} impl /* struct */ QListWidget { pub fn currentRowChanged(&self) -> QListWidget_currentRowChanged_signal { return QListWidget_currentRowChanged_signal{poi:self.qclsinst}; } } impl /* struct */ QListWidget_currentRowChanged_signal { pub fn connect<T: QListWidget_currentRowChanged_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QListWidget_currentRowChanged_signal_connect { fn connect(self, sigthis: QListWidget_currentRowChanged_signal); } #[derive(Default)] // for QListWidget_currentTextChanged pub struct QListWidget_currentTextChanged_signal{poi:u64} impl /* struct */ QListWidget { pub fn currentTextChanged(&self) -> QListWidget_currentTextChanged_signal { return QListWidget_currentTextChanged_signal{poi:self.qclsinst}; } } impl /* struct */ QListWidget_currentTextChanged_signal { pub fn connect<T: QListWidget_currentTextChanged_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QListWidget_currentTextChanged_signal_connect { fn connect(self, sigthis: QListWidget_currentTextChanged_signal); } // itemDoubleClicked(class QListWidgetItem *) extern fn QListWidget_itemDoubleClicked_signal_connect_cb_0(rsfptr:fn(QListWidgetItem), arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsarg0 = QListWidgetItem::inheritFrom(arg0 as u64); rsfptr(rsarg0); } extern fn QListWidget_itemDoubleClicked_signal_connect_cb_box_0(rsfptr_raw:*mut Box<Fn(QListWidgetItem)>, arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = QListWidgetItem::inheritFrom(arg0 as u64); // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QListWidget_itemDoubleClicked_signal_connect for fn(QListWidgetItem) { fn connect(self, sigthis: QListWidget_itemDoubleClicked_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_itemDoubleClicked_signal_connect_cb_0 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget17itemDoubleClickedEP15QListWidgetItem(arg0, arg1, arg2)}; } } impl /* trait */ QListWidget_itemDoubleClicked_signal_connect for Box<Fn(QListWidgetItem)> { fn connect(self, sigthis: QListWidget_itemDoubleClicked_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_itemDoubleClicked_signal_connect_cb_box_0 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget17itemDoubleClickedEP15QListWidgetItem(arg0, arg1, arg2)}; } } // itemEntered(class QListWidgetItem *) extern fn QListWidget_itemEntered_signal_connect_cb_1(rsfptr:fn(QListWidgetItem), arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsarg0 = QListWidgetItem::inheritFrom(arg0 as u64); rsfptr(rsarg0); } extern fn QListWidget_itemEntered_signal_connect_cb_box_1(rsfptr_raw:*mut Box<Fn(QListWidgetItem)>, arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = QListWidgetItem::inheritFrom(arg0 as u64); // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QListWidget_itemEntered_signal_connect for fn(QListWidgetItem) { fn connect(self, sigthis: QListWidget_itemEntered_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_itemEntered_signal_connect_cb_1 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget11itemEnteredEP15QListWidgetItem(arg0, arg1, arg2)}; } } impl /* trait */ QListWidget_itemEntered_signal_connect for Box<Fn(QListWidgetItem)> { fn connect(self, sigthis: QListWidget_itemEntered_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_itemEntered_signal_connect_cb_box_1 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget11itemEnteredEP15QListWidgetItem(arg0, arg1, arg2)}; } } // itemClicked(class QListWidgetItem *) extern fn QListWidget_itemClicked_signal_connect_cb_2(rsfptr:fn(QListWidgetItem), arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsarg0 = QListWidgetItem::inheritFrom(arg0 as u64); rsfptr(rsarg0); } extern fn QListWidget_itemClicked_signal_connect_cb_box_2(rsfptr_raw:*mut Box<Fn(QListWidgetItem)>, arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = QListWidgetItem::inheritFrom(arg0 as u64); // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QListWidget_itemClicked_signal_connect for fn(QListWidgetItem) { fn connect(self, sigthis: QListWidget_itemClicked_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_itemClicked_signal_connect_cb_2 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget11itemClickedEP15QListWidgetItem(arg0, arg1, arg2)}; } } impl /* trait */ QListWidget_itemClicked_signal_connect for Box<Fn(QListWidgetItem)> { fn connect(self, sigthis: QListWidget_itemClicked_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_itemClicked_signal_connect_cb_box_2 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget11itemClickedEP15QListWidgetItem(arg0, arg1, arg2)}; } } // currentItemChanged(class QListWidgetItem *, class QListWidgetItem *) extern fn QListWidget_currentItemChanged_signal_connect_cb_3(rsfptr:fn(QListWidgetItem, QListWidgetItem), arg0: *mut c_void, arg1: *mut c_void) { println!("{}:{}", file!(), line!()); let rsarg0 = QListWidgetItem::inheritFrom(arg0 as u64); let rsarg1 = QListWidgetItem::inheritFrom(arg1 as u64); rsfptr(rsarg0,rsarg1); } extern fn QListWidget_currentItemChanged_signal_connect_cb_box_3(rsfptr_raw:*mut Box<Fn(QListWidgetItem, QListWidgetItem)>, arg0: *mut c_void, arg1: *mut c_void) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = QListWidgetItem::inheritFrom(arg0 as u64); let rsarg1 = QListWidgetItem::inheritFrom(arg1 as u64); // rsfptr(rsarg0,rsarg1); unsafe{(*rsfptr_raw)(rsarg0,rsarg1)}; } impl /* trait */ QListWidget_currentItemChanged_signal_connect for fn(QListWidgetItem, QListWidgetItem) { fn connect(self, sigthis: QListWidget_currentItemChanged_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_currentItemChanged_signal_connect_cb_3 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget18currentItemChangedEP15QListWidgetItemS1_(arg0, arg1, arg2)}; } } impl /* trait */ QListWidget_currentItemChanged_signal_connect for Box<Fn(QListWidgetItem, QListWidgetItem)> { fn connect(self, sigthis: QListWidget_currentItemChanged_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_currentItemChanged_signal_connect_cb_box_3 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget18currentItemChangedEP15QListWidgetItemS1_(arg0, arg1, arg2)}; } } // currentTextChanged(const class QString &) extern fn QListWidget_currentTextChanged_signal_connect_cb_4(rsfptr:fn(QString), arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsarg0 = QString::inheritFrom(arg0 as u64); rsfptr(rsarg0); } extern fn QListWidget_currentTextChanged_signal_connect_cb_box_4(rsfptr_raw:*mut Box<Fn(QString)>, arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = QString::inheritFrom(arg0 as u64); // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QListWidget_currentTextChanged_signal_connect for fn(QString) { fn connect(self, sigthis: QListWidget_currentTextChanged_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_currentTextChanged_signal_connect_cb_4 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget18currentTextChangedERK7QString(arg0, arg1, arg2)}; } } impl /* trait */ QListWidget_currentTextChanged_signal_connect for Box<Fn(QString)> { fn connect(self, sigthis: QListWidget_currentTextChanged_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_currentTextChanged_signal_connect_cb_box_4 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget18currentTextChangedERK7QString(arg0, arg1, arg2)}; } } // itemChanged(class QListWidgetItem *) extern fn QListWidget_itemChanged_signal_connect_cb_5(rsfptr:fn(QListWidgetItem), arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsarg0 = QListWidgetItem::inheritFrom(arg0 as u64); rsfptr(rsarg0); } extern fn QListWidget_itemChanged_signal_connect_cb_box_5(rsfptr_raw:*mut Box<Fn(QListWidgetItem)>, arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = QListWidgetItem::inheritFrom(arg0 as u64); // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QListWidget_itemChanged_signal_connect for fn(QListWidgetItem) { fn connect(self, sigthis: QListWidget_itemChanged_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_itemChanged_signal_connect_cb_5 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget11itemChangedEP15QListWidgetItem(arg0, arg1, arg2)}; } } impl /* trait */ QListWidget_itemChanged_signal_connect for Box<Fn(QListWidgetItem)> { fn connect(self, sigthis: QListWidget_itemChanged_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_itemChanged_signal_connect_cb_box_5 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget11itemChangedEP15QListWidgetItem(arg0, arg1, arg2)}; } } // itemSelectionChanged() extern fn QListWidget_itemSelectionChanged_signal_connect_cb_6(rsfptr:fn(), ) { println!("{}:{}", file!(), line!()); rsfptr(); } extern fn QListWidget_itemSelectionChanged_signal_connect_cb_box_6(rsfptr_raw:*mut Box<Fn()>, ) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; // rsfptr(); unsafe{(*rsfptr_raw)()}; } impl /* trait */ QListWidget_itemSelectionChanged_signal_connect for fn() { fn connect(self, sigthis: QListWidget_itemSelectionChanged_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_itemSelectionChanged_signal_connect_cb_6 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget20itemSelectionChangedEv(arg0, arg1, arg2)}; } } impl /* trait */ QListWidget_itemSelectionChanged_signal_connect for Box<Fn()> { fn connect(self, sigthis: QListWidget_itemSelectionChanged_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_itemSelectionChanged_signal_connect_cb_box_6 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget20itemSelectionChangedEv(arg0, arg1, arg2)}; } } // itemPressed(class QListWidgetItem *) extern fn QListWidget_itemPressed_signal_connect_cb_7(rsfptr:fn(QListWidgetItem), arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsarg0 = QListWidgetItem::inheritFrom(arg0 as u64); rsfptr(rsarg0); } extern fn QListWidget_itemPressed_signal_connect_cb_box_7(rsfptr_raw:*mut Box<Fn(QListWidgetItem)>, arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = QListWidgetItem::inheritFrom(arg0 as u64); // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QListWidget_itemPressed_signal_connect for fn(QListWidgetItem) { fn connect(self, sigthis: QListWidget_itemPressed_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_itemPressed_signal_connect_cb_7 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget11itemPressedEP15QListWidgetItem(arg0, arg1, arg2)}; } } impl /* trait */ QListWidget_itemPressed_signal_connect for Box<Fn(QListWidgetItem)> { fn connect(self, sigthis: QListWidget_itemPressed_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_itemPressed_signal_connect_cb_box_7 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget11itemPressedEP15QListWidgetItem(arg0, arg1, arg2)}; } } // itemActivated(class QListWidgetItem *) extern fn QListWidget_itemActivated_signal_connect_cb_8(rsfptr:fn(QListWidgetItem), arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsarg0 = QListWidgetItem::inheritFrom(arg0 as u64); rsfptr(rsarg0); } extern fn QListWidget_itemActivated_signal_connect_cb_box_8(rsfptr_raw:*mut Box<Fn(QListWidgetItem)>, arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = QListWidgetItem::inheritFrom(arg0 as u64); // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QListWidget_itemActivated_signal_connect for fn(QListWidgetItem) { fn connect(self, sigthis: QListWidget_itemActivated_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_itemActivated_signal_connect_cb_8 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget13itemActivatedEP15QListWidgetItem(arg0, arg1, arg2)}; } } impl /* trait */ QListWidget_itemActivated_signal_connect for Box<Fn(QListWidgetItem)> { fn connect(self, sigthis: QListWidget_itemActivated_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_itemActivated_signal_connect_cb_box_8 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget13itemActivatedEP15QListWidgetItem(arg0, arg1, arg2)}; } } // currentRowChanged(int) extern fn QListWidget_currentRowChanged_signal_connect_cb_9(rsfptr:fn(i32), arg0: c_int) { println!("{}:{}", file!(), line!()); let rsarg0 = arg0 as i32; rsfptr(rsarg0); } extern fn QListWidget_currentRowChanged_signal_connect_cb_box_9(rsfptr_raw:*mut Box<Fn(i32)>, arg0: c_int) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = arg0 as i32; // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QListWidget_currentRowChanged_signal_connect for fn(i32) { fn connect(self, sigthis: QListWidget_currentRowChanged_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_currentRowChanged_signal_connect_cb_9 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget17currentRowChangedEi(arg0, arg1, arg2)}; } } impl /* trait */ QListWidget_currentRowChanged_signal_connect for Box<Fn(i32)> { fn connect(self, sigthis: QListWidget_currentRowChanged_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QListWidget_currentRowChanged_signal_connect_cb_box_9 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QListWidget_SlotProxy_connect__ZN11QListWidget17currentRowChangedEi(arg0, arg1, arg2)}; } } // <= body block end
use std::fmt; use std::fmt::Debug; use std::string::String; use std::boxed::Box; use super::mbc::Mbc; use super::mbc::MbcType; use super::mbc::RamInfo; use super::mbc::MbcInfo; use super::GameboyType; pub struct Cart { bytes: Box<[u8]>, mbc: Box<Mbc>, } #[derive(Debug)] pub enum DestinationCode { Japanese, NonJapanese, } impl Cart { pub fn new(bytes: Box<[u8]>, ram: Option<Box<[u8]>>) -> Cart { let mbc_info = Cart::get_mbc_info(&bytes); let mbc = super::mbc::new_mbc(mbc_info, ram); Cart { bytes: bytes, mbc: mbc, } } pub fn title(&self) -> String { let mut title = Vec::new(); for i in 0x0134..0x0143 { title.push(self.bytes[i]); } String::from_utf8(title).unwrap() } pub fn mbc_info(&self) -> MbcInfo { Cart::get_mbc_info(&self.bytes) } fn get_mbc_info(bytes: &Box<[u8]>) -> MbcInfo { let ram_info = if Cart::get_ram_size(&bytes) != 0 { Some(RamInfo::new(Cart::get_ram_size(&bytes), Cart::get_ram_bank_count(&bytes))) } else { None }; match bytes[0x0147] { 0x00 => MbcInfo::new(MbcType::None, ram_info, false), 0x01 => MbcInfo::new(MbcType::Mbc1, ram_info, false), 0x02 => MbcInfo::new(MbcType::Mbc1, ram_info, false), 0x03 => MbcInfo::new(MbcType::Mbc1, ram_info, true), 0x13 => MbcInfo::new(MbcType::Mbc3, ram_info, true), 0x19 => MbcInfo::new(MbcType::Mbc5, ram_info, false), 0x1b => MbcInfo::new(MbcType::Mbc5, ram_info, true), _ => panic!("Unsupported mbc_info: 0x{:x}", bytes[0x0147]), } } pub fn rom_size(&self) -> u32 { match self.bytes[0x0148] { 0 => 1024 * 32, 1 => 1024 * 64, 2 => 1024 * 128, 3 => 1024 * 256, 4 => 1024 * 512, 5 => 1024 * 1024, 6 => 1024 * 1024 * 2, _ => panic!("Unsupported rom size: {:x}", self.bytes[0x0148]), } } pub fn rom_bank_count(&self) -> u32 { self.rom_size() / (1024 * 16) } #[allow(dead_code)] pub fn ram_size(&self) -> u32 { Cart::get_ram_size(&self.bytes) } fn get_ram_size(bytes: &Box<[u8]>) -> u32 { match bytes[0x149] { 0 => 0, 1 => 1024 * 2, 2 => 1024 * 8, 3 => 1024 * 32, 4 => 1024 * 128, _ => panic!("Unsupported ram size: {:x}", bytes[0x0149]), } } #[allow(dead_code)] pub fn ram_bank_count(&self) -> u32 { Cart::get_ram_bank_count(&self.bytes) } fn get_ram_bank_count(bytes: &Box<[u8]>) -> u32 { match bytes[0x0149] { 0 => 0, 1 | 2 => 1, 3 => 4, 4 => 16, _ => panic!("Unsupported ram size"), } } pub fn destination_code(&self) -> DestinationCode { match self.bytes[0x014a] { 0 => DestinationCode::Japanese, 1 => DestinationCode::NonJapanese, _ => panic!("Unsupported destination code"), } } #[allow(dead_code)] pub fn gameboy_type(&self) -> GameboyType { match self.bytes[0x0143] { // TODO: confirm that this is correct 0x80 | 0xc0 => GameboyType::Cgb, _ => GameboyType::Dmg, } } pub fn read(&self, addr: u16) -> u8 { self.mbc.read(&self.bytes, addr) } pub fn write(&mut self, addr: u16, val: u8) { self.mbc.write(addr, val) } pub fn read_ram(&self, addr: u16) -> u8 { self.mbc.read_ram(addr) } pub fn write_ram(&mut self, addr: u16, val: u8) { self.mbc.write_ram(addr, val) } pub fn copy_ram(&self) -> Option<Box<[u8]>> { self.mbc.copy_ram() } } impl Debug for Cart { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Cart {{ title: {}, mbc_info: {:?}, size: {:?}, bank_count: {:?}, destination_code: {:?}, }}", self.title(), self.mbc_info(), self.rom_size(), self.rom_bank_count(), self.destination_code()) } }
#![doc(html_root_url = "https://docs.rs/hyper/0.12.24")] #![deny(missing_docs)] #![deny(missing_debug_implementations)] #![cfg_attr(test, deny(warnings))] #![cfg_attr(all(test, feature = "nightly"), feature(test))] //! # hyper //! //! hyper is a **fast** and **correct** HTTP implementation written in and for Rust. //! //! hyper provides both a [Client](client/index.html) and a //! [Server](server/index.html). //! //! If just starting out, **check out the [Guides](https://hyper.rs/guides) //! first.** //! //! If looking for just a convenient HTTP client, consider the //! [reqwest](https://crates.io/crates/reqwest) crate. extern crate bytes; #[macro_use] extern crate futures; #[cfg(feature = "runtime")] extern crate futures_cpupool; extern crate h2; #[doc(hidden)] pub extern crate http; extern crate httparse; extern crate iovec; extern crate itoa; #[macro_use] extern crate log; #[cfg(feature = "runtime")] extern crate net2; extern crate time; #[cfg(feature = "runtime")] extern crate tokio; #[cfg(feature = "runtime")] extern crate tokio_executor; #[macro_use] extern crate tokio_io; #[cfg(feature = "runtime")] extern crate tokio_reactor; #[cfg(feature = "runtime")] extern crate tokio_tcp; #[cfg(feature = "runtime")] extern crate tokio_threadpool; #[cfg(feature = "runtime")] extern crate tokio_timer; extern crate want; #[cfg(all(test, feature = "nightly"))] extern crate test; pub use http::{ header, HeaderMap, Method, Request, Response, StatusCode, Uri, Version, }; pub use client::Client; pub use error::{Result, Error}; pub use body::{Body, Chunk}; pub use server::Server; #[macro_use] mod common; #[cfg(test)] mod mock; pub mod body; pub mod client; pub mod error; mod headers; mod proto; pub mod server; pub mod service; #[cfg(feature = "runtime")] pub mod rt; pub mod upgrade;
use super::{ Entity, EntityShape, ResourceRegistry, RunSystemPhase, Service, ServicePhase, System, SystemRunner, }; use generational_arena::Arena; use std::fmt; pub struct ECS { pub(crate) entities: Arena<Entity>, systems: SystemRunner, pub resources: ResourceRegistry, } impl fmt::Debug for ECS { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "<ECS>") } } impl ECS { pub fn new() -> Self { Self { entities: Arena::new(), systems: SystemRunner::new(), resources: ResourceRegistry::new(), } } pub fn add_entity(&mut self, entity: Entity) { self.entities.insert(entity); } pub fn add_system(&mut self, system: System) { self.systems.add(system); } pub fn add_before_service(&mut self, system: Service) { self.systems.add_service(system, ServicePhase::Before); } pub fn add_after_service(&mut self, system: Service) { self.systems.add_service(system, ServicePhase::After); } pub fn run_systems(&mut self, phase: RunSystemPhase) { match phase.clone() { RunSystemPhase::Update(type_id) => { for service in self.systems.before_update.iter_mut() { if let Some(update_key) = service.update_key { if update_key == type_id { (service.calls)(&mut self.resources, &phase); } } } for (_, entity) in self.entities.iter_mut() { for system in self.systems.update.iter_mut() { if let Some(update_key) = system.update_key { if update_key == type_id { if entity.components.raw_contains_all(&system.query.0) { (system.calls)(entity, &mut self.resources, &phase); } } } } } for service in self.systems.after_update.iter_mut() { if let Some(update_key) = service.update_key { if update_key == type_id { (service.calls)(&mut self.resources, &phase); } } } } RunSystemPhase::Event(_event) => { for system in self.systems.before_event.iter_mut() { (system.calls)(&mut self.resources, &phase); } for (_, entity) in self.entities.iter_mut() { for system in self.systems.event.iter_mut() { if entity.components.raw_contains_all(&system.query.0) { (system.calls)(entity, &mut self.resources, &phase); } } } for system in self.systems.after_event.iter_mut() { (system.calls)(&mut self.resources, &phase); } } RunSystemPhase::Tick => { for system in self.systems.before_tick.iter_mut() { (system.calls)(&mut self.resources, &phase); } for (_, entity) in self.entities.iter_mut() { for system in self.systems.tick.iter_mut() { if entity.components.raw_contains_all(&system.query.0) { (system.calls)(entity, &mut self.resources, &phase); } } } for system in self.systems.after_tick.iter_mut() { (system.calls)(&mut self.resources, &phase); } } RunSystemPhase::Render => { for system in self.systems.before_render.iter_mut() { (system.calls)(&mut self.resources, &phase); } for (_, entity) in self.entities.iter_mut() { for system in self.systems.render.iter_mut() { if entity.components.raw_contains_all(&system.query.0) { (system.calls)(entity, &mut self.resources, &phase); } } } for system in self.systems.after_render.iter_mut() { (system.calls)(&mut self.resources, &phase); } } } } pub fn query_exact(&mut self, shape: &EntityShape) -> Vec<&mut Entity> { let mut matching: Vec<&mut Entity> = Vec::new(); for (_, entity) in self.entities.iter_mut() { if entity.components.raw_contains_all(&shape.0) { matching.push(entity); } } matching } }
use proconio::input; fn main() { input! { _: usize, s: String, }; let t = s.replace("na", "nya"); println!("{}", t); }
use failure::Error; use std::io::BufRead; // \r 13 // \n 10 fn find_new_line(data: &[u8]) -> Option<(usize, usize)> { match memchr::memchr(b'\n', data) { Some(i) => { if i > 0 && data[i - 1] == b'\r' { Some((i - 1, 2)) } else { Some((i, 1)) } } None => None, } } #[derive(Clone, Debug)] pub struct StreamReader<T> { inner: T, buffer: Vec<u8>, clear_next: bool, } impl<T: BufRead> StreamReader<T> { pub fn new(inner: T) -> StreamReader<T> { StreamReader { inner, buffer: Vec::new(), clear_next: false, } } pub fn line(&mut self) -> Result<(bool, Option<&[u8]>), Error> { if self.clear_next { self.buffer.clear(); } self.clear_next = false; let (line, length) = { let buffer = self.inner.fill_buf().unwrap(); if let Some((pos, size)) = find_new_line(buffer) { if pos == 0 { if !self.buffer.is_empty() && self.buffer[self.buffer.len() - 1] == b'\r' { self.buffer.pop(); } } else { self.buffer.extend_from_slice(&buffer[..pos]); } (true, pos + size) } else { self.buffer.extend_from_slice(&buffer); (false, buffer.len()) } }; if length == 0 { return Ok((true, None)); } self.inner.consume(length); if line { self.clear_next = true; Ok((false, Some(&self.buffer))) } else { Ok((false, None)) } } } #[cfg(test)] mod tests { use super::*; use std::io::Cursor; use std::io::Write; #[test] fn it_works() { { let buf = Cursor::new(&b""[..]); let mut r = StreamReader::new(buf); assert_eq!(r.line().unwrap(), (true, None)); } { let buf = Cursor::new(&b"\n"[..]); let mut r = StreamReader::new(buf); assert_eq!(r.line().unwrap(), (false, Some(&b""[..]))); } { let buf = Cursor::new(&b"12"[..]); let mut r = StreamReader::new(buf); assert_eq!(r.line().unwrap(), (false, None)); } // --- { let buf = Cursor::new(&b"12"[..]); let mut r = StreamReader::new(buf); assert_eq!(r.line().unwrap(), (false, None)); } { let buf = Cursor::new(&b"12\r\n"[..]); let mut r = StreamReader::new(buf); assert_eq!(r.line().unwrap(), (false, Some(&b"12"[..]))); assert_eq!(r.line().unwrap(), (true, None)); } { let buf = Cursor::new(&b"12\r\n1"[..]); let mut r = StreamReader::new(buf); assert_eq!(r.line().unwrap(), (false, Some(&b"12"[..]))); assert_eq!(r.line().unwrap(), (false, None)); } { let buf = Cursor::new(&b"12\r\n13\r\ntest"[..]); let mut r = StreamReader::new(buf); assert_eq!(r.line().unwrap(), (false, Some(&b"12"[..]))); assert_eq!(r.line().unwrap(), (false, Some(&b"13"[..]))); assert_eq!(r.line().unwrap(), (false, None)); } // ----- { let buf = Cursor::new(&b"12"[..]); let mut r = StreamReader::new(buf); assert_eq!(r.line().unwrap(), (false, None)); } { let buf = Cursor::new(&b"12\n"[..]); let mut r = StreamReader::new(buf); assert_eq!(r.line().unwrap(), (false, Some(&b"12"[..]))); assert_eq!(r.line().unwrap(), (true, None)); } { let buf = Cursor::new(&b"12\n1"[..]); let mut r = StreamReader::new(buf); assert_eq!(r.line().unwrap(), (false, Some(&b"12"[..]))); assert_eq!(r.line().unwrap(), (false, None)); } { let buf = Cursor::new(&b"12\n13\ntest"[..]); let mut r = StreamReader::new(buf); assert_eq!(r.line().unwrap(), (false, Some(&b"12"[..]))); assert_eq!(r.line().unwrap(), (false, Some(&b"13"[..]))); assert_eq!(r.line().unwrap(), (false, None)); } } #[test] fn it_works2() { { let mut r = StreamReader::new(Cursor::new(Vec::new())); r.inner.write(b"test").unwrap(); r.inner.set_position(0); assert_eq!(r.line().unwrap(), (false, None)); let last_pos = r.inner.position(); r.inner.write(b"\r\nsome bytes\nttt").unwrap(); r.inner.set_position(last_pos); assert_eq!(r.line().unwrap(), (false, Some(&b"test"[..]))); assert_eq!(r.line().unwrap(), (false, Some(&b"some bytes"[..]))); assert_eq!(r.line().unwrap(), (false, None)); } } #[test] fn line_endings_win() { let mut r = StreamReader::new(Cursor::new("line1\r\nline 2\r\nsomething")); assert_eq!(r.line().unwrap(), (false, Some(&b"line1"[..]))); assert_eq!(r.line().unwrap(), (false, Some(&b"line 2"[..]))); assert_eq!(r.line().unwrap(), (false, None)); } #[test] fn line_endings_unix() { let mut r = StreamReader::new(Cursor::new("line1\nline 2\nsomething")); assert_eq!(r.line().unwrap(), (false, Some(&b"line1"[..]))); assert_eq!(r.line().unwrap(), (false, Some(&b"line 2"[..]))); assert_eq!(r.line().unwrap(), (false, None)); } #[test] fn test_multiples_newlines_unix() { let mut r = StreamReader::new(Cursor::new("\n\ntest\nthing")); assert_eq!(r.line().unwrap(), (false, Some(&b""[..]))); assert_eq!(r.line().unwrap(), (false, Some(&b""[..]))); assert_eq!(r.line().unwrap(), (false, Some(&b"test"[..]))); assert_eq!(r.line().unwrap(), (false, None)); } #[test] fn test_multiples_newlines_win() { let mut r = StreamReader::new(Cursor::new("\r\n\r\ntest\r\nthing")); assert_eq!(r.line().unwrap(), (false, Some(&b""[..]))); assert_eq!(r.line().unwrap(), (false, Some(&b""[..]))); assert_eq!(r.line().unwrap(), (false, Some(&b"test"[..]))); assert_eq!(r.line().unwrap(), (false, None)); } #[test] fn line_endings_both() { let mut r = StreamReader::new(Cursor::new("line1\r\nline 2\nsomething")); assert_eq!(r.line().unwrap(), (false, Some(&b"line1"[..]))); assert_eq!(r.line().unwrap(), (false, Some(&b"line 2"[..]))); assert_eq!(r.line().unwrap(), (false, None)); } #[test] fn bug_middle_cr_lf() { let mut r = StreamReader::new(Cursor::new(Vec::new())); r.inner.write(b"[2018.10.02-03.10.58:467][952]LogSquadTrace: [DedicatedServer]ASQPlayerController::ChangeState(): PC=TotenKopf OldState=Inactive NewState=Playing\r").unwrap(); r.inner.set_position(0); assert_eq!(r.line().unwrap(), (false, None)); let last_pos = r.inner.position(); r.inner.write(b"\n[2018.10.02-03.10.58:467]").unwrap(); r.inner.set_position(last_pos); assert_eq!(r.line().unwrap(), (false, Some(&b"[2018.10.02-03.10.58:467][952]LogSquadTrace: [DedicatedServer]ASQPlayerController::ChangeState(): PC=TotenKopf OldState=Inactive NewState=Playing"[..]))); } #[test] fn test_find_new_line() { { let data = "aaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaa"; assert_eq!(find_new_line(data.as_bytes()).unwrap(), (21, 1)); } { let data = "aaaaaaaaaaaaaaaaa\r\naaaaaaaaaaaaaaaa"; assert_eq!(find_new_line(data.as_bytes()).unwrap(), (17, 2)); } { let data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; assert_eq!(find_new_line(data.as_bytes()), None); } { let data = "aaaaaaaaaaaaaaaaa\raaaaaaaaaaaaaaaaaaaa"; assert_eq!(find_new_line(data.as_bytes()), None); } { let data = ""; assert_eq!(find_new_line(data.as_bytes()), None); } } }
#[doc = "Reader of register TX_SINGLE_COLLISION_GOOD_PACKETS"] pub type R = crate::R<u32, super::TX_SINGLE_COLLISION_GOOD_PACKETS>; #[doc = "Reader of field `TXSNGLCOLG`"] pub type TXSNGLCOLG_R = crate::R<u32, u32>; impl R { #[doc = "Bits 0:31 - Tx Single Collision Good Packets"] #[inline(always)] pub fn txsnglcolg(&self) -> TXSNGLCOLG_R { TXSNGLCOLG_R::new((self.bits & 0xffff_ffff) as u32) } }
//game.rs //game manager use quicksilver::prelude::*; pub mod game_map; pub mod item_bag; pub mod player; pub mod store; pub struct Game { title: Asset<Image>, pub map: game_map::Map, pic: Asset<Image>, tileset: Asset<std::collections::HashMap<char, Image>>, pub player: player::Player, //vec players //tile_size_px: Vector, controls: Asset<Image>, msg: String, display_msg: bool, msg_asset: Asset<Image>, store: store::Store, store_asset: Asset<Image>, bees: Asset<Image>, } impl State for Game { //qs state trait handles window rendering fn new() -> Result<Self> { //switch fmt // gnu mono let font_mono = "FreeMono.ttf"; // xxx new font / ss //title let title = Asset::new( Font::load(font_mono) .and_then(|font| font.render("NKd", &FontStyle::new(72.0, Color::BLACK))), ); //controls let controls = Asset::new(Font::load(font_mono).and_then(move |font| { font.render( "Conrols:\nUp: North\nDown: South\nLeft: East\nRight: West\nW: act M: market\nEsc: quit", &FontStyle::new(20.0, Color::BLACK), ) })); //store display let store = store::Store::gen_store(); let store_clone = store.clone(); let store_asset = Asset::new(Font::load(font_mono).and_then(move |font| { font.render( &store_clone.contents_to_strings().join("\n"), &FontStyle::new(20.0, Color::BLACK), ) })); //message let msg = "Missing: ".to_string(); let display_msg = false; let msg_clone = msg.clone(); let msg_asset = Asset::new(Font::load(font_mono).and_then(move |font| { font.render(&msg_clone, &FontStyle::new(20.0, Color::BLACK)) })); //pic for experimenting let pic = Asset::new(Image::load("testimg1.png")); let bees = Asset::new(Image::load("bees.jpeg")); //map let map = game_map::Map::gen(25, 25); // xxx use window size? //characters //break up into fei // let mut players = Vec::<player::Player>::new(); // players.push(player::Player::new()) let mut player = player::Player::new(); player.add_tool(&"Blue towel".to_string()); // ttt ??? //based on tse example let chs = "amoxwlg"; let tile_size_px = Vector::new(10, 24); let tileset = Asset::new(Font::load(font_mono).and_then(move |text| { let tiles = text .render(chs, &FontStyle::new(tile_size_px.y, Color::WHITE)) .expect("Could not render the font tileset."); let mut tileset = std::collections::HashMap::new(); for (index, glyph) in chs.chars().enumerate() { let pos = (index as i32 * tile_size_px.x as i32, 0); let tile = tiles.subimage(Rectangle::new(pos, tile_size_px)); tileset.insert(glyph, tile); } Ok(tileset) })); Ok(Self { title, map, pic, player, tileset, controls, msg, display_msg, msg_asset, store, store_asset, bees, }) } // Process keyboard update the game state fn update(&mut self, window: &mut Window) -> Result<()> { use ButtonState::*; let mut curr_pos = self.player.pos; let mut moved = false; if window.keyboard()[Key::Left] == Pressed { //is down? { curr_pos.x -= 1.0; if self.map.is_on_board(curr_pos) && self.player.can_move(&self.map.get_tile(curr_pos)) { //compare tile requirements to player's items moved = true; } } if window.keyboard()[Key::Right] == Pressed { curr_pos.x += 1.0; if self.map.is_on_board(curr_pos) && self.player.can_move(&self.map.get_tile(curr_pos)) { //rewire to player bag to tile reqs ??? moved = true; } } if window.keyboard()[Key::Up] == Pressed { curr_pos.y -= 1.0; if self.map.is_on_board(curr_pos) && self.player.can_move(&self.map.get_tile(curr_pos)) { moved = true; } } if window.keyboard()[Key::Down] == Pressed { curr_pos.y += 1.0; if self.map.is_on_board(curr_pos) && self.player.can_move(&self.map.get_tile(curr_pos)) { moved = true; } } if window.keyboard()[Key::A].is_down() { self.player.money -= 10; // xxx if self.player.money < 0 { self.player.money = 0; } } if window.keyboard()[Key::S].is_down() { self.player.money += 10; // xxx } if window.keyboard()[Key::Z] == Pressed { self.player.energy -= 10; // xxx if self.player.energy < 0 { self.player.energy = 0; } } if window.keyboard()[Key::X] == Pressed { self.player.energy += 10; // xxx } if window.keyboard()[Key::W] == Pressed { if self.player.act { self.player.act = false; } else { self.player.act = true; } } //activate store window if window.keyboard()[Key::M] == Pressed { if self.store.is_active { self.store.is_active = false; } else { self.store.is_active = true; } } if window.keyboard()[Key::R] == Pressed { // xxx add rope if self.store.purchase("(R)ope", &mut self.player.money) { self.player.add_tool(&"Rope".to_string()); } } if window.keyboard()[Key::F] == Pressed { if self.store.purchase("(F)ace", &mut self.player.money) { self.player.add_tool(&"Face".to_string()); } } if window.keyboard()[Key::B] == Pressed { if self.store.purchase("(B)oat", &mut self.player.money) { self.player.add_tool(&"Boat".to_string()); } } if window.keyboard()[Key::Escape].is_down() { window.close(); } //update player if move successful if moved { if self.map.get_tile(curr_pos).ch == 'g' { self.map.win = true; // xxx ??? window.close(); // xxx end game //game won window, prompt to press esc to exit } self.player.pos = curr_pos; self.player.energy -= self.map.get_tile(curr_pos).fare; //self.map.get_mut_tile(curr_pos).seen = true; self.player.money += self.map.get_tile(curr_pos).chance_val; self.display_msg = false; self.msg.clear(); //update tiles self.map.unshroud_dis_x(curr_pos, 3); //sets tiles within range x to seen (they are displayed) //print current state to terminal // xxx disable self.dump_stats(); } else { //return missing item for display if self.player.pos != curr_pos { //if a move was attempted self.msg = self .player .satchel .compare_to_tile_reqs(&self.map.get_tile(curr_pos).reqs); //gets missing item from tile self.display_msg = true; self.dump_stats(); } } Ok(()) //ret ok void } ///draw everything fn draw(&mut self, window: &mut Window) -> Result<()> { window.clear(Color::WHITE)?; // Draw title self.title.execute(|image| { window.draw( &image .area() .with_center((window.screen_size().x as i32 / 2, 40)), Img(&image), ); Ok(()) })?; //draw image if activated if self.player.act { // xxx self.pic.execute(|image| { window.draw( &image.area().with_center(( window.screen_size().x as i32 - 100, window.screen_size().y as i32 / 2, )), Img(&image), ); Ok(()) })?; } // if won display game won ... and end or last on top of everything, prompt for esc // Draw map let tile_size_px = Vector::new(24, 24); let map_size_px = self.map.size.times(tile_size_px); let offset_px = Vector::new(50, 120); let (tileset, map, _p_pos, _p_ch) = ( &mut self.tileset, &self.map, &self.player.pos, &self.player.ch, ); tileset.execute(|tileset| { for tile in map.map.iter() { if let Some(image) = tileset.get(&tile.get_display_ch()) { let pos_px = tile.pos.times(tile_size_px); window.draw( &Rectangle::new(offset_px + pos_px, image.area().size()), Blended(&image, tile.get_display_color()), ); } } Ok(()) })?; //Draw Player let (tileset, p1) = (&mut self.tileset, &self.player); tileset.execute(|tileset| { if let Some(image) = tileset.get(&p1.ch) { let pos_px = offset_px + p1.pos.times(tile_size_px); window.draw( &Rectangle::new(pos_px, image.area().size()), Blended(&image, p1.color), ); } Ok(()) })?; //draw button controls self.controls.execute(|image| { window.draw( &image.area().with_center(( window.screen_size().x as i32 - 75, window.screen_size().y as i32 - 100, )), Img(&image), ); Ok(()) })?; //draw store ??? if self.store.is_active { self.store_asset.execute(|image| { window.draw( &image.area().with_center(( window.screen_size().x as i32 - 75, window.screen_size().y as i32 - 250, )), Img(&image), ); Ok(()) })?; } let p1 = &self.player; let max_bar = 100.0; let curr_power = p1.energy; //add checks let curr_money = p1.money; // xxx make min/max let power_bar_pos_px = offset_px + Vector::new(map_size_px.x, 0.0); let money_bar_pos_px = offset_px + Vector::new(map_size_px.x, tile_size_px.y); let inventory_pos_px = offset_px + Vector::new(map_size_px.x, tile_size_px.y * 2.0); //draw max vals shaded window.draw( &Rectangle::new(power_bar_pos_px, (max_bar, tile_size_px.y)), Col(Color::BLUE.with_alpha(0.5)), ); window.draw( &Rectangle::new(money_bar_pos_px, (max_bar, tile_size_px.y)), Col(Color::GREEN.with_alpha(0.5)), ); //draw curr values on top window.draw( &Rectangle::new(power_bar_pos_px, (curr_power, tile_size_px.y)), Col(Color::BLUE), ); window.draw( &Rectangle::new(money_bar_pos_px, (curr_money, tile_size_px.y)), Col(Color::GREEN), ); //msg alert for wasm page xxx let act_width_px = if self.display_msg { tile_size_px.x } else { 0.0 }; window.draw( &Rectangle::new( money_bar_pos_px + tile_size_px, (act_width_px, tile_size_px.y), ), Col(Color::BLUE), ); //draw inventory let font_mono = "FreeMono.ttf"; // xxx new font let mut player_bag = "Inventory:\n".to_string(); player_bag.push_str(&self.player.contents_to_string()); let mut inventory = Asset::new(Font::load(font_mono).and_then(move |font| { font.render(&player_bag, &FontStyle::new(20.0, Color::BLACK)) })); inventory.execute(|image| { window.draw( // &image.area() // .translate(inventory_pos_px), &Rectangle::new(inventory_pos_px, image.area().size()), Img(&image), ); Ok(()) })?; //draw msg, if exists let mut missing = "Missing: ".to_string(); missing.push_str(&self.msg); self.msg_asset = Asset::new( Font::load(font_mono) .and_then(move |font| font.render(&missing, &FontStyle::new(20.0, Color::BLACK))), ); if self.display_msg { self.msg_asset.execute(|image| { window.draw( &image .area() .with_center((window.screen_size().x as i32 / 2, 80)), Img(&image), ); Ok(()) })?; } //msg // draw bees on top if self.display_msg && self.player.act { self.bees.execute(|image| { window.draw( &image .area() .with_center((window.screen_size().x as i32 / 2, window.screen_size().y as i32 / 2)), Img(&image), ); Ok(()) })?; } // Ok(()) } }//impl state for game impl Game { //dump stats to terminal on move xxx pub fn dump_stats(&self) { println!( "win: {}\nPpos: {} - {}\nTpos: {} - {} id: {} seen: {}\npow: {}\nmoney: {}\n", self.map.win, self.player.pos.x, self.player.pos.y, self.map.get_tile(self.player.pos).pos.x, self.map.get_tile(self.player.pos).pos.y, self.map.get_tile(self.player.pos).id, self.map.get_tile(self.player.pos).seen, self.player.energy, self.player.money ); } }
//! # Basic Sample //! //! This sample demonstrates how to create a toplevel `window`, set its title, size and position, how to add a `button` to this `window` and how to connect signals with actions. #![crate_type = "bin"] // Third party libraries used, every possible dependency should be defined in here extern crate glib; extern crate gtk; extern crate mysql; extern crate config; // Top level modules mod gui; mod connector; fn main() { // initialize gtk library gtk::init().unwrap_or_else(|_| panic!("Failed to initialize GTK.")); // create window let window = gui::MainWindow::new(); // load components window.setup(); // show window window.show(); // run gtk event loop, essentially infinite loop gtk::main(); }
impl Solution { pub fn two_sum(nums: Vec<i32>, target: i32) -> Vec<i32> { let mut dic = std::collections::HashMap::<i32, i32>::new(); for i in 0..nums.len() { let v = nums[i]; let exp = target - v; if let Some(ix) = dic.get(&exp) { return vec![*ix, i as i32]; } dic.insert(v, i as i32); } vec![0, 0] } }
use std::io::prelude::*; use std::fs::File; use std::env; use std::io::BufReader; use std::time::Instant; fn main() { let args: Vec<String> = env::args().collect(); if args.len() == 1 { println!("No file specified."); } else { // let beginning = PreciseTime::now(); let beginning = Instant::now(); for a in 1..args.len() { let arg = &args[a]; let f = File::open(arg).expect("Unable to open file"); let r = BufReader::new(f); let start = Instant::now(); let mut t = 0; let mut entropy: f32 = 0.0; let mut histogram = [0; 256]; for b in r.bytes() { histogram.get_mut(b.unwrap() as usize).map(|v| *v += 1); t += 1; } for i in 0..256 { if histogram[i] > 0 { let ratio = (histogram[i] as f32 / t as f32) as f32; entropy -= (ratio * ratio.log2()) as f32; } } let end = start.elapsed(); println!("File {} entropy: {}% in {:?} seconds", a, entropy/8.0*100.0, end); } let ending = beginning.elapsed(); println!("Exec time: {:?}", ending); } }
use gobble::*; use std::collections::BTreeMap; use std::io::Write; fn p_int() -> impl Parser<i64> { maybe(s_tag("-")) .then(read_fs(is_num, 1)) .try_map(|(neg, ns)| { let mut n = ns .parse::<i64>() .map_err(|_| ECode::SMess("Too long int"))?; if neg.is_some() { n = -n } Ok(n) }) } fn parse_dice() -> impl Parser<Vec<Vec<i64>>> { repeat_until( maybe(p_int()) .then_ig(s_tag("[")) .then(sep_until(p_int(), s_tag(","), s_tag("]"))), s_(eoi), ) .map(|v| { let mut res = Vec::new(); for (nop, ar) in v { match nop { Some(n) => { for _ in 0..n { res.push(ar.clone()); } } _ => res.push(ar), } } res }) } fn main() { let stdin = std::io::stdin(); loop { print!(">>"); std::io::stdout().flush().ok(); let mut s = String::new(); match stdin.read_line(&mut s) { Ok(0) => { println!("All done"); return; } _ => {} } match parse_dice().parse_s(&s.trim()) { Ok(r) => { println!("Parsed dice = {:?}", r); let p = calc_probs(&r); print_probabilities(&p); //println!("probabilities = {:?}", p); } Err(e) => println!("Err parsing dice: {:?}", e), } } //println!("Hello, world!"); } pub fn calc_probs(v: &[Vec<i64>]) -> BTreeMap<i64, i64> { let mut cmap = BTreeMap::new(); cmap.insert(0, 1); for d in v { let mut m2 = BTreeMap::new(); for (k, v) in &cmap { for roll in d { let added = *k + *roll; let prev = *(m2.get(&added).unwrap_or(&0)); m2.insert(added, prev + v); } } cmap = m2; } cmap } pub fn print_probabilities(b: &BTreeMap<i64, i64>) { let tot_p = b.values().fold(0, |n, v| n + v); println!("Tot options = {}", tot_p); for (k, v) in b { let pcent = 100. * (*v as f64) / (tot_p as f64); let mut at_least = 0; for (k2, v2) in b { if k2 >= k { at_least += v2 } } let ls_pcent = 100. * (at_least as f64) / (tot_p as f64); println!( "ex {} : {}/{} = {:.2}\t\tmin {0} : {}/{2} = {:.2}", k, v, tot_p, pcent, at_least, ls_pcent ); } }
use quote::quote; use syn::{ parse::{Parse, ParseStream}, parse_macro_input, spanned::Spanned, Ident, Item, ItemImpl, ItemStruct, LitStr, Token, }; struct Parsed { items: Vec<Item>, } impl Parse for Parsed { fn parse(input: ParseStream) -> syn::parse::Result<Self> { let mut items = Vec::new(); while !input.is_empty() { items.push(input.parse()?); } Ok(Self { items }) } } pub fn parse_and_build(input: proc_macro::TokenStream, with_main: bool) -> proc_macro::TokenStream { let Parsed { items } = parse_macro_input!(input as Parsed); crate::error::wrap(match process(items) { Ok((ts, class_name)) => { if with_main { match ext_main_classes(&[class_name]) { Ok(m) => Ok(quote! { #ts #m } .into()), Err(e) => Err(e), } } else { Ok(ts.into()) } } Err(e) => Err(e), }) } pub fn ext_main(tokens: proc_macro2::TokenStream) -> syn::Result<proc_macro2::TokenStream> { Ok(quote! { #[no_mangle] pub unsafe extern "C" fn ext_main(_r: *mut ::std::ffi::c_void) { if std::panic::catch_unwind(|| { #tokens }).is_err() { std::process::exit(1); } } } .into()) } pub fn ext_main_classes(class_names: &[Ident]) -> syn::Result<proc_macro2::TokenStream> { let register: Vec<_> = class_names .iter() .map(|n| quote! { #n::register() }) .collect(); Ok(quote! { #[no_mangle] pub unsafe extern "C" fn ext_main(_r: *mut ::std::ffi::c_void) { if std::panic::catch_unwind(|| { #(#register)* }).is_err() { std::process::exit(1); } } } .into()) } struct StructDetails { the_struct: ItemStruct, class_name: Ident, class_alias: String, } //an attribute to specify the name of the class struct ClassNameArgs { pub name: LitStr, } impl Parse for ClassNameArgs { fn parse(input: ParseStream) -> syn::parse::Result<Self> { let _: Token![=] = input.parse()?; let name: LitStr = input.parse()?; Ok(Self { name }) } } fn process_struct(mut s: ItemStruct) -> syn::Result<StructDetails> { let class_name = s.ident.clone(); let mut class_alias = class_name.to_string().to_lowercase(); //find name attribute and remove it if let Some(pos) = s.attrs.iter().position(|a| { a.path .segments .last() .expect("the attribute path to have at least 1 segment") .ident == "name" }) { let a = s.attrs.remove(pos); let n: ClassNameArgs = syn::parse2(a.tokens.clone())?; class_alias = n.name.value(); } Ok(StructDetails { the_struct: s, class_name, class_alias, }) } struct ImplDetails { wrapper_type: Ident, processed_impls: Vec<ItemImpl>, } fn process_impls( the_struct: &ItemStruct, class_name: &Ident, impls: Vec<ItemImpl>, ) -> syn::Result<ImplDetails> { let mut processed_impls = Vec::new(); let mut the_impl = None; let mut wrapper_type = None; for i in impls { if let Some((_, path, _)) = &i.trait_ { let t = path.segments.last().unwrap().ident.clone(); if t == "MaxObjWrapped" { wrapper_type = Some(Ident::new(&"MaxObjWrapper", the_struct.span())); the_impl = Some(i); continue; } else if t == "MSPObjWrapped" { wrapper_type = Some(Ident::new(&"MSPObjWrapper", the_struct.span())); the_impl = Some(i); continue; } } processed_impls.push(i); } let wrapper_type = wrapper_type.ok_or(syn::Error::new( the_struct.span(), "Failed to find MaxObjWrapper or MSPObjWrapper", ))?; //find class_setup, if it exists let mut the_impl = the_impl.unwrap(); let mut class_setup = None; if let Some(pos) = the_impl.items.iter().position(|item| { if let syn::ImplItem::Method(m) = item { if m.sig.ident == "class_setup" { class_setup = Some(m.clone()); true } else { false } } else { false } }) { let _ = the_impl.items.remove(pos); }; let mut class_setup: syn::ImplItemMethod = class_setup.unwrap_or_else(|| { syn::parse( quote! { fn class_setup(c: &mut ::median::class::Class<::median::wrapper::#wrapper_type<Self>>) { } } .into(), ) .expect("to parse as method") }); //get the var "c" from class setup let class_setup_class_var = match class_setup.sig.inputs.first().unwrap() { syn::FnArg::Receiver(_) => panic!("failed"), syn::FnArg::Typed(t) => { if let syn::Pat::Ident(i) = t.pat.as_ref() { i.clone() } else { panic!("failed to get ident"); } } }; //get the setup method the_impl.items = the_impl .items .iter() .map(|item| match item { syn::ImplItem::Method(m) => syn::ImplItem::Method(m.clone()), _ => item.clone(), }) .collect(); //process methods for attributes, add Type if needed { let attr_add_type = |a: &mut syn::Attribute| { //add the wrapper type to the attribute a.tokens = quote! { (::median::wrapper::#wrapper_type::<#class_name>) }; }; for imp in &mut processed_impls { imp.items = imp .items .iter() .map(|item| match item { syn::ImplItem::Method(m) => { let mut m = m.clone(); //find any attributes that end with "tramp" and don't have any tokens //(tokens is the part after the attribute name, including parens) if let Some(pos) = m.attrs.iter().position(|a| { a.tokens.is_empty() && a.path .segments .last() .expect("attribute path to have at least 1 segment") .ident .to_string() .ends_with("tramp") }) { let mut a = m.attrs.remove(pos).clone(); attr_add_type(&mut a); m.attrs.push(a); }; //create automatic method mappings for (attr_name, var_name, attr_new_name) in &[ ("bang", "Bang", "tramp"), ("int", "Int", "tramp"), ("float", "Float", "tramp"), ("sym", "Symbol", "tramp"), ("list", "List", "list_tramp"), ("any", "Anything", "sel_list_tramp"), ] { if let Some(pos) = m.attrs.iter().position(|a| { a.path .segments .last() .expect("attribute path to have at least 1 segment") .ident == attr_name }) { //create a tramp and register the method let mut a = m.attrs.remove(pos).clone(); a.path = syn::parse_str(&format!("::median::wrapper::{}", attr_new_name)).expect("to make tramp"); attr_add_type(&mut a); let tramp_name = std::format!("{}_tramp", m.sig.ident); let tramp_name = Ident::new(tramp_name.as_str(), m.span()); let var_name = Ident::new(var_name, a.span()); class_setup.block.stmts.push( syn::parse( quote! { #class_setup_class_var.add_method(median::method::Method::#var_name(Self::#tramp_name)).unwrap(); }.into() ).expect("to create a statement")); m.attrs.push(a); }; } syn::ImplItem::Method(m) } _ => item.clone(), }) .collect(); } } the_impl.items.push(syn::ImplItem::Method(class_setup)); processed_impls.push(the_impl); Ok(ImplDetails { wrapper_type, processed_impls, }) } fn process(items: Vec<Item>) -> syn::Result<(proc_macro2::TokenStream, Ident)> { let mut impls = Vec::new(); let mut the_struct = None; let mut remain = Vec::new(); let mut has_obj_wrapped = false; for item in items.iter() { match item { Item::Struct(i) => { if the_struct.is_some() { return Err(syn::Error::new(i.span(), "only one wrapped struct allowed")); } the_struct = Some(i); } Item::Impl(i) => { //see if ObjWrapped is already implemented so we don't double impl match &i.trait_ { Some((_, path, _)) => { if let Some(l) = path.segments.last() { if l.ident == "ObjWrapped" { has_obj_wrapped = true; } } } _ => (), } impls.push(i.clone()); } _ => remain.push(item), } } //process the struct, getting the names let StructDetails { the_struct, class_name, class_alias, } = process_struct(the_struct.unwrap().clone())?; //process the impls, getting the wrapper type let ImplDetails { wrapper_type, processed_impls: impls, } = process_impls(&the_struct, &class_name, impls)?; let mut out = quote! { #the_struct impl #class_name { /// Register your wrapped class with Max pub(crate) unsafe fn register() { ::median::wrapper::#wrapper_type::<#class_name>::register(false) } } #(#impls)* #(#remain)* }; if !has_obj_wrapped { let max_class_name = LitStr::new(&class_alias, the_struct.span()); out = quote! { #out impl ::median::wrapper::ObjWrapped<#class_name> for #class_name { fn class_name() -> &'static str { &#max_class_name } } }; } Ok((out.into(), class_name)) }
// Copyright 2019-2020 PolkaX. Licensed under MIT or Apache-2.0. /// Type alias to use this library's [`BlockFormatError`] type in a `Result`. pub type Result<T> = std::result::Result<T, BlockFormatError>; /// Errors generated from this library. #[derive(Debug, thiserror::Error)] pub enum BlockFormatError { /// The data of block is not match given hash. #[error("data is not match given hash, fst: {0:?}, snd: {1:?}")] WrongHash(Vec<u8>, Vec<u8>), /// Cid error. #[error("cid error: {0}")] CidError(#[from] cid::Error), /// Other type error. #[error("other err: {0}")] Other(#[from] Box<dyn std::error::Error + Send + Sync>), }
#![recursion_limit = "1024"] extern crate rss; #[macro_use] extern crate error_chain; mod errors { // Create the Error, ErrorKind, ResultExt, and Result types error_chain!{} } error_chain!{ foreign_links { Fmt(::std::fmt::Error); Io(::std::io::Error) #[cfg(unix)]; //Reqwest(reqwest::Error); Rss(rss::Error); } } use rss::{Channel, Item}; use std::convert::From; use std::process::Command; impl From<Item> for Episode{ fn from(item: Item) -> Episode{ //println!("{:?}", item)c let show_name :Option<&str>= item.extensions().get("tv") .and_then(|m| m.get("show_name")) .and_then(|vec| vec.into_iter().last().and_then(|e| e.value())); let link = item.link().map(String::from).map_or_else(|| Vec::new(), |link| vec![link]); let e: Episode = Episode{title:item.title().map(String::from ), show_name: show_name.map(String::from), magnet_links: link, ..Default::default()}; e } } #[derive(Default, Debug)] struct Episode{ show_name: Option<String>, title: Option<String>, magnet_links: Vec<String>, http_links: Vec<String> } use std::io::{self}; fn main() { let channel = Channel::from_url("http://showrss.info/user/105107.rss?magnets=true&namespaces=true&name=null&re=null").unwrap(); let items = channel.into_items(); let episodes :Vec<Episode> = items.into_iter().map(|x| Episode::from(x)).collect(); for (i, ep) in episodes.iter().enumerate(){ println!("{:?} {:?}", i, ep.title); } println!("select ep to stream!"); let mut input = String::new(); match io::stdin().read_line(&mut input) { Ok(_) => { let selector = input.trim().parse::<u32>().unwrap(); let selected = episodes.get(selector as usize).unwrap(); let link :&str= selected.magnet_links.last().unwrap(); println!("piping to iina {:?}", link); let the_output = Command::new("webtorrent") .args(&[link, "--iina"]) .output() .ok() .expect("failed to execute process"); let encoded = String::from_utf8_lossy(the_output.stdout.as_slice()); print!("{}", encoded); } Err(error) => println!("error: {}", error), } }
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtCore/qlocale.h // dst-file: /src/core/qlocale.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::qstring::*; // 773 use super::qchar::*; // 773 use super::qdatetime::*; // 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 QLocale_Class_Size() -> c_int; // proto: QString QLocale::pmText(); fn C_ZNK7QLocale6pmTextEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString QLocale::nativeLanguageName(); fn C_ZNK7QLocale18nativeLanguageNameEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString QLocale::toLower(const QString & str); fn C_ZNK7QLocale7toLowerERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: QChar QLocale::zeroDigit(); fn C_ZNK7QLocale9zeroDigitEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString QLocale::name(); fn C_ZNK7QLocale4nameEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString QLocale::toCurrencyString(qlonglong , const QString & symbol); fn C_ZNK7QLocale16toCurrencyStringExRK7QString(qthis: u64 /* *mut c_void*/, arg0: c_longlong, arg1: *mut c_void) -> *mut c_void; // proto: float QLocale::toFloat(const QString & s, bool * ok); fn C_ZNK7QLocale7toFloatERK7QStringPb(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_char) -> c_float; // proto: static QLocale QLocale::c(); fn C_ZN7QLocale1cEv() -> *mut c_void; // proto: QString QLocale::toCurrencyString(uint , const QString & symbol); fn C_ZNK7QLocale16toCurrencyStringEjRK7QString(qthis: u64 /* *mut c_void*/, arg0: c_uint, arg1: *mut c_void) -> *mut c_void; // proto: QString QLocale::createSeparatedList(const QStringList & strl); fn C_ZNK7QLocale19createSeparatedListERK11QStringList(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: uint QLocale::toUInt(const QString & s, bool * ok); fn C_ZNK7QLocale6toUIntERK7QStringPb(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_char) -> c_uint; // proto: QChar QLocale::decimalPoint(); fn C_ZNK7QLocale12decimalPointEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QChar QLocale::positiveSign(); fn C_ZNK7QLocale12positiveSignEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: qlonglong QLocale::toLongLong(const QString & s, bool * ok); fn C_ZNK7QLocale10toLongLongERK7QStringPb(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_char) -> c_longlong; // proto: short QLocale::toShort(const QString & s, bool * ok); fn C_ZNK7QLocale7toShortERK7QStringPb(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_char) -> c_short; // proto: QString QLocale::toString(float i, char f, int prec); fn C_ZNK7QLocale8toStringEfci(qthis: u64 /* *mut c_void*/, arg0: c_float, arg1: c_char, arg2: c_int) -> *mut c_void; // proto: QString QLocale::toString(const QDateTime & dateTime, const QString & format); fn C_ZNK7QLocale8toStringERK9QDateTimeRK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void) -> *mut c_void; // proto: QDateTime QLocale::toDateTime(const QString & string, const QString & format); fn C_ZNK7QLocale10toDateTimeERK7QStringS2_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void) -> *mut c_void; // proto: QString QLocale::toCurrencyString(short , const QString & symbol); fn C_ZNK7QLocale16toCurrencyStringEsRK7QString(qthis: u64 /* *mut c_void*/, arg0: c_short, arg1: *mut c_void) -> *mut c_void; // proto: QChar QLocale::groupSeparator(); fn C_ZNK7QLocale14groupSeparatorEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString QLocale::toCurrencyString(double , const QString & symbol); fn C_ZNK7QLocale16toCurrencyStringEdRK7QString(qthis: u64 /* *mut c_void*/, arg0: c_double, arg1: *mut c_void) -> *mut c_void; // proto: QString QLocale::toCurrencyString(qulonglong , const QString & symbol); fn C_ZNK7QLocale16toCurrencyStringEyRK7QString(qthis: u64 /* *mut c_void*/, arg0: c_ulonglong, arg1: *mut c_void) -> *mut c_void; // proto: void QLocale::QLocale(const QString & name); fn C_ZN7QLocaleC2ERK7QString(arg0: *mut c_void) -> u64; // proto: QString QLocale::toString(const QTime & time, const QString & formatStr); fn C_ZNK7QLocale8toStringERK5QTimeRK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void) -> *mut c_void; // proto: QDate QLocale::toDate(const QString & string, const QString & format); fn C_ZNK7QLocale6toDateERK7QStringS2_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void) -> *mut c_void; // proto: QString QLocale::nativeCountryName(); fn C_ZNK7QLocale17nativeCountryNameEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QChar QLocale::negativeSign(); fn C_ZNK7QLocale12negativeSignEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QLocale::~QLocale(); fn C_ZN7QLocaleD2Ev(qthis: u64 /* *mut c_void*/); // proto: void QLocale::QLocale(const QLocale & other); fn C_ZN7QLocaleC2ERKS_(arg0: *mut c_void) -> u64; // proto: QString QLocale::toString(const QDate & date, const QString & formatStr); fn C_ZNK7QLocale8toStringERK5QDateRK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void) -> *mut c_void; // proto: QString QLocale::toUpper(const QString & str); fn C_ZNK7QLocale7toUpperERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: QChar QLocale::percent(); fn C_ZNK7QLocale7percentEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: qulonglong QLocale::toULongLong(const QString & s, bool * ok); fn C_ZNK7QLocale11toULongLongERK7QStringPb(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_char) -> c_ulonglong; // proto: QString QLocale::toString(double i, char f, int prec); fn C_ZNK7QLocale8toStringEdci(qthis: u64 /* *mut c_void*/, arg0: c_double, arg1: c_char, arg2: c_int) -> *mut c_void; // proto: QStringList QLocale::uiLanguages(); fn C_ZNK7QLocale11uiLanguagesEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString QLocale::bcp47Name(); fn C_ZNK7QLocale9bcp47NameEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QTime QLocale::toTime(const QString & string, const QString & format); fn C_ZNK7QLocale6toTimeERK7QStringS2_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void) -> *mut c_void; // proto: ushort QLocale::toUShort(const QString & s, bool * ok); fn C_ZNK7QLocale8toUShortERK7QStringPb(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_char) -> c_ushort; // proto: QString QLocale::toCurrencyString(ushort , const QString & symbol); fn C_ZNK7QLocale16toCurrencyStringEtRK7QString(qthis: u64 /* *mut c_void*/, arg0: c_ushort, arg1: *mut c_void) -> *mut c_void; // proto: double QLocale::toDouble(const QString & s, bool * ok); fn C_ZNK7QLocale8toDoubleERK7QStringPb(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_char) -> c_double; // proto: static QLocale QLocale::system(); fn C_ZN7QLocale6systemEv() -> *mut c_void; // proto: static void QLocale::setDefault(const QLocale & locale); fn C_ZN7QLocale10setDefaultERKS_(arg0: *mut c_void); // proto: QChar QLocale::exponential(); fn C_ZNK7QLocale11exponentialEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString QLocale::toCurrencyString(float , const QString & symbol); fn C_ZNK7QLocale16toCurrencyStringEfRK7QString(qthis: u64 /* *mut c_void*/, arg0: c_float, arg1: *mut c_void) -> *mut c_void; // proto: QString QLocale::toString(int i); fn C_ZNK7QLocale8toStringEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: QString QLocale::toString(uint i); fn C_ZNK7QLocale8toStringEj(qthis: u64 /* *mut c_void*/, arg0: c_uint) -> *mut c_void; // proto: QString QLocale::toString(qlonglong i); fn C_ZNK7QLocale8toStringEx(qthis: u64 /* *mut c_void*/, arg0: c_longlong) -> *mut c_void; // proto: QString QLocale::toString(qulonglong i); fn C_ZNK7QLocale8toStringEy(qthis: u64 /* *mut c_void*/, arg0: c_ulonglong) -> *mut c_void; // proto: QString QLocale::toString(ushort i); fn C_ZNK7QLocale8toStringEt(qthis: u64 /* *mut c_void*/, arg0: c_ushort) -> *mut c_void; // proto: QString QLocale::amText(); fn C_ZNK7QLocale6amTextEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QString QLocale::toCurrencyString(int , const QString & symbol); fn C_ZNK7QLocale16toCurrencyStringEiRK7QString(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void) -> *mut c_void; // proto: QString QLocale::toString(short i); fn C_ZNK7QLocale8toStringEs(qthis: u64 /* *mut c_void*/, arg0: c_short) -> *mut c_void; // proto: void QLocale::QLocale(); fn C_ZN7QLocaleC2Ev() -> u64; // proto: int QLocale::toInt(const QString & s, bool * ok); fn C_ZNK7QLocale5toIntERK7QStringPb(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_char) -> c_int; } // <= ext block end // body block begin => // class sizeof(QLocale)=1 #[derive(Default)] pub struct QLocale { // qbase: None, pub qclsinst: u64 /* *mut c_void*/, } impl /*struct*/ QLocale { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QLocale { return QLocale{qclsinst: qthis, ..Default::default()}; } } // proto: QString QLocale::pmText(); impl /*struct*/ QLocale { pub fn pmText<RetType, T: QLocale_pmText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.pmText(self); // return 1; } } pub trait QLocale_pmText<RetType> { fn pmText(self , rsthis: & QLocale) -> RetType; } // proto: QString QLocale::pmText(); impl<'a> /*trait*/ QLocale_pmText<QString> for () { fn pmText(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale6pmTextEv()}; let mut ret = unsafe {C_ZNK7QLocale6pmTextEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::nativeLanguageName(); impl /*struct*/ QLocale { pub fn nativeLanguageName<RetType, T: QLocale_nativeLanguageName<RetType>>(& self, overload_args: T) -> RetType { return overload_args.nativeLanguageName(self); // return 1; } } pub trait QLocale_nativeLanguageName<RetType> { fn nativeLanguageName(self , rsthis: & QLocale) -> RetType; } // proto: QString QLocale::nativeLanguageName(); impl<'a> /*trait*/ QLocale_nativeLanguageName<QString> for () { fn nativeLanguageName(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale18nativeLanguageNameEv()}; let mut ret = unsafe {C_ZNK7QLocale18nativeLanguageNameEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::toLower(const QString & str); impl /*struct*/ QLocale { pub fn toLower<RetType, T: QLocale_toLower<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toLower(self); // return 1; } } pub trait QLocale_toLower<RetType> { fn toLower(self , rsthis: & QLocale) -> RetType; } // proto: QString QLocale::toLower(const QString & str); impl<'a> /*trait*/ QLocale_toLower<QString> for (&'a QString) { fn toLower(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale7toLowerERK7QString()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale7toLowerERK7QString(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QChar QLocale::zeroDigit(); impl /*struct*/ QLocale { pub fn zeroDigit<RetType, T: QLocale_zeroDigit<RetType>>(& self, overload_args: T) -> RetType { return overload_args.zeroDigit(self); // return 1; } } pub trait QLocale_zeroDigit<RetType> { fn zeroDigit(self , rsthis: & QLocale) -> RetType; } // proto: QChar QLocale::zeroDigit(); impl<'a> /*trait*/ QLocale_zeroDigit<QChar> for () { fn zeroDigit(self , rsthis: & QLocale) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale9zeroDigitEv()}; let mut ret = unsafe {C_ZNK7QLocale9zeroDigitEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::name(); impl /*struct*/ QLocale { pub fn name<RetType, T: QLocale_name<RetType>>(& self, overload_args: T) -> RetType { return overload_args.name(self); // return 1; } } pub trait QLocale_name<RetType> { fn name(self , rsthis: & QLocale) -> RetType; } // proto: QString QLocale::name(); impl<'a> /*trait*/ QLocale_name<QString> for () { fn name(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale4nameEv()}; let mut ret = unsafe {C_ZNK7QLocale4nameEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::toCurrencyString(qlonglong , const QString & symbol); impl /*struct*/ QLocale { pub fn toCurrencyString<RetType, T: QLocale_toCurrencyString<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toCurrencyString(self); // return 1; } } pub trait QLocale_toCurrencyString<RetType> { fn toCurrencyString(self , rsthis: & QLocale) -> RetType; } // proto: QString QLocale::toCurrencyString(qlonglong , const QString & symbol); impl<'a> /*trait*/ QLocale_toCurrencyString<QString> for (i64, Option<&'a QString>) { fn toCurrencyString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale16toCurrencyStringExRK7QString()}; let arg0 = self.0 as c_longlong; let arg1 = (if self.1.is_none() {QString::new(()).qclsinst} else {self.1.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale16toCurrencyStringExRK7QString(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: float QLocale::toFloat(const QString & s, bool * ok); impl /*struct*/ QLocale { pub fn toFloat<RetType, T: QLocale_toFloat<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toFloat(self); // return 1; } } pub trait QLocale_toFloat<RetType> { fn toFloat(self , rsthis: & QLocale) -> RetType; } // proto: float QLocale::toFloat(const QString & s, bool * ok); impl<'a> /*trait*/ QLocale_toFloat<f32> for (&'a QString, Option<&'a mut Vec<i8>>) { fn toFloat(self , rsthis: & QLocale) -> f32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale7toFloatERK7QStringPb()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {0 as *const i8} else {self.1.unwrap().as_ptr()}) as *mut c_char; let mut ret = unsafe {C_ZNK7QLocale7toFloatERK7QStringPb(rsthis.qclsinst, arg0, arg1)}; return ret as f32; // 1 // return 1; } } // proto: static QLocale QLocale::c(); impl /*struct*/ QLocale { pub fn c_s<RetType, T: QLocale_c_s<RetType>>( overload_args: T) -> RetType { return overload_args.c_s(); // return 1; } } pub trait QLocale_c_s<RetType> { fn c_s(self ) -> RetType; } // proto: static QLocale QLocale::c(); impl<'a> /*trait*/ QLocale_c_s<QLocale> for () { fn c_s(self ) -> QLocale { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QLocale1cEv()}; let mut ret = unsafe {C_ZN7QLocale1cEv()}; let mut ret1 = QLocale::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::toCurrencyString(uint , const QString & symbol); impl<'a> /*trait*/ QLocale_toCurrencyString<QString> for (u32, Option<&'a QString>) { fn toCurrencyString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale16toCurrencyStringEjRK7QString()}; let arg0 = self.0 as c_uint; let arg1 = (if self.1.is_none() {QString::new(()).qclsinst} else {self.1.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale16toCurrencyStringEjRK7QString(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::createSeparatedList(const QStringList & strl); impl /*struct*/ QLocale { pub fn createSeparatedList<RetType, T: QLocale_createSeparatedList<RetType>>(& self, overload_args: T) -> RetType { return overload_args.createSeparatedList(self); // return 1; } } pub trait QLocale_createSeparatedList<RetType> { fn createSeparatedList(self , rsthis: & QLocale) -> RetType; } // proto: QString QLocale::createSeparatedList(const QStringList & strl); impl<'a> /*trait*/ QLocale_createSeparatedList<QString> for (&'a QStringList) { fn createSeparatedList(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale19createSeparatedListERK11QStringList()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale19createSeparatedListERK11QStringList(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: uint QLocale::toUInt(const QString & s, bool * ok); impl /*struct*/ QLocale { pub fn toUInt<RetType, T: QLocale_toUInt<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toUInt(self); // return 1; } } pub trait QLocale_toUInt<RetType> { fn toUInt(self , rsthis: & QLocale) -> RetType; } // proto: uint QLocale::toUInt(const QString & s, bool * ok); impl<'a> /*trait*/ QLocale_toUInt<u32> for (&'a QString, Option<&'a mut Vec<i8>>) { fn toUInt(self , rsthis: & QLocale) -> u32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale6toUIntERK7QStringPb()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {0 as *const i8} else {self.1.unwrap().as_ptr()}) as *mut c_char; let mut ret = unsafe {C_ZNK7QLocale6toUIntERK7QStringPb(rsthis.qclsinst, arg0, arg1)}; return ret as u32; // 1 // return 1; } } // proto: QChar QLocale::decimalPoint(); impl /*struct*/ QLocale { pub fn decimalPoint<RetType, T: QLocale_decimalPoint<RetType>>(& self, overload_args: T) -> RetType { return overload_args.decimalPoint(self); // return 1; } } pub trait QLocale_decimalPoint<RetType> { fn decimalPoint(self , rsthis: & QLocale) -> RetType; } // proto: QChar QLocale::decimalPoint(); impl<'a> /*trait*/ QLocale_decimalPoint<QChar> for () { fn decimalPoint(self , rsthis: & QLocale) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale12decimalPointEv()}; let mut ret = unsafe {C_ZNK7QLocale12decimalPointEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QChar QLocale::positiveSign(); impl /*struct*/ QLocale { pub fn positiveSign<RetType, T: QLocale_positiveSign<RetType>>(& self, overload_args: T) -> RetType { return overload_args.positiveSign(self); // return 1; } } pub trait QLocale_positiveSign<RetType> { fn positiveSign(self , rsthis: & QLocale) -> RetType; } // proto: QChar QLocale::positiveSign(); impl<'a> /*trait*/ QLocale_positiveSign<QChar> for () { fn positiveSign(self , rsthis: & QLocale) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale12positiveSignEv()}; let mut ret = unsafe {C_ZNK7QLocale12positiveSignEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: qlonglong QLocale::toLongLong(const QString & s, bool * ok); impl /*struct*/ QLocale { pub fn toLongLong<RetType, T: QLocale_toLongLong<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toLongLong(self); // return 1; } } pub trait QLocale_toLongLong<RetType> { fn toLongLong(self , rsthis: & QLocale) -> RetType; } // proto: qlonglong QLocale::toLongLong(const QString & s, bool * ok); impl<'a> /*trait*/ QLocale_toLongLong<i64> for (&'a QString, Option<&'a mut Vec<i8>>) { fn toLongLong(self , rsthis: & QLocale) -> i64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale10toLongLongERK7QStringPb()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {0 as *const i8} else {self.1.unwrap().as_ptr()}) as *mut c_char; let mut ret = unsafe {C_ZNK7QLocale10toLongLongERK7QStringPb(rsthis.qclsinst, arg0, arg1)}; return ret as i64; // 1 // return 1; } } // proto: short QLocale::toShort(const QString & s, bool * ok); impl /*struct*/ QLocale { pub fn toShort<RetType, T: QLocale_toShort<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toShort(self); // return 1; } } pub trait QLocale_toShort<RetType> { fn toShort(self , rsthis: & QLocale) -> RetType; } // proto: short QLocale::toShort(const QString & s, bool * ok); impl<'a> /*trait*/ QLocale_toShort<i16> for (&'a QString, Option<&'a mut Vec<i8>>) { fn toShort(self , rsthis: & QLocale) -> i16 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale7toShortERK7QStringPb()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {0 as *const i8} else {self.1.unwrap().as_ptr()}) as *mut c_char; let mut ret = unsafe {C_ZNK7QLocale7toShortERK7QStringPb(rsthis.qclsinst, arg0, arg1)}; return ret as i16; // 1 // return 1; } } // proto: QString QLocale::toString(float i, char f, int prec); impl /*struct*/ QLocale { pub fn toString<RetType, T: QLocale_toString<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toString(self); // return 1; } } pub trait QLocale_toString<RetType> { fn toString(self , rsthis: & QLocale) -> RetType; } // proto: QString QLocale::toString(float i, char f, int prec); impl<'a> /*trait*/ QLocale_toString<QString> for (f32, Option<i8>, Option<i32>) { fn toString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale8toStringEfci()}; let arg0 = self.0 as c_float; let arg1 = (if self.1.is_none() {'g' as i8} else {self.1.unwrap()}) as c_char; let arg2 = (if self.2.is_none() {6} else {self.2.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK7QLocale8toStringEfci(rsthis.qclsinst, arg0, arg1, arg2)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::toString(const QDateTime & dateTime, const QString & format); impl<'a> /*trait*/ QLocale_toString<QString> for (&'a QDateTime, &'a QString) { fn toString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale8toStringERK9QDateTimeRK7QString()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale8toStringERK9QDateTimeRK7QString(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QDateTime QLocale::toDateTime(const QString & string, const QString & format); impl /*struct*/ QLocale { pub fn toDateTime<RetType, T: QLocale_toDateTime<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toDateTime(self); // return 1; } } pub trait QLocale_toDateTime<RetType> { fn toDateTime(self , rsthis: & QLocale) -> RetType; } // proto: QDateTime QLocale::toDateTime(const QString & string, const QString & format); impl<'a> /*trait*/ QLocale_toDateTime<QDateTime> for (&'a QString, &'a QString) { fn toDateTime(self , rsthis: & QLocale) -> QDateTime { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale10toDateTimeERK7QStringS2_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale10toDateTimeERK7QStringS2_(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QDateTime::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::toCurrencyString(short , const QString & symbol); impl<'a> /*trait*/ QLocale_toCurrencyString<QString> for (i16, Option<&'a QString>) { fn toCurrencyString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale16toCurrencyStringEsRK7QString()}; let arg0 = self.0 as c_short; let arg1 = (if self.1.is_none() {QString::new(()).qclsinst} else {self.1.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale16toCurrencyStringEsRK7QString(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QChar QLocale::groupSeparator(); impl /*struct*/ QLocale { pub fn groupSeparator<RetType, T: QLocale_groupSeparator<RetType>>(& self, overload_args: T) -> RetType { return overload_args.groupSeparator(self); // return 1; } } pub trait QLocale_groupSeparator<RetType> { fn groupSeparator(self , rsthis: & QLocale) -> RetType; } // proto: QChar QLocale::groupSeparator(); impl<'a> /*trait*/ QLocale_groupSeparator<QChar> for () { fn groupSeparator(self , rsthis: & QLocale) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale14groupSeparatorEv()}; let mut ret = unsafe {C_ZNK7QLocale14groupSeparatorEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::toCurrencyString(double , const QString & symbol); impl<'a> /*trait*/ QLocale_toCurrencyString<QString> for (f64, Option<&'a QString>) { fn toCurrencyString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale16toCurrencyStringEdRK7QString()}; let arg0 = self.0 as c_double; let arg1 = (if self.1.is_none() {QString::new(()).qclsinst} else {self.1.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale16toCurrencyStringEdRK7QString(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::toCurrencyString(qulonglong , const QString & symbol); impl<'a> /*trait*/ QLocale_toCurrencyString<QString> for (u64, Option<&'a QString>) { fn toCurrencyString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale16toCurrencyStringEyRK7QString()}; let arg0 = self.0 as c_ulonglong; let arg1 = (if self.1.is_none() {QString::new(()).qclsinst} else {self.1.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale16toCurrencyStringEyRK7QString(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QLocale::QLocale(const QString & name); impl /*struct*/ QLocale { pub fn new<T: QLocale_new>(value: T) -> QLocale { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QLocale_new { fn new(self) -> QLocale; } // proto: void QLocale::QLocale(const QString & name); impl<'a> /*trait*/ QLocale_new for (&'a QString) { fn new(self) -> QLocale { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QLocaleC2ERK7QString()}; let ctysz: c_int = unsafe{QLocale_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_ZN7QLocaleC2ERK7QString(arg0)}; let rsthis = QLocale{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: QString QLocale::toString(const QTime & time, const QString & formatStr); impl<'a> /*trait*/ QLocale_toString<QString> for (&'a QTime, &'a QString) { fn toString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale8toStringERK5QTimeRK7QString()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale8toStringERK5QTimeRK7QString(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QDate QLocale::toDate(const QString & string, const QString & format); impl /*struct*/ QLocale { pub fn toDate<RetType, T: QLocale_toDate<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toDate(self); // return 1; } } pub trait QLocale_toDate<RetType> { fn toDate(self , rsthis: & QLocale) -> RetType; } // proto: QDate QLocale::toDate(const QString & string, const QString & format); impl<'a> /*trait*/ QLocale_toDate<QDate> for (&'a QString, &'a QString) { fn toDate(self , rsthis: & QLocale) -> QDate { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale6toDateERK7QStringS2_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale6toDateERK7QStringS2_(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QDate::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::nativeCountryName(); impl /*struct*/ QLocale { pub fn nativeCountryName<RetType, T: QLocale_nativeCountryName<RetType>>(& self, overload_args: T) -> RetType { return overload_args.nativeCountryName(self); // return 1; } } pub trait QLocale_nativeCountryName<RetType> { fn nativeCountryName(self , rsthis: & QLocale) -> RetType; } // proto: QString QLocale::nativeCountryName(); impl<'a> /*trait*/ QLocale_nativeCountryName<QString> for () { fn nativeCountryName(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale17nativeCountryNameEv()}; let mut ret = unsafe {C_ZNK7QLocale17nativeCountryNameEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QChar QLocale::negativeSign(); impl /*struct*/ QLocale { pub fn negativeSign<RetType, T: QLocale_negativeSign<RetType>>(& self, overload_args: T) -> RetType { return overload_args.negativeSign(self); // return 1; } } pub trait QLocale_negativeSign<RetType> { fn negativeSign(self , rsthis: & QLocale) -> RetType; } // proto: QChar QLocale::negativeSign(); impl<'a> /*trait*/ QLocale_negativeSign<QChar> for () { fn negativeSign(self , rsthis: & QLocale) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale12negativeSignEv()}; let mut ret = unsafe {C_ZNK7QLocale12negativeSignEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QLocale::~QLocale(); impl /*struct*/ QLocale { pub fn free<RetType, T: QLocale_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QLocale_free<RetType> { fn free(self , rsthis: & QLocale) -> RetType; } // proto: void QLocale::~QLocale(); impl<'a> /*trait*/ QLocale_free<()> for () { fn free(self , rsthis: & QLocale) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QLocaleD2Ev()}; unsafe {C_ZN7QLocaleD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: void QLocale::QLocale(const QLocale & other); impl<'a> /*trait*/ QLocale_new for (&'a QLocale) { fn new(self) -> QLocale { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QLocaleC2ERKS_()}; let ctysz: c_int = unsafe{QLocale_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_ZN7QLocaleC2ERKS_(arg0)}; let rsthis = QLocale{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: QString QLocale::toString(const QDate & date, const QString & formatStr); impl<'a> /*trait*/ QLocale_toString<QString> for (&'a QDate, &'a QString) { fn toString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale8toStringERK5QDateRK7QString()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale8toStringERK5QDateRK7QString(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::toUpper(const QString & str); impl /*struct*/ QLocale { pub fn toUpper<RetType, T: QLocale_toUpper<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toUpper(self); // return 1; } } pub trait QLocale_toUpper<RetType> { fn toUpper(self , rsthis: & QLocale) -> RetType; } // proto: QString QLocale::toUpper(const QString & str); impl<'a> /*trait*/ QLocale_toUpper<QString> for (&'a QString) { fn toUpper(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale7toUpperERK7QString()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale7toUpperERK7QString(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QChar QLocale::percent(); impl /*struct*/ QLocale { pub fn percent<RetType, T: QLocale_percent<RetType>>(& self, overload_args: T) -> RetType { return overload_args.percent(self); // return 1; } } pub trait QLocale_percent<RetType> { fn percent(self , rsthis: & QLocale) -> RetType; } // proto: QChar QLocale::percent(); impl<'a> /*trait*/ QLocale_percent<QChar> for () { fn percent(self , rsthis: & QLocale) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale7percentEv()}; let mut ret = unsafe {C_ZNK7QLocale7percentEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: qulonglong QLocale::toULongLong(const QString & s, bool * ok); impl /*struct*/ QLocale { pub fn toULongLong<RetType, T: QLocale_toULongLong<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toULongLong(self); // return 1; } } pub trait QLocale_toULongLong<RetType> { fn toULongLong(self , rsthis: & QLocale) -> RetType; } // proto: qulonglong QLocale::toULongLong(const QString & s, bool * ok); impl<'a> /*trait*/ QLocale_toULongLong<u64> for (&'a QString, Option<&'a mut Vec<i8>>) { fn toULongLong(self , rsthis: & QLocale) -> u64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale11toULongLongERK7QStringPb()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {0 as *const i8} else {self.1.unwrap().as_ptr()}) as *mut c_char; let mut ret = unsafe {C_ZNK7QLocale11toULongLongERK7QStringPb(rsthis.qclsinst, arg0, arg1)}; return ret as u64; // 1 // return 1; } } // proto: QString QLocale::toString(double i, char f, int prec); impl<'a> /*trait*/ QLocale_toString<QString> for (f64, Option<i8>, Option<i32>) { fn toString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale8toStringEdci()}; let arg0 = self.0 as c_double; let arg1 = (if self.1.is_none() {'g' as i8} else {self.1.unwrap()}) as c_char; let arg2 = (if self.2.is_none() {6} else {self.2.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK7QLocale8toStringEdci(rsthis.qclsinst, arg0, arg1, arg2)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QStringList QLocale::uiLanguages(); impl /*struct*/ QLocale { pub fn uiLanguages<RetType, T: QLocale_uiLanguages<RetType>>(& self, overload_args: T) -> RetType { return overload_args.uiLanguages(self); // return 1; } } pub trait QLocale_uiLanguages<RetType> { fn uiLanguages(self , rsthis: & QLocale) -> RetType; } // proto: QStringList QLocale::uiLanguages(); impl<'a> /*trait*/ QLocale_uiLanguages<QStringList> for () { fn uiLanguages(self , rsthis: & QLocale) -> QStringList { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale11uiLanguagesEv()}; let mut ret = unsafe {C_ZNK7QLocale11uiLanguagesEv(rsthis.qclsinst)}; let mut ret1 = QStringList::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::bcp47Name(); impl /*struct*/ QLocale { pub fn bcp47Name<RetType, T: QLocale_bcp47Name<RetType>>(& self, overload_args: T) -> RetType { return overload_args.bcp47Name(self); // return 1; } } pub trait QLocale_bcp47Name<RetType> { fn bcp47Name(self , rsthis: & QLocale) -> RetType; } // proto: QString QLocale::bcp47Name(); impl<'a> /*trait*/ QLocale_bcp47Name<QString> for () { fn bcp47Name(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale9bcp47NameEv()}; let mut ret = unsafe {C_ZNK7QLocale9bcp47NameEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QTime QLocale::toTime(const QString & string, const QString & format); impl /*struct*/ QLocale { pub fn toTime<RetType, T: QLocale_toTime<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toTime(self); // return 1; } } pub trait QLocale_toTime<RetType> { fn toTime(self , rsthis: & QLocale) -> RetType; } // proto: QTime QLocale::toTime(const QString & string, const QString & format); impl<'a> /*trait*/ QLocale_toTime<QTime> for (&'a QString, &'a QString) { fn toTime(self , rsthis: & QLocale) -> QTime { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale6toTimeERK7QStringS2_()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale6toTimeERK7QStringS2_(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QTime::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: ushort QLocale::toUShort(const QString & s, bool * ok); impl /*struct*/ QLocale { pub fn toUShort<RetType, T: QLocale_toUShort<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toUShort(self); // return 1; } } pub trait QLocale_toUShort<RetType> { fn toUShort(self , rsthis: & QLocale) -> RetType; } // proto: ushort QLocale::toUShort(const QString & s, bool * ok); impl<'a> /*trait*/ QLocale_toUShort<u16> for (&'a QString, Option<&'a mut Vec<i8>>) { fn toUShort(self , rsthis: & QLocale) -> u16 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale8toUShortERK7QStringPb()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {0 as *const i8} else {self.1.unwrap().as_ptr()}) as *mut c_char; let mut ret = unsafe {C_ZNK7QLocale8toUShortERK7QStringPb(rsthis.qclsinst, arg0, arg1)}; return ret as u16; // 1 // return 1; } } // proto: QString QLocale::toCurrencyString(ushort , const QString & symbol); impl<'a> /*trait*/ QLocale_toCurrencyString<QString> for (u16, Option<&'a QString>) { fn toCurrencyString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale16toCurrencyStringEtRK7QString()}; let arg0 = self.0 as c_ushort; let arg1 = (if self.1.is_none() {QString::new(()).qclsinst} else {self.1.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale16toCurrencyStringEtRK7QString(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: double QLocale::toDouble(const QString & s, bool * ok); impl /*struct*/ QLocale { pub fn toDouble<RetType, T: QLocale_toDouble<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toDouble(self); // return 1; } } pub trait QLocale_toDouble<RetType> { fn toDouble(self , rsthis: & QLocale) -> RetType; } // proto: double QLocale::toDouble(const QString & s, bool * ok); impl<'a> /*trait*/ QLocale_toDouble<f64> for (&'a QString, Option<&'a mut Vec<i8>>) { fn toDouble(self , rsthis: & QLocale) -> f64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale8toDoubleERK7QStringPb()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {0 as *const i8} else {self.1.unwrap().as_ptr()}) as *mut c_char; let mut ret = unsafe {C_ZNK7QLocale8toDoubleERK7QStringPb(rsthis.qclsinst, arg0, arg1)}; return ret as f64; // 1 // return 1; } } // proto: static QLocale QLocale::system(); impl /*struct*/ QLocale { pub fn system_s<RetType, T: QLocale_system_s<RetType>>( overload_args: T) -> RetType { return overload_args.system_s(); // return 1; } } pub trait QLocale_system_s<RetType> { fn system_s(self ) -> RetType; } // proto: static QLocale QLocale::system(); impl<'a> /*trait*/ QLocale_system_s<QLocale> for () { fn system_s(self ) -> QLocale { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QLocale6systemEv()}; let mut ret = unsafe {C_ZN7QLocale6systemEv()}; let mut ret1 = QLocale::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: static void QLocale::setDefault(const QLocale & locale); impl /*struct*/ QLocale { pub fn setDefault_s<RetType, T: QLocale_setDefault_s<RetType>>( overload_args: T) -> RetType { return overload_args.setDefault_s(); // return 1; } } pub trait QLocale_setDefault_s<RetType> { fn setDefault_s(self ) -> RetType; } // proto: static void QLocale::setDefault(const QLocale & locale); impl<'a> /*trait*/ QLocale_setDefault_s<()> for (&'a QLocale) { fn setDefault_s(self ) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QLocale10setDefaultERKS_()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN7QLocale10setDefaultERKS_(arg0)}; // return 1; } } // proto: QChar QLocale::exponential(); impl /*struct*/ QLocale { pub fn exponential<RetType, T: QLocale_exponential<RetType>>(& self, overload_args: T) -> RetType { return overload_args.exponential(self); // return 1; } } pub trait QLocale_exponential<RetType> { fn exponential(self , rsthis: & QLocale) -> RetType; } // proto: QChar QLocale::exponential(); impl<'a> /*trait*/ QLocale_exponential<QChar> for () { fn exponential(self , rsthis: & QLocale) -> QChar { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale11exponentialEv()}; let mut ret = unsafe {C_ZNK7QLocale11exponentialEv(rsthis.qclsinst)}; let mut ret1 = QChar::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::toCurrencyString(float , const QString & symbol); impl<'a> /*trait*/ QLocale_toCurrencyString<QString> for (f32, Option<&'a QString>) { fn toCurrencyString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale16toCurrencyStringEfRK7QString()}; let arg0 = self.0 as c_float; let arg1 = (if self.1.is_none() {QString::new(()).qclsinst} else {self.1.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale16toCurrencyStringEfRK7QString(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::toString(int i); impl<'a> /*trait*/ QLocale_toString<QString> for (i32) { fn toString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale8toStringEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK7QLocale8toStringEi(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::toString(uint i); impl<'a> /*trait*/ QLocale_toString<QString> for (u32) { fn toString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale8toStringEj()}; let arg0 = self as c_uint; let mut ret = unsafe {C_ZNK7QLocale8toStringEj(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::toString(qlonglong i); impl<'a> /*trait*/ QLocale_toString<QString> for (i64) { fn toString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale8toStringEx()}; let arg0 = self as c_longlong; let mut ret = unsafe {C_ZNK7QLocale8toStringEx(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::toString(qulonglong i); impl<'a> /*trait*/ QLocale_toString<QString> for (u64) { fn toString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale8toStringEy()}; let arg0 = self as c_ulonglong; let mut ret = unsafe {C_ZNK7QLocale8toStringEy(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::toString(ushort i); impl<'a> /*trait*/ QLocale_toString<QString> for (u16) { fn toString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale8toStringEt()}; let arg0 = self as c_ushort; let mut ret = unsafe {C_ZNK7QLocale8toStringEt(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::amText(); impl /*struct*/ QLocale { pub fn amText<RetType, T: QLocale_amText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.amText(self); // return 1; } } pub trait QLocale_amText<RetType> { fn amText(self , rsthis: & QLocale) -> RetType; } // proto: QString QLocale::amText(); impl<'a> /*trait*/ QLocale_amText<QString> for () { fn amText(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale6amTextEv()}; let mut ret = unsafe {C_ZNK7QLocale6amTextEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::toCurrencyString(int , const QString & symbol); impl<'a> /*trait*/ QLocale_toCurrencyString<QString> for (i32, Option<&'a QString>) { fn toCurrencyString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale16toCurrencyStringEiRK7QString()}; let arg0 = self.0 as c_int; let arg1 = (if self.1.is_none() {QString::new(()).qclsinst} else {self.1.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK7QLocale16toCurrencyStringEiRK7QString(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QString QLocale::toString(short i); impl<'a> /*trait*/ QLocale_toString<QString> for (i16) { fn toString(self , rsthis: & QLocale) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale8toStringEs()}; let arg0 = self as c_short; let mut ret = unsafe {C_ZNK7QLocale8toStringEs(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QLocale::QLocale(); impl<'a> /*trait*/ QLocale_new for () { fn new(self) -> QLocale { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN7QLocaleC2Ev()}; let ctysz: c_int = unsafe{QLocale_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let qthis: u64 = unsafe {C_ZN7QLocaleC2Ev()}; let rsthis = QLocale{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: int QLocale::toInt(const QString & s, bool * ok); impl /*struct*/ QLocale { pub fn toInt<RetType, T: QLocale_toInt<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toInt(self); // return 1; } } pub trait QLocale_toInt<RetType> { fn toInt(self , rsthis: & QLocale) -> RetType; } // proto: int QLocale::toInt(const QString & s, bool * ok); impl<'a> /*trait*/ QLocale_toInt<i32> for (&'a QString, Option<&'a mut Vec<i8>>) { fn toInt(self , rsthis: & QLocale) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK7QLocale5toIntERK7QStringPb()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {0 as *const i8} else {self.1.unwrap().as_ptr()}) as *mut c_char; let mut ret = unsafe {C_ZNK7QLocale5toIntERK7QStringPb(rsthis.qclsinst, arg0, arg1)}; return ret as i32; // 1 // return 1; } } // <= body block end
use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::fmt; use std::time; /// Summary statistics produced at the end of a search. /// /// When statistics are reported by a printer, they correspond to all searches /// executed with that printer. #[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)] pub struct Stats { elapsed: NiceDuration, searches: u64, searches_with_match: u64, bytes_searched: u64, bytes_printed: u64, matched_lines: u64, matches: u64, } /// A type that provides "nicer" Display and Serialize impls for /// std::time::Duration. The serialization format should actually be compatible /// with the Deserialize impl for std::time::Duration, since this type only /// adds new fields. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] pub struct NiceDuration(pub time::Duration); impl fmt::Display for NiceDuration { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:0.6}s", self.fractional_seconds()) } } impl NiceDuration { /// Returns the number of seconds in this duration in fraction form. /// The number to the left of the decimal point is the number of seconds, /// and the number to the right is the number of milliseconds. fn fractional_seconds(&self) -> f64 { let fractional = (self.0.subsec_nanos() as f64) / 1_000_000_000.0; self.0.as_secs() as f64 + fractional } } impl Serialize for NiceDuration { fn serialize<S: Serializer>(&self, ser: S) -> Result<S::Ok, S::Error> { use serde::ser::SerializeStruct; let mut state = ser.serialize_struct("Duration", 2)?; state.serialize_field("secs", &self.0.as_secs())?; state.serialize_field("nanos", &self.0.subsec_nanos())?; state.serialize_field("human", &format!("{self}"))?; state.end() } } impl<'de> Deserialize<'de> for NiceDuration { fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer<'de>, { #[derive(Deserialize)] struct StdDuration { secs: u64, nanos: u32, } let deserialized = StdDuration::deserialize(deserializer)?; Ok(NiceDuration(time::Duration::new( deserialized.secs, deserialized.nanos, ))) } } #[test] fn test_nice_duration_serde() { let duration = time::Duration::new(10, 20); let nice_duration = NiceDuration(duration); let seralized = serde_json::to_string(&nice_duration).unwrap(); let deserialized: NiceDuration = serde_json::from_str(&seralized).unwrap(); assert_eq!(deserialized, NiceDuration(time::Duration::new(10, 20))); }
// 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. pub mod bitfields; #[allow(missing_docs)] pub mod block; #[allow(missing_docs)] pub mod block_type; #[allow(missing_docs)] pub mod constants;
use primes_iter; pub fn new() -> PrimalityChecker { PrimalityChecker::new() } pub struct PrimalityChecker { pi: primes_iter::PrimesIter } impl PrimalityChecker { pub fn new() -> PrimalityChecker { PrimalityChecker { pi: primes_iter::new() } } pub fn is_prime(&mut self, num: u64) -> bool { // Short-circuit for cases where num is // small enough that we can just search // for it in known_primes let last = match self.pi.known_primes.last() { None => 0, Some(last) => *last }; if num <= last { for p in self.pi.known_primes.iter().take_while(|&p| *p <= num) { if *p == num { return true } } return false }; let sqrt = (num as f64).sqrt().ceil() as u64; while self.pi.known_primes.is_empty() || *self.pi.known_primes.last().unwrap() < sqrt { self.pi.next(); } match self.pi.is_prime(num) { Err(_) => panic!("Programming error: this should be impossible"), Ok(result) => result } } } #[test] fn test_is_prime() { let mut pc = new(); assert_eq!(true, pc.is_prime(2)); assert_eq!(true, pc.is_prime(3)); assert_eq!(false, pc.is_prime(4)); assert_eq!(true, pc.is_prime(5)); assert_eq!(false, pc.is_prime(6)); assert_eq!(true, pc.is_prime(7)); assert_eq!(false, pc.is_prime(8)); assert_eq!(false, pc.is_prime(9)); assert_eq!(false, pc.is_prime(10)); assert_eq!(true, pc.is_prime(11)); // Second iteration should check the // cases where num < known_primes.last() assert_eq!(true, pc.is_prime(2)); assert_eq!(true, pc.is_prime(3)); assert_eq!(false, pc.is_prime(4)); assert_eq!(true, pc.is_prime(5)); assert_eq!(false, pc.is_prime(6)); assert_eq!(true, pc.is_prime(7)); assert_eq!(false, pc.is_prime(8)); assert_eq!(false, pc.is_prime(9)); assert_eq!(false, pc.is_prime(10)); assert_eq!(true, pc.is_prime(11)); }
/* * Copyright 2020 Fluence Labs Limited * * 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 crate::certificate::Certificate; use crate::ed25519::PublicKey; use crate::public_key_hashable::PublicKeyHashable; use crate::revoke::Revoke; use crate::trust::Trust; use crate::trust_node::{Auth, TrustNode}; use std::collections::hash_map::Entry; use std::collections::hash_map::Entry::Occupied; use std::collections::{HashMap, HashSet, VecDeque}; use std::fmt::Debug; use std::time::Duration; /// for simplicity, we store `n` where Weight = 1/n^2 type Weight = u32; /// Graph to efficiently calculate weights of certificates and get chains of certificates. /// TODO serialization/deserialization /// TODO export a certificate from graph #[allow(dead_code)] #[derive(Debug, Default)] pub struct TrustGraph { // TODO abstract this into a trait with key access methods // TODO: add docs on fields nodes: HashMap<PublicKeyHashable, TrustNode>, root_weights: HashMap<PublicKeyHashable, Weight>, } #[allow(dead_code)] impl TrustGraph { pub fn new(root_weights: Vec<(PublicKey, Weight)>) -> Self { Self { nodes: HashMap::new(), root_weights: root_weights .into_iter() .map(|(k, w)| (k.into(), w)) .collect(), } } /// Get trust by public key pub fn get(&self, pk: PublicKey) -> Option<&TrustNode> { self.nodes.get(&pk.into()) } /// Certificate is a chain of trusts, add this chain to graph pub fn add(&mut self, cert: Certificate, cur_time: Duration) -> Result<(), String> { let roots: Vec<PublicKey> = self.root_weights.keys().cloned().map(Into::into).collect(); Certificate::verify(&cert, roots.as_slice(), cur_time)?; let chain = cert.chain; let root_trust = &chain[0]; let root_pk: PublicKeyHashable = root_trust.issued_for.clone().into(); match self.nodes.get_mut(&root_pk) { Some(_) => {} None => { let mut trust_node = TrustNode::new(root_trust.issued_for.clone(), cur_time); let root_auth = Auth { trust: root_trust.clone(), issued_by: root_trust.issued_for.clone(), }; trust_node.update_auth(root_auth); self.nodes.insert(root_pk, trust_node); } } let mut previous_trust = root_trust; for trust in chain.iter().skip(1) { let pk = trust.issued_for.clone().into(); let auth = Auth { trust: trust.clone(), issued_by: previous_trust.issued_for.clone(), }; match self.nodes.get_mut(&pk) { Some(trust_node) => { trust_node.update_auth(auth); } None => { let mut trust_node = TrustNode::new(root_trust.issued_for.clone(), cur_time); trust_node.update_auth(auth); self.nodes.insert(pk, trust_node); } } previous_trust = trust; } Ok(()) } /// Get the maximum weight of trust for one public key. /// Returns None if there is no such public key /// or some trust between this key and a root key is revoked. /// TODO handle non-direct revocations pub fn weight(&self, pk: PublicKey) -> Option<Weight> { if let Some(weight) = self.root_weights.get(&pk.clone().into()) { return Some(*weight); } let roots: Vec<PublicKey> = self .root_weights .keys() .map(|pk| pk.clone().into()) .collect(); // get all possible certificates from the given public key to all roots in the graph let certs = self.get_all_certs(pk, roots.as_slice()); // if there are no certificates for the given public key, there is no info about this public key // or some elements of possible certificate chains was revoked if certs.is_empty() { return None; } let mut weight = std::u32::MAX; for cert in certs { let root_weight = *self .root_weights .get(&cert.chain[0].issued_for.clone().into()) // The error is unreachable. .unwrap(); // certificate weight = root weight + 1 * every other element in the chain // (except root, so the formula is `root weight + chain length - 1`) weight = std::cmp::min(weight, root_weight + cert.chain.len() as u32 - 1) } Some(weight) } /// BF search for all converging paths (chains) in the graph /// TODO could be optimized with closure, that will calculate the weight on the fly /// TODO or store auths to build certificates fn bf_search_paths( &self, node: &TrustNode, roots: HashSet<&PublicKeyHashable>, ) -> Vec<Vec<Auth>> { // queue to collect all chains in the trust graph (each chain is a path in the trust graph) let mut chains_queue: VecDeque<Vec<Auth>> = VecDeque::new(); let node_auths: Vec<Auth> = node.authorizations().cloned().collect(); // put all auth in the queue as the first possible paths through the graph for auth in node_auths { chains_queue.push_back(vec![auth]); } // List of all chains that converge (terminate) to known roots let mut terminated_chains: Vec<Vec<Auth>> = Vec::new(); while !chains_queue.is_empty() { let cur_chain = chains_queue.pop_front().unwrap(); // The error is unreachable. `cur_chain` is always have at least one element. let last = cur_chain.last().unwrap(); let auths: Vec<Auth> = self .nodes .get(&last.issued_by.clone().into()) // The error is unreachable. There cannot be paths without any nodes after adding verified certificates. .unwrap() .authorizations() .cloned() .collect(); for auth in auths { // if there is auth, that we not visited in the current chain, copy chain and append this auth if !cur_chain .iter() .any(|a| a.trust.issued_for == auth.issued_by) { let mut new_chain = cur_chain.clone(); new_chain.push(auth); chains_queue.push_back(new_chain); } } if roots.contains(last.trust.issued_for.as_ref()) { terminated_chains.push(cur_chain); } } terminated_chains } /// Get all possible certificates where `issued_for` will be the last element of the chain /// and one of the destinations is the root of this chain. pub fn get_all_certs(&self, issued_for: PublicKey, roots: &[PublicKey]) -> Vec<Certificate> { // get all auths (edges) for issued public key let issued_for_node = self.nodes.get(&issued_for.into()); let roots = roots.iter().map(|pk| pk.as_ref()); let roots = self.root_weights.keys().chain(roots).collect(); match issued_for_node { Some(node) => self .bf_search_paths(node, roots) .iter() .map(|auths| { // TODO: can avoid cloning here by returning &Certificate let trusts: Vec<Trust> = auths.iter().map(|auth| auth.trust.clone()).rev().collect(); Certificate::new_unverified(trusts) }) .collect(), None => Vec::new(), } } /// Mark public key as revoked. pub fn revoke(&mut self, revoke: Revoke) -> Result<(), String> { Revoke::verify(&revoke)?; let pk: PublicKeyHashable = revoke.pk.clone().into(); match self.nodes.entry(pk) { Occupied(mut entry) => { entry.get_mut().update_revoke(revoke); Ok(()) } Entry::Vacant(_) => Err("There is no trust with such PublicKey".to_string()), } } /// Check information about new certificates and about revoked certificates. /// Do it once per some time // TODO fn maintain() {} } #[cfg(test)] mod tests { use super::*; use crate::key_pair::KeyPair; use crate::misc::current_time; use failure::_core::time::Duration; pub fn one_minute() -> Duration { Duration::new(60, 0) } fn generate_root_cert() -> (KeyPair, KeyPair, Certificate) { let root_kp = KeyPair::generate(); let second_kp = KeyPair::generate(); let cur_time = current_time(); ( root_kp.clone(), second_kp.clone(), Certificate::issue_root( &root_kp, second_kp.public_key(), cur_time.checked_add(one_minute()).unwrap(), cur_time, ), ) } fn generate_cert_with_len_and_expiration( len: usize, predefined: HashMap<usize, KeyPair>, expiration: Duration, ) -> (Vec<KeyPair>, Certificate) { assert!(len > 2); let root_kp = KeyPair::generate(); let second_kp = KeyPair::generate(); let mut cert = Certificate::issue_root(&root_kp, second_kp.public_key(), expiration, current_time()); let mut key_pairs = vec![root_kp, second_kp]; for idx in 2..len { let kp = predefined.get(&idx).unwrap_or(&KeyPair::generate()).clone(); let previous_kp = &key_pairs[idx - 1]; cert = Certificate::issue( &previous_kp, kp.public_key(), &cert, expiration, current_time().checked_sub(Duration::new(60, 0)).unwrap(), current_time(), ) .unwrap(); key_pairs.push(kp); } (key_pairs, cert) } fn generate_cert_with_len( len: usize, predefined: HashMap<usize, KeyPair>, ) -> (Vec<KeyPair>, Certificate) { let cur_time = current_time(); let far_future = cur_time.checked_add(one_minute()).unwrap(); generate_cert_with_len_and_expiration(len, predefined, far_future) } #[test] fn test_add_cert_without_trusted_root() { let (_, _, cert) = generate_root_cert(); let cur_time = current_time(); let mut graph = TrustGraph::default(); let addition = graph.add(cert, cur_time); assert_eq!(addition.is_ok(), false); } #[test] fn test_add_cert() { let (root, _, cert) = generate_root_cert(); let mut graph = TrustGraph::default(); graph.root_weights.insert(root.key_pair.public().into(), 0); let addition = graph.add(cert, current_time()); assert_eq!(addition.is_ok(), true); } #[test] fn test_add_certs_with_same_trusts_and_different_expirations() { let cur_time = current_time(); let far_future = cur_time.checked_add(Duration::new(10, 0)).unwrap(); let far_far_future = cur_time.checked_add(Duration::new(900, 0)).unwrap(); let key_pair1 = KeyPair::generate(); let key_pair2 = KeyPair::generate(); let mut predefined1 = HashMap::new(); predefined1.insert(5, key_pair1.clone()); predefined1.insert(6, key_pair2.clone()); let (key_pairs1, cert1) = generate_cert_with_len_and_expiration(10, predefined1, far_future); let mut predefined2 = HashMap::new(); predefined2.insert(7, key_pair1.clone()); predefined2.insert(8, key_pair2.clone()); let (key_pairs2, cert2) = generate_cert_with_len_and_expiration(10, predefined2, far_far_future); let mut graph = TrustGraph::default(); let root1_pk = key_pairs1[0].public_key(); let root2_pk = key_pairs2[0].public_key(); graph.root_weights.insert(root1_pk.into(), 1); graph.root_weights.insert(root2_pk.into(), 0); graph.add(cert1, cur_time).unwrap(); let node2 = graph.get(key_pair2.public_key()).unwrap(); let auth_by_kp1 = node2 .authorizations() .find(|a| a.issued_by == key_pair1.public_key()) .unwrap(); assert_eq!(auth_by_kp1.trust.expires_at, far_future); graph.add(cert2, cur_time).unwrap(); let node2 = graph.get(key_pair2.public_key()).unwrap(); let auth_by_kp1 = node2 .authorizations() .find(|a| a.issued_by == key_pair1.public_key()) .unwrap(); assert_eq!(auth_by_kp1.trust.expires_at, far_far_future); } #[test] fn test_one_cert_in_graph() { let (key_pairs, cert1) = generate_cert_with_len(10, HashMap::new()); let last_trust = cert1.chain[9].clone(); let mut graph = TrustGraph::default(); let root_pk = key_pairs[0].public_key(); graph.root_weights.insert(root_pk.into(), 1); graph.add(cert1, current_time()).unwrap(); let w1 = graph.weight(key_pairs[0].public_key()).unwrap(); assert_eq!(w1, 1); let w2 = graph.weight(key_pairs[1].public_key()).unwrap(); assert_eq!(w2, 2); let w3 = graph.weight(key_pairs[9].public_key()).unwrap(); assert_eq!(w3, 10); let node = graph.get(key_pairs[9].public_key()).unwrap(); let auths: Vec<&Auth> = node.authorizations().collect(); assert_eq!(auths.len(), 1); assert_eq!(auths[0].trust, last_trust); } #[test] fn test_cycles_in_graph() { let key_pair1 = KeyPair::generate(); let key_pair2 = KeyPair::generate(); let key_pair3 = KeyPair::generate(); let mut predefined1 = HashMap::new(); predefined1.insert(3, key_pair1.clone()); predefined1.insert(5, key_pair2.clone()); predefined1.insert(7, key_pair3.clone()); let (key_pairs1, cert1) = generate_cert_with_len(10, predefined1); let mut predefined2 = HashMap::new(); predefined2.insert(7, key_pair1.clone()); predefined2.insert(6, key_pair2.clone()); predefined2.insert(5, key_pair3.clone()); let (key_pairs2, cert2) = generate_cert_with_len(10, predefined2); let mut graph = TrustGraph::default(); let root1_pk = key_pairs1[0].public_key(); let root2_pk = key_pairs2[0].public_key(); graph.root_weights.insert(root1_pk.into(), 1); graph.root_weights.insert(root2_pk.into(), 0); let last_pk1 = cert1.chain[9].issued_for.clone(); let last_pk2 = cert2.chain[9].issued_for.clone(); graph.add(cert1, current_time()).unwrap(); graph.add(cert2, current_time()).unwrap(); let revoke1 = Revoke::create(&key_pairs1[3], key_pairs1[4].public_key(), current_time()); graph.revoke(revoke1).unwrap(); let revoke2 = Revoke::create(&key_pairs2[5], key_pairs2[6].public_key(), current_time()); graph.revoke(revoke2).unwrap(); let w1 = graph.weight(key_pair1.public_key()).unwrap(); // all upper trusts are revoked for this public key let w2 = graph.weight(key_pair2.public_key()); let w3 = graph.weight(key_pair3.public_key()).unwrap(); let w_last1 = graph.weight(last_pk1).unwrap(); let w_last2 = graph.weight(last_pk2).unwrap(); assert_eq!(w1, 4); assert_eq!(w2.is_none(), true); assert_eq!(w3, 5); assert_eq!(w_last1, 7); assert_eq!(w_last2, 6); } #[test] fn test_get_one_cert() { let (key_pairs, cert) = generate_cert_with_len(5, HashMap::new()); let mut graph = TrustGraph::default(); let root1_pk = key_pairs[0].public_key(); graph.root_weights.insert(root1_pk.clone().into(), 1); graph.add(cert.clone(), current_time()).unwrap(); let certs = graph.get_all_certs(key_pairs.last().unwrap().public_key(), &[root1_pk]); assert_eq!(certs.len(), 1); assert_eq!(certs[0], cert); } #[test] fn test_find_certs() { let key_pair1 = KeyPair::generate(); let key_pair2 = KeyPair::generate(); let key_pair3 = KeyPair::generate(); let mut predefined1 = HashMap::new(); predefined1.insert(2, key_pair1.clone()); predefined1.insert(3, key_pair2.clone()); predefined1.insert(4, key_pair3.clone()); let (key_pairs1, cert1) = generate_cert_with_len(5, predefined1); let mut predefined2 = HashMap::new(); predefined2.insert(4, key_pair1.clone()); predefined2.insert(3, key_pair2.clone()); predefined2.insert(2, key_pair3.clone()); let (key_pairs2, cert2) = generate_cert_with_len(5, predefined2); let mut predefined3 = HashMap::new(); predefined3.insert(3, key_pair1.clone()); predefined3.insert(4, key_pair2.clone()); predefined3.insert(2, key_pair3.clone()); let (key_pairs3, cert3) = generate_cert_with_len(5, predefined3); let mut graph = TrustGraph::default(); let root1_pk = key_pairs1[0].public_key(); let root2_pk = key_pairs2[0].public_key(); let root3_pk = key_pairs3[0].public_key(); graph.root_weights.insert(root1_pk.clone().into(), 1); graph.root_weights.insert(root2_pk.clone().into(), 0); graph.root_weights.insert(root3_pk.clone().into(), 0); graph.add(cert1, current_time()).unwrap(); graph.add(cert2, current_time()).unwrap(); graph.add(cert3, current_time()).unwrap(); let roots_values = [root1_pk, root2_pk, root3_pk]; let certs1 = graph.get_all_certs(key_pair1.public_key(), &roots_values); let lenghts1: Vec<usize> = certs1.iter().map(|c| c.chain.len()).collect(); let check_lenghts1: Vec<usize> = vec![3, 4, 4, 5, 5]; assert_eq!(lenghts1, check_lenghts1); let certs2 = graph.get_all_certs(key_pair2.public_key(), &roots_values); let lenghts2: Vec<usize> = certs2.iter().map(|c| c.chain.len()).collect(); let check_lenghts2: Vec<usize> = vec![4, 4, 4, 5, 5]; assert_eq!(lenghts2, check_lenghts2); let certs3 = graph.get_all_certs(key_pair3.public_key(), &roots_values); let lenghts3: Vec<usize> = certs3.iter().map(|c| c.chain.len()).collect(); let check_lenghts3: Vec<usize> = vec![3, 3, 5]; assert_eq!(lenghts3, check_lenghts3); } }
//! Exports the `Term` type which is a high-level API for the Grid. use std::ops::{Index, IndexMut, Range}; use std::sync::Arc; use std::{cmp, mem, ptr, slice, str}; use bitflags::bitflags; use log::{debug, trace}; use unicode_width::UnicodeWidthChar; use vte::ansi::{Hyperlink as VteHyperlink, Rgb as VteRgb}; use crate::ansi::{ self, Attr, CharsetIndex, Color, CursorShape, CursorStyle, Handler, NamedColor, StandardCharset, }; use crate::config::{Config, Osc52, Terminal}; use crate::event::{Event, EventListener}; use crate::grid::{Dimensions, Grid, GridIterator, Scroll}; use crate::index::{self, Boundary, Column, Direction, Line, Point, Side}; use crate::selection::{Selection, SelectionRange, SelectionType}; use crate::term::cell::{Cell, Flags, LineLength}; use crate::term::color::Colors; use crate::vi_mode::{ViModeCursor, ViMotion}; pub mod cell; pub mod color; pub mod search; /// Minimum number of columns. /// /// A minimum of 2 is necessary to hold fullwidth unicode characters. pub const MIN_COLUMNS: usize = 2; /// Minimum number of visible lines. pub const MIN_SCREEN_LINES: usize = 1; /// Max size of the window title stack. const TITLE_STACK_MAX_DEPTH: usize = 4096; /// Default tab interval, corresponding to terminfo `it` value. const INITIAL_TABSTOPS: usize = 8; bitflags! { #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct TermMode: u32 { const NONE = 0; const SHOW_CURSOR = 0b0000_0000_0000_0000_0001; const APP_CURSOR = 0b0000_0000_0000_0000_0010; const APP_KEYPAD = 0b0000_0000_0000_0000_0100; const MOUSE_REPORT_CLICK = 0b0000_0000_0000_0000_1000; const BRACKETED_PASTE = 0b0000_0000_0000_0001_0000; const SGR_MOUSE = 0b0000_0000_0000_0010_0000; const MOUSE_MOTION = 0b0000_0000_0000_0100_0000; const LINE_WRAP = 0b0000_0000_0000_1000_0000; const LINE_FEED_NEW_LINE = 0b0000_0000_0001_0000_0000; const ORIGIN = 0b0000_0000_0010_0000_0000; const INSERT = 0b0000_0000_0100_0000_0000; const FOCUS_IN_OUT = 0b0000_0000_1000_0000_0000; const ALT_SCREEN = 0b0000_0001_0000_0000_0000; const MOUSE_DRAG = 0b0000_0010_0000_0000_0000; const MOUSE_MODE = 0b0000_0010_0000_0100_1000; const UTF8_MOUSE = 0b0000_0100_0000_0000_0000; const ALTERNATE_SCROLL = 0b0000_1000_0000_0000_0000; const VI = 0b0001_0000_0000_0000_0000; const URGENCY_HINTS = 0b0010_0000_0000_0000_0000; const ANY = u32::MAX; } } impl Default for TermMode { fn default() -> TermMode { TermMode::SHOW_CURSOR | TermMode::LINE_WRAP | TermMode::ALTERNATE_SCROLL | TermMode::URGENCY_HINTS } } /// Convert a terminal point to a viewport relative point. #[inline] pub fn point_to_viewport(display_offset: usize, point: Point) -> Option<Point<usize>> { let viewport_line = point.line.0 + display_offset as i32; usize::try_from(viewport_line).ok().map(|line| Point::new(line, point.column)) } /// Convert a viewport relative point to a terminal point. #[inline] pub fn viewport_to_point(display_offset: usize, point: Point<usize>) -> Point { let line = Line(point.line as i32) - display_offset; Point::new(line, point.column) } #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct LineDamageBounds { /// Damaged line number. pub line: usize, /// Leftmost damaged column. pub left: usize, /// Rightmost damaged column. pub right: usize, } impl LineDamageBounds { #[inline] pub fn undamaged(line: usize, num_cols: usize) -> Self { Self { line, left: num_cols, right: 0 } } #[inline] pub fn reset(&mut self, num_cols: usize) { *self = Self::undamaged(self.line, num_cols); } #[inline] pub fn expand(&mut self, left: usize, right: usize) { self.left = cmp::min(self.left, left); self.right = cmp::max(self.right, right); } #[inline] pub fn is_damaged(&self) -> bool { self.left <= self.right } } /// Terminal damage information collected since the last [`Term::reset_damage`] call. #[derive(Debug)] pub enum TermDamage<'a> { /// The entire terminal is damaged. Full, /// Iterator over damaged lines in the terminal. Partial(TermDamageIterator<'a>), } /// Iterator over the terminal's damaged lines. #[derive(Clone, Debug)] pub struct TermDamageIterator<'a> { line_damage: slice::Iter<'a, LineDamageBounds>, } impl<'a> TermDamageIterator<'a> { fn new(line_damage: &'a [LineDamageBounds]) -> Self { Self { line_damage: line_damage.iter() } } } impl<'a> Iterator for TermDamageIterator<'a> { type Item = LineDamageBounds; fn next(&mut self) -> Option<Self::Item> { self.line_damage.find(|line| line.is_damaged()).copied() } } /// State of the terminal damage. struct TermDamageState { /// Hint whether terminal should be damaged entirely regardless of the actual damage changes. is_fully_damaged: bool, /// Information about damage on terminal lines. lines: Vec<LineDamageBounds>, /// Old terminal cursor point. last_cursor: Point, /// Last Vi cursor point. last_vi_cursor_point: Option<Point<usize>>, /// Old selection range. last_selection: Option<SelectionRange>, } impl TermDamageState { fn new(num_cols: usize, num_lines: usize) -> Self { let lines = (0..num_lines).map(|line| LineDamageBounds::undamaged(line, num_cols)).collect(); Self { is_fully_damaged: true, lines, last_cursor: Default::default(), last_vi_cursor_point: Default::default(), last_selection: Default::default(), } } #[inline] fn resize(&mut self, num_cols: usize, num_lines: usize) { // Reset point, so old cursor won't end up outside of the viewport. self.last_cursor = Default::default(); self.last_vi_cursor_point = None; self.last_selection = None; self.is_fully_damaged = true; self.lines.clear(); self.lines.reserve(num_lines); for line in 0..num_lines { self.lines.push(LineDamageBounds::undamaged(line, num_cols)); } } /// Damage point inside of the viewport. #[inline] fn damage_point(&mut self, point: Point<usize>) { self.damage_line(point.line, point.column.0, point.column.0); } /// Expand `line`'s damage to span at least `left` to `right` column. #[inline] fn damage_line(&mut self, line: usize, left: usize, right: usize) { self.lines[line].expand(left, right); } fn damage_selection( &mut self, selection: SelectionRange, display_offset: usize, num_cols: usize, ) { let display_offset = display_offset as i32; let last_visible_line = self.lines.len() as i32 - 1; // Don't damage invisible selection. if selection.end.line.0 + display_offset < 0 || selection.start.line.0.abs() < display_offset - last_visible_line { return; }; let start = cmp::max(selection.start.line.0 + display_offset, 0); let end = (selection.end.line.0 + display_offset).clamp(0, last_visible_line); for line in start as usize..=end as usize { self.damage_line(line, 0, num_cols - 1); } } /// Reset information about terminal damage. fn reset(&mut self, num_cols: usize) { self.is_fully_damaged = false; self.lines.iter_mut().for_each(|line| line.reset(num_cols)); } } pub struct Term<T> { /// Terminal focus controlling the cursor shape. pub is_focused: bool, /// Cursor for keyboard selection. pub vi_mode_cursor: ViModeCursor, pub selection: Option<Selection>, /// Currently active grid. /// /// Tracks the screen buffer currently in use. While the alternate screen buffer is active, /// this will be the alternate grid. Otherwise it is the primary screen buffer. grid: Grid<Cell>, /// Currently inactive grid. /// /// Opposite of the active grid. While the alternate screen buffer is active, this will be the /// primary grid. Otherwise it is the alternate screen buffer. inactive_grid: Grid<Cell>, /// Index into `charsets`, pointing to what ASCII is currently being mapped to. active_charset: CharsetIndex, /// Tabstops. tabs: TabStops, /// Mode flags. mode: TermMode, /// Scroll region. /// /// Range going from top to bottom of the terminal, indexed from the top of the viewport. scroll_region: Range<Line>, semantic_escape_chars: String, /// Modified terminal colors. colors: Colors, /// Current style of the cursor. cursor_style: Option<CursorStyle>, /// Default style for resetting the cursor. default_cursor_style: CursorStyle, /// Style of the vi mode cursor. vi_mode_cursor_style: Option<CursorStyle>, /// Proxy for sending events to the event loop. event_proxy: T, /// Current title of the window. title: Option<String>, /// Stack of saved window titles. When a title is popped from this stack, the `title` for the /// term is set. title_stack: Vec<Option<String>>, /// Information about damaged cells. damage: TermDamageState, /// Config directly for the terminal. config: Terminal, } impl<T> Term<T> { #[inline] pub fn scroll_display(&mut self, scroll: Scroll) where T: EventListener, { let old_display_offset = self.grid.display_offset(); self.grid.scroll_display(scroll); self.event_proxy.send_event(Event::MouseCursorDirty); // Clamp vi mode cursor to the viewport. let viewport_start = -(self.grid.display_offset() as i32); let viewport_end = viewport_start + self.bottommost_line().0; let vi_cursor_line = &mut self.vi_mode_cursor.point.line.0; *vi_cursor_line = cmp::min(viewport_end, cmp::max(viewport_start, *vi_cursor_line)); self.vi_mode_recompute_selection(); // Damage everything if display offset changed. if old_display_offset != self.grid().display_offset() { self.mark_fully_damaged(); } } pub fn new<D: Dimensions>(config: &Config, dimensions: &D, event_proxy: T) -> Term<T> { let num_cols = dimensions.columns(); let num_lines = dimensions.screen_lines(); let history_size = config.scrolling.history() as usize; let grid = Grid::new(num_lines, num_cols, history_size); let alt = Grid::new(num_lines, num_cols, 0); let tabs = TabStops::new(grid.columns()); let scroll_region = Line(0)..Line(grid.screen_lines() as i32); // Initialize terminal damage, covering the entire terminal upon launch. let damage = TermDamageState::new(num_cols, num_lines); Term { grid, inactive_grid: alt, active_charset: Default::default(), vi_mode_cursor: Default::default(), tabs, mode: Default::default(), scroll_region, colors: color::Colors::default(), semantic_escape_chars: config.selection.semantic_escape_chars.to_owned(), cursor_style: None, default_cursor_style: config.cursor.style(), vi_mode_cursor_style: config.cursor.vi_mode_style(), event_proxy, is_focused: true, title: None, title_stack: Vec::new(), selection: None, damage, config: config.terminal.clone(), } } #[must_use] pub fn damage(&mut self, selection: Option<SelectionRange>) -> TermDamage<'_> { // Ensure the entire terminal is damaged after entering insert mode. // Leaving is handled in the ansi handler. if self.mode.contains(TermMode::INSERT) { self.mark_fully_damaged(); } // Update tracking of cursor, selection, and vi mode cursor. let display_offset = self.grid().display_offset(); let vi_cursor_point = if self.mode.contains(TermMode::VI) { point_to_viewport(display_offset, self.vi_mode_cursor.point) } else { None }; let previous_cursor = mem::replace(&mut self.damage.last_cursor, self.grid.cursor.point); let previous_selection = mem::replace(&mut self.damage.last_selection, selection); let previous_vi_cursor_point = mem::replace(&mut self.damage.last_vi_cursor_point, vi_cursor_point); // Early return if the entire terminal is damaged. if self.damage.is_fully_damaged { return TermDamage::Full; } // Add information about old cursor position and new one if they are not the same, so we // cover everything that was produced by `Term::input`. if self.damage.last_cursor != previous_cursor { // Cursor cooridanates are always inside viewport even if you have `display_offset`. let point = Point::new(previous_cursor.line.0 as usize, previous_cursor.column); self.damage.damage_point(point); } // Always damage current cursor. self.damage_cursor(); // Vi mode doesn't update the terminal content, thus only last vi cursor position and the // new one should be damaged. if let Some(previous_vi_cursor_point) = previous_vi_cursor_point { self.damage.damage_point(previous_vi_cursor_point) } // Damage Vi cursor if it's present. if let Some(vi_cursor_point) = self.damage.last_vi_cursor_point { self.damage.damage_point(vi_cursor_point); } if self.damage.last_selection != previous_selection { for selection in self.damage.last_selection.into_iter().chain(previous_selection) { self.damage.damage_selection(selection, display_offset, self.columns()); } } TermDamage::Partial(TermDamageIterator::new(&self.damage.lines)) } /// Resets the terminal damage information. pub fn reset_damage(&mut self) { self.damage.reset(self.columns()); } #[inline] pub fn mark_fully_damaged(&mut self) { self.damage.is_fully_damaged = true; } /// Damage line in a terminal viewport. #[inline] pub fn damage_line(&mut self, line: usize, left: usize, right: usize) { self.damage.damage_line(line, left, right); } pub fn update_config(&mut self, config: &Config) where T: EventListener, { self.semantic_escape_chars = config.selection.semantic_escape_chars.to_owned(); self.default_cursor_style = config.cursor.style(); self.vi_mode_cursor_style = config.cursor.vi_mode_style(); let title_event = match &self.title { Some(title) => Event::Title(title.clone()), None => Event::ResetTitle, }; self.event_proxy.send_event(title_event); if self.mode.contains(TermMode::ALT_SCREEN) { self.inactive_grid.update_history(config.scrolling.history() as usize); } else { self.grid.update_history(config.scrolling.history() as usize); } self.config = config.terminal.clone(); // Damage everything on config updates. self.mark_fully_damaged(); } /// Convert the active selection to a String. pub fn selection_to_string(&self) -> Option<String> { let selection_range = self.selection.as_ref().and_then(|s| s.to_range(self))?; let SelectionRange { start, end, .. } = selection_range; let mut res = String::new(); match self.selection.as_ref() { Some(Selection { ty: SelectionType::Block, .. }) => { for line in (start.line.0..end.line.0).map(Line::from) { res += self .line_to_string(line, start.column..end.column, start.column.0 != 0) .trim_end(); res += "\n"; } res += self.line_to_string(end.line, start.column..end.column, true).trim_end(); }, Some(Selection { ty: SelectionType::Lines, .. }) => { res = self.bounds_to_string(start, end) + "\n"; }, _ => { res = self.bounds_to_string(start, end); }, } Some(res) } /// Convert range between two points to a String. pub fn bounds_to_string(&self, start: Point, end: Point) -> String { let mut res = String::new(); for line in (start.line.0..=end.line.0).map(Line::from) { let start_col = if line == start.line { start.column } else { Column(0) }; let end_col = if line == end.line { end.column } else { self.last_column() }; res += &self.line_to_string(line, start_col..end_col, line == end.line); } res.strip_suffix('\n').map(str::to_owned).unwrap_or(res) } /// Convert a single line in the grid to a String. fn line_to_string( &self, line: Line, mut cols: Range<Column>, include_wrapped_wide: bool, ) -> String { let mut text = String::new(); let grid_line = &self.grid[line]; let line_length = cmp::min(grid_line.line_length(), cols.end + 1); // Include wide char when trailing spacer is selected. if grid_line[cols.start].flags.contains(Flags::WIDE_CHAR_SPACER) { cols.start -= 1; } let mut tab_mode = false; for column in (cols.start.0..line_length.0).map(Column::from) { let cell = &grid_line[column]; // Skip over cells until next tab-stop once a tab was found. if tab_mode { if self.tabs[column] || cell.c != ' ' { tab_mode = false; } else { continue; } } if cell.c == '\t' { tab_mode = true; } if !cell.flags.intersects(Flags::WIDE_CHAR_SPACER | Flags::LEADING_WIDE_CHAR_SPACER) { // Push cells primary character. text.push(cell.c); // Push zero-width characters. for c in cell.zerowidth().into_iter().flatten() { text.push(*c); } } } if cols.end >= self.columns() - 1 && (line_length.0 == 0 || !self.grid[line][line_length - 1].flags.contains(Flags::WRAPLINE)) { text.push('\n'); } // If wide char is not part of the selection, but leading spacer is, include it. if line_length == self.columns() && line_length.0 >= 2 && grid_line[line_length - 1].flags.contains(Flags::LEADING_WIDE_CHAR_SPACER) && include_wrapped_wide { text.push(self.grid[line - 1i32][Column(0)].c); } text } /// Terminal content required for rendering. #[inline] pub fn renderable_content(&self) -> RenderableContent<'_> where T: EventListener, { RenderableContent::new(self) } /// Access to the raw grid data structure. pub fn grid(&self) -> &Grid<Cell> { &self.grid } /// Mutable access to the raw grid data structure. pub fn grid_mut(&mut self) -> &mut Grid<Cell> { &mut self.grid } /// Resize terminal to new dimensions. pub fn resize<S: Dimensions>(&mut self, size: S) { let old_cols = self.columns(); let old_lines = self.screen_lines(); let num_cols = size.columns(); let num_lines = size.screen_lines(); if old_cols == num_cols && old_lines == num_lines { debug!("Term::resize dimensions unchanged"); return; } debug!("New num_cols is {} and num_lines is {}", num_cols, num_lines); // Move vi mode cursor with the content. let history_size = self.history_size(); let mut delta = num_lines as i32 - old_lines as i32; let min_delta = cmp::min(0, num_lines as i32 - self.grid.cursor.point.line.0 - 1); delta = cmp::min(cmp::max(delta, min_delta), history_size as i32); self.vi_mode_cursor.point.line += delta; let is_alt = self.mode.contains(TermMode::ALT_SCREEN); self.grid.resize(!is_alt, num_lines, num_cols); self.inactive_grid.resize(is_alt, num_lines, num_cols); // Invalidate selection and tabs only when necessary. if old_cols != num_cols { self.selection = None; // Recreate tabs list. self.tabs.resize(num_cols); } else if let Some(selection) = self.selection.take() { let max_lines = cmp::max(num_lines, old_lines) as i32; let range = Line(0)..Line(max_lines); self.selection = selection.rotate(self, &range, -delta); } // Clamp vi cursor to viewport. let vi_point = self.vi_mode_cursor.point; let viewport_top = Line(-(self.grid.display_offset() as i32)); let viewport_bottom = viewport_top + self.bottommost_line(); self.vi_mode_cursor.point.line = cmp::max(cmp::min(vi_point.line, viewport_bottom), viewport_top); self.vi_mode_cursor.point.column = cmp::min(vi_point.column, self.last_column()); // Reset scrolling region. self.scroll_region = Line(0)..Line(self.screen_lines() as i32); // Resize damage information. self.damage.resize(num_cols, num_lines); } /// Active terminal modes. #[inline] pub fn mode(&self) -> &TermMode { &self.mode } /// Swap primary and alternate screen buffer. pub fn swap_alt(&mut self) { if !self.mode.contains(TermMode::ALT_SCREEN) { // Set alt screen cursor to the current primary screen cursor. self.inactive_grid.cursor = self.grid.cursor.clone(); // Drop information about the primary screens saved cursor. self.grid.saved_cursor = self.grid.cursor.clone(); // Reset alternate screen contents. self.inactive_grid.reset_region(..); } mem::swap(&mut self.grid, &mut self.inactive_grid); self.mode ^= TermMode::ALT_SCREEN; self.selection = None; self.mark_fully_damaged(); } /// Scroll screen down. /// /// Text moves down; clear at bottom /// Expects origin to be in scroll range. #[inline] fn scroll_down_relative(&mut self, origin: Line, mut lines: usize) { trace!("Scrolling down relative: origin={}, lines={}", origin, lines); lines = cmp::min(lines, (self.scroll_region.end - self.scroll_region.start).0 as usize); lines = cmp::min(lines, (self.scroll_region.end - origin).0 as usize); let region = origin..self.scroll_region.end; // Scroll selection. self.selection = self.selection.take().and_then(|s| s.rotate(self, &region, -(lines as i32))); // Scroll vi mode cursor. let line = &mut self.vi_mode_cursor.point.line; if region.start <= *line && region.end > *line { *line = cmp::min(*line + lines, region.end - 1); } // Scroll between origin and bottom self.grid.scroll_down(&region, lines); self.mark_fully_damaged(); } /// Scroll screen up /// /// Text moves up; clear at top /// Expects origin to be in scroll range. #[inline] fn scroll_up_relative(&mut self, origin: Line, mut lines: usize) { trace!("Scrolling up relative: origin={}, lines={}", origin, lines); lines = cmp::min(lines, (self.scroll_region.end - self.scroll_region.start).0 as usize); let region = origin..self.scroll_region.end; // Scroll selection. self.selection = self.selection.take().and_then(|s| s.rotate(self, &region, lines as i32)); self.grid.scroll_up(&region, lines); // Scroll vi mode cursor. let viewport_top = Line(-(self.grid.display_offset() as i32)); let top = if region.start == 0 { viewport_top } else { region.start }; let line = &mut self.vi_mode_cursor.point.line; if (top <= *line) && region.end > *line { *line = cmp::max(*line - lines, top); } self.mark_fully_damaged(); } fn deccolm(&mut self) where T: EventListener, { // Setting 132 column font makes no sense, but run the other side effects. // Clear scrolling region. self.set_scrolling_region(1, None); // Clear grid. self.grid.reset_region(..); self.mark_fully_damaged(); } #[inline] pub fn exit(&mut self) where T: EventListener, { self.event_proxy.send_event(Event::Exit); } /// Toggle the vi mode. #[inline] pub fn toggle_vi_mode(&mut self) where T: EventListener, { self.mode ^= TermMode::VI; if self.mode.contains(TermMode::VI) { let display_offset = self.grid.display_offset() as i32; if self.grid.cursor.point.line > self.bottommost_line() - display_offset { // Move cursor to top-left if terminal cursor is not visible. let point = Point::new(Line(-display_offset), Column(0)); self.vi_mode_cursor = ViModeCursor::new(point); } else { // Reset vi mode cursor position to match primary cursor. self.vi_mode_cursor = ViModeCursor::new(self.grid.cursor.point); } } // Update UI about cursor blinking state changes. self.event_proxy.send_event(Event::CursorBlinkingChange); } /// Move vi mode cursor. #[inline] pub fn vi_motion(&mut self, motion: ViMotion) where T: EventListener, { // Require vi mode to be active. if !self.mode.contains(TermMode::VI) { return; } // Move cursor. self.vi_mode_cursor = self.vi_mode_cursor.motion(self, motion); self.vi_mode_recompute_selection(); } /// Move vi cursor to a point in the grid. #[inline] pub fn vi_goto_point(&mut self, point: Point) where T: EventListener, { // Move viewport to make point visible. self.scroll_to_point(point); // Move vi cursor to the point. self.vi_mode_cursor.point = point; self.vi_mode_recompute_selection(); } /// Update the active selection to match the vi mode cursor position. #[inline] fn vi_mode_recompute_selection(&mut self) { // Require vi mode to be active. if !self.mode.contains(TermMode::VI) { return; } // Update only if non-empty selection is present. if let Some(selection) = self.selection.as_mut().filter(|s| !s.is_empty()) { selection.update(self.vi_mode_cursor.point, Side::Left); selection.include_all(); } } /// Scroll display to point if it is outside of viewport. pub fn scroll_to_point(&mut self, point: Point) where T: EventListener, { let display_offset = self.grid.display_offset() as i32; let screen_lines = self.grid.screen_lines() as i32; if point.line < -display_offset { let lines = point.line + display_offset; self.scroll_display(Scroll::Delta(-lines.0)); } else if point.line >= (screen_lines - display_offset) { let lines = point.line + display_offset - screen_lines + 1i32; self.scroll_display(Scroll::Delta(-lines.0)); } } /// Jump to the end of a wide cell. pub fn expand_wide(&self, mut point: Point, direction: Direction) -> Point { let flags = self.grid[point.line][point.column].flags; match direction { Direction::Right if flags.contains(Flags::LEADING_WIDE_CHAR_SPACER) => { point.column = Column(1); point.line += 1; }, Direction::Right if flags.contains(Flags::WIDE_CHAR) => { point.column = cmp::min(point.column + 1, self.last_column()); }, Direction::Left if flags.intersects(Flags::WIDE_CHAR | Flags::WIDE_CHAR_SPACER) => { if flags.contains(Flags::WIDE_CHAR_SPACER) { point.column -= 1; } let prev = point.sub(self, Boundary::Grid, 1); if self.grid[prev].flags.contains(Flags::LEADING_WIDE_CHAR_SPACER) { point = prev; } }, _ => (), } point } #[inline] pub fn semantic_escape_chars(&self) -> &str { &self.semantic_escape_chars } /// Active terminal cursor style. /// /// While vi mode is active, this will automatically return the vi mode cursor style. #[inline] pub fn cursor_style(&self) -> CursorStyle { let cursor_style = self.cursor_style.unwrap_or(self.default_cursor_style); if self.mode.contains(TermMode::VI) { self.vi_mode_cursor_style.unwrap_or(cursor_style) } else { cursor_style } } pub fn colors(&self) -> &Colors { &self.colors } /// Insert a linebreak at the current cursor position. #[inline] fn wrapline(&mut self) where T: EventListener, { if !self.mode.contains(TermMode::LINE_WRAP) { return; } trace!("Wrapping input"); self.grid.cursor_cell().flags.insert(Flags::WRAPLINE); if self.grid.cursor.point.line + 1 >= self.scroll_region.end { self.linefeed(); } else { self.damage_cursor(); self.grid.cursor.point.line += 1; } self.grid.cursor.point.column = Column(0); self.grid.cursor.input_needs_wrap = false; self.damage_cursor(); } /// Write `c` to the cell at the cursor position. #[inline(always)] fn write_at_cursor(&mut self, c: char) { let c = self.grid.cursor.charsets[self.active_charset].map(c); let fg = self.grid.cursor.template.fg; let bg = self.grid.cursor.template.bg; let flags = self.grid.cursor.template.flags; let extra = self.grid.cursor.template.extra.clone(); let mut cursor_cell = self.grid.cursor_cell(); // Clear all related cells when overwriting a fullwidth cell. if cursor_cell.flags.intersects(Flags::WIDE_CHAR | Flags::WIDE_CHAR_SPACER) { // Remove wide char and spacer. let wide = cursor_cell.flags.contains(Flags::WIDE_CHAR); let point = self.grid.cursor.point; if wide && point.column < self.last_column() { self.grid[point.line][point.column + 1].flags.remove(Flags::WIDE_CHAR_SPACER); } else if point.column > 0 { self.grid[point.line][point.column - 1].clear_wide(); } // Remove leading spacers. if point.column <= 1 && point.line != self.topmost_line() { let column = self.last_column(); self.grid[point.line - 1i32][column].flags.remove(Flags::LEADING_WIDE_CHAR_SPACER); } cursor_cell = self.grid.cursor_cell(); } cursor_cell.c = c; cursor_cell.fg = fg; cursor_cell.bg = bg; cursor_cell.flags = flags; cursor_cell.extra = extra; } #[inline] fn damage_cursor(&mut self) { // The normal cursor coordinates are always in viewport. let point = Point::new(self.grid.cursor.point.line.0 as usize, self.grid.cursor.point.column); self.damage.damage_point(point); } } impl<T> Dimensions for Term<T> { #[inline] fn columns(&self) -> usize { self.grid.columns() } #[inline] fn screen_lines(&self) -> usize { self.grid.screen_lines() } #[inline] fn total_lines(&self) -> usize { self.grid.total_lines() } } impl<T: EventListener> Handler for Term<T> { /// A character to be displayed. #[inline(never)] fn input(&mut self, c: char) { // Number of cells the char will occupy. let width = match c.width() { Some(width) => width, None => return, }; // Handle zero-width characters. if width == 0 { // Get previous column. let mut column = self.grid.cursor.point.column; if !self.grid.cursor.input_needs_wrap { column.0 = column.saturating_sub(1); } // Put zerowidth characters over first fullwidth character cell. let line = self.grid.cursor.point.line; if self.grid[line][column].flags.contains(Flags::WIDE_CHAR_SPACER) { column.0 = column.saturating_sub(1); } self.grid[line][column].push_zerowidth(c); return; } // Move cursor to next line. if self.grid.cursor.input_needs_wrap { self.wrapline(); } // If in insert mode, first shift cells to the right. let columns = self.columns(); if self.mode.contains(TermMode::INSERT) && self.grid.cursor.point.column + width < columns { let line = self.grid.cursor.point.line; let col = self.grid.cursor.point.column; let row = &mut self.grid[line][..]; for col in (col.0..(columns - width)).rev() { row.swap(col + width, col); } } if width == 1 { self.write_at_cursor(c); } else { if self.grid.cursor.point.column + 1 >= columns { if self.mode.contains(TermMode::LINE_WRAP) { // Insert placeholder before wide char if glyph does not fit in this row. self.grid.cursor.template.flags.insert(Flags::LEADING_WIDE_CHAR_SPACER); self.write_at_cursor(' '); self.grid.cursor.template.flags.remove(Flags::LEADING_WIDE_CHAR_SPACER); self.wrapline(); } else { // Prevent out of bounds crash when linewrapping is disabled. self.grid.cursor.input_needs_wrap = true; return; } } // Write full width glyph to current cursor cell. self.grid.cursor.template.flags.insert(Flags::WIDE_CHAR); self.write_at_cursor(c); self.grid.cursor.template.flags.remove(Flags::WIDE_CHAR); // Write spacer to cell following the wide glyph. self.grid.cursor.point.column += 1; self.grid.cursor.template.flags.insert(Flags::WIDE_CHAR_SPACER); self.write_at_cursor(' '); self.grid.cursor.template.flags.remove(Flags::WIDE_CHAR_SPACER); } if self.grid.cursor.point.column + 1 < columns { self.grid.cursor.point.column += 1; } else { self.grid.cursor.input_needs_wrap = true; } } #[inline] fn decaln(&mut self) { trace!("Decalnning"); for line in (0..self.screen_lines()).map(Line::from) { for column in 0..self.columns() { let cell = &mut self.grid[line][Column(column)]; *cell = Cell::default(); cell.c = 'E'; } } self.mark_fully_damaged(); } #[inline] fn goto(&mut self, line: i32, col: usize) { let line = Line(line); let col = Column(col); trace!("Going to: line={}, col={}", line, col); let (y_offset, max_y) = if self.mode.contains(TermMode::ORIGIN) { (self.scroll_region.start, self.scroll_region.end - 1) } else { (Line(0), self.bottommost_line()) }; self.damage_cursor(); self.grid.cursor.point.line = cmp::max(cmp::min(line + y_offset, max_y), Line(0)); self.grid.cursor.point.column = cmp::min(col, self.last_column()); self.damage_cursor(); self.grid.cursor.input_needs_wrap = false; } #[inline] fn goto_line(&mut self, line: i32) { trace!("Going to line: {}", line); self.goto(line, self.grid.cursor.point.column.0) } #[inline] fn goto_col(&mut self, col: usize) { trace!("Going to column: {}", col); self.goto(self.grid.cursor.point.line.0, col) } #[inline] fn insert_blank(&mut self, count: usize) { let cursor = &self.grid.cursor; let bg = cursor.template.bg; // Ensure inserting within terminal bounds let count = cmp::min(count, self.columns() - cursor.point.column.0); let source = cursor.point.column; let destination = cursor.point.column.0 + count; let num_cells = self.columns() - destination; let line = cursor.point.line; self.damage.damage_line(line.0 as usize, 0, self.columns() - 1); let row = &mut self.grid[line][..]; for offset in (0..num_cells).rev() { row.swap(destination + offset, source.0 + offset); } // Cells were just moved out toward the end of the line; // fill in between source and dest with blanks. for cell in &mut row[source.0..destination] { *cell = bg.into(); } } #[inline] fn move_up(&mut self, lines: usize) { trace!("Moving up: {}", lines); let line = self.grid.cursor.point.line - lines; let column = self.grid.cursor.point.column; self.goto(line.0, column.0) } #[inline] fn move_down(&mut self, lines: usize) { trace!("Moving down: {}", lines); let line = self.grid.cursor.point.line + lines; let column = self.grid.cursor.point.column; self.goto(line.0, column.0) } #[inline] fn move_forward(&mut self, cols: usize) { trace!("Moving forward: {}", cols); let last_column = cmp::min(self.grid.cursor.point.column + cols, self.last_column()); let cursor_line = self.grid.cursor.point.line.0 as usize; self.damage.damage_line(cursor_line, self.grid.cursor.point.column.0, last_column.0); self.grid.cursor.point.column = last_column; self.grid.cursor.input_needs_wrap = false; } #[inline] fn move_backward(&mut self, cols: usize) { trace!("Moving backward: {}", cols); let column = self.grid.cursor.point.column.saturating_sub(cols); let cursor_line = self.grid.cursor.point.line.0 as usize; self.damage.damage_line(cursor_line, column, self.grid.cursor.point.column.0); self.grid.cursor.point.column = Column(column); self.grid.cursor.input_needs_wrap = false; } #[inline] fn identify_terminal(&mut self, intermediate: Option<char>) { match intermediate { None => { trace!("Reporting primary device attributes"); let text = String::from("\x1b[?6c"); self.event_proxy.send_event(Event::PtyWrite(text)); }, Some('>') => { trace!("Reporting secondary device attributes"); let version = version_number(env!("CARGO_PKG_VERSION")); let text = format!("\x1b[>0;{version};1c"); self.event_proxy.send_event(Event::PtyWrite(text)); }, _ => debug!("Unsupported device attributes intermediate"), } } #[inline] fn device_status(&mut self, arg: usize) { trace!("Reporting device status: {}", arg); match arg { 5 => { let text = String::from("\x1b[0n"); self.event_proxy.send_event(Event::PtyWrite(text)); }, 6 => { let pos = self.grid.cursor.point; let text = format!("\x1b[{};{}R", pos.line + 1, pos.column + 1); self.event_proxy.send_event(Event::PtyWrite(text)); }, _ => debug!("unknown device status query: {}", arg), }; } #[inline] fn move_down_and_cr(&mut self, lines: usize) { trace!("Moving down and cr: {}", lines); let line = self.grid.cursor.point.line + lines; self.goto(line.0, 0) } #[inline] fn move_up_and_cr(&mut self, lines: usize) { trace!("Moving up and cr: {}", lines); let line = self.grid.cursor.point.line - lines; self.goto(line.0, 0) } /// Insert tab at cursor position. #[inline] fn put_tab(&mut self, mut count: u16) { // A tab after the last column is the same as a linebreak. if self.grid.cursor.input_needs_wrap { self.wrapline(); return; } while self.grid.cursor.point.column < self.columns() && count != 0 { count -= 1; let c = self.grid.cursor.charsets[self.active_charset].map('\t'); let cell = self.grid.cursor_cell(); if cell.c == ' ' { cell.c = c; } loop { if (self.grid.cursor.point.column + 1) == self.columns() { break; } self.grid.cursor.point.column += 1; if self.tabs[self.grid.cursor.point.column] { break; } } } } /// Backspace. #[inline] fn backspace(&mut self) { trace!("Backspace"); if self.grid.cursor.point.column > Column(0) { let line = self.grid.cursor.point.line.0 as usize; let column = self.grid.cursor.point.column.0; self.grid.cursor.point.column -= 1; self.grid.cursor.input_needs_wrap = false; self.damage.damage_line(line, column - 1, column); } } /// Carriage return. #[inline] fn carriage_return(&mut self) { trace!("Carriage return"); let new_col = 0; let line = self.grid.cursor.point.line.0 as usize; self.damage_line(line, new_col, self.grid.cursor.point.column.0); self.grid.cursor.point.column = Column(new_col); self.grid.cursor.input_needs_wrap = false; } /// Linefeed. #[inline] fn linefeed(&mut self) { trace!("Linefeed"); let next = self.grid.cursor.point.line + 1; if next == self.scroll_region.end { self.scroll_up(1); } else if next < self.screen_lines() { self.damage_cursor(); self.grid.cursor.point.line += 1; self.damage_cursor(); } } /// Set current position as a tabstop. #[inline] fn bell(&mut self) { trace!("Bell"); self.event_proxy.send_event(Event::Bell); } #[inline] fn substitute(&mut self) { trace!("[unimplemented] Substitute"); } /// Run LF/NL. /// /// LF/NL mode has some interesting history. According to ECMA-48 4th /// edition, in LINE FEED mode, /// /// > The execution of the formatter functions LINE FEED (LF), FORM FEED /// (FF), LINE TABULATION (VT) cause only movement of the active position in /// the direction of the line progression. /// /// In NEW LINE mode, /// /// > The execution of the formatter functions LINE FEED (LF), FORM FEED /// (FF), LINE TABULATION (VT) cause movement to the line home position on /// the following line, the following form, etc. In the case of LF this is /// referred to as the New Line (NL) option. /// /// Additionally, ECMA-48 4th edition says that this option is deprecated. /// ECMA-48 5th edition only mentions this option (without explanation) /// saying that it's been removed. /// /// As an emulator, we need to support it since applications may still rely /// on it. #[inline] fn newline(&mut self) { self.linefeed(); if self.mode.contains(TermMode::LINE_FEED_NEW_LINE) { self.carriage_return(); } } #[inline] fn set_horizontal_tabstop(&mut self) { trace!("Setting horizontal tabstop"); self.tabs[self.grid.cursor.point.column] = true; } #[inline] fn scroll_up(&mut self, lines: usize) { let origin = self.scroll_region.start; self.scroll_up_relative(origin, lines); } #[inline] fn scroll_down(&mut self, lines: usize) { let origin = self.scroll_region.start; self.scroll_down_relative(origin, lines); } #[inline] fn insert_blank_lines(&mut self, lines: usize) { trace!("Inserting blank {} lines", lines); let origin = self.grid.cursor.point.line; if self.scroll_region.contains(&origin) { self.scroll_down_relative(origin, lines); } } #[inline] fn delete_lines(&mut self, lines: usize) { let origin = self.grid.cursor.point.line; let lines = cmp::min(self.screen_lines() - origin.0 as usize, lines); trace!("Deleting {} lines", lines); if lines > 0 && self.scroll_region.contains(&origin) { self.scroll_up_relative(origin, lines); } } #[inline] fn erase_chars(&mut self, count: usize) { let cursor = &self.grid.cursor; trace!("Erasing chars: count={}, col={}", count, cursor.point.column); let start = cursor.point.column; let end = cmp::min(start + count, Column(self.columns())); // Cleared cells have current background color set. let bg = self.grid.cursor.template.bg; let line = cursor.point.line; self.damage.damage_line(line.0 as usize, start.0, end.0); let row = &mut self.grid[line]; for cell in &mut row[start..end] { *cell = bg.into(); } } #[inline] fn delete_chars(&mut self, count: usize) { let columns = self.columns(); let cursor = &self.grid.cursor; let bg = cursor.template.bg; // Ensure deleting within terminal bounds. let count = cmp::min(count, columns); let start = cursor.point.column.0; let end = cmp::min(start + count, columns - 1); let num_cells = columns - end; let line = cursor.point.line; self.damage.damage_line(line.0 as usize, 0, self.columns() - 1); let row = &mut self.grid[line][..]; for offset in 0..num_cells { row.swap(start + offset, end + offset); } // Clear last `count` cells in the row. If deleting 1 char, need to delete // 1 cell. let end = columns - count; for cell in &mut row[end..] { *cell = bg.into(); } } #[inline] fn move_backward_tabs(&mut self, count: u16) { trace!("Moving backward {} tabs", count); self.damage_cursor(); let old_col = self.grid.cursor.point.column.0; for _ in 0..count { let mut col = self.grid.cursor.point.column; for i in (0..(col.0)).rev() { if self.tabs[index::Column(i)] { col = index::Column(i); break; } } self.grid.cursor.point.column = col; } let line = self.grid.cursor.point.line.0 as usize; self.damage_line(line, self.grid.cursor.point.column.0, old_col); } #[inline] fn move_forward_tabs(&mut self, count: u16) { trace!("[unimplemented] Moving forward {} tabs", count); } #[inline] fn save_cursor_position(&mut self) { trace!("Saving cursor position"); self.grid.saved_cursor = self.grid.cursor.clone(); } #[inline] fn restore_cursor_position(&mut self) { trace!("Restoring cursor position"); self.damage_cursor(); self.grid.cursor = self.grid.saved_cursor.clone(); self.damage_cursor(); } #[inline] fn clear_line(&mut self, mode: ansi::LineClearMode) { trace!("Clearing line: {:?}", mode); let cursor = &self.grid.cursor; let bg = cursor.template.bg; let point = cursor.point; let (left, right) = match mode { ansi::LineClearMode::Right if cursor.input_needs_wrap => return, ansi::LineClearMode::Right => (point.column, Column(self.columns())), ansi::LineClearMode::Left => (Column(0), point.column + 1), ansi::LineClearMode::All => (Column(0), Column(self.columns())), }; self.damage.damage_line(point.line.0 as usize, left.0, right.0 - 1); let row = &mut self.grid[point.line]; for cell in &mut row[left..right] { *cell = bg.into(); } let range = self.grid.cursor.point.line..=self.grid.cursor.point.line; self.selection = self.selection.take().filter(|s| !s.intersects_range(range)); } /// Set the indexed color value. #[inline] fn set_color(&mut self, index: usize, color: VteRgb) { trace!("Setting color[{}] = {:?}", index, color); let color = color.into(); // Damage terminal if the color changed and it's not the cursor. if index != NamedColor::Cursor as usize && self.colors[index] != Some(color) { self.mark_fully_damaged(); } self.colors[index] = Some(color); } /// Respond to a color query escape sequence. #[inline] fn dynamic_color_sequence(&mut self, prefix: String, index: usize, terminator: &str) { trace!("Requested write of escape sequence for color code {}: color[{}]", prefix, index); let terminator = terminator.to_owned(); self.event_proxy.send_event(Event::ColorRequest( index, Arc::new(move |color| { format!( "\x1b]{};rgb:{1:02x}{1:02x}/{2:02x}{2:02x}/{3:02x}{3:02x}{4}", prefix, color.r, color.g, color.b, terminator ) }), )); } /// Reset the indexed color to original value. #[inline] fn reset_color(&mut self, index: usize) { trace!("Resetting color[{}]", index); // Damage terminal if the color changed and it's not the cursor. if index != NamedColor::Cursor as usize && self.colors[index].is_some() { self.mark_fully_damaged(); } self.colors[index] = None; } /// Store data into clipboard. #[inline] fn clipboard_store(&mut self, clipboard: u8, base64: &[u8]) { if !matches!(self.config.osc52, Osc52::OnlyCopy | Osc52::CopyPaste) { debug!("Denied osc52 store"); return; } let clipboard_type = match clipboard { b'c' => ClipboardType::Clipboard, b'p' | b's' => ClipboardType::Selection, _ => return, }; if let Ok(bytes) = base64::decode(base64) { if let Ok(text) = String::from_utf8(bytes) { self.event_proxy.send_event(Event::ClipboardStore(clipboard_type, text)); } } } /// Load data from clipboard. #[inline] fn clipboard_load(&mut self, clipboard: u8, terminator: &str) { if !matches!(self.config.osc52, Osc52::OnlyPaste | Osc52::CopyPaste) { debug!("Denied osc52 load"); return; } let clipboard_type = match clipboard { b'c' => ClipboardType::Clipboard, b'p' | b's' => ClipboardType::Selection, _ => return, }; let terminator = terminator.to_owned(); self.event_proxy.send_event(Event::ClipboardLoad( clipboard_type, Arc::new(move |text| { let base64 = base64::encode(text); format!("\x1b]52;{};{}{}", clipboard as char, base64, terminator) }), )); } #[inline] fn clear_screen(&mut self, mode: ansi::ClearMode) { trace!("Clearing screen: {:?}", mode); let bg = self.grid.cursor.template.bg; let screen_lines = self.screen_lines(); match mode { ansi::ClearMode::Above => { let cursor = self.grid.cursor.point; // If clearing more than one line. if cursor.line > 1 { // Fully clear all lines before the current line. self.grid.reset_region(..cursor.line); } // Clear up to the current column in the current line. let end = cmp::min(cursor.column + 1, Column(self.columns())); for cell in &mut self.grid[cursor.line][..end] { *cell = bg.into(); } let range = Line(0)..=cursor.line; self.selection = self.selection.take().filter(|s| !s.intersects_range(range)); }, ansi::ClearMode::Below => { let cursor = self.grid.cursor.point; for cell in &mut self.grid[cursor.line][cursor.column..] { *cell = bg.into(); } if (cursor.line.0 as usize) < screen_lines - 1 { self.grid.reset_region((cursor.line + 1)..); } let range = cursor.line..Line(screen_lines as i32); self.selection = self.selection.take().filter(|s| !s.intersects_range(range)); }, ansi::ClearMode::All => { if self.mode.contains(TermMode::ALT_SCREEN) { self.grid.reset_region(..); } else { let old_offset = self.grid.display_offset(); self.grid.clear_viewport(); // Compute number of lines scrolled by clearing the viewport. let lines = self.grid.display_offset().saturating_sub(old_offset); self.vi_mode_cursor.point.line = (self.vi_mode_cursor.point.line - lines).grid_clamp(self, Boundary::Grid); } self.selection = None; }, ansi::ClearMode::Saved if self.history_size() > 0 => { self.grid.clear_history(); self.vi_mode_cursor.point.line = self.vi_mode_cursor.point.line.grid_clamp(self, Boundary::Cursor); self.selection = self.selection.take().filter(|s| !s.intersects_range(..Line(0))); }, // We have no history to clear. ansi::ClearMode::Saved => (), } self.mark_fully_damaged(); } #[inline] fn clear_tabs(&mut self, mode: ansi::TabulationClearMode) { trace!("Clearing tabs: {:?}", mode); match mode { ansi::TabulationClearMode::Current => { self.tabs[self.grid.cursor.point.column] = false; }, ansi::TabulationClearMode::All => { self.tabs.clear_all(); }, } } /// Reset all important fields in the term struct. #[inline] fn reset_state(&mut self) { if self.mode.contains(TermMode::ALT_SCREEN) { mem::swap(&mut self.grid, &mut self.inactive_grid); } self.active_charset = Default::default(); self.cursor_style = None; self.grid.reset(); self.inactive_grid.reset(); self.scroll_region = Line(0)..Line(self.screen_lines() as i32); self.tabs = TabStops::new(self.columns()); self.title_stack = Vec::new(); self.title = None; self.selection = None; self.vi_mode_cursor = Default::default(); // Preserve vi mode across resets. self.mode &= TermMode::VI; self.mode.insert(TermMode::default()); self.event_proxy.send_event(Event::CursorBlinkingChange); self.mark_fully_damaged(); } #[inline] fn reverse_index(&mut self) { trace!("Reversing index"); // If cursor is at the top. if self.grid.cursor.point.line == self.scroll_region.start { self.scroll_down(1); } else { self.damage_cursor(); self.grid.cursor.point.line = cmp::max(self.grid.cursor.point.line - 1, Line(0)); self.damage_cursor(); } } #[inline] fn set_hyperlink(&mut self, hyperlink: Option<VteHyperlink>) { trace!("Setting hyperlink: {:?}", hyperlink); self.grid.cursor.template.set_hyperlink(hyperlink.map(|e| e.into())); } /// Set a terminal attribute. #[inline] fn terminal_attribute(&mut self, attr: Attr) { trace!("Setting attribute: {:?}", attr); let cursor = &mut self.grid.cursor; match attr { Attr::Foreground(color) => cursor.template.fg = color, Attr::Background(color) => cursor.template.bg = color, Attr::UnderlineColor(color) => cursor.template.set_underline_color(color), Attr::Reset => { cursor.template.fg = Color::Named(NamedColor::Foreground); cursor.template.bg = Color::Named(NamedColor::Background); cursor.template.flags = Flags::empty(); cursor.template.set_underline_color(None); }, Attr::Reverse => cursor.template.flags.insert(Flags::INVERSE), Attr::CancelReverse => cursor.template.flags.remove(Flags::INVERSE), Attr::Bold => cursor.template.flags.insert(Flags::BOLD), Attr::CancelBold => cursor.template.flags.remove(Flags::BOLD), Attr::Dim => cursor.template.flags.insert(Flags::DIM), Attr::CancelBoldDim => cursor.template.flags.remove(Flags::BOLD | Flags::DIM), Attr::Italic => cursor.template.flags.insert(Flags::ITALIC), Attr::CancelItalic => cursor.template.flags.remove(Flags::ITALIC), Attr::Underline => { cursor.template.flags.remove(Flags::ALL_UNDERLINES); cursor.template.flags.insert(Flags::UNDERLINE); }, Attr::DoubleUnderline => { cursor.template.flags.remove(Flags::ALL_UNDERLINES); cursor.template.flags.insert(Flags::DOUBLE_UNDERLINE); }, Attr::Undercurl => { cursor.template.flags.remove(Flags::ALL_UNDERLINES); cursor.template.flags.insert(Flags::UNDERCURL); }, Attr::DottedUnderline => { cursor.template.flags.remove(Flags::ALL_UNDERLINES); cursor.template.flags.insert(Flags::DOTTED_UNDERLINE); }, Attr::DashedUnderline => { cursor.template.flags.remove(Flags::ALL_UNDERLINES); cursor.template.flags.insert(Flags::DASHED_UNDERLINE); }, Attr::CancelUnderline => cursor.template.flags.remove(Flags::ALL_UNDERLINES), Attr::Hidden => cursor.template.flags.insert(Flags::HIDDEN), Attr::CancelHidden => cursor.template.flags.remove(Flags::HIDDEN), Attr::Strike => cursor.template.flags.insert(Flags::STRIKEOUT), Attr::CancelStrike => cursor.template.flags.remove(Flags::STRIKEOUT), _ => { debug!("Term got unhandled attr: {:?}", attr); }, } } #[inline] fn set_mode(&mut self, mode: ansi::Mode) { trace!("Setting mode: {:?}", mode); match mode { ansi::Mode::UrgencyHints => self.mode.insert(TermMode::URGENCY_HINTS), ansi::Mode::SwapScreenAndSetRestoreCursor => { if !self.mode.contains(TermMode::ALT_SCREEN) { self.swap_alt(); } }, ansi::Mode::ShowCursor => self.mode.insert(TermMode::SHOW_CURSOR), ansi::Mode::CursorKeys => self.mode.insert(TermMode::APP_CURSOR), // Mouse protocols are mutually exclusive. ansi::Mode::ReportMouseClicks => { self.mode.remove(TermMode::MOUSE_MODE); self.mode.insert(TermMode::MOUSE_REPORT_CLICK); self.event_proxy.send_event(Event::MouseCursorDirty); }, ansi::Mode::ReportCellMouseMotion => { self.mode.remove(TermMode::MOUSE_MODE); self.mode.insert(TermMode::MOUSE_DRAG); self.event_proxy.send_event(Event::MouseCursorDirty); }, ansi::Mode::ReportAllMouseMotion => { self.mode.remove(TermMode::MOUSE_MODE); self.mode.insert(TermMode::MOUSE_MOTION); self.event_proxy.send_event(Event::MouseCursorDirty); }, ansi::Mode::ReportFocusInOut => self.mode.insert(TermMode::FOCUS_IN_OUT), ansi::Mode::BracketedPaste => self.mode.insert(TermMode::BRACKETED_PASTE), // Mouse encodings are mutually exclusive. ansi::Mode::SgrMouse => { self.mode.remove(TermMode::UTF8_MOUSE); self.mode.insert(TermMode::SGR_MOUSE); }, ansi::Mode::Utf8Mouse => { self.mode.remove(TermMode::SGR_MOUSE); self.mode.insert(TermMode::UTF8_MOUSE); }, ansi::Mode::AlternateScroll => self.mode.insert(TermMode::ALTERNATE_SCROLL), ansi::Mode::LineWrap => self.mode.insert(TermMode::LINE_WRAP), ansi::Mode::LineFeedNewLine => self.mode.insert(TermMode::LINE_FEED_NEW_LINE), ansi::Mode::Origin => self.mode.insert(TermMode::ORIGIN), ansi::Mode::ColumnMode => self.deccolm(), ansi::Mode::Insert => self.mode.insert(TermMode::INSERT), ansi::Mode::BlinkingCursor => { let style = self.cursor_style.get_or_insert(self.default_cursor_style); style.blinking = true; self.event_proxy.send_event(Event::CursorBlinkingChange); }, } } #[inline] fn unset_mode(&mut self, mode: ansi::Mode) { trace!("Unsetting mode: {:?}", mode); match mode { ansi::Mode::UrgencyHints => self.mode.remove(TermMode::URGENCY_HINTS), ansi::Mode::SwapScreenAndSetRestoreCursor => { if self.mode.contains(TermMode::ALT_SCREEN) { self.swap_alt(); } }, ansi::Mode::ShowCursor => self.mode.remove(TermMode::SHOW_CURSOR), ansi::Mode::CursorKeys => self.mode.remove(TermMode::APP_CURSOR), ansi::Mode::ReportMouseClicks => { self.mode.remove(TermMode::MOUSE_REPORT_CLICK); self.event_proxy.send_event(Event::MouseCursorDirty); }, ansi::Mode::ReportCellMouseMotion => { self.mode.remove(TermMode::MOUSE_DRAG); self.event_proxy.send_event(Event::MouseCursorDirty); }, ansi::Mode::ReportAllMouseMotion => { self.mode.remove(TermMode::MOUSE_MOTION); self.event_proxy.send_event(Event::MouseCursorDirty); }, ansi::Mode::ReportFocusInOut => self.mode.remove(TermMode::FOCUS_IN_OUT), ansi::Mode::BracketedPaste => self.mode.remove(TermMode::BRACKETED_PASTE), ansi::Mode::SgrMouse => self.mode.remove(TermMode::SGR_MOUSE), ansi::Mode::Utf8Mouse => self.mode.remove(TermMode::UTF8_MOUSE), ansi::Mode::AlternateScroll => self.mode.remove(TermMode::ALTERNATE_SCROLL), ansi::Mode::LineWrap => self.mode.remove(TermMode::LINE_WRAP), ansi::Mode::LineFeedNewLine => self.mode.remove(TermMode::LINE_FEED_NEW_LINE), ansi::Mode::Origin => self.mode.remove(TermMode::ORIGIN), ansi::Mode::ColumnMode => self.deccolm(), ansi::Mode::Insert => { self.mode.remove(TermMode::INSERT); self.mark_fully_damaged(); }, ansi::Mode::BlinkingCursor => { let style = self.cursor_style.get_or_insert(self.default_cursor_style); style.blinking = false; self.event_proxy.send_event(Event::CursorBlinkingChange); }, } } #[inline] fn set_scrolling_region(&mut self, top: usize, bottom: Option<usize>) { // Fallback to the last line as default. let bottom = bottom.unwrap_or_else(|| self.screen_lines()); if top >= bottom { debug!("Invalid scrolling region: ({};{})", top, bottom); return; } // Bottom should be included in the range, but range end is not // usually included. One option would be to use an inclusive // range, but instead we just let the open range end be 1 // higher. let start = Line(top as i32 - 1); let end = Line(bottom as i32); trace!("Setting scrolling region: ({};{})", start, end); let screen_lines = Line(self.screen_lines() as i32); self.scroll_region.start = cmp::min(start, screen_lines); self.scroll_region.end = cmp::min(end, screen_lines); self.goto(0, 0); } #[inline] fn set_keypad_application_mode(&mut self) { trace!("Setting keypad application mode"); self.mode.insert(TermMode::APP_KEYPAD); } #[inline] fn unset_keypad_application_mode(&mut self) { trace!("Unsetting keypad application mode"); self.mode.remove(TermMode::APP_KEYPAD); } #[inline] fn configure_charset(&mut self, index: CharsetIndex, charset: StandardCharset) { trace!("Configuring charset {:?} as {:?}", index, charset); self.grid.cursor.charsets[index] = charset; } #[inline] fn set_active_charset(&mut self, index: CharsetIndex) { trace!("Setting active charset {:?}", index); self.active_charset = index; } #[inline] fn set_cursor_style(&mut self, style: Option<CursorStyle>) { trace!("Setting cursor style {:?}", style); self.cursor_style = style; // Notify UI about blinking changes. self.event_proxy.send_event(Event::CursorBlinkingChange); } #[inline] fn set_cursor_shape(&mut self, shape: CursorShape) { trace!("Setting cursor shape {:?}", shape); let style = self.cursor_style.get_or_insert(self.default_cursor_style); style.shape = shape; } #[inline] fn set_title(&mut self, title: Option<String>) { trace!("Setting title to '{:?}'", title); self.title = title.clone(); let title_event = match title { Some(title) => Event::Title(title), None => Event::ResetTitle, }; self.event_proxy.send_event(title_event); } #[inline] fn push_title(&mut self) { trace!("Pushing '{:?}' onto title stack", self.title); if self.title_stack.len() >= TITLE_STACK_MAX_DEPTH { let removed = self.title_stack.remove(0); trace!( "Removing '{:?}' from bottom of title stack that exceeds its maximum depth", removed ); } self.title_stack.push(self.title.clone()); } #[inline] fn pop_title(&mut self) { trace!("Attempting to pop title from stack..."); if let Some(popped) = self.title_stack.pop() { trace!("Title '{:?}' popped from stack", popped); self.set_title(popped); } } #[inline] fn text_area_size_pixels(&mut self) { self.event_proxy.send_event(Event::TextAreaSizeRequest(Arc::new(move |window_size| { let height = window_size.num_lines * window_size.cell_height; let width = window_size.num_cols * window_size.cell_width; format!("\x1b[4;{height};{width}t") }))); } #[inline] fn text_area_size_chars(&mut self) { let text = format!("\x1b[8;{};{}t", self.screen_lines(), self.columns()); self.event_proxy.send_event(Event::PtyWrite(text)); } } /// Terminal version for escape sequence reports. /// /// This returns the current terminal version as a unique number based on alacritty_terminal's /// semver version. The different versions are padded to ensure that a higher semver version will /// always report a higher version number. fn version_number(mut version: &str) -> usize { if let Some(separator) = version.rfind('-') { version = &version[..separator]; } let mut version_number = 0; let semver_versions = version.split('.'); for (i, semver_version) in semver_versions.rev().enumerate() { let semver_number = semver_version.parse::<usize>().unwrap_or(0); version_number += usize::pow(100, i as u32) * semver_number; } version_number } #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum ClipboardType { Clipboard, Selection, } struct TabStops { tabs: Vec<bool>, } impl TabStops { #[inline] fn new(columns: usize) -> TabStops { TabStops { tabs: (0..columns).map(|i| i % INITIAL_TABSTOPS == 0).collect() } } /// Remove all tabstops. #[inline] fn clear_all(&mut self) { unsafe { ptr::write_bytes(self.tabs.as_mut_ptr(), 0, self.tabs.len()); } } /// Increase tabstop capacity. #[inline] fn resize(&mut self, columns: usize) { let mut index = self.tabs.len(); self.tabs.resize_with(columns, || { let is_tabstop = index % INITIAL_TABSTOPS == 0; index += 1; is_tabstop }); } } impl Index<Column> for TabStops { type Output = bool; fn index(&self, index: Column) -> &bool { &self.tabs[index.0] } } impl IndexMut<Column> for TabStops { fn index_mut(&mut self, index: Column) -> &mut bool { self.tabs.index_mut(index.0) } } /// Terminal cursor rendering information. #[derive(Copy, Clone, PartialEq, Eq)] pub struct RenderableCursor { pub shape: CursorShape, pub point: Point, } impl RenderableCursor { fn new<T>(term: &Term<T>) -> Self { // Cursor position. let vi_mode = term.mode().contains(TermMode::VI); let mut point = if vi_mode { term.vi_mode_cursor.point } else { term.grid.cursor.point }; if term.grid[point].flags.contains(Flags::WIDE_CHAR_SPACER) { point.column -= 1; } // Cursor shape. let shape = if !vi_mode && !term.mode().contains(TermMode::SHOW_CURSOR) { CursorShape::Hidden } else { term.cursor_style().shape }; Self { shape, point } } } /// Visible terminal content. /// /// This contains all content required to render the current terminal view. pub struct RenderableContent<'a> { pub display_iter: GridIterator<'a, Cell>, pub selection: Option<SelectionRange>, pub cursor: RenderableCursor, pub display_offset: usize, pub colors: &'a color::Colors, pub mode: TermMode, } impl<'a> RenderableContent<'a> { fn new<T>(term: &'a Term<T>) -> Self { Self { display_iter: term.grid().display_iter(), display_offset: term.grid().display_offset(), cursor: RenderableCursor::new(term), selection: term.selection.as_ref().and_then(|s| s.to_range(term)), colors: &term.colors, mode: *term.mode(), } } } /// Terminal test helpers. pub mod test { use super::*; use serde::{Deserialize, Serialize}; use unicode_width::UnicodeWidthChar; use crate::config::Config; use crate::event::VoidListener; use crate::index::Column; #[derive(Serialize, Deserialize)] pub struct TermSize { pub columns: usize, pub screen_lines: usize, } impl TermSize { pub fn new(columns: usize, screen_lines: usize) -> Self { Self { columns, screen_lines } } } impl Dimensions for TermSize { fn total_lines(&self) -> usize { self.screen_lines() } fn screen_lines(&self) -> usize { self.screen_lines } fn columns(&self) -> usize { self.columns } } /// Construct a terminal from its content as string. /// /// A `\n` will break line and `\r\n` will break line without wrapping. /// /// # Examples /// /// ```rust /// use alacritty_terminal::term::test::mock_term; /// /// // Create a terminal with the following cells: /// // /// // [h][e][l][l][o] <- WRAPLINE flag set /// // [:][)][ ][ ][ ] /// // [t][e][s][t][ ] /// mock_term( /// "\ /// hello\n:)\r\ntest", /// ); /// ``` pub fn mock_term(content: &str) -> Term<VoidListener> { let lines: Vec<&str> = content.split('\n').collect(); let num_cols = lines .iter() .map(|line| line.chars().filter(|c| *c != '\r').map(|c| c.width().unwrap()).sum()) .max() .unwrap_or(0); // Create terminal with the appropriate dimensions. let size = TermSize::new(num_cols, lines.len()); let mut term = Term::new(&Config::default(), &size, VoidListener); // Fill terminal with content. for (line, text) in lines.iter().enumerate() { let line = Line(line as i32); if !text.ends_with('\r') && line + 1 != lines.len() { term.grid[line][Column(num_cols - 1)].flags.insert(Flags::WRAPLINE); } let mut index = 0; for c in text.chars().take_while(|c| *c != '\r') { term.grid[line][Column(index)].c = c; // Handle fullwidth characters. let width = c.width().unwrap(); if width == 2 { term.grid[line][Column(index)].flags.insert(Flags::WIDE_CHAR); term.grid[line][Column(index + 1)].flags.insert(Flags::WIDE_CHAR_SPACER); } index += width; } } term } } #[cfg(test)] mod tests { use super::*; use std::mem; use crate::ansi::{self, CharsetIndex, Handler, StandardCharset}; use crate::config::Config; use crate::event::VoidListener; use crate::grid::{Grid, Scroll}; use crate::index::{Column, Point, Side}; use crate::selection::{Selection, SelectionType}; use crate::term::cell::{Cell, Flags}; use crate::term::test::TermSize; #[test] fn scroll_display_page_up() { let size = TermSize::new(5, 10); let mut term = Term::new(&Config::default(), &size, VoidListener); // Create 11 lines of scrollback. for _ in 0..20 { term.newline(); } // Scrollable amount to top is 11. term.scroll_display(Scroll::PageUp); assert_eq!(term.vi_mode_cursor.point, Point::new(Line(-1), Column(0))); assert_eq!(term.grid.display_offset(), 10); // Scrollable amount to top is 1. term.scroll_display(Scroll::PageUp); assert_eq!(term.vi_mode_cursor.point, Point::new(Line(-2), Column(0))); assert_eq!(term.grid.display_offset(), 11); // Scrollable amount to top is 0. term.scroll_display(Scroll::PageUp); assert_eq!(term.vi_mode_cursor.point, Point::new(Line(-2), Column(0))); assert_eq!(term.grid.display_offset(), 11); } #[test] fn scroll_display_page_down() { let size = TermSize::new(5, 10); let mut term = Term::new(&Config::default(), &size, VoidListener); // Create 11 lines of scrollback. for _ in 0..20 { term.newline(); } // Change display_offset to topmost. term.grid_mut().scroll_display(Scroll::Top); term.vi_mode_cursor = ViModeCursor::new(Point::new(Line(-11), Column(0))); // Scrollable amount to bottom is 11. term.scroll_display(Scroll::PageDown); assert_eq!(term.vi_mode_cursor.point, Point::new(Line(-1), Column(0))); assert_eq!(term.grid.display_offset(), 1); // Scrollable amount to bottom is 1. term.scroll_display(Scroll::PageDown); assert_eq!(term.vi_mode_cursor.point, Point::new(Line(0), Column(0))); assert_eq!(term.grid.display_offset(), 0); // Scrollable amount to bottom is 0. term.scroll_display(Scroll::PageDown); assert_eq!(term.vi_mode_cursor.point, Point::new(Line(0), Column(0))); assert_eq!(term.grid.display_offset(), 0); } #[test] fn simple_selection_works() { let size = TermSize::new(5, 5); let mut term = Term::new(&Config::default(), &size, VoidListener); let grid = term.grid_mut(); for i in 0..4 { if i == 1 { continue; } grid[Line(i)][Column(0)].c = '"'; for j in 1..4 { grid[Line(i)][Column(j)].c = 'a'; } grid[Line(i)][Column(4)].c = '"'; } grid[Line(2)][Column(0)].c = ' '; grid[Line(2)][Column(4)].c = ' '; grid[Line(2)][Column(4)].flags.insert(Flags::WRAPLINE); grid[Line(3)][Column(0)].c = ' '; // Multiple lines contain an empty line. term.selection = Some(Selection::new( SelectionType::Simple, Point { line: Line(0), column: Column(0) }, Side::Left, )); if let Some(s) = term.selection.as_mut() { s.update(Point { line: Line(2), column: Column(4) }, Side::Right); } assert_eq!(term.selection_to_string(), Some(String::from("\"aaa\"\n\n aaa "))); // A wrapline. term.selection = Some(Selection::new( SelectionType::Simple, Point { line: Line(2), column: Column(0) }, Side::Left, )); if let Some(s) = term.selection.as_mut() { s.update(Point { line: Line(3), column: Column(4) }, Side::Right); } assert_eq!(term.selection_to_string(), Some(String::from(" aaa aaa\""))); } #[test] fn semantic_selection_works() { let size = TermSize::new(5, 3); let mut term = Term::new(&Config::default(), &size, VoidListener); let mut grid: Grid<Cell> = Grid::new(3, 5, 0); for i in 0..5 { for j in 0..2 { grid[Line(j)][Column(i)].c = 'a'; } } grid[Line(0)][Column(0)].c = '"'; grid[Line(0)][Column(3)].c = '"'; grid[Line(1)][Column(2)].c = '"'; grid[Line(0)][Column(4)].flags.insert(Flags::WRAPLINE); let mut escape_chars = String::from("\""); mem::swap(&mut term.grid, &mut grid); mem::swap(&mut term.semantic_escape_chars, &mut escape_chars); { term.selection = Some(Selection::new( SelectionType::Semantic, Point { line: Line(0), column: Column(1) }, Side::Left, )); assert_eq!(term.selection_to_string(), Some(String::from("aa"))); } { term.selection = Some(Selection::new( SelectionType::Semantic, Point { line: Line(0), column: Column(4) }, Side::Left, )); assert_eq!(term.selection_to_string(), Some(String::from("aaa"))); } { term.selection = Some(Selection::new( SelectionType::Semantic, Point { line: Line(1), column: Column(1) }, Side::Left, )); assert_eq!(term.selection_to_string(), Some(String::from("aaa"))); } } #[test] fn line_selection_works() { let size = TermSize::new(5, 1); let mut term = Term::new(&Config::default(), &size, VoidListener); let mut grid: Grid<Cell> = Grid::new(1, 5, 0); for i in 0..5 { grid[Line(0)][Column(i)].c = 'a'; } grid[Line(0)][Column(0)].c = '"'; grid[Line(0)][Column(3)].c = '"'; mem::swap(&mut term.grid, &mut grid); term.selection = Some(Selection::new( SelectionType::Lines, Point { line: Line(0), column: Column(3) }, Side::Left, )); assert_eq!(term.selection_to_string(), Some(String::from("\"aa\"a\n"))); } #[test] fn block_selection_works() { let size = TermSize::new(5, 5); let mut term = Term::new(&Config::default(), &size, VoidListener); let grid = term.grid_mut(); for i in 1..4 { grid[Line(i)][Column(0)].c = '"'; for j in 1..4 { grid[Line(i)][Column(j)].c = 'a'; } grid[Line(i)][Column(4)].c = '"'; } grid[Line(2)][Column(2)].c = ' '; grid[Line(2)][Column(4)].flags.insert(Flags::WRAPLINE); grid[Line(3)][Column(4)].c = ' '; term.selection = Some(Selection::new( SelectionType::Block, Point { line: Line(0), column: Column(3) }, Side::Left, )); // The same column. if let Some(s) = term.selection.as_mut() { s.update(Point { line: Line(3), column: Column(3) }, Side::Right); } assert_eq!(term.selection_to_string(), Some(String::from("\na\na\na"))); // The first column. if let Some(s) = term.selection.as_mut() { s.update(Point { line: Line(3), column: Column(0) }, Side::Left); } assert_eq!(term.selection_to_string(), Some(String::from("\n\"aa\n\"a\n\"aa"))); // The last column. if let Some(s) = term.selection.as_mut() { s.update(Point { line: Line(3), column: Column(4) }, Side::Right); } assert_eq!(term.selection_to_string(), Some(String::from("\na\"\na\"\na"))); } /// Check that the grid can be serialized back and forth losslessly. /// /// This test is in the term module as opposed to the grid since we want to /// test this property with a T=Cell. #[test] fn grid_serde() { let grid: Grid<Cell> = Grid::new(24, 80, 0); let serialized = serde_json::to_string(&grid).expect("ser"); let deserialized = serde_json::from_str::<Grid<Cell>>(&serialized).expect("de"); assert_eq!(deserialized, grid); } #[test] fn input_line_drawing_character() { let size = TermSize::new(7, 17); let mut term = Term::new(&Config::default(), &size, VoidListener); let cursor = Point::new(Line(0), Column(0)); term.configure_charset(CharsetIndex::G0, StandardCharset::SpecialCharacterAndLineDrawing); term.input('a'); assert_eq!(term.grid()[cursor].c, '▒'); } #[test] fn clearing_viewport_keeps_history_position() { let size = TermSize::new(10, 20); let mut term = Term::new(&Config::default(), &size, VoidListener); // Create 10 lines of scrollback. for _ in 0..29 { term.newline(); } // Change the display area. term.scroll_display(Scroll::Top); assert_eq!(term.grid.display_offset(), 10); // Clear the viewport. term.clear_screen(ansi::ClearMode::All); assert_eq!(term.grid.display_offset(), 10); } #[test] fn clearing_viewport_with_vi_mode_keeps_history_position() { let size = TermSize::new(10, 20); let mut term = Term::new(&Config::default(), &size, VoidListener); // Create 10 lines of scrollback. for _ in 0..29 { term.newline(); } // Enable vi mode. term.toggle_vi_mode(); // Change the display area and the vi cursor position. term.scroll_display(Scroll::Top); term.vi_mode_cursor.point = Point::new(Line(-5), Column(3)); assert_eq!(term.grid.display_offset(), 10); // Clear the viewport. term.clear_screen(ansi::ClearMode::All); assert_eq!(term.grid.display_offset(), 10); assert_eq!(term.vi_mode_cursor.point, Point::new(Line(-5), Column(3))); } #[test] fn clearing_scrollback_resets_display_offset() { let size = TermSize::new(10, 20); let mut term = Term::new(&Config::default(), &size, VoidListener); // Create 10 lines of scrollback. for _ in 0..29 { term.newline(); } // Change the display area. term.scroll_display(Scroll::Top); assert_eq!(term.grid.display_offset(), 10); // Clear the scrollback buffer. term.clear_screen(ansi::ClearMode::Saved); assert_eq!(term.grid.display_offset(), 0); } #[test] fn clearing_scrollback_sets_vi_cursor_into_viewport() { let size = TermSize::new(10, 20); let mut term = Term::new(&Config::default(), &size, VoidListener); // Create 10 lines of scrollback. for _ in 0..29 { term.newline(); } // Enable vi mode. term.toggle_vi_mode(); // Change the display area and the vi cursor position. term.scroll_display(Scroll::Top); term.vi_mode_cursor.point = Point::new(Line(-5), Column(3)); assert_eq!(term.grid.display_offset(), 10); // Clear the scrollback buffer. term.clear_screen(ansi::ClearMode::Saved); assert_eq!(term.grid.display_offset(), 0); assert_eq!(term.vi_mode_cursor.point, Point::new(Line(0), Column(3))); } #[test] fn clear_saved_lines() { let size = TermSize::new(7, 17); let mut term = Term::new(&Config::default(), &size, VoidListener); // Add one line of scrollback. term.grid.scroll_up(&(Line(0)..Line(1)), 1); // Clear the history. term.clear_screen(ansi::ClearMode::Saved); // Make sure that scrolling does not change the grid. let mut scrolled_grid = term.grid.clone(); scrolled_grid.scroll_display(Scroll::Top); // Truncate grids for comparison. scrolled_grid.truncate(); term.grid.truncate(); assert_eq!(term.grid, scrolled_grid); } #[test] fn vi_cursor_keep_pos_on_scrollback_buffer() { let size = TermSize::new(5, 10); let mut term = Term::new(&Config::default(), &size, VoidListener); // Create 11 lines of scrollback. for _ in 0..20 { term.newline(); } // Enable vi mode. term.toggle_vi_mode(); term.scroll_display(Scroll::Top); term.vi_mode_cursor.point.line = Line(-11); term.linefeed(); assert_eq!(term.vi_mode_cursor.point.line, Line(-12)); } #[test] fn grow_lines_updates_active_cursor_pos() { let mut size = TermSize::new(100, 10); let mut term = Term::new(&Config::default(), &size, VoidListener); // Create 10 lines of scrollback. for _ in 0..19 { term.newline(); } assert_eq!(term.history_size(), 10); assert_eq!(term.grid.cursor.point, Point::new(Line(9), Column(0))); // Increase visible lines. size.screen_lines = 30; term.resize(size); assert_eq!(term.history_size(), 0); assert_eq!(term.grid.cursor.point, Point::new(Line(19), Column(0))); } #[test] fn grow_lines_updates_inactive_cursor_pos() { let mut size = TermSize::new(100, 10); let mut term = Term::new(&Config::default(), &size, VoidListener); // Create 10 lines of scrollback. for _ in 0..19 { term.newline(); } assert_eq!(term.history_size(), 10); assert_eq!(term.grid.cursor.point, Point::new(Line(9), Column(0))); // Enter alt screen. term.set_mode(ansi::Mode::SwapScreenAndSetRestoreCursor); // Increase visible lines. size.screen_lines = 30; term.resize(size); // Leave alt screen. term.unset_mode(ansi::Mode::SwapScreenAndSetRestoreCursor); assert_eq!(term.history_size(), 0); assert_eq!(term.grid.cursor.point, Point::new(Line(19), Column(0))); } #[test] fn shrink_lines_updates_active_cursor_pos() { let mut size = TermSize::new(100, 10); let mut term = Term::new(&Config::default(), &size, VoidListener); // Create 10 lines of scrollback. for _ in 0..19 { term.newline(); } assert_eq!(term.history_size(), 10); assert_eq!(term.grid.cursor.point, Point::new(Line(9), Column(0))); // Increase visible lines. size.screen_lines = 5; term.resize(size); assert_eq!(term.history_size(), 15); assert_eq!(term.grid.cursor.point, Point::new(Line(4), Column(0))); } #[test] fn shrink_lines_updates_inactive_cursor_pos() { let mut size = TermSize::new(100, 10); let mut term = Term::new(&Config::default(), &size, VoidListener); // Create 10 lines of scrollback. for _ in 0..19 { term.newline(); } assert_eq!(term.history_size(), 10); assert_eq!(term.grid.cursor.point, Point::new(Line(9), Column(0))); // Enter alt screen. term.set_mode(ansi::Mode::SwapScreenAndSetRestoreCursor); // Increase visible lines. size.screen_lines = 5; term.resize(size); // Leave alt screen. term.unset_mode(ansi::Mode::SwapScreenAndSetRestoreCursor); assert_eq!(term.history_size(), 15); assert_eq!(term.grid.cursor.point, Point::new(Line(4), Column(0))); } #[test] fn damage_public_usage() { let size = TermSize::new(10, 10); let mut term = Term::new(&Config::default(), &size, VoidListener); // Reset terminal for partial damage tests since it's initialized as fully damaged. term.reset_damage(); // Test that we damage input form [`Term::input`]. let left = term.grid.cursor.point.column.0; term.input('d'); term.input('a'); term.input('m'); term.input('a'); term.input('g'); term.input('e'); let right = term.grid.cursor.point.column.0; let mut damaged_lines = match term.damage(None) { TermDamage::Full => panic!("Expected partial damage, however got Full"), TermDamage::Partial(damaged_lines) => damaged_lines, }; assert_eq!(damaged_lines.next(), Some(LineDamageBounds { line: 0, left, right })); assert_eq!(damaged_lines.next(), None); term.reset_damage(); // Check that selection we've passed was properly damaged. let line = 1; let left = 0; let right = term.columns() - 1; let mut selection = Selection::new(SelectionType::Block, Point::new(Line(line), Column(3)), Side::Left); selection.update(Point::new(Line(line), Column(5)), Side::Left); let selection_range = selection.to_range(&term); let mut damaged_lines = match term.damage(selection_range) { TermDamage::Full => panic!("Expected partial damage, however got Full"), TermDamage::Partial(damaged_lines) => damaged_lines, }; let line = line as usize; // Skip cursor damage information, since we're just testing selection. damaged_lines.next(); assert_eq!(damaged_lines.next(), Some(LineDamageBounds { line, left, right })); assert_eq!(damaged_lines.next(), None); term.reset_damage(); // Check that existing selection gets damaged when it is removed. let mut damaged_lines = match term.damage(None) { TermDamage::Full => panic!("Expected partial damage, however got Full"), TermDamage::Partial(damaged_lines) => damaged_lines, }; // Skip cursor damage information, since we're just testing selection clearing. damaged_lines.next(); assert_eq!(damaged_lines.next(), Some(LineDamageBounds { line, left, right })); assert_eq!(damaged_lines.next(), None); term.reset_damage(); // Check that `Vi` cursor in vi mode is being always damaged. term.toggle_vi_mode(); // Put Vi cursor to a different location than normal cursor. term.vi_goto_point(Point::new(Line(5), Column(5))); // Reset damage, so the damage information from `vi_goto_point` won't affect test. term.reset_damage(); let vi_cursor_point = term.vi_mode_cursor.point; let line = vi_cursor_point.line.0 as usize; let left = vi_cursor_point.column.0; let right = left; let mut damaged_lines = match term.damage(None) { TermDamage::Full => panic!("Expected partial damage, however got Full"), TermDamage::Partial(damaged_lines) => damaged_lines, }; // Skip cursor damage information, since we're just testing Vi cursor. damaged_lines.next(); assert_eq!(damaged_lines.next(), Some(LineDamageBounds { line, left, right })); assert_eq!(damaged_lines.next(), None); // Ensure that old Vi cursor got damaged as well. term.reset_damage(); term.toggle_vi_mode(); let mut damaged_lines = match term.damage(None) { TermDamage::Full => panic!("Expected partial damage, however got Full"), TermDamage::Partial(damaged_lines) => damaged_lines, }; // Skip cursor damage information, since we're just testing Vi cursor. damaged_lines.next(); assert_eq!(damaged_lines.next(), Some(LineDamageBounds { line, left, right })); assert_eq!(damaged_lines.next(), None); } #[test] fn damage_cursor_movements() { let size = TermSize::new(10, 10); let mut term = Term::new(&Config::default(), &size, VoidListener); let num_cols = term.columns(); // Reset terminal for partial damage tests since it's initialized as fully damaged. term.reset_damage(); term.goto(1, 1); // NOTE While we can use `[Term::damage]` to access terminal damage information, in the // following tests we will be accessing `term.damage.lines` directly to avoid adding extra // damage information (like cursor and Vi cursor), which we're not testing. assert_eq!(term.damage.lines[0], LineDamageBounds { line: 0, left: 0, right: 0 }); assert_eq!(term.damage.lines[1], LineDamageBounds { line: 1, left: 1, right: 1 }); term.damage.reset(num_cols); term.move_forward(3); assert_eq!(term.damage.lines[1], LineDamageBounds { line: 1, left: 1, right: 4 }); term.damage.reset(num_cols); term.move_backward(8); assert_eq!(term.damage.lines[1], LineDamageBounds { line: 1, left: 0, right: 4 }); term.goto(5, 5); term.damage.reset(num_cols); term.backspace(); term.backspace(); assert_eq!(term.damage.lines[5], LineDamageBounds { line: 5, left: 3, right: 5 }); term.damage.reset(num_cols); term.move_up(1); assert_eq!(term.damage.lines[5], LineDamageBounds { line: 5, left: 3, right: 3 }); assert_eq!(term.damage.lines[4], LineDamageBounds { line: 4, left: 3, right: 3 }); term.damage.reset(num_cols); term.move_down(1); term.move_down(1); assert_eq!(term.damage.lines[4], LineDamageBounds { line: 4, left: 3, right: 3 }); assert_eq!(term.damage.lines[5], LineDamageBounds { line: 5, left: 3, right: 3 }); assert_eq!(term.damage.lines[6], LineDamageBounds { line: 6, left: 3, right: 3 }); term.damage.reset(num_cols); term.wrapline(); assert_eq!(term.damage.lines[6], LineDamageBounds { line: 6, left: 3, right: 3 }); assert_eq!(term.damage.lines[7], LineDamageBounds { line: 7, left: 0, right: 0 }); term.move_forward(3); term.move_up(1); term.damage.reset(num_cols); term.linefeed(); assert_eq!(term.damage.lines[6], LineDamageBounds { line: 6, left: 3, right: 3 }); assert_eq!(term.damage.lines[7], LineDamageBounds { line: 7, left: 3, right: 3 }); term.damage.reset(num_cols); term.carriage_return(); assert_eq!(term.damage.lines[7], LineDamageBounds { line: 7, left: 0, right: 3 }); term.damage.reset(num_cols); term.erase_chars(5); assert_eq!(term.damage.lines[7], LineDamageBounds { line: 7, left: 0, right: 5 }); term.damage.reset(num_cols); term.delete_chars(3); let right = term.columns() - 1; assert_eq!(term.damage.lines[7], LineDamageBounds { line: 7, left: 0, right }); term.move_forward(term.columns()); term.damage.reset(num_cols); term.move_backward_tabs(1); assert_eq!(term.damage.lines[7], LineDamageBounds { line: 7, left: 8, right }); term.save_cursor_position(); term.goto(1, 1); term.damage.reset(num_cols); term.restore_cursor_position(); assert_eq!(term.damage.lines[1], LineDamageBounds { line: 1, left: 1, right: 1 }); assert_eq!(term.damage.lines[7], LineDamageBounds { line: 7, left: 8, right: 8 }); term.damage.reset(num_cols); term.clear_line(ansi::LineClearMode::All); assert_eq!(term.damage.lines[7], LineDamageBounds { line: 7, left: 0, right }); term.damage.reset(num_cols); term.clear_line(ansi::LineClearMode::Left); assert_eq!(term.damage.lines[7], LineDamageBounds { line: 7, left: 0, right: 8 }); term.damage.reset(num_cols); term.clear_line(ansi::LineClearMode::Right); assert_eq!(term.damage.lines[7], LineDamageBounds { line: 7, left: 8, right }); term.damage.reset(num_cols); term.reverse_index(); assert_eq!(term.damage.lines[7], LineDamageBounds { line: 7, left: 8, right: 8 }); assert_eq!(term.damage.lines[6], LineDamageBounds { line: 6, left: 8, right: 8 }); } #[test] fn full_damage() { let size = TermSize::new(100, 10); let mut term = Term::new(&Config::default(), &size, VoidListener); assert!(term.damage.is_fully_damaged); for _ in 0..20 { term.newline(); } term.reset_damage(); term.clear_screen(ansi::ClearMode::Above); assert!(term.damage.is_fully_damaged); term.reset_damage(); term.scroll_display(Scroll::Top); assert!(term.damage.is_fully_damaged); term.reset_damage(); // Sequential call to scroll display without doing anything shouldn't damage. term.scroll_display(Scroll::Top); assert!(!term.damage.is_fully_damaged); term.reset_damage(); term.update_config(&Config::default()); assert!(term.damage.is_fully_damaged); term.reset_damage(); term.scroll_down_relative(Line(5), 2); assert!(term.damage.is_fully_damaged); term.reset_damage(); term.scroll_up_relative(Line(3), 2); assert!(term.damage.is_fully_damaged); term.reset_damage(); term.deccolm(); assert!(term.damage.is_fully_damaged); term.reset_damage(); term.decaln(); assert!(term.damage.is_fully_damaged); term.reset_damage(); term.set_mode(ansi::Mode::Insert); // Just setting `Insert` mode shouldn't mark terminal as damaged. assert!(!term.damage.is_fully_damaged); term.reset_damage(); let color_index = 257; term.set_color(color_index, VteRgb::default()); assert!(term.damage.is_fully_damaged); term.reset_damage(); // Setting the same color once again shouldn't trigger full damage. term.set_color(color_index, VteRgb::default()); assert!(!term.damage.is_fully_damaged); term.reset_color(color_index); assert!(term.damage.is_fully_damaged); term.reset_damage(); // We shouldn't trigger fully damage when cursor gets update. term.set_color(NamedColor::Cursor as usize, VteRgb::default()); assert!(!term.damage.is_fully_damaged); // However requesting terminal damage should mark terminal as fully damaged in `Insert` // mode. let _ = term.damage(None); assert!(term.damage.is_fully_damaged); term.reset_damage(); term.unset_mode(ansi::Mode::Insert); assert!(term.damage.is_fully_damaged); term.reset_damage(); // Keep this as a last check, so we don't have to deal with restoring from alt-screen. term.swap_alt(); assert!(term.damage.is_fully_damaged); term.reset_damage(); let size = TermSize::new(10, 10); term.resize(size); assert!(term.damage.is_fully_damaged); } #[test] fn window_title() { let size = TermSize::new(7, 17); let mut term = Term::new(&Config::default(), &size, VoidListener); // Title None by default. assert_eq!(term.title, None); // Title can be set. term.set_title(Some("Test".into())); assert_eq!(term.title, Some("Test".into())); // Title can be pushed onto stack. term.push_title(); term.set_title(Some("Next".into())); assert_eq!(term.title, Some("Next".into())); assert_eq!(term.title_stack.get(0).unwrap(), &Some("Test".into())); // Title can be popped from stack and set as the window title. term.pop_title(); assert_eq!(term.title, Some("Test".into())); assert!(term.title_stack.is_empty()); // Title stack doesn't grow infinitely. for _ in 0..4097 { term.push_title(); } assert_eq!(term.title_stack.len(), 4096); // Title and title stack reset when terminal state is reset. term.push_title(); term.reset_state(); assert_eq!(term.title, None); assert!(term.title_stack.is_empty()); // Title stack pops back to default. term.title = None; term.push_title(); term.set_title(Some("Test".into())); term.pop_title(); assert_eq!(term.title, None); // Title can be reset to default. term.title = Some("Test".into()); term.set_title(None); assert_eq!(term.title, None); } #[test] fn parse_cargo_version() { assert!(version_number(env!("CARGO_PKG_VERSION")) >= 10_01); assert_eq!(version_number("0.0.1-dev"), 1); assert_eq!(version_number("0.1.2-dev"), 1_02); assert_eq!(version_number("1.2.3-dev"), 1_02_03); assert_eq!(version_number("999.99.99"), 9_99_99_99); } }
use logos::Logos; #[derive(Debug, Logos)] enum Token<'a> { #[regex("[a-zA-Z_][a-zA-Z0-9_]*")] Ident(&'a str), #[regex(r#""(?:\\"|[^"])*""#)] InterpolatedString(&'a str), #[regex(r#"'[^']*'"#)] RawString(&'a str), #[regex(r"\$\w+")] DollarVariable(&'a str), #[token("$")] Dollar, #[token("|")] Pipe, #[token("<")] RedirectIn, #[token(">")] RedirectOut, #[token("(")] OpenParen, #[token(")")] CloseParen, #[token("=")] Equal, #[error] #[regex(r"[ \t\n\f]+" ,logos::skip)] Error, } fn print(s: &str) { let lex = Token::lexer(s); for token in lex { println!("{:?}", token); } println!(); } fn main() { println!("Hello, world!"); print(r#"echo $HELLO | "ls -al" <(foo)"#); print(r#"echo hello world"#); print(r#"echo "hello world""#); print(r#"echo 'hello world'"#); print(r#"echo $HELLO_WORLD"#); print(r#"echo $(hello world)"#); print(r#"echo hello | world"#); print(r#"echo $HELLO | world"#); print(r#"echo hello > world"#); print(r#"echo <hello >world"#); print(r#"echo "hello" "world""#); print(r#"echo "$HELLO" "$WORLD""#); print(r#"HELLO=WORLD"#); }
// Copyright (c) 2020 Sam Blenny // SPDX-License-Identifier: Apache-2.0 OR MIT // /// Panic Handler for no_std. use core::panic::PanicInfo; #[panic_handler] pub fn panic(_panic_info: &PanicInfo) -> ! { unsafe { core::arch::wasm32::unreachable(); } }
use std::{error::Error, fmt}; #[derive(Debug)] pub enum NaiaServerError { Wrapped(Box<dyn Error>), } impl fmt::Display for NaiaServerError { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { match self { NaiaServerError::Wrapped(boxed_err) => fmt::Display::fmt(boxed_err.as_ref(), f), } } } impl Error for NaiaServerError {}
#[doc = "Reader of register TXDLADDR"] pub type R = crate::R<u32, super::TXDLADDR>; #[doc = "Writer for register TXDLADDR"] pub type W = crate::W<u32, super::TXDLADDR>; #[doc = "Register TXDLADDR `reset()`'s with value 0"] impl crate::ResetValue for super::TXDLADDR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `TXDLADDR`"] pub type TXDLADDR_R = crate::R<u32, u32>; #[doc = "Write proxy for field `TXDLADDR`"] pub struct TXDLADDR_W<'a> { w: &'a mut W, } impl<'a> TXDLADDR_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u32) -> &'a mut W { self.w.bits = (self.w.bits & !(0x3fff_ffff << 2)) | (((value as u32) & 0x3fff_ffff) << 2); self.w } } impl R { #[doc = "Bits 2:31 - Start of Transmit List Base Address"] #[inline(always)] pub fn txdladdr(&self) -> TXDLADDR_R { TXDLADDR_R::new(((self.bits >> 2) & 0x3fff_ffff) as u32) } } impl W { #[doc = "Bits 2:31 - Start of Transmit List Base Address"] #[inline(always)] pub fn txdladdr(&mut self) -> TXDLADDR_W { TXDLADDR_W { w: self } } }
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type DXGI_ALPHA_MODE = u32; pub const DXGI_ALPHA_MODE_UNSPECIFIED: DXGI_ALPHA_MODE = 0u32; pub const DXGI_ALPHA_MODE_PREMULTIPLIED: DXGI_ALPHA_MODE = 1u32; pub const DXGI_ALPHA_MODE_STRAIGHT: DXGI_ALPHA_MODE = 2u32; pub const DXGI_ALPHA_MODE_IGNORE: DXGI_ALPHA_MODE = 3u32; pub const DXGI_ALPHA_MODE_FORCE_DWORD: DXGI_ALPHA_MODE = 4294967295u32; pub const DXGI_CENTER_MULTISAMPLE_QUALITY_PATTERN: u32 = 4294967294u32; pub type DXGI_COLOR_SPACE_TYPE = i32; pub const DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709: DXGI_COLOR_SPACE_TYPE = 0i32; pub const DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709: DXGI_COLOR_SPACE_TYPE = 1i32; pub const DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709: DXGI_COLOR_SPACE_TYPE = 2i32; pub const DXGI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020: DXGI_COLOR_SPACE_TYPE = 3i32; pub const DXGI_COLOR_SPACE_RESERVED: DXGI_COLOR_SPACE_TYPE = 4i32; pub const DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601: DXGI_COLOR_SPACE_TYPE = 5i32; pub const DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601: DXGI_COLOR_SPACE_TYPE = 6i32; pub const DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601: DXGI_COLOR_SPACE_TYPE = 7i32; pub const DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709: DXGI_COLOR_SPACE_TYPE = 8i32; pub const DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709: DXGI_COLOR_SPACE_TYPE = 9i32; pub const DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020: DXGI_COLOR_SPACE_TYPE = 10i32; pub const DXGI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020: DXGI_COLOR_SPACE_TYPE = 11i32; pub const DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020: DXGI_COLOR_SPACE_TYPE = 12i32; pub const DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_LEFT_P2020: DXGI_COLOR_SPACE_TYPE = 13i32; pub const DXGI_COLOR_SPACE_RGB_STUDIO_G2084_NONE_P2020: DXGI_COLOR_SPACE_TYPE = 14i32; pub const DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_TOPLEFT_P2020: DXGI_COLOR_SPACE_TYPE = 15i32; pub const DXGI_COLOR_SPACE_YCBCR_STUDIO_G2084_TOPLEFT_P2020: DXGI_COLOR_SPACE_TYPE = 16i32; pub const DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020: DXGI_COLOR_SPACE_TYPE = 17i32; pub const DXGI_COLOR_SPACE_YCBCR_STUDIO_GHLG_TOPLEFT_P2020: DXGI_COLOR_SPACE_TYPE = 18i32; pub const DXGI_COLOR_SPACE_YCBCR_FULL_GHLG_TOPLEFT_P2020: DXGI_COLOR_SPACE_TYPE = 19i32; pub const DXGI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P709: DXGI_COLOR_SPACE_TYPE = 20i32; pub const DXGI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P2020: DXGI_COLOR_SPACE_TYPE = 21i32; pub const DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_LEFT_P709: DXGI_COLOR_SPACE_TYPE = 22i32; pub const DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_LEFT_P2020: DXGI_COLOR_SPACE_TYPE = 23i32; pub const DXGI_COLOR_SPACE_YCBCR_STUDIO_G24_TOPLEFT_P2020: DXGI_COLOR_SPACE_TYPE = 24i32; pub const DXGI_COLOR_SPACE_CUSTOM: DXGI_COLOR_SPACE_TYPE = -1i32; pub const DXGI_CPU_ACCESS_DYNAMIC: u32 = 1u32; pub const DXGI_CPU_ACCESS_FIELD: u32 = 15u32; pub const DXGI_CPU_ACCESS_NONE: u32 = 0u32; pub const DXGI_CPU_ACCESS_READ_WRITE: u32 = 2u32; pub const DXGI_CPU_ACCESS_SCRATCH: u32 = 3u32; pub type DXGI_FORMAT = u32; pub const DXGI_FORMAT_UNKNOWN: DXGI_FORMAT = 0u32; pub const DXGI_FORMAT_R32G32B32A32_TYPELESS: DXGI_FORMAT = 1u32; pub const DXGI_FORMAT_R32G32B32A32_FLOAT: DXGI_FORMAT = 2u32; pub const DXGI_FORMAT_R32G32B32A32_UINT: DXGI_FORMAT = 3u32; pub const DXGI_FORMAT_R32G32B32A32_SINT: DXGI_FORMAT = 4u32; pub const DXGI_FORMAT_R32G32B32_TYPELESS: DXGI_FORMAT = 5u32; pub const DXGI_FORMAT_R32G32B32_FLOAT: DXGI_FORMAT = 6u32; pub const DXGI_FORMAT_R32G32B32_UINT: DXGI_FORMAT = 7u32; pub const DXGI_FORMAT_R32G32B32_SINT: DXGI_FORMAT = 8u32; pub const DXGI_FORMAT_R16G16B16A16_TYPELESS: DXGI_FORMAT = 9u32; pub const DXGI_FORMAT_R16G16B16A16_FLOAT: DXGI_FORMAT = 10u32; pub const DXGI_FORMAT_R16G16B16A16_UNORM: DXGI_FORMAT = 11u32; pub const DXGI_FORMAT_R16G16B16A16_UINT: DXGI_FORMAT = 12u32; pub const DXGI_FORMAT_R16G16B16A16_SNORM: DXGI_FORMAT = 13u32; pub const DXGI_FORMAT_R16G16B16A16_SINT: DXGI_FORMAT = 14u32; pub const DXGI_FORMAT_R32G32_TYPELESS: DXGI_FORMAT = 15u32; pub const DXGI_FORMAT_R32G32_FLOAT: DXGI_FORMAT = 16u32; pub const DXGI_FORMAT_R32G32_UINT: DXGI_FORMAT = 17u32; pub const DXGI_FORMAT_R32G32_SINT: DXGI_FORMAT = 18u32; pub const DXGI_FORMAT_R32G8X24_TYPELESS: DXGI_FORMAT = 19u32; pub const DXGI_FORMAT_D32_FLOAT_S8X24_UINT: DXGI_FORMAT = 20u32; pub const DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS: DXGI_FORMAT = 21u32; pub const DXGI_FORMAT_X32_TYPELESS_G8X24_UINT: DXGI_FORMAT = 22u32; pub const DXGI_FORMAT_R10G10B10A2_TYPELESS: DXGI_FORMAT = 23u32; pub const DXGI_FORMAT_R10G10B10A2_UNORM: DXGI_FORMAT = 24u32; pub const DXGI_FORMAT_R10G10B10A2_UINT: DXGI_FORMAT = 25u32; pub const DXGI_FORMAT_R11G11B10_FLOAT: DXGI_FORMAT = 26u32; pub const DXGI_FORMAT_R8G8B8A8_TYPELESS: DXGI_FORMAT = 27u32; pub const DXGI_FORMAT_R8G8B8A8_UNORM: DXGI_FORMAT = 28u32; pub const DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: DXGI_FORMAT = 29u32; pub const DXGI_FORMAT_R8G8B8A8_UINT: DXGI_FORMAT = 30u32; pub const DXGI_FORMAT_R8G8B8A8_SNORM: DXGI_FORMAT = 31u32; pub const DXGI_FORMAT_R8G8B8A8_SINT: DXGI_FORMAT = 32u32; pub const DXGI_FORMAT_R16G16_TYPELESS: DXGI_FORMAT = 33u32; pub const DXGI_FORMAT_R16G16_FLOAT: DXGI_FORMAT = 34u32; pub const DXGI_FORMAT_R16G16_UNORM: DXGI_FORMAT = 35u32; pub const DXGI_FORMAT_R16G16_UINT: DXGI_FORMAT = 36u32; pub const DXGI_FORMAT_R16G16_SNORM: DXGI_FORMAT = 37u32; pub const DXGI_FORMAT_R16G16_SINT: DXGI_FORMAT = 38u32; pub const DXGI_FORMAT_R32_TYPELESS: DXGI_FORMAT = 39u32; pub const DXGI_FORMAT_D32_FLOAT: DXGI_FORMAT = 40u32; pub const DXGI_FORMAT_R32_FLOAT: DXGI_FORMAT = 41u32; pub const DXGI_FORMAT_R32_UINT: DXGI_FORMAT = 42u32; pub const DXGI_FORMAT_R32_SINT: DXGI_FORMAT = 43u32; pub const DXGI_FORMAT_R24G8_TYPELESS: DXGI_FORMAT = 44u32; pub const DXGI_FORMAT_D24_UNORM_S8_UINT: DXGI_FORMAT = 45u32; pub const DXGI_FORMAT_R24_UNORM_X8_TYPELESS: DXGI_FORMAT = 46u32; pub const DXGI_FORMAT_X24_TYPELESS_G8_UINT: DXGI_FORMAT = 47u32; pub const DXGI_FORMAT_R8G8_TYPELESS: DXGI_FORMAT = 48u32; pub const DXGI_FORMAT_R8G8_UNORM: DXGI_FORMAT = 49u32; pub const DXGI_FORMAT_R8G8_UINT: DXGI_FORMAT = 50u32; pub const DXGI_FORMAT_R8G8_SNORM: DXGI_FORMAT = 51u32; pub const DXGI_FORMAT_R8G8_SINT: DXGI_FORMAT = 52u32; pub const DXGI_FORMAT_R16_TYPELESS: DXGI_FORMAT = 53u32; pub const DXGI_FORMAT_R16_FLOAT: DXGI_FORMAT = 54u32; pub const DXGI_FORMAT_D16_UNORM: DXGI_FORMAT = 55u32; pub const DXGI_FORMAT_R16_UNORM: DXGI_FORMAT = 56u32; pub const DXGI_FORMAT_R16_UINT: DXGI_FORMAT = 57u32; pub const DXGI_FORMAT_R16_SNORM: DXGI_FORMAT = 58u32; pub const DXGI_FORMAT_R16_SINT: DXGI_FORMAT = 59u32; pub const DXGI_FORMAT_R8_TYPELESS: DXGI_FORMAT = 60u32; pub const DXGI_FORMAT_R8_UNORM: DXGI_FORMAT = 61u32; pub const DXGI_FORMAT_R8_UINT: DXGI_FORMAT = 62u32; pub const DXGI_FORMAT_R8_SNORM: DXGI_FORMAT = 63u32; pub const DXGI_FORMAT_R8_SINT: DXGI_FORMAT = 64u32; pub const DXGI_FORMAT_A8_UNORM: DXGI_FORMAT = 65u32; pub const DXGI_FORMAT_R1_UNORM: DXGI_FORMAT = 66u32; pub const DXGI_FORMAT_R9G9B9E5_SHAREDEXP: DXGI_FORMAT = 67u32; pub const DXGI_FORMAT_R8G8_B8G8_UNORM: DXGI_FORMAT = 68u32; pub const DXGI_FORMAT_G8R8_G8B8_UNORM: DXGI_FORMAT = 69u32; pub const DXGI_FORMAT_BC1_TYPELESS: DXGI_FORMAT = 70u32; pub const DXGI_FORMAT_BC1_UNORM: DXGI_FORMAT = 71u32; pub const DXGI_FORMAT_BC1_UNORM_SRGB: DXGI_FORMAT = 72u32; pub const DXGI_FORMAT_BC2_TYPELESS: DXGI_FORMAT = 73u32; pub const DXGI_FORMAT_BC2_UNORM: DXGI_FORMAT = 74u32; pub const DXGI_FORMAT_BC2_UNORM_SRGB: DXGI_FORMAT = 75u32; pub const DXGI_FORMAT_BC3_TYPELESS: DXGI_FORMAT = 76u32; pub const DXGI_FORMAT_BC3_UNORM: DXGI_FORMAT = 77u32; pub const DXGI_FORMAT_BC3_UNORM_SRGB: DXGI_FORMAT = 78u32; pub const DXGI_FORMAT_BC4_TYPELESS: DXGI_FORMAT = 79u32; pub const DXGI_FORMAT_BC4_UNORM: DXGI_FORMAT = 80u32; pub const DXGI_FORMAT_BC4_SNORM: DXGI_FORMAT = 81u32; pub const DXGI_FORMAT_BC5_TYPELESS: DXGI_FORMAT = 82u32; pub const DXGI_FORMAT_BC5_UNORM: DXGI_FORMAT = 83u32; pub const DXGI_FORMAT_BC5_SNORM: DXGI_FORMAT = 84u32; pub const DXGI_FORMAT_B5G6R5_UNORM: DXGI_FORMAT = 85u32; pub const DXGI_FORMAT_B5G5R5A1_UNORM: DXGI_FORMAT = 86u32; pub const DXGI_FORMAT_B8G8R8A8_UNORM: DXGI_FORMAT = 87u32; pub const DXGI_FORMAT_B8G8R8X8_UNORM: DXGI_FORMAT = 88u32; pub const DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM: DXGI_FORMAT = 89u32; pub const DXGI_FORMAT_B8G8R8A8_TYPELESS: DXGI_FORMAT = 90u32; pub const DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: DXGI_FORMAT = 91u32; pub const DXGI_FORMAT_B8G8R8X8_TYPELESS: DXGI_FORMAT = 92u32; pub const DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: DXGI_FORMAT = 93u32; pub const DXGI_FORMAT_BC6H_TYPELESS: DXGI_FORMAT = 94u32; pub const DXGI_FORMAT_BC6H_UF16: DXGI_FORMAT = 95u32; pub const DXGI_FORMAT_BC6H_SF16: DXGI_FORMAT = 96u32; pub const DXGI_FORMAT_BC7_TYPELESS: DXGI_FORMAT = 97u32; pub const DXGI_FORMAT_BC7_UNORM: DXGI_FORMAT = 98u32; pub const DXGI_FORMAT_BC7_UNORM_SRGB: DXGI_FORMAT = 99u32; pub const DXGI_FORMAT_AYUV: DXGI_FORMAT = 100u32; pub const DXGI_FORMAT_Y410: DXGI_FORMAT = 101u32; pub const DXGI_FORMAT_Y416: DXGI_FORMAT = 102u32; pub const DXGI_FORMAT_NV12: DXGI_FORMAT = 103u32; pub const DXGI_FORMAT_P010: DXGI_FORMAT = 104u32; pub const DXGI_FORMAT_P016: DXGI_FORMAT = 105u32; pub const DXGI_FORMAT_420_OPAQUE: DXGI_FORMAT = 106u32; pub const DXGI_FORMAT_YUY2: DXGI_FORMAT = 107u32; pub const DXGI_FORMAT_Y210: DXGI_FORMAT = 108u32; pub const DXGI_FORMAT_Y216: DXGI_FORMAT = 109u32; pub const DXGI_FORMAT_NV11: DXGI_FORMAT = 110u32; pub const DXGI_FORMAT_AI44: DXGI_FORMAT = 111u32; pub const DXGI_FORMAT_IA44: DXGI_FORMAT = 112u32; pub const DXGI_FORMAT_P8: DXGI_FORMAT = 113u32; pub const DXGI_FORMAT_A8P8: DXGI_FORMAT = 114u32; pub const DXGI_FORMAT_B4G4R4A4_UNORM: DXGI_FORMAT = 115u32; pub const DXGI_FORMAT_P208: DXGI_FORMAT = 130u32; pub const DXGI_FORMAT_V208: DXGI_FORMAT = 131u32; pub const DXGI_FORMAT_V408: DXGI_FORMAT = 132u32; pub const DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE: DXGI_FORMAT = 189u32; pub const DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE: DXGI_FORMAT = 190u32; pub const DXGI_FORMAT_FORCE_UINT: DXGI_FORMAT = 4294967295u32; pub const DXGI_FORMAT_DEFINED: u32 = 1u32; #[repr(C)] pub struct DXGI_GAMMA_CONTROL { pub Scale: DXGI_RGB, pub Offset: DXGI_RGB, pub GammaCurve: [DXGI_RGB; 1025], } impl ::core::marker::Copy for DXGI_GAMMA_CONTROL {} impl ::core::clone::Clone for DXGI_GAMMA_CONTROL { fn clone(&self) -> Self { *self } } #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DXGI_GAMMA_CONTROL_CAPABILITIES { pub ScaleAndOffsetSupported: super::super::super::Foundation::BOOL, pub MaxConvertedValue: f32, pub MinConvertedValue: f32, pub NumGammaControlPoints: u32, pub ControlPointPositions: [f32; 1025], } #[cfg(feature = "Win32_Foundation")] impl ::core::marker::Copy for DXGI_GAMMA_CONTROL_CAPABILITIES {} #[cfg(feature = "Win32_Foundation")] impl ::core::clone::Clone for DXGI_GAMMA_CONTROL_CAPABILITIES { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct DXGI_JPEG_AC_HUFFMAN_TABLE { pub CodeCounts: [u8; 16], pub CodeValues: [u8; 162], } impl ::core::marker::Copy for DXGI_JPEG_AC_HUFFMAN_TABLE {} impl ::core::clone::Clone for DXGI_JPEG_AC_HUFFMAN_TABLE { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct DXGI_JPEG_DC_HUFFMAN_TABLE { pub CodeCounts: [u8; 12], pub CodeValues: [u8; 12], } impl ::core::marker::Copy for DXGI_JPEG_DC_HUFFMAN_TABLE {} impl ::core::clone::Clone for DXGI_JPEG_DC_HUFFMAN_TABLE { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct DXGI_JPEG_QUANTIZATION_TABLE { pub Elements: [u8; 64], } impl ::core::marker::Copy for DXGI_JPEG_QUANTIZATION_TABLE {} impl ::core::clone::Clone for DXGI_JPEG_QUANTIZATION_TABLE { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct DXGI_MODE_DESC { pub Width: u32, pub Height: u32, pub RefreshRate: DXGI_RATIONAL, pub Format: DXGI_FORMAT, pub ScanlineOrdering: DXGI_MODE_SCANLINE_ORDER, pub Scaling: DXGI_MODE_SCALING, } impl ::core::marker::Copy for DXGI_MODE_DESC {} impl ::core::clone::Clone for DXGI_MODE_DESC { fn clone(&self) -> Self { *self } } pub type DXGI_MODE_ROTATION = i32; pub const DXGI_MODE_ROTATION_UNSPECIFIED: DXGI_MODE_ROTATION = 0i32; pub const DXGI_MODE_ROTATION_IDENTITY: DXGI_MODE_ROTATION = 1i32; pub const DXGI_MODE_ROTATION_ROTATE90: DXGI_MODE_ROTATION = 2i32; pub const DXGI_MODE_ROTATION_ROTATE180: DXGI_MODE_ROTATION = 3i32; pub const DXGI_MODE_ROTATION_ROTATE270: DXGI_MODE_ROTATION = 4i32; pub type DXGI_MODE_SCALING = i32; pub const DXGI_MODE_SCALING_UNSPECIFIED: DXGI_MODE_SCALING = 0i32; pub const DXGI_MODE_SCALING_CENTERED: DXGI_MODE_SCALING = 1i32; pub const DXGI_MODE_SCALING_STRETCHED: DXGI_MODE_SCALING = 2i32; pub type DXGI_MODE_SCANLINE_ORDER = i32; pub const DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED: DXGI_MODE_SCANLINE_ORDER = 0i32; pub const DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE: DXGI_MODE_SCANLINE_ORDER = 1i32; pub const DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST: DXGI_MODE_SCANLINE_ORDER = 2i32; pub const DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST: DXGI_MODE_SCANLINE_ORDER = 3i32; #[repr(C)] pub struct DXGI_RATIONAL { pub Numerator: u32, pub Denominator: u32, } impl ::core::marker::Copy for DXGI_RATIONAL {} impl ::core::clone::Clone for DXGI_RATIONAL { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct DXGI_RGB { pub Red: f32, pub Green: f32, pub Blue: f32, } impl ::core::marker::Copy for DXGI_RGB {} impl ::core::clone::Clone for DXGI_RGB { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct DXGI_SAMPLE_DESC { pub Count: u32, pub Quality: u32, } impl ::core::marker::Copy for DXGI_SAMPLE_DESC {} impl ::core::clone::Clone for DXGI_SAMPLE_DESC { fn clone(&self) -> Self { *self } } pub const DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN: u32 = 4294967295u32; pub const _FACDXGI: u32 = 2170u32;
#[doc = "Reader of register IMR2"] pub type R = crate::R<u32, super::IMR2>; #[doc = "Writer for register IMR2"] pub type W = crate::W<u32, super::IMR2>; #[doc = "Register IMR2 `reset()`'s with value 0xffff_ff87"] impl crate::ResetValue for super::IMR2 { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0xffff_ff87 } } #[doc = "Interrupt Mask on external/internal line 32\n\nValue on reset: 1"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum IM32_A { #[doc = "0: Interrupt request line is masked"] MASKED = 0, #[doc = "1: Interrupt request line is unmasked"] UNMASKED = 1, } impl From<IM32_A> for bool { #[inline(always)] fn from(variant: IM32_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `IM32`"] pub type IM32_R = crate::R<bool, IM32_A>; impl IM32_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> IM32_A { match self.bits { false => IM32_A::MASKED, true => IM32_A::UNMASKED, } } #[doc = "Checks if the value of the field is `MASKED`"] #[inline(always)] pub fn is_masked(&self) -> bool { *self == IM32_A::MASKED } #[doc = "Checks if the value of the field is `UNMASKED`"] #[inline(always)] pub fn is_unmasked(&self) -> bool { *self == IM32_A::UNMASKED } } #[doc = "Write proxy for field `IM32`"] pub struct IM32_W<'a> { w: &'a mut W, } impl<'a> IM32_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: IM32_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Interrupt request line is masked"] #[inline(always)] pub fn masked(self) -> &'a mut W { self.variant(IM32_A::MASKED) } #[doc = "Interrupt request line is unmasked"] #[inline(always)] pub fn unmasked(self) -> &'a mut W { self.variant(IM32_A::UNMASKED) } #[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 = "Interrupt Mask on external/internal line 33"] pub type IM33_A = IM32_A; #[doc = "Reader of field `IM33`"] pub type IM33_R = crate::R<bool, IM32_A>; #[doc = "Write proxy for field `IM33`"] pub struct IM33_W<'a> { w: &'a mut W, } impl<'a> IM33_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: IM33_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Interrupt request line is masked"] #[inline(always)] pub fn masked(self) -> &'a mut W { self.variant(IM32_A::MASKED) } #[doc = "Interrupt request line is unmasked"] #[inline(always)] pub fn unmasked(self) -> &'a mut W { self.variant(IM32_A::UNMASKED) } #[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 = "Interrupt Mask on external/internal line 34"] pub type IM34_A = IM32_A; #[doc = "Reader of field `IM34`"] pub type IM34_R = crate::R<bool, IM32_A>; #[doc = "Write proxy for field `IM34`"] pub struct IM34_W<'a> { w: &'a mut W, } impl<'a> IM34_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: IM34_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Interrupt request line is masked"] #[inline(always)] pub fn masked(self) -> &'a mut W { self.variant(IM32_A::MASKED) } #[doc = "Interrupt request line is unmasked"] #[inline(always)] pub fn unmasked(self) -> &'a mut W { self.variant(IM32_A::UNMASKED) } #[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 = "Interrupt Mask on external/internal line 35"] pub type IM35_A = IM32_A; #[doc = "Reader of field `IM35`"] pub type IM35_R = crate::R<bool, IM32_A>; #[doc = "Write proxy for field `IM35`"] pub struct IM35_W<'a> { w: &'a mut W, } impl<'a> IM35_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: IM35_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Interrupt request line is masked"] #[inline(always)] pub fn masked(self) -> &'a mut W { self.variant(IM32_A::MASKED) } #[doc = "Interrupt request line is unmasked"] #[inline(always)] pub fn unmasked(self) -> &'a mut W { self.variant(IM32_A::UNMASKED) } #[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 = "Interrupt Mask on external/internal line 36"] pub type IM36_A = IM32_A; #[doc = "Reader of field `IM36`"] pub type IM36_R = crate::R<bool, IM32_A>; #[doc = "Write proxy for field `IM36`"] pub struct IM36_W<'a> { w: &'a mut W, } impl<'a> IM36_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: IM36_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Interrupt request line is masked"] #[inline(always)] pub fn masked(self) -> &'a mut W { self.variant(IM32_A::MASKED) } #[doc = "Interrupt request line is unmasked"] #[inline(always)] pub fn unmasked(self) -> &'a mut W { self.variant(IM32_A::UNMASKED) } #[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 = "Interrupt Mask on external/internal line 37"] pub type IM37_A = IM32_A; #[doc = "Reader of field `IM37`"] pub type IM37_R = crate::R<bool, IM32_A>; #[doc = "Write proxy for field `IM37`"] pub struct IM37_W<'a> { w: &'a mut W, } impl<'a> IM37_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: IM37_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Interrupt request line is masked"] #[inline(always)] pub fn masked(self) -> &'a mut W { self.variant(IM32_A::MASKED) } #[doc = "Interrupt request line is unmasked"] #[inline(always)] pub fn unmasked(self) -> &'a mut W { self.variant(IM32_A::UNMASKED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5); self.w } } #[doc = "Interrupt Mask on external/internal line 40"] pub type IM40_A = IM32_A; #[doc = "Reader of field `IM40`"] pub type IM40_R = crate::R<bool, IM32_A>; #[doc = "Write proxy for field `IM40`"] pub struct IM40_W<'a> { w: &'a mut W, } impl<'a> IM40_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: IM40_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Interrupt request line is masked"] #[inline(always)] pub fn masked(self) -> &'a mut W { self.variant(IM32_A::MASKED) } #[doc = "Interrupt request line is unmasked"] #[inline(always)] pub fn unmasked(self) -> &'a mut W { self.variant(IM32_A::UNMASKED) } #[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 = "Interrupt Mask on external/internal line 41"] pub type IM41_A = IM32_A; #[doc = "Reader of field `IM41`"] pub type IM41_R = crate::R<bool, IM32_A>; #[doc = "Write proxy for field `IM41`"] pub struct IM41_W<'a> { w: &'a mut W, } impl<'a> IM41_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: IM41_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Interrupt request line is masked"] #[inline(always)] pub fn masked(self) -> &'a mut W { self.variant(IM32_A::MASKED) } #[doc = "Interrupt request line is unmasked"] #[inline(always)] pub fn unmasked(self) -> &'a mut W { self.variant(IM32_A::UNMASKED) } #[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 = "Interrupt Mask on external/internal line 42"] pub type IM42_A = IM32_A; #[doc = "Reader of field `IM42`"] pub type IM42_R = crate::R<bool, IM32_A>; #[doc = "Write proxy for field `IM42`"] pub struct IM42_W<'a> { w: &'a mut W, } impl<'a> IM42_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: IM42_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Interrupt request line is masked"] #[inline(always)] pub fn masked(self) -> &'a mut W { self.variant(IM32_A::MASKED) } #[doc = "Interrupt request line is unmasked"] #[inline(always)] pub fn unmasked(self) -> &'a mut W { self.variant(IM32_A::UNMASKED) } #[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 = "Interrupt Mask on external/internal line 43"] pub type IM43_A = IM32_A; #[doc = "Reader of field `IM43`"] pub type IM43_R = crate::R<bool, IM32_A>; #[doc = "Write proxy for field `IM43`"] pub struct IM43_W<'a> { w: &'a mut W, } impl<'a> IM43_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: IM43_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Interrupt request line is masked"] #[inline(always)] pub fn masked(self) -> &'a mut W { self.variant(IM32_A::MASKED) } #[doc = "Interrupt request line is unmasked"] #[inline(always)] pub fn unmasked(self) -> &'a mut W { self.variant(IM32_A::UNMASKED) } #[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 } } impl R { #[doc = "Bit 0 - Interrupt Mask on external/internal line 32"] #[inline(always)] pub fn im32(&self) -> IM32_R { IM32_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - Interrupt Mask on external/internal line 33"] #[inline(always)] pub fn im33(&self) -> IM33_R { IM33_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 2 - Interrupt Mask on external/internal line 34"] #[inline(always)] pub fn im34(&self) -> IM34_R { IM34_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 3 - Interrupt Mask on external/internal line 35"] #[inline(always)] pub fn im35(&self) -> IM35_R { IM35_R::new(((self.bits >> 3) & 0x01) != 0) } #[doc = "Bit 4 - Interrupt Mask on external/internal line 36"] #[inline(always)] pub fn im36(&self) -> IM36_R { IM36_R::new(((self.bits >> 4) & 0x01) != 0) } #[doc = "Bit 5 - Interrupt Mask on external/internal line 37"] #[inline(always)] pub fn im37(&self) -> IM37_R { IM37_R::new(((self.bits >> 5) & 0x01) != 0) } #[doc = "Bit 8 - Interrupt Mask on external/internal line 40"] #[inline(always)] pub fn im40(&self) -> IM40_R { IM40_R::new(((self.bits >> 8) & 0x01) != 0) } #[doc = "Bit 9 - Interrupt Mask on external/internal line 41"] #[inline(always)] pub fn im41(&self) -> IM41_R { IM41_R::new(((self.bits >> 9) & 0x01) != 0) } #[doc = "Bit 10 - Interrupt Mask on external/internal line 42"] #[inline(always)] pub fn im42(&self) -> IM42_R { IM42_R::new(((self.bits >> 10) & 0x01) != 0) } #[doc = "Bit 11 - Interrupt Mask on external/internal line 43"] #[inline(always)] pub fn im43(&self) -> IM43_R { IM43_R::new(((self.bits >> 11) & 0x01) != 0) } } impl W { #[doc = "Bit 0 - Interrupt Mask on external/internal line 32"] #[inline(always)] pub fn im32(&mut self) -> IM32_W { IM32_W { w: self } } #[doc = "Bit 1 - Interrupt Mask on external/internal line 33"] #[inline(always)] pub fn im33(&mut self) -> IM33_W { IM33_W { w: self } } #[doc = "Bit 2 - Interrupt Mask on external/internal line 34"] #[inline(always)] pub fn im34(&mut self) -> IM34_W { IM34_W { w: self } } #[doc = "Bit 3 - Interrupt Mask on external/internal line 35"] #[inline(always)] pub fn im35(&mut self) -> IM35_W { IM35_W { w: self } } #[doc = "Bit 4 - Interrupt Mask on external/internal line 36"] #[inline(always)] pub fn im36(&mut self) -> IM36_W { IM36_W { w: self } } #[doc = "Bit 5 - Interrupt Mask on external/internal line 37"] #[inline(always)] pub fn im37(&mut self) -> IM37_W { IM37_W { w: self } } #[doc = "Bit 8 - Interrupt Mask on external/internal line 40"] #[inline(always)] pub fn im40(&mut self) -> IM40_W { IM40_W { w: self } } #[doc = "Bit 9 - Interrupt Mask on external/internal line 41"] #[inline(always)] pub fn im41(&mut self) -> IM41_W { IM41_W { w: self } } #[doc = "Bit 10 - Interrupt Mask on external/internal line 42"] #[inline(always)] pub fn im42(&mut self) -> IM42_W { IM42_W { w: self } } #[doc = "Bit 11 - Interrupt Mask on external/internal line 43"] #[inline(always)] pub fn im43(&mut self) -> IM43_W { IM43_W { w: self } } }
//! linux_raw syscalls supporting `rustix::pipe`. //! //! # Safety //! //! See the `rustix::backend` module documentation for details. #![allow(unsafe_code)] #![allow(clippy::undocumented_unsafe_blocks)] use crate::backend::conv::{c_int, c_uint, opt_mut, pass_usize, ret, ret_usize, slice}; use crate::backend::{c, MAX_IOV}; use crate::fd::{BorrowedFd, OwnedFd}; use crate::io; use crate::pipe::{IoSliceRaw, PipeFlags, SpliceFlags}; use core::cmp; use core::mem::MaybeUninit; use linux_raw_sys::general::{F_GETPIPE_SZ, F_SETPIPE_SZ}; #[inline] pub(crate) fn pipe() -> io::Result<(OwnedFd, OwnedFd)> { // aarch64 and risc64 omit `__NR_pipe`. On mips, `__NR_pipe` uses a special // calling convention, but using it is not worth complicating our syscall // wrapping infrastructure at this time. #[cfg(any( target_arch = "aarch64", target_arch = "mips", target_arch = "mips32r6", target_arch = "mips64", target_arch = "mips64r6", target_arch = "riscv64", ))] { pipe_with(PipeFlags::empty()) } #[cfg(not(any( target_arch = "aarch64", target_arch = "mips", target_arch = "mips32r6", target_arch = "mips64", target_arch = "mips64r6", target_arch = "riscv64", )))] unsafe { let mut result = MaybeUninit::<[OwnedFd; 2]>::uninit(); ret(syscall!(__NR_pipe, &mut result))?; let [p0, p1] = result.assume_init(); Ok((p0, p1)) } } #[inline] pub(crate) fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> { unsafe { let mut result = MaybeUninit::<[OwnedFd; 2]>::uninit(); ret(syscall!(__NR_pipe2, &mut result, flags))?; let [p0, p1] = result.assume_init(); Ok((p0, p1)) } } #[inline] pub fn splice( fd_in: BorrowedFd, off_in: Option<&mut u64>, fd_out: BorrowedFd, off_out: Option<&mut u64>, len: usize, flags: SpliceFlags, ) -> io::Result<usize> { unsafe { ret_usize(syscall!( __NR_splice, fd_in, opt_mut(off_in), fd_out, opt_mut(off_out), pass_usize(len), flags )) } } #[inline] pub unsafe fn vmsplice( fd: BorrowedFd, bufs: &[IoSliceRaw], flags: SpliceFlags, ) -> io::Result<usize> { let (bufs_addr, bufs_len) = slice(&bufs[..cmp::min(bufs.len(), MAX_IOV)]); ret_usize(syscall!(__NR_vmsplice, fd, bufs_addr, bufs_len, flags)) } #[inline] pub fn tee( fd_in: BorrowedFd, fd_out: BorrowedFd, len: usize, flags: SpliceFlags, ) -> io::Result<usize> { unsafe { ret_usize(syscall!(__NR_tee, fd_in, fd_out, pass_usize(len), flags)) } } #[inline] pub(crate) fn fcntl_getpipe_sz(fd: BorrowedFd<'_>) -> io::Result<usize> { #[cfg(target_pointer_width = "32")] unsafe { ret_usize(syscall_readonly!(__NR_fcntl64, fd, c_uint(F_GETPIPE_SZ))) } #[cfg(target_pointer_width = "64")] unsafe { ret_usize(syscall_readonly!(__NR_fcntl, fd, c_uint(F_GETPIPE_SZ))) } } #[inline] pub(crate) fn fcntl_setpipe_sz(fd: BorrowedFd<'_>, size: usize) -> io::Result<()> { let size: c::c_int = size.try_into().map_err(|_| io::Errno::PERM)?; #[cfg(target_pointer_width = "32")] unsafe { ret(syscall_readonly!( __NR_fcntl64, fd, c_uint(F_SETPIPE_SZ), c_int(size) )) } #[cfg(target_pointer_width = "64")] unsafe { ret(syscall_readonly!( __NR_fcntl, fd, c_uint(F_SETPIPE_SZ), c_int(size) )) } }
#[doc = "Reader of register ITLINE12"] pub type R = crate::R<u32, super::ITLINE12>; #[doc = "Reader of field `ADC`"] pub type ADC_R = crate::R<bool, bool>; #[doc = "Reader of field `COMP1`"] pub type COMP1_R = crate::R<bool, bool>; #[doc = "Reader of field `COMP2`"] pub type COMP2_R = crate::R<bool, bool>; impl R { #[doc = "Bit 0 - ADC"] #[inline(always)] pub fn adc(&self) -> ADC_R { ADC_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - COMP1"] #[inline(always)] pub fn comp1(&self) -> COMP1_R { COMP1_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 2 - COMP2"] #[inline(always)] pub fn comp2(&self) -> COMP2_R { COMP2_R::new(((self.bits >> 2) & 0x01) != 0) } }
#![feature(asm, lang_items)] #![crate_type="staticlib"] #![no_std] const GPFSEL3: u32 = 0x3F20_000C; const GPFSEL4: u32 = 0x3F20_0010; const GPSET1: u32 = 0x3F20_0020; const GPCLR1: u32 = 0x3F20_002C; const GPIO35: u32 = 1 << (35 - 32); const GPIO47: u32 = 1 << (47 - 32); extern { fn dummy(); } fn sleep(times: u32) { for _ in 0..times { unsafe { dummy() }; } } #[no_mangle] pub extern fn rust_main() { let gpfsel3 = GPFSEL3 as *mut u32; let gpfsel4 = GPFSEL4 as *mut u32; let gpset1 = GPSET1 as *mut u32; let gpclr1 = GPCLR1 as *mut u32; let mut gpfsel3_val = unsafe { *gpfsel3 }; gpfsel3_val &= !(7 << 15); gpfsel3_val |= 1 << 15; unsafe { *gpfsel3 = gpfsel3_val }; let mut gpfsel4_val = unsafe { *gpfsel4 }; gpfsel4_val &= !(7 << 21); gpfsel4_val |= 1 << 21; unsafe { *gpfsel4 = gpfsel4_val }; loop { unsafe { *gpset1 = GPIO47 }; unsafe { *gpclr1 = GPIO35 }; sleep(100_000); unsafe { *gpclr1 = GPIO47 }; unsafe { *gpset1 = GPIO35 }; sleep(100_000); } } #[no_mangle] pub unsafe fn __aeabi_unwind_cpp_pr0() { loop {} } #[lang = "eh_personality"] extern fn eh_personality() {} #[lang = "panic_fmt"] extern fn panic_fmt() -> ! { loop {} }
use std::env; use std::io::{self, Write, StderrLock}; use std::process::{Command, exit}; use std::thread::{self, JoinHandle}; use std::sync::{Arc, Mutex}; /* TODO: Functionality can be increased to accept the following syntaxes from GNU Parallel: - Stdin support is currently missing. - Use a tokenizer for building commands instead of string replacements. - {N}, {N.}, etc. - parallel command {1} {2} {3} ::: 1 2 3 ::: 4 5 6 ::: 7 8 9 - parallel command ::: * instead of parallel command {} ::: * - parallel ::: "command 1" "command 2" - paralllel command ::: a b c :::+ 1 2 3 ::: d e f :::+ 4 5 6 */ /// A JobThread allows for the manipulation of content within. struct JobThread { /// Allows us to know when a thread has completed all of it's tasks. handle: JoinHandle<()>, } /// Contains the parameters that each thread will acquire and manipulate. struct Inputs { /// The counter that will be checked and incremented by each thread. counter: usize, /// The values that each thread will copy values from. values: Vec<String> } struct Flags { /// The number of jobs to create for processing inputs. ncores: usize, } fn main() { let stderr = io::stderr(); let mut flags = Flags { ncores: 8 }; let mut command = String::new(); let mut inputs = Inputs { counter: 0, values: Vec::new() }; // Let's collect all parameters that we need from the program's arguments. // If an error is returned, this will handle that error as efficiently as possible. if let Err(why) = parse_arguments(&mut flags, &mut command, &mut inputs.values) { let mut stderr = stderr.lock(); let _ = stderr.write(b"parallel: parsing error: "); match why { ParseErr::JobsNaN(value) => { let _ = stderr.write(b"jobs parameter, '"); let _ = stderr.write(value.as_bytes()); let _ = stderr.write(b"', is not a number.\n"); }, _ => { let message: &[u8] = match why { ParseErr::InputVarsNotDefined => b"input variables were not defined.\n", ParseErr::JobsNoValue => b"no jobs parameter was defined.\n", _ => unreachable!() }; let _ = stderr.write(message); } }; exit(1); } // It will be useful to know the number of inputs, to know when to quit. let num_inputs = inputs.values.len(); // We will share the same list of inputs and counter with each thread. let shared_input = Arc::new(Mutex::new((inputs))); // First we will create as many threads as `flags.ncores` specifies. // The `threads` vector will contain the thread handles needed to // know when to quit the program. let mut threads: Vec<JobThread> = Vec::with_capacity(flags.ncores); for slot in 1..flags.ncores+1 { // The command that each input variable will be sent to. let command = command.clone(); // Allow the thread to gain access to the list of inputs. let input = shared_input.clone(); // Allow the thread to know when it's time to stop. let num_inputs = num_inputs.clone(); // The actual thread where the work will happen on incoming data. let handle: JoinHandle<()> = thread::spawn(move || { let slot_number = slot; let stderr = io::stderr(); loop { // Obtain the Nth item and it's job ID from the list of inputs. let (input_var, job_id) = { // Lock the access to the counter and values so that other threads won't clash. let mut input = input.lock().unwrap(); if input.counter == num_inputs { break } else { // The value must then be copied so that we can unlock it. let input_var = input.values[input.counter].to_owned(); let job_id = input.counter + 1; input.counter += 1; (input_var, job_id) } }; // Now the input can be processed with the command. if let Err(cmd_err) = cmd_builder(&input_var, &command, slot_number, job_id) { let mut stderr = stderr.lock(); cmd_err.handle(&mut stderr); } } }); // After the thread has been created, add the important pieces needed by the // main thread to the `threads` vector. threads.push(JobThread { handle: handle, // Gives the main thread access to using the thread's `join()` method. }); } for thread in threads.into_iter() { thread.handle.join().unwrap(); } } enum CommandErr { NoCommandSpecified, Failed(String, Vec<String>) } impl CommandErr { fn handle(self, stderr: &mut StderrLock) { let _ = stderr.write(b"parallel: command error: "); match self { CommandErr::NoCommandSpecified => { let _ = stderr.write(b"no command specified.\n"); }, CommandErr::Failed(command, arguments) => { let _ = stderr.write(command.as_bytes()); for arg in &arguments { let _ = stderr.write(b" "); let _ = stderr.write(arg.as_bytes()); } let _ = stderr.write(b"\n"); } } } } /// Builds the command and executes it fn cmd_builder(input: &str, template: &str, slot_id: usize, job_id: usize) -> Result<(), CommandErr> { // TODO: Use a tokenizer for building the command from the template. let mut iterator = template.split_whitespace(); let command = match iterator.next() { Some(command) => command, None => return Err(CommandErr::NoCommandSpecified) }; let mut arguments = Vec::new(); for arg in iterator { if arg.contains("{}") { arguments.push(arg.replace("{}", input)); } else if arg.contains("{.}") { arguments.push(arg.replace("{.}", remove_extension(input))); } else if arg.contains("{/}") { arguments.push(arg.replace("{/}", basename(input))); } else if arg.contains("{//}") { arguments.push(arg.replace("{//}", dirname(input))); } else if arg.contains("{/.}") { arguments.push(arg.replace("{/.}", basename(remove_extension(input)))); } else if arg.contains("{#}") { arguments.push(arg.replace("{#}", &job_id.to_string())); } else if arg.contains("{%}") { arguments.push(arg.replace("{%}", &slot_id.to_string())); } else { arguments.push(arg.to_owned()); } } if let Err(_) = Command::new(&command).args(&arguments).status() { return Err(CommandErr::Failed(String::from(command), arguments)); } Ok(()) } /// Removes the extension of a given input fn remove_extension<'a>(input: &'a str) -> &'a str { let mut index = 0; for (id, character) in input.chars().enumerate() { if character == '.' { index = id; } } if index == 0 { input } else { &input[0..index] } } fn basename<'a>(input: &'a str) -> &'a str { let mut index = 0; for (id, character) in input.chars().enumerate() { if character == '/' { index = id; } } if index == 0 { input } else { &input[index+1..] } } fn dirname<'a>(input: &'a str) -> &'a str { let mut index = 0; for (id, character) in input.chars().enumerate() { if character == '/' { index = id; } } if index == 0 { input } else { &input[0..index] } } enum ParseErr { JobsNaN(String), JobsNoValue, InputVarsNotDefined, } // Parses input arguments and stores their values into their associated variabless. fn parse_arguments(flags: &mut Flags, command: &mut String, input_variables: &mut Vec<String>) -> Result<(), ParseErr> { let mut parsing_arguments = true; let mut command_is_set = false; let mut raw_args = env::args().skip(1).peekable(); while let Some(argument) = raw_args.next() { if parsing_arguments { match argument.as_str() { // Defines the number of jobs to run in parallel. "-j" => { match raw_args.peek() { Some(val) => match val.parse::<usize>() { Ok(val) => flags.ncores = val, Err(_) => return Err(ParseErr::JobsNaN(val.clone())) }, None => return Err(ParseErr::JobsNoValue) } let _ = raw_args.next(); }, // Arguments after `:::` are input values. ":::" => parsing_arguments = false, _ => { if command_is_set { command.push(' '); command.push_str(&argument); } else { command.push_str(&argument); command_is_set = true; } } } } else { input_variables.push(argument); } } if input_variables.is_empty() { return Err(ParseErr::InputVarsNotDefined) } Ok(()) }
#[cfg(x86_64)] use std::arch::x86_64; use std::ffi::CString; use std::ptr; use sys::*; pub struct Device { pub(crate) handle: RTCDevice, } impl Device { pub fn new() -> Device { // Set the flush zero and denormals modes from Embrees's perf. recommendations // https://embree.github.io/api.html#performance-recommendations // Though, in Rust I think we just call the below function to do both #[cfg(x86_64)] unsafe { x86_64::_MM_SET_FLUSH_ZERO_MODE(x86_64::_MM_FLUSH_ZERO_ON); } Device { handle: unsafe { rtcNewDevice(ptr::null()) }, } } pub fn debug() -> Device { let cfg = CString::new("verbose=4").unwrap(); Device { handle: unsafe { rtcNewDevice(cfg.as_ptr()) }, } } // TODO: Setup the flush zero and denormals mode needed by Embree // using the Rust SIMD when it's in core } impl Drop for Device { fn drop(&mut self) { unsafe { rtcReleaseDevice(self.handle); } } } unsafe impl Sync for Device {}
use std::collections::{HashMap, HashSet}; use std::io::Write; use crate::client::{CharacterRecipes, Client, Item, ItemId, Recipe, RecipeId, Listings}; use crate::error::Result; pub struct Index { pub recipes: HashMap<RecipeId, Recipe>, pub recipes_by_item: HashMap<ItemId, Recipe>, pub items: HashMap<ItemId, Item>, pub materials: HashMap<ItemId, i32>, // item -> bank count pub listings: HashMap<ItemId, Listings>, pub offerings: HashSet<ItemId>, } #[allow(dead_code)] pub enum RecipeSource { Characters, All, } impl Index { pub fn new(client: &mut Client, source: RecipeSource) -> Result<Index> { let all_ids; match source { RecipeSource::Characters => { let names: Vec<String> = client.characters()?; println!("{:?}", names); let mut id_set = HashSet::<RecipeId>::new(); for name in &names { let r: CharacterRecipes = client.character_recipes(name)?; println!("{}: {}", name, r.recipes.len()); for id in &r.recipes { id_set.insert(*id); } } all_ids = id_set.iter().cloned().collect(); } RecipeSource::All => { all_ids = client.all_recipes()?; } } println!("known recipes: {}", all_ids.len()); let mut recipes = HashMap::new(); let mut recipes_by_item = HashMap::new(); for ids in all_ids.chunks(50) { let rs: Vec<Recipe> = client.recipes(ids)?; for r in rs { recipes.insert(r.id, r.clone()); recipes_by_item.insert(r.output_item_id, r); } print!("."); std::io::stdout().flush()?; } println!(""); println!("retrieved recipes: {}", recipes.len()); let mut all_items = HashSet::<ItemId>::new(); for (_, r) in &recipes { all_items.insert(r.output_item_id); for i in &r.ingredients { all_items.insert(i.item_id); } } println!("total items: {}", all_items.len()); let mut items = HashMap::new(); let id_vec: Vec<_> = all_items.iter().cloned().collect(); for ids in id_vec.chunks(50) { let is = client.items(&ids)?; for i in is { items.insert(i.id, i); } print!("."); std::io::stdout().flush()?; } println!(""); println!("retrieved items: {}", items.len()); let pid_vec: Vec<ItemId> = all_items.iter().cloned().collect(); let mut listings = HashMap::new(); for ids in pid_vec.chunks(50) { let ls = client.listings(ids)?; for l in ls { listings.insert(l.id, l); } print!("."); std::io::stdout().flush()?; } println!(""); println!("retrieve listings: {}", listings.len()); let mut materials = HashMap::new(); let ms = client.materials()?; println!("materials: {}", ms.len()); for m in ms { materials.insert(m.id, m.count); } let mut offerings = HashSet::new(); for (id, item) in &items { if item.description.as_ref().map_or(false, |d| d == "An offering used in dungeon recipes.") { offerings.insert(*id); } } Ok(Index{recipes, recipes_by_item, items, materials, listings, offerings}) } pub fn refresh_materials(&mut self, client: &mut Client) -> Result<()> { let mut materials = HashMap::new(); let ms = client.materials()?; println!("materials: {}", ms.len()); for m in ms { materials.insert(m.id, m.count); } self.materials = materials; Ok(()) } }
//! Provides methods for controlling process, //! and gathering resource usages. //! use super::{result::*, util::*}; use sigar_sys::*; /// Returns pid for current process pub fn current_pid() -> SigarResult<u32> { ffi_wrap_sigar_t!((|ptr_t| unsafe { sigar_pid_get(ptr_t) as u32 })) } // C: sigar_proc_kill /// Kills a specific process with given process id & signal pub fn kill(pid: u32, signal: i32) -> SigarResult<()> { let res = unsafe { sigar_proc_kill(pid as sigar_pid_t, signal as ::std::os::raw::c_int) }; if res != SIGAR_CODE_OK { let reason = ffi_wrap_sigar_t!((|ptr_t| error_string(ptr_t, res.into())))?; return Err(Error::from_string(reason)); } Ok(()) } // C: sigar_proc_list_get pub type PIDList = Vec<u32>; /// Returns pid list pub fn list() -> SigarResult<PIDList> { ffi_wrap_destroy!( sigar_proc_list_get, sigar_proc_list_destroy, sigar_proc_list_t, (|list: &sigar_proc_list_t| ffi_extract_list!(list, (|one: &sigar_pid_t| *one as u32))) ) } // C: sigar_proc_stat_get /// Process summary #[derive(Debug)] pub struct Summary { pub total: u64, pub sleeping: u64, pub running: u64, pub zombie: u64, pub stopped: u64, pub idle: u64, pub threads: u64, } /// Returns summary of all processes pub fn summary() -> SigarResult<Summary> { let raw = ffi_wrap!(sigar_proc_stat_get, sigar_proc_stat_t)?; Ok(value_convert!( Summary, raw, total, sleeping, running, zombie, stopped, idle, threads )) } // C: sigar_proc_mem_get /// Process memory info #[derive(Debug, Default, Copy, Clone)] pub struct Mem { pub size: u64, pub resident: u64, pub share: u64, pub minor_faults: u64, pub major_faults: u64, pub page_faults: u64, } /// Returns memory usage for given pid pub fn mem(pid: u32) -> SigarResult<Mem> { let raw = ffi_wrap!(sigar_proc_mem_get, (pid as sigar_pid_t), sigar_proc_mem_t)?; Ok(value_convert!( Mem, raw, size, resident, share, minor_faults, major_faults, page_faults, )) } // C: sigar_proc_disk_io_get /// Disk IO info #[derive(Debug)] pub struct DiskIO { pub bytes_read: u64, pub bytes_written: u64, pub bytes_total: u64, } /// Returns disk io for given pid pub fn disk_io(pid: u32) -> SigarResult<DiskIO> { let raw = ffi_wrap!( sigar_proc_disk_io_get, (pid as sigar_pid_t), sigar_proc_disk_io_t )?; Ok(value_convert!( DiskIO, raw, bytes_read, bytes_written, bytes_total, )) } // C: sigar_proc_cumulative_disk_io_get /// Returns cumulative disk io for given pid pub fn cum_disk_io(pid: u32) -> SigarResult<DiskIO> { let raw = ffi_wrap!( sigar_proc_cumulative_disk_io_get, (pid as sigar_pid_t), sigar_proc_cumulative_disk_io_t )?; Ok(value_convert!( DiskIO, raw, bytes_read, bytes_written, bytes_total, )) } // C: sigar_proc_cred_get /// Process cred #[derive(Debug)] pub struct Cred { pub uid: u32, pub gid: u32, pub euid: u32, pub egid: u32, } /// Returns creds for given pid pub fn cred(pid: u32) -> SigarResult<Cred> { let raw = ffi_wrap!(sigar_proc_cred_get, (pid as sigar_pid_t), sigar_proc_cred_t)?; Ok(value_convert!(Cred, raw, uid, gid, euid, egid)) } // C: sigar_proc_cred_name_get /// Process cred name #[derive(Debug)] pub struct CredName { pub user: Vec<u8>, pub group: Vec<u8>, } pub fn cred_name(pid: u32) -> SigarResult<CredName> { let raw = ffi_wrap!( sigar_proc_cred_name_get, (pid as sigar_pid_t), sigar_proc_cred_name_t )?; Ok(CredName { user: chars_to_bytes(&raw.user[..]), group: chars_to_bytes(&raw.group[..]), }) } // C: sigar_proc_time_get /// Process time #[derive(Debug)] pub struct Time { pub start_time: u64, pub user: u64, pub sys: u64, pub total: u64, } /// Returns process time for given pid pub fn time(pid: u32) -> SigarResult<Time> { let raw = ffi_wrap!(sigar_proc_time_get, (pid as sigar_pid_t), sigar_proc_time_t)?; Ok(value_convert!(Time, raw, start_time, user, sys, total)) } // C: sigar_proc_cpu_get /// Process cpu usage #[derive(Debug)] pub struct CPU { pub start_time: u64, pub user: u64, pub sys: u64, pub total: u64, pub last_time: u64, pub percent: f64, } /// Returns cpu usage for given pid pub fn cpu(pid: u32) -> SigarResult<CPU> { let raw = ffi_wrap!(sigar_proc_cpu_get, (pid as sigar_pid_t), sigar_proc_cpu_t)?; Ok(value_convert!( CPU, raw, start_time, user, sys, total, last_time, percent, )) } // C: sigar_proc_state_get #[derive(Debug)] pub struct State { pub name: Vec<u8>, pub state: u8, pub ppid: i32, pub tty: i32, pub priority: i32, pub nice: i32, pub processor: i32, pub threads: u64, } /// Returns process state for given pid pub fn state(pid: u32) -> SigarResult<State> { let raw = ffi_wrap!( sigar_proc_state_get, (pid as sigar_pid_t), sigar_proc_state_t )?; Ok(value_convert!( State, raw, ppid, tty, priority, nice, processor, threads, (name: chars_to_bytes(&raw.name[..])), (state: raw.state as u8), )) } // C: sigar_proc_fd_get /// Process file descriptor summary #[derive(Debug)] pub struct FD { pub total: u64, } /// Returns fd summary for given pid pub fn fd(pid: u32) -> SigarResult<FD> { let raw = ffi_wrap!(sigar_proc_fd_get, (pid as sigar_pid_t), sigar_proc_fd_t)?; Ok(value_convert!(FD, raw, total,)) } // TODO: some methods // C: sigar_proc_args_get // C: sigar_proc_env_get // C: sigar_proc_exe_get // C: sigar_proc_modules_get // C: sigar_proc_port_get
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "Win32_Security_AppLocker")] pub mod AppLocker; #[cfg(feature = "Win32_Security_Authentication")] pub mod Authentication; #[cfg(feature = "Win32_Security_Authorization")] pub mod Authorization; #[cfg(feature = "Win32_Security_ConfigurationSnapin")] pub mod ConfigurationSnapin; #[cfg(feature = "Win32_Security_Credentials")] pub mod Credentials; #[cfg(feature = "Win32_Security_Cryptography")] pub mod Cryptography; #[cfg(feature = "Win32_Security_DiagnosticDataQuery")] pub mod DiagnosticDataQuery; #[cfg(feature = "Win32_Security_DirectoryServices")] pub mod DirectoryServices; #[cfg(feature = "Win32_Security_EnterpriseData")] pub mod EnterpriseData; #[cfg(feature = "Win32_Security_ExtensibleAuthenticationProtocol")] pub mod ExtensibleAuthenticationProtocol; #[cfg(feature = "Win32_Security_Isolation")] pub mod Isolation; #[cfg(feature = "Win32_Security_LicenseProtection")] pub mod LicenseProtection; #[cfg(feature = "Win32_Security_NetworkAccessProtection")] pub mod NetworkAccessProtection; #[cfg(feature = "Win32_Security_Tpm")] pub mod Tpm; #[cfg(feature = "Win32_Security_WinTrust")] pub mod WinTrust; #[cfg(feature = "Win32_Security_WinWlx")] pub mod WinWlx; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ACCESS_ALLOWED_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub SidStart: u32, } impl ACCESS_ALLOWED_ACE {} impl ::core::default::Default for ACCESS_ALLOWED_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ACCESS_ALLOWED_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ACCESS_ALLOWED_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for ACCESS_ALLOWED_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for ACCESS_ALLOWED_ACE {} unsafe impl ::windows::core::Abi for ACCESS_ALLOWED_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ACCESS_ALLOWED_CALLBACK_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub SidStart: u32, } impl ACCESS_ALLOWED_CALLBACK_ACE {} impl ::core::default::Default for ACCESS_ALLOWED_CALLBACK_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ACCESS_ALLOWED_CALLBACK_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ACCESS_ALLOWED_CALLBACK_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for ACCESS_ALLOWED_CALLBACK_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for ACCESS_ALLOWED_CALLBACK_ACE {} unsafe impl ::windows::core::Abi for ACCESS_ALLOWED_CALLBACK_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ACCESS_ALLOWED_CALLBACK_OBJECT_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub Flags: SYSTEM_AUDIT_OBJECT_ACE_FLAGS, pub ObjectType: ::windows::core::GUID, pub InheritedObjectType: ::windows::core::GUID, pub SidStart: u32, } impl ACCESS_ALLOWED_CALLBACK_OBJECT_ACE {} impl ::core::default::Default for ACCESS_ALLOWED_CALLBACK_OBJECT_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ACCESS_ALLOWED_CALLBACK_OBJECT_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ACCESS_ALLOWED_CALLBACK_OBJECT_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("Flags", &self.Flags).field("ObjectType", &self.ObjectType).field("InheritedObjectType", &self.InheritedObjectType).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for ACCESS_ALLOWED_CALLBACK_OBJECT_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.Flags == other.Flags && self.ObjectType == other.ObjectType && self.InheritedObjectType == other.InheritedObjectType && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for ACCESS_ALLOWED_CALLBACK_OBJECT_ACE {} unsafe impl ::windows::core::Abi for ACCESS_ALLOWED_CALLBACK_OBJECT_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ACCESS_ALLOWED_OBJECT_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub Flags: SYSTEM_AUDIT_OBJECT_ACE_FLAGS, pub ObjectType: ::windows::core::GUID, pub InheritedObjectType: ::windows::core::GUID, pub SidStart: u32, } impl ACCESS_ALLOWED_OBJECT_ACE {} impl ::core::default::Default for ACCESS_ALLOWED_OBJECT_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ACCESS_ALLOWED_OBJECT_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ACCESS_ALLOWED_OBJECT_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("Flags", &self.Flags).field("ObjectType", &self.ObjectType).field("InheritedObjectType", &self.InheritedObjectType).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for ACCESS_ALLOWED_OBJECT_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.Flags == other.Flags && self.ObjectType == other.ObjectType && self.InheritedObjectType == other.InheritedObjectType && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for ACCESS_ALLOWED_OBJECT_ACE {} unsafe impl ::windows::core::Abi for ACCESS_ALLOWED_OBJECT_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ACCESS_DENIED_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub SidStart: u32, } impl ACCESS_DENIED_ACE {} impl ::core::default::Default for ACCESS_DENIED_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ACCESS_DENIED_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ACCESS_DENIED_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for ACCESS_DENIED_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for ACCESS_DENIED_ACE {} unsafe impl ::windows::core::Abi for ACCESS_DENIED_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ACCESS_DENIED_CALLBACK_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub SidStart: u32, } impl ACCESS_DENIED_CALLBACK_ACE {} impl ::core::default::Default for ACCESS_DENIED_CALLBACK_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ACCESS_DENIED_CALLBACK_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ACCESS_DENIED_CALLBACK_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for ACCESS_DENIED_CALLBACK_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for ACCESS_DENIED_CALLBACK_ACE {} unsafe impl ::windows::core::Abi for ACCESS_DENIED_CALLBACK_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ACCESS_DENIED_CALLBACK_OBJECT_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub Flags: SYSTEM_AUDIT_OBJECT_ACE_FLAGS, pub ObjectType: ::windows::core::GUID, pub InheritedObjectType: ::windows::core::GUID, pub SidStart: u32, } impl ACCESS_DENIED_CALLBACK_OBJECT_ACE {} impl ::core::default::Default for ACCESS_DENIED_CALLBACK_OBJECT_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ACCESS_DENIED_CALLBACK_OBJECT_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ACCESS_DENIED_CALLBACK_OBJECT_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("Flags", &self.Flags).field("ObjectType", &self.ObjectType).field("InheritedObjectType", &self.InheritedObjectType).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for ACCESS_DENIED_CALLBACK_OBJECT_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.Flags == other.Flags && self.ObjectType == other.ObjectType && self.InheritedObjectType == other.InheritedObjectType && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for ACCESS_DENIED_CALLBACK_OBJECT_ACE {} unsafe impl ::windows::core::Abi for ACCESS_DENIED_CALLBACK_OBJECT_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ACCESS_DENIED_OBJECT_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub Flags: SYSTEM_AUDIT_OBJECT_ACE_FLAGS, pub ObjectType: ::windows::core::GUID, pub InheritedObjectType: ::windows::core::GUID, pub SidStart: u32, } impl ACCESS_DENIED_OBJECT_ACE {} impl ::core::default::Default for ACCESS_DENIED_OBJECT_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ACCESS_DENIED_OBJECT_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ACCESS_DENIED_OBJECT_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("Flags", &self.Flags).field("ObjectType", &self.ObjectType).field("InheritedObjectType", &self.InheritedObjectType).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for ACCESS_DENIED_OBJECT_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.Flags == other.Flags && self.ObjectType == other.ObjectType && self.InheritedObjectType == other.InheritedObjectType && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for ACCESS_DENIED_OBJECT_ACE {} unsafe impl ::windows::core::Abi for ACCESS_DENIED_OBJECT_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ACCESS_REASONS { pub Data: [u32; 32], } impl ACCESS_REASONS {} impl ::core::default::Default for ACCESS_REASONS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ACCESS_REASONS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ACCESS_REASONS").field("Data", &self.Data).finish() } } impl ::core::cmp::PartialEq for ACCESS_REASONS { fn eq(&self, other: &Self) -> bool { self.Data == other.Data } } impl ::core::cmp::Eq for ACCESS_REASONS {} unsafe impl ::windows::core::Abi for ACCESS_REASONS { 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 ACE_FLAGS(pub u32); pub const CONTAINER_INHERIT_ACE: ACE_FLAGS = ACE_FLAGS(2u32); pub const FAILED_ACCESS_ACE_FLAG: ACE_FLAGS = ACE_FLAGS(128u32); pub const INHERIT_ONLY_ACE: ACE_FLAGS = ACE_FLAGS(8u32); pub const INHERITED_ACE: ACE_FLAGS = ACE_FLAGS(16u32); pub const NO_PROPAGATE_INHERIT_ACE: ACE_FLAGS = ACE_FLAGS(4u32); pub const OBJECT_INHERIT_ACE: ACE_FLAGS = ACE_FLAGS(1u32); pub const SUCCESSFUL_ACCESS_ACE_FLAG: ACE_FLAGS = ACE_FLAGS(64u32); pub const SUB_CONTAINERS_AND_OBJECTS_INHERIT: ACE_FLAGS = ACE_FLAGS(3u32); pub const SUB_CONTAINERS_ONLY_INHERIT: ACE_FLAGS = ACE_FLAGS(2u32); pub const SUB_OBJECTS_ONLY_INHERIT: ACE_FLAGS = ACE_FLAGS(1u32); pub const INHERIT_NO_PROPAGATE: ACE_FLAGS = ACE_FLAGS(4u32); pub const INHERIT_ONLY: ACE_FLAGS = ACE_FLAGS(8u32); pub const NO_INHERITANCE: ACE_FLAGS = ACE_FLAGS(0u32); pub const INHERIT_ONLY_ACE_: ACE_FLAGS = ACE_FLAGS(8u32); impl ::core::convert::From<u32> for ACE_FLAGS { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for ACE_FLAGS { type Abi = Self; } impl ::core::ops::BitOr for ACE_FLAGS { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for ACE_FLAGS { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for ACE_FLAGS { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for ACE_FLAGS { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for ACE_FLAGS { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ACE_HEADER { pub AceType: u8, pub AceFlags: u8, pub AceSize: u16, } impl ACE_HEADER {} impl ::core::default::Default for ACE_HEADER { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ACE_HEADER { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ACE_HEADER").field("AceType", &self.AceType).field("AceFlags", &self.AceFlags).field("AceSize", &self.AceSize).finish() } } impl ::core::cmp::PartialEq for ACE_HEADER { fn eq(&self, other: &Self) -> bool { self.AceType == other.AceType && self.AceFlags == other.AceFlags && self.AceSize == other.AceSize } } impl ::core::cmp::Eq for ACE_HEADER {} unsafe impl ::windows::core::Abi for ACE_HEADER { 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 ACE_REVISION(pub u32); pub const ACL_REVISION: ACE_REVISION = ACE_REVISION(2u32); pub const ACL_REVISION_DS: ACE_REVISION = ACE_REVISION(4u32); impl ::core::convert::From<u32> for ACE_REVISION { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for ACE_REVISION { type Abi = Self; } impl ::core::ops::BitOr for ACE_REVISION { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for ACE_REVISION { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for ACE_REVISION { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for ACE_REVISION { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for ACE_REVISION { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ACL { pub AclRevision: u8, pub Sbz1: u8, pub AclSize: u16, pub AceCount: u16, pub Sbz2: u16, } impl ACL {} impl ::core::default::Default for ACL { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ACL { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ACL").field("AclRevision", &self.AclRevision).field("Sbz1", &self.Sbz1).field("AclSize", &self.AclSize).field("AceCount", &self.AceCount).field("Sbz2", &self.Sbz2).finish() } } impl ::core::cmp::PartialEq for ACL { fn eq(&self, other: &Self) -> bool { self.AclRevision == other.AclRevision && self.Sbz1 == other.Sbz1 && self.AclSize == other.AclSize && self.AceCount == other.AceCount && self.Sbz2 == other.Sbz2 } } impl ::core::cmp::Eq for ACL {} unsafe impl ::windows::core::Abi for ACL { 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 ACL_INFORMATION_CLASS(pub i32); pub const AclRevisionInformation: ACL_INFORMATION_CLASS = ACL_INFORMATION_CLASS(1i32); pub const AclSizeInformation: ACL_INFORMATION_CLASS = ACL_INFORMATION_CLASS(2i32); impl ::core::convert::From<i32> for ACL_INFORMATION_CLASS { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for ACL_INFORMATION_CLASS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ACL_REVISION_INFORMATION { pub AclRevision: u32, } impl ACL_REVISION_INFORMATION {} impl ::core::default::Default for ACL_REVISION_INFORMATION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ACL_REVISION_INFORMATION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ACL_REVISION_INFORMATION").field("AclRevision", &self.AclRevision).finish() } } impl ::core::cmp::PartialEq for ACL_REVISION_INFORMATION { fn eq(&self, other: &Self) -> bool { self.AclRevision == other.AclRevision } } impl ::core::cmp::Eq for ACL_REVISION_INFORMATION {} unsafe impl ::windows::core::Abi for ACL_REVISION_INFORMATION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ACL_SIZE_INFORMATION { pub AceCount: u32, pub AclBytesInUse: u32, pub AclBytesFree: u32, } impl ACL_SIZE_INFORMATION {} impl ::core::default::Default for ACL_SIZE_INFORMATION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ACL_SIZE_INFORMATION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ACL_SIZE_INFORMATION").field("AceCount", &self.AceCount).field("AclBytesInUse", &self.AclBytesInUse).field("AclBytesFree", &self.AclBytesFree).finish() } } impl ::core::cmp::PartialEq for ACL_SIZE_INFORMATION { fn eq(&self, other: &Self) -> bool { self.AceCount == other.AceCount && self.AclBytesInUse == other.AclBytesInUse && self.AclBytesFree == other.AclBytesFree } } impl ::core::cmp::Eq for ACL_SIZE_INFORMATION {} unsafe impl ::windows::core::Abi for ACL_SIZE_INFORMATION { 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 AUDIT_EVENT_TYPE(pub i32); pub const AuditEventObjectAccess: AUDIT_EVENT_TYPE = AUDIT_EVENT_TYPE(0i32); pub const AuditEventDirectoryServiceAccess: AUDIT_EVENT_TYPE = AUDIT_EVENT_TYPE(1i32); impl ::core::convert::From<i32> for AUDIT_EVENT_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for AUDIT_EVENT_TYPE { type Abi = Self; } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AccessCheck<'a, Param1: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(psecuritydescriptor: *const SECURITY_DESCRIPTOR, clienttoken: Param1, desiredaccess: u32, genericmapping: *const GENERIC_MAPPING, privilegeset: *mut PRIVILEGE_SET, privilegesetlength: *mut u32, grantedaccess: *mut u32, accessstatus: *mut i32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AccessCheck(psecuritydescriptor: *const SECURITY_DESCRIPTOR, clienttoken: super::Foundation::HANDLE, desiredaccess: u32, genericmapping: *const GENERIC_MAPPING, privilegeset: *mut PRIVILEGE_SET, privilegesetlength: *mut u32, grantedaccess: *mut u32, accessstatus: *mut i32) -> super::Foundation::BOOL; } ::core::mem::transmute(AccessCheck( ::core::mem::transmute(psecuritydescriptor), clienttoken.into_param().abi(), ::core::mem::transmute(desiredaccess), ::core::mem::transmute(genericmapping), ::core::mem::transmute(privilegeset), ::core::mem::transmute(privilegesetlength), ::core::mem::transmute(grantedaccess), ::core::mem::transmute(accessstatus), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AccessCheckAndAuditAlarmA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param7: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>( subsystemname: Param0, handleid: *const ::core::ffi::c_void, objecttypename: Param2, objectname: Param3, securitydescriptor: *const SECURITY_DESCRIPTOR, desiredaccess: u32, genericmapping: *const GENERIC_MAPPING, objectcreation: Param7, grantedaccess: *mut u32, accessstatus: *mut i32, pfgenerateonclose: *mut i32, ) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AccessCheckAndAuditAlarmA(subsystemname: super::Foundation::PSTR, handleid: *const ::core::ffi::c_void, objecttypename: super::Foundation::PSTR, objectname: super::Foundation::PSTR, securitydescriptor: *const SECURITY_DESCRIPTOR, desiredaccess: u32, genericmapping: *const GENERIC_MAPPING, objectcreation: super::Foundation::BOOL, grantedaccess: *mut u32, accessstatus: *mut i32, pfgenerateonclose: *mut i32) -> super::Foundation::BOOL; } ::core::mem::transmute(AccessCheckAndAuditAlarmA( subsystemname.into_param().abi(), ::core::mem::transmute(handleid), objecttypename.into_param().abi(), objectname.into_param().abi(), ::core::mem::transmute(securitydescriptor), ::core::mem::transmute(desiredaccess), ::core::mem::transmute(genericmapping), objectcreation.into_param().abi(), ::core::mem::transmute(grantedaccess), ::core::mem::transmute(accessstatus), ::core::mem::transmute(pfgenerateonclose), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AccessCheckAndAuditAlarmW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param7: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>( subsystemname: Param0, handleid: *const ::core::ffi::c_void, objecttypename: Param2, objectname: Param3, securitydescriptor: *const SECURITY_DESCRIPTOR, desiredaccess: u32, genericmapping: *const GENERIC_MAPPING, objectcreation: Param7, grantedaccess: *mut u32, accessstatus: *mut i32, pfgenerateonclose: *mut i32, ) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AccessCheckAndAuditAlarmW(subsystemname: super::Foundation::PWSTR, handleid: *const ::core::ffi::c_void, objecttypename: super::Foundation::PWSTR, objectname: super::Foundation::PWSTR, securitydescriptor: *const SECURITY_DESCRIPTOR, desiredaccess: u32, genericmapping: *const GENERIC_MAPPING, objectcreation: super::Foundation::BOOL, grantedaccess: *mut u32, accessstatus: *mut i32, pfgenerateonclose: *mut i32) -> super::Foundation::BOOL; } ::core::mem::transmute(AccessCheckAndAuditAlarmW( subsystemname.into_param().abi(), ::core::mem::transmute(handleid), objecttypename.into_param().abi(), objectname.into_param().abi(), ::core::mem::transmute(securitydescriptor), ::core::mem::transmute(desiredaccess), ::core::mem::transmute(genericmapping), objectcreation.into_param().abi(), ::core::mem::transmute(grantedaccess), ::core::mem::transmute(accessstatus), ::core::mem::transmute(pfgenerateonclose), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AccessCheckByType<'a, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param2: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>( psecuritydescriptor: *const SECURITY_DESCRIPTOR, principalselfsid: Param1, clienttoken: Param2, desiredaccess: u32, objecttypelist: *mut OBJECT_TYPE_LIST, objecttypelistlength: u32, genericmapping: *const GENERIC_MAPPING, privilegeset: *mut PRIVILEGE_SET, privilegesetlength: *mut u32, grantedaccess: *mut u32, accessstatus: *mut i32, ) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AccessCheckByType(psecuritydescriptor: *const SECURITY_DESCRIPTOR, principalselfsid: super::Foundation::PSID, clienttoken: super::Foundation::HANDLE, desiredaccess: u32, objecttypelist: *mut OBJECT_TYPE_LIST, objecttypelistlength: u32, genericmapping: *const GENERIC_MAPPING, privilegeset: *mut PRIVILEGE_SET, privilegesetlength: *mut u32, grantedaccess: *mut u32, accessstatus: *mut i32) -> super::Foundation::BOOL; } ::core::mem::transmute(AccessCheckByType( ::core::mem::transmute(psecuritydescriptor), principalselfsid.into_param().abi(), clienttoken.into_param().abi(), ::core::mem::transmute(desiredaccess), ::core::mem::transmute(objecttypelist), ::core::mem::transmute(objecttypelistlength), ::core::mem::transmute(genericmapping), ::core::mem::transmute(privilegeset), ::core::mem::transmute(privilegesetlength), ::core::mem::transmute(grantedaccess), ::core::mem::transmute(accessstatus), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AccessCheckByTypeAndAuditAlarmA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param5: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param12: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>( subsystemname: Param0, handleid: *const ::core::ffi::c_void, objecttypename: Param2, objectname: Param3, securitydescriptor: *const SECURITY_DESCRIPTOR, principalselfsid: Param5, desiredaccess: u32, audittype: AUDIT_EVENT_TYPE, flags: u32, objecttypelist: *mut OBJECT_TYPE_LIST, objecttypelistlength: u32, genericmapping: *const GENERIC_MAPPING, objectcreation: Param12, grantedaccess: *mut u32, accessstatus: *mut i32, pfgenerateonclose: *mut i32, ) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AccessCheckByTypeAndAuditAlarmA( subsystemname: super::Foundation::PSTR, handleid: *const ::core::ffi::c_void, objecttypename: super::Foundation::PSTR, objectname: super::Foundation::PSTR, securitydescriptor: *const SECURITY_DESCRIPTOR, principalselfsid: super::Foundation::PSID, desiredaccess: u32, audittype: AUDIT_EVENT_TYPE, flags: u32, objecttypelist: *mut OBJECT_TYPE_LIST, objecttypelistlength: u32, genericmapping: *const GENERIC_MAPPING, objectcreation: super::Foundation::BOOL, grantedaccess: *mut u32, accessstatus: *mut i32, pfgenerateonclose: *mut i32, ) -> super::Foundation::BOOL; } ::core::mem::transmute(AccessCheckByTypeAndAuditAlarmA( subsystemname.into_param().abi(), ::core::mem::transmute(handleid), objecttypename.into_param().abi(), objectname.into_param().abi(), ::core::mem::transmute(securitydescriptor), principalselfsid.into_param().abi(), ::core::mem::transmute(desiredaccess), ::core::mem::transmute(audittype), ::core::mem::transmute(flags), ::core::mem::transmute(objecttypelist), ::core::mem::transmute(objecttypelistlength), ::core::mem::transmute(genericmapping), objectcreation.into_param().abi(), ::core::mem::transmute(grantedaccess), ::core::mem::transmute(accessstatus), ::core::mem::transmute(pfgenerateonclose), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AccessCheckByTypeAndAuditAlarmW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param5: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param12: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>( subsystemname: Param0, handleid: *const ::core::ffi::c_void, objecttypename: Param2, objectname: Param3, securitydescriptor: *const SECURITY_DESCRIPTOR, principalselfsid: Param5, desiredaccess: u32, audittype: AUDIT_EVENT_TYPE, flags: u32, objecttypelist: *mut OBJECT_TYPE_LIST, objecttypelistlength: u32, genericmapping: *const GENERIC_MAPPING, objectcreation: Param12, grantedaccess: *mut u32, accessstatus: *mut i32, pfgenerateonclose: *mut i32, ) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AccessCheckByTypeAndAuditAlarmW( subsystemname: super::Foundation::PWSTR, handleid: *const ::core::ffi::c_void, objecttypename: super::Foundation::PWSTR, objectname: super::Foundation::PWSTR, securitydescriptor: *const SECURITY_DESCRIPTOR, principalselfsid: super::Foundation::PSID, desiredaccess: u32, audittype: AUDIT_EVENT_TYPE, flags: u32, objecttypelist: *mut OBJECT_TYPE_LIST, objecttypelistlength: u32, genericmapping: *const GENERIC_MAPPING, objectcreation: super::Foundation::BOOL, grantedaccess: *mut u32, accessstatus: *mut i32, pfgenerateonclose: *mut i32, ) -> super::Foundation::BOOL; } ::core::mem::transmute(AccessCheckByTypeAndAuditAlarmW( subsystemname.into_param().abi(), ::core::mem::transmute(handleid), objecttypename.into_param().abi(), objectname.into_param().abi(), ::core::mem::transmute(securitydescriptor), principalselfsid.into_param().abi(), ::core::mem::transmute(desiredaccess), ::core::mem::transmute(audittype), ::core::mem::transmute(flags), ::core::mem::transmute(objecttypelist), ::core::mem::transmute(objecttypelistlength), ::core::mem::transmute(genericmapping), objectcreation.into_param().abi(), ::core::mem::transmute(grantedaccess), ::core::mem::transmute(accessstatus), ::core::mem::transmute(pfgenerateonclose), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AccessCheckByTypeResultList<'a, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param2: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>( psecuritydescriptor: *const SECURITY_DESCRIPTOR, principalselfsid: Param1, clienttoken: Param2, desiredaccess: u32, objecttypelist: *mut OBJECT_TYPE_LIST, objecttypelistlength: u32, genericmapping: *const GENERIC_MAPPING, privilegeset: *mut PRIVILEGE_SET, privilegesetlength: *mut u32, grantedaccesslist: *mut u32, accessstatuslist: *mut u32, ) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AccessCheckByTypeResultList(psecuritydescriptor: *const SECURITY_DESCRIPTOR, principalselfsid: super::Foundation::PSID, clienttoken: super::Foundation::HANDLE, desiredaccess: u32, objecttypelist: *mut OBJECT_TYPE_LIST, objecttypelistlength: u32, genericmapping: *const GENERIC_MAPPING, privilegeset: *mut PRIVILEGE_SET, privilegesetlength: *mut u32, grantedaccesslist: *mut u32, accessstatuslist: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(AccessCheckByTypeResultList( ::core::mem::transmute(psecuritydescriptor), principalselfsid.into_param().abi(), clienttoken.into_param().abi(), ::core::mem::transmute(desiredaccess), ::core::mem::transmute(objecttypelist), ::core::mem::transmute(objecttypelistlength), ::core::mem::transmute(genericmapping), ::core::mem::transmute(privilegeset), ::core::mem::transmute(privilegesetlength), ::core::mem::transmute(grantedaccesslist), ::core::mem::transmute(accessstatuslist), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AccessCheckByTypeResultListAndAuditAlarmA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param5: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param12: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>( subsystemname: Param0, handleid: *const ::core::ffi::c_void, objecttypename: Param2, objectname: Param3, securitydescriptor: *const SECURITY_DESCRIPTOR, principalselfsid: Param5, desiredaccess: u32, audittype: AUDIT_EVENT_TYPE, flags: u32, objecttypelist: *mut OBJECT_TYPE_LIST, objecttypelistlength: u32, genericmapping: *const GENERIC_MAPPING, objectcreation: Param12, grantedaccess: *mut u32, accessstatuslist: *mut u32, pfgenerateonclose: *mut i32, ) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AccessCheckByTypeResultListAndAuditAlarmA( subsystemname: super::Foundation::PSTR, handleid: *const ::core::ffi::c_void, objecttypename: super::Foundation::PSTR, objectname: super::Foundation::PSTR, securitydescriptor: *const SECURITY_DESCRIPTOR, principalselfsid: super::Foundation::PSID, desiredaccess: u32, audittype: AUDIT_EVENT_TYPE, flags: u32, objecttypelist: *mut OBJECT_TYPE_LIST, objecttypelistlength: u32, genericmapping: *const GENERIC_MAPPING, objectcreation: super::Foundation::BOOL, grantedaccess: *mut u32, accessstatuslist: *mut u32, pfgenerateonclose: *mut i32, ) -> super::Foundation::BOOL; } ::core::mem::transmute(AccessCheckByTypeResultListAndAuditAlarmA( subsystemname.into_param().abi(), ::core::mem::transmute(handleid), objecttypename.into_param().abi(), objectname.into_param().abi(), ::core::mem::transmute(securitydescriptor), principalselfsid.into_param().abi(), ::core::mem::transmute(desiredaccess), ::core::mem::transmute(audittype), ::core::mem::transmute(flags), ::core::mem::transmute(objecttypelist), ::core::mem::transmute(objecttypelistlength), ::core::mem::transmute(genericmapping), objectcreation.into_param().abi(), ::core::mem::transmute(grantedaccess), ::core::mem::transmute(accessstatuslist), ::core::mem::transmute(pfgenerateonclose), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AccessCheckByTypeResultListAndAuditAlarmByHandleA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>, Param3: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param4: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param6: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param13: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>( subsystemname: Param0, handleid: *const ::core::ffi::c_void, clienttoken: Param2, objecttypename: Param3, objectname: Param4, securitydescriptor: *const SECURITY_DESCRIPTOR, principalselfsid: Param6, desiredaccess: u32, audittype: AUDIT_EVENT_TYPE, flags: u32, objecttypelist: *mut OBJECT_TYPE_LIST, objecttypelistlength: u32, genericmapping: *const GENERIC_MAPPING, objectcreation: Param13, grantedaccess: *mut u32, accessstatuslist: *mut u32, pfgenerateonclose: *mut i32, ) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AccessCheckByTypeResultListAndAuditAlarmByHandleA( subsystemname: super::Foundation::PSTR, handleid: *const ::core::ffi::c_void, clienttoken: super::Foundation::HANDLE, objecttypename: super::Foundation::PSTR, objectname: super::Foundation::PSTR, securitydescriptor: *const SECURITY_DESCRIPTOR, principalselfsid: super::Foundation::PSID, desiredaccess: u32, audittype: AUDIT_EVENT_TYPE, flags: u32, objecttypelist: *mut OBJECT_TYPE_LIST, objecttypelistlength: u32, genericmapping: *const GENERIC_MAPPING, objectcreation: super::Foundation::BOOL, grantedaccess: *mut u32, accessstatuslist: *mut u32, pfgenerateonclose: *mut i32, ) -> super::Foundation::BOOL; } ::core::mem::transmute(AccessCheckByTypeResultListAndAuditAlarmByHandleA( subsystemname.into_param().abi(), ::core::mem::transmute(handleid), clienttoken.into_param().abi(), objecttypename.into_param().abi(), objectname.into_param().abi(), ::core::mem::transmute(securitydescriptor), principalselfsid.into_param().abi(), ::core::mem::transmute(desiredaccess), ::core::mem::transmute(audittype), ::core::mem::transmute(flags), ::core::mem::transmute(objecttypelist), ::core::mem::transmute(objecttypelistlength), ::core::mem::transmute(genericmapping), objectcreation.into_param().abi(), ::core::mem::transmute(grantedaccess), ::core::mem::transmute(accessstatuslist), ::core::mem::transmute(pfgenerateonclose), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AccessCheckByTypeResultListAndAuditAlarmByHandleW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>, Param3: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param6: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param13: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>( subsystemname: Param0, handleid: *const ::core::ffi::c_void, clienttoken: Param2, objecttypename: Param3, objectname: Param4, securitydescriptor: *const SECURITY_DESCRIPTOR, principalselfsid: Param6, desiredaccess: u32, audittype: AUDIT_EVENT_TYPE, flags: u32, objecttypelist: *mut OBJECT_TYPE_LIST, objecttypelistlength: u32, genericmapping: *const GENERIC_MAPPING, objectcreation: Param13, grantedaccesslist: *mut u32, accessstatuslist: *mut u32, pfgenerateonclose: *mut i32, ) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AccessCheckByTypeResultListAndAuditAlarmByHandleW( subsystemname: super::Foundation::PWSTR, handleid: *const ::core::ffi::c_void, clienttoken: super::Foundation::HANDLE, objecttypename: super::Foundation::PWSTR, objectname: super::Foundation::PWSTR, securitydescriptor: *const SECURITY_DESCRIPTOR, principalselfsid: super::Foundation::PSID, desiredaccess: u32, audittype: AUDIT_EVENT_TYPE, flags: u32, objecttypelist: *mut OBJECT_TYPE_LIST, objecttypelistlength: u32, genericmapping: *const GENERIC_MAPPING, objectcreation: super::Foundation::BOOL, grantedaccesslist: *mut u32, accessstatuslist: *mut u32, pfgenerateonclose: *mut i32, ) -> super::Foundation::BOOL; } ::core::mem::transmute(AccessCheckByTypeResultListAndAuditAlarmByHandleW( subsystemname.into_param().abi(), ::core::mem::transmute(handleid), clienttoken.into_param().abi(), objecttypename.into_param().abi(), objectname.into_param().abi(), ::core::mem::transmute(securitydescriptor), principalselfsid.into_param().abi(), ::core::mem::transmute(desiredaccess), ::core::mem::transmute(audittype), ::core::mem::transmute(flags), ::core::mem::transmute(objecttypelist), ::core::mem::transmute(objecttypelistlength), ::core::mem::transmute(genericmapping), objectcreation.into_param().abi(), ::core::mem::transmute(grantedaccesslist), ::core::mem::transmute(accessstatuslist), ::core::mem::transmute(pfgenerateonclose), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AccessCheckByTypeResultListAndAuditAlarmW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param5: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param12: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>( subsystemname: Param0, handleid: *const ::core::ffi::c_void, objecttypename: Param2, objectname: Param3, securitydescriptor: *const SECURITY_DESCRIPTOR, principalselfsid: Param5, desiredaccess: u32, audittype: AUDIT_EVENT_TYPE, flags: u32, objecttypelist: *mut OBJECT_TYPE_LIST, objecttypelistlength: u32, genericmapping: *const GENERIC_MAPPING, objectcreation: Param12, grantedaccesslist: *mut u32, accessstatuslist: *mut u32, pfgenerateonclose: *mut i32, ) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AccessCheckByTypeResultListAndAuditAlarmW( subsystemname: super::Foundation::PWSTR, handleid: *const ::core::ffi::c_void, objecttypename: super::Foundation::PWSTR, objectname: super::Foundation::PWSTR, securitydescriptor: *const SECURITY_DESCRIPTOR, principalselfsid: super::Foundation::PSID, desiredaccess: u32, audittype: AUDIT_EVENT_TYPE, flags: u32, objecttypelist: *mut OBJECT_TYPE_LIST, objecttypelistlength: u32, genericmapping: *const GENERIC_MAPPING, objectcreation: super::Foundation::BOOL, grantedaccesslist: *mut u32, accessstatuslist: *mut u32, pfgenerateonclose: *mut i32, ) -> super::Foundation::BOOL; } ::core::mem::transmute(AccessCheckByTypeResultListAndAuditAlarmW( subsystemname.into_param().abi(), ::core::mem::transmute(handleid), objecttypename.into_param().abi(), objectname.into_param().abi(), ::core::mem::transmute(securitydescriptor), principalselfsid.into_param().abi(), ::core::mem::transmute(desiredaccess), ::core::mem::transmute(audittype), ::core::mem::transmute(flags), ::core::mem::transmute(objecttypelist), ::core::mem::transmute(objecttypelistlength), ::core::mem::transmute(genericmapping), objectcreation.into_param().abi(), ::core::mem::transmute(grantedaccesslist), ::core::mem::transmute(accessstatuslist), ::core::mem::transmute(pfgenerateonclose), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AddAccessAllowedAce<'a, Param3: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(pacl: *mut ACL, dwacerevision: u32, accessmask: u32, psid: Param3) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AddAccessAllowedAce(pacl: *mut ACL, dwacerevision: u32, accessmask: u32, psid: super::Foundation::PSID) -> super::Foundation::BOOL; } ::core::mem::transmute(AddAccessAllowedAce(::core::mem::transmute(pacl), ::core::mem::transmute(dwacerevision), ::core::mem::transmute(accessmask), psid.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AddAccessAllowedAceEx<'a, Param4: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, accessmask: u32, psid: Param4) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AddAccessAllowedAceEx(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, accessmask: u32, psid: super::Foundation::PSID) -> super::Foundation::BOOL; } ::core::mem::transmute(AddAccessAllowedAceEx(::core::mem::transmute(pacl), ::core::mem::transmute(dwacerevision), ::core::mem::transmute(aceflags), ::core::mem::transmute(accessmask), psid.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AddAccessAllowedObjectAce<'a, Param6: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, accessmask: u32, objecttypeguid: *const ::windows::core::GUID, inheritedobjecttypeguid: *const ::windows::core::GUID, psid: Param6) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AddAccessAllowedObjectAce(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, accessmask: u32, objecttypeguid: *const ::windows::core::GUID, inheritedobjecttypeguid: *const ::windows::core::GUID, psid: super::Foundation::PSID) -> super::Foundation::BOOL; } ::core::mem::transmute(AddAccessAllowedObjectAce(::core::mem::transmute(pacl), ::core::mem::transmute(dwacerevision), ::core::mem::transmute(aceflags), ::core::mem::transmute(accessmask), ::core::mem::transmute(objecttypeguid), ::core::mem::transmute(inheritedobjecttypeguid), psid.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AddAccessDeniedAce<'a, Param3: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(pacl: *mut ACL, dwacerevision: u32, accessmask: u32, psid: Param3) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AddAccessDeniedAce(pacl: *mut ACL, dwacerevision: u32, accessmask: u32, psid: super::Foundation::PSID) -> super::Foundation::BOOL; } ::core::mem::transmute(AddAccessDeniedAce(::core::mem::transmute(pacl), ::core::mem::transmute(dwacerevision), ::core::mem::transmute(accessmask), psid.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AddAccessDeniedAceEx<'a, Param4: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, accessmask: u32, psid: Param4) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AddAccessDeniedAceEx(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, accessmask: u32, psid: super::Foundation::PSID) -> super::Foundation::BOOL; } ::core::mem::transmute(AddAccessDeniedAceEx(::core::mem::transmute(pacl), ::core::mem::transmute(dwacerevision), ::core::mem::transmute(aceflags), ::core::mem::transmute(accessmask), psid.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AddAccessDeniedObjectAce<'a, Param6: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, accessmask: u32, objecttypeguid: *const ::windows::core::GUID, inheritedobjecttypeguid: *const ::windows::core::GUID, psid: Param6) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AddAccessDeniedObjectAce(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, accessmask: u32, objecttypeguid: *const ::windows::core::GUID, inheritedobjecttypeguid: *const ::windows::core::GUID, psid: super::Foundation::PSID) -> super::Foundation::BOOL; } ::core::mem::transmute(AddAccessDeniedObjectAce(::core::mem::transmute(pacl), ::core::mem::transmute(dwacerevision), ::core::mem::transmute(aceflags), ::core::mem::transmute(accessmask), ::core::mem::transmute(objecttypeguid), ::core::mem::transmute(inheritedobjecttypeguid), psid.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AddAce(pacl: *mut ACL, dwacerevision: u32, dwstartingaceindex: u32, pacelist: *const ::core::ffi::c_void, nacelistlength: u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AddAce(pacl: *mut ACL, dwacerevision: u32, dwstartingaceindex: u32, pacelist: *const ::core::ffi::c_void, nacelistlength: u32) -> super::Foundation::BOOL; } ::core::mem::transmute(AddAce(::core::mem::transmute(pacl), ::core::mem::transmute(dwacerevision), ::core::mem::transmute(dwstartingaceindex), ::core::mem::transmute(pacelist), ::core::mem::transmute(nacelistlength))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AddAuditAccessAce<'a, Param3: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param4: ::windows::core::IntoParam<'a, super::Foundation::BOOL>, Param5: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(pacl: *mut ACL, dwacerevision: u32, dwaccessmask: u32, psid: Param3, bauditsuccess: Param4, bauditfailure: Param5) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AddAuditAccessAce(pacl: *mut ACL, dwacerevision: u32, dwaccessmask: u32, psid: super::Foundation::PSID, bauditsuccess: super::Foundation::BOOL, bauditfailure: super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(AddAuditAccessAce(::core::mem::transmute(pacl), ::core::mem::transmute(dwacerevision), ::core::mem::transmute(dwaccessmask), psid.into_param().abi(), bauditsuccess.into_param().abi(), bauditfailure.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AddAuditAccessAceEx<'a, Param4: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param5: ::windows::core::IntoParam<'a, super::Foundation::BOOL>, Param6: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, dwaccessmask: u32, psid: Param4, bauditsuccess: Param5, bauditfailure: Param6) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AddAuditAccessAceEx(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, dwaccessmask: u32, psid: super::Foundation::PSID, bauditsuccess: super::Foundation::BOOL, bauditfailure: super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(AddAuditAccessAceEx(::core::mem::transmute(pacl), ::core::mem::transmute(dwacerevision), ::core::mem::transmute(aceflags), ::core::mem::transmute(dwaccessmask), psid.into_param().abi(), bauditsuccess.into_param().abi(), bauditfailure.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AddAuditAccessObjectAce<'a, Param6: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param7: ::windows::core::IntoParam<'a, super::Foundation::BOOL>, Param8: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, accessmask: u32, objecttypeguid: *const ::windows::core::GUID, inheritedobjecttypeguid: *const ::windows::core::GUID, psid: Param6, bauditsuccess: Param7, bauditfailure: Param8) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AddAuditAccessObjectAce(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, accessmask: u32, objecttypeguid: *const ::windows::core::GUID, inheritedobjecttypeguid: *const ::windows::core::GUID, psid: super::Foundation::PSID, bauditsuccess: super::Foundation::BOOL, bauditfailure: super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(AddAuditAccessObjectAce( ::core::mem::transmute(pacl), ::core::mem::transmute(dwacerevision), ::core::mem::transmute(aceflags), ::core::mem::transmute(accessmask), ::core::mem::transmute(objecttypeguid), ::core::mem::transmute(inheritedobjecttypeguid), psid.into_param().abi(), bauditsuccess.into_param().abi(), bauditfailure.into_param().abi(), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AddConditionalAce<'a, Param5: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param6: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>>(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, acetype: u8, accessmask: u32, psid: Param5, conditionstr: Param6, returnlength: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AddConditionalAce(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, acetype: u8, accessmask: u32, psid: super::Foundation::PSID, conditionstr: super::Foundation::PWSTR, returnlength: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(AddConditionalAce(::core::mem::transmute(pacl), ::core::mem::transmute(dwacerevision), ::core::mem::transmute(aceflags), ::core::mem::transmute(acetype), ::core::mem::transmute(accessmask), psid.into_param().abi(), conditionstr.into_param().abi(), ::core::mem::transmute(returnlength))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AddMandatoryAce<'a, Param4: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(pacl: *mut ACL, dwacerevision: ACE_REVISION, aceflags: ACE_FLAGS, mandatorypolicy: u32, plabelsid: Param4) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AddMandatoryAce(pacl: *mut ACL, dwacerevision: ACE_REVISION, aceflags: ACE_FLAGS, mandatorypolicy: u32, plabelsid: super::Foundation::PSID) -> super::Foundation::BOOL; } ::core::mem::transmute(AddMandatoryAce(::core::mem::transmute(pacl), ::core::mem::transmute(dwacerevision), ::core::mem::transmute(aceflags), ::core::mem::transmute(mandatorypolicy), plabelsid.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AddResourceAttributeAce<'a, Param4: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, accessmask: u32, psid: Param4, pattributeinfo: *const CLAIM_SECURITY_ATTRIBUTES_INFORMATION, preturnlength: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AddResourceAttributeAce(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, accessmask: u32, psid: super::Foundation::PSID, pattributeinfo: *const CLAIM_SECURITY_ATTRIBUTES_INFORMATION, preturnlength: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(AddResourceAttributeAce(::core::mem::transmute(pacl), ::core::mem::transmute(dwacerevision), ::core::mem::transmute(aceflags), ::core::mem::transmute(accessmask), psid.into_param().abi(), ::core::mem::transmute(pattributeinfo), ::core::mem::transmute(preturnlength))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AddScopedPolicyIDAce<'a, Param4: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, accessmask: u32, psid: Param4) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AddScopedPolicyIDAce(pacl: *mut ACL, dwacerevision: u32, aceflags: ACE_FLAGS, accessmask: u32, psid: super::Foundation::PSID) -> super::Foundation::BOOL; } ::core::mem::transmute(AddScopedPolicyIDAce(::core::mem::transmute(pacl), ::core::mem::transmute(dwacerevision), ::core::mem::transmute(aceflags), ::core::mem::transmute(accessmask), psid.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AdjustTokenGroups<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>, Param1: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(tokenhandle: Param0, resettodefault: Param1, newstate: *const TOKEN_GROUPS, bufferlength: u32, previousstate: *mut TOKEN_GROUPS, returnlength: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AdjustTokenGroups(tokenhandle: super::Foundation::HANDLE, resettodefault: super::Foundation::BOOL, newstate: *const TOKEN_GROUPS, bufferlength: u32, previousstate: *mut TOKEN_GROUPS, returnlength: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(AdjustTokenGroups(tokenhandle.into_param().abi(), resettodefault.into_param().abi(), ::core::mem::transmute(newstate), ::core::mem::transmute(bufferlength), ::core::mem::transmute(previousstate), ::core::mem::transmute(returnlength))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AdjustTokenPrivileges<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>, Param1: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(tokenhandle: Param0, disableallprivileges: Param1, newstate: *const TOKEN_PRIVILEGES, bufferlength: u32, previousstate: *mut TOKEN_PRIVILEGES, returnlength: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AdjustTokenPrivileges(tokenhandle: super::Foundation::HANDLE, disableallprivileges: super::Foundation::BOOL, newstate: *const TOKEN_PRIVILEGES, bufferlength: u32, previousstate: *mut TOKEN_PRIVILEGES, returnlength: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(AdjustTokenPrivileges(tokenhandle.into_param().abi(), disableallprivileges.into_param().abi(), ::core::mem::transmute(newstate), ::core::mem::transmute(bufferlength), ::core::mem::transmute(previousstate), ::core::mem::transmute(returnlength))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AllocateAndInitializeSid(pidentifierauthority: *const SID_IDENTIFIER_AUTHORITY, nsubauthoritycount: u8, nsubauthority0: u32, nsubauthority1: u32, nsubauthority2: u32, nsubauthority3: u32, nsubauthority4: u32, nsubauthority5: u32, nsubauthority6: u32, nsubauthority7: u32, psid: *mut super::Foundation::PSID) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AllocateAndInitializeSid(pidentifierauthority: *const SID_IDENTIFIER_AUTHORITY, nsubauthoritycount: u8, nsubauthority0: u32, nsubauthority1: u32, nsubauthority2: u32, nsubauthority3: u32, nsubauthority4: u32, nsubauthority5: u32, nsubauthority6: u32, nsubauthority7: u32, psid: *mut super::Foundation::PSID) -> super::Foundation::BOOL; } ::core::mem::transmute(AllocateAndInitializeSid( ::core::mem::transmute(pidentifierauthority), ::core::mem::transmute(nsubauthoritycount), ::core::mem::transmute(nsubauthority0), ::core::mem::transmute(nsubauthority1), ::core::mem::transmute(nsubauthority2), ::core::mem::transmute(nsubauthority3), ::core::mem::transmute(nsubauthority4), ::core::mem::transmute(nsubauthority5), ::core::mem::transmute(nsubauthority6), ::core::mem::transmute(nsubauthority7), ::core::mem::transmute(psid), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AllocateLocallyUniqueId(luid: *mut super::Foundation::LUID) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AllocateLocallyUniqueId(luid: *mut super::Foundation::LUID) -> super::Foundation::BOOL; } ::core::mem::transmute(AllocateLocallyUniqueId(::core::mem::transmute(luid))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AreAllAccessesGranted(grantedaccess: u32, desiredaccess: u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AreAllAccessesGranted(grantedaccess: u32, desiredaccess: u32) -> super::Foundation::BOOL; } ::core::mem::transmute(AreAllAccessesGranted(::core::mem::transmute(grantedaccess), ::core::mem::transmute(desiredaccess))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AreAnyAccessesGranted(grantedaccess: u32, desiredaccess: u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AreAnyAccessesGranted(grantedaccess: u32, desiredaccess: u32) -> super::Foundation::BOOL; } ::core::mem::transmute(AreAnyAccessesGranted(::core::mem::transmute(grantedaccess), ::core::mem::transmute(desiredaccess))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct CLAIM_SECURITY_ATTRIBUTES_INFORMATION { pub Version: u16, pub Reserved: u16, pub AttributeCount: u32, pub Attribute: CLAIM_SECURITY_ATTRIBUTES_INFORMATION_0, } #[cfg(feature = "Win32_Foundation")] impl CLAIM_SECURITY_ATTRIBUTES_INFORMATION {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for CLAIM_SECURITY_ATTRIBUTES_INFORMATION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for CLAIM_SECURITY_ATTRIBUTES_INFORMATION { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for CLAIM_SECURITY_ATTRIBUTES_INFORMATION {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for CLAIM_SECURITY_ATTRIBUTES_INFORMATION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub union CLAIM_SECURITY_ATTRIBUTES_INFORMATION_0 { pub pAttributeV1: *mut CLAIM_SECURITY_ATTRIBUTE_V1, } #[cfg(feature = "Win32_Foundation")] impl CLAIM_SECURITY_ATTRIBUTES_INFORMATION_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for CLAIM_SECURITY_ATTRIBUTES_INFORMATION_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for CLAIM_SECURITY_ATTRIBUTES_INFORMATION_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for CLAIM_SECURITY_ATTRIBUTES_INFORMATION_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for CLAIM_SECURITY_ATTRIBUTES_INFORMATION_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 CLAIM_SECURITY_ATTRIBUTE_FLAGS(pub u32); pub const CLAIM_SECURITY_ATTRIBUTE_NON_INHERITABLE: CLAIM_SECURITY_ATTRIBUTE_FLAGS = CLAIM_SECURITY_ATTRIBUTE_FLAGS(1u32); pub const CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE: CLAIM_SECURITY_ATTRIBUTE_FLAGS = CLAIM_SECURITY_ATTRIBUTE_FLAGS(2u32); pub const CLAIM_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY: CLAIM_SECURITY_ATTRIBUTE_FLAGS = CLAIM_SECURITY_ATTRIBUTE_FLAGS(4u32); pub const CLAIM_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT: CLAIM_SECURITY_ATTRIBUTE_FLAGS = CLAIM_SECURITY_ATTRIBUTE_FLAGS(8u32); pub const CLAIM_SECURITY_ATTRIBUTE_DISABLED: CLAIM_SECURITY_ATTRIBUTE_FLAGS = CLAIM_SECURITY_ATTRIBUTE_FLAGS(16u32); pub const CLAIM_SECURITY_ATTRIBUTE_MANDATORY: CLAIM_SECURITY_ATTRIBUTE_FLAGS = CLAIM_SECURITY_ATTRIBUTE_FLAGS(32u32); impl ::core::convert::From<u32> for CLAIM_SECURITY_ATTRIBUTE_FLAGS { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for CLAIM_SECURITY_ATTRIBUTE_FLAGS { type Abi = Self; } impl ::core::ops::BitOr for CLAIM_SECURITY_ATTRIBUTE_FLAGS { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for CLAIM_SECURITY_ATTRIBUTE_FLAGS { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for CLAIM_SECURITY_ATTRIBUTE_FLAGS { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for CLAIM_SECURITY_ATTRIBUTE_FLAGS { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for CLAIM_SECURITY_ATTRIBUTE_FLAGS { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE { pub Version: u64, pub Name: super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE").field("Version", &self.Version).field("Name", &self.Name).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE { fn eq(&self, other: &Self) -> bool { self.Version == other.Version && self.Name == other.Name } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE { pub pValue: *mut ::core::ffi::c_void, pub ValueLength: u32, } impl CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE {} impl ::core::default::Default for CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE").field("pValue", &self.pValue).field("ValueLength", &self.ValueLength).finish() } } impl ::core::cmp::PartialEq for CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE { fn eq(&self, other: &Self) -> bool { self.pValue == other.pValue && self.ValueLength == other.ValueLength } } impl ::core::cmp::Eq for CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE {} unsafe impl ::windows::core::Abi for CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 { pub Name: u32, pub ValueType: CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE, pub Reserved: u16, pub Flags: CLAIM_SECURITY_ATTRIBUTE_FLAGS, pub ValueCount: u32, pub Values: CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1_0, } impl CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 {} impl ::core::default::Default for CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 {} unsafe impl ::windows::core::Abi for CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub union CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1_0 { pub pInt64: [u32; 1], pub pUint64: [u32; 1], pub ppString: [u32; 1], pub pFqbn: [u32; 1], pub pOctetString: [u32; 1], } impl CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1_0 {} impl ::core::default::Default for CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1_0 {} unsafe impl ::windows::core::Abi for CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct CLAIM_SECURITY_ATTRIBUTE_V1 { pub Name: super::Foundation::PWSTR, pub ValueType: CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE, pub Reserved: u16, pub Flags: u32, pub ValueCount: u32, pub Values: CLAIM_SECURITY_ATTRIBUTE_V1_0, } #[cfg(feature = "Win32_Foundation")] impl CLAIM_SECURITY_ATTRIBUTE_V1 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for CLAIM_SECURITY_ATTRIBUTE_V1 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for CLAIM_SECURITY_ATTRIBUTE_V1 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for CLAIM_SECURITY_ATTRIBUTE_V1 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for CLAIM_SECURITY_ATTRIBUTE_V1 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub union CLAIM_SECURITY_ATTRIBUTE_V1_0 { pub pInt64: *mut i64, pub pUint64: *mut u64, pub ppString: *mut super::Foundation::PWSTR, pub pFqbn: *mut CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE, pub pOctetString: *mut CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE, } #[cfg(feature = "Win32_Foundation")] impl CLAIM_SECURITY_ATTRIBUTE_V1_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for CLAIM_SECURITY_ATTRIBUTE_V1_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for CLAIM_SECURITY_ATTRIBUTE_V1_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for CLAIM_SECURITY_ATTRIBUTE_V1_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for CLAIM_SECURITY_ATTRIBUTE_V1_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 CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE(pub u16); pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_INT64: CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE = CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE(1u16); pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_UINT64: CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE = CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE(2u16); pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_STRING: CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE = CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE(3u16); pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_OCTET_STRING: CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE = CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE(16u16); pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_FQBN: CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE = CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE(4u16); pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_SID: CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE = CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE(5u16); pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_BOOLEAN: CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE = CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE(6u16); impl ::core::convert::From<u16> for CLAIM_SECURITY_ATTRIBUTE_VALUE_TYPE { fn from(value: u16) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for CLAIM_SECURITY_ATTRIBUTE_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 CREATE_RESTRICTED_TOKEN_FLAGS(pub u32); pub const DISABLE_MAX_PRIVILEGE: CREATE_RESTRICTED_TOKEN_FLAGS = CREATE_RESTRICTED_TOKEN_FLAGS(1u32); pub const SANDBOX_INERT: CREATE_RESTRICTED_TOKEN_FLAGS = CREATE_RESTRICTED_TOKEN_FLAGS(2u32); pub const LUA_TOKEN: CREATE_RESTRICTED_TOKEN_FLAGS = CREATE_RESTRICTED_TOKEN_FLAGS(4u32); pub const WRITE_RESTRICTED: CREATE_RESTRICTED_TOKEN_FLAGS = CREATE_RESTRICTED_TOKEN_FLAGS(8u32); impl ::core::convert::From<u32> for CREATE_RESTRICTED_TOKEN_FLAGS { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for CREATE_RESTRICTED_TOKEN_FLAGS { type Abi = Self; } impl ::core::ops::BitOr for CREATE_RESTRICTED_TOKEN_FLAGS { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for CREATE_RESTRICTED_TOKEN_FLAGS { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for CREATE_RESTRICTED_TOKEN_FLAGS { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for CREATE_RESTRICTED_TOKEN_FLAGS { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for CREATE_RESTRICTED_TOKEN_FLAGS { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } pub const CVT_SECONDS: u32 = 1u32; #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CheckTokenCapability<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(tokenhandle: Param0, capabilitysidtocheck: Param1, hascapability: *mut super::Foundation::BOOL) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CheckTokenCapability(tokenhandle: super::Foundation::HANDLE, capabilitysidtocheck: super::Foundation::PSID, hascapability: *mut super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(CheckTokenCapability(tokenhandle.into_param().abi(), capabilitysidtocheck.into_param().abi(), ::core::mem::transmute(hascapability))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CheckTokenMembership<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(tokenhandle: Param0, sidtocheck: Param1, ismember: *mut super::Foundation::BOOL) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CheckTokenMembership(tokenhandle: super::Foundation::HANDLE, sidtocheck: super::Foundation::PSID, ismember: *mut super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(CheckTokenMembership(tokenhandle.into_param().abi(), sidtocheck.into_param().abi(), ::core::mem::transmute(ismember))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CheckTokenMembershipEx<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(tokenhandle: Param0, sidtocheck: Param1, flags: u32, ismember: *mut super::Foundation::BOOL) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CheckTokenMembershipEx(tokenhandle: super::Foundation::HANDLE, sidtocheck: super::Foundation::PSID, flags: u32, ismember: *mut super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(CheckTokenMembershipEx(tokenhandle.into_param().abi(), sidtocheck.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(ismember))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn ConvertToAutoInheritPrivateObjectSecurity<'a, Param4: ::windows::core::IntoParam<'a, super::Foundation::BOOLEAN>>(parentdescriptor: *const SECURITY_DESCRIPTOR, currentsecuritydescriptor: *const SECURITY_DESCRIPTOR, newsecuritydescriptor: *mut *mut SECURITY_DESCRIPTOR, objecttype: *const ::windows::core::GUID, isdirectoryobject: Param4, genericmapping: *const GENERIC_MAPPING) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn ConvertToAutoInheritPrivateObjectSecurity(parentdescriptor: *const SECURITY_DESCRIPTOR, currentsecuritydescriptor: *const SECURITY_DESCRIPTOR, newsecuritydescriptor: *mut *mut SECURITY_DESCRIPTOR, objecttype: *const ::windows::core::GUID, isdirectoryobject: super::Foundation::BOOLEAN, genericmapping: *const GENERIC_MAPPING) -> super::Foundation::BOOL; } ::core::mem::transmute(ConvertToAutoInheritPrivateObjectSecurity(::core::mem::transmute(parentdescriptor), ::core::mem::transmute(currentsecuritydescriptor), ::core::mem::transmute(newsecuritydescriptor), ::core::mem::transmute(objecttype), isdirectoryobject.into_param().abi(), ::core::mem::transmute(genericmapping))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CopySid<'a, Param2: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(ndestinationsidlength: u32, pdestinationsid: super::Foundation::PSID, psourcesid: Param2) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CopySid(ndestinationsidlength: u32, pdestinationsid: super::Foundation::PSID, psourcesid: super::Foundation::PSID) -> super::Foundation::BOOL; } ::core::mem::transmute(CopySid(::core::mem::transmute(ndestinationsidlength), ::core::mem::transmute(pdestinationsid), psourcesid.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CreatePrivateObjectSecurity<'a, Param3: ::windows::core::IntoParam<'a, super::Foundation::BOOL>, Param4: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(parentdescriptor: *const SECURITY_DESCRIPTOR, creatordescriptor: *const SECURITY_DESCRIPTOR, newdescriptor: *mut *mut SECURITY_DESCRIPTOR, isdirectoryobject: Param3, token: Param4, genericmapping: *const GENERIC_MAPPING) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CreatePrivateObjectSecurity(parentdescriptor: *const SECURITY_DESCRIPTOR, creatordescriptor: *const SECURITY_DESCRIPTOR, newdescriptor: *mut *mut SECURITY_DESCRIPTOR, isdirectoryobject: super::Foundation::BOOL, token: super::Foundation::HANDLE, genericmapping: *const GENERIC_MAPPING) -> super::Foundation::BOOL; } ::core::mem::transmute(CreatePrivateObjectSecurity(::core::mem::transmute(parentdescriptor), ::core::mem::transmute(creatordescriptor), ::core::mem::transmute(newdescriptor), isdirectoryobject.into_param().abi(), token.into_param().abi(), ::core::mem::transmute(genericmapping))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CreatePrivateObjectSecurityEx<'a, Param4: ::windows::core::IntoParam<'a, super::Foundation::BOOL>, Param6: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>( parentdescriptor: *const SECURITY_DESCRIPTOR, creatordescriptor: *const SECURITY_DESCRIPTOR, newdescriptor: *mut *mut SECURITY_DESCRIPTOR, objecttype: *const ::windows::core::GUID, iscontainerobject: Param4, autoinheritflags: SECURITY_AUTO_INHERIT_FLAGS, token: Param6, genericmapping: *const GENERIC_MAPPING, ) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CreatePrivateObjectSecurityEx(parentdescriptor: *const SECURITY_DESCRIPTOR, creatordescriptor: *const SECURITY_DESCRIPTOR, newdescriptor: *mut *mut SECURITY_DESCRIPTOR, objecttype: *const ::windows::core::GUID, iscontainerobject: super::Foundation::BOOL, autoinheritflags: SECURITY_AUTO_INHERIT_FLAGS, token: super::Foundation::HANDLE, genericmapping: *const GENERIC_MAPPING) -> super::Foundation::BOOL; } ::core::mem::transmute(CreatePrivateObjectSecurityEx( ::core::mem::transmute(parentdescriptor), ::core::mem::transmute(creatordescriptor), ::core::mem::transmute(newdescriptor), ::core::mem::transmute(objecttype), iscontainerobject.into_param().abi(), ::core::mem::transmute(autoinheritflags), token.into_param().abi(), ::core::mem::transmute(genericmapping), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CreatePrivateObjectSecurityWithMultipleInheritance<'a, Param5: ::windows::core::IntoParam<'a, super::Foundation::BOOL>, Param7: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>( parentdescriptor: *const SECURITY_DESCRIPTOR, creatordescriptor: *const SECURITY_DESCRIPTOR, newdescriptor: *mut *mut SECURITY_DESCRIPTOR, objecttypes: *const *const ::windows::core::GUID, guidcount: u32, iscontainerobject: Param5, autoinheritflags: SECURITY_AUTO_INHERIT_FLAGS, token: Param7, genericmapping: *const GENERIC_MAPPING, ) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CreatePrivateObjectSecurityWithMultipleInheritance(parentdescriptor: *const SECURITY_DESCRIPTOR, creatordescriptor: *const SECURITY_DESCRIPTOR, newdescriptor: *mut *mut SECURITY_DESCRIPTOR, objecttypes: *const *const ::windows::core::GUID, guidcount: u32, iscontainerobject: super::Foundation::BOOL, autoinheritflags: SECURITY_AUTO_INHERIT_FLAGS, token: super::Foundation::HANDLE, genericmapping: *const GENERIC_MAPPING) -> super::Foundation::BOOL; } ::core::mem::transmute(CreatePrivateObjectSecurityWithMultipleInheritance( ::core::mem::transmute(parentdescriptor), ::core::mem::transmute(creatordescriptor), ::core::mem::transmute(newdescriptor), ::core::mem::transmute(objecttypes), ::core::mem::transmute(guidcount), iscontainerobject.into_param().abi(), ::core::mem::transmute(autoinheritflags), token.into_param().abi(), ::core::mem::transmute(genericmapping), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CreateRestrictedToken<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(existingtokenhandle: Param0, flags: CREATE_RESTRICTED_TOKEN_FLAGS, disablesidcount: u32, sidstodisable: *const SID_AND_ATTRIBUTES, deleteprivilegecount: u32, privilegestodelete: *const LUID_AND_ATTRIBUTES, restrictedsidcount: u32, sidstorestrict: *const SID_AND_ATTRIBUTES, newtokenhandle: *mut super::Foundation::HANDLE) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CreateRestrictedToken(existingtokenhandle: super::Foundation::HANDLE, flags: CREATE_RESTRICTED_TOKEN_FLAGS, disablesidcount: u32, sidstodisable: *const SID_AND_ATTRIBUTES, deleteprivilegecount: u32, privilegestodelete: *const LUID_AND_ATTRIBUTES, restrictedsidcount: u32, sidstorestrict: *const SID_AND_ATTRIBUTES, newtokenhandle: *mut super::Foundation::HANDLE) -> super::Foundation::BOOL; } ::core::mem::transmute(CreateRestrictedToken( existingtokenhandle.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(disablesidcount), ::core::mem::transmute(sidstodisable), ::core::mem::transmute(deleteprivilegecount), ::core::mem::transmute(privilegestodelete), ::core::mem::transmute(restrictedsidcount), ::core::mem::transmute(sidstorestrict), ::core::mem::transmute(newtokenhandle), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CreateWellKnownSid<'a, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(wellknownsidtype: WELL_KNOWN_SID_TYPE, domainsid: Param1, psid: super::Foundation::PSID, cbsid: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CreateWellKnownSid(wellknownsidtype: WELL_KNOWN_SID_TYPE, domainsid: super::Foundation::PSID, psid: super::Foundation::PSID, cbsid: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(CreateWellKnownSid(::core::mem::transmute(wellknownsidtype), domainsid.into_param().abi(), ::core::mem::transmute(psid), ::core::mem::transmute(cbsid))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DeleteAce(pacl: *mut ACL, dwaceindex: u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DeleteAce(pacl: *mut ACL, dwaceindex: u32) -> super::Foundation::BOOL; } ::core::mem::transmute(DeleteAce(::core::mem::transmute(pacl), ::core::mem::transmute(dwaceindex))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DeriveCapabilitySidsFromName<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>>(capname: Param0, capabilitygroupsids: *mut *mut super::Foundation::PSID, capabilitygroupsidcount: *mut u32, capabilitysids: *mut *mut super::Foundation::PSID, capabilitysidcount: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DeriveCapabilitySidsFromName(capname: super::Foundation::PWSTR, capabilitygroupsids: *mut *mut super::Foundation::PSID, capabilitygroupsidcount: *mut u32, capabilitysids: *mut *mut super::Foundation::PSID, capabilitysidcount: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(DeriveCapabilitySidsFromName(capname.into_param().abi(), ::core::mem::transmute(capabilitygroupsids), ::core::mem::transmute(capabilitygroupsidcount), ::core::mem::transmute(capabilitysids), ::core::mem::transmute(capabilitysidcount))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DestroyPrivateObjectSecurity(objectdescriptor: *const *const SECURITY_DESCRIPTOR) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DestroyPrivateObjectSecurity(objectdescriptor: *const *const SECURITY_DESCRIPTOR) -> super::Foundation::BOOL; } ::core::mem::transmute(DestroyPrivateObjectSecurity(::core::mem::transmute(objectdescriptor))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DuplicateToken<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(existingtokenhandle: Param0, impersonationlevel: SECURITY_IMPERSONATION_LEVEL, duplicatetokenhandle: *mut super::Foundation::HANDLE) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DuplicateToken(existingtokenhandle: super::Foundation::HANDLE, impersonationlevel: SECURITY_IMPERSONATION_LEVEL, duplicatetokenhandle: *mut super::Foundation::HANDLE) -> super::Foundation::BOOL; } ::core::mem::transmute(DuplicateToken(existingtokenhandle.into_param().abi(), ::core::mem::transmute(impersonationlevel), ::core::mem::transmute(duplicatetokenhandle))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DuplicateTokenEx<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(hexistingtoken: Param0, dwdesiredaccess: TOKEN_ACCESS_MASK, lptokenattributes: *const SECURITY_ATTRIBUTES, impersonationlevel: SECURITY_IMPERSONATION_LEVEL, tokentype: TOKEN_TYPE, phnewtoken: *mut super::Foundation::HANDLE) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DuplicateTokenEx(hexistingtoken: super::Foundation::HANDLE, dwdesiredaccess: TOKEN_ACCESS_MASK, lptokenattributes: *const SECURITY_ATTRIBUTES, impersonationlevel: SECURITY_IMPERSONATION_LEVEL, tokentype: TOKEN_TYPE, phnewtoken: *mut super::Foundation::HANDLE) -> super::Foundation::BOOL; } ::core::mem::transmute(DuplicateTokenEx(hexistingtoken.into_param().abi(), ::core::mem::transmute(dwdesiredaccess), ::core::mem::transmute(lptokenattributes), ::core::mem::transmute(impersonationlevel), ::core::mem::transmute(tokentype), ::core::mem::transmute(phnewtoken))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct ENUM_PERIOD(pub i32); pub const ENUM_PERIOD_INVALID: ENUM_PERIOD = ENUM_PERIOD(-1i32); pub const ENUM_PERIOD_SECONDS: ENUM_PERIOD = ENUM_PERIOD(0i32); pub const ENUM_PERIOD_MINUTES: ENUM_PERIOD = ENUM_PERIOD(1i32); pub const ENUM_PERIOD_HOURS: ENUM_PERIOD = ENUM_PERIOD(2i32); pub const ENUM_PERIOD_DAYS: ENUM_PERIOD = ENUM_PERIOD(3i32); pub const ENUM_PERIOD_WEEKS: ENUM_PERIOD = ENUM_PERIOD(4i32); pub const ENUM_PERIOD_MONTHS: ENUM_PERIOD = ENUM_PERIOD(5i32); pub const ENUM_PERIOD_YEARS: ENUM_PERIOD = ENUM_PERIOD(6i32); impl ::core::convert::From<i32> for ENUM_PERIOD { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for ENUM_PERIOD { type Abi = Self; } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn EqualDomainSid<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(psid1: Param0, psid2: Param1, pfequal: *mut super::Foundation::BOOL) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn EqualDomainSid(psid1: super::Foundation::PSID, psid2: super::Foundation::PSID, pfequal: *mut super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(EqualDomainSid(psid1.into_param().abi(), psid2.into_param().abi(), ::core::mem::transmute(pfequal))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn EqualPrefixSid<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(psid1: Param0, psid2: Param1) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn EqualPrefixSid(psid1: super::Foundation::PSID, psid2: super::Foundation::PSID) -> super::Foundation::BOOL; } ::core::mem::transmute(EqualPrefixSid(psid1.into_param().abi(), psid2.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn EqualSid<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(psid1: Param0, psid2: Param1) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn EqualSid(psid1: super::Foundation::PSID, psid2: super::Foundation::PSID) -> super::Foundation::BOOL; } ::core::mem::transmute(EqualSid(psid1.into_param().abi(), psid2.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn FindFirstFreeAce(pacl: *const ACL, pace: *mut *mut ::core::ffi::c_void) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn FindFirstFreeAce(pacl: *const ACL, pace: *mut *mut ::core::ffi::c_void) -> super::Foundation::BOOL; } ::core::mem::transmute(FindFirstFreeAce(::core::mem::transmute(pacl), ::core::mem::transmute(pace))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn FreeSid<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(psid: Param0) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn FreeSid(psid: super::Foundation::PSID) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(FreeSid(psid.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct GENERIC_MAPPING { pub GenericRead: u32, pub GenericWrite: u32, pub GenericExecute: u32, pub GenericAll: u32, } impl GENERIC_MAPPING {} impl ::core::default::Default for GENERIC_MAPPING { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for GENERIC_MAPPING { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("GENERIC_MAPPING").field("GenericRead", &self.GenericRead).field("GenericWrite", &self.GenericWrite).field("GenericExecute", &self.GenericExecute).field("GenericAll", &self.GenericAll).finish() } } impl ::core::cmp::PartialEq for GENERIC_MAPPING { fn eq(&self, other: &Self) -> bool { self.GenericRead == other.GenericRead && self.GenericWrite == other.GenericWrite && self.GenericExecute == other.GenericExecute && self.GenericAll == other.GenericAll } } impl ::core::cmp::Eq for GENERIC_MAPPING {} unsafe impl ::windows::core::Abi for GENERIC_MAPPING { type Abi = Self; } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetAce(pacl: *const ACL, dwaceindex: u32, pace: *mut *mut ::core::ffi::c_void) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetAce(pacl: *const ACL, dwaceindex: u32, pace: *mut *mut ::core::ffi::c_void) -> super::Foundation::BOOL; } ::core::mem::transmute(GetAce(::core::mem::transmute(pacl), ::core::mem::transmute(dwaceindex), ::core::mem::transmute(pace))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetAclInformation(pacl: *const ACL, paclinformation: *mut ::core::ffi::c_void, naclinformationlength: u32, dwaclinformationclass: ACL_INFORMATION_CLASS) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetAclInformation(pacl: *const ACL, paclinformation: *mut ::core::ffi::c_void, naclinformationlength: u32, dwaclinformationclass: ACL_INFORMATION_CLASS) -> super::Foundation::BOOL; } ::core::mem::transmute(GetAclInformation(::core::mem::transmute(pacl), ::core::mem::transmute(paclinformation), ::core::mem::transmute(naclinformationlength), ::core::mem::transmute(dwaclinformationclass))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetAppContainerAce(acl: *const ACL, startingaceindex: u32, appcontainerace: *mut *mut ::core::ffi::c_void, appcontaineraceindex: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetAppContainerAce(acl: *const ACL, startingaceindex: u32, appcontainerace: *mut *mut ::core::ffi::c_void, appcontaineraceindex: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(GetAppContainerAce(::core::mem::transmute(acl), ::core::mem::transmute(startingaceindex), ::core::mem::transmute(appcontainerace), ::core::mem::transmute(appcontaineraceindex))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetCachedSigningLevel<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(file: Param0, flags: *mut u32, signinglevel: *mut u32, thumbprint: *mut u8, thumbprintsize: *mut u32, thumbprintalgorithm: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetCachedSigningLevel(file: super::Foundation::HANDLE, flags: *mut u32, signinglevel: *mut u32, thumbprint: *mut u8, thumbprintsize: *mut u32, thumbprintalgorithm: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(GetCachedSigningLevel(file.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(signinglevel), ::core::mem::transmute(thumbprint), ::core::mem::transmute(thumbprintsize), ::core::mem::transmute(thumbprintalgorithm))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetFileSecurityA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>>(lpfilename: Param0, requestedinformation: u32, psecuritydescriptor: *mut SECURITY_DESCRIPTOR, nlength: u32, lpnlengthneeded: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetFileSecurityA(lpfilename: super::Foundation::PSTR, requestedinformation: u32, psecuritydescriptor: *mut SECURITY_DESCRIPTOR, nlength: u32, lpnlengthneeded: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(GetFileSecurityA(lpfilename.into_param().abi(), ::core::mem::transmute(requestedinformation), ::core::mem::transmute(psecuritydescriptor), ::core::mem::transmute(nlength), ::core::mem::transmute(lpnlengthneeded))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetFileSecurityW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>>(lpfilename: Param0, requestedinformation: u32, psecuritydescriptor: *mut SECURITY_DESCRIPTOR, nlength: u32, lpnlengthneeded: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetFileSecurityW(lpfilename: super::Foundation::PWSTR, requestedinformation: u32, psecuritydescriptor: *mut SECURITY_DESCRIPTOR, nlength: u32, lpnlengthneeded: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(GetFileSecurityW(lpfilename.into_param().abi(), ::core::mem::transmute(requestedinformation), ::core::mem::transmute(psecuritydescriptor), ::core::mem::transmute(nlength), ::core::mem::transmute(lpnlengthneeded))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetKernelObjectSecurity<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(handle: Param0, requestedinformation: u32, psecuritydescriptor: *mut SECURITY_DESCRIPTOR, nlength: u32, lpnlengthneeded: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetKernelObjectSecurity(handle: super::Foundation::HANDLE, requestedinformation: u32, psecuritydescriptor: *mut SECURITY_DESCRIPTOR, nlength: u32, lpnlengthneeded: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(GetKernelObjectSecurity(handle.into_param().abi(), ::core::mem::transmute(requestedinformation), ::core::mem::transmute(psecuritydescriptor), ::core::mem::transmute(nlength), ::core::mem::transmute(lpnlengthneeded))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetLengthSid<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(psid: Param0) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetLengthSid(psid: super::Foundation::PSID) -> u32; } ::core::mem::transmute(GetLengthSid(psid.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetPrivateObjectSecurity(objectdescriptor: *const SECURITY_DESCRIPTOR, securityinformation: u32, resultantdescriptor: *mut SECURITY_DESCRIPTOR, descriptorlength: u32, returnlength: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetPrivateObjectSecurity(objectdescriptor: *const SECURITY_DESCRIPTOR, securityinformation: u32, resultantdescriptor: *mut SECURITY_DESCRIPTOR, descriptorlength: u32, returnlength: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(GetPrivateObjectSecurity(::core::mem::transmute(objectdescriptor), ::core::mem::transmute(securityinformation), ::core::mem::transmute(resultantdescriptor), ::core::mem::transmute(descriptorlength), ::core::mem::transmute(returnlength))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetSecurityDescriptorControl(psecuritydescriptor: *const SECURITY_DESCRIPTOR, pcontrol: *mut u16, lpdwrevision: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetSecurityDescriptorControl(psecuritydescriptor: *const SECURITY_DESCRIPTOR, pcontrol: *mut u16, lpdwrevision: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(GetSecurityDescriptorControl(::core::mem::transmute(psecuritydescriptor), ::core::mem::transmute(pcontrol), ::core::mem::transmute(lpdwrevision))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetSecurityDescriptorDacl(psecuritydescriptor: *const SECURITY_DESCRIPTOR, lpbdaclpresent: *mut i32, pdacl: *mut *mut ACL, lpbdacldefaulted: *mut i32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetSecurityDescriptorDacl(psecuritydescriptor: *const SECURITY_DESCRIPTOR, lpbdaclpresent: *mut i32, pdacl: *mut *mut ACL, lpbdacldefaulted: *mut i32) -> super::Foundation::BOOL; } ::core::mem::transmute(GetSecurityDescriptorDacl(::core::mem::transmute(psecuritydescriptor), ::core::mem::transmute(lpbdaclpresent), ::core::mem::transmute(pdacl), ::core::mem::transmute(lpbdacldefaulted))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetSecurityDescriptorGroup(psecuritydescriptor: *const SECURITY_DESCRIPTOR, pgroup: *mut super::Foundation::PSID, lpbgroupdefaulted: *mut i32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetSecurityDescriptorGroup(psecuritydescriptor: *const SECURITY_DESCRIPTOR, pgroup: *mut super::Foundation::PSID, lpbgroupdefaulted: *mut i32) -> super::Foundation::BOOL; } ::core::mem::transmute(GetSecurityDescriptorGroup(::core::mem::transmute(psecuritydescriptor), ::core::mem::transmute(pgroup), ::core::mem::transmute(lpbgroupdefaulted))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetSecurityDescriptorLength(psecuritydescriptor: *const SECURITY_DESCRIPTOR) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetSecurityDescriptorLength(psecuritydescriptor: *const SECURITY_DESCRIPTOR) -> u32; } ::core::mem::transmute(GetSecurityDescriptorLength(::core::mem::transmute(psecuritydescriptor))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetSecurityDescriptorOwner(psecuritydescriptor: *const SECURITY_DESCRIPTOR, powner: *mut super::Foundation::PSID, lpbownerdefaulted: *mut i32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetSecurityDescriptorOwner(psecuritydescriptor: *const SECURITY_DESCRIPTOR, powner: *mut super::Foundation::PSID, lpbownerdefaulted: *mut i32) -> super::Foundation::BOOL; } ::core::mem::transmute(GetSecurityDescriptorOwner(::core::mem::transmute(psecuritydescriptor), ::core::mem::transmute(powner), ::core::mem::transmute(lpbownerdefaulted))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetSecurityDescriptorRMControl(securitydescriptor: *const SECURITY_DESCRIPTOR, rmcontrol: *mut u8) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetSecurityDescriptorRMControl(securitydescriptor: *const SECURITY_DESCRIPTOR, rmcontrol: *mut u8) -> u32; } ::core::mem::transmute(GetSecurityDescriptorRMControl(::core::mem::transmute(securitydescriptor), ::core::mem::transmute(rmcontrol))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetSecurityDescriptorSacl(psecuritydescriptor: *const SECURITY_DESCRIPTOR, lpbsaclpresent: *mut i32, psacl: *mut *mut ACL, lpbsacldefaulted: *mut i32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetSecurityDescriptorSacl(psecuritydescriptor: *const SECURITY_DESCRIPTOR, lpbsaclpresent: *mut i32, psacl: *mut *mut ACL, lpbsacldefaulted: *mut i32) -> super::Foundation::BOOL; } ::core::mem::transmute(GetSecurityDescriptorSacl(::core::mem::transmute(psecuritydescriptor), ::core::mem::transmute(lpbsaclpresent), ::core::mem::transmute(psacl), ::core::mem::transmute(lpbsacldefaulted))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetSidIdentifierAuthority<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(psid: Param0) -> *mut SID_IDENTIFIER_AUTHORITY { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetSidIdentifierAuthority(psid: super::Foundation::PSID) -> *mut SID_IDENTIFIER_AUTHORITY; } ::core::mem::transmute(GetSidIdentifierAuthority(psid.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn GetSidLengthRequired(nsubauthoritycount: u8) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetSidLengthRequired(nsubauthoritycount: u8) -> u32; } ::core::mem::transmute(GetSidLengthRequired(::core::mem::transmute(nsubauthoritycount))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetSidSubAuthority<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(psid: Param0, nsubauthority: u32) -> *mut u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetSidSubAuthority(psid: super::Foundation::PSID, nsubauthority: u32) -> *mut u32; } ::core::mem::transmute(GetSidSubAuthority(psid.into_param().abi(), ::core::mem::transmute(nsubauthority))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetSidSubAuthorityCount<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(psid: Param0) -> *mut u8 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetSidSubAuthorityCount(psid: super::Foundation::PSID) -> *mut u8; } ::core::mem::transmute(GetSidSubAuthorityCount(psid.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetTokenInformation<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(tokenhandle: Param0, tokeninformationclass: TOKEN_INFORMATION_CLASS, tokeninformation: *mut ::core::ffi::c_void, tokeninformationlength: u32, returnlength: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetTokenInformation(tokenhandle: super::Foundation::HANDLE, tokeninformationclass: TOKEN_INFORMATION_CLASS, tokeninformation: *mut ::core::ffi::c_void, tokeninformationlength: u32, returnlength: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(GetTokenInformation(tokenhandle.into_param().abi(), ::core::mem::transmute(tokeninformationclass), ::core::mem::transmute(tokeninformation), ::core::mem::transmute(tokeninformationlength), ::core::mem::transmute(returnlength))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetUserObjectSecurity<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(hobj: Param0, psirequested: *const u32, psid: *mut SECURITY_DESCRIPTOR, nlength: u32, lpnlengthneeded: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetUserObjectSecurity(hobj: super::Foundation::HANDLE, psirequested: *const u32, psid: *mut SECURITY_DESCRIPTOR, nlength: u32, lpnlengthneeded: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(GetUserObjectSecurity(hobj.into_param().abi(), ::core::mem::transmute(psirequested), ::core::mem::transmute(psid), ::core::mem::transmute(nlength), ::core::mem::transmute(lpnlengthneeded))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn GetWindowsAccountDomainSid<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(psid: Param0, pdomainsid: super::Foundation::PSID, cbdomainsid: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn GetWindowsAccountDomainSid(psid: super::Foundation::PSID, pdomainsid: super::Foundation::PSID, cbdomainsid: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(GetWindowsAccountDomainSid(psid.into_param().abi(), ::core::mem::transmute(pdomainsid), ::core::mem::transmute(cbdomainsid))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)] #[repr(transparent)] pub struct HDIAGNOSTIC_DATA_QUERY_SESSION(pub isize); impl ::core::default::Default for HDIAGNOSTIC_DATA_QUERY_SESSION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } unsafe impl ::windows::core::Handle for HDIAGNOSTIC_DATA_QUERY_SESSION {} unsafe impl ::windows::core::Abi for HDIAGNOSTIC_DATA_QUERY_SESSION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)] #[repr(transparent)] pub struct HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION(pub isize); impl ::core::default::Default for HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } unsafe impl ::windows::core::Handle for HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION {} unsafe impl ::windows::core::Abi for HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)] #[repr(transparent)] pub struct HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION(pub isize); impl ::core::default::Default for HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } unsafe impl ::windows::core::Handle for HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION {} unsafe impl ::windows::core::Abi for HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)] #[repr(transparent)] pub struct HDIAGNOSTIC_EVENT_TAG_DESCRIPTION(pub isize); impl ::core::default::Default for HDIAGNOSTIC_EVENT_TAG_DESCRIPTION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } unsafe impl ::windows::core::Handle for HDIAGNOSTIC_EVENT_TAG_DESCRIPTION {} unsafe impl ::windows::core::Abi for HDIAGNOSTIC_EVENT_TAG_DESCRIPTION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)] #[repr(transparent)] pub struct HDIAGNOSTIC_RECORD(pub isize); impl ::core::default::Default for HDIAGNOSTIC_RECORD { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } unsafe impl ::windows::core::Handle for HDIAGNOSTIC_RECORD {} unsafe impl ::windows::core::Abi for HDIAGNOSTIC_RECORD { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)] #[repr(transparent)] pub struct HDIAGNOSTIC_REPORT(pub isize); impl ::core::default::Default for HDIAGNOSTIC_REPORT { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } unsafe impl ::windows::core::Handle for HDIAGNOSTIC_REPORT {} unsafe impl ::windows::core::Abi for HDIAGNOSTIC_REPORT { type Abi = Self; } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn ImpersonateAnonymousToken<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(threadhandle: Param0) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn ImpersonateAnonymousToken(threadhandle: super::Foundation::HANDLE) -> super::Foundation::BOOL; } ::core::mem::transmute(ImpersonateAnonymousToken(threadhandle.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn ImpersonateLoggedOnUser<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(htoken: Param0) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn ImpersonateLoggedOnUser(htoken: super::Foundation::HANDLE) -> super::Foundation::BOOL; } ::core::mem::transmute(ImpersonateLoggedOnUser(htoken.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn ImpersonateSelf(impersonationlevel: SECURITY_IMPERSONATION_LEVEL) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn ImpersonateSelf(impersonationlevel: SECURITY_IMPERSONATION_LEVEL) -> super::Foundation::BOOL; } ::core::mem::transmute(ImpersonateSelf(::core::mem::transmute(impersonationlevel))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn InitializeAcl(pacl: *mut ACL, nacllength: u32, dwaclrevision: u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn InitializeAcl(pacl: *mut ACL, nacllength: u32, dwaclrevision: u32) -> super::Foundation::BOOL; } ::core::mem::transmute(InitializeAcl(::core::mem::transmute(pacl), ::core::mem::transmute(nacllength), ::core::mem::transmute(dwaclrevision))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn InitializeSecurityDescriptor(psecuritydescriptor: *mut SECURITY_DESCRIPTOR, dwrevision: u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn InitializeSecurityDescriptor(psecuritydescriptor: *mut SECURITY_DESCRIPTOR, dwrevision: u32) -> super::Foundation::BOOL; } ::core::mem::transmute(InitializeSecurityDescriptor(::core::mem::transmute(psecuritydescriptor), ::core::mem::transmute(dwrevision))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn InitializeSid(sid: super::Foundation::PSID, pidentifierauthority: *const SID_IDENTIFIER_AUTHORITY, nsubauthoritycount: u8) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn InitializeSid(sid: super::Foundation::PSID, pidentifierauthority: *const SID_IDENTIFIER_AUTHORITY, nsubauthoritycount: u8) -> super::Foundation::BOOL; } ::core::mem::transmute(InitializeSid(::core::mem::transmute(sid), ::core::mem::transmute(pidentifierauthority), ::core::mem::transmute(nsubauthoritycount))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn IsTokenRestricted<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(tokenhandle: Param0) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn IsTokenRestricted(tokenhandle: super::Foundation::HANDLE) -> super::Foundation::BOOL; } ::core::mem::transmute(IsTokenRestricted(tokenhandle.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn IsValidAcl(pacl: *const ACL) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn IsValidAcl(pacl: *const ACL) -> super::Foundation::BOOL; } ::core::mem::transmute(IsValidAcl(::core::mem::transmute(pacl))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn IsValidSecurityDescriptor(psecuritydescriptor: *const SECURITY_DESCRIPTOR) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn IsValidSecurityDescriptor(psecuritydescriptor: *const SECURITY_DESCRIPTOR) -> super::Foundation::BOOL; } ::core::mem::transmute(IsValidSecurityDescriptor(::core::mem::transmute(psecuritydescriptor))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn IsValidSid<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(psid: Param0) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn IsValidSid(psid: super::Foundation::PSID) -> super::Foundation::BOOL; } ::core::mem::transmute(IsValidSid(psid.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn IsWellKnownSid<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(psid: Param0, wellknownsidtype: WELL_KNOWN_SID_TYPE) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn IsWellKnownSid(psid: super::Foundation::PSID, wellknownsidtype: WELL_KNOWN_SID_TYPE) -> super::Foundation::BOOL; } ::core::mem::transmute(IsWellKnownSid(psid.into_param().abi(), ::core::mem::transmute(wellknownsidtype))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct LLFILETIME { pub Anonymous: LLFILETIME_0, } #[cfg(feature = "Win32_Foundation")] impl LLFILETIME {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for LLFILETIME { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for LLFILETIME { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for LLFILETIME {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for LLFILETIME { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub union LLFILETIME_0 { pub ll: i64, pub ft: super::Foundation::FILETIME, } #[cfg(feature = "Win32_Foundation")] impl LLFILETIME_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for LLFILETIME_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for LLFILETIME_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for LLFILETIME_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for LLFILETIME_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 LOGON32_LOGON(pub u32); pub const LOGON32_LOGON_BATCH: LOGON32_LOGON = LOGON32_LOGON(4u32); pub const LOGON32_LOGON_INTERACTIVE: LOGON32_LOGON = LOGON32_LOGON(2u32); pub const LOGON32_LOGON_NETWORK: LOGON32_LOGON = LOGON32_LOGON(3u32); pub const LOGON32_LOGON_NETWORK_CLEARTEXT: LOGON32_LOGON = LOGON32_LOGON(8u32); pub const LOGON32_LOGON_NEW_CREDENTIALS: LOGON32_LOGON = LOGON32_LOGON(9u32); pub const LOGON32_LOGON_SERVICE: LOGON32_LOGON = LOGON32_LOGON(5u32); pub const LOGON32_LOGON_UNLOCK: LOGON32_LOGON = LOGON32_LOGON(7u32); impl ::core::convert::From<u32> for LOGON32_LOGON { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for LOGON32_LOGON { type Abi = Self; } impl ::core::ops::BitOr for LOGON32_LOGON { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for LOGON32_LOGON { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for LOGON32_LOGON { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for LOGON32_LOGON { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for LOGON32_LOGON { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct LOGON32_PROVIDER(pub u32); pub const LOGON32_PROVIDER_DEFAULT: LOGON32_PROVIDER = LOGON32_PROVIDER(0u32); pub const LOGON32_PROVIDER_WINNT50: LOGON32_PROVIDER = LOGON32_PROVIDER(3u32); pub const LOGON32_PROVIDER_WINNT40: LOGON32_PROVIDER = LOGON32_PROVIDER(2u32); impl ::core::convert::From<u32> for LOGON32_PROVIDER { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for LOGON32_PROVIDER { type Abi = Self; } impl ::core::ops::BitOr for LOGON32_PROVIDER { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for LOGON32_PROVIDER { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for LOGON32_PROVIDER { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for LOGON32_PROVIDER { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for LOGON32_PROVIDER { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct LUID_AND_ATTRIBUTES { pub Luid: super::Foundation::LUID, pub Attributes: TOKEN_PRIVILEGES_ATTRIBUTES, } #[cfg(feature = "Win32_Foundation")] impl LUID_AND_ATTRIBUTES {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for LUID_AND_ATTRIBUTES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for LUID_AND_ATTRIBUTES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("LUID_AND_ATTRIBUTES").field("Luid", &self.Luid).field("Attributes", &self.Attributes).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for LUID_AND_ATTRIBUTES { fn eq(&self, other: &Self) -> bool { self.Luid == other.Luid && self.Attributes == other.Attributes } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for LUID_AND_ATTRIBUTES {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for LUID_AND_ATTRIBUTES { type Abi = Self; } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn LogonUserA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::PSTR>>(lpszusername: Param0, lpszdomain: Param1, lpszpassword: Param2, dwlogontype: LOGON32_LOGON, dwlogonprovider: LOGON32_PROVIDER, phtoken: *mut super::Foundation::HANDLE) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn LogonUserA(lpszusername: super::Foundation::PSTR, lpszdomain: super::Foundation::PSTR, lpszpassword: super::Foundation::PSTR, dwlogontype: LOGON32_LOGON, dwlogonprovider: LOGON32_PROVIDER, phtoken: *mut super::Foundation::HANDLE) -> super::Foundation::BOOL; } ::core::mem::transmute(LogonUserA(lpszusername.into_param().abi(), lpszdomain.into_param().abi(), lpszpassword.into_param().abi(), ::core::mem::transmute(dwlogontype), ::core::mem::transmute(dwlogonprovider), ::core::mem::transmute(phtoken))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn LogonUserExA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::PSTR>>( lpszusername: Param0, lpszdomain: Param1, lpszpassword: Param2, dwlogontype: LOGON32_LOGON, dwlogonprovider: LOGON32_PROVIDER, phtoken: *mut super::Foundation::HANDLE, pplogonsid: *mut super::Foundation::PSID, ppprofilebuffer: *mut *mut ::core::ffi::c_void, pdwprofilelength: *mut u32, pquotalimits: *mut QUOTA_LIMITS, ) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn LogonUserExA(lpszusername: super::Foundation::PSTR, lpszdomain: super::Foundation::PSTR, lpszpassword: super::Foundation::PSTR, dwlogontype: LOGON32_LOGON, dwlogonprovider: LOGON32_PROVIDER, phtoken: *mut super::Foundation::HANDLE, pplogonsid: *mut super::Foundation::PSID, ppprofilebuffer: *mut *mut ::core::ffi::c_void, pdwprofilelength: *mut u32, pquotalimits: *mut QUOTA_LIMITS) -> super::Foundation::BOOL; } ::core::mem::transmute(LogonUserExA( lpszusername.into_param().abi(), lpszdomain.into_param().abi(), lpszpassword.into_param().abi(), ::core::mem::transmute(dwlogontype), ::core::mem::transmute(dwlogonprovider), ::core::mem::transmute(phtoken), ::core::mem::transmute(pplogonsid), ::core::mem::transmute(ppprofilebuffer), ::core::mem::transmute(pdwprofilelength), ::core::mem::transmute(pquotalimits), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn LogonUserExW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>>( lpszusername: Param0, lpszdomain: Param1, lpszpassword: Param2, dwlogontype: LOGON32_LOGON, dwlogonprovider: LOGON32_PROVIDER, phtoken: *mut super::Foundation::HANDLE, pplogonsid: *mut super::Foundation::PSID, ppprofilebuffer: *mut *mut ::core::ffi::c_void, pdwprofilelength: *mut u32, pquotalimits: *mut QUOTA_LIMITS, ) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn LogonUserExW(lpszusername: super::Foundation::PWSTR, lpszdomain: super::Foundation::PWSTR, lpszpassword: super::Foundation::PWSTR, dwlogontype: LOGON32_LOGON, dwlogonprovider: LOGON32_PROVIDER, phtoken: *mut super::Foundation::HANDLE, pplogonsid: *mut super::Foundation::PSID, ppprofilebuffer: *mut *mut ::core::ffi::c_void, pdwprofilelength: *mut u32, pquotalimits: *mut QUOTA_LIMITS) -> super::Foundation::BOOL; } ::core::mem::transmute(LogonUserExW( lpszusername.into_param().abi(), lpszdomain.into_param().abi(), lpszpassword.into_param().abi(), ::core::mem::transmute(dwlogontype), ::core::mem::transmute(dwlogonprovider), ::core::mem::transmute(phtoken), ::core::mem::transmute(pplogonsid), ::core::mem::transmute(ppprofilebuffer), ::core::mem::transmute(pdwprofilelength), ::core::mem::transmute(pquotalimits), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn LogonUserW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>>(lpszusername: Param0, lpszdomain: Param1, lpszpassword: Param2, dwlogontype: LOGON32_LOGON, dwlogonprovider: LOGON32_PROVIDER, phtoken: *mut super::Foundation::HANDLE) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn LogonUserW(lpszusername: super::Foundation::PWSTR, lpszdomain: super::Foundation::PWSTR, lpszpassword: super::Foundation::PWSTR, dwlogontype: LOGON32_LOGON, dwlogonprovider: LOGON32_PROVIDER, phtoken: *mut super::Foundation::HANDLE) -> super::Foundation::BOOL; } ::core::mem::transmute(LogonUserW(lpszusername.into_param().abi(), lpszdomain.into_param().abi(), lpszpassword.into_param().abi(), ::core::mem::transmute(dwlogontype), ::core::mem::transmute(dwlogonprovider), ::core::mem::transmute(phtoken))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn LookupAccountNameA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSTR>>(lpsystemname: Param0, lpaccountname: Param1, sid: super::Foundation::PSID, cbsid: *mut u32, referenceddomainname: super::Foundation::PSTR, cchreferenceddomainname: *mut u32, peuse: *mut SID_NAME_USE) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn LookupAccountNameA(lpsystemname: super::Foundation::PSTR, lpaccountname: super::Foundation::PSTR, sid: super::Foundation::PSID, cbsid: *mut u32, referenceddomainname: super::Foundation::PSTR, cchreferenceddomainname: *mut u32, peuse: *mut SID_NAME_USE) -> super::Foundation::BOOL; } ::core::mem::transmute(LookupAccountNameA(lpsystemname.into_param().abi(), lpaccountname.into_param().abi(), ::core::mem::transmute(sid), ::core::mem::transmute(cbsid), ::core::mem::transmute(referenceddomainname), ::core::mem::transmute(cchreferenceddomainname), ::core::mem::transmute(peuse))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn LookupAccountNameW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>>(lpsystemname: Param0, lpaccountname: Param1, sid: super::Foundation::PSID, cbsid: *mut u32, referenceddomainname: super::Foundation::PWSTR, cchreferenceddomainname: *mut u32, peuse: *mut SID_NAME_USE) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn LookupAccountNameW(lpsystemname: super::Foundation::PWSTR, lpaccountname: super::Foundation::PWSTR, sid: super::Foundation::PSID, cbsid: *mut u32, referenceddomainname: super::Foundation::PWSTR, cchreferenceddomainname: *mut u32, peuse: *mut SID_NAME_USE) -> super::Foundation::BOOL; } ::core::mem::transmute(LookupAccountNameW(lpsystemname.into_param().abi(), lpaccountname.into_param().abi(), ::core::mem::transmute(sid), ::core::mem::transmute(cbsid), ::core::mem::transmute(referenceddomainname), ::core::mem::transmute(cchreferenceddomainname), ::core::mem::transmute(peuse))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn LookupAccountSidA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(lpsystemname: Param0, sid: Param1, name: super::Foundation::PSTR, cchname: *mut u32, referenceddomainname: super::Foundation::PSTR, cchreferenceddomainname: *mut u32, peuse: *mut SID_NAME_USE) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn LookupAccountSidA(lpsystemname: super::Foundation::PSTR, sid: super::Foundation::PSID, name: super::Foundation::PSTR, cchname: *mut u32, referenceddomainname: super::Foundation::PSTR, cchreferenceddomainname: *mut u32, peuse: *mut SID_NAME_USE) -> super::Foundation::BOOL; } ::core::mem::transmute(LookupAccountSidA(lpsystemname.into_param().abi(), sid.into_param().abi(), ::core::mem::transmute(name), ::core::mem::transmute(cchname), ::core::mem::transmute(referenceddomainname), ::core::mem::transmute(cchreferenceddomainname), ::core::mem::transmute(peuse))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn LookupAccountSidW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSID>>(lpsystemname: Param0, sid: Param1, name: super::Foundation::PWSTR, cchname: *mut u32, referenceddomainname: super::Foundation::PWSTR, cchreferenceddomainname: *mut u32, peuse: *mut SID_NAME_USE) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn LookupAccountSidW(lpsystemname: super::Foundation::PWSTR, sid: super::Foundation::PSID, name: super::Foundation::PWSTR, cchname: *mut u32, referenceddomainname: super::Foundation::PWSTR, cchreferenceddomainname: *mut u32, peuse: *mut SID_NAME_USE) -> super::Foundation::BOOL; } ::core::mem::transmute(LookupAccountSidW(lpsystemname.into_param().abi(), sid.into_param().abi(), ::core::mem::transmute(name), ::core::mem::transmute(cchname), ::core::mem::transmute(referenceddomainname), ::core::mem::transmute(cchreferenceddomainname), ::core::mem::transmute(peuse))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn LookupPrivilegeDisplayNameA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSTR>>(lpsystemname: Param0, lpname: Param1, lpdisplayname: super::Foundation::PSTR, cchdisplayname: *mut u32, lplanguageid: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn LookupPrivilegeDisplayNameA(lpsystemname: super::Foundation::PSTR, lpname: super::Foundation::PSTR, lpdisplayname: super::Foundation::PSTR, cchdisplayname: *mut u32, lplanguageid: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(LookupPrivilegeDisplayNameA(lpsystemname.into_param().abi(), lpname.into_param().abi(), ::core::mem::transmute(lpdisplayname), ::core::mem::transmute(cchdisplayname), ::core::mem::transmute(lplanguageid))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn LookupPrivilegeDisplayNameW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>>(lpsystemname: Param0, lpname: Param1, lpdisplayname: super::Foundation::PWSTR, cchdisplayname: *mut u32, lplanguageid: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn LookupPrivilegeDisplayNameW(lpsystemname: super::Foundation::PWSTR, lpname: super::Foundation::PWSTR, lpdisplayname: super::Foundation::PWSTR, cchdisplayname: *mut u32, lplanguageid: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(LookupPrivilegeDisplayNameW(lpsystemname.into_param().abi(), lpname.into_param().abi(), ::core::mem::transmute(lpdisplayname), ::core::mem::transmute(cchdisplayname), ::core::mem::transmute(lplanguageid))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn LookupPrivilegeNameA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>>(lpsystemname: Param0, lpluid: *const super::Foundation::LUID, lpname: super::Foundation::PSTR, cchname: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn LookupPrivilegeNameA(lpsystemname: super::Foundation::PSTR, lpluid: *const super::Foundation::LUID, lpname: super::Foundation::PSTR, cchname: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(LookupPrivilegeNameA(lpsystemname.into_param().abi(), ::core::mem::transmute(lpluid), ::core::mem::transmute(lpname), ::core::mem::transmute(cchname))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn LookupPrivilegeNameW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>>(lpsystemname: Param0, lpluid: *const super::Foundation::LUID, lpname: super::Foundation::PWSTR, cchname: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn LookupPrivilegeNameW(lpsystemname: super::Foundation::PWSTR, lpluid: *const super::Foundation::LUID, lpname: super::Foundation::PWSTR, cchname: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(LookupPrivilegeNameW(lpsystemname.into_param().abi(), ::core::mem::transmute(lpluid), ::core::mem::transmute(lpname), ::core::mem::transmute(cchname))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn LookupPrivilegeValueA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSTR>>(lpsystemname: Param0, lpname: Param1, lpluid: *mut super::Foundation::LUID) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn LookupPrivilegeValueA(lpsystemname: super::Foundation::PSTR, lpname: super::Foundation::PSTR, lpluid: *mut super::Foundation::LUID) -> super::Foundation::BOOL; } ::core::mem::transmute(LookupPrivilegeValueA(lpsystemname.into_param().abi(), lpname.into_param().abi(), ::core::mem::transmute(lpluid))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn LookupPrivilegeValueW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>>(lpsystemname: Param0, lpname: Param1, lpluid: *mut super::Foundation::LUID) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn LookupPrivilegeValueW(lpsystemname: super::Foundation::PWSTR, lpname: super::Foundation::PWSTR, lpluid: *mut super::Foundation::LUID) -> super::Foundation::BOOL; } ::core::mem::transmute(LookupPrivilegeValueW(lpsystemname.into_param().abi(), lpname.into_param().abi(), ::core::mem::transmute(lpluid))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct MANDATORY_LEVEL(pub i32); pub const MandatoryLevelUntrusted: MANDATORY_LEVEL = MANDATORY_LEVEL(0i32); pub const MandatoryLevelLow: MANDATORY_LEVEL = MANDATORY_LEVEL(1i32); pub const MandatoryLevelMedium: MANDATORY_LEVEL = MANDATORY_LEVEL(2i32); pub const MandatoryLevelHigh: MANDATORY_LEVEL = MANDATORY_LEVEL(3i32); pub const MandatoryLevelSystem: MANDATORY_LEVEL = MANDATORY_LEVEL(4i32); pub const MandatoryLevelSecureProcess: MANDATORY_LEVEL = MANDATORY_LEVEL(5i32); pub const MandatoryLevelCount: MANDATORY_LEVEL = MANDATORY_LEVEL(6i32); impl ::core::convert::From<i32> for MANDATORY_LEVEL { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for MANDATORY_LEVEL { type Abi = Self; } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn MakeAbsoluteSD(pselfrelativesecuritydescriptor: *const SECURITY_DESCRIPTOR, pabsolutesecuritydescriptor: *mut SECURITY_DESCRIPTOR, lpdwabsolutesecuritydescriptorsize: *mut u32, pdacl: *mut ACL, lpdwdaclsize: *mut u32, psacl: *mut ACL, lpdwsaclsize: *mut u32, powner: super::Foundation::PSID, lpdwownersize: *mut u32, pprimarygroup: super::Foundation::PSID, lpdwprimarygroupsize: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn MakeAbsoluteSD(pselfrelativesecuritydescriptor: *const SECURITY_DESCRIPTOR, pabsolutesecuritydescriptor: *mut SECURITY_DESCRIPTOR, lpdwabsolutesecuritydescriptorsize: *mut u32, pdacl: *mut ACL, lpdwdaclsize: *mut u32, psacl: *mut ACL, lpdwsaclsize: *mut u32, powner: super::Foundation::PSID, lpdwownersize: *mut u32, pprimarygroup: super::Foundation::PSID, lpdwprimarygroupsize: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(MakeAbsoluteSD( ::core::mem::transmute(pselfrelativesecuritydescriptor), ::core::mem::transmute(pabsolutesecuritydescriptor), ::core::mem::transmute(lpdwabsolutesecuritydescriptorsize), ::core::mem::transmute(pdacl), ::core::mem::transmute(lpdwdaclsize), ::core::mem::transmute(psacl), ::core::mem::transmute(lpdwsaclsize), ::core::mem::transmute(powner), ::core::mem::transmute(lpdwownersize), ::core::mem::transmute(pprimarygroup), ::core::mem::transmute(lpdwprimarygroupsize), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn MakeSelfRelativeSD(pabsolutesecuritydescriptor: *const SECURITY_DESCRIPTOR, pselfrelativesecuritydescriptor: *mut SECURITY_DESCRIPTOR, lpdwbufferlength: *mut u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn MakeSelfRelativeSD(pabsolutesecuritydescriptor: *const SECURITY_DESCRIPTOR, pselfrelativesecuritydescriptor: *mut SECURITY_DESCRIPTOR, lpdwbufferlength: *mut u32) -> super::Foundation::BOOL; } ::core::mem::transmute(MakeSelfRelativeSD(::core::mem::transmute(pabsolutesecuritydescriptor), ::core::mem::transmute(pselfrelativesecuritydescriptor), ::core::mem::transmute(lpdwbufferlength))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn MapGenericMask(accessmask: *mut u32, genericmapping: *const GENERIC_MAPPING) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn MapGenericMask(accessmask: *mut u32, genericmapping: *const GENERIC_MAPPING); } ::core::mem::transmute(MapGenericMask(::core::mem::transmute(accessmask), ::core::mem::transmute(genericmapping))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)] #[repr(transparent)] pub struct NCRYPT_DESCRIPTOR_HANDLE(pub isize); impl ::core::default::Default for NCRYPT_DESCRIPTOR_HANDLE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } unsafe impl ::windows::core::Handle for NCRYPT_DESCRIPTOR_HANDLE {} unsafe impl ::windows::core::Abi for NCRYPT_DESCRIPTOR_HANDLE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)] #[repr(transparent)] pub struct NCRYPT_STREAM_HANDLE(pub isize); impl ::core::default::Default for NCRYPT_STREAM_HANDLE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } unsafe impl ::windows::core::Handle for NCRYPT_STREAM_HANDLE {} unsafe impl ::windows::core::Abi for NCRYPT_STREAM_HANDLE { 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 OBJECT_SECURITY_INFORMATION(pub u32); pub const ATTRIBUTE_SECURITY_INFORMATION: OBJECT_SECURITY_INFORMATION = OBJECT_SECURITY_INFORMATION(32u32); pub const BACKUP_SECURITY_INFORMATION: OBJECT_SECURITY_INFORMATION = OBJECT_SECURITY_INFORMATION(65536u32); pub const DACL_SECURITY_INFORMATION: OBJECT_SECURITY_INFORMATION = OBJECT_SECURITY_INFORMATION(4u32); pub const GROUP_SECURITY_INFORMATION: OBJECT_SECURITY_INFORMATION = OBJECT_SECURITY_INFORMATION(2u32); pub const LABEL_SECURITY_INFORMATION: OBJECT_SECURITY_INFORMATION = OBJECT_SECURITY_INFORMATION(16u32); pub const OWNER_SECURITY_INFORMATION: OBJECT_SECURITY_INFORMATION = OBJECT_SECURITY_INFORMATION(1u32); pub const PROTECTED_DACL_SECURITY_INFORMATION: OBJECT_SECURITY_INFORMATION = OBJECT_SECURITY_INFORMATION(2147483648u32); pub const PROTECTED_SACL_SECURITY_INFORMATION: OBJECT_SECURITY_INFORMATION = OBJECT_SECURITY_INFORMATION(1073741824u32); pub const SACL_SECURITY_INFORMATION: OBJECT_SECURITY_INFORMATION = OBJECT_SECURITY_INFORMATION(8u32); pub const SCOPE_SECURITY_INFORMATION: OBJECT_SECURITY_INFORMATION = OBJECT_SECURITY_INFORMATION(64u32); pub const UNPROTECTED_DACL_SECURITY_INFORMATION: OBJECT_SECURITY_INFORMATION = OBJECT_SECURITY_INFORMATION(536870912u32); pub const UNPROTECTED_SACL_SECURITY_INFORMATION: OBJECT_SECURITY_INFORMATION = OBJECT_SECURITY_INFORMATION(268435456u32); impl ::core::convert::From<u32> for OBJECT_SECURITY_INFORMATION { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for OBJECT_SECURITY_INFORMATION { type Abi = Self; } impl ::core::ops::BitOr for OBJECT_SECURITY_INFORMATION { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for OBJECT_SECURITY_INFORMATION { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for OBJECT_SECURITY_INFORMATION { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for OBJECT_SECURITY_INFORMATION { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for OBJECT_SECURITY_INFORMATION { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct OBJECT_TYPE_LIST { pub Level: u16, pub Sbz: u16, pub ObjectType: *mut ::windows::core::GUID, } impl OBJECT_TYPE_LIST {} impl ::core::default::Default for OBJECT_TYPE_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for OBJECT_TYPE_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("OBJECT_TYPE_LIST").field("Level", &self.Level).field("Sbz", &self.Sbz).field("ObjectType", &self.ObjectType).finish() } } impl ::core::cmp::PartialEq for OBJECT_TYPE_LIST { fn eq(&self, other: &Self) -> bool { self.Level == other.Level && self.Sbz == other.Sbz && self.ObjectType == other.ObjectType } } impl ::core::cmp::Eq for OBJECT_TYPE_LIST {} unsafe impl ::windows::core::Abi for OBJECT_TYPE_LIST { type Abi = Self; } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn ObjectCloseAuditAlarmA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(subsystemname: Param0, handleid: *const ::core::ffi::c_void, generateonclose: Param2) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn ObjectCloseAuditAlarmA(subsystemname: super::Foundation::PSTR, handleid: *const ::core::ffi::c_void, generateonclose: super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(ObjectCloseAuditAlarmA(subsystemname.into_param().abi(), ::core::mem::transmute(handleid), generateonclose.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn ObjectCloseAuditAlarmW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(subsystemname: Param0, handleid: *const ::core::ffi::c_void, generateonclose: Param2) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn ObjectCloseAuditAlarmW(subsystemname: super::Foundation::PWSTR, handleid: *const ::core::ffi::c_void, generateonclose: super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(ObjectCloseAuditAlarmW(subsystemname.into_param().abi(), ::core::mem::transmute(handleid), generateonclose.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn ObjectDeleteAuditAlarmA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(subsystemname: Param0, handleid: *const ::core::ffi::c_void, generateonclose: Param2) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn ObjectDeleteAuditAlarmA(subsystemname: super::Foundation::PSTR, handleid: *const ::core::ffi::c_void, generateonclose: super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(ObjectDeleteAuditAlarmA(subsystemname.into_param().abi(), ::core::mem::transmute(handleid), generateonclose.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn ObjectDeleteAuditAlarmW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(subsystemname: Param0, handleid: *const ::core::ffi::c_void, generateonclose: Param2) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn ObjectDeleteAuditAlarmW(subsystemname: super::Foundation::PWSTR, handleid: *const ::core::ffi::c_void, generateonclose: super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(ObjectDeleteAuditAlarmW(subsystemname.into_param().abi(), ::core::mem::transmute(handleid), generateonclose.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn ObjectOpenAuditAlarmA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param5: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>, Param9: ::windows::core::IntoParam<'a, super::Foundation::BOOL>, Param10: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>( subsystemname: Param0, handleid: *const ::core::ffi::c_void, objecttypename: Param2, objectname: Param3, psecuritydescriptor: *const SECURITY_DESCRIPTOR, clienttoken: Param5, desiredaccess: u32, grantedaccess: u32, privileges: *const PRIVILEGE_SET, objectcreation: Param9, accessgranted: Param10, generateonclose: *mut i32, ) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn ObjectOpenAuditAlarmA(subsystemname: super::Foundation::PSTR, handleid: *const ::core::ffi::c_void, objecttypename: super::Foundation::PSTR, objectname: super::Foundation::PSTR, psecuritydescriptor: *const SECURITY_DESCRIPTOR, clienttoken: super::Foundation::HANDLE, desiredaccess: u32, grantedaccess: u32, privileges: *const PRIVILEGE_SET, objectcreation: super::Foundation::BOOL, accessgranted: super::Foundation::BOOL, generateonclose: *mut i32) -> super::Foundation::BOOL; } ::core::mem::transmute(ObjectOpenAuditAlarmA( subsystemname.into_param().abi(), ::core::mem::transmute(handleid), objecttypename.into_param().abi(), objectname.into_param().abi(), ::core::mem::transmute(psecuritydescriptor), clienttoken.into_param().abi(), ::core::mem::transmute(desiredaccess), ::core::mem::transmute(grantedaccess), ::core::mem::transmute(privileges), objectcreation.into_param().abi(), accessgranted.into_param().abi(), ::core::mem::transmute(generateonclose), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn ObjectOpenAuditAlarmW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param5: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>, Param9: ::windows::core::IntoParam<'a, super::Foundation::BOOL>, Param10: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>( subsystemname: Param0, handleid: *const ::core::ffi::c_void, objecttypename: Param2, objectname: Param3, psecuritydescriptor: *const SECURITY_DESCRIPTOR, clienttoken: Param5, desiredaccess: u32, grantedaccess: u32, privileges: *const PRIVILEGE_SET, objectcreation: Param9, accessgranted: Param10, generateonclose: *mut i32, ) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn ObjectOpenAuditAlarmW(subsystemname: super::Foundation::PWSTR, handleid: *const ::core::ffi::c_void, objecttypename: super::Foundation::PWSTR, objectname: super::Foundation::PWSTR, psecuritydescriptor: *const SECURITY_DESCRIPTOR, clienttoken: super::Foundation::HANDLE, desiredaccess: u32, grantedaccess: u32, privileges: *const PRIVILEGE_SET, objectcreation: super::Foundation::BOOL, accessgranted: super::Foundation::BOOL, generateonclose: *mut i32) -> super::Foundation::BOOL; } ::core::mem::transmute(ObjectOpenAuditAlarmW( subsystemname.into_param().abi(), ::core::mem::transmute(handleid), objecttypename.into_param().abi(), objectname.into_param().abi(), ::core::mem::transmute(psecuritydescriptor), clienttoken.into_param().abi(), ::core::mem::transmute(desiredaccess), ::core::mem::transmute(grantedaccess), ::core::mem::transmute(privileges), objectcreation.into_param().abi(), accessgranted.into_param().abi(), ::core::mem::transmute(generateonclose), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn ObjectPrivilegeAuditAlarmA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>, Param5: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(subsystemname: Param0, handleid: *const ::core::ffi::c_void, clienttoken: Param2, desiredaccess: u32, privileges: *const PRIVILEGE_SET, accessgranted: Param5) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn ObjectPrivilegeAuditAlarmA(subsystemname: super::Foundation::PSTR, handleid: *const ::core::ffi::c_void, clienttoken: super::Foundation::HANDLE, desiredaccess: u32, privileges: *const PRIVILEGE_SET, accessgranted: super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(ObjectPrivilegeAuditAlarmA(subsystemname.into_param().abi(), ::core::mem::transmute(handleid), clienttoken.into_param().abi(), ::core::mem::transmute(desiredaccess), ::core::mem::transmute(privileges), accessgranted.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn ObjectPrivilegeAuditAlarmW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>, Param5: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(subsystemname: Param0, handleid: *const ::core::ffi::c_void, clienttoken: Param2, desiredaccess: u32, privileges: *const PRIVILEGE_SET, accessgranted: Param5) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn ObjectPrivilegeAuditAlarmW(subsystemname: super::Foundation::PWSTR, handleid: *const ::core::ffi::c_void, clienttoken: super::Foundation::HANDLE, desiredaccess: u32, privileges: *const PRIVILEGE_SET, accessgranted: super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(ObjectPrivilegeAuditAlarmW(subsystemname.into_param().abi(), ::core::mem::transmute(handleid), clienttoken.into_param().abi(), ::core::mem::transmute(desiredaccess), ::core::mem::transmute(privileges), accessgranted.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] pub type PLSA_AP_CALL_PACKAGE_UNTRUSTED = unsafe extern "system" fn(clientrequest: *const *const ::core::ffi::c_void, protocolsubmitbuffer: *const ::core::ffi::c_void, clientbufferbase: *const ::core::ffi::c_void, submitbufferlength: u32, protocolreturnbuffer: *mut *mut ::core::ffi::c_void, returnbufferlength: *mut u32, protocolstatus: *mut i32) -> super::Foundation::NTSTATUS; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct PRIVILEGE_SET { pub PrivilegeCount: u32, pub Control: u32, pub Privilege: [LUID_AND_ATTRIBUTES; 1], } #[cfg(feature = "Win32_Foundation")] impl PRIVILEGE_SET {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for PRIVILEGE_SET { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for PRIVILEGE_SET { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("PRIVILEGE_SET").field("PrivilegeCount", &self.PrivilegeCount).field("Control", &self.Control).field("Privilege", &self.Privilege).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for PRIVILEGE_SET { fn eq(&self, other: &Self) -> bool { self.PrivilegeCount == other.PrivilegeCount && self.Control == other.Control && self.Privilege == other.Privilege } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for PRIVILEGE_SET {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for PRIVILEGE_SET { type Abi = Self; } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn PrivilegeCheck<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(clienttoken: Param0, requiredprivileges: *mut PRIVILEGE_SET, pfresult: *mut i32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn PrivilegeCheck(clienttoken: super::Foundation::HANDLE, requiredprivileges: *mut PRIVILEGE_SET, pfresult: *mut i32) -> super::Foundation::BOOL; } ::core::mem::transmute(PrivilegeCheck(clienttoken.into_param().abi(), ::core::mem::transmute(requiredprivileges), ::core::mem::transmute(pfresult))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn PrivilegedServiceAuditAlarmA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>, Param4: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(subsystemname: Param0, servicename: Param1, clienttoken: Param2, privileges: *const PRIVILEGE_SET, accessgranted: Param4) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn PrivilegedServiceAuditAlarmA(subsystemname: super::Foundation::PSTR, servicename: super::Foundation::PSTR, clienttoken: super::Foundation::HANDLE, privileges: *const PRIVILEGE_SET, accessgranted: super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(PrivilegedServiceAuditAlarmA(subsystemname.into_param().abi(), servicename.into_param().abi(), clienttoken.into_param().abi(), ::core::mem::transmute(privileges), accessgranted.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn PrivilegedServiceAuditAlarmW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>, Param4: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(subsystemname: Param0, servicename: Param1, clienttoken: Param2, privileges: *const PRIVILEGE_SET, accessgranted: Param4) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn PrivilegedServiceAuditAlarmW(subsystemname: super::Foundation::PWSTR, servicename: super::Foundation::PWSTR, clienttoken: super::Foundation::HANDLE, privileges: *const PRIVILEGE_SET, accessgranted: super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(PrivilegedServiceAuditAlarmW(subsystemname.into_param().abi(), servicename.into_param().abi(), clienttoken.into_param().abi(), ::core::mem::transmute(privileges), accessgranted.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct QUOTA_LIMITS { pub PagedPoolLimit: usize, pub NonPagedPoolLimit: usize, pub MinimumWorkingSetSize: usize, pub MaximumWorkingSetSize: usize, pub PagefileLimit: usize, pub TimeLimit: i64, } impl QUOTA_LIMITS {} impl ::core::default::Default for QUOTA_LIMITS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for QUOTA_LIMITS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("QUOTA_LIMITS") .field("PagedPoolLimit", &self.PagedPoolLimit) .field("NonPagedPoolLimit", &self.NonPagedPoolLimit) .field("MinimumWorkingSetSize", &self.MinimumWorkingSetSize) .field("MaximumWorkingSetSize", &self.MaximumWorkingSetSize) .field("PagefileLimit", &self.PagefileLimit) .field("TimeLimit", &self.TimeLimit) .finish() } } impl ::core::cmp::PartialEq for QUOTA_LIMITS { fn eq(&self, other: &Self) -> bool { self.PagedPoolLimit == other.PagedPoolLimit && self.NonPagedPoolLimit == other.NonPagedPoolLimit && self.MinimumWorkingSetSize == other.MinimumWorkingSetSize && self.MaximumWorkingSetSize == other.MaximumWorkingSetSize && self.PagefileLimit == other.PagefileLimit && self.TimeLimit == other.TimeLimit } } impl ::core::cmp::Eq for QUOTA_LIMITS {} unsafe impl ::windows::core::Abi for QUOTA_LIMITS { type Abi = Self; } #[inline] pub unsafe fn QuerySecurityAccessMask(securityinformation: u32, desiredaccess: *mut u32) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn QuerySecurityAccessMask(securityinformation: u32, desiredaccess: *mut u32); } ::core::mem::transmute(QuerySecurityAccessMask(::core::mem::transmute(securityinformation), ::core::mem::transmute(desiredaccess))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn RevertToSelf() -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn RevertToSelf() -> super::Foundation::BOOL; } ::core::mem::transmute(RevertToSelf()) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn RtlConvertSidToUnicodeString<'a, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param2: ::windows::core::IntoParam<'a, super::Foundation::BOOLEAN>>(unicodestring: *mut super::Foundation::UNICODE_STRING, sid: Param1, allocatedestinationstring: Param2) -> ::windows::core::Result<()> { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn RtlConvertSidToUnicodeString(unicodestring: *mut super::Foundation::UNICODE_STRING, sid: super::Foundation::PSID, allocatedestinationstring: super::Foundation::BOOLEAN) -> super::Foundation::NTSTATUS; } RtlConvertSidToUnicodeString(::core::mem::transmute(unicodestring), sid.into_param().abi(), allocatedestinationstring.into_param().abi()).ok() } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn RtlNormalizeSecurityDescriptor<'a, Param4: ::windows::core::IntoParam<'a, super::Foundation::BOOLEAN>>(securitydescriptor: *mut *mut SECURITY_DESCRIPTOR, securitydescriptorlength: u32, newsecuritydescriptor: *mut *mut SECURITY_DESCRIPTOR, newsecuritydescriptorlength: *mut u32, checkonly: Param4) -> super::Foundation::BOOLEAN { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn RtlNormalizeSecurityDescriptor(securitydescriptor: *mut *mut SECURITY_DESCRIPTOR, securitydescriptorlength: u32, newsecuritydescriptor: *mut *mut SECURITY_DESCRIPTOR, newsecuritydescriptorlength: *mut u32, checkonly: super::Foundation::BOOLEAN) -> super::Foundation::BOOLEAN; } ::core::mem::transmute(RtlNormalizeSecurityDescriptor(::core::mem::transmute(securitydescriptor), ::core::mem::transmute(securitydescriptorlength), ::core::mem::transmute(newsecuritydescriptor), ::core::mem::transmute(newsecuritydescriptorlength), checkonly.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)] #[repr(transparent)] pub struct SAFER_LEVEL_HANDLE(pub isize); impl ::core::default::Default for SAFER_LEVEL_HANDLE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } unsafe impl ::windows::core::Handle for SAFER_LEVEL_HANDLE {} unsafe impl ::windows::core::Abi for SAFER_LEVEL_HANDLE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)] #[repr(transparent)] pub struct SC_HANDLE(pub isize); impl ::core::default::Default for SC_HANDLE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } unsafe impl ::windows::core::Handle for SC_HANDLE {} unsafe impl ::windows::core::Abi for SC_HANDLE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct SECURITY_ATTRIBUTES { pub nLength: u32, pub lpSecurityDescriptor: *mut ::core::ffi::c_void, pub bInheritHandle: super::Foundation::BOOL, } #[cfg(feature = "Win32_Foundation")] impl SECURITY_ATTRIBUTES {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SECURITY_ATTRIBUTES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for SECURITY_ATTRIBUTES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SECURITY_ATTRIBUTES").field("nLength", &self.nLength).field("lpSecurityDescriptor", &self.lpSecurityDescriptor).field("bInheritHandle", &self.bInheritHandle).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SECURITY_ATTRIBUTES { fn eq(&self, other: &Self) -> bool { self.nLength == other.nLength && self.lpSecurityDescriptor == other.lpSecurityDescriptor && self.bInheritHandle == other.bInheritHandle } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SECURITY_ATTRIBUTES {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for 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 SECURITY_AUTO_INHERIT_FLAGS(pub u32); pub const SEF_AVOID_OWNER_CHECK: SECURITY_AUTO_INHERIT_FLAGS = SECURITY_AUTO_INHERIT_FLAGS(16u32); pub const SEF_AVOID_OWNER_RESTRICTION: SECURITY_AUTO_INHERIT_FLAGS = SECURITY_AUTO_INHERIT_FLAGS(4096u32); pub const SEF_AVOID_PRIVILEGE_CHECK: SECURITY_AUTO_INHERIT_FLAGS = SECURITY_AUTO_INHERIT_FLAGS(8u32); pub const SEF_DACL_AUTO_INHERIT: SECURITY_AUTO_INHERIT_FLAGS = SECURITY_AUTO_INHERIT_FLAGS(1u32); pub const SEF_DEFAULT_DESCRIPTOR_FOR_OBJECT: SECURITY_AUTO_INHERIT_FLAGS = SECURITY_AUTO_INHERIT_FLAGS(4u32); pub const SEF_DEFAULT_GROUP_FROM_PARENT: SECURITY_AUTO_INHERIT_FLAGS = SECURITY_AUTO_INHERIT_FLAGS(64u32); pub const SEF_DEFAULT_OWNER_FROM_PARENT: SECURITY_AUTO_INHERIT_FLAGS = SECURITY_AUTO_INHERIT_FLAGS(32u32); pub const SEF_MACL_NO_EXECUTE_UP: SECURITY_AUTO_INHERIT_FLAGS = SECURITY_AUTO_INHERIT_FLAGS(1024u32); pub const SEF_MACL_NO_READ_UP: SECURITY_AUTO_INHERIT_FLAGS = SECURITY_AUTO_INHERIT_FLAGS(512u32); pub const SEF_MACL_NO_WRITE_UP: SECURITY_AUTO_INHERIT_FLAGS = SECURITY_AUTO_INHERIT_FLAGS(256u32); pub const SEF_SACL_AUTO_INHERIT: SECURITY_AUTO_INHERIT_FLAGS = SECURITY_AUTO_INHERIT_FLAGS(2u32); impl ::core::convert::From<u32> for SECURITY_AUTO_INHERIT_FLAGS { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SECURITY_AUTO_INHERIT_FLAGS { type Abi = Self; } impl ::core::ops::BitOr for SECURITY_AUTO_INHERIT_FLAGS { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for SECURITY_AUTO_INHERIT_FLAGS { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for SECURITY_AUTO_INHERIT_FLAGS { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for SECURITY_AUTO_INHERIT_FLAGS { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for SECURITY_AUTO_INHERIT_FLAGS { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct SECURITY_CAPABILITIES { pub AppContainerSid: super::Foundation::PSID, pub Capabilities: *mut SID_AND_ATTRIBUTES, pub CapabilityCount: u32, pub Reserved: u32, } #[cfg(feature = "Win32_Foundation")] impl SECURITY_CAPABILITIES {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SECURITY_CAPABILITIES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for SECURITY_CAPABILITIES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SECURITY_CAPABILITIES").field("AppContainerSid", &self.AppContainerSid).field("Capabilities", &self.Capabilities).field("CapabilityCount", &self.CapabilityCount).field("Reserved", &self.Reserved).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SECURITY_CAPABILITIES { fn eq(&self, other: &Self) -> bool { self.AppContainerSid == other.AppContainerSid && self.Capabilities == other.Capabilities && self.CapabilityCount == other.CapabilityCount && self.Reserved == other.Reserved } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SECURITY_CAPABILITIES {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SECURITY_CAPABILITIES { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct SECURITY_DESCRIPTOR { pub Revision: u8, pub Sbz1: u8, pub Control: u16, pub Owner: super::Foundation::PSID, pub Group: super::Foundation::PSID, pub Sacl: *mut ACL, pub Dacl: *mut ACL, } #[cfg(feature = "Win32_Foundation")] impl SECURITY_DESCRIPTOR {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SECURITY_DESCRIPTOR { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for SECURITY_DESCRIPTOR { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SECURITY_DESCRIPTOR").field("Revision", &self.Revision).field("Sbz1", &self.Sbz1).field("Control", &self.Control).field("Owner", &self.Owner).field("Group", &self.Group).field("Sacl", &self.Sacl).field("Dacl", &self.Dacl).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SECURITY_DESCRIPTOR { fn eq(&self, other: &Self) -> bool { self.Revision == other.Revision && self.Sbz1 == other.Sbz1 && self.Control == other.Control && self.Owner == other.Owner && self.Group == other.Group && self.Sacl == other.Sacl && self.Dacl == other.Dacl } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SECURITY_DESCRIPTOR {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SECURITY_DESCRIPTOR { 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 SECURITY_IMPERSONATION_LEVEL(pub i32); pub const SecurityAnonymous: SECURITY_IMPERSONATION_LEVEL = SECURITY_IMPERSONATION_LEVEL(0i32); pub const SecurityIdentification: SECURITY_IMPERSONATION_LEVEL = SECURITY_IMPERSONATION_LEVEL(1i32); pub const SecurityImpersonation: SECURITY_IMPERSONATION_LEVEL = SECURITY_IMPERSONATION_LEVEL(2i32); pub const SecurityDelegation: SECURITY_IMPERSONATION_LEVEL = SECURITY_IMPERSONATION_LEVEL(3i32); impl ::core::convert::From<i32> for SECURITY_IMPERSONATION_LEVEL { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SECURITY_IMPERSONATION_LEVEL { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct SECURITY_QUALITY_OF_SERVICE { pub Length: u32, pub ImpersonationLevel: SECURITY_IMPERSONATION_LEVEL, pub ContextTrackingMode: u8, pub EffectiveOnly: super::Foundation::BOOLEAN, } #[cfg(feature = "Win32_Foundation")] impl SECURITY_QUALITY_OF_SERVICE {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SECURITY_QUALITY_OF_SERVICE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for SECURITY_QUALITY_OF_SERVICE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SECURITY_QUALITY_OF_SERVICE").field("Length", &self.Length).field("ImpersonationLevel", &self.ImpersonationLevel).field("ContextTrackingMode", &self.ContextTrackingMode).field("EffectiveOnly", &self.EffectiveOnly).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SECURITY_QUALITY_OF_SERVICE { fn eq(&self, other: &Self) -> bool { self.Length == other.Length && self.ImpersonationLevel == other.ImpersonationLevel && self.ContextTrackingMode == other.ContextTrackingMode && self.EffectiveOnly == other.EffectiveOnly } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SECURITY_QUALITY_OF_SERVICE {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SECURITY_QUALITY_OF_SERVICE { type Abi = Self; } pub type SEC_THREAD_START = unsafe extern "system" fn(lpthreadparameter: *mut ::core::ffi::c_void) -> u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct SE_ACCESS_REPLY { pub Size: u32, pub ResultListCount: u32, pub GrantedAccess: *mut u32, pub AccessStatus: *mut u32, pub AccessReason: *mut ACCESS_REASONS, pub Privileges: *mut *mut PRIVILEGE_SET, } #[cfg(feature = "Win32_Foundation")] impl SE_ACCESS_REPLY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SE_ACCESS_REPLY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for SE_ACCESS_REPLY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SE_ACCESS_REPLY").field("Size", &self.Size).field("ResultListCount", &self.ResultListCount).field("GrantedAccess", &self.GrantedAccess).field("AccessStatus", &self.AccessStatus).field("AccessReason", &self.AccessReason).field("Privileges", &self.Privileges).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SE_ACCESS_REPLY { fn eq(&self, other: &Self) -> bool { self.Size == other.Size && self.ResultListCount == other.ResultListCount && self.GrantedAccess == other.GrantedAccess && self.AccessStatus == other.AccessStatus && self.AccessReason == other.AccessReason && self.Privileges == other.Privileges } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SE_ACCESS_REPLY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SE_ACCESS_REPLY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct SE_ACCESS_REQUEST { pub Size: u32, pub SeSecurityDescriptor: *mut SE_SECURITY_DESCRIPTOR, pub DesiredAccess: u32, pub PreviouslyGrantedAccess: u32, pub PrincipalSelfSid: super::Foundation::PSID, pub GenericMapping: *mut GENERIC_MAPPING, pub ObjectTypeListCount: u32, pub ObjectTypeList: *mut OBJECT_TYPE_LIST, } #[cfg(feature = "Win32_Foundation")] impl SE_ACCESS_REQUEST {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SE_ACCESS_REQUEST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for SE_ACCESS_REQUEST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SE_ACCESS_REQUEST") .field("Size", &self.Size) .field("SeSecurityDescriptor", &self.SeSecurityDescriptor) .field("DesiredAccess", &self.DesiredAccess) .field("PreviouslyGrantedAccess", &self.PreviouslyGrantedAccess) .field("PrincipalSelfSid", &self.PrincipalSelfSid) .field("GenericMapping", &self.GenericMapping) .field("ObjectTypeListCount", &self.ObjectTypeListCount) .field("ObjectTypeList", &self.ObjectTypeList) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SE_ACCESS_REQUEST { fn eq(&self, other: &Self) -> bool { self.Size == other.Size && self.SeSecurityDescriptor == other.SeSecurityDescriptor && self.DesiredAccess == other.DesiredAccess && self.PreviouslyGrantedAccess == other.PreviouslyGrantedAccess && self.PrincipalSelfSid == other.PrincipalSelfSid && self.GenericMapping == other.GenericMapping && self.ObjectTypeListCount == other.ObjectTypeListCount && self.ObjectTypeList == other.ObjectTypeList } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SE_ACCESS_REQUEST {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SE_ACCESS_REQUEST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct SE_IMPERSONATION_STATE { pub Token: *mut ::core::ffi::c_void, pub CopyOnOpen: super::Foundation::BOOLEAN, pub EffectiveOnly: super::Foundation::BOOLEAN, pub Level: SECURITY_IMPERSONATION_LEVEL, } #[cfg(feature = "Win32_Foundation")] impl SE_IMPERSONATION_STATE {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SE_IMPERSONATION_STATE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for SE_IMPERSONATION_STATE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SE_IMPERSONATION_STATE").field("Token", &self.Token).field("CopyOnOpen", &self.CopyOnOpen).field("EffectiveOnly", &self.EffectiveOnly).field("Level", &self.Level).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SE_IMPERSONATION_STATE { fn eq(&self, other: &Self) -> bool { self.Token == other.Token && self.CopyOnOpen == other.CopyOnOpen && self.EffectiveOnly == other.EffectiveOnly && self.Level == other.Level } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SE_IMPERSONATION_STATE {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SE_IMPERSONATION_STATE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct SE_SECURITY_DESCRIPTOR { pub Size: u32, pub Flags: u32, pub SecurityDescriptor: *mut SECURITY_DESCRIPTOR, } #[cfg(feature = "Win32_Foundation")] impl SE_SECURITY_DESCRIPTOR {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SE_SECURITY_DESCRIPTOR { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for SE_SECURITY_DESCRIPTOR { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SE_SECURITY_DESCRIPTOR").field("Size", &self.Size).field("Flags", &self.Flags).field("SecurityDescriptor", &self.SecurityDescriptor).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SE_SECURITY_DESCRIPTOR { fn eq(&self, other: &Self) -> bool { self.Size == other.Size && self.Flags == other.Flags && self.SecurityDescriptor == other.SecurityDescriptor } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SE_SECURITY_DESCRIPTOR {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SE_SECURITY_DESCRIPTOR { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub union SE_SID { pub Sid: SID, pub Buffer: [u8; 68], } impl SE_SID {} impl ::core::default::Default for SE_SID { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for SE_SID { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for SE_SID {} unsafe impl ::windows::core::Abi for SE_SID { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SID { pub Revision: u8, pub SubAuthorityCount: u8, pub IdentifierAuthority: SID_IDENTIFIER_AUTHORITY, pub SubAuthority: [u32; 1], } impl SID {} impl ::core::default::Default for SID { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SID { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SID").field("Revision", &self.Revision).field("SubAuthorityCount", &self.SubAuthorityCount).field("IdentifierAuthority", &self.IdentifierAuthority).field("SubAuthority", &self.SubAuthority).finish() } } impl ::core::cmp::PartialEq for SID { fn eq(&self, other: &Self) -> bool { self.Revision == other.Revision && self.SubAuthorityCount == other.SubAuthorityCount && self.IdentifierAuthority == other.IdentifierAuthority && self.SubAuthority == other.SubAuthority } } impl ::core::cmp::Eq for SID {} unsafe impl ::windows::core::Abi for SID { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct SID_AND_ATTRIBUTES { pub Sid: super::Foundation::PSID, pub Attributes: u32, } #[cfg(feature = "Win32_Foundation")] impl SID_AND_ATTRIBUTES {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SID_AND_ATTRIBUTES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for SID_AND_ATTRIBUTES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SID_AND_ATTRIBUTES").field("Sid", &self.Sid).field("Attributes", &self.Attributes).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SID_AND_ATTRIBUTES { fn eq(&self, other: &Self) -> bool { self.Sid == other.Sid && self.Attributes == other.Attributes } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SID_AND_ATTRIBUTES {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SID_AND_ATTRIBUTES { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct SID_AND_ATTRIBUTES_HASH { pub SidCount: u32, pub SidAttr: *mut SID_AND_ATTRIBUTES, pub Hash: [usize; 32], } #[cfg(feature = "Win32_Foundation")] impl SID_AND_ATTRIBUTES_HASH {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SID_AND_ATTRIBUTES_HASH { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for SID_AND_ATTRIBUTES_HASH { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SID_AND_ATTRIBUTES_HASH").field("SidCount", &self.SidCount).field("SidAttr", &self.SidAttr).field("Hash", &self.Hash).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SID_AND_ATTRIBUTES_HASH { fn eq(&self, other: &Self) -> bool { self.SidCount == other.SidCount && self.SidAttr == other.SidAttr && self.Hash == other.Hash } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SID_AND_ATTRIBUTES_HASH {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SID_AND_ATTRIBUTES_HASH { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SID_IDENTIFIER_AUTHORITY { pub Value: [u8; 6], } impl SID_IDENTIFIER_AUTHORITY {} impl ::core::default::Default for SID_IDENTIFIER_AUTHORITY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SID_IDENTIFIER_AUTHORITY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SID_IDENTIFIER_AUTHORITY").field("Value", &self.Value).finish() } } impl ::core::cmp::PartialEq for SID_IDENTIFIER_AUTHORITY { fn eq(&self, other: &Self) -> bool { self.Value == other.Value } } impl ::core::cmp::Eq for SID_IDENTIFIER_AUTHORITY {} unsafe impl ::windows::core::Abi for SID_IDENTIFIER_AUTHORITY { 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 SID_NAME_USE(pub i32); pub const SidTypeUser: SID_NAME_USE = SID_NAME_USE(1i32); pub const SidTypeGroup: SID_NAME_USE = SID_NAME_USE(2i32); pub const SidTypeDomain: SID_NAME_USE = SID_NAME_USE(3i32); pub const SidTypeAlias: SID_NAME_USE = SID_NAME_USE(4i32); pub const SidTypeWellKnownGroup: SID_NAME_USE = SID_NAME_USE(5i32); pub const SidTypeDeletedAccount: SID_NAME_USE = SID_NAME_USE(6i32); pub const SidTypeInvalid: SID_NAME_USE = SID_NAME_USE(7i32); pub const SidTypeUnknown: SID_NAME_USE = SID_NAME_USE(8i32); pub const SidTypeComputer: SID_NAME_USE = SID_NAME_USE(9i32); pub const SidTypeLabel: SID_NAME_USE = SID_NAME_USE(10i32); pub const SidTypeLogonSession: SID_NAME_USE = SID_NAME_USE(11i32); impl ::core::convert::From<i32> for SID_NAME_USE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SID_NAME_USE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SYSTEM_ACCESS_FILTER_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub SidStart: u32, } impl SYSTEM_ACCESS_FILTER_ACE {} impl ::core::default::Default for SYSTEM_ACCESS_FILTER_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SYSTEM_ACCESS_FILTER_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SYSTEM_ACCESS_FILTER_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for SYSTEM_ACCESS_FILTER_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for SYSTEM_ACCESS_FILTER_ACE {} unsafe impl ::windows::core::Abi for SYSTEM_ACCESS_FILTER_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SYSTEM_ALARM_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub SidStart: u32, } impl SYSTEM_ALARM_ACE {} impl ::core::default::Default for SYSTEM_ALARM_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SYSTEM_ALARM_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SYSTEM_ALARM_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for SYSTEM_ALARM_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for SYSTEM_ALARM_ACE {} unsafe impl ::windows::core::Abi for SYSTEM_ALARM_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SYSTEM_ALARM_CALLBACK_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub SidStart: u32, } impl SYSTEM_ALARM_CALLBACK_ACE {} impl ::core::default::Default for SYSTEM_ALARM_CALLBACK_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SYSTEM_ALARM_CALLBACK_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SYSTEM_ALARM_CALLBACK_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for SYSTEM_ALARM_CALLBACK_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for SYSTEM_ALARM_CALLBACK_ACE {} unsafe impl ::windows::core::Abi for SYSTEM_ALARM_CALLBACK_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SYSTEM_ALARM_CALLBACK_OBJECT_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub Flags: SYSTEM_AUDIT_OBJECT_ACE_FLAGS, pub ObjectType: ::windows::core::GUID, pub InheritedObjectType: ::windows::core::GUID, pub SidStart: u32, } impl SYSTEM_ALARM_CALLBACK_OBJECT_ACE {} impl ::core::default::Default for SYSTEM_ALARM_CALLBACK_OBJECT_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SYSTEM_ALARM_CALLBACK_OBJECT_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SYSTEM_ALARM_CALLBACK_OBJECT_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("Flags", &self.Flags).field("ObjectType", &self.ObjectType).field("InheritedObjectType", &self.InheritedObjectType).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for SYSTEM_ALARM_CALLBACK_OBJECT_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.Flags == other.Flags && self.ObjectType == other.ObjectType && self.InheritedObjectType == other.InheritedObjectType && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for SYSTEM_ALARM_CALLBACK_OBJECT_ACE {} unsafe impl ::windows::core::Abi for SYSTEM_ALARM_CALLBACK_OBJECT_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SYSTEM_ALARM_OBJECT_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub Flags: u32, pub ObjectType: ::windows::core::GUID, pub InheritedObjectType: ::windows::core::GUID, pub SidStart: u32, } impl SYSTEM_ALARM_OBJECT_ACE {} impl ::core::default::Default for SYSTEM_ALARM_OBJECT_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SYSTEM_ALARM_OBJECT_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SYSTEM_ALARM_OBJECT_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("Flags", &self.Flags).field("ObjectType", &self.ObjectType).field("InheritedObjectType", &self.InheritedObjectType).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for SYSTEM_ALARM_OBJECT_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.Flags == other.Flags && self.ObjectType == other.ObjectType && self.InheritedObjectType == other.InheritedObjectType && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for SYSTEM_ALARM_OBJECT_ACE {} unsafe impl ::windows::core::Abi for SYSTEM_ALARM_OBJECT_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SYSTEM_AUDIT_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub SidStart: u32, } impl SYSTEM_AUDIT_ACE {} impl ::core::default::Default for SYSTEM_AUDIT_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SYSTEM_AUDIT_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SYSTEM_AUDIT_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for SYSTEM_AUDIT_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for SYSTEM_AUDIT_ACE {} unsafe impl ::windows::core::Abi for SYSTEM_AUDIT_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SYSTEM_AUDIT_CALLBACK_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub SidStart: u32, } impl SYSTEM_AUDIT_CALLBACK_ACE {} impl ::core::default::Default for SYSTEM_AUDIT_CALLBACK_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SYSTEM_AUDIT_CALLBACK_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SYSTEM_AUDIT_CALLBACK_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for SYSTEM_AUDIT_CALLBACK_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for SYSTEM_AUDIT_CALLBACK_ACE {} unsafe impl ::windows::core::Abi for SYSTEM_AUDIT_CALLBACK_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SYSTEM_AUDIT_CALLBACK_OBJECT_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub Flags: SYSTEM_AUDIT_OBJECT_ACE_FLAGS, pub ObjectType: ::windows::core::GUID, pub InheritedObjectType: ::windows::core::GUID, pub SidStart: u32, } impl SYSTEM_AUDIT_CALLBACK_OBJECT_ACE {} impl ::core::default::Default for SYSTEM_AUDIT_CALLBACK_OBJECT_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SYSTEM_AUDIT_CALLBACK_OBJECT_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SYSTEM_AUDIT_CALLBACK_OBJECT_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("Flags", &self.Flags).field("ObjectType", &self.ObjectType).field("InheritedObjectType", &self.InheritedObjectType).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for SYSTEM_AUDIT_CALLBACK_OBJECT_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.Flags == other.Flags && self.ObjectType == other.ObjectType && self.InheritedObjectType == other.InheritedObjectType && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for SYSTEM_AUDIT_CALLBACK_OBJECT_ACE {} unsafe impl ::windows::core::Abi for SYSTEM_AUDIT_CALLBACK_OBJECT_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SYSTEM_AUDIT_OBJECT_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub Flags: SYSTEM_AUDIT_OBJECT_ACE_FLAGS, pub ObjectType: ::windows::core::GUID, pub InheritedObjectType: ::windows::core::GUID, pub SidStart: u32, } impl SYSTEM_AUDIT_OBJECT_ACE {} impl ::core::default::Default for SYSTEM_AUDIT_OBJECT_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SYSTEM_AUDIT_OBJECT_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SYSTEM_AUDIT_OBJECT_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("Flags", &self.Flags).field("ObjectType", &self.ObjectType).field("InheritedObjectType", &self.InheritedObjectType).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for SYSTEM_AUDIT_OBJECT_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.Flags == other.Flags && self.ObjectType == other.ObjectType && self.InheritedObjectType == other.InheritedObjectType && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for SYSTEM_AUDIT_OBJECT_ACE {} unsafe impl ::windows::core::Abi for SYSTEM_AUDIT_OBJECT_ACE { 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 SYSTEM_AUDIT_OBJECT_ACE_FLAGS(pub u32); pub const ACE_OBJECT_TYPE_PRESENT: SYSTEM_AUDIT_OBJECT_ACE_FLAGS = SYSTEM_AUDIT_OBJECT_ACE_FLAGS(1u32); pub const ACE_INHERITED_OBJECT_TYPE_PRESENT: SYSTEM_AUDIT_OBJECT_ACE_FLAGS = SYSTEM_AUDIT_OBJECT_ACE_FLAGS(2u32); impl ::core::convert::From<u32> for SYSTEM_AUDIT_OBJECT_ACE_FLAGS { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SYSTEM_AUDIT_OBJECT_ACE_FLAGS { type Abi = Self; } impl ::core::ops::BitOr for SYSTEM_AUDIT_OBJECT_ACE_FLAGS { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for SYSTEM_AUDIT_OBJECT_ACE_FLAGS { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for SYSTEM_AUDIT_OBJECT_ACE_FLAGS { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for SYSTEM_AUDIT_OBJECT_ACE_FLAGS { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for SYSTEM_AUDIT_OBJECT_ACE_FLAGS { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SYSTEM_MANDATORY_LABEL_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub SidStart: u32, } impl SYSTEM_MANDATORY_LABEL_ACE {} impl ::core::default::Default for SYSTEM_MANDATORY_LABEL_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SYSTEM_MANDATORY_LABEL_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SYSTEM_MANDATORY_LABEL_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for SYSTEM_MANDATORY_LABEL_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for SYSTEM_MANDATORY_LABEL_ACE {} unsafe impl ::windows::core::Abi for SYSTEM_MANDATORY_LABEL_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SYSTEM_PROCESS_TRUST_LABEL_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub SidStart: u32, } impl SYSTEM_PROCESS_TRUST_LABEL_ACE {} impl ::core::default::Default for SYSTEM_PROCESS_TRUST_LABEL_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SYSTEM_PROCESS_TRUST_LABEL_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SYSTEM_PROCESS_TRUST_LABEL_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for SYSTEM_PROCESS_TRUST_LABEL_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for SYSTEM_PROCESS_TRUST_LABEL_ACE {} unsafe impl ::windows::core::Abi for SYSTEM_PROCESS_TRUST_LABEL_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SYSTEM_RESOURCE_ATTRIBUTE_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub SidStart: u32, } impl SYSTEM_RESOURCE_ATTRIBUTE_ACE {} impl ::core::default::Default for SYSTEM_RESOURCE_ATTRIBUTE_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SYSTEM_RESOURCE_ATTRIBUTE_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SYSTEM_RESOURCE_ATTRIBUTE_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for SYSTEM_RESOURCE_ATTRIBUTE_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for SYSTEM_RESOURCE_ATTRIBUTE_ACE {} unsafe impl ::windows::core::Abi for SYSTEM_RESOURCE_ATTRIBUTE_ACE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SYSTEM_SCOPED_POLICY_ID_ACE { pub Header: ACE_HEADER, pub Mask: u32, pub SidStart: u32, } impl SYSTEM_SCOPED_POLICY_ID_ACE {} impl ::core::default::Default for SYSTEM_SCOPED_POLICY_ID_ACE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SYSTEM_SCOPED_POLICY_ID_ACE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SYSTEM_SCOPED_POLICY_ID_ACE").field("Header", &self.Header).field("Mask", &self.Mask).field("SidStart", &self.SidStart).finish() } } impl ::core::cmp::PartialEq for SYSTEM_SCOPED_POLICY_ID_ACE { fn eq(&self, other: &Self) -> bool { self.Header == other.Header && self.Mask == other.Mask && self.SidStart == other.SidStart } } impl ::core::cmp::Eq for SYSTEM_SCOPED_POLICY_ID_ACE {} unsafe impl ::windows::core::Abi for SYSTEM_SCOPED_POLICY_ID_ACE { type Abi = Self; } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetAclInformation(pacl: *mut ACL, paclinformation: *const ::core::ffi::c_void, naclinformationlength: u32, dwaclinformationclass: ACL_INFORMATION_CLASS) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetAclInformation(pacl: *mut ACL, paclinformation: *const ::core::ffi::c_void, naclinformationlength: u32, dwaclinformationclass: ACL_INFORMATION_CLASS) -> super::Foundation::BOOL; } ::core::mem::transmute(SetAclInformation(::core::mem::transmute(pacl), ::core::mem::transmute(paclinformation), ::core::mem::transmute(naclinformationlength), ::core::mem::transmute(dwaclinformationclass))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetCachedSigningLevel<'a, Param3: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(sourcefiles: *const super::Foundation::HANDLE, sourcefilecount: u32, flags: u32, targetfile: Param3) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetCachedSigningLevel(sourcefiles: *const super::Foundation::HANDLE, sourcefilecount: u32, flags: u32, targetfile: super::Foundation::HANDLE) -> super::Foundation::BOOL; } ::core::mem::transmute(SetCachedSigningLevel(::core::mem::transmute(sourcefiles), ::core::mem::transmute(sourcefilecount), ::core::mem::transmute(flags), targetfile.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetFileSecurityA<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PSTR>>(lpfilename: Param0, securityinformation: u32, psecuritydescriptor: *const SECURITY_DESCRIPTOR) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetFileSecurityA(lpfilename: super::Foundation::PSTR, securityinformation: u32, psecuritydescriptor: *const SECURITY_DESCRIPTOR) -> super::Foundation::BOOL; } ::core::mem::transmute(SetFileSecurityA(lpfilename.into_param().abi(), ::core::mem::transmute(securityinformation), ::core::mem::transmute(psecuritydescriptor))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetFileSecurityW<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::PWSTR>>(lpfilename: Param0, securityinformation: u32, psecuritydescriptor: *const SECURITY_DESCRIPTOR) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetFileSecurityW(lpfilename: super::Foundation::PWSTR, securityinformation: u32, psecuritydescriptor: *const SECURITY_DESCRIPTOR) -> super::Foundation::BOOL; } ::core::mem::transmute(SetFileSecurityW(lpfilename.into_param().abi(), ::core::mem::transmute(securityinformation), ::core::mem::transmute(psecuritydescriptor))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetKernelObjectSecurity<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(handle: Param0, securityinformation: u32, securitydescriptor: *const SECURITY_DESCRIPTOR) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetKernelObjectSecurity(handle: super::Foundation::HANDLE, securityinformation: u32, securitydescriptor: *const SECURITY_DESCRIPTOR) -> super::Foundation::BOOL; } ::core::mem::transmute(SetKernelObjectSecurity(handle.into_param().abi(), ::core::mem::transmute(securityinformation), ::core::mem::transmute(securitydescriptor))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetPrivateObjectSecurity<'a, Param4: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(securityinformation: u32, modificationdescriptor: *const SECURITY_DESCRIPTOR, objectssecuritydescriptor: *mut *mut SECURITY_DESCRIPTOR, genericmapping: *const GENERIC_MAPPING, token: Param4) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetPrivateObjectSecurity(securityinformation: u32, modificationdescriptor: *const SECURITY_DESCRIPTOR, objectssecuritydescriptor: *mut *mut SECURITY_DESCRIPTOR, genericmapping: *const GENERIC_MAPPING, token: super::Foundation::HANDLE) -> super::Foundation::BOOL; } ::core::mem::transmute(SetPrivateObjectSecurity(::core::mem::transmute(securityinformation), ::core::mem::transmute(modificationdescriptor), ::core::mem::transmute(objectssecuritydescriptor), ::core::mem::transmute(genericmapping), token.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetPrivateObjectSecurityEx<'a, Param5: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(securityinformation: u32, modificationdescriptor: *const SECURITY_DESCRIPTOR, objectssecuritydescriptor: *mut *mut SECURITY_DESCRIPTOR, autoinheritflags: SECURITY_AUTO_INHERIT_FLAGS, genericmapping: *const GENERIC_MAPPING, token: Param5) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetPrivateObjectSecurityEx(securityinformation: u32, modificationdescriptor: *const SECURITY_DESCRIPTOR, objectssecuritydescriptor: *mut *mut SECURITY_DESCRIPTOR, autoinheritflags: SECURITY_AUTO_INHERIT_FLAGS, genericmapping: *const GENERIC_MAPPING, token: super::Foundation::HANDLE) -> super::Foundation::BOOL; } ::core::mem::transmute(SetPrivateObjectSecurityEx(::core::mem::transmute(securityinformation), ::core::mem::transmute(modificationdescriptor), ::core::mem::transmute(objectssecuritydescriptor), ::core::mem::transmute(autoinheritflags), ::core::mem::transmute(genericmapping), token.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn SetSecurityAccessMask(securityinformation: u32, desiredaccess: *mut u32) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetSecurityAccessMask(securityinformation: u32, desiredaccess: *mut u32); } ::core::mem::transmute(SetSecurityAccessMask(::core::mem::transmute(securityinformation), ::core::mem::transmute(desiredaccess))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetSecurityDescriptorControl(psecuritydescriptor: *const SECURITY_DESCRIPTOR, controlbitsofinterest: u16, controlbitstoset: u16) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetSecurityDescriptorControl(psecuritydescriptor: *const SECURITY_DESCRIPTOR, controlbitsofinterest: u16, controlbitstoset: u16) -> super::Foundation::BOOL; } ::core::mem::transmute(SetSecurityDescriptorControl(::core::mem::transmute(psecuritydescriptor), ::core::mem::transmute(controlbitsofinterest), ::core::mem::transmute(controlbitstoset))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetSecurityDescriptorDacl<'a, Param1: ::windows::core::IntoParam<'a, super::Foundation::BOOL>, Param3: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(psecuritydescriptor: *mut SECURITY_DESCRIPTOR, bdaclpresent: Param1, pdacl: *const ACL, bdacldefaulted: Param3) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetSecurityDescriptorDacl(psecuritydescriptor: *mut SECURITY_DESCRIPTOR, bdaclpresent: super::Foundation::BOOL, pdacl: *const ACL, bdacldefaulted: super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(SetSecurityDescriptorDacl(::core::mem::transmute(psecuritydescriptor), bdaclpresent.into_param().abi(), ::core::mem::transmute(pdacl), bdacldefaulted.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetSecurityDescriptorGroup<'a, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param2: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(psecuritydescriptor: *mut SECURITY_DESCRIPTOR, pgroup: Param1, bgroupdefaulted: Param2) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetSecurityDescriptorGroup(psecuritydescriptor: *mut SECURITY_DESCRIPTOR, pgroup: super::Foundation::PSID, bgroupdefaulted: super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(SetSecurityDescriptorGroup(::core::mem::transmute(psecuritydescriptor), pgroup.into_param().abi(), bgroupdefaulted.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetSecurityDescriptorOwner<'a, Param1: ::windows::core::IntoParam<'a, super::Foundation::PSID>, Param2: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(psecuritydescriptor: *mut SECURITY_DESCRIPTOR, powner: Param1, bownerdefaulted: Param2) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetSecurityDescriptorOwner(psecuritydescriptor: *mut SECURITY_DESCRIPTOR, powner: super::Foundation::PSID, bownerdefaulted: super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(SetSecurityDescriptorOwner(::core::mem::transmute(psecuritydescriptor), powner.into_param().abi(), bownerdefaulted.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetSecurityDescriptorRMControl(securitydescriptor: *mut SECURITY_DESCRIPTOR, rmcontrol: *const u8) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetSecurityDescriptorRMControl(securitydescriptor: *mut SECURITY_DESCRIPTOR, rmcontrol: *const u8) -> u32; } ::core::mem::transmute(SetSecurityDescriptorRMControl(::core::mem::transmute(securitydescriptor), ::core::mem::transmute(rmcontrol))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetSecurityDescriptorSacl<'a, Param1: ::windows::core::IntoParam<'a, super::Foundation::BOOL>, Param3: ::windows::core::IntoParam<'a, super::Foundation::BOOL>>(psecuritydescriptor: *mut SECURITY_DESCRIPTOR, bsaclpresent: Param1, psacl: *const ACL, bsacldefaulted: Param3) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetSecurityDescriptorSacl(psecuritydescriptor: *mut SECURITY_DESCRIPTOR, bsaclpresent: super::Foundation::BOOL, psacl: *const ACL, bsacldefaulted: super::Foundation::BOOL) -> super::Foundation::BOOL; } ::core::mem::transmute(SetSecurityDescriptorSacl(::core::mem::transmute(psecuritydescriptor), bsaclpresent.into_param().abi(), ::core::mem::transmute(psacl), bsacldefaulted.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetTokenInformation<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(tokenhandle: Param0, tokeninformationclass: TOKEN_INFORMATION_CLASS, tokeninformation: *const ::core::ffi::c_void, tokeninformationlength: u32) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetTokenInformation(tokenhandle: super::Foundation::HANDLE, tokeninformationclass: TOKEN_INFORMATION_CLASS, tokeninformation: *const ::core::ffi::c_void, tokeninformationlength: u32) -> super::Foundation::BOOL; } ::core::mem::transmute(SetTokenInformation(tokenhandle.into_param().abi(), ::core::mem::transmute(tokeninformationclass), ::core::mem::transmute(tokeninformation), ::core::mem::transmute(tokeninformationlength))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetUserObjectSecurity<'a, Param0: ::windows::core::IntoParam<'a, super::Foundation::HANDLE>>(hobj: Param0, psirequested: *const OBJECT_SECURITY_INFORMATION, psid: *const SECURITY_DESCRIPTOR) -> super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetUserObjectSecurity(hobj: super::Foundation::HANDLE, psirequested: *const OBJECT_SECURITY_INFORMATION, psid: *const SECURITY_DESCRIPTOR) -> super::Foundation::BOOL; } ::core::mem::transmute(SetUserObjectSecurity(hobj.into_param().abi(), ::core::mem::transmute(psirequested), ::core::mem::transmute(psid))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct TOKEN_ACCESS_INFORMATION { pub SidHash: *mut SID_AND_ATTRIBUTES_HASH, pub RestrictedSidHash: *mut SID_AND_ATTRIBUTES_HASH, pub Privileges: *mut TOKEN_PRIVILEGES, pub AuthenticationId: super::Foundation::LUID, pub TokenType: TOKEN_TYPE, pub ImpersonationLevel: SECURITY_IMPERSONATION_LEVEL, pub MandatoryPolicy: TOKEN_MANDATORY_POLICY, pub Flags: u32, pub AppContainerNumber: u32, pub PackageSid: super::Foundation::PSID, pub CapabilitiesHash: *mut SID_AND_ATTRIBUTES_HASH, pub TrustLevelSid: super::Foundation::PSID, pub SecurityAttributes: *mut ::core::ffi::c_void, } #[cfg(feature = "Win32_Foundation")] impl TOKEN_ACCESS_INFORMATION {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for TOKEN_ACCESS_INFORMATION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for TOKEN_ACCESS_INFORMATION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_ACCESS_INFORMATION") .field("SidHash", &self.SidHash) .field("RestrictedSidHash", &self.RestrictedSidHash) .field("Privileges", &self.Privileges) .field("AuthenticationId", &self.AuthenticationId) .field("TokenType", &self.TokenType) .field("ImpersonationLevel", &self.ImpersonationLevel) .field("MandatoryPolicy", &self.MandatoryPolicy) .field("Flags", &self.Flags) .field("AppContainerNumber", &self.AppContainerNumber) .field("PackageSid", &self.PackageSid) .field("CapabilitiesHash", &self.CapabilitiesHash) .field("TrustLevelSid", &self.TrustLevelSid) .field("SecurityAttributes", &self.SecurityAttributes) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for TOKEN_ACCESS_INFORMATION { fn eq(&self, other: &Self) -> bool { self.SidHash == other.SidHash && self.RestrictedSidHash == other.RestrictedSidHash && self.Privileges == other.Privileges && self.AuthenticationId == other.AuthenticationId && self.TokenType == other.TokenType && self.ImpersonationLevel == other.ImpersonationLevel && self.MandatoryPolicy == other.MandatoryPolicy && self.Flags == other.Flags && self.AppContainerNumber == other.AppContainerNumber && self.PackageSid == other.PackageSid && self.CapabilitiesHash == other.CapabilitiesHash && self.TrustLevelSid == other.TrustLevelSid && self.SecurityAttributes == other.SecurityAttributes } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for TOKEN_ACCESS_INFORMATION {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for TOKEN_ACCESS_INFORMATION { 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 TOKEN_ACCESS_MASK(pub u32); pub const TOKEN_DELETE: TOKEN_ACCESS_MASK = TOKEN_ACCESS_MASK(65536u32); pub const TOKEN_READ_CONTROL: TOKEN_ACCESS_MASK = TOKEN_ACCESS_MASK(131072u32); pub const TOKEN_WRITE_DAC: TOKEN_ACCESS_MASK = TOKEN_ACCESS_MASK(262144u32); pub const TOKEN_WRITE_OWNER: TOKEN_ACCESS_MASK = TOKEN_ACCESS_MASK(524288u32); pub const TOKEN_ACCESS_SYSTEM_SECURITY: TOKEN_ACCESS_MASK = TOKEN_ACCESS_MASK(16777216u32); pub const TOKEN_ASSIGN_PRIMARY: TOKEN_ACCESS_MASK = TOKEN_ACCESS_MASK(1u32); pub const TOKEN_DUPLICATE: TOKEN_ACCESS_MASK = TOKEN_ACCESS_MASK(2u32); pub const TOKEN_IMPERSONATE: TOKEN_ACCESS_MASK = TOKEN_ACCESS_MASK(4u32); pub const TOKEN_QUERY: TOKEN_ACCESS_MASK = TOKEN_ACCESS_MASK(8u32); pub const TOKEN_QUERY_SOURCE: TOKEN_ACCESS_MASK = TOKEN_ACCESS_MASK(16u32); pub const TOKEN_ADJUST_PRIVILEGES: TOKEN_ACCESS_MASK = TOKEN_ACCESS_MASK(32u32); pub const TOKEN_ADJUST_GROUPS: TOKEN_ACCESS_MASK = TOKEN_ACCESS_MASK(64u32); pub const TOKEN_ADJUST_DEFAULT: TOKEN_ACCESS_MASK = TOKEN_ACCESS_MASK(128u32); pub const TOKEN_ADJUST_SESSIONID: TOKEN_ACCESS_MASK = TOKEN_ACCESS_MASK(256u32); pub const TOKEN_ALL_ACCESS: TOKEN_ACCESS_MASK = TOKEN_ACCESS_MASK(983295u32); impl ::core::convert::From<u32> for TOKEN_ACCESS_MASK { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TOKEN_ACCESS_MASK { type Abi = Self; } impl ::core::ops::BitOr for TOKEN_ACCESS_MASK { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for TOKEN_ACCESS_MASK { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for TOKEN_ACCESS_MASK { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for TOKEN_ACCESS_MASK { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for TOKEN_ACCESS_MASK { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct TOKEN_APPCONTAINER_INFORMATION { pub TokenAppContainer: super::Foundation::PSID, } #[cfg(feature = "Win32_Foundation")] impl TOKEN_APPCONTAINER_INFORMATION {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for TOKEN_APPCONTAINER_INFORMATION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for TOKEN_APPCONTAINER_INFORMATION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_APPCONTAINER_INFORMATION").field("TokenAppContainer", &self.TokenAppContainer).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for TOKEN_APPCONTAINER_INFORMATION { fn eq(&self, other: &Self) -> bool { self.TokenAppContainer == other.TokenAppContainer } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for TOKEN_APPCONTAINER_INFORMATION {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for TOKEN_APPCONTAINER_INFORMATION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct TOKEN_AUDIT_POLICY { pub PerUserPolicy: [u8; 30], } impl TOKEN_AUDIT_POLICY {} impl ::core::default::Default for TOKEN_AUDIT_POLICY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for TOKEN_AUDIT_POLICY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_AUDIT_POLICY").field("PerUserPolicy", &self.PerUserPolicy).finish() } } impl ::core::cmp::PartialEq for TOKEN_AUDIT_POLICY { fn eq(&self, other: &Self) -> bool { self.PerUserPolicy == other.PerUserPolicy } } impl ::core::cmp::Eq for TOKEN_AUDIT_POLICY {} unsafe impl ::windows::core::Abi for TOKEN_AUDIT_POLICY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct TOKEN_CONTROL { pub TokenId: super::Foundation::LUID, pub AuthenticationId: super::Foundation::LUID, pub ModifiedId: super::Foundation::LUID, pub TokenSource: TOKEN_SOURCE, } #[cfg(feature = "Win32_Foundation")] impl TOKEN_CONTROL {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for TOKEN_CONTROL { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for TOKEN_CONTROL { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_CONTROL").field("TokenId", &self.TokenId).field("AuthenticationId", &self.AuthenticationId).field("ModifiedId", &self.ModifiedId).field("TokenSource", &self.TokenSource).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for TOKEN_CONTROL { fn eq(&self, other: &Self) -> bool { self.TokenId == other.TokenId && self.AuthenticationId == other.AuthenticationId && self.ModifiedId == other.ModifiedId && self.TokenSource == other.TokenSource } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for TOKEN_CONTROL {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for TOKEN_CONTROL { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct TOKEN_DEFAULT_DACL { pub DefaultDacl: *mut ACL, } impl TOKEN_DEFAULT_DACL {} impl ::core::default::Default for TOKEN_DEFAULT_DACL { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for TOKEN_DEFAULT_DACL { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_DEFAULT_DACL").field("DefaultDacl", &self.DefaultDacl).finish() } } impl ::core::cmp::PartialEq for TOKEN_DEFAULT_DACL { fn eq(&self, other: &Self) -> bool { self.DefaultDacl == other.DefaultDacl } } impl ::core::cmp::Eq for TOKEN_DEFAULT_DACL {} unsafe impl ::windows::core::Abi for TOKEN_DEFAULT_DACL { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct TOKEN_DEVICE_CLAIMS { pub DeviceClaims: *mut ::core::ffi::c_void, } impl TOKEN_DEVICE_CLAIMS {} impl ::core::default::Default for TOKEN_DEVICE_CLAIMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for TOKEN_DEVICE_CLAIMS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_DEVICE_CLAIMS").field("DeviceClaims", &self.DeviceClaims).finish() } } impl ::core::cmp::PartialEq for TOKEN_DEVICE_CLAIMS { fn eq(&self, other: &Self) -> bool { self.DeviceClaims == other.DeviceClaims } } impl ::core::cmp::Eq for TOKEN_DEVICE_CLAIMS {} unsafe impl ::windows::core::Abi for TOKEN_DEVICE_CLAIMS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct TOKEN_ELEVATION { pub TokenIsElevated: u32, } impl TOKEN_ELEVATION {} impl ::core::default::Default for TOKEN_ELEVATION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for TOKEN_ELEVATION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_ELEVATION").field("TokenIsElevated", &self.TokenIsElevated).finish() } } impl ::core::cmp::PartialEq for TOKEN_ELEVATION { fn eq(&self, other: &Self) -> bool { self.TokenIsElevated == other.TokenIsElevated } } impl ::core::cmp::Eq for TOKEN_ELEVATION {} unsafe impl ::windows::core::Abi for TOKEN_ELEVATION { 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 TOKEN_ELEVATION_TYPE(pub i32); pub const TokenElevationTypeDefault: TOKEN_ELEVATION_TYPE = TOKEN_ELEVATION_TYPE(1i32); pub const TokenElevationTypeFull: TOKEN_ELEVATION_TYPE = TOKEN_ELEVATION_TYPE(2i32); pub const TokenElevationTypeLimited: TOKEN_ELEVATION_TYPE = TOKEN_ELEVATION_TYPE(3i32); impl ::core::convert::From<i32> for TOKEN_ELEVATION_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TOKEN_ELEVATION_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct TOKEN_GROUPS { pub GroupCount: u32, pub Groups: [SID_AND_ATTRIBUTES; 1], } #[cfg(feature = "Win32_Foundation")] impl TOKEN_GROUPS {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for TOKEN_GROUPS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for TOKEN_GROUPS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_GROUPS").field("GroupCount", &self.GroupCount).field("Groups", &self.Groups).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for TOKEN_GROUPS { fn eq(&self, other: &Self) -> bool { self.GroupCount == other.GroupCount && self.Groups == other.Groups } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for TOKEN_GROUPS {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for TOKEN_GROUPS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct TOKEN_GROUPS_AND_PRIVILEGES { pub SidCount: u32, pub SidLength: u32, pub Sids: *mut SID_AND_ATTRIBUTES, pub RestrictedSidCount: u32, pub RestrictedSidLength: u32, pub RestrictedSids: *mut SID_AND_ATTRIBUTES, pub PrivilegeCount: u32, pub PrivilegeLength: u32, pub Privileges: *mut LUID_AND_ATTRIBUTES, pub AuthenticationId: super::Foundation::LUID, } #[cfg(feature = "Win32_Foundation")] impl TOKEN_GROUPS_AND_PRIVILEGES {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for TOKEN_GROUPS_AND_PRIVILEGES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for TOKEN_GROUPS_AND_PRIVILEGES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_GROUPS_AND_PRIVILEGES") .field("SidCount", &self.SidCount) .field("SidLength", &self.SidLength) .field("Sids", &self.Sids) .field("RestrictedSidCount", &self.RestrictedSidCount) .field("RestrictedSidLength", &self.RestrictedSidLength) .field("RestrictedSids", &self.RestrictedSids) .field("PrivilegeCount", &self.PrivilegeCount) .field("PrivilegeLength", &self.PrivilegeLength) .field("Privileges", &self.Privileges) .field("AuthenticationId", &self.AuthenticationId) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for TOKEN_GROUPS_AND_PRIVILEGES { fn eq(&self, other: &Self) -> bool { self.SidCount == other.SidCount && self.SidLength == other.SidLength && self.Sids == other.Sids && self.RestrictedSidCount == other.RestrictedSidCount && self.RestrictedSidLength == other.RestrictedSidLength && self.RestrictedSids == other.RestrictedSids && self.PrivilegeCount == other.PrivilegeCount && self.PrivilegeLength == other.PrivilegeLength && self.Privileges == other.Privileges && self.AuthenticationId == other.AuthenticationId } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for TOKEN_GROUPS_AND_PRIVILEGES {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for TOKEN_GROUPS_AND_PRIVILEGES { 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 TOKEN_INFORMATION_CLASS(pub i32); pub const TokenUser: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(1i32); pub const TokenGroups: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(2i32); pub const TokenPrivileges: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(3i32); pub const TokenOwner: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(4i32); pub const TokenPrimaryGroup: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(5i32); pub const TokenDefaultDacl: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(6i32); pub const TokenSource: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(7i32); pub const TokenType: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(8i32); pub const TokenImpersonationLevel: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(9i32); pub const TokenStatistics: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(10i32); pub const TokenRestrictedSids: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(11i32); pub const TokenSessionId: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(12i32); pub const TokenGroupsAndPrivileges: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(13i32); pub const TokenSessionReference: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(14i32); pub const TokenSandBoxInert: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(15i32); pub const TokenAuditPolicy: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(16i32); pub const TokenOrigin: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(17i32); pub const TokenElevationType: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(18i32); pub const TokenLinkedToken: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(19i32); pub const TokenElevation: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(20i32); pub const TokenHasRestrictions: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(21i32); pub const TokenAccessInformation: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(22i32); pub const TokenVirtualizationAllowed: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(23i32); pub const TokenVirtualizationEnabled: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(24i32); pub const TokenIntegrityLevel: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(25i32); pub const TokenUIAccess: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(26i32); pub const TokenMandatoryPolicy: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(27i32); pub const TokenLogonSid: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(28i32); pub const TokenIsAppContainer: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(29i32); pub const TokenCapabilities: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(30i32); pub const TokenAppContainerSid: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(31i32); pub const TokenAppContainerNumber: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(32i32); pub const TokenUserClaimAttributes: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(33i32); pub const TokenDeviceClaimAttributes: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(34i32); pub const TokenRestrictedUserClaimAttributes: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(35i32); pub const TokenRestrictedDeviceClaimAttributes: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(36i32); pub const TokenDeviceGroups: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(37i32); pub const TokenRestrictedDeviceGroups: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(38i32); pub const TokenSecurityAttributes: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(39i32); pub const TokenIsRestricted: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(40i32); pub const TokenProcessTrustLevel: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(41i32); pub const TokenPrivateNameSpace: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(42i32); pub const TokenSingletonAttributes: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(43i32); pub const TokenBnoIsolation: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(44i32); pub const TokenChildProcessFlags: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(45i32); pub const TokenIsLessPrivilegedAppContainer: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(46i32); pub const TokenIsSandboxed: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(47i32); pub const MaxTokenInfoClass: TOKEN_INFORMATION_CLASS = TOKEN_INFORMATION_CLASS(48i32); impl ::core::convert::From<i32> for TOKEN_INFORMATION_CLASS { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TOKEN_INFORMATION_CLASS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct TOKEN_LINKED_TOKEN { pub LinkedToken: super::Foundation::HANDLE, } #[cfg(feature = "Win32_Foundation")] impl TOKEN_LINKED_TOKEN {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for TOKEN_LINKED_TOKEN { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for TOKEN_LINKED_TOKEN { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_LINKED_TOKEN").field("LinkedToken", &self.LinkedToken).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for TOKEN_LINKED_TOKEN { fn eq(&self, other: &Self) -> bool { self.LinkedToken == other.LinkedToken } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for TOKEN_LINKED_TOKEN {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for TOKEN_LINKED_TOKEN { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct TOKEN_MANDATORY_LABEL { pub Label: SID_AND_ATTRIBUTES, } #[cfg(feature = "Win32_Foundation")] impl TOKEN_MANDATORY_LABEL {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for TOKEN_MANDATORY_LABEL { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for TOKEN_MANDATORY_LABEL { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_MANDATORY_LABEL").field("Label", &self.Label).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for TOKEN_MANDATORY_LABEL { fn eq(&self, other: &Self) -> bool { self.Label == other.Label } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for TOKEN_MANDATORY_LABEL {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for TOKEN_MANDATORY_LABEL { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct TOKEN_MANDATORY_POLICY { pub Policy: TOKEN_MANDATORY_POLICY_ID, } impl TOKEN_MANDATORY_POLICY {} impl ::core::default::Default for TOKEN_MANDATORY_POLICY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for TOKEN_MANDATORY_POLICY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_MANDATORY_POLICY").field("Policy", &self.Policy).finish() } } impl ::core::cmp::PartialEq for TOKEN_MANDATORY_POLICY { fn eq(&self, other: &Self) -> bool { self.Policy == other.Policy } } impl ::core::cmp::Eq for TOKEN_MANDATORY_POLICY {} unsafe impl ::windows::core::Abi for TOKEN_MANDATORY_POLICY { 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 TOKEN_MANDATORY_POLICY_ID(pub u32); pub const TOKEN_MANDATORY_POLICY_OFF: TOKEN_MANDATORY_POLICY_ID = TOKEN_MANDATORY_POLICY_ID(0u32); pub const TOKEN_MANDATORY_POLICY_NO_WRITE_UP: TOKEN_MANDATORY_POLICY_ID = TOKEN_MANDATORY_POLICY_ID(1u32); pub const TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN: TOKEN_MANDATORY_POLICY_ID = TOKEN_MANDATORY_POLICY_ID(2u32); pub const TOKEN_MANDATORY_POLICY_VALID_MASK: TOKEN_MANDATORY_POLICY_ID = TOKEN_MANDATORY_POLICY_ID(3u32); impl ::core::convert::From<u32> for TOKEN_MANDATORY_POLICY_ID { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TOKEN_MANDATORY_POLICY_ID { type Abi = Self; } impl ::core::ops::BitOr for TOKEN_MANDATORY_POLICY_ID { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for TOKEN_MANDATORY_POLICY_ID { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for TOKEN_MANDATORY_POLICY_ID { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for TOKEN_MANDATORY_POLICY_ID { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for TOKEN_MANDATORY_POLICY_ID { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct TOKEN_ORIGIN { pub OriginatingLogonSession: super::Foundation::LUID, } #[cfg(feature = "Win32_Foundation")] impl TOKEN_ORIGIN {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for TOKEN_ORIGIN { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for TOKEN_ORIGIN { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_ORIGIN").field("OriginatingLogonSession", &self.OriginatingLogonSession).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for TOKEN_ORIGIN { fn eq(&self, other: &Self) -> bool { self.OriginatingLogonSession == other.OriginatingLogonSession } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for TOKEN_ORIGIN {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for TOKEN_ORIGIN { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct TOKEN_OWNER { pub Owner: super::Foundation::PSID, } #[cfg(feature = "Win32_Foundation")] impl TOKEN_OWNER {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for TOKEN_OWNER { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for TOKEN_OWNER { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_OWNER").field("Owner", &self.Owner).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for TOKEN_OWNER { fn eq(&self, other: &Self) -> bool { self.Owner == other.Owner } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for TOKEN_OWNER {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for TOKEN_OWNER { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct TOKEN_PRIMARY_GROUP { pub PrimaryGroup: super::Foundation::PSID, } #[cfg(feature = "Win32_Foundation")] impl TOKEN_PRIMARY_GROUP {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for TOKEN_PRIMARY_GROUP { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for TOKEN_PRIMARY_GROUP { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_PRIMARY_GROUP").field("PrimaryGroup", &self.PrimaryGroup).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for TOKEN_PRIMARY_GROUP { fn eq(&self, other: &Self) -> bool { self.PrimaryGroup == other.PrimaryGroup } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for TOKEN_PRIMARY_GROUP {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for TOKEN_PRIMARY_GROUP { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct TOKEN_PRIVILEGES { pub PrivilegeCount: u32, pub Privileges: [LUID_AND_ATTRIBUTES; 1], } #[cfg(feature = "Win32_Foundation")] impl TOKEN_PRIVILEGES {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for TOKEN_PRIVILEGES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for TOKEN_PRIVILEGES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_PRIVILEGES").field("PrivilegeCount", &self.PrivilegeCount).field("Privileges", &self.Privileges).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for TOKEN_PRIVILEGES { fn eq(&self, other: &Self) -> bool { self.PrivilegeCount == other.PrivilegeCount && self.Privileges == other.Privileges } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for TOKEN_PRIVILEGES {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for TOKEN_PRIVILEGES { 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 TOKEN_PRIVILEGES_ATTRIBUTES(pub u32); pub const SE_PRIVILEGE_ENABLED: TOKEN_PRIVILEGES_ATTRIBUTES = TOKEN_PRIVILEGES_ATTRIBUTES(2u32); pub const SE_PRIVILEGE_ENABLED_BY_DEFAULT: TOKEN_PRIVILEGES_ATTRIBUTES = TOKEN_PRIVILEGES_ATTRIBUTES(1u32); pub const SE_PRIVILEGE_REMOVED: TOKEN_PRIVILEGES_ATTRIBUTES = TOKEN_PRIVILEGES_ATTRIBUTES(4u32); pub const SE_PRIVILEGE_USED_FOR_ACCESS: TOKEN_PRIVILEGES_ATTRIBUTES = TOKEN_PRIVILEGES_ATTRIBUTES(2147483648u32); impl ::core::convert::From<u32> for TOKEN_PRIVILEGES_ATTRIBUTES { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TOKEN_PRIVILEGES_ATTRIBUTES { type Abi = Self; } impl ::core::ops::BitOr for TOKEN_PRIVILEGES_ATTRIBUTES { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for TOKEN_PRIVILEGES_ATTRIBUTES { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for TOKEN_PRIVILEGES_ATTRIBUTES { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for TOKEN_PRIVILEGES_ATTRIBUTES { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for TOKEN_PRIVILEGES_ATTRIBUTES { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct TOKEN_SOURCE { pub SourceName: [super::Foundation::CHAR; 8], pub SourceIdentifier: super::Foundation::LUID, } #[cfg(feature = "Win32_Foundation")] impl TOKEN_SOURCE {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for TOKEN_SOURCE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for TOKEN_SOURCE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_SOURCE").field("SourceName", &self.SourceName).field("SourceIdentifier", &self.SourceIdentifier).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for TOKEN_SOURCE { fn eq(&self, other: &Self) -> bool { self.SourceName == other.SourceName && self.SourceIdentifier == other.SourceIdentifier } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for TOKEN_SOURCE {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for TOKEN_SOURCE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct TOKEN_STATISTICS { pub TokenId: super::Foundation::LUID, pub AuthenticationId: super::Foundation::LUID, pub ExpirationTime: i64, pub TokenType: TOKEN_TYPE, pub ImpersonationLevel: SECURITY_IMPERSONATION_LEVEL, pub DynamicCharged: u32, pub DynamicAvailable: u32, pub GroupCount: u32, pub PrivilegeCount: u32, pub ModifiedId: super::Foundation::LUID, } #[cfg(feature = "Win32_Foundation")] impl TOKEN_STATISTICS {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for TOKEN_STATISTICS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for TOKEN_STATISTICS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_STATISTICS") .field("TokenId", &self.TokenId) .field("AuthenticationId", &self.AuthenticationId) .field("ExpirationTime", &self.ExpirationTime) .field("TokenType", &self.TokenType) .field("ImpersonationLevel", &self.ImpersonationLevel) .field("DynamicCharged", &self.DynamicCharged) .field("DynamicAvailable", &self.DynamicAvailable) .field("GroupCount", &self.GroupCount) .field("PrivilegeCount", &self.PrivilegeCount) .field("ModifiedId", &self.ModifiedId) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for TOKEN_STATISTICS { fn eq(&self, other: &Self) -> bool { self.TokenId == other.TokenId && self.AuthenticationId == other.AuthenticationId && self.ExpirationTime == other.ExpirationTime && self.TokenType == other.TokenType && self.ImpersonationLevel == other.ImpersonationLevel && self.DynamicCharged == other.DynamicCharged && self.DynamicAvailable == other.DynamicAvailable && self.GroupCount == other.GroupCount && self.PrivilegeCount == other.PrivilegeCount && self.ModifiedId == other.ModifiedId } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for TOKEN_STATISTICS {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for TOKEN_STATISTICS { 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 TOKEN_TYPE(pub i32); pub const TokenPrimary: TOKEN_TYPE = TOKEN_TYPE(1i32); pub const TokenImpersonation: TOKEN_TYPE = TOKEN_TYPE(2i32); impl ::core::convert::From<i32> for TOKEN_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TOKEN_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct TOKEN_USER { pub User: SID_AND_ATTRIBUTES, } #[cfg(feature = "Win32_Foundation")] impl TOKEN_USER {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for TOKEN_USER { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for TOKEN_USER { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_USER").field("User", &self.User).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for TOKEN_USER { fn eq(&self, other: &Self) -> bool { self.User == other.User } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for TOKEN_USER {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for TOKEN_USER { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct TOKEN_USER_CLAIMS { pub UserClaims: *mut ::core::ffi::c_void, } impl TOKEN_USER_CLAIMS {} impl ::core::default::Default for TOKEN_USER_CLAIMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for TOKEN_USER_CLAIMS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TOKEN_USER_CLAIMS").field("UserClaims", &self.UserClaims).finish() } } impl ::core::cmp::PartialEq for TOKEN_USER_CLAIMS { fn eq(&self, other: &Self) -> bool { self.UserClaims == other.UserClaims } } impl ::core::cmp::Eq for TOKEN_USER_CLAIMS {} unsafe impl ::windows::core::Abi for TOKEN_USER_CLAIMS { 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 WELL_KNOWN_SID_TYPE(pub i32); pub const WinNullSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(0i32); pub const WinWorldSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(1i32); pub const WinLocalSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(2i32); pub const WinCreatorOwnerSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(3i32); pub const WinCreatorGroupSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(4i32); pub const WinCreatorOwnerServerSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(5i32); pub const WinCreatorGroupServerSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(6i32); pub const WinNtAuthoritySid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(7i32); pub const WinDialupSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(8i32); pub const WinNetworkSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(9i32); pub const WinBatchSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(10i32); pub const WinInteractiveSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(11i32); pub const WinServiceSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(12i32); pub const WinAnonymousSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(13i32); pub const WinProxySid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(14i32); pub const WinEnterpriseControllersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(15i32); pub const WinSelfSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(16i32); pub const WinAuthenticatedUserSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(17i32); pub const WinRestrictedCodeSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(18i32); pub const WinTerminalServerSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(19i32); pub const WinRemoteLogonIdSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(20i32); pub const WinLogonIdsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(21i32); pub const WinLocalSystemSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(22i32); pub const WinLocalServiceSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(23i32); pub const WinNetworkServiceSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(24i32); pub const WinBuiltinDomainSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(25i32); pub const WinBuiltinAdministratorsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(26i32); pub const WinBuiltinUsersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(27i32); pub const WinBuiltinGuestsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(28i32); pub const WinBuiltinPowerUsersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(29i32); pub const WinBuiltinAccountOperatorsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(30i32); pub const WinBuiltinSystemOperatorsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(31i32); pub const WinBuiltinPrintOperatorsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(32i32); pub const WinBuiltinBackupOperatorsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(33i32); pub const WinBuiltinReplicatorSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(34i32); pub const WinBuiltinPreWindows2000CompatibleAccessSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(35i32); pub const WinBuiltinRemoteDesktopUsersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(36i32); pub const WinBuiltinNetworkConfigurationOperatorsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(37i32); pub const WinAccountAdministratorSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(38i32); pub const WinAccountGuestSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(39i32); pub const WinAccountKrbtgtSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(40i32); pub const WinAccountDomainAdminsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(41i32); pub const WinAccountDomainUsersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(42i32); pub const WinAccountDomainGuestsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(43i32); pub const WinAccountComputersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(44i32); pub const WinAccountControllersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(45i32); pub const WinAccountCertAdminsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(46i32); pub const WinAccountSchemaAdminsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(47i32); pub const WinAccountEnterpriseAdminsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(48i32); pub const WinAccountPolicyAdminsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(49i32); pub const WinAccountRasAndIasServersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(50i32); pub const WinNTLMAuthenticationSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(51i32); pub const WinDigestAuthenticationSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(52i32); pub const WinSChannelAuthenticationSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(53i32); pub const WinThisOrganizationSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(54i32); pub const WinOtherOrganizationSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(55i32); pub const WinBuiltinIncomingForestTrustBuildersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(56i32); pub const WinBuiltinPerfMonitoringUsersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(57i32); pub const WinBuiltinPerfLoggingUsersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(58i32); pub const WinBuiltinAuthorizationAccessSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(59i32); pub const WinBuiltinTerminalServerLicenseServersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(60i32); pub const WinBuiltinDCOMUsersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(61i32); pub const WinBuiltinIUsersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(62i32); pub const WinIUserSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(63i32); pub const WinBuiltinCryptoOperatorsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(64i32); pub const WinUntrustedLabelSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(65i32); pub const WinLowLabelSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(66i32); pub const WinMediumLabelSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(67i32); pub const WinHighLabelSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(68i32); pub const WinSystemLabelSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(69i32); pub const WinWriteRestrictedCodeSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(70i32); pub const WinCreatorOwnerRightsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(71i32); pub const WinCacheablePrincipalsGroupSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(72i32); pub const WinNonCacheablePrincipalsGroupSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(73i32); pub const WinEnterpriseReadonlyControllersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(74i32); pub const WinAccountReadonlyControllersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(75i32); pub const WinBuiltinEventLogReadersGroup: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(76i32); pub const WinNewEnterpriseReadonlyControllersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(77i32); pub const WinBuiltinCertSvcDComAccessGroup: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(78i32); pub const WinMediumPlusLabelSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(79i32); pub const WinLocalLogonSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(80i32); pub const WinConsoleLogonSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(81i32); pub const WinThisOrganizationCertificateSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(82i32); pub const WinApplicationPackageAuthoritySid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(83i32); pub const WinBuiltinAnyPackageSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(84i32); pub const WinCapabilityInternetClientSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(85i32); pub const WinCapabilityInternetClientServerSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(86i32); pub const WinCapabilityPrivateNetworkClientServerSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(87i32); pub const WinCapabilityPicturesLibrarySid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(88i32); pub const WinCapabilityVideosLibrarySid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(89i32); pub const WinCapabilityMusicLibrarySid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(90i32); pub const WinCapabilityDocumentsLibrarySid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(91i32); pub const WinCapabilitySharedUserCertificatesSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(92i32); pub const WinCapabilityEnterpriseAuthenticationSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(93i32); pub const WinCapabilityRemovableStorageSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(94i32); pub const WinBuiltinRDSRemoteAccessServersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(95i32); pub const WinBuiltinRDSEndpointServersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(96i32); pub const WinBuiltinRDSManagementServersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(97i32); pub const WinUserModeDriversSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(98i32); pub const WinBuiltinHyperVAdminsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(99i32); pub const WinAccountCloneableControllersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(100i32); pub const WinBuiltinAccessControlAssistanceOperatorsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(101i32); pub const WinBuiltinRemoteManagementUsersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(102i32); pub const WinAuthenticationAuthorityAssertedSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(103i32); pub const WinAuthenticationServiceAssertedSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(104i32); pub const WinLocalAccountSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(105i32); pub const WinLocalAccountAndAdministratorSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(106i32); pub const WinAccountProtectedUsersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(107i32); pub const WinCapabilityAppointmentsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(108i32); pub const WinCapabilityContactsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(109i32); pub const WinAccountDefaultSystemManagedSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(110i32); pub const WinBuiltinDefaultSystemManagedGroupSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(111i32); pub const WinBuiltinStorageReplicaAdminsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(112i32); pub const WinAccountKeyAdminsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(113i32); pub const WinAccountEnterpriseKeyAdminsSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(114i32); pub const WinAuthenticationKeyTrustSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(115i32); pub const WinAuthenticationKeyPropertyMFASid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(116i32); pub const WinAuthenticationKeyPropertyAttestationSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(117i32); pub const WinAuthenticationFreshKeyAuthSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(118i32); pub const WinBuiltinDeviceOwnersSid: WELL_KNOWN_SID_TYPE = WELL_KNOWN_SID_TYPE(119i32); impl ::core::convert::From<i32> for WELL_KNOWN_SID_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for WELL_KNOWN_SID_TYPE { type Abi = Self; }
#![allow(unused)] #![allow(unused_imports)] #![allow(dead_code)] pub mod reverse_resolver; pub mod service; pub mod upsert_util; pub mod upserter;
use super::{PositionIterInternal, PyGenericAlias, PyStrRef, PyType, PyTypeRef}; use crate::common::{hash::PyHash, lock::PyMutex}; use crate::object::{Traverse, TraverseFn}; use crate::{ atomic_func, class::PyClassImpl, convert::{ToPyObject, TransmuteFromObject}, function::{ArgSize, OptionalArg, PyArithmeticValue, PyComparisonValue}, iter::PyExactSizeIterator, protocol::{PyIterReturn, PyMappingMethods, PySequenceMethods}, recursion::ReprGuard, sequence::{OptionalRangeArgs, SequenceExt}, sliceable::{SequenceIndex, SliceableSequenceOp}, types::{ AsMapping, AsSequence, Comparable, Constructor, Hashable, IterNext, Iterable, PyComparisonOp, Representable, SelfIter, Unconstructible, }, utils::collection_repr, vm::VirtualMachine, AsObject, Context, Py, PyObject, PyObjectRef, PyPayload, PyRef, PyResult, TryFromObject, }; use once_cell::sync::Lazy; use std::{fmt, marker::PhantomData}; #[pyclass(module = false, name = "tuple", traverse)] pub struct PyTuple { elements: Box<[PyObjectRef]>, } impl fmt::Debug for PyTuple { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { // TODO: implement more informational, non-recursive Debug formatter f.write_str("tuple") } } impl PyPayload for PyTuple { fn class(ctx: &Context) -> &'static Py<PyType> { ctx.types.tuple_type } } pub trait IntoPyTuple { fn into_pytuple(self, vm: &VirtualMachine) -> PyTupleRef; } impl IntoPyTuple for () { fn into_pytuple(self, vm: &VirtualMachine) -> PyTupleRef { vm.ctx.empty_tuple.clone() } } impl IntoPyTuple for Vec<PyObjectRef> { fn into_pytuple(self, vm: &VirtualMachine) -> PyTupleRef { PyTuple::new_ref(self, &vm.ctx) } } macro_rules! impl_into_pyobj_tuple { ($(($T:ident, $idx:tt)),+) => { impl<$($T: ToPyObject),*> IntoPyTuple for ($($T,)*) { fn into_pytuple(self, vm: &VirtualMachine) -> PyTupleRef { PyTuple::new_ref(vec![$(self.$idx.to_pyobject(vm)),*], &vm.ctx) } } impl<$($T: ToPyObject),*> ToPyObject for ($($T,)*) { fn to_pyobject(self, vm: &VirtualMachine) -> PyObjectRef { self.into_pytuple(vm).into() } } }; } impl_into_pyobj_tuple!((A, 0)); impl_into_pyobj_tuple!((A, 0), (B, 1)); impl_into_pyobj_tuple!((A, 0), (B, 1), (C, 2)); impl_into_pyobj_tuple!((A, 0), (B, 1), (C, 2), (D, 3)); impl_into_pyobj_tuple!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4)); impl_into_pyobj_tuple!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5)); impl_into_pyobj_tuple!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6)); impl PyTuple { pub(crate) fn fast_getitem(&self, idx: usize) -> PyObjectRef { self.elements[idx].clone() } } pub type PyTupleRef = PyRef<PyTuple>; impl Constructor for PyTuple { type Args = OptionalArg<PyObjectRef>; fn py_new(cls: PyTypeRef, iterable: Self::Args, vm: &VirtualMachine) -> PyResult { let elements = if let OptionalArg::Present(iterable) = iterable { let iterable = if cls.is(vm.ctx.types.tuple_type) { match iterable.downcast_exact::<Self>(vm) { Ok(tuple) => return Ok(tuple.into_pyref().into()), Err(iterable) => iterable, } } else { iterable }; iterable.try_to_value(vm)? } else { vec![] }; // Return empty tuple only for exact tuple types if the iterable is empty. if elements.is_empty() && cls.is(vm.ctx.types.tuple_type) { Ok(vm.ctx.empty_tuple.clone().into()) } else { Self { elements: elements.into_boxed_slice(), } .into_ref_with_type(vm, cls) .map(Into::into) } } } impl AsRef<[PyObjectRef]> for PyTuple { fn as_ref(&self) -> &[PyObjectRef] { self.as_slice() } } impl std::ops::Deref for PyTuple { type Target = [PyObjectRef]; fn deref(&self) -> &[PyObjectRef] { self.as_slice() } } impl<'a> std::iter::IntoIterator for &'a PyTuple { type Item = &'a PyObjectRef; type IntoIter = std::slice::Iter<'a, PyObjectRef>; fn into_iter(self) -> Self::IntoIter { self.iter() } } impl<'a> std::iter::IntoIterator for &'a Py<PyTuple> { type Item = &'a PyObjectRef; type IntoIter = std::slice::Iter<'a, PyObjectRef>; fn into_iter(self) -> Self::IntoIter { self.iter() } } impl PyTuple { pub fn new_ref(elements: Vec<PyObjectRef>, ctx: &Context) -> PyRef<Self> { if elements.is_empty() { ctx.empty_tuple.clone() } else { let elements = elements.into_boxed_slice(); PyRef::new_ref(Self { elements }, ctx.types.tuple_type.to_owned(), None) } } /// Creating a new tuple with given boxed slice. /// NOTE: for usual case, you probably want to use PyTuple::new_ref. /// Calling this function implies trying micro optimization for non-zero-sized tuple. pub fn new_unchecked(elements: Box<[PyObjectRef]>) -> Self { Self { elements } } pub fn as_slice(&self) -> &[PyObjectRef] { &self.elements } fn repeat(zelf: PyRef<Self>, value: isize, vm: &VirtualMachine) -> PyResult<PyRef<Self>> { Ok(if zelf.elements.is_empty() || value == 0 { vm.ctx.empty_tuple.clone() } else if value == 1 && zelf.class().is(vm.ctx.types.tuple_type) { // Special case: when some `tuple` is multiplied by `1`, // nothing really happens, we need to return an object itself // with the same `id()` to be compatible with CPython. // This only works for `tuple` itself, not its subclasses. zelf } else { let v = zelf.elements.mul(vm, value)?; let elements = v.into_boxed_slice(); Self { elements }.into_ref(&vm.ctx) }) } } #[pyclass( flags(BASETYPE), with( AsMapping, AsSequence, Hashable, Comparable, Iterable, Constructor, Representable ) )] impl PyTuple { #[pymethod(magic)] fn add( zelf: PyRef<Self>, other: PyObjectRef, vm: &VirtualMachine, ) -> PyArithmeticValue<PyRef<Self>> { let added = other.downcast::<Self>().map(|other| { if other.elements.is_empty() && zelf.class().is(vm.ctx.types.tuple_type) { zelf } else if zelf.elements.is_empty() && other.class().is(vm.ctx.types.tuple_type) { other } else { let elements = zelf .iter() .chain(other.as_slice()) .cloned() .collect::<Box<[_]>>(); Self { elements }.into_ref(&vm.ctx) } }); PyArithmeticValue::from_option(added.ok()) } #[pymethod(magic)] fn bool(&self) -> bool { !self.elements.is_empty() } #[pymethod] fn count(&self, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult<usize> { let mut count: usize = 0; for element in self { if vm.identical_or_equal(element, &needle)? { count += 1; } } Ok(count) } #[pymethod(magic)] #[inline] pub fn len(&self) -> usize { self.elements.len() } #[inline] pub fn is_empty(&self) -> bool { self.elements.is_empty() } #[pymethod(name = "__rmul__")] #[pymethod(magic)] fn mul(zelf: PyRef<Self>, value: ArgSize, vm: &VirtualMachine) -> PyResult<PyRef<Self>> { Self::repeat(zelf, value.into(), vm) } fn _getitem(&self, needle: &PyObject, vm: &VirtualMachine) -> PyResult { match SequenceIndex::try_from_borrowed_object(vm, needle, "tuple")? { SequenceIndex::Int(i) => self.elements.getitem_by_index(vm, i), SequenceIndex::Slice(slice) => self .elements .getitem_by_slice(vm, slice) .map(|x| vm.ctx.new_tuple(x).into()), } } #[pymethod(magic)] fn getitem(&self, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult { self._getitem(&needle, vm) } #[pymethod] fn index( &self, needle: PyObjectRef, range: OptionalRangeArgs, vm: &VirtualMachine, ) -> PyResult<usize> { let (start, stop) = range.saturate(self.len(), vm)?; for (index, element) in self.elements.iter().enumerate().take(stop).skip(start) { if vm.identical_or_equal(element, &needle)? { return Ok(index); } } Err(vm.new_value_error("tuple.index(x): x not in tuple".to_owned())) } fn _contains(&self, needle: &PyObject, vm: &VirtualMachine) -> PyResult<bool> { for element in self.elements.iter() { if vm.identical_or_equal(element, needle)? { return Ok(true); } } Ok(false) } #[pymethod(magic)] fn contains(&self, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult<bool> { self._contains(&needle, vm) } #[pymethod(magic)] fn getnewargs(zelf: PyRef<Self>, vm: &VirtualMachine) -> (PyTupleRef,) { // the arguments to pass to tuple() is just one tuple - so we'll be doing tuple(tup), which // should just return tup, or tuplesubclass(tup), which'll copy/validate (e.g. for a // structseq) let tup_arg = if zelf.class().is(vm.ctx.types.tuple_type) { zelf } else { PyTuple::new_ref(zelf.elements.clone().into_vec(), &vm.ctx) }; (tup_arg,) } #[pyclassmethod(magic)] fn class_getitem(cls: PyTypeRef, args: PyObjectRef, vm: &VirtualMachine) -> PyGenericAlias { PyGenericAlias::new(cls, args, vm) } } impl AsMapping for PyTuple { fn as_mapping() -> &'static PyMappingMethods { static AS_MAPPING: Lazy<PyMappingMethods> = Lazy::new(|| PyMappingMethods { length: atomic_func!(|mapping, _vm| Ok(PyTuple::mapping_downcast(mapping).len())), subscript: atomic_func!( |mapping, needle, vm| PyTuple::mapping_downcast(mapping)._getitem(needle, vm) ), ..PyMappingMethods::NOT_IMPLEMENTED }); &AS_MAPPING } } impl AsSequence for PyTuple { fn as_sequence() -> &'static PySequenceMethods { static AS_SEQUENCE: Lazy<PySequenceMethods> = Lazy::new(|| PySequenceMethods { length: atomic_func!(|seq, _vm| Ok(PyTuple::sequence_downcast(seq).len())), concat: atomic_func!(|seq, other, vm| { let zelf = PyTuple::sequence_downcast(seq); match PyTuple::add(zelf.to_owned(), other.to_owned(), vm) { PyArithmeticValue::Implemented(tuple) => Ok(tuple.into()), PyArithmeticValue::NotImplemented => Err(vm.new_type_error(format!( "can only concatenate tuple (not '{}') to tuple", other.class().name() ))), } }), repeat: atomic_func!(|seq, n, vm| { let zelf = PyTuple::sequence_downcast(seq); PyTuple::repeat(zelf.to_owned(), n, vm).map(|x| x.into()) }), item: atomic_func!(|seq, i, vm| { let zelf = PyTuple::sequence_downcast(seq); zelf.elements.getitem_by_index(vm, i) }), contains: atomic_func!(|seq, needle, vm| { let zelf = PyTuple::sequence_downcast(seq); zelf._contains(needle, vm) }), ..PySequenceMethods::NOT_IMPLEMENTED }); &AS_SEQUENCE } } impl Hashable for PyTuple { #[inline] fn hash(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyHash> { tuple_hash(zelf.as_slice(), vm) } } impl Comparable for PyTuple { fn cmp( zelf: &Py<Self>, other: &PyObject, op: PyComparisonOp, vm: &VirtualMachine, ) -> PyResult<PyComparisonValue> { if let Some(res) = op.identical_optimization(zelf, other) { return Ok(res.into()); } let other = class_or_notimplemented!(Self, other); zelf.iter() .richcompare(other.iter(), op, vm) .map(PyComparisonValue::Implemented) } } impl Iterable for PyTuple { fn iter(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult { Ok(PyTupleIterator { internal: PyMutex::new(PositionIterInternal::new(zelf, 0)), } .into_pyobject(vm)) } } impl Representable for PyTuple { #[inline] fn repr(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyStrRef> { let s = if zelf.len() == 0 { vm.ctx.intern_str("()").to_owned() } else if let Some(_guard) = ReprGuard::enter(vm, zelf.as_object()) { let s = if zelf.len() == 1 { format!("({},)", zelf.elements[0].repr(vm)?) } else { collection_repr(None, "(", ")", zelf.elements.iter(), vm)? }; vm.ctx.new_str(s) } else { vm.ctx.intern_str("(...)").to_owned() }; Ok(s) } #[cold] fn repr_str(_zelf: &Py<Self>, _vm: &VirtualMachine) -> PyResult<String> { unreachable!("use repr instead") } } #[pyclass(module = false, name = "tuple_iterator", traverse)] #[derive(Debug)] pub(crate) struct PyTupleIterator { internal: PyMutex<PositionIterInternal<PyTupleRef>>, } impl PyPayload for PyTupleIterator { fn class(ctx: &Context) -> &'static Py<PyType> { ctx.types.tuple_iterator_type } } #[pyclass(with(Constructor, IterNext, Iterable))] impl PyTupleIterator { #[pymethod(magic)] fn length_hint(&self) -> usize { self.internal.lock().length_hint(|obj| obj.len()) } #[pymethod(magic)] fn setstate(&self, state: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { self.internal .lock() .set_state(state, |obj, pos| pos.min(obj.len()), vm) } #[pymethod(magic)] fn reduce(&self, vm: &VirtualMachine) -> PyTupleRef { self.internal .lock() .builtins_iter_reduce(|x| x.clone().into(), vm) } } impl Unconstructible for PyTupleIterator {} impl SelfIter for PyTupleIterator {} impl IterNext for PyTupleIterator { fn next(zelf: &Py<Self>, _vm: &VirtualMachine) -> PyResult<PyIterReturn> { zelf.internal.lock().next(|tuple, pos| { Ok(PyIterReturn::from_result( tuple.get(pos).cloned().ok_or(None), )) }) } } pub(crate) fn init(context: &Context) { PyTuple::extend_class(context, context.types.tuple_type); PyTupleIterator::extend_class(context, context.types.tuple_iterator_type); } pub struct PyTupleTyped<T: TransmuteFromObject> { // SAFETY INVARIANT: T must be repr(transparent) over PyObjectRef, and the // elements must be logically valid when transmuted to T tuple: PyTupleRef, _marker: PhantomData<Vec<T>>, } unsafe impl<T> Traverse for PyTupleTyped<T> where T: TransmuteFromObject + Traverse, { fn traverse(&self, tracer_fn: &mut TraverseFn) { self.tuple.traverse(tracer_fn); } } impl<T: TransmuteFromObject> TryFromObject for PyTupleTyped<T> { fn try_from_object(vm: &VirtualMachine, obj: PyObjectRef) -> PyResult<Self> { let tuple = PyTupleRef::try_from_object(vm, obj)?; for elem in &*tuple { T::check(vm, elem)? } // SAFETY: the contract of TransmuteFromObject upholds the variant on `tuple` Ok(Self { tuple, _marker: PhantomData, }) } } impl<T: TransmuteFromObject> AsRef<[T]> for PyTupleTyped<T> { fn as_ref(&self) -> &[T] { self.as_slice() } } impl<T: TransmuteFromObject> PyTupleTyped<T> { #[inline] pub fn as_slice(&self) -> &[T] { unsafe { &*(self.tuple.as_slice() as *const [PyObjectRef] as *const [T]) } } #[inline] pub fn len(&self) -> usize { self.tuple.len() } #[inline] pub fn is_empty(&self) -> bool { self.tuple.is_empty() } } impl<T: TransmuteFromObject> Clone for PyTupleTyped<T> { fn clone(&self) -> Self { Self { tuple: self.tuple.clone(), _marker: PhantomData, } } } impl<T: TransmuteFromObject + fmt::Debug> fmt::Debug for PyTupleTyped<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.as_slice().fmt(f) } } impl<T: TransmuteFromObject> From<PyTupleTyped<T>> for PyTupleRef { #[inline] fn from(tup: PyTupleTyped<T>) -> Self { tup.tuple } } impl<T: TransmuteFromObject> ToPyObject for PyTupleTyped<T> { #[inline] fn to_pyobject(self, _vm: &VirtualMachine) -> PyObjectRef { self.tuple.into() } } pub(super) fn tuple_hash(elements: &[PyObjectRef], vm: &VirtualMachine) -> PyResult<PyHash> { // TODO: See #3460 for the correct implementation. // https://github.com/RustPython/RustPython/pull/3460 crate::utils::hash_iter(elements.iter(), vm) }
#[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn BackupEventLogA ( heventlog : EventLogHandle , lpbackupfilename : ::windows_sys::core::PCSTR ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn BackupEventLogW ( heventlog : EventLogHandle , lpbackupfilename : ::windows_sys::core::PCWSTR ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn ClearEventLogA ( heventlog : EventLogHandle , lpbackupfilename : ::windows_sys::core::PCSTR ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn ClearEventLogW ( heventlog : EventLogHandle , lpbackupfilename : ::windows_sys::core::PCWSTR ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn CloseEventLog ( heventlog : EventLogHandle ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn DeregisterEventSource ( heventlog : EventSourceHandle ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtArchiveExportedLog ( session : EVT_HANDLE , logfilepath : ::windows_sys::core::PCWSTR , locale : u32 , flags : u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtCancel ( object : EVT_HANDLE ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtClearLog ( session : EVT_HANDLE , channelpath : ::windows_sys::core::PCWSTR , targetfilepath : ::windows_sys::core::PCWSTR , flags : u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtClose ( object : EVT_HANDLE ) -> super::super::Foundation:: BOOL ); ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn EvtCreateBookmark ( bookmarkxml : ::windows_sys::core::PCWSTR ) -> EVT_HANDLE ); ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn EvtCreateRenderContext ( valuepathscount : u32 , valuepaths : *const ::windows_sys::core::PCWSTR , flags : u32 ) -> EVT_HANDLE ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtExportLog ( session : EVT_HANDLE , path : ::windows_sys::core::PCWSTR , query : ::windows_sys::core::PCWSTR , targetfilepath : ::windows_sys::core::PCWSTR , flags : u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtFormatMessage ( publishermetadata : EVT_HANDLE , event : EVT_HANDLE , messageid : u32 , valuecount : u32 , values : *const EVT_VARIANT , flags : u32 , buffersize : u32 , buffer : ::windows_sys::core::PWSTR , bufferused : *mut u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtGetChannelConfigProperty ( channelconfig : EVT_HANDLE , propertyid : EVT_CHANNEL_CONFIG_PROPERTY_ID , flags : u32 , propertyvaluebuffersize : u32 , propertyvaluebuffer : *mut EVT_VARIANT , propertyvaluebufferused : *mut u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtGetEventInfo ( event : EVT_HANDLE , propertyid : EVT_EVENT_PROPERTY_ID , propertyvaluebuffersize : u32 , propertyvaluebuffer : *mut EVT_VARIANT , propertyvaluebufferused : *mut u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtGetEventMetadataProperty ( eventmetadata : EVT_HANDLE , propertyid : EVT_EVENT_METADATA_PROPERTY_ID , flags : u32 , eventmetadatapropertybuffersize : u32 , eventmetadatapropertybuffer : *mut EVT_VARIANT , eventmetadatapropertybufferused : *mut u32 ) -> super::super::Foundation:: BOOL ); ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn EvtGetExtendedStatus ( buffersize : u32 , buffer : ::windows_sys::core::PWSTR , bufferused : *mut u32 ) -> u32 ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtGetLogInfo ( log : EVT_HANDLE , propertyid : EVT_LOG_PROPERTY_ID , propertyvaluebuffersize : u32 , propertyvaluebuffer : *mut EVT_VARIANT , propertyvaluebufferused : *mut u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtGetObjectArrayProperty ( objectarray : isize , propertyid : u32 , arrayindex : u32 , flags : u32 , propertyvaluebuffersize : u32 , propertyvaluebuffer : *mut EVT_VARIANT , propertyvaluebufferused : *mut u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtGetObjectArraySize ( objectarray : isize , objectarraysize : *mut u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtGetPublisherMetadataProperty ( publishermetadata : EVT_HANDLE , propertyid : EVT_PUBLISHER_METADATA_PROPERTY_ID , flags : u32 , publishermetadatapropertybuffersize : u32 , publishermetadatapropertybuffer : *mut EVT_VARIANT , publishermetadatapropertybufferused : *mut u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtGetQueryInfo ( queryorsubscription : EVT_HANDLE , propertyid : EVT_QUERY_PROPERTY_ID , propertyvaluebuffersize : u32 , propertyvaluebuffer : *mut EVT_VARIANT , propertyvaluebufferused : *mut u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtNext ( resultset : EVT_HANDLE , eventssize : u32 , events : *mut isize , timeout : u32 , flags : u32 , returned : *mut u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtNextChannelPath ( channelenum : EVT_HANDLE , channelpathbuffersize : u32 , channelpathbuffer : ::windows_sys::core::PWSTR , channelpathbufferused : *mut u32 ) -> super::super::Foundation:: BOOL ); ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn EvtNextEventMetadata ( eventmetadataenum : EVT_HANDLE , flags : u32 ) -> EVT_HANDLE ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtNextPublisherId ( publisherenum : EVT_HANDLE , publisheridbuffersize : u32 , publisheridbuffer : ::windows_sys::core::PWSTR , publisheridbufferused : *mut u32 ) -> super::super::Foundation:: BOOL ); ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn EvtOpenChannelConfig ( session : EVT_HANDLE , channelpath : ::windows_sys::core::PCWSTR , flags : u32 ) -> EVT_HANDLE ); ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn EvtOpenChannelEnum ( session : EVT_HANDLE , flags : u32 ) -> EVT_HANDLE ); ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn EvtOpenEventMetadataEnum ( publishermetadata : EVT_HANDLE , flags : u32 ) -> EVT_HANDLE ); ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn EvtOpenLog ( session : EVT_HANDLE , path : ::windows_sys::core::PCWSTR , flags : u32 ) -> EVT_HANDLE ); ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn EvtOpenPublisherEnum ( session : EVT_HANDLE , flags : u32 ) -> EVT_HANDLE ); ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn EvtOpenPublisherMetadata ( session : EVT_HANDLE , publisherid : ::windows_sys::core::PCWSTR , logfilepath : ::windows_sys::core::PCWSTR , locale : u32 , flags : u32 ) -> EVT_HANDLE ); ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn EvtOpenSession ( loginclass : EVT_LOGIN_CLASS , login : *const ::core::ffi::c_void , timeout : u32 , flags : u32 ) -> EVT_HANDLE ); ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn EvtQuery ( session : EVT_HANDLE , path : ::windows_sys::core::PCWSTR , query : ::windows_sys::core::PCWSTR , flags : u32 ) -> EVT_HANDLE ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtRender ( context : EVT_HANDLE , fragment : EVT_HANDLE , flags : u32 , buffersize : u32 , buffer : *mut ::core::ffi::c_void , bufferused : *mut u32 , propertycount : *mut u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtSaveChannelConfig ( channelconfig : EVT_HANDLE , flags : u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtSeek ( resultset : EVT_HANDLE , position : i64 , bookmark : EVT_HANDLE , timeout : u32 , flags : u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtSetChannelConfigProperty ( channelconfig : EVT_HANDLE , propertyid : EVT_CHANNEL_CONFIG_PROPERTY_ID , flags : u32 , propertyvalue : *const EVT_VARIANT ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtSubscribe ( session : EVT_HANDLE , signalevent : super::super::Foundation:: HANDLE , channelpath : ::windows_sys::core::PCWSTR , query : ::windows_sys::core::PCWSTR , bookmark : EVT_HANDLE , context : *const ::core::ffi::c_void , callback : EVT_SUBSCRIBE_CALLBACK , flags : u32 ) -> EVT_HANDLE ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "wevtapi.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn EvtUpdateBookmark ( bookmark : EVT_HANDLE , event : EVT_HANDLE ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn GetEventLogInformation ( heventlog : EventLogHandle , dwinfolevel : u32 , lpbuffer : *mut ::core::ffi::c_void , cbbufsize : u32 , pcbbytesneeded : *mut u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn GetNumberOfEventLogRecords ( heventlog : EventLogHandle , numberofrecords : *mut u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn GetOldestEventLogRecord ( heventlog : EventLogHandle , oldestrecord : *mut u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn NotifyChangeEventLog ( heventlog : EventLogHandle , hevent : super::super::Foundation:: HANDLE ) -> super::super::Foundation:: BOOL ); ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn OpenBackupEventLogA ( lpuncservername : ::windows_sys::core::PCSTR , lpfilename : ::windows_sys::core::PCSTR ) -> EventLogHandle ); ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn OpenBackupEventLogW ( lpuncservername : ::windows_sys::core::PCWSTR , lpfilename : ::windows_sys::core::PCWSTR ) -> EventLogHandle ); ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn OpenEventLogA ( lpuncservername : ::windows_sys::core::PCSTR , lpsourcename : ::windows_sys::core::PCSTR ) -> EventLogHandle ); ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn OpenEventLogW ( lpuncservername : ::windows_sys::core::PCWSTR , lpsourcename : ::windows_sys::core::PCWSTR ) -> EventLogHandle ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn ReadEventLogA ( heventlog : EventLogHandle , dwreadflags : READ_EVENT_LOG_READ_FLAGS , dwrecordoffset : u32 , lpbuffer : *mut ::core::ffi::c_void , nnumberofbytestoread : u32 , pnbytesread : *mut u32 , pnminnumberofbytesneeded : *mut u32 ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn ReadEventLogW ( heventlog : EventLogHandle , dwreadflags : READ_EVENT_LOG_READ_FLAGS , dwrecordoffset : u32 , lpbuffer : *mut ::core::ffi::c_void , nnumberofbytestoread : u32 , pnbytesread : *mut u32 , pnminnumberofbytesneeded : *mut u32 ) -> super::super::Foundation:: BOOL ); ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn RegisterEventSourceA ( lpuncservername : ::windows_sys::core::PCSTR , lpsourcename : ::windows_sys::core::PCSTR ) -> EventSourceHandle ); ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] fn RegisterEventSourceW ( lpuncservername : ::windows_sys::core::PCWSTR , lpsourcename : ::windows_sys::core::PCWSTR ) -> EventSourceHandle ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn ReportEventA ( heventlog : EventSourceHandle , wtype : REPORT_EVENT_TYPE , wcategory : u16 , dweventid : u32 , lpusersid : super::super::Foundation:: PSID , wnumstrings : u16 , dwdatasize : u32 , lpstrings : *const ::windows_sys::core::PCSTR , lprawdata : *const ::core::ffi::c_void ) -> super::super::Foundation:: BOOL ); #[cfg(feature = "Win32_Foundation")] ::windows_targets::link ! ( "advapi32.dll""system" #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] fn ReportEventW ( heventlog : EventSourceHandle , wtype : REPORT_EVENT_TYPE , wcategory : u16 , dweventid : u32 , lpusersid : super::super::Foundation:: PSID , wnumstrings : u16 , dwdatasize : u32 , lpstrings : *const ::windows_sys::core::PCWSTR , lprawdata : *const ::core::ffi::c_void ) -> super::super::Foundation:: BOOL ); #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EVT_ALL_ACCESS: u32 = 7u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EVT_CLEAR_ACCESS: u32 = 4u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EVT_READ_ACCESS: u32 = 1u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EVT_VARIANT_TYPE_ARRAY: u32 = 128u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EVT_VARIANT_TYPE_MASK: u32 = 127u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EVT_WRITE_ACCESS: u32 = 2u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_CHANNEL_CLOCK_TYPE = i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelClockTypeSystemTime: EVT_CHANNEL_CLOCK_TYPE = 0i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelClockTypeQPC: EVT_CHANNEL_CLOCK_TYPE = 1i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_CHANNEL_CONFIG_PROPERTY_ID = i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelConfigEnabled: EVT_CHANNEL_CONFIG_PROPERTY_ID = 0i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelConfigIsolation: EVT_CHANNEL_CONFIG_PROPERTY_ID = 1i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelConfigType: EVT_CHANNEL_CONFIG_PROPERTY_ID = 2i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelConfigOwningPublisher: EVT_CHANNEL_CONFIG_PROPERTY_ID = 3i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelConfigClassicEventlog: EVT_CHANNEL_CONFIG_PROPERTY_ID = 4i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelConfigAccess: EVT_CHANNEL_CONFIG_PROPERTY_ID = 5i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelLoggingConfigRetention: EVT_CHANNEL_CONFIG_PROPERTY_ID = 6i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelLoggingConfigAutoBackup: EVT_CHANNEL_CONFIG_PROPERTY_ID = 7i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelLoggingConfigMaxSize: EVT_CHANNEL_CONFIG_PROPERTY_ID = 8i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelLoggingConfigLogFilePath: EVT_CHANNEL_CONFIG_PROPERTY_ID = 9i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelPublishingConfigLevel: EVT_CHANNEL_CONFIG_PROPERTY_ID = 10i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelPublishingConfigKeywords: EVT_CHANNEL_CONFIG_PROPERTY_ID = 11i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelPublishingConfigControlGuid: EVT_CHANNEL_CONFIG_PROPERTY_ID = 12i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelPublishingConfigBufferSize: EVT_CHANNEL_CONFIG_PROPERTY_ID = 13i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelPublishingConfigMinBuffers: EVT_CHANNEL_CONFIG_PROPERTY_ID = 14i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelPublishingConfigMaxBuffers: EVT_CHANNEL_CONFIG_PROPERTY_ID = 15i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelPublishingConfigLatency: EVT_CHANNEL_CONFIG_PROPERTY_ID = 16i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelPublishingConfigClockType: EVT_CHANNEL_CONFIG_PROPERTY_ID = 17i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelPublishingConfigSidType: EVT_CHANNEL_CONFIG_PROPERTY_ID = 18i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelPublisherList: EVT_CHANNEL_CONFIG_PROPERTY_ID = 19i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelPublishingConfigFileMax: EVT_CHANNEL_CONFIG_PROPERTY_ID = 20i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelConfigPropertyIdEND: EVT_CHANNEL_CONFIG_PROPERTY_ID = 21i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_CHANNEL_ISOLATION_TYPE = i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelIsolationTypeApplication: EVT_CHANNEL_ISOLATION_TYPE = 0i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelIsolationTypeSystem: EVT_CHANNEL_ISOLATION_TYPE = 1i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelIsolationTypeCustom: EVT_CHANNEL_ISOLATION_TYPE = 2i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_CHANNEL_REFERENCE_FLAGS = u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelReferenceImported: EVT_CHANNEL_REFERENCE_FLAGS = 1u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_CHANNEL_SID_TYPE = i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelSidTypeNone: EVT_CHANNEL_SID_TYPE = 0i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelSidTypePublishing: EVT_CHANNEL_SID_TYPE = 1i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_CHANNEL_TYPE = i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelTypeAdmin: EVT_CHANNEL_TYPE = 0i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelTypeOperational: EVT_CHANNEL_TYPE = 1i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelTypeAnalytic: EVT_CHANNEL_TYPE = 2i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtChannelTypeDebug: EVT_CHANNEL_TYPE = 3i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_EVENT_METADATA_PROPERTY_ID = i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EventMetadataEventID: EVT_EVENT_METADATA_PROPERTY_ID = 0i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EventMetadataEventVersion: EVT_EVENT_METADATA_PROPERTY_ID = 1i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EventMetadataEventChannel: EVT_EVENT_METADATA_PROPERTY_ID = 2i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EventMetadataEventLevel: EVT_EVENT_METADATA_PROPERTY_ID = 3i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EventMetadataEventOpcode: EVT_EVENT_METADATA_PROPERTY_ID = 4i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EventMetadataEventTask: EVT_EVENT_METADATA_PROPERTY_ID = 5i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EventMetadataEventKeyword: EVT_EVENT_METADATA_PROPERTY_ID = 6i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EventMetadataEventMessageID: EVT_EVENT_METADATA_PROPERTY_ID = 7i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EventMetadataEventTemplate: EVT_EVENT_METADATA_PROPERTY_ID = 8i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtEventMetadataPropertyIdEND: EVT_EVENT_METADATA_PROPERTY_ID = 9i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_EVENT_PROPERTY_ID = i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtEventQueryIDs: EVT_EVENT_PROPERTY_ID = 0i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtEventPath: EVT_EVENT_PROPERTY_ID = 1i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtEventPropertyIdEND: EVT_EVENT_PROPERTY_ID = 2i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_EXPORTLOG_FLAGS = u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtExportLogChannelPath: EVT_EXPORTLOG_FLAGS = 1u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtExportLogFilePath: EVT_EXPORTLOG_FLAGS = 2u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtExportLogTolerateQueryErrors: EVT_EXPORTLOG_FLAGS = 4096u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtExportLogOverwrite: EVT_EXPORTLOG_FLAGS = 8192u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_FORMAT_MESSAGE_FLAGS = u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtFormatMessageEvent: EVT_FORMAT_MESSAGE_FLAGS = 1u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtFormatMessageLevel: EVT_FORMAT_MESSAGE_FLAGS = 2u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtFormatMessageTask: EVT_FORMAT_MESSAGE_FLAGS = 3u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtFormatMessageOpcode: EVT_FORMAT_MESSAGE_FLAGS = 4u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtFormatMessageKeyword: EVT_FORMAT_MESSAGE_FLAGS = 5u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtFormatMessageChannel: EVT_FORMAT_MESSAGE_FLAGS = 6u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtFormatMessageProvider: EVT_FORMAT_MESSAGE_FLAGS = 7u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtFormatMessageId: EVT_FORMAT_MESSAGE_FLAGS = 8u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtFormatMessageXml: EVT_FORMAT_MESSAGE_FLAGS = 9u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_LOGIN_CLASS = i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtRpcLogin: EVT_LOGIN_CLASS = 1i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_LOG_PROPERTY_ID = i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtLogCreationTime: EVT_LOG_PROPERTY_ID = 0i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtLogLastAccessTime: EVT_LOG_PROPERTY_ID = 1i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtLogLastWriteTime: EVT_LOG_PROPERTY_ID = 2i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtLogFileSize: EVT_LOG_PROPERTY_ID = 3i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtLogAttributes: EVT_LOG_PROPERTY_ID = 4i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtLogNumberOfLogRecords: EVT_LOG_PROPERTY_ID = 5i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtLogOldestRecordNumber: EVT_LOG_PROPERTY_ID = 6i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtLogFull: EVT_LOG_PROPERTY_ID = 7i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_OPEN_LOG_FLAGS = u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtOpenChannelPath: EVT_OPEN_LOG_FLAGS = 1u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtOpenFilePath: EVT_OPEN_LOG_FLAGS = 2u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_PUBLISHER_METADATA_PROPERTY_ID = i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataPublisherGuid: EVT_PUBLISHER_METADATA_PROPERTY_ID = 0i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataResourceFilePath: EVT_PUBLISHER_METADATA_PROPERTY_ID = 1i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataParameterFilePath: EVT_PUBLISHER_METADATA_PROPERTY_ID = 2i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataMessageFilePath: EVT_PUBLISHER_METADATA_PROPERTY_ID = 3i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataHelpLink: EVT_PUBLISHER_METADATA_PROPERTY_ID = 4i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataPublisherMessageID: EVT_PUBLISHER_METADATA_PROPERTY_ID = 5i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataChannelReferences: EVT_PUBLISHER_METADATA_PROPERTY_ID = 6i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataChannelReferencePath: EVT_PUBLISHER_METADATA_PROPERTY_ID = 7i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataChannelReferenceIndex: EVT_PUBLISHER_METADATA_PROPERTY_ID = 8i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataChannelReferenceID: EVT_PUBLISHER_METADATA_PROPERTY_ID = 9i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataChannelReferenceFlags: EVT_PUBLISHER_METADATA_PROPERTY_ID = 10i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataChannelReferenceMessageID: EVT_PUBLISHER_METADATA_PROPERTY_ID = 11i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataLevels: EVT_PUBLISHER_METADATA_PROPERTY_ID = 12i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataLevelName: EVT_PUBLISHER_METADATA_PROPERTY_ID = 13i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataLevelValue: EVT_PUBLISHER_METADATA_PROPERTY_ID = 14i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataLevelMessageID: EVT_PUBLISHER_METADATA_PROPERTY_ID = 15i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataTasks: EVT_PUBLISHER_METADATA_PROPERTY_ID = 16i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataTaskName: EVT_PUBLISHER_METADATA_PROPERTY_ID = 17i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataTaskEventGuid: EVT_PUBLISHER_METADATA_PROPERTY_ID = 18i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataTaskValue: EVT_PUBLISHER_METADATA_PROPERTY_ID = 19i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataTaskMessageID: EVT_PUBLISHER_METADATA_PROPERTY_ID = 20i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataOpcodes: EVT_PUBLISHER_METADATA_PROPERTY_ID = 21i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataOpcodeName: EVT_PUBLISHER_METADATA_PROPERTY_ID = 22i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataOpcodeValue: EVT_PUBLISHER_METADATA_PROPERTY_ID = 23i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataOpcodeMessageID: EVT_PUBLISHER_METADATA_PROPERTY_ID = 24i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataKeywords: EVT_PUBLISHER_METADATA_PROPERTY_ID = 25i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataKeywordName: EVT_PUBLISHER_METADATA_PROPERTY_ID = 26i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataKeywordValue: EVT_PUBLISHER_METADATA_PROPERTY_ID = 27i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataKeywordMessageID: EVT_PUBLISHER_METADATA_PROPERTY_ID = 28i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtPublisherMetadataPropertyIdEND: EVT_PUBLISHER_METADATA_PROPERTY_ID = 29i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_QUERY_FLAGS = u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtQueryChannelPath: EVT_QUERY_FLAGS = 1u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtQueryFilePath: EVT_QUERY_FLAGS = 2u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtQueryForwardDirection: EVT_QUERY_FLAGS = 256u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtQueryReverseDirection: EVT_QUERY_FLAGS = 512u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtQueryTolerateQueryErrors: EVT_QUERY_FLAGS = 4096u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_QUERY_PROPERTY_ID = i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtQueryNames: EVT_QUERY_PROPERTY_ID = 0i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtQueryStatuses: EVT_QUERY_PROPERTY_ID = 1i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtQueryPropertyIdEND: EVT_QUERY_PROPERTY_ID = 2i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_RENDER_CONTEXT_FLAGS = u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtRenderContextValues: EVT_RENDER_CONTEXT_FLAGS = 0u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtRenderContextSystem: EVT_RENDER_CONTEXT_FLAGS = 1u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtRenderContextUser: EVT_RENDER_CONTEXT_FLAGS = 2u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_RENDER_FLAGS = u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtRenderEventValues: EVT_RENDER_FLAGS = 0u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtRenderEventXml: EVT_RENDER_FLAGS = 1u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtRenderBookmark: EVT_RENDER_FLAGS = 2u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_RPC_LOGIN_FLAGS = u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtRpcLoginAuthDefault: EVT_RPC_LOGIN_FLAGS = 0u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtRpcLoginAuthNegotiate: EVT_RPC_LOGIN_FLAGS = 1u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtRpcLoginAuthKerberos: EVT_RPC_LOGIN_FLAGS = 2u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtRpcLoginAuthNTLM: EVT_RPC_LOGIN_FLAGS = 3u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_SEEK_FLAGS = u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSeekRelativeToFirst: EVT_SEEK_FLAGS = 1u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSeekRelativeToLast: EVT_SEEK_FLAGS = 2u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSeekRelativeToCurrent: EVT_SEEK_FLAGS = 3u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSeekRelativeToBookmark: EVT_SEEK_FLAGS = 4u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSeekOriginMask: EVT_SEEK_FLAGS = 7u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSeekStrict: EVT_SEEK_FLAGS = 65536u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_SUBSCRIBE_FLAGS = u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSubscribeToFutureEvents: EVT_SUBSCRIBE_FLAGS = 1u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSubscribeStartAtOldestRecord: EVT_SUBSCRIBE_FLAGS = 2u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSubscribeStartAfterBookmark: EVT_SUBSCRIBE_FLAGS = 3u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSubscribeOriginMask: EVT_SUBSCRIBE_FLAGS = 3u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSubscribeTolerateQueryErrors: EVT_SUBSCRIBE_FLAGS = 4096u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSubscribeStrict: EVT_SUBSCRIBE_FLAGS = 65536u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_SUBSCRIBE_NOTIFY_ACTION = i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSubscribeActionError: EVT_SUBSCRIBE_NOTIFY_ACTION = 0i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSubscribeActionDeliver: EVT_SUBSCRIBE_NOTIFY_ACTION = 1i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_SYSTEM_PROPERTY_ID = i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemProviderName: EVT_SYSTEM_PROPERTY_ID = 0i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemProviderGuid: EVT_SYSTEM_PROPERTY_ID = 1i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemEventID: EVT_SYSTEM_PROPERTY_ID = 2i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemQualifiers: EVT_SYSTEM_PROPERTY_ID = 3i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemLevel: EVT_SYSTEM_PROPERTY_ID = 4i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemTask: EVT_SYSTEM_PROPERTY_ID = 5i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemOpcode: EVT_SYSTEM_PROPERTY_ID = 6i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemKeywords: EVT_SYSTEM_PROPERTY_ID = 7i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemTimeCreated: EVT_SYSTEM_PROPERTY_ID = 8i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemEventRecordId: EVT_SYSTEM_PROPERTY_ID = 9i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemActivityID: EVT_SYSTEM_PROPERTY_ID = 10i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemRelatedActivityID: EVT_SYSTEM_PROPERTY_ID = 11i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemProcessID: EVT_SYSTEM_PROPERTY_ID = 12i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemThreadID: EVT_SYSTEM_PROPERTY_ID = 13i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemChannel: EVT_SYSTEM_PROPERTY_ID = 14i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemComputer: EVT_SYSTEM_PROPERTY_ID = 15i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemUserID: EVT_SYSTEM_PROPERTY_ID = 16i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemVersion: EVT_SYSTEM_PROPERTY_ID = 17i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtSystemPropertyIdEND: EVT_SYSTEM_PROPERTY_ID = 18i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_VARIANT_TYPE = i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeNull: EVT_VARIANT_TYPE = 0i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeString: EVT_VARIANT_TYPE = 1i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeAnsiString: EVT_VARIANT_TYPE = 2i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeSByte: EVT_VARIANT_TYPE = 3i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeByte: EVT_VARIANT_TYPE = 4i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeInt16: EVT_VARIANT_TYPE = 5i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeUInt16: EVT_VARIANT_TYPE = 6i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeInt32: EVT_VARIANT_TYPE = 7i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeUInt32: EVT_VARIANT_TYPE = 8i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeInt64: EVT_VARIANT_TYPE = 9i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeUInt64: EVT_VARIANT_TYPE = 10i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeSingle: EVT_VARIANT_TYPE = 11i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeDouble: EVT_VARIANT_TYPE = 12i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeBoolean: EVT_VARIANT_TYPE = 13i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeBinary: EVT_VARIANT_TYPE = 14i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeGuid: EVT_VARIANT_TYPE = 15i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeSizeT: EVT_VARIANT_TYPE = 16i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeFileTime: EVT_VARIANT_TYPE = 17i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeSysTime: EVT_VARIANT_TYPE = 18i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeSid: EVT_VARIANT_TYPE = 19i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeHexInt32: EVT_VARIANT_TYPE = 20i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeHexInt64: EVT_VARIANT_TYPE = 21i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeEvtHandle: EVT_VARIANT_TYPE = 32i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EvtVarTypeEvtXml: EVT_VARIANT_TYPE = 35i32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type READ_EVENT_LOG_READ_FLAGS = u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EVENTLOG_SEEK_READ: READ_EVENT_LOG_READ_FLAGS = 2u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EVENTLOG_SEQUENTIAL_READ: READ_EVENT_LOG_READ_FLAGS = 1u32; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type REPORT_EVENT_TYPE = u16; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EVENTLOG_SUCCESS: REPORT_EVENT_TYPE = 0u16; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EVENTLOG_AUDIT_FAILURE: REPORT_EVENT_TYPE = 16u16; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EVENTLOG_AUDIT_SUCCESS: REPORT_EVENT_TYPE = 8u16; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EVENTLOG_ERROR_TYPE: REPORT_EVENT_TYPE = 1u16; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EVENTLOG_INFORMATION_TYPE: REPORT_EVENT_TYPE = 4u16; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub const EVENTLOG_WARNING_TYPE: REPORT_EVENT_TYPE = 2u16; #[repr(C)] #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub struct EVENTLOGRECORD { pub Length: u32, pub Reserved: u32, pub RecordNumber: u32, pub TimeGenerated: u32, pub TimeWritten: u32, pub EventID: u32, pub EventType: REPORT_EVENT_TYPE, pub NumStrings: u16, pub EventCategory: u16, pub ReservedFlags: u16, pub ClosingRecordNumber: u32, pub StringOffset: u32, pub UserSidLength: u32, pub UserSidOffset: u32, pub DataLength: u32, pub DataOffset: u32, } impl ::core::marker::Copy for EVENTLOGRECORD {} impl ::core::clone::Clone for EVENTLOGRECORD { fn clone(&self) -> Self { *self } } #[repr(C)] #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub struct EVENTLOG_FULL_INFORMATION { pub dwFull: u32, } impl ::core::marker::Copy for EVENTLOG_FULL_INFORMATION {} impl ::core::clone::Clone for EVENTLOG_FULL_INFORMATION { fn clone(&self) -> Self { *self } } #[repr(C)] #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub struct EVENTSFORLOGFILE { pub ulSize: u32, pub szLogicalLogFile: [u16; 256], pub ulNumRecords: u32, pub pEventLogRecords: [EVENTLOGRECORD; 1], } impl ::core::marker::Copy for EVENTSFORLOGFILE {} impl ::core::clone::Clone for EVENTSFORLOGFILE { fn clone(&self) -> Self { *self } } pub type EVT_HANDLE = isize; #[repr(C)] #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub struct EVT_RPC_LOGIN { pub Server: ::windows_sys::core::PWSTR, pub User: ::windows_sys::core::PWSTR, pub Domain: ::windows_sys::core::PWSTR, pub Password: ::windows_sys::core::PWSTR, pub Flags: u32, } impl ::core::marker::Copy for EVT_RPC_LOGIN {} impl ::core::clone::Clone for EVT_RPC_LOGIN { fn clone(&self) -> Self { *self } } #[repr(C)] #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] #[cfg(feature = "Win32_Foundation")] pub struct EVT_VARIANT { pub Anonymous: EVT_VARIANT_0, pub Count: u32, pub Type: u32, } #[cfg(feature = "Win32_Foundation")] impl ::core::marker::Copy for EVT_VARIANT {} #[cfg(feature = "Win32_Foundation")] impl ::core::clone::Clone for EVT_VARIANT { fn clone(&self) -> Self { *self } } #[repr(C)] #[doc = "*Required features: `\"Win32_System_EventLog\"`, `\"Win32_Foundation\"`*"] #[cfg(feature = "Win32_Foundation")] pub union EVT_VARIANT_0 { pub BooleanVal: super::super::Foundation::BOOL, pub SByteVal: i8, pub Int16Val: i16, pub Int32Val: i32, pub Int64Val: i64, pub ByteVal: u8, pub UInt16Val: u16, pub UInt32Val: u32, pub UInt64Val: u64, pub SingleVal: f32, pub DoubleVal: f64, pub FileTimeVal: u64, pub SysTimeVal: *mut super::super::Foundation::SYSTEMTIME, pub GuidVal: *mut ::windows_sys::core::GUID, pub StringVal: ::windows_sys::core::PCWSTR, pub AnsiStringVal: ::windows_sys::core::PCSTR, pub BinaryVal: *mut u8, pub SidVal: super::super::Foundation::PSID, pub SizeTVal: usize, pub BooleanArr: *mut super::super::Foundation::BOOL, pub SByteArr: *mut i8, pub Int16Arr: *mut i16, pub Int32Arr: *mut i32, pub Int64Arr: *mut i64, pub ByteArr: *mut u8, pub UInt16Arr: *mut u16, pub UInt32Arr: *mut u32, pub UInt64Arr: *mut u64, pub SingleArr: *mut f32, pub DoubleArr: *mut f64, pub FileTimeArr: *mut super::super::Foundation::FILETIME, pub SysTimeArr: *mut super::super::Foundation::SYSTEMTIME, pub GuidArr: *mut ::windows_sys::core::GUID, pub StringArr: *mut ::windows_sys::core::PWSTR, pub AnsiStringArr: *mut ::windows_sys::core::PSTR, pub SidArr: *mut super::super::Foundation::PSID, pub SizeTArr: *mut usize, pub EvtHandleVal: EVT_HANDLE, pub XmlVal: ::windows_sys::core::PCWSTR, pub XmlValArr: *const ::windows_sys::core::PCWSTR, } #[cfg(feature = "Win32_Foundation")] impl ::core::marker::Copy for EVT_VARIANT_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::clone::Clone for EVT_VARIANT_0 { fn clone(&self) -> Self { *self } } pub type EventLogHandle = isize; pub type EventSourceHandle = isize; #[doc = "*Required features: `\"Win32_System_EventLog\"`*"] pub type EVT_SUBSCRIBE_CALLBACK = ::core::option::Option<unsafe extern "system" fn(action: EVT_SUBSCRIBE_NOTIFY_ACTION, usercontext: *const ::core::ffi::c_void, event: EVT_HANDLE) -> u32>;
// Copyright 2023 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::hash::BuildHasher; use std::sync::Arc; use std::time::Instant; use common_cache::CountableMeter; use common_exception::Result; use parking_lot::RwLock; use super::loader::LoadParams; use crate::metrics::metrics_inc_cache_miss_load_millisecond; use crate::providers::ImMemoryCache; use crate::CacheAccessor; use crate::Loader; use crate::NamedCache; /// A cache-aware reader pub struct CachedReader<L, C> { cache: Option<C>, loader: L, } pub type CacheHolder<V, S, M> = Arc<RwLock<ImMemoryCache<V, S, M>>>; impl<V, L, S, M> CachedReader<L, NamedCache<CacheHolder<V, S, M>>> where L: Loader<V> + Sync, S: BuildHasher, M: CountableMeter<String, Arc<V>>, { pub fn new(cache: Option<NamedCache<CacheHolder<V, S, M>>>, loader: L) -> Self { Self { cache, loader } } /// Load the object at `location`, uses/populates the cache if possible/necessary. pub async fn read(&self, params: &LoadParams) -> Result<Arc<V>> { match &self.cache { None => Ok(Arc::new(self.loader.load(params).await?)), Some(cache) => { let cache_key = self.loader.cache_key(params); match cache.get(cache_key.as_str()) { Some(item) => Ok(item), None => { let start = Instant::now(); let v = self.loader.load(params).await?; let item = Arc::new(v); // Perf. { metrics_inc_cache_miss_load_millisecond( start.elapsed().as_millis() as u64, cache.name(), ); } if params.put_cache { cache.put(cache_key, item.clone()); } Ok(item) } } } } } pub fn name(&self) -> &str { self.cache.as_ref().map(|c| c.name()).unwrap_or("") } }
#![allow(unused_imports)] // Import everything from libc, but we'll add some stuff and override some // things below. pub(crate) use libc::*; /// `PROC_SUPER_MAGIC`—The magic number for the procfs filesystem. #[cfg(all(linux_kernel, target_env = "musl"))] pub(crate) const PROC_SUPER_MAGIC: u32 = 0x0000_9fa0; /// `NFS_SUPER_MAGIC`—The magic number for the NFS filesystem. #[cfg(all(linux_kernel, target_env = "musl"))] pub(crate) const NFS_SUPER_MAGIC: u32 = 0x0000_6969; // TODO: Upstream these. #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_TSN: c_int = linux_raw_sys::if_ether::ETH_P_TSN as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_ERSPAN2: c_int = linux_raw_sys::if_ether::ETH_P_ERSPAN2 as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_ERSPAN: c_int = linux_raw_sys::if_ether::ETH_P_ERSPAN as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_PROFINET: c_int = linux_raw_sys::if_ether::ETH_P_PROFINET as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_REALTEK: c_int = linux_raw_sys::if_ether::ETH_P_REALTEK as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_ETHERCAT: c_int = linux_raw_sys::if_ether::ETH_P_ETHERCAT as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_PREAUTH: c_int = linux_raw_sys::if_ether::ETH_P_PREAUTH as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_LLDP: c_int = linux_raw_sys::if_ether::ETH_P_LLDP as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_MRP: c_int = linux_raw_sys::if_ether::ETH_P_MRP as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_NCSI: c_int = linux_raw_sys::if_ether::ETH_P_NCSI as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_CFM: c_int = linux_raw_sys::if_ether::ETH_P_CFM as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_IBOE: c_int = linux_raw_sys::if_ether::ETH_P_IBOE as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_HSR: c_int = linux_raw_sys::if_ether::ETH_P_HSR as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_NSH: c_int = linux_raw_sys::if_ether::ETH_P_NSH as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_DSA_8021Q: c_int = linux_raw_sys::if_ether::ETH_P_DSA_8021Q as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_DSA_A5PSW: c_int = linux_raw_sys::if_ether::ETH_P_DSA_A5PSW as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_IFE: c_int = linux_raw_sys::if_ether::ETH_P_IFE as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_CAN: c_int = linux_raw_sys::if_ether::ETH_P_CAN as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_CANXL: c_int = linux_raw_sys::if_ether::ETH_P_CANXL as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_XDSA: c_int = linux_raw_sys::if_ether::ETH_P_XDSA as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_MAP: c_int = linux_raw_sys::if_ether::ETH_P_MAP as _; #[cfg(all(linux_kernel, feature = "net"))] pub(crate) const ETH_P_MCTP: c_int = linux_raw_sys::if_ether::ETH_P_MCTP as _; #[cfg(all( linux_kernel, any( target_arch = "mips", target_arch = "mips32r6", target_arch = "mips64", target_arch = "mips64r6", target_arch = "sparc", target_arch = "sparc64" ) ))] pub(crate) const SIGEMT: c_int = linux_raw_sys::general::SIGEMT as _; // TODO: Upstream these. #[cfg(all(linux_kernel, feature = "termios"))] pub(crate) const IUCLC: tcflag_t = linux_raw_sys::general::IUCLC as _; #[cfg(all(linux_kernel, feature = "termios"))] pub(crate) const XCASE: tcflag_t = linux_raw_sys::general::XCASE as _; // On PowerPC, the regular `termios` has the `termios2` fields and there is no // `termios2`. linux-raw-sys has aliases `termios2` to `termios` to cover this // difference, but we still need to manually import it since `libc` doesn't // have this. #[cfg(all( linux_kernel, feature = "termios", any(target_arch = "powerpc", target_arch = "powerpc64") ))] pub(crate) use { linux_raw_sys::general::{termios2, CIBAUD}, linux_raw_sys::ioctl::{TCGETS2, TCSETS2, TCSETSF2, TCSETSW2}, }; // Automatically enable “large file” support (LFS) features. #[cfg(target_os = "vxworks")] pub(super) use libc::_Vx_ticks64_t as _Vx_ticks_t; #[cfg(linux_kernel)] pub(super) use libc::fallocate64 as fallocate; #[cfg(not(any(target_arch = "aarch64", target_arch = "riscv64")))] #[cfg(any(linux_like, target_os = "aix"))] pub(super) use libc::open64 as open; #[cfg(any(linux_kernel, target_os = "aix", target_os = "l4re"))] pub(super) use libc::posix_fallocate64 as posix_fallocate; #[cfg(any(all(linux_like, not(target_os = "android")), target_os = "aix"))] pub(super) use libc::{blkcnt64_t as blkcnt_t, rlim64_t as rlim_t}; #[cfg(target_os = "aix")] pub(super) use libc::{ blksize64_t as blksize_t, fstat64 as fstat, fstatat, fstatfs64 as fstatfs, fstatvfs64 as fstatvfs, ftruncate64 as ftruncate, getrlimit64 as getrlimit, ino_t, lseek64 as lseek, mmap, off64_t as off_t, openat, posix_fadvise64 as posix_fadvise, preadv, pwritev, rlimit64 as rlimit, setrlimit64 as setrlimit, statfs64 as statfs, statvfs64 as statvfs, RLIM_INFINITY, }; #[cfg(linux_like)] pub(super) use libc::{ fstat64 as fstat, fstatat64 as fstatat, fstatfs64 as fstatfs, fstatvfs64 as fstatvfs, ftruncate64 as ftruncate, getrlimit64 as getrlimit, ino64_t as ino_t, lseek64 as lseek, mmap64 as mmap, off64_t as off_t, openat64 as openat, posix_fadvise64 as posix_fadvise, rlimit64 as rlimit, setrlimit64 as setrlimit, statfs64 as statfs, statvfs64 as statvfs, RLIM64_INFINITY as RLIM_INFINITY, }; #[cfg(apple)] pub(super) use libc::{ host_info64_t as host_info_t, host_statistics64 as host_statistics, vm_statistics64_t as vm_statistics_t, }; #[cfg(not(all( linux_kernel, any( target_pointer_width = "32", target_arch = "mips64", target_arch = "mips64r6" ) )))] #[cfg(any(linux_like, target_os = "aix"))] pub(super) use libc::{lstat64 as lstat, stat64 as stat}; #[cfg(any(linux_kernel, target_os = "aix", target_os = "emscripten"))] pub(super) use libc::{pread64 as pread, pwrite64 as pwrite}; #[cfg(any(target_os = "linux", target_os = "emscripten"))] pub(super) use libc::{preadv64 as preadv, pwritev64 as pwritev}; #[cfg(all(target_os = "linux", target_env = "gnu"))] pub(super) unsafe fn prlimit( pid: libc::pid_t, resource: libc::__rlimit_resource_t, new_limit: *const libc::rlimit64, old_limit: *mut libc::rlimit64, ) -> libc::c_int { // `prlimit64` wasn't supported in glibc until 2.13. weak_or_syscall! { fn prlimit64( pid: libc::pid_t, resource: libc::__rlimit_resource_t, new_limit: *const libc::rlimit64, old_limit: *mut libc::rlimit64 ) via SYS_prlimit64 -> libc::c_int } prlimit64(pid, resource, new_limit, old_limit) } #[cfg(all(target_os = "linux", target_env = "musl"))] pub(super) unsafe fn prlimit( pid: libc::pid_t, resource: libc::c_int, new_limit: *const libc::rlimit64, old_limit: *mut libc::rlimit64, ) -> libc::c_int { weak_or_syscall! { fn prlimit64( pid: libc::pid_t, resource: libc::c_int, new_limit: *const libc::rlimit64, old_limit: *mut libc::rlimit64 ) via SYS_prlimit64 -> libc::c_int } prlimit64(pid, resource, new_limit, old_limit) } #[cfg(target_os = "android")] pub(super) unsafe fn prlimit( pid: libc::pid_t, resource: libc::c_int, new_limit: *const libc::rlimit64, old_limit: *mut libc::rlimit64, ) -> libc::c_int { weak_or_syscall! { fn prlimit64( pid: libc::pid_t, resource: libc::c_int, new_limit: *const libc::rlimit64, old_limit: *mut libc::rlimit64 ) via SYS_prlimit64 -> libc::c_int } prlimit64(pid, resource, new_limit, old_limit) } // 64-bit offsets on 32-bit platforms are passed in endianness-specific // lo/hi pairs. See src/backend/linux_raw/conv.rs for details. #[cfg(all(linux_kernel, target_endian = "little", target_pointer_width = "32"))] fn lo(x: i64) -> usize { (x >> 32) as usize } #[cfg(all(linux_kernel, target_endian = "little", target_pointer_width = "32"))] fn hi(x: i64) -> usize { x as usize } #[cfg(all(linux_kernel, target_endian = "big", target_pointer_width = "32"))] fn lo(x: i64) -> usize { x as usize } #[cfg(all(linux_kernel, target_endian = "big", target_pointer_width = "32"))] fn hi(x: i64) -> usize { (x >> 32) as usize } #[cfg(target_os = "android")] mod readwrite_pv64 { use super::*; pub(in super::super) unsafe fn preadv64( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset: libc::off64_t, ) -> libc::ssize_t { // Older Android libc lacks `preadv64`, so use the `weak!` mechanism to // test for it, and call back to `libc::syscall`. We don't use // `weak_or_syscall` here because we need to pass the 64-bit offset // specially. weak! { fn preadv64(libc::c_int, *const libc::iovec, libc::c_int, libc::off64_t) -> libc::ssize_t } if let Some(fun) = preadv64.get() { fun(fd, iov, iovcnt, offset) } else { #[cfg(target_pointer_width = "32")] { syscall! { fn preadv( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset_hi: usize, offset_lo: usize ) via SYS_preadv -> libc::ssize_t } preadv(fd, iov, iovcnt, hi(offset), lo(offset)) } #[cfg(target_pointer_width = "64")] { syscall! { fn preadv( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset: libc::off_t ) via SYS_preadv -> libc::ssize_t } preadv(fd, iov, iovcnt, offset) } } } pub(in super::super) unsafe fn pwritev64( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset: libc::off64_t, ) -> libc::ssize_t { // See the comments in `preadv64`. weak! { fn pwritev64(libc::c_int, *const libc::iovec, libc::c_int, libc::off64_t) -> libc::ssize_t } if let Some(fun) = pwritev64.get() { fun(fd, iov, iovcnt, offset) } else { #[cfg(target_pointer_width = "32")] { syscall! { fn pwritev( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset_hi: usize, offset_lo: usize ) via SYS_pwritev -> libc::ssize_t } pwritev(fd, iov, iovcnt, hi(offset), lo(offset)) } #[cfg(target_pointer_width = "64")] { syscall! { fn pwritev( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset: libc::off_t ) via SYS_pwritev -> libc::ssize_t } pwritev(fd, iov, iovcnt, offset) } } } } #[cfg(target_os = "android")] pub(super) use readwrite_pv64::{preadv64 as preadv, pwritev64 as pwritev}; // macOS added preadv and pwritev in version 11.0 #[cfg(apple)] mod readwrite_pv { weakcall! { pub(in super::super) fn preadv( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset: libc::off_t ) -> libc::ssize_t } weakcall! { pub(in super::super) fn pwritev( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset: libc::off_t ) -> libc::ssize_t } } #[cfg(apple)] pub(super) use readwrite_pv::{preadv, pwritev}; // glibc added `preadv64v2` and `pwritev64v2` in version 2.26. #[cfg(all(target_os = "linux", target_env = "gnu"))] mod readwrite_pv64v2 { use super::*; pub(in super::super) unsafe fn preadv64v2( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset: libc::off64_t, flags: libc::c_int, ) -> libc::ssize_t { // Older glibc lacks `preadv64v2`, so use the `weak!` mechanism to // test for it, and call back to `libc::syscall`. We don't use // `weak_or_syscall` here because we need to pass the 64-bit offset // specially. weak! { fn preadv64v2(libc::c_int, *const libc::iovec, libc::c_int, libc::off64_t, libc::c_int) -> libc::ssize_t } if let Some(fun) = preadv64v2.get() { fun(fd, iov, iovcnt, offset, flags) } else { #[cfg(target_pointer_width = "32")] { syscall! { fn preadv2( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset_hi: usize, offset_lo: usize, flags: libc::c_int ) via SYS_preadv2 -> libc::ssize_t } preadv2(fd, iov, iovcnt, hi(offset), lo(offset), flags) } #[cfg(target_pointer_width = "64")] { syscall! { fn preadv2( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset: libc::off_t, flags: libc::c_int ) via SYS_preadv2 -> libc::ssize_t } preadv2(fd, iov, iovcnt, offset, flags) } } } pub(in super::super) unsafe fn pwritev64v2( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset: libc::off64_t, flags: libc::c_int, ) -> libc::ssize_t { // See the comments in `preadv64v2`. weak! { fn pwritev64v2(libc::c_int, *const libc::iovec, libc::c_int, libc::off64_t, libc::c_int) -> libc::ssize_t } if let Some(fun) = pwritev64v2.get() { fun(fd, iov, iovcnt, offset, flags) } else { #[cfg(target_pointer_width = "32")] { syscall! { fn pwritev2( fd: libc::c_int, iov: *const libc::iovec, iovec: libc::c_int, offset_hi: usize, offset_lo: usize, flags: libc::c_int ) via SYS_pwritev2 -> libc::ssize_t } pwritev2(fd, iov, iovcnt, hi(offset), lo(offset), flags) } #[cfg(target_pointer_width = "64")] { syscall! { fn pwritev2( fd: libc::c_int, iov:*const libc::iovec, iovcnt: libc::c_int, offset: libc::off_t, flags: libc::c_int ) via SYS_pwritev2 -> libc::ssize_t } pwritev2(fd, iov, iovcnt, offset, flags) } } } } #[cfg(all(target_os = "linux", target_env = "gnu"))] pub(super) use readwrite_pv64v2::{preadv64v2 as preadv2, pwritev64v2 as pwritev2}; // On non-glibc, assume we don't have `pwritev2`/`preadv2` in libc and use // `c::syscall` instead. #[cfg(any( target_os = "android", all(target_os = "linux", not(target_env = "gnu")), ))] mod readwrite_pv64v2 { use super::*; pub(in super::super) unsafe fn preadv64v2( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset: libc::off64_t, flags: libc::c_int, ) -> libc::ssize_t { #[cfg(target_pointer_width = "32")] { syscall! { fn preadv2( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset_hi: usize, offset_lo: usize, flags: libc::c_int ) via SYS_preadv2 -> libc::ssize_t } preadv2(fd, iov, iovcnt, hi(offset), lo(offset), flags) } #[cfg(target_pointer_width = "64")] { syscall! { fn preadv2( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset: libc::off_t, flags: libc::c_int ) via SYS_preadv2 -> libc::ssize_t } preadv2(fd, iov, iovcnt, offset, flags) } } pub(in super::super) unsafe fn pwritev64v2( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset: libc::off64_t, flags: libc::c_int, ) -> libc::ssize_t { #[cfg(target_pointer_width = "32")] { syscall! { fn pwritev2( fd: libc::c_int, iov: *const libc::iovec, iovcnt: libc::c_int, offset_hi: usize, offset_lo: usize, flags: libc::c_int ) via SYS_pwritev2 -> libc::ssize_t } pwritev2(fd, iov, iovcnt, hi(offset), lo(offset), flags) } #[cfg(target_pointer_width = "64")] { syscall! { fn pwritev2( fd: libc::c_int, iov:*const libc::iovec, iovcnt: libc::c_int, offset: libc::off_t, flags: libc::c_int ) via SYS_pwritev2 -> libc::ssize_t } pwritev2(fd, iov, iovcnt, offset, flags) } } } #[cfg(any( target_os = "android", all(target_os = "linux", not(target_env = "gnu")), ))] pub(super) use readwrite_pv64v2::{preadv64v2 as preadv2, pwritev64v2 as pwritev2};