text
stringlengths
8
4.13M
use self::{stack_trace::StackFrameKey, utils::IdMapping, variable::VariablesKey}; use super::vm_state::VmState; mod memory; mod scope; mod stack_trace; mod utils; mod variable; pub struct PausedState { pub vm_state: VmState, stack_frame_ids: IdMapping<StackFrameKey>, variables_ids: IdMapping<VariablesKey>, } impl PausedState { pub fn new(vm_state: VmState) -> Self { Self { vm_state, stack_frame_ids: IdMapping::default(), variables_ids: IdMapping::default(), } } }
fn main(){ //struct struct Point { x:i32, y:i32, } let mut point = Point{ x: 3, y: 3}; point.x = 1; point.y = 2; println!("point.x = {} , point.y = {}.", point.x, point.y); //tuple struct struct Color(u8,u8,u8); let android_green = Color(0xa4,0xc6,0x39); let Color(red,green,blue) = android_green; println!("red = {}, green = {}, blue = {}.", red, green, blue); //newtype: only one element tuple struct struct Char(i32); let a = Char(97); let Char(int_char_a) = a; println!("int_char_a = {}.", int_char_a); // unit-like structs 类单元结构体 // 这样的结构体叫做“类单元”因为它与一个空元组类似,(),这有时叫做“单元”。 // 就像一个元组结构体,它定义了一个新类型。 // 就它本身来看没什么用(虽然有时它可以作为一个标记类型),不过在与其它功能的结合中,它可以变得有用。 // 例如,一个库可能请求你创建一个实现了一个特定特性的结构来处理事件 // 。如果你并不需要在结构中存储任何数据,你可以仅仅创建一个类单元结构体。 struct EmptyStruct; let empty = EmptyStruct; //使用..忽略一些值,并从其他struct中拷贝 struct Point3d { x: i32, y: i32, z: i32, } let defult_point3d = Point3d{x:1, y:1, z:1}; let point3d = Point3d{x:2, ..defult_point3d}; // }
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[cfg(feature = "Security_Authentication_Identity_Core")] pub mod Core; #[cfg(feature = "Security_Authentication_Identity_Provider")] pub mod Provider; #[link(name = "windows")] extern "system" {} pub type EnterpriseKeyCredentialRegistrationInfo = *mut ::core::ffi::c_void; pub type EnterpriseKeyCredentialRegistrationManager = *mut ::core::ffi::c_void;
use crate::psrc::{Endpoint, Mode, Parcel, Purpose}; use crate::PopDat; use abstutil::Timer; use geom::{Distance, Duration, LonLat, PolyLine, Polygon, Pt2D}; use map_model::{BuildingID, IntersectionID, LaneType, Map, PathRequest, Position}; use sim::{DrivingGoal, Scenario, SidewalkSpot, SpawnTrip, TripSpec}; use std::collections::{BTreeMap, HashMap}; #[derive(Clone, Debug)] pub struct Trip { pub from: TripEndpt, pub to: TripEndpt, pub depart_at: Duration, pub purpose: (Purpose, Purpose), pub mode: Mode, // These are an upper bound when TripEndpt::Border is involved. pub trip_time: Duration, pub trip_dist: Distance, // clip_trips doesn't populate this. pub route: Option<PolyLine>, } #[derive(Clone, Debug)] pub enum TripEndpt { Building(BuildingID), // The Pt2D is the original point. It'll be outside the map and likely out-of-bounds entirely, // maybe even negative. Border(IntersectionID, Pt2D), } impl Trip { pub fn end_time(&self) -> Duration { self.depart_at + self.trip_time } pub fn path_req(&self, map: &Map) -> PathRequest { match self.mode { Mode::Walk => PathRequest { start: self.from.start_sidewalk_spot(map).sidewalk_pos, end: self.from.end_sidewalk_spot(map).sidewalk_pos, can_use_bike_lanes: false, can_use_bus_lanes: false, }, Mode::Bike => PathRequest { start: self.from.start_pos_driving(map), end: self .to .driving_goal(vec![LaneType::Biking, LaneType::Driving], map) .goal_pos(map), can_use_bike_lanes: true, can_use_bus_lanes: false, }, Mode::Drive => PathRequest { start: self.from.start_pos_driving(map), end: self .to .driving_goal(vec![LaneType::Driving], map) .goal_pos(map), can_use_bike_lanes: false, can_use_bus_lanes: false, }, Mode::Transit => { let start = self.from.start_sidewalk_spot(map).sidewalk_pos; let end = self.to.end_sidewalk_spot(map).sidewalk_pos; if let Some((stop1, _, _)) = map.should_use_transit(start, end) { PathRequest { start, end: SidewalkSpot::bus_stop(stop1, map).sidewalk_pos, can_use_bike_lanes: false, can_use_bus_lanes: false, } } else { // Just fall back to walking. :\ PathRequest { start, end, can_use_bike_lanes: false, can_use_bus_lanes: false, } } } } } } impl TripEndpt { fn new( endpt: &Endpoint, map: &Map, osm_id_to_bldg: &HashMap<i64, BuildingID>, borders: &Vec<(IntersectionID, LonLat)>, ) -> Option<TripEndpt> { if let Some(b) = endpt.osm_building.and_then(|id| osm_id_to_bldg.get(&id)) { return Some(TripEndpt::Building(*b)); } borders .iter() .min_by_key(|(_, pt)| pt.fast_dist(endpt.pos)) .map(|(id, _)| { TripEndpt::Border( *id, Pt2D::forcibly_from_gps(endpt.pos, map.get_gps_bounds()), ) }) } fn start_sidewalk_spot(&self, map: &Map) -> SidewalkSpot { match self { TripEndpt::Building(b) => SidewalkSpot::building(*b, map), TripEndpt::Border(i, _) => SidewalkSpot::start_at_border(*i, map).unwrap(), } } fn end_sidewalk_spot(&self, map: &Map) -> SidewalkSpot { match self { TripEndpt::Building(b) => SidewalkSpot::building(*b, map), TripEndpt::Border(i, _) => SidewalkSpot::end_at_border(*i, map).unwrap(), } } // TODO or biking // TODO bldg_via_driving needs to do find_driving_lane_near_building sometimes // Doesn't adjust for starting length yet. fn start_pos_driving(&self, map: &Map) -> Position { match self { TripEndpt::Building(b) => Position::bldg_via_driving(*b, map).unwrap(), TripEndpt::Border(i, _) => { let lane = map.get_i(*i).get_outgoing_lanes(map, LaneType::Driving)[0]; Position::new(lane, Distance::ZERO) } } } fn driving_goal(&self, lane_types: Vec<LaneType>, map: &Map) -> DrivingGoal { match self { TripEndpt::Building(b) => DrivingGoal::ParkNear(*b), TripEndpt::Border(i, _) => DrivingGoal::end_at_border(*i, lane_types, map).unwrap(), } } pub fn polygon<'a>(&self, map: &'a Map) -> &'a Polygon { match self { TripEndpt::Building(b) => &map.get_b(*b).polygon, TripEndpt::Border(i, _) => &map.get_i(*i).polygon, } } } pub fn clip_trips(map: &Map, timer: &mut Timer) -> (Vec<Trip>, HashMap<BuildingID, Parcel>) { let popdat: PopDat = abstutil::read_binary("../data/shapes/popdat.bin", timer) .expect("Couldn't load popdat.bin"); let mut osm_id_to_bldg = HashMap::new(); for b in map.all_buildings() { osm_id_to_bldg.insert(b.osm_way_id, b.id); } let bounds = map.get_gps_bounds(); // TODO Figure out why some polygon centers are broken let incoming_borders_walking: Vec<(IntersectionID, LonLat)> = map .all_incoming_borders() .into_iter() .filter(|i| !i.get_outgoing_lanes(map, LaneType::Sidewalk).is_empty()) .filter_map(|i| i.polygon.center().to_gps(bounds).map(|pt| (i.id, pt))) .collect(); let incoming_borders_driving: Vec<(IntersectionID, LonLat)> = map .all_incoming_borders() .into_iter() .filter(|i| !i.get_outgoing_lanes(map, LaneType::Driving).is_empty()) .filter_map(|i| i.polygon.center().to_gps(bounds).map(|pt| (i.id, pt))) .collect(); let outgoing_borders_walking: Vec<(IntersectionID, LonLat)> = map .all_outgoing_borders() .into_iter() .filter(|i| !i.get_incoming_lanes(map, LaneType::Sidewalk).is_empty()) .filter_map(|i| i.polygon.center().to_gps(bounds).map(|pt| (i.id, pt))) .collect(); let outgoing_borders_driving: Vec<(IntersectionID, LonLat)> = map .all_outgoing_borders() .into_iter() .filter(|i| !i.get_incoming_lanes(map, LaneType::Driving).is_empty()) .filter_map(|i| i.polygon.center().to_gps(bounds).map(|pt| (i.id, pt))) .collect(); let maybe_results: Vec<Option<Trip>> = timer.parallelize("clip trips", popdat.trips, |trip| { let from = TripEndpt::new( &trip.from, map, &osm_id_to_bldg, match trip.mode { Mode::Walk | Mode::Transit => &incoming_borders_walking, Mode::Drive | Mode::Bike => &incoming_borders_driving, }, )?; let to = TripEndpt::new( &trip.to, map, &osm_id_to_bldg, match trip.mode { Mode::Walk | Mode::Transit => &outgoing_borders_walking, Mode::Drive | Mode::Bike => &outgoing_borders_driving, }, )?; let mut trip = Trip { from, to, depart_at: trip.depart_at, purpose: trip.purpose, mode: trip.mode, trip_time: trip.trip_time, trip_dist: trip.trip_dist, route: None, }; match (&trip.from, &trip.to) { (TripEndpt::Border(_, _), TripEndpt::Border(_, _)) => { // TODO Detect and handle pass-through trips return None; } // Fix depart_at, trip_time, and trip_dist for border cases. Assume constant speed // through the trip. // TODO Disabled because slow and nonsensical distance ratios. :( (TripEndpt::Border(_, _), TripEndpt::Building(_)) => { if false { // TODO Figure out why some paths fail. // TODO Since we're doing the work anyway, store the result? let dist = map.pathfind(trip.path_req(map))?.total_dist(map); // TODO This is failing all over the place, why? assert!(dist <= trip.trip_dist); let trip_time = (dist / trip.trip_dist) * trip.trip_time; trip.depart_at += trip.trip_time - trip_time; trip.trip_time = trip_time; trip.trip_dist = dist; } } (TripEndpt::Building(_), TripEndpt::Border(_, _)) => { if false { let dist = map.pathfind(trip.path_req(map))?.total_dist(map); assert!(dist <= trip.trip_dist); trip.trip_time = (dist / trip.trip_dist) * trip.trip_time; trip.trip_dist = dist; } } (TripEndpt::Building(_), TripEndpt::Building(_)) => {} } Some(trip) }); let trips = maybe_results.into_iter().flatten().collect(); let mut bldgs = HashMap::new(); for (osm_id, metadata) in popdat.parcels { if let Some(b) = osm_id_to_bldg.get(&osm_id) { bldgs.insert(*b, metadata); } } (trips, bldgs) } pub fn trips_to_scenario(map: &Map, t1: Duration, t2: Duration, timer: &mut Timer) -> Scenario { let (trips, _) = clip_trips(map, timer); // TODO Don't clone trips for parallelize let individ_trips = timer .parallelize("turn PSRC trips into SpawnTrips", trips.clone(), |trip| { if trip.depart_at < t1 || trip.depart_at > t2 { return None; } match trip.mode { Mode::Drive => match trip.from { TripEndpt::Border(_, _) => { if let Some(start) = TripSpec::spawn_car_at(trip.from.start_pos_driving(map), map) { Some(SpawnTrip::CarAppearing { depart: trip.depart_at, start, goal: trip.to.driving_goal(vec![LaneType::Driving], map), is_bike: false, }) } else { // TODO need to be able to emit warnings from parallelize //timer.warn(format!("No room for car to appear at {:?}", trip.from)); None } } TripEndpt::Building(b) => Some(SpawnTrip::MaybeUsingParkedCar( trip.depart_at, b, trip.to.driving_goal(vec![LaneType::Driving], map), )), }, Mode::Bike => match trip.from { TripEndpt::Building(b) => Some(SpawnTrip::UsingBike( trip.depart_at, SidewalkSpot::building(b, map), trip.to .driving_goal(vec![LaneType::Biking, LaneType::Driving], map), )), TripEndpt::Border(_, _) => { if let Some(start) = TripSpec::spawn_car_at(trip.from.start_pos_driving(map), map) { Some(SpawnTrip::CarAppearing { depart: trip.depart_at, start, goal: trip .to .driving_goal(vec![LaneType::Biking, LaneType::Driving], map), is_bike: true, }) } else { //timer.warn(format!("No room for bike to appear at {:?}", trip.from)); None } } }, Mode::Walk => Some(SpawnTrip::JustWalking( trip.depart_at, trip.from.start_sidewalk_spot(map), trip.to.end_sidewalk_spot(map), )), Mode::Transit => { let start = trip.from.start_sidewalk_spot(map); let goal = trip.to.end_sidewalk_spot(map); if let Some((stop1, stop2, route)) = map.should_use_transit(start.sidewalk_pos, goal.sidewalk_pos) { Some(SpawnTrip::UsingTransit( trip.depart_at, start, goal, route, stop1, stop2, )) } else { //timer.warn(format!("{:?} not actually using transit, because pathfinding didn't find any useful route", trip)); Some(SpawnTrip::JustWalking(trip.depart_at, start, goal)) } } } }) .into_iter() .flatten() .collect(); // This is another variation of the 'recycle' algorithm in game's ScenarioManager. let mut individ_parked_cars = BTreeMap::new(); let mut avail_per_bldg = BTreeMap::new(); for b in map.all_buildings() { individ_parked_cars.insert(b.id, 0); avail_per_bldg.insert(b.id, 0); } for trip in trips { if trip.depart_at < t1 || trip.depart_at > t2 || trip.mode != Mode::Drive { continue; } if let TripEndpt::Building(b) = trip.from { if avail_per_bldg[&b] > 0 { *avail_per_bldg.get_mut(&b).unwrap() -= 1; } else { *individ_parked_cars.get_mut(&b).unwrap() += 1; } } if let TripEndpt::Building(b) = trip.to { *avail_per_bldg.get_mut(&b).unwrap() += 1; } } Scenario { scenario_name: format!("psrc {} to {}", t1, t2), map_name: map.get_name().to_string(), seed_parked_cars: Vec::new(), spawn_over_time: Vec::new(), border_spawn_over_time: Vec::new(), individ_trips, individ_parked_cars, } }
fn puzzle1(input: Vec<String>) -> i32 { return 0; } fn puzzle2(input: Vec<String>) -> i32 { return 0; } #[cfg(test)] mod tests { use crate::template::{puzzle1, puzzle2}; use crate::utils; struct Puzzle1Test { test_data: Vec<String>, expected_result: i32, } #[test] fn test_puzzle_1() { let mut tests: Vec<Puzzle1Test> = Vec::new(); tests.push(Puzzle1Test { test_data: vec![String::from("R98,U47,R26,D63,R33,U87,L62,D20,R33,U53,R51"), String::from("U98,R91,D20,R16,D67,R40,U7,R15,U6,R7")], expected_result: 135, }); match utils::read_lines("data/Day3.txt") { Ok(lines) => { tests.push(Puzzle1Test { test_data: lines, expected_result: 0, }); for test in tests { let result = puzzle1(test.test_data); assert_eq!(result, test.expected_result); } } Err(error) => { println!("{}", error); } } } struct Puzzle2Test { test_data: Vec<String>, expected_result: i32, } #[test] fn test_puzzle_2() { let mut tests: Vec<Puzzle2Test> = Vec::new(); tests.push(Puzzle2Test { test_data: vec![String::from("14")], expected_result: 2, }); match utils::read_lines("data/Day1.txt") { Ok(lines) => { tests.push(Puzzle2Test { test_data: lines, expected_result: 0, }); for test in tests { let result = puzzle2(test.test_data); assert_eq!(result, test.expected_result); } } Err(error) => { println!("{}", error); } } } }
use libc::c_int; /// Values for the FLAG argument to the user function passed to `ftw' and 'nftw'. /// Regular file. #[allow(unused)] pub const FTW_F: c_int = 0; /// Directory. #[allow(unused)] pub const FTW_D: c_int = 1; /// Unreadable directory. #[allow(unused)] pub const FTW_DNR: c_int = 2; /// Unstatable file. #[allow(unused)] pub const FTW_NS: c_int = 3; /// Symbolic link. #[allow(unused)] pub const FTW_SL: c_int = 4; /// These flags are only passed from the `nftw' function. */ /// Directory, all subdirs have been visited. #[allow(unused)] pub const FTW_DP: c_int = 5; /// Symbolic link naming non-existing file. #[allow(unused)] pub const FTW_SLN: c_int = 6; /// Perform physical walk, ignore symlinks. #[allow(unused)] pub const FTW_PHYS: c_int = 1; /// Report only files on same file system as the argument. #[allow(unused)] pub const FTW_MOUNT: c_int = 2; /// Change to current directory while processing it. #[allow(unused)] pub const FTW_CHDIR: c_int = 4; /// Report files in directory before directory itself. #[allow(unused)] pub const FTW_DEPTH: c_int = 8;
use itertools::Itertools; use whiteread::parse_line; fn main() { let (n, p, q): (usize, usize, usize) = parse_line().unwrap(); let aa: Vec<usize> = parse_line().unwrap(); let mut ans = 0; for a in aa.into_iter().combinations(5) { let tmp = (((((a[0] * a[1]) % p) * a[2]) % p) * ((a[3] * a[4]) % p)) % p; if tmp == q { ans += 1; } } println!("{}", ans); }
//! Thread pool for blocking operations use std::fmt; use derive_more::Display; use futures::sync::oneshot; use futures::{Async, Future, Poll}; use parking_lot::Mutex; use threadpool::ThreadPool; /// Env variable for default cpu pool size const ENV_CPU_POOL_VAR: &str = "ACTIX_CPU_POOL"; lazy_static::lazy_static! { pub(crate) static ref DEFAULT_POOL: Mutex<ThreadPool> = { let default = match std::env::var(ENV_CPU_POOL_VAR) { Ok(val) => { if let Ok(val) = val.parse() { val } else { log::error!("Can not parse ACTIX_CPU_POOL value"); num_cpus::get() * 5 } } Err(_) => num_cpus::get() * 5, }; Mutex::new( threadpool::Builder::new() .thread_name("actix-web".to_owned()) .num_threads(default) .build(), ) }; } thread_local! { static POOL: ThreadPool = { DEFAULT_POOL.lock().clone() }; } /// Blocking operation execution error #[derive(Debug, Display)] pub enum BlockingError<E: fmt::Debug> { #[display(fmt = "{:?}", _0)] Error(E), #[display(fmt = "Thread pool is gone")] Canceled, } /// Execute blocking function on a thread pool, returns future that resolves /// to result of the function execution. pub fn run<F, I, E>(f: F) -> CpuFuture<I, E> where F: FnOnce() -> Result<I, E> + Send + 'static, I: Send + 'static, E: Send + fmt::Debug + 'static, { let (tx, rx) = oneshot::channel(); POOL.with(|pool| { pool.execute(move || { if !tx.is_canceled() { let _ = tx.send(f()); } }) }); CpuFuture { rx } } /// Blocking operation completion future. It resolves with results /// of blocking function execution. pub struct CpuFuture<I, E> { rx: oneshot::Receiver<Result<I, E>>, } impl<I, E: fmt::Debug> Future for CpuFuture<I, E> { type Item = I; type Error = BlockingError<E>; fn poll(&mut self) -> Poll<Self::Item, Self::Error> { let res = futures::try_ready!(self.rx.poll().map_err(|_| BlockingError::Canceled)); match res { Ok(val) => Ok(Async::Ready(val)), Err(err) => Err(BlockingError::Error(err)), } } }
use state::context::Action; use state::context::Context; use state::context::Effects; use objects::player::Player; pub type Idx = u32; #[derive(Serialize, Deserialize, Clone, Copy, Debug)] pub struct Pixel (pub Icon, pub Color); impl Pixel { pub fn empty() -> Pixel { return Pixel(Icon::Empty, Color(255, 255, 255)) } pub fn gray(&self) -> Pixel { Pixel(self.0, Color(128, 128, 128)) } } #[derive(Serialize, Deserialize, Clone, Copy, Debug)] pub struct Color (pub u8, pub u8, pub u8); #[derive(Serialize, Deserialize, Clone, Copy, Debug)] pub enum Icon { Wall, Player, Enemy, Floor, Empty } pub trait Object { fn get_idx(&self) -> Idx; fn get_pixel(&self) -> Pixel; fn get_ordinal(&self) -> i32; fn is_environment(&self) -> bool; fn is_blocking(&self) -> bool; fn is_opaque(&self) -> bool; fn name(&self) -> &str; fn is_active(&self) -> bool { false } fn get_cooldown(&self) -> i64 { i64::max_value() } fn lapse_time(&mut self, _interval: i64) { } fn update(&self, _context: Context, _effects: &mut Effects) { } fn plan_action(&self, _context: Context, _effects: &mut Effects) { } fn execute_action(&mut self, _effects: &mut Effects, _action: &Action) { } fn as_player(&mut self) -> Option<&mut Player> { None } }
use std::env; use std::process; use clap::{App, Arg, SubCommand}; fn main() { let matches = App::new("Simple key:value store") .version("0.1") .author("Ivan <ivanalejandro0@gmail.com>") .about("Simple store for data in key:value shape") .subcommand( SubCommand::with_name("get") .about("gets a value by its key") .arg( Arg::with_name("key") // And their own arguments .help("the key to look for") .required(true), ), ) .subcommand( SubCommand::with_name("set") .about("sets a key/value pair") .arg( Arg::with_name("key") // And their own arguments .help("the key to save the value") .required(true), ) .arg( Arg::with_name("value") // And their own arguments .help("the value to save") .required(true), ), ) .subcommand( SubCommand::with_name("list") .about("list all the existing keys") ) .subcommand( SubCommand::with_name("git-add") .about("work in progress: add and commit a file") .arg( Arg::with_name("key") // And their own arguments .help("the key to add/commit") .required(true), ), ) .subcommand( SubCommand::with_name("git-update") .about("work in progress: fetch and update the repo") ) .get_matches(); let store_path = env::var("STORE").unwrap_or_else(|e| { eprintln!("You must define a STORE variable with the path to a repo. Error: {}", e); process::exit(1); }); let store = gitkv::Store::new(&store_path).unwrap(); // Calling .unwrap() is safe for getting the values of key/value arguments since they are // required. // If they weren't required we could have used an 'if let' to conditionally get the values. if let Some(matches) = matches.subcommand_matches("set") { let key = matches.value_of("key").unwrap(); let value = matches.value_of("value").unwrap(); match store.set(key, value) { Ok(()) => println!("[set ok] {}: {}", key, value), Err(e) => { eprintln!("There was a problem while setting key/value. Error: {}", e); process::exit(1); } } } if let Some(matches) = matches.subcommand_matches("get") { let key = matches.value_of("key").unwrap(); match store.get(key) { Ok(value) => println!("[get ok] {}: {}", key, value), Err(e) => { eprintln!("There was a problem while getting key/value. Error: {}", e); process::exit(1); } } } if matches.is_present("list") { let entries = store.list(); println!("Entries: {:?}", entries); } if matches.is_present("git-update") { if let Err(e) = store.git_update() { eprintln!("Error adding/committing file: {}", e); process::exit(1); }; } if let Some(matches) = matches.subcommand_matches("git-add") { let key = matches.value_of("key").unwrap(); if let Err(e) = store.git_add(key) { eprintln!("Error adding/committing file: {}", e); process::exit(1); }; } }
use std::process::Command; fn main() { let cmd = Command::new("unrar") .args(&["lb", "/home/susilo/Documents/eBooks/Rust/Packt.The.Complete.Rust.Programming.Reference.Guide.1838828109.rar"]) .output(); // .expect("Gagal menjalankan compiler"); // unrar x -xNamaFile -c- match cmd { Ok(output) => { if output.status.success() { let s = output.stdout.iter().map(|&x| x as char).collect::<String>(); let arr_s = s.split('\n').filter(|x| !x.is_empty()).collect::<Vec<&str>>(); for x in arr_s { println!("{}", x); } } else { println!("Unrar tidak berhasil."); } }, Err(_) => println!("Gagal unrar file!.") } }
use crate::{crh::FieldBasedHash, signature::FieldBasedSignatureScheme, CryptoError, Error, compute_truncation_size}; use algebra::{Field, PrimeField, Group, UniformRand, ProjectiveCurve, convert, leading_zeros, ToBits, ToConstraintField, ToBytes, FromBytes}; use std::marker::PhantomData; use rand::Rng; use std::io::{Write, Read, Result as IoResult}; #[allow(dead_code)] pub struct FieldBasedSchnorrSignatureScheme< F: PrimeField, G: Group, H: FieldBasedHash, > { _field: PhantomData<F>, _group: PhantomData<G>, _hash: PhantomData<H>, } #[derive(Derivative)] #[derivative( Copy(bound = "F: PrimeField"), Clone(bound = "F: PrimeField"), Default(bound = "F: PrimeField"), Eq(bound = "F: PrimeField"), PartialEq(bound = "F: PrimeField"), Debug(bound = "F: PrimeField") )] pub struct FieldBasedSchnorrSignature<F: PrimeField> { pub e: F, pub s: F, } impl<F: PrimeField> ToBytes for FieldBasedSchnorrSignature<F> { fn write<W: Write>(&self, mut writer: W) -> IoResult<()> { self.e.write(&mut writer)?; self.s.write(&mut writer) } } impl<F: PrimeField> FromBytes for FieldBasedSchnorrSignature<F> { fn read<R: Read>(mut reader: R) -> IoResult<Self> { let e = F::read(&mut reader)?; let s = F::read(&mut reader)?; Ok(Self{ e, s }) } } impl<F: PrimeField, G: ProjectiveCurve + ToConstraintField<F>, H: FieldBasedHash<Data = F>> FieldBasedSignatureScheme for FieldBasedSchnorrSignatureScheme<F, G, H> { type Data = H::Data; type PublicKey = G; type SecretKey = G::ScalarField; type Signature = FieldBasedSchnorrSignature<F>; fn keygen<R: Rng>(rng: &mut R) -> (Self::PublicKey, Self::SecretKey) { let secret_key = G::ScalarField::rand(rng); let public_key = G::prime_subgroup_generator() .mul(&secret_key); (public_key, secret_key) } fn get_public_key(sk: &Self::SecretKey) -> Self::PublicKey { G::prime_subgroup_generator().mul(sk) } fn sign<R: Rng>( rng: &mut R, pk: &Self::PublicKey, sk: &Self::SecretKey, message: &[Self::Data], )-> Result<Self::Signature, Error> { let pk_coords = pk.to_field_elements()?; let (e, s) = loop { //Sample random element let k = G::ScalarField::rand(rng); if k.is_zero() {continue}; //R = k * G let r = G::prime_subgroup_generator() .mul(&k); let r_coords = r.to_field_elements()?; // Compute e = H(m || R || pk.x) let mut hash_input = Vec::new(); hash_input.extend_from_slice(message); hash_input.extend_from_slice(r_coords.as_slice()); hash_input.push(pk_coords[0]); let e = H::evaluate(hash_input.as_ref())?; let e_bits = e.write_bits(); let e_leading_zeros = leading_zeros(e_bits.clone()) as usize; let required_leading_zeros = compute_truncation_size( F::size_in_bits() as i32, G::ScalarField::size_in_bits() as i32, ); //Enforce e bit length is strictly smaller than G::ScalarField modulus bit length if e_leading_zeros < required_leading_zeros {continue}; //We can now safely convert it to the other field let e_conv = convert::<G::ScalarField>(e_bits)?; //Enforce s bit length is strictly smaller than F modulus bit length let s = k + &(e_conv * sk); let s_bits = s.write_bits(); let s_leading_zeros = leading_zeros(s_bits.clone()) as usize; let required_leading_zeros = compute_truncation_size( G::ScalarField::size_in_bits() as i32, F::size_in_bits() as i32, ); if s_leading_zeros < required_leading_zeros {continue}; let s_conv = convert::<F>(s_bits)?; break (e, s_conv); }; Ok(FieldBasedSchnorrSignature {e, s}) } fn verify( pk: &Self::PublicKey, message: &[Self::Data], signature: &Self::Signature ) -> Result<bool, Error> { let pk_coords = pk.to_field_elements()?; //Checks let e_bits = signature.e.write_bits(); let e_leading_zeros = leading_zeros(e_bits.clone()) as usize; if (F::size_in_bits() - e_leading_zeros) >= G::ScalarField::size_in_bits(){ return Err(Box::new(CryptoError::IncorrectInputLength("signature.e".to_owned(), e_bits.len() - e_leading_zeros))) } let s_bits = signature.s.write_bits(); let s_leading_zeros = leading_zeros(s_bits.clone()) as usize; if (G::ScalarField::size_in_bits() - s_leading_zeros) >= F::size_in_bits(){ return Err(Box::new(CryptoError::IncorrectInputLength("signature.s".to_owned(), s_bits.len() - s_leading_zeros))) } //Compute R' = s*G - e * pk let r_prime = { let s_conv = convert::<G::ScalarField>(s_bits)?; let e_conv = convert::<G::ScalarField>(e_bits)?; let s_times_g = G::prime_subgroup_generator().mul(&s_conv); let neg_e_times_pk = pk.neg().mul(&e_conv); s_times_g + &neg_e_times_pk }; let r_prime_coords = r_prime.to_field_elements()?; // Compute e' = H(m || R' || pk.x) let mut hash_input = Vec::new(); hash_input.extend_from_slice(message); hash_input.extend_from_slice(r_prime_coords.as_slice()); hash_input.push(pk_coords[0]); let e_prime = H::evaluate(hash_input.as_ref())?; Ok(signature.e == e_prime) } fn keyverify(pk: &Self::PublicKey) -> bool { pk.group_membership_test() } } #[cfg(test)] mod test { use algebra::curves::{ mnt4753::G1Projective as MNT4G1Projective, mnt6753::G1Projective as MNT6G1Projective, }; use algebra::fields::{ mnt4753::Fr as MNT4Fr, mnt6753::Fr as MNT6Fr, }; use algebra::{ToBytes, to_bytes, FromBytes}; use crate::crh::{MNT4PoseidonHash, MNT6PoseidonHash}; use crate::signature::FieldBasedSignatureScheme; use crate::signature::schnorr::field_based_schnorr::FieldBasedSchnorrSignatureScheme; use rand::{Rng, thread_rng}; type SchnorrMNT4 = FieldBasedSchnorrSignatureScheme<MNT4Fr, MNT6G1Projective, MNT4PoseidonHash>; type SchnorrMNT6 = FieldBasedSchnorrSignatureScheme<MNT6Fr, MNT4G1Projective, MNT6PoseidonHash>; fn sign_and_verify<S: FieldBasedSignatureScheme, R: Rng>(rng: &mut R, message: &[S::Data]) { let (pk, sk) = S::keygen(rng); assert!(S::keyverify(&pk)); assert_eq!(pk, S::get_public_key(&sk)); let sig = S::sign(rng, &pk, &sk, &message).unwrap(); assert!(S::verify(&pk, &message, &sig).unwrap()); //Serialization/deserialization test let sig_serialized = to_bytes!(sig).unwrap(); let sig_deserialized = <S as FieldBasedSignatureScheme>::Signature::read(sig_serialized.as_slice()).unwrap(); assert_eq!(sig, sig_deserialized); assert!(S::verify(&pk, &message, &sig_deserialized).unwrap()); } fn failed_verification<S: FieldBasedSignatureScheme, R: Rng>(rng: &mut R, message: &[S::Data], bad_message: &[S::Data]) { let (pk, sk) = S::keygen(rng); assert!(S::keyverify(&pk)); assert_eq!(pk, S::get_public_key(&sk)); //Attempt to verify a signature for a different message let sig = S::sign(rng, &pk, &sk, message).unwrap(); assert!(!S::verify(&pk, bad_message, &sig).unwrap()); //Attempt to verify a different signature for a message let bad_sig = S::sign(rng, &pk, &sk, bad_message).unwrap(); assert!(!S::verify(&pk, message, &bad_sig).unwrap()); //Attempt to verify a signature for a message but with different public key let (new_pk, _) = S::keygen(rng); assert!(!S::verify(&new_pk, message, &sig).unwrap()); } #[test] fn mnt4_schnorr_test() { let rng = &mut thread_rng(); let samples = 100; for _ in 0..samples { let f: MNT4Fr = rng.gen(); let g: MNT4Fr = rng.gen(); sign_and_verify::<SchnorrMNT4, _>(rng, &[f, g]); failed_verification::<SchnorrMNT4, _>(rng, &[f], &[g]); } } #[test] fn mnt6_schnorr_test() { let rng = &mut thread_rng(); let samples = 100; for _ in 0..samples{ let f: MNT6Fr = rng.gen(); let g: MNT6Fr = rng.gen(); sign_and_verify::<SchnorrMNT6, _>(rng,&[f, g]); failed_verification::<SchnorrMNT6, _>(rng, &[f], &[g]); } } }
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // run-pass use std::fmt; struct NoisyDrop<T: fmt::Debug>(T); impl<T: fmt::Debug> Drop for NoisyDrop<T> { fn drop(&mut self) {} } struct Bar<T: fmt::Debug>([*const NoisyDrop<T>; 2]); fn fine() { let (u,b); u = vec![43]; b = Bar([&NoisyDrop(&u), &NoisyDrop(&u)]); } struct Bar2<T: fmt::Debug>(*const NoisyDrop<T>, *const NoisyDrop<T>); fn lolwut() { let (u,v); u = vec![43]; v = Bar2(&NoisyDrop(&u), &NoisyDrop(&u)); } fn main() { fine(); lolwut() }
use proconio::input; fn gcd(a: u64, b: u64) -> u64 { if b == 0 { a } else { gcd(b, a % b) } } fn solve(n: u64, d: u64, k: u64) { let g = gcd(n, d); let x = (k - 1) / (n / g); let ans = x + ((k - 1) % (n / g)) * d; println!("{}", ans % n); } fn main() { input! { t: usize, }; for _ in 0..t { input! { n: u64, d: u64, k: u64, }; solve(n, d, k); } }
#[doc = "Reader of register CALCTRL"] pub type R = crate::R<u32, super::CALCTRL>; #[doc = "Writer for register CALCTRL"] pub type W = crate::W<u32, super::CALCTRL>; #[doc = "Register CALCTRL `reset()`'s with value 0"] impl crate::ResetValue for super::CALCTRL { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Calibration Up-counter Select\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum UPSEL_A { #[doc = "0: Select HFXO as up-counter"] HFXO = 0, #[doc = "1: Select LFXO as up-counter"] LFXO = 1, #[doc = "2: Select HFRCO as up-counter"] HFRCO = 2, #[doc = "3: Select LFRCO as up-counter"] LFRCO = 3, #[doc = "4: Select AUXHFRCO as up-counter"] AUXHFRCO = 4, #[doc = "5: Select PRS input selected by PRSUPSEL as up-counter"] PRS = 5, } impl From<UPSEL_A> for u8 { #[inline(always)] fn from(variant: UPSEL_A) -> Self { variant as _ } } #[doc = "Reader of field `UPSEL`"] pub type UPSEL_R = crate::R<u8, UPSEL_A>; impl UPSEL_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, UPSEL_A> { use crate::Variant::*; match self.bits { 0 => Val(UPSEL_A::HFXO), 1 => Val(UPSEL_A::LFXO), 2 => Val(UPSEL_A::HFRCO), 3 => Val(UPSEL_A::LFRCO), 4 => Val(UPSEL_A::AUXHFRCO), 5 => Val(UPSEL_A::PRS), i => Res(i), } } #[doc = "Checks if the value of the field is `HFXO`"] #[inline(always)] pub fn is_hfxo(&self) -> bool { *self == UPSEL_A::HFXO } #[doc = "Checks if the value of the field is `LFXO`"] #[inline(always)] pub fn is_lfxo(&self) -> bool { *self == UPSEL_A::LFXO } #[doc = "Checks if the value of the field is `HFRCO`"] #[inline(always)] pub fn is_hfrco(&self) -> bool { *self == UPSEL_A::HFRCO } #[doc = "Checks if the value of the field is `LFRCO`"] #[inline(always)] pub fn is_lfrco(&self) -> bool { *self == UPSEL_A::LFRCO } #[doc = "Checks if the value of the field is `AUXHFRCO`"] #[inline(always)] pub fn is_auxhfrco(&self) -> bool { *self == UPSEL_A::AUXHFRCO } #[doc = "Checks if the value of the field is `PRS`"] #[inline(always)] pub fn is_prs(&self) -> bool { *self == UPSEL_A::PRS } } #[doc = "Write proxy for field `UPSEL`"] pub struct UPSEL_W<'a> { w: &'a mut W, } impl<'a> UPSEL_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: UPSEL_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "Select HFXO as up-counter"] #[inline(always)] pub fn hfxo(self) -> &'a mut W { self.variant(UPSEL_A::HFXO) } #[doc = "Select LFXO as up-counter"] #[inline(always)] pub fn lfxo(self) -> &'a mut W { self.variant(UPSEL_A::LFXO) } #[doc = "Select HFRCO as up-counter"] #[inline(always)] pub fn hfrco(self) -> &'a mut W { self.variant(UPSEL_A::HFRCO) } #[doc = "Select LFRCO as up-counter"] #[inline(always)] pub fn lfrco(self) -> &'a mut W { self.variant(UPSEL_A::LFRCO) } #[doc = "Select AUXHFRCO as up-counter"] #[inline(always)] pub fn auxhfrco(self) -> &'a mut W { self.variant(UPSEL_A::AUXHFRCO) } #[doc = "Select PRS input selected by PRSUPSEL as up-counter"] #[inline(always)] pub fn prs(self) -> &'a mut W { self.variant(UPSEL_A::PRS) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !0x07) | ((value as u32) & 0x07); self.w } } #[doc = "Calibration Down-counter Select\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum DOWNSEL_A { #[doc = "0: Select HFCLK for down-counter"] HFCLK = 0, #[doc = "1: Select HFXO for down-counter"] HFXO = 1, #[doc = "2: Select LFXO for down-counter"] LFXO = 2, #[doc = "3: Select HFRCO for down-counter"] HFRCO = 3, #[doc = "4: Select LFRCO for down-counter"] LFRCO = 4, #[doc = "5: Select AUXHFRCO for down-counter"] AUXHFRCO = 5, #[doc = "6: Select PRS input selected by PRSDOWNSEL as down-counter"] PRS = 6, } impl From<DOWNSEL_A> for u8 { #[inline(always)] fn from(variant: DOWNSEL_A) -> Self { variant as _ } } #[doc = "Reader of field `DOWNSEL`"] pub type DOWNSEL_R = crate::R<u8, DOWNSEL_A>; impl DOWNSEL_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, DOWNSEL_A> { use crate::Variant::*; match self.bits { 0 => Val(DOWNSEL_A::HFCLK), 1 => Val(DOWNSEL_A::HFXO), 2 => Val(DOWNSEL_A::LFXO), 3 => Val(DOWNSEL_A::HFRCO), 4 => Val(DOWNSEL_A::LFRCO), 5 => Val(DOWNSEL_A::AUXHFRCO), 6 => Val(DOWNSEL_A::PRS), i => Res(i), } } #[doc = "Checks if the value of the field is `HFCLK`"] #[inline(always)] pub fn is_hfclk(&self) -> bool { *self == DOWNSEL_A::HFCLK } #[doc = "Checks if the value of the field is `HFXO`"] #[inline(always)] pub fn is_hfxo(&self) -> bool { *self == DOWNSEL_A::HFXO } #[doc = "Checks if the value of the field is `LFXO`"] #[inline(always)] pub fn is_lfxo(&self) -> bool { *self == DOWNSEL_A::LFXO } #[doc = "Checks if the value of the field is `HFRCO`"] #[inline(always)] pub fn is_hfrco(&self) -> bool { *self == DOWNSEL_A::HFRCO } #[doc = "Checks if the value of the field is `LFRCO`"] #[inline(always)] pub fn is_lfrco(&self) -> bool { *self == DOWNSEL_A::LFRCO } #[doc = "Checks if the value of the field is `AUXHFRCO`"] #[inline(always)] pub fn is_auxhfrco(&self) -> bool { *self == DOWNSEL_A::AUXHFRCO } #[doc = "Checks if the value of the field is `PRS`"] #[inline(always)] pub fn is_prs(&self) -> bool { *self == DOWNSEL_A::PRS } } #[doc = "Write proxy for field `DOWNSEL`"] pub struct DOWNSEL_W<'a> { w: &'a mut W, } impl<'a> DOWNSEL_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: DOWNSEL_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "Select HFCLK for down-counter"] #[inline(always)] pub fn hfclk(self) -> &'a mut W { self.variant(DOWNSEL_A::HFCLK) } #[doc = "Select HFXO for down-counter"] #[inline(always)] pub fn hfxo(self) -> &'a mut W { self.variant(DOWNSEL_A::HFXO) } #[doc = "Select LFXO for down-counter"] #[inline(always)] pub fn lfxo(self) -> &'a mut W { self.variant(DOWNSEL_A::LFXO) } #[doc = "Select HFRCO for down-counter"] #[inline(always)] pub fn hfrco(self) -> &'a mut W { self.variant(DOWNSEL_A::HFRCO) } #[doc = "Select LFRCO for down-counter"] #[inline(always)] pub fn lfrco(self) -> &'a mut W { self.variant(DOWNSEL_A::LFRCO) } #[doc = "Select AUXHFRCO for down-counter"] #[inline(always)] pub fn auxhfrco(self) -> &'a mut W { self.variant(DOWNSEL_A::AUXHFRCO) } #[doc = "Select PRS input selected by PRSDOWNSEL as down-counter"] #[inline(always)] pub fn prs(self) -> &'a mut W { self.variant(DOWNSEL_A::PRS) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x07 << 4)) | (((value as u32) & 0x07) << 4); self.w } } #[doc = "Reader of field `CONT`"] pub type CONT_R = crate::R<bool, bool>; #[doc = "Write proxy for field `CONT`"] pub struct CONT_W<'a> { w: &'a mut W, } impl<'a> CONT_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8); self.w } } #[doc = "PRS Select for PRS Input When Selected in UPSEL\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum PRSUPSEL_A { #[doc = "0: PRS Channel 0 selected as input"] PRSCH0 = 0, #[doc = "1: PRS Channel 1 selected as input"] PRSCH1 = 1, #[doc = "2: PRS Channel 2 selected as input"] PRSCH2 = 2, #[doc = "3: PRS Channel 3 selected as input"] PRSCH3 = 3, #[doc = "4: PRS Channel 4 selected as input"] PRSCH4 = 4, #[doc = "5: PRS Channel 5 selected as input"] PRSCH5 = 5, #[doc = "6: PRS Channel 6 selected as input"] PRSCH6 = 6, #[doc = "7: PRS Channel 7 selected as input"] PRSCH7 = 7, #[doc = "8: PRS Channel 8 selected as input"] PRSCH8 = 8, #[doc = "9: PRS Channel 9 selected as input"] PRSCH9 = 9, #[doc = "10: PRS Channel 10 selected as input"] PRSCH10 = 10, #[doc = "11: PRS Channel 11 selected as input"] PRSCH11 = 11, } impl From<PRSUPSEL_A> for u8 { #[inline(always)] fn from(variant: PRSUPSEL_A) -> Self { variant as _ } } #[doc = "Reader of field `PRSUPSEL`"] pub type PRSUPSEL_R = crate::R<u8, PRSUPSEL_A>; impl PRSUPSEL_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, PRSUPSEL_A> { use crate::Variant::*; match self.bits { 0 => Val(PRSUPSEL_A::PRSCH0), 1 => Val(PRSUPSEL_A::PRSCH1), 2 => Val(PRSUPSEL_A::PRSCH2), 3 => Val(PRSUPSEL_A::PRSCH3), 4 => Val(PRSUPSEL_A::PRSCH4), 5 => Val(PRSUPSEL_A::PRSCH5), 6 => Val(PRSUPSEL_A::PRSCH6), 7 => Val(PRSUPSEL_A::PRSCH7), 8 => Val(PRSUPSEL_A::PRSCH8), 9 => Val(PRSUPSEL_A::PRSCH9), 10 => Val(PRSUPSEL_A::PRSCH10), 11 => Val(PRSUPSEL_A::PRSCH11), i => Res(i), } } #[doc = "Checks if the value of the field is `PRSCH0`"] #[inline(always)] pub fn is_prsch0(&self) -> bool { *self == PRSUPSEL_A::PRSCH0 } #[doc = "Checks if the value of the field is `PRSCH1`"] #[inline(always)] pub fn is_prsch1(&self) -> bool { *self == PRSUPSEL_A::PRSCH1 } #[doc = "Checks if the value of the field is `PRSCH2`"] #[inline(always)] pub fn is_prsch2(&self) -> bool { *self == PRSUPSEL_A::PRSCH2 } #[doc = "Checks if the value of the field is `PRSCH3`"] #[inline(always)] pub fn is_prsch3(&self) -> bool { *self == PRSUPSEL_A::PRSCH3 } #[doc = "Checks if the value of the field is `PRSCH4`"] #[inline(always)] pub fn is_prsch4(&self) -> bool { *self == PRSUPSEL_A::PRSCH4 } #[doc = "Checks if the value of the field is `PRSCH5`"] #[inline(always)] pub fn is_prsch5(&self) -> bool { *self == PRSUPSEL_A::PRSCH5 } #[doc = "Checks if the value of the field is `PRSCH6`"] #[inline(always)] pub fn is_prsch6(&self) -> bool { *self == PRSUPSEL_A::PRSCH6 } #[doc = "Checks if the value of the field is `PRSCH7`"] #[inline(always)] pub fn is_prsch7(&self) -> bool { *self == PRSUPSEL_A::PRSCH7 } #[doc = "Checks if the value of the field is `PRSCH8`"] #[inline(always)] pub fn is_prsch8(&self) -> bool { *self == PRSUPSEL_A::PRSCH8 } #[doc = "Checks if the value of the field is `PRSCH9`"] #[inline(always)] pub fn is_prsch9(&self) -> bool { *self == PRSUPSEL_A::PRSCH9 } #[doc = "Checks if the value of the field is `PRSCH10`"] #[inline(always)] pub fn is_prsch10(&self) -> bool { *self == PRSUPSEL_A::PRSCH10 } #[doc = "Checks if the value of the field is `PRSCH11`"] #[inline(always)] pub fn is_prsch11(&self) -> bool { *self == PRSUPSEL_A::PRSCH11 } } #[doc = "Write proxy for field `PRSUPSEL`"] pub struct PRSUPSEL_W<'a> { w: &'a mut W, } impl<'a> PRSUPSEL_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: PRSUPSEL_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "PRS Channel 0 selected as input"] #[inline(always)] pub fn prsch0(self) -> &'a mut W { self.variant(PRSUPSEL_A::PRSCH0) } #[doc = "PRS Channel 1 selected as input"] #[inline(always)] pub fn prsch1(self) -> &'a mut W { self.variant(PRSUPSEL_A::PRSCH1) } #[doc = "PRS Channel 2 selected as input"] #[inline(always)] pub fn prsch2(self) -> &'a mut W { self.variant(PRSUPSEL_A::PRSCH2) } #[doc = "PRS Channel 3 selected as input"] #[inline(always)] pub fn prsch3(self) -> &'a mut W { self.variant(PRSUPSEL_A::PRSCH3) } #[doc = "PRS Channel 4 selected as input"] #[inline(always)] pub fn prsch4(self) -> &'a mut W { self.variant(PRSUPSEL_A::PRSCH4) } #[doc = "PRS Channel 5 selected as input"] #[inline(always)] pub fn prsch5(self) -> &'a mut W { self.variant(PRSUPSEL_A::PRSCH5) } #[doc = "PRS Channel 6 selected as input"] #[inline(always)] pub fn prsch6(self) -> &'a mut W { self.variant(PRSUPSEL_A::PRSCH6) } #[doc = "PRS Channel 7 selected as input"] #[inline(always)] pub fn prsch7(self) -> &'a mut W { self.variant(PRSUPSEL_A::PRSCH7) } #[doc = "PRS Channel 8 selected as input"] #[inline(always)] pub fn prsch8(self) -> &'a mut W { self.variant(PRSUPSEL_A::PRSCH8) } #[doc = "PRS Channel 9 selected as input"] #[inline(always)] pub fn prsch9(self) -> &'a mut W { self.variant(PRSUPSEL_A::PRSCH9) } #[doc = "PRS Channel 10 selected as input"] #[inline(always)] pub fn prsch10(self) -> &'a mut W { self.variant(PRSUPSEL_A::PRSCH10) } #[doc = "PRS Channel 11 selected as input"] #[inline(always)] pub fn prsch11(self) -> &'a mut W { self.variant(PRSUPSEL_A::PRSCH11) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x0f << 16)) | (((value as u32) & 0x0f) << 16); self.w } } #[doc = "PRS Select for PRS Input When Selected in DOWNSEL\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum PRSDOWNSEL_A { #[doc = "0: PRS Channel 0 selected as input"] PRSCH0 = 0, #[doc = "1: PRS Channel 1 selected as input"] PRSCH1 = 1, #[doc = "2: PRS Channel 2 selected as input"] PRSCH2 = 2, #[doc = "3: PRS Channel 3 selected as input"] PRSCH3 = 3, #[doc = "4: PRS Channel 4 selected as input"] PRSCH4 = 4, #[doc = "5: PRS Channel 5 selected as input"] PRSCH5 = 5, #[doc = "6: PRS Channel 6 selected as input"] PRSCH6 = 6, #[doc = "7: PRS Channel 7 selected as input"] PRSCH7 = 7, #[doc = "8: PRS Channel 8 selected as input"] PRSCH8 = 8, #[doc = "9: PRS Channel 9 selected as input"] PRSCH9 = 9, #[doc = "10: PRS Channel 10 selected as input"] PRSCH10 = 10, #[doc = "11: PRS Channel 11 selected as input"] PRSCH11 = 11, } impl From<PRSDOWNSEL_A> for u8 { #[inline(always)] fn from(variant: PRSDOWNSEL_A) -> Self { variant as _ } } #[doc = "Reader of field `PRSDOWNSEL`"] pub type PRSDOWNSEL_R = crate::R<u8, PRSDOWNSEL_A>; impl PRSDOWNSEL_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, PRSDOWNSEL_A> { use crate::Variant::*; match self.bits { 0 => Val(PRSDOWNSEL_A::PRSCH0), 1 => Val(PRSDOWNSEL_A::PRSCH1), 2 => Val(PRSDOWNSEL_A::PRSCH2), 3 => Val(PRSDOWNSEL_A::PRSCH3), 4 => Val(PRSDOWNSEL_A::PRSCH4), 5 => Val(PRSDOWNSEL_A::PRSCH5), 6 => Val(PRSDOWNSEL_A::PRSCH6), 7 => Val(PRSDOWNSEL_A::PRSCH7), 8 => Val(PRSDOWNSEL_A::PRSCH8), 9 => Val(PRSDOWNSEL_A::PRSCH9), 10 => Val(PRSDOWNSEL_A::PRSCH10), 11 => Val(PRSDOWNSEL_A::PRSCH11), i => Res(i), } } #[doc = "Checks if the value of the field is `PRSCH0`"] #[inline(always)] pub fn is_prsch0(&self) -> bool { *self == PRSDOWNSEL_A::PRSCH0 } #[doc = "Checks if the value of the field is `PRSCH1`"] #[inline(always)] pub fn is_prsch1(&self) -> bool { *self == PRSDOWNSEL_A::PRSCH1 } #[doc = "Checks if the value of the field is `PRSCH2`"] #[inline(always)] pub fn is_prsch2(&self) -> bool { *self == PRSDOWNSEL_A::PRSCH2 } #[doc = "Checks if the value of the field is `PRSCH3`"] #[inline(always)] pub fn is_prsch3(&self) -> bool { *self == PRSDOWNSEL_A::PRSCH3 } #[doc = "Checks if the value of the field is `PRSCH4`"] #[inline(always)] pub fn is_prsch4(&self) -> bool { *self == PRSDOWNSEL_A::PRSCH4 } #[doc = "Checks if the value of the field is `PRSCH5`"] #[inline(always)] pub fn is_prsch5(&self) -> bool { *self == PRSDOWNSEL_A::PRSCH5 } #[doc = "Checks if the value of the field is `PRSCH6`"] #[inline(always)] pub fn is_prsch6(&self) -> bool { *self == PRSDOWNSEL_A::PRSCH6 } #[doc = "Checks if the value of the field is `PRSCH7`"] #[inline(always)] pub fn is_prsch7(&self) -> bool { *self == PRSDOWNSEL_A::PRSCH7 } #[doc = "Checks if the value of the field is `PRSCH8`"] #[inline(always)] pub fn is_prsch8(&self) -> bool { *self == PRSDOWNSEL_A::PRSCH8 } #[doc = "Checks if the value of the field is `PRSCH9`"] #[inline(always)] pub fn is_prsch9(&self) -> bool { *self == PRSDOWNSEL_A::PRSCH9 } #[doc = "Checks if the value of the field is `PRSCH10`"] #[inline(always)] pub fn is_prsch10(&self) -> bool { *self == PRSDOWNSEL_A::PRSCH10 } #[doc = "Checks if the value of the field is `PRSCH11`"] #[inline(always)] pub fn is_prsch11(&self) -> bool { *self == PRSDOWNSEL_A::PRSCH11 } } #[doc = "Write proxy for field `PRSDOWNSEL`"] pub struct PRSDOWNSEL_W<'a> { w: &'a mut W, } impl<'a> PRSDOWNSEL_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: PRSDOWNSEL_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "PRS Channel 0 selected as input"] #[inline(always)] pub fn prsch0(self) -> &'a mut W { self.variant(PRSDOWNSEL_A::PRSCH0) } #[doc = "PRS Channel 1 selected as input"] #[inline(always)] pub fn prsch1(self) -> &'a mut W { self.variant(PRSDOWNSEL_A::PRSCH1) } #[doc = "PRS Channel 2 selected as input"] #[inline(always)] pub fn prsch2(self) -> &'a mut W { self.variant(PRSDOWNSEL_A::PRSCH2) } #[doc = "PRS Channel 3 selected as input"] #[inline(always)] pub fn prsch3(self) -> &'a mut W { self.variant(PRSDOWNSEL_A::PRSCH3) } #[doc = "PRS Channel 4 selected as input"] #[inline(always)] pub fn prsch4(self) -> &'a mut W { self.variant(PRSDOWNSEL_A::PRSCH4) } #[doc = "PRS Channel 5 selected as input"] #[inline(always)] pub fn prsch5(self) -> &'a mut W { self.variant(PRSDOWNSEL_A::PRSCH5) } #[doc = "PRS Channel 6 selected as input"] #[inline(always)] pub fn prsch6(self) -> &'a mut W { self.variant(PRSDOWNSEL_A::PRSCH6) } #[doc = "PRS Channel 7 selected as input"] #[inline(always)] pub fn prsch7(self) -> &'a mut W { self.variant(PRSDOWNSEL_A::PRSCH7) } #[doc = "PRS Channel 8 selected as input"] #[inline(always)] pub fn prsch8(self) -> &'a mut W { self.variant(PRSDOWNSEL_A::PRSCH8) } #[doc = "PRS Channel 9 selected as input"] #[inline(always)] pub fn prsch9(self) -> &'a mut W { self.variant(PRSDOWNSEL_A::PRSCH9) } #[doc = "PRS Channel 10 selected as input"] #[inline(always)] pub fn prsch10(self) -> &'a mut W { self.variant(PRSDOWNSEL_A::PRSCH10) } #[doc = "PRS Channel 11 selected as input"] #[inline(always)] pub fn prsch11(self) -> &'a mut W { self.variant(PRSDOWNSEL_A::PRSCH11) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x0f << 24)) | (((value as u32) & 0x0f) << 24); self.w } } impl R { #[doc = "Bits 0:2 - Calibration Up-counter Select"] #[inline(always)] pub fn upsel(&self) -> UPSEL_R { UPSEL_R::new((self.bits & 0x07) as u8) } #[doc = "Bits 4:6 - Calibration Down-counter Select"] #[inline(always)] pub fn downsel(&self) -> DOWNSEL_R { DOWNSEL_R::new(((self.bits >> 4) & 0x07) as u8) } #[doc = "Bit 8 - Continuous Calibration"] #[inline(always)] pub fn cont(&self) -> CONT_R { CONT_R::new(((self.bits >> 8) & 0x01) != 0) } #[doc = "Bits 16:19 - PRS Select for PRS Input When Selected in UPSEL"] #[inline(always)] pub fn prsupsel(&self) -> PRSUPSEL_R { PRSUPSEL_R::new(((self.bits >> 16) & 0x0f) as u8) } #[doc = "Bits 24:27 - PRS Select for PRS Input When Selected in DOWNSEL"] #[inline(always)] pub fn prsdownsel(&self) -> PRSDOWNSEL_R { PRSDOWNSEL_R::new(((self.bits >> 24) & 0x0f) as u8) } } impl W { #[doc = "Bits 0:2 - Calibration Up-counter Select"] #[inline(always)] pub fn upsel(&mut self) -> UPSEL_W { UPSEL_W { w: self } } #[doc = "Bits 4:6 - Calibration Down-counter Select"] #[inline(always)] pub fn downsel(&mut self) -> DOWNSEL_W { DOWNSEL_W { w: self } } #[doc = "Bit 8 - Continuous Calibration"] #[inline(always)] pub fn cont(&mut self) -> CONT_W { CONT_W { w: self } } #[doc = "Bits 16:19 - PRS Select for PRS Input When Selected in UPSEL"] #[inline(always)] pub fn prsupsel(&mut self) -> PRSUPSEL_W { PRSUPSEL_W { w: self } } #[doc = "Bits 24:27 - PRS Select for PRS Input When Selected in DOWNSEL"] #[inline(always)] pub fn prsdownsel(&mut self) -> PRSDOWNSEL_W { PRSDOWNSEL_W { w: self } } }
pub mod default_alloc;
use dlal_component_base::{component, err, json, serde_json, Body, CmdResult}; use midir::{MidiInput, MidiInputConnection}; use multiqueue2::{MPMCSender, MPMCUniReceiver}; const MSG_CAP: usize = 3; fn new_midi_in() -> MidiInput { MidiInput::new("midir test input").expect("MidiInput::new failed") } component!( {"in": ["midi**"], "out": ["midi"]}, ["multi"], { conn: Option<MidiInputConnection<MPMCSender<[u8; MSG_CAP]>>>, recv: Option<MPMCUniReceiver<[u8; MSG_CAP]>>, }, { "ports": {}, "open": {"args": ["port_name_prefix"]}, }, ); impl Component { fn get_ports(&self) -> Vec<String> { let midi_in = new_midi_in(); (0..midi_in.port_count()) .map(|i| midi_in.port_name(i).expect("port_name failed")) .collect() } fn open(&mut self, port: usize) { let midi_in = new_midi_in(); let (send, recv) = multiqueue2::mpmc_queue(256); self.recv = Some(recv.into_single().expect("into_single failed")); let conn = midi_in .connect( port, "dlal-midir-input", move |_timestamp_us, msg, send| { if msg[0] >= 0xf0 { return; } send.try_send([msg[0], msg[1], *msg.get(2).unwrap_or(&(0 as u8))]) .expect("try_send failed"); }, send, ) .expect("MidiIn::connect failed"); std::thread::sleep(std::time::Duration::from_millis(10)); while self.recv.as_ref().unwrap().try_recv().is_ok() {} self.conn = Some(conn); } } impl ComponentTrait for Component { fn midi(&mut self, msg: &[u8]) { self.multi_midi(msg); } fn run(&mut self) { if self.recv.is_none() { return; } loop { match self.recv.as_ref().unwrap().try_recv() { Ok(msg) => { self.multi_midi(&msg); } Err(_) => return, } } } fn to_json_cmd(&mut self, _body: serde_json::Value) -> CmdResult { Ok(None) } fn from_json_cmd(&mut self, _body: serde_json::Value) -> CmdResult { Ok(None) } } impl Component { fn ports_cmd(&mut self, _body: serde_json::Value) -> CmdResult { Ok(Some(json!(self.get_ports()))) } fn open_cmd(&mut self, body: serde_json::Value) -> CmdResult { let port: String = body.arg(0)?; let ports = self.get_ports(); for (i, v) in ports.iter().enumerate() { if v.starts_with(&port) { self.open(i); return Ok(None); } } Err(err!("no such port").into()) } }
use std::env; use std::io::prelude::*; use std::io::BufReader; use std::fs::File; fn main() { let args: Vec<String> = env::args().collect(); let filename: &str = &args[1]; let file = File::open(filename).unwrap(); let mut reader = BufReader::new(file); let mut buf: [u8; 2880] = [0; 2880]; /* for _ in 0..6 { let len = reader.read(&mut buf).unwrap(); let line: String = buf.iter().map(|b: &u8| -> char {*b as char}).collect::<String>(); println!("{:?}", &line[0..len].split("=").collect::<Vec<&str>>().iter().map(|s| s.trim()).collect::<Vec<&str>>()); } loop { let len = reader.read(&mut buf).unwrap(); println!("{:?}", &buf[0..len]); if len == 0 { break; } } */ for _ in 0..2 { let len = reader.read(&mut buf).unwrap(); let line: String = buf.iter().map(|b: &u8| -> char {*b as char}).collect::<String>(); let res = parse_header(&line[0..len]); println!("{:?}", res); } } pub fn parse_keyword(s: &str) -> nom::IResult<&str, &str> { nom::bytes::complete::take_until(" ")(s) } pub fn parse_header(s: &str) -> Vec<&str> { let mut res: Vec<&str> = Vec::new(); for _ in 0..5 { let (rest, keyword): (&str, &str) = parse_keyword(s).unwrap(); let rest = rest.trim(); res.push(keyword); res.push(rest); } res }
fn main() { let contents = std::fs::read_to_string("./res/input.txt").expect("Could not read file"); let count: usize = contents.lines().collect::<Vec<&str>>().iter().map(|&l| { return l.split(['-',' ',':'].as_ref()).collect::<Vec<&str>>(); }).filter(|elem| { return (elem.get(4).unwrap().chars().nth(elem.get(0).unwrap().parse::<usize>().unwrap() - 1).unwrap() == elem.get(2).unwrap().chars().nth(0).unwrap()) ^ (elem.get(4).unwrap().chars().nth(elem.get(1).unwrap().parse::<usize>().unwrap() - 1).unwrap() == elem.get(2).unwrap().chars().nth(0).unwrap()); }).count(); println!("{}", count); }
#[doc = "Reader of register PC"] pub type R = crate::R<u32, super::PC>; #[doc = "Reader of field `HS`"] pub type HS_R = crate::R<bool, bool>; impl R { #[doc = "Bit 0 - High-Speed Capable"] #[inline(always)] pub fn hs(&self) -> HS_R { HS_R::new((self.bits & 0x01) != 0) } }
// 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::HashMap; use std::ops::Not; use common_arrow::arrow::bitmap; use common_arrow::arrow::bitmap::Bitmap; use common_exception::ErrorCode; use common_exception::Result; use common_exception::Span; use itertools::Itertools; use tracing::error; use crate::block::DataBlock; use crate::expression::Expr; use crate::function::EvalContext; use crate::property::Domain; use crate::type_check::check_function; use crate::type_check::get_simple_cast_function; use crate::types::any::AnyType; use crate::types::array::ArrayColumn; use crate::types::nullable::NullableColumn; use crate::types::nullable::NullableDomain; use crate::types::BooleanType; use crate::types::DataType; use crate::types::NullableType; use crate::utils::arrow::constant_bitmap; use crate::values::Column; use crate::values::ColumnBuilder; use crate::values::Scalar; use crate::values::Value; use crate::BlockEntry; use crate::ColumnIndex; use crate::FunctionContext; use crate::FunctionDomain; use crate::FunctionEval; use crate::FunctionRegistry; pub struct Evaluator<'a> { input_columns: &'a DataBlock, func_ctx: FunctionContext, fn_registry: &'a FunctionRegistry, } impl<'a> Evaluator<'a> { pub fn new( input_columns: &'a DataBlock, func_ctx: FunctionContext, fn_registry: &'a FunctionRegistry, ) -> Self { Evaluator { input_columns, func_ctx, fn_registry, } } #[cfg(debug_assertions)] fn check_expr(&self, expr: &Expr) { let column_refs = expr.column_refs(); for (index, datatype) in column_refs.iter() { let column = self.input_columns.get_by_offset(*index); assert_eq!( &column.data_type, datatype, "column datatype mismatch at index: {index}, expr: {} blocks: \n\n{}", expr.sql_display(), self.input_columns, ); } } /// TODO(sundy/andy): refactor this if we got better idea pub fn run_auto_type(&self, expr: &Expr) -> Result<Value<AnyType>> { let column_refs = expr.column_refs(); let mut columns = self.input_columns.columns().to_vec(); for (index, datatype) in column_refs.iter() { let column = &columns[*index]; if datatype != &column.data_type { let value = self.run(&Expr::Cast { span: None, is_try: false, expr: Box::new(Expr::ColumnRef { span: None, id: *index, data_type: column.data_type.clone(), display_name: String::new(), }), dest_type: datatype.clone(), })?; columns[*index] = BlockEntry { data_type: datatype.clone(), value, }; } } let new_blocks = DataBlock::new_with_meta( columns, self.input_columns.num_rows(), self.input_columns.get_meta().cloned(), ); let new_evaluator = Evaluator::new(&new_blocks, self.func_ctx, self.fn_registry); new_evaluator.run(expr) } pub fn run(&self, expr: &Expr) -> Result<Value<AnyType>> { self.partial_run(expr, None) } /// Run an expression partially, only the rows that are valid in the validity bitmap /// will be evaluated, the rest will be default values and should not throw any error. fn partial_run(&self, expr: &Expr, validity: Option<Bitmap>) -> Result<Value<AnyType>> { debug_assert!( validity.is_none() || validity.as_ref().unwrap().len() == self.input_columns.num_rows() ); #[cfg(debug_assertions)] self.check_expr(expr); let result = match expr { Expr::Constant { scalar, .. } => Ok(Value::Scalar(scalar.clone())), Expr::ColumnRef { id, .. } => Ok(self.input_columns.get_by_offset(*id).value.clone()), Expr::Cast { span, is_try, expr, dest_type, } => { let value = self.partial_run(expr, validity.clone())?; if *is_try { self.run_try_cast(*span, expr.data_type(), dest_type, value) } else { self.run_cast(*span, expr.data_type(), dest_type, value, validity) } } Expr::FunctionCall { function, args, generics, .. } if function.signature.name == "if" => self.eval_if(args, generics, validity), Expr::FunctionCall { span, function, args, generics, .. } => { let args = args .iter() .map(|expr| self.partial_run(expr, validity.clone())) .collect::<Result<Vec<_>>>()?; assert!( args.iter() .filter_map(|val| match val { Value::Column(col) => Some(col.len()), Value::Scalar(_) => None, }) .all_equal() ); let cols_ref = args.iter().map(Value::as_ref).collect::<Vec<_>>(); let mut ctx = EvalContext { generics, num_rows: self.input_columns.num_rows(), validity, errors: None, tz: self.func_ctx.tz, }; let (_, eval) = function.eval.as_scalar().unwrap(); let result = (eval)(cols_ref.as_slice(), &mut ctx); ctx.render_error(*span, &args, &function.signature.name)?; Ok(result) } }; #[cfg(debug_assertions)] if result.is_err() { use std::sync::atomic::AtomicBool; use std::sync::atomic::Ordering; static RECURSING: AtomicBool = AtomicBool::new(false); if RECURSING .compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst) .is_ok() { assert_eq!( ConstantFolder::fold_with_domain( expr, self.input_columns .domains() .into_iter() .enumerate() .collect(), self.func_ctx, self.fn_registry ) .1, None, "domain calculation should not return any domain for expressions that are possible to fail" ); RECURSING.store(false, Ordering::SeqCst); } } result } fn run_cast( &self, span: Span, src_type: &DataType, dest_type: &DataType, value: Value<AnyType>, validity: Option<Bitmap>, ) -> Result<Value<AnyType>> { if src_type == dest_type { return Ok(value); } if let Some(cast_fn) = get_simple_cast_function(false, dest_type) { if let Some(new_value) = self.run_simple_cast( span, src_type, dest_type, value.clone(), &cast_fn, validity.clone(), )? { return Ok(new_value); } } match (src_type, dest_type) { (DataType::Null, DataType::Nullable(_)) => match value { Value::Scalar(Scalar::Null) => Ok(Value::Scalar(Scalar::Null)), Value::Column(Column::Null { len }) => { let mut builder = ColumnBuilder::with_capacity(dest_type, len); for _ in 0..len { builder.push_default(); } Ok(Value::Column(builder.build())) } _ => unreachable!(), }, (DataType::Nullable(inner_src_ty), DataType::Nullable(inner_dest_ty)) => match value { Value::Scalar(Scalar::Null) => Ok(Value::Scalar(Scalar::Null)), Value::Scalar(_) => { self.run_cast(span, inner_src_ty, inner_dest_ty, value, validity) } Value::Column(Column::Nullable(col)) => { let validity = validity .map(|validity| (&validity) & (&col.validity)) .unwrap_or_else(|| col.validity.clone()); let column = self .run_cast( span, inner_src_ty, inner_dest_ty, Value::Column(col.column), Some(validity.clone()), )? .into_column() .unwrap(); Ok(Value::Column(Column::Nullable(Box::new(NullableColumn { column, validity, })))) } other => unreachable!("source: {}", other), }, (DataType::Nullable(inner_src_ty), _) => match value { Value::Scalar(Scalar::Null) => { let has_valid = validity .map(|validity| validity.unset_bits() < validity.len()) .unwrap_or(true); if has_valid { Err(ErrorCode::Internal(format!( "unable to cast type `NULL` to type `{dest_type}`" )) .set_span(span)) } else { Ok(Value::Scalar(Scalar::default_value(dest_type))) } } Value::Scalar(_) => self.run_cast(span, inner_src_ty, dest_type, value, validity), Value::Column(Column::Nullable(col)) => { let has_valid_nulls = validity .as_ref() .map(|validity| { (validity & (&col.validity)).unset_bits() > validity.unset_bits() }) .unwrap_or_else(|| col.validity.unset_bits() > 0); if has_valid_nulls { return Err(ErrorCode::Internal(format!( "unable to cast `NULL` to type `{dest_type}`" )) .set_span(span)); } let column = self .run_cast( span, inner_src_ty, dest_type, Value::Column(col.column), validity, )? .into_column() .unwrap(); Ok(Value::Column(column)) } other => unreachable!("source: {}", other), }, (_, DataType::Nullable(inner_dest_ty)) => match value { Value::Scalar(scalar) => self.run_cast( span, src_type, inner_dest_ty, Value::Scalar(scalar), validity, ), Value::Column(col) => { let column = self .run_cast(span, src_type, inner_dest_ty, Value::Column(col), validity)? .into_column() .unwrap(); Ok(Value::Column(Column::Nullable(Box::new(NullableColumn { validity: constant_bitmap(true, column.len()).into(), column, })))) } }, (DataType::EmptyArray, DataType::Array(inner_dest_ty)) => match value { Value::Scalar(Scalar::EmptyArray) => { let new_column = ColumnBuilder::with_capacity(inner_dest_ty, 0).build(); Ok(Value::Scalar(Scalar::Array(new_column))) } Value::Column(Column::EmptyArray { len }) => { let mut builder = ColumnBuilder::with_capacity(dest_type, len); for _ in 0..len { builder.push_default(); } Ok(Value::Column(builder.build())) } other => unreachable!("source: {}", other), }, (DataType::Array(inner_src_ty), DataType::Array(inner_dest_ty)) => match value { Value::Scalar(Scalar::Array(array)) => { let new_array = self .run_cast( span, inner_src_ty, inner_dest_ty, Value::Column(array), validity, )? .into_column() .unwrap(); Ok(Value::Scalar(Scalar::Array(new_array))) } Value::Column(Column::Array(col)) => { let new_col = self .run_cast( span, inner_src_ty, inner_dest_ty, Value::Column(col.values), validity, )? .into_column() .unwrap(); Ok(Value::Column(Column::Array(Box::new(ArrayColumn { values: new_col, offsets: col.offsets, })))) } other => unreachable!("source: {}", other), }, (DataType::EmptyMap, DataType::Map(inner_dest_ty)) => match value { Value::Scalar(Scalar::EmptyMap) => { let new_column = ColumnBuilder::with_capacity(inner_dest_ty, 0).build(); Ok(Value::Scalar(Scalar::Map(new_column))) } Value::Column(Column::EmptyMap { len }) => { let mut builder = ColumnBuilder::with_capacity(dest_type, len); for _ in 0..len { builder.push_default(); } Ok(Value::Column(builder.build())) } other => unreachable!("source: {}", other), }, (DataType::Map(inner_src_ty), DataType::Map(inner_dest_ty)) => match value { Value::Scalar(Scalar::Map(array)) => { let new_array = self .run_cast( span, inner_src_ty, inner_dest_ty, Value::Column(array), validity, )? .into_column() .unwrap(); Ok(Value::Scalar(Scalar::Map(new_array))) } Value::Column(Column::Map(col)) => { let new_col = self .run_cast( span, inner_src_ty, inner_dest_ty, Value::Column(col.values), validity, )? .into_column() .unwrap(); Ok(Value::Column(Column::Map(Box::new(ArrayColumn { values: new_col, offsets: col.offsets, })))) } other => unreachable!("source: {}", other), }, (DataType::Tuple(fields_src_ty), DataType::Tuple(fields_dest_ty)) if fields_src_ty.len() == fields_dest_ty.len() => { match value { Value::Scalar(Scalar::Tuple(fields)) => { let new_fields = fields .into_iter() .zip(fields_src_ty.iter()) .zip(fields_dest_ty.iter()) .map(|((field, src_ty), dest_ty)| { self.run_cast( span, src_ty, dest_ty, Value::Scalar(field), validity.clone(), ) .map(|val| val.into_scalar().unwrap()) }) .collect::<Result<Vec<_>>>()?; Ok(Value::Scalar(Scalar::Tuple(new_fields))) } Value::Column(Column::Tuple(fields)) => { let new_fields = fields .into_iter() .zip(fields_src_ty.iter()) .zip(fields_dest_ty.iter()) .map(|((field, src_ty), dest_ty)| { self.run_cast( span, src_ty, dest_ty, Value::Column(field), validity.clone(), ) .map(|val| val.into_column().unwrap()) }) .collect::<Result<_>>()?; Ok(Value::Column(Column::Tuple(new_fields))) } other => unreachable!("source: {}", other), } } _ => Err(ErrorCode::Internal(format!( "unable to cast type `{src_type}` to type `{dest_type}`" )) .set_span(span)), } } fn run_try_cast( &self, span: Span, src_type: &DataType, dest_type: &DataType, value: Value<AnyType>, ) -> Result<Value<AnyType>> { if src_type == dest_type { return Ok(value); } // The dest_type of `TRY_CAST` must be `Nullable`, which is guaranteed by the type checker. let inner_dest_type = &**dest_type.as_nullable().unwrap(); if let Some(cast_fn) = get_simple_cast_function(true, inner_dest_type) { // `try_to_xxx` functions must not return errors, so we can safely call them without concerning validity. if let Ok(Some(new_value)) = self.run_simple_cast(span, src_type, dest_type, value.clone(), &cast_fn, None) { return Ok(new_value); } } match (src_type, inner_dest_type) { (DataType::Null, _) => match value { Value::Scalar(Scalar::Null) => Ok(Value::Scalar(Scalar::Null)), Value::Column(Column::Null { len }) => { let mut builder = ColumnBuilder::with_capacity(dest_type, len); for _ in 0..len { builder.push_default(); } Ok(Value::Column(builder.build())) } other => unreachable!("source: {}", other), }, (DataType::Nullable(inner_src_ty), _) => match value { Value::Scalar(Scalar::Null) => Ok(Value::Scalar(Scalar::Null)), Value::Scalar(_) => self.run_try_cast(span, inner_src_ty, inner_dest_type, value), Value::Column(Column::Nullable(col)) => { let new_col = *self .run_try_cast(span, inner_src_ty, dest_type, Value::Column(col.column))? .into_column() .unwrap() .into_nullable() .unwrap(); Ok(Value::Column(Column::Nullable(Box::new(NullableColumn { column: new_col.column, validity: bitmap::and(&col.validity, &new_col.validity), })))) } other => unreachable!("source: {}", other), }, (src_ty, inner_dest_ty) if src_ty == inner_dest_ty => match value { Value::Scalar(_) => Ok(value), Value::Column(column) => { Ok(Value::Column(Column::Nullable(Box::new(NullableColumn { validity: constant_bitmap(true, column.len()).into(), column, })))) } }, (DataType::EmptyArray, DataType::Array(inner_dest_ty)) => match value { Value::Scalar(Scalar::EmptyArray) => { let new_column = ColumnBuilder::with_capacity(inner_dest_ty, 0).build(); Ok(Value::Scalar(Scalar::Array(new_column))) } Value::Column(Column::EmptyArray { len }) => { let mut builder = ColumnBuilder::with_capacity(dest_type, len); for _ in 0..len { builder.push_default(); } Ok(Value::Column(builder.build())) } other => unreachable!("source: {}", other), }, (DataType::Array(inner_src_ty), DataType::Array(inner_dest_ty)) => match value { Value::Scalar(Scalar::Array(array)) => { let new_array = self .run_try_cast(span, inner_src_ty, inner_dest_ty, Value::Column(array))? .into_column() .unwrap(); Ok(Value::Scalar(Scalar::Array(new_array))) } Value::Column(Column::Array(col)) => { let new_values = self .run_try_cast(span, inner_src_ty, inner_dest_ty, Value::Column(col.values))? .into_column() .unwrap(); let new_col = Column::Array(Box::new(ArrayColumn { values: new_values, offsets: col.offsets, })); Ok(Value::Column(Column::Nullable(Box::new(NullableColumn { validity: constant_bitmap(true, new_col.len()).into(), column: new_col, })))) } _ => unreachable!(), }, (DataType::EmptyMap, DataType::Map(inner_dest_ty)) => match value { Value::Scalar(Scalar::EmptyMap) => { let new_column = ColumnBuilder::with_capacity(inner_dest_ty, 0).build(); Ok(Value::Scalar(Scalar::Map(new_column))) } Value::Column(Column::EmptyMap { len }) => { let mut builder = ColumnBuilder::with_capacity(dest_type, len); for _ in 0..len { builder.push_default(); } Ok(Value::Column(builder.build())) } other => unreachable!("source: {}", other), }, (DataType::Map(inner_src_ty), DataType::Map(inner_dest_ty)) => match value { Value::Scalar(Scalar::Map(array)) => { let new_array = self .run_try_cast(span, inner_src_ty, inner_dest_ty, Value::Column(array))? .into_column() .unwrap(); Ok(Value::Scalar(Scalar::Map(new_array))) } Value::Column(Column::Map(col)) => { let new_values = self .run_try_cast(span, inner_src_ty, inner_dest_ty, Value::Column(col.values))? .into_column() .unwrap(); let new_col = Column::Map(Box::new(ArrayColumn { values: new_values, offsets: col.offsets, })); Ok(Value::Column(Column::Nullable(Box::new(NullableColumn { validity: constant_bitmap(true, new_col.len()).into(), column: new_col, })))) } _ => unreachable!(), }, (DataType::Tuple(fields_src_ty), DataType::Tuple(fields_dest_ty)) if fields_src_ty.len() == fields_dest_ty.len() => { match value { Value::Scalar(Scalar::Tuple(fields)) => { let new_fields = fields .into_iter() .zip(fields_src_ty.iter()) .zip(fields_dest_ty.iter()) .map(|((field, src_ty), dest_ty)| { Ok(self .run_try_cast(span, src_ty, dest_ty, Value::Scalar(field))? .into_scalar() .unwrap()) }) .collect::<Result<_>>()?; Ok(Value::Scalar(Scalar::Tuple(new_fields))) } Value::Column(Column::Tuple(fields)) => { let new_fields = fields .into_iter() .zip(fields_src_ty.iter()) .zip(fields_dest_ty.iter()) .map(|((field, src_ty), dest_ty)| { Ok(self .run_try_cast(span, src_ty, dest_ty, Value::Column(field))? .into_column() .unwrap()) }) .collect::<Result<_>>()?; let new_col = Column::Tuple(new_fields); Ok(Value::Column(new_col)) } other => unreachable!("source: {}", other), } } _ => Err(ErrorCode::Internal(format!( "unable to cast type `{src_type}` to type `{dest_type}`" )) .set_span(span)), } } fn run_simple_cast( &self, span: Span, src_type: &DataType, dest_type: &DataType, value: Value<AnyType>, cast_fn: &str, validity: Option<Bitmap>, ) -> Result<Option<Value<AnyType>>> { let expr = Expr::ColumnRef { span, id: 0, data_type: src_type.clone(), display_name: String::new(), }; let params = if let DataType::Decimal(ty) = dest_type { vec![ty.precision() as usize, ty.scale() as usize] } else { vec![] }; let cast_expr = match check_function(span, cast_fn, &params, &[expr], self.fn_registry) { Ok(cast_expr) => cast_expr, Err(_) => return Ok(None), }; if cast_expr.data_type() != dest_type { return Ok(None); } let num_rows = match &value { Value::Scalar(_) => 1, Value::Column(col) => col.len(), }; let block = DataBlock::new( vec![BlockEntry { data_type: src_type.clone(), value, }], num_rows, ); let evaluator = Evaluator::new(&block, self.func_ctx, self.fn_registry); Ok(Some(evaluator.partial_run(&cast_expr, validity)?)) } // `if` is a special builtin function that could partially evaluate its arguments // depending on the truthess of the condition. `if` should register it's signature // as other functions do in `FunctionRegistry`, but it's does not necessarily implement // the eval function because it will be evaluated here. fn eval_if( &self, args: &[Expr], generics: &[DataType], validity: Option<Bitmap>, ) -> Result<Value<AnyType>> { if args.len() < 3 && args.len() % 2 == 0 { unreachable!() } let num_rows = self.input_columns.num_rows(); let len = self .input_columns .columns() .iter() .find_map(|col| match &col.value { Value::Column(col) => Some(col.len()), _ => None, }); // Evaluate the condition first and then partially evaluate the result branches. let mut validity = validity.unwrap_or_else(|| constant_bitmap(true, num_rows).into()); let mut conds = Vec::new(); let mut flags = Vec::new(); let mut results = Vec::new(); for cond_idx in (0..args.len() - 1).step_by(2) { let cond = self.partial_run(&args[cond_idx], Some(validity.clone()))?; match cond.try_downcast::<NullableType<BooleanType>>().unwrap() { Value::Scalar(None | Some(false)) => { results.push(Value::Scalar(Scalar::default_value(&generics[0]))); flags.push(constant_bitmap(false, len.unwrap_or(1)).into()); } Value::Scalar(Some(true)) => { results.push(self.partial_run(&args[cond_idx + 1], Some(validity.clone()))?); validity = constant_bitmap(false, num_rows).into(); flags.push(constant_bitmap(true, len.unwrap_or(1)).into()); break; } Value::Column(cond) => { let flag = (&cond.column) & (&cond.validity); results .push(self.partial_run(&args[cond_idx + 1], Some((&validity) & (&flag)))?); validity = (&validity) & (&flag.not()); flags.push(flag); } }; conds.push(cond); } let else_result = self.partial_run(&args[args.len() - 1], Some(validity))?; // Assert that all the arguments have the same length. assert!( conds .iter() .chain(results.iter()) .chain([&else_result]) .filter_map(|val| match val { Value::Column(col) => Some(col.len()), Value::Scalar(_) => None, }) .all_equal() ); // Pick the results from the result branches depending on the condition. let mut output_builder = ColumnBuilder::with_capacity(&generics[0], len.unwrap_or(1)); for row_idx in 0..(len.unwrap_or(1)) { unsafe { let result = flags .iter() .position(|flag| flag.get_bit(row_idx)) .map(|idx| results[idx].index_unchecked(row_idx)) .unwrap_or(else_result.index_unchecked(row_idx)); output_builder.push(result); } } match len { Some(_) => Ok(Value::Column(output_builder.build())), None => Ok(Value::Scalar(output_builder.build_scalar())), } } /// Evaluate a set returning function. Return multiple chunks of results, and the repeat times of each of the result. pub fn run_srf(&self, expr: &Expr) -> Result<Vec<(Value<AnyType>, usize)>> { if let Expr::FunctionCall { function, args, return_type, .. } = expr { if let FunctionEval::SRF { eval } = &function.eval { assert!(return_type.as_tuple().is_some()); let args = args .iter() .map(|expr| self.run(expr)) .collect::<Result<Vec<_>>>()?; let cols_ref = args.iter().map(Value::as_ref).collect::<Vec<_>>(); return Ok((eval)(&cols_ref, self.input_columns.num_rows())); } } unreachable!("expr is not a set returning function: {expr}") } } pub struct ConstantFolder<'a, Index: ColumnIndex> { input_domains: HashMap<Index, Domain>, func_ctx: FunctionContext, fn_registry: &'a FunctionRegistry, } impl<'a, Index: ColumnIndex> ConstantFolder<'a, Index> { /// Fold a single expression, returning the new expression and the domain of the new expression. pub fn fold( expr: &Expr<Index>, func_ctx: FunctionContext, fn_registry: &'a FunctionRegistry, ) -> (Expr<Index>, Option<Domain>) { let input_domains = expr .column_refs() .into_iter() .map(|(id, ty)| { let domain = Domain::full(&ty); (id, domain) }) .collect(); let folder = ConstantFolder { input_domains, func_ctx, fn_registry, }; folder.fold_to_stable(expr) } /// Fold a single expression with columns' domain, and then return the new expression and the /// domain of the new expression. pub fn fold_with_domain( expr: &Expr<Index>, input_domains: HashMap<Index, Domain>, func_ctx: FunctionContext, fn_registry: &'a FunctionRegistry, ) -> (Expr<Index>, Option<Domain>) { let folder = ConstantFolder { input_domains, func_ctx, fn_registry, }; folder.fold_to_stable(expr) } /// Running `fold_once()` for only one time may not reach the simplest form of expression, /// therefore we need to call it repeatedly until the expression becomes stable. fn fold_to_stable(&self, expr: &Expr<Index>) -> (Expr<Index>, Option<Domain>) { const MAX_ITERATIONS: usize = 1024; let mut old_expr = expr.clone(); let mut old_domain = None; for _ in 0..MAX_ITERATIONS { let (new_expr, new_domain) = self.fold_once(&old_expr); if new_expr == old_expr { return (new_expr, new_domain); } old_expr = new_expr; old_domain = new_domain; } error!("maximum iterations reached while folding expression"); (old_expr, old_domain) } /// Fold expression by one step, specifically, by reducing expression by domain calculation and then /// folding the function calls whose all arguments are constants. fn fold_once(&self, expr: &Expr<Index>) -> (Expr<Index>, Option<Domain>) { let (new_expr, domain) = match expr { Expr::Constant { scalar, data_type, .. } => (expr.clone(), Some(scalar.as_ref().domain(data_type))), Expr::ColumnRef { span, id, data_type, .. } => { let domain = &self.input_domains[id]; let expr = domain .as_singleton() .map(|scalar| Expr::Constant { span: *span, scalar, data_type: data_type.clone(), }) .unwrap_or_else(|| expr.clone()); (expr, Some(domain.clone())) } Expr::Cast { span, is_try, expr, dest_type, } => { let (inner_expr, inner_domain) = self.fold_once(expr); let new_domain = if *is_try { inner_domain.and_then(|inner_domain| { self.calculate_try_cast(*span, expr.data_type(), dest_type, &inner_domain) }) } else { inner_domain.and_then(|inner_domain| { self.calculate_cast(*span, expr.data_type(), dest_type, &inner_domain) }) }; let cast_expr = Expr::Cast { span: *span, is_try: *is_try, expr: Box::new(inner_expr.clone()), dest_type: dest_type.clone(), }; if inner_expr.as_constant().is_some() { let block = DataBlock::empty(); let evaluator = Evaluator::new(&block, self.func_ctx, self.fn_registry); // Since we know the expression is constant, it'll be safe to change its column index type. let cast_expr = cast_expr.project_column_ref(|_| unreachable!()); if let Ok(Value::Scalar(scalar)) = evaluator.run(&cast_expr) { return ( Expr::Constant { span: *span, scalar, data_type: dest_type.clone(), }, new_domain, ); } } ( new_domain .as_ref() .and_then(Domain::as_singleton) .map(|scalar| Expr::Constant { span: *span, scalar, data_type: dest_type.clone(), }) .unwrap_or(cast_expr), new_domain, ) } Expr::FunctionCall { span, id, function, generics, args, return_type, } => { let (mut args_expr, mut args_domain) = (Vec::new(), Some(Vec::new())); for arg in args { let (expr, domain) = self.fold_once(arg); args_expr.push(expr); args_domain = args_domain.zip(domain).map(|(mut domains, domain)| { domains.push(domain); domains }); } let all_args_is_scalar = args_expr.iter().all(|arg| arg.as_constant().is_some()); let func_expr = Expr::FunctionCall { span: *span, id: id.clone(), function: function.clone(), generics: generics.clone(), args: args_expr, return_type: return_type.clone(), }; let calc_domain = match &function.eval { FunctionEval::Scalar { calc_domain, .. } => calc_domain, FunctionEval::SRF { .. } => { return (func_expr, None); } }; let func_domain = args_domain.and_then(|domains| match (calc_domain)(&domains) { FunctionDomain::MayThrow => None, FunctionDomain::Full => Some(Domain::full(return_type)), FunctionDomain::Domain(domain) => Some(domain), }); if let Some(scalar) = func_domain.as_ref().and_then(Domain::as_singleton) { return ( Expr::Constant { span: *span, scalar, data_type: return_type.clone(), }, func_domain, ); } if all_args_is_scalar { let block = DataBlock::empty(); let evaluator = Evaluator::new(&block, self.func_ctx, self.fn_registry); // Since we know the expression is constant, it'll be safe to change its column index type. let func_expr = func_expr.project_column_ref(|_| unreachable!()); if let Ok(Value::Scalar(scalar)) = evaluator.run(&func_expr) { return ( Expr::Constant { span: *span, scalar, data_type: return_type.clone(), }, func_domain, ); } } (func_expr, func_domain) } }; debug_assert_eq!(expr.data_type(), new_expr.data_type()); (new_expr, domain) } fn calculate_cast( &self, span: Span, src_type: &DataType, dest_type: &DataType, domain: &Domain, ) -> Option<Domain> { if src_type == dest_type { return Some(domain.clone()); } if let Some(cast_fn) = get_simple_cast_function(false, dest_type) { if let Some(new_domain) = self.calculate_simple_cast(span, src_type, dest_type, domain, &cast_fn) { return new_domain; } } match (src_type, dest_type) { (DataType::Null, DataType::Nullable(_)) => Some(domain.clone()), (DataType::Nullable(inner_src_ty), DataType::Nullable(inner_dest_ty)) => { let domain = domain.as_nullable().unwrap(); let value = match &domain.value { Some(value) => Some(Box::new(self.calculate_cast( span, inner_src_ty, inner_dest_ty, value, )?)), None => None, }; Some(Domain::Nullable(NullableDomain { has_null: domain.has_null, value, })) } (_, DataType::Nullable(inner_dest_ty)) => Some(Domain::Nullable(NullableDomain { has_null: false, value: Some(Box::new(self.calculate_cast( span, src_type, inner_dest_ty, domain, )?)), })), (DataType::EmptyArray, DataType::Array(_)) => Some(domain.clone()), (DataType::Array(inner_src_ty), DataType::Array(inner_dest_ty)) => { let inner_domain = match domain.as_array().unwrap() { Some(inner_domain) => Some(Box::new(self.calculate_cast( span, inner_src_ty, inner_dest_ty, inner_domain, )?)), None => None, }; Some(Domain::Array(inner_domain)) } (DataType::Tuple(fields_src_ty), DataType::Tuple(fields_dest_ty)) if fields_src_ty.len() == fields_dest_ty.len() => { Some(Domain::Tuple( domain .as_tuple() .unwrap() .iter() .zip(fields_src_ty) .zip(fields_dest_ty) .map(|((field_domain, src_ty), dest_ty)| { self.calculate_cast(span, src_ty, dest_ty, field_domain) }) .collect::<Option<Vec<_>>>()?, )) } _ => None, } } fn calculate_try_cast( &self, span: Span, src_type: &DataType, dest_type: &DataType, domain: &Domain, ) -> Option<Domain> { if src_type == dest_type { return Some(domain.clone()); } // The dest_type of `TRY_CAST` must be `Nullable`, which is guaranteed by the type checker. let inner_dest_type = &**dest_type.as_nullable().unwrap(); if let Some(cast_fn) = get_simple_cast_function(true, inner_dest_type) { if let Some(new_domain) = self.calculate_simple_cast(span, src_type, dest_type, domain, &cast_fn) { return new_domain; } } match (src_type, inner_dest_type) { (DataType::Null, _) => Some(domain.clone()), (DataType::Nullable(inner_src_ty), _) => { let nullable_domain = domain.as_nullable().unwrap(); match &nullable_domain.value { Some(value) => { let new_domain = self .calculate_try_cast(span, inner_src_ty, dest_type, value)? .into_nullable() .unwrap(); Some(Domain::Nullable(NullableDomain { has_null: nullable_domain.has_null || new_domain.has_null, value: new_domain.value, })) } None => Some(domain.clone()), } } (src_ty, inner_dest_ty) if src_ty == inner_dest_ty => { Some(Domain::Nullable(NullableDomain { has_null: false, value: Some(Box::new(domain.clone())), })) } (DataType::EmptyArray, DataType::Array(_)) => Some(Domain::Nullable(NullableDomain { has_null: false, value: Some(Box::new(domain.clone())), })), (DataType::Array(inner_src_ty), DataType::Array(inner_dest_ty)) => { let inner_domain = match domain.as_array().unwrap() { Some(inner_domain) => Some(Box::new(self.calculate_try_cast( span, inner_src_ty, inner_dest_ty, inner_domain, )?)), None => None, }; Some(Domain::Nullable(NullableDomain { has_null: false, value: Some(Box::new(Domain::Array(inner_domain))), })) } (DataType::Tuple(fields_src_ty), DataType::Tuple(fields_dest_ty)) if fields_src_ty.len() == fields_dest_ty.len() => { let fields_domain = domain.as_tuple().unwrap(); let new_fields_domain = fields_domain .iter() .zip(fields_src_ty) .zip(fields_dest_ty) .map(|((domain, src_ty), dest_ty)| { self.calculate_try_cast(span, src_ty, dest_ty, domain) }) .collect::<Option<_>>()?; Some(Domain::Tuple(new_fields_domain)) } _ => None, } } fn calculate_simple_cast( &self, span: Span, src_type: &DataType, dest_type: &DataType, domain: &Domain, cast_fn: &str, ) -> Option<Option<Domain>> { let expr = Expr::ColumnRef { span, id: 0, data_type: src_type.clone(), display_name: String::new(), }; let params = if let DataType::Decimal(ty) = dest_type { vec![ty.precision() as usize, ty.scale() as usize] } else { vec![] }; let cast_expr = check_function(span, cast_fn, &params, &[expr], self.fn_registry).ok()?; if cast_expr.data_type() != dest_type { return None; } let (_, output_domain) = ConstantFolder::fold_with_domain( &cast_expr, [(0, domain.clone())].into_iter().collect(), self.func_ctx, self.fn_registry, ); Some(output_domain) } }
// // intersection.rs // Copyright (C) 2019 Malcolm Ramsay <malramsay64@gmail.com> // Distributed under terms of the MIT license. // use std::f64::consts::PI; use anyhow::Error; use criterion::BenchmarkId; use criterion::{criterion_group, criterion_main, Criterion}; use crystal_packing::traits::*; use crystal_packing::wallpaper::{Wallpaper, WyckoffSite}; use crystal_packing::{ CrystalFamily, LineShape, MolecularShape2, OccupiedSite, PackedState, Transform2, }; static BENCH_SIDES: &[usize] = &[4, 16, 64, 256]; /// Utility function to create a Packed State /// /// This creates a packed state from the number of points used to create a shape. /// fn create_packed_state(points: usize) -> Result<PackedState<LineShape>, Error> { let shape = LineShape::from_radial("Polygon", vec![1.; points])?; let wallpaper = Wallpaper { name: String::from("p2"), family: CrystalFamily::Monoclinic, }; let isopointal = &[WyckoffSite { letter: 'd', symmetries: vec![ Transform2::from_operations("x,y")?, Transform2::from_operations("-x,-y")?, ], num_rotations: 1, mirror_primary: false, mirror_secondary: false, }]; Ok(PackedState::initialise(shape, wallpaper, isopointal)) } fn state_check_intersection(c: &mut Criterion) { let mut group = c.benchmark_group("State Score"); for &sides in BENCH_SIDES.iter() { group.bench_with_input( BenchmarkId::new("Polygon", sides), &create_packed_state(sides).expect("Creation of state failed"), |b, state| b.iter(|| state.score()), ); } group.finish(); } fn shape_check_intersection(c: &mut Criterion) { let mut group = c.benchmark_group("Shape Intersection"); for &sides in BENCH_SIDES.iter() { group.bench_with_input( BenchmarkId::new("Polygon", sides), &LineShape::from_radial("Polygon", vec![1.; sides]).expect("Creation of shape failed"), |b, shape| { let si1 = shape.transform(&Transform2::new(PI / 3., (0.2, -5.3))); let si2 = shape.transform(&Transform2::new(-PI / 3., (-0.2, 5.3))); b.iter(|| si1.intersects(&si2)) }, ); } group.bench_with_input( BenchmarkId::new("Molecule", 1), &MolecularShape2::circle(), |b, shape| { let si1 = shape.transform(&Transform2::new(PI / 3., (0.2, -5.3))); let si2 = shape.transform(&Transform2::new(-PI / 3., (-0.2, 5.3))); b.iter(|| si1.intersects(&si2)) }, ); group.bench_with_input( BenchmarkId::new("Molecule", 3), &MolecularShape2::from_trimer(0.637_556, 180., 1.0), |b, shape| { let si1 = shape.transform(&Transform2::new(PI / 3., (0.2, -5.3))); let si2 = shape.transform(&Transform2::new(-PI / 3., (-0.2, 5.3))); b.iter(|| si1.intersects(&si2)) }, ); group.finish(); } fn create_shape_instance(c: &mut Criterion) { let mut group = c.benchmark_group("Transform Shape"); for &sides in BENCH_SIDES.iter() { group.bench_with_input( BenchmarkId::new("Polygon", sides), &LineShape::from_radial("Polygon", vec![1.; sides]).expect("Creation of shape failed"), |b, shape| { let trans = &Transform2::new(PI / 3., (0.2, -5.3)); b.iter(|| shape.transform(trans)) }, ); } group.bench_with_input( BenchmarkId::new("Molecule", 1), &MolecularShape2::circle(), |b, shape| { let trans = &Transform2::new(PI / 3., (0.2, -5.3)); b.iter(|| shape.transform(trans)) }, ); group.bench_with_input( BenchmarkId::new("Molecule", 3), &MolecularShape2::from_trimer(0.637_556, 180., 1.0), |b, shape| { let trans = &Transform2::new(PI / 3., (0.2, -5.3)); b.iter(|| shape.transform(trans)) }, ); group.finish(); } fn site_positions(c: &mut Criterion) { let site = OccupiedSite::from_wyckoff(&WyckoffSite { letter: 'd', symmetries: vec![ Transform2::from_operations("x,y").expect("Transform is invalid"), Transform2::from_operations("-x,-y").expect("Transform is invalid"), ], num_rotations: 1, mirror_primary: false, mirror_secondary: false, }); c.bench_function("Site Positions", |b| { b.iter(|| { for _ in site.positions() { criterion::black_box(0); } }) }); } fn state_modify_basis(c: &mut Criterion) { let state = create_packed_state(256).expect("Creation of state failed"); let mut basis = state.generate_basis(); c.bench_function("Modify Basis", |b| { b.iter(|| { for _ in 0..1000 { for value in basis.iter_mut() { let val = value.get_value(); if value.set_value(val - 0.01).is_ok() { value .set_value(val) .expect("Previous value should be valid"); } } } }) }); } criterion_group!( intersections, shape_check_intersection, create_shape_instance, state_check_intersection, ); criterion_group!(general, site_positions, state_modify_basis); criterion_main!(intersections, general);
//! Parses the references made by classes from their compiled bytcode. use std::collections::HashSet; use lazy_static::lazy_static; use noak; use noak::descriptor::{MethodDescriptor, TypeDescriptor}; use noak::reader::AttributeContent; use noak::reader::attributes::annotations::{Annotation, ElementValue}; use noak::reader::cpool; use noak::reader::cpool::Item; use regex; use crate::bc::{get_type_name, to_real_string}; use crate::bc::javastd::JavaStdLib; use crate::sconst::{IndexedString, StringConstants}; lazy_static! { // We decide a string looks like a class if it's a sequence of three or more valid identifiers // delimited by periods. This will therefore not notice any classes that are referred to by their // simple name, and it will not notice classes in top-level packages (which are unconventional in // java anyway). static ref LOOKS_LIKE_A_CLASS: regex::Regex = regex::Regex::new(r"^([a-zA-Z_](\w)*)+([.]([a-zA-Z_](\w)*)){2,}$") .expect("Static LOOKS_LIKE_A_CLASS regex didn't compile."); } #[derive(Clone, Debug, Eq, Ord, PartialOrd, PartialEq, Hash)] pub struct ClassReference { pub source_class: IndexedString, pub class_name: IndexedString, } #[derive(Clone, Debug, Eq, Ord, PartialOrd, PartialEq, Hash)] pub struct MethodReference { pub source_class: IndexedString, pub class_name: IndexedString, pub method_name: IndexedString, pub return_type: Option<IndexedString>, pub is_static: bool, } #[derive(Clone, Debug, Eq, Ord, PartialOrd, PartialEq, Hash)] pub struct FieldReference { pub source_class: IndexedString, pub class_name: IndexedString, pub field_name: IndexedString, pub field_type: Option<IndexedString>, pub is_static: bool, } pub trait JavaReference { fn class_name(&self) -> &IndexedString; fn source_class_name(&self) -> &IndexedString; fn is_java_stdlib(&self, constants: &StringConstants) -> bool { if let Some(name) = self.class_name().get_str(constants) { return name.starts_with("java/") || name.starts_with("javax/") || JavaStdLib::is_standard_library_class(name); } false } fn is_self_reference(&self, constants: &StringConstants) -> bool { if self.class_name() == self.source_class_name() { return true; } let mut me = self.class_name().get_str(constants).unwrap_or(""); let mut other = self.source_class_name().get_str(constants).unwrap_or(""); if let Some(dollar) = me.find("$") { me = &me[..dollar]; } if let Some(dollar) = other.find("$") { other = &other[..dollar]; } me == other } fn is_sun_internal(&self, constants: &StringConstants) -> bool { let name = self.class_name().get_str(constants).unwrap_or(""); name == "sun/misc/Unsafe" } fn to_string(&self, constants: &StringConstants) -> String; } impl JavaReference for ClassReference { fn class_name(&self) -> &IndexedString { &self.class_name } fn source_class_name(&self) -> &IndexedString { &self.source_class } fn to_string(&self, constants: &StringConstants) -> String { self.class_name .get_string(constants) .expect("Expected class name in string pool.") } } impl JavaReference for MethodReference { fn class_name(&self) -> &IndexedString { &self.class_name } fn source_class_name(&self) -> &IndexedString { &self.source_class } fn to_string(&self, constants: &StringConstants) -> String { let class_name = self .class_name .get_string(constants) .expect("Expected class name in string pool."); let method_name = self .method_name .get_string(constants) .expect("Expected method name in string pool."); let return_type = self .return_type .map(|rt| rt.get_string(constants) .expect("Expected return type in string pool.")) .unwrap_or("n/a".to_string()); format!("{}#{}(..): {}", class_name, method_name, return_type) } } impl JavaReference for FieldReference { fn class_name(&self) -> &IndexedString { &self.class_name } fn source_class_name(&self) -> &IndexedString { &self.source_class } fn to_string(&self, constants: &StringConstants) -> String { let class_name = self .class_name .get_string(constants) .expect("Expected class name in string pool."); let field_name = self .field_name .get_string(constants) .expect("Expected field name in string pool."); let field_type = self .field_type .map(|ft| ft.get_string(constants) .expect("Expected field type in string pool.")) .unwrap_or("n/a".to_string()); format!("{}#{}: {}", class_name, field_name, field_type) } } #[derive(Clone, Debug, Eq, Ord, PartialOrd, PartialEq, Hash)] pub enum Reference { ClassReference(ClassReference), DynamicClassReference(ClassReference), MethodReference(MethodReference), FieldReference(FieldReference), } impl JavaReference for Reference { fn class_name(&self) -> &IndexedString { match &self { Reference::ClassReference(c) => c.class_name(), Reference::DynamicClassReference(c) => c.class_name(), Reference::MethodReference(m) => m.class_name(), Reference::FieldReference(f) => f.class_name(), } } fn source_class_name(&self) -> &IndexedString { match &self { Reference::ClassReference(c) => c.source_class_name(), Reference::DynamicClassReference(c) => c.source_class_name(), Reference::MethodReference(m) => m.source_class_name(), Reference::FieldReference(f) => f.source_class_name(), } } fn to_string(&self, constants: &StringConstants) -> String { match &self { Reference::ClassReference(c) => c.to_string(constants), Reference::DynamicClassReference(c) => c.to_string(constants), Reference::MethodReference(m) => m.to_string(constants), Reference::FieldReference(f) => f.to_string(constants), } } } pub struct ReferenceWalker<'a, 'b, 'c> { /// String constants parsed from the class file bytecode. cpool: &'a cpool::ConstantPool<'a>, /// References parsed from the byte code. references: &'b mut HashSet<Reference>, /// String constants pool to store any parsed strings. Separate from the cpool, because the /// cpool just refers to the read-only bytecode for this class. The constants pool may be /// populated with strings aggregated from bytecode spanning an entire shaded jar. constants: &'c mut StringConstants, } impl<'cpool, 'references, 'constants> ReferenceWalker<'cpool, 'references, 'constants> { fn new( cpool: &'cpool cpool::ConstantPool<'cpool>, references: &'references mut HashSet<Reference>, constants: &'constants mut StringConstants, ) -> Self { Self { cpool, references, constants, } } pub fn collect_all_references<'a, 'b>( class: &'a mut noak::reader::Class<'a>, constants: &'b mut StringConstants, ) -> Result<Vec<Reference>, noak::error::DecodeError> { let mut references = HashSet::new(); let source_class = if let Ok(class_name) = class.this_class_name() { String::from_utf8_lossy(class_name.as_bytes()).to_string() } else { String::from("-") }; let source_class = constants.put(&source_class); if let Ok(attrs) = class.attribute_indices() { let mut walker = ReferenceWalker::new(class.pool()?, &mut references, constants); walker.walk_attributes(source_class, attrs); } if let Ok(methods) = class.methods() { for method in methods { if let Ok(method) = method { let mut walker = ReferenceWalker::new(class.pool()?, &mut references, constants); walker.walk_attributes(source_class, method.attribute_indices()); } } } if let Ok(fields) = class.fields() { for field in fields { if let Ok(field) = field { let mut walker = ReferenceWalker::new(class.pool()?, &mut references, constants); walker.walk_attributes(source_class, field.attribute_indices()); } } } return Ok(references.into_iter().collect()); } fn record_class_ref(&mut self, r: ClassReference) { if r.is_self_reference(&self.constants) || r.is_sun_internal(&self.constants) { return; } self.references.insert(Reference::ClassReference(r)); } fn record_dynamic_class_reference(&mut self, r: ClassReference) { if r.is_self_reference(&self.constants) || r.is_sun_internal(&self.constants) { return; } self.references.insert(Reference::DynamicClassReference(r)); } fn record_method_ref(&mut self, r: MethodReference) { if r.is_self_reference(&self.constants) || r.is_sun_internal(&self.constants) { return; } self.references.insert(Reference::MethodReference(r)); } fn record_field_ref(&mut self, r: FieldReference) { if r.is_self_reference(&self.constants) || r.is_sun_internal(&self.constants) { return; } self.references.insert(Reference::FieldReference(r)); } fn walk_attributes( &mut self, source_class: IndexedString, attributes: noak::reader::AttributeIter<'cpool>, ) -> () { for attr in attributes { if attr.is_err() { continue; } let attr = attr.unwrap(); let content = attr.read_content(self.cpool); if content.is_err() { continue; } let content = content.unwrap(); self.walk_attribute(source_class, &content); } } fn walk_attribute( &mut self, source_class: IndexedString, attribute: &noak::reader::AttributeContent<'cpool>, ) -> () { match attribute { AttributeContent::AnnotationDefault(_) => {} AttributeContent::BootstrapMethods(_) => {} AttributeContent::Code(code) => { for instruction in code.raw_instructions() { if let Ok((_, instruction)) = instruction { self.walk_instruction(source_class, &instruction); } } } AttributeContent::ConstantValue(c) => { if let Ok(item) = self.cpool.get(c.value()) { match item { Item::Class(class) => { if let Ok(class_name) = self.cpool.get(class.name).map(to_real_string) { let class_name = self.constants.put(&class_name); self.record_class_ref(ClassReference { source_class, class_name, }); } } Item::FieldRef(field) => { let class_name_type = self.get_class_name_type(&field.class, &field.name_and_type); if let Some(reference) = class_name_type { let class_name = self.constants.put(&reference.class_name); let field_name = self.constants.put(&reference.member_name); let field_type = self.constants.put(&reference.member_type); let field_type = Some(field_type); self.record_field_ref(FieldReference { source_class, class_name, field_name, field_type, is_static: true, }); } } Item::MethodRef(method) => { let class_name_type = self.get_class_name_type(&method.class, &method.name_and_type); if let Some(reference) = class_name_type { let class_name = self.constants.put(&reference.class_name); let method_name = self.constants.put(&reference.member_name); let return_type = self.constants.put(&reference.member_type); let return_type = Some(return_type); self.record_method_ref(MethodReference { source_class, class_name, method_name, return_type, is_static: true, }); } } Item::InterfaceMethodRef(_) => {} Item::String(s) => { if let Ok(s) = self.cpool.get(s.string).map(to_real_string) { if looks_like_class_name(&s) { let class_name = self.constants.put(&s); self.record_dynamic_class_reference(ClassReference { source_class, class_name, }); } } } Item::Integer(_) => {} Item::Long(_) => {} Item::Float(_) => {} Item::Double(_) => {} Item::NameAndType(name_and_type) => { if let Ok(desc) = self .cpool .get(name_and_type.descriptor) .and_then(|utf8| TypeDescriptor::parse(utf8.content)) { let type_name = get_type_name(&desc); let class_name = self.constants.put(&type_name); self.record_class_ref(ClassReference { source_class, class_name, }); } } Item::Utf8(_) => {} Item::MethodHandle(_) => {} Item::MethodType(method_type) => { if let Ok(method) = self .cpool .get(method_type.descriptor) .and_then(|utf8| MethodDescriptor::parse(utf8.content)) { if let Some(return_type) = method.return_type() { let class_name = self.constants.put(&get_type_name(&return_type)); self.record_class_ref(ClassReference { source_class, class_name, }); } for param in method.parameters() { let class_name = self.constants.put(&get_type_name(&param)); self.record_class_ref(ClassReference { source_class, class_name, }); } } } Item::Dynamic(_d) => {} Item::InvokeDynamic(_) => {} Item::Module(_) => {} Item::Package(_) => {} } } } AttributeContent::Deprecated => {} AttributeContent::EnclosingMethod(_) => {} AttributeContent::Exceptions(_) => {} AttributeContent::InnerClasses(_) => {} AttributeContent::LineNumberTable(_) => {} AttributeContent::LocalVariableTable(_) => {} AttributeContent::LocalVariableTypeTable(_) => {} AttributeContent::MethodParameters(_) => {} AttributeContent::Module(_) => {} AttributeContent::ModuleMainClass(_) => {} AttributeContent::ModulePackages(_) => {} AttributeContent::NestHost(_) => {} AttributeContent::NestMembers(_) => {} AttributeContent::RuntimeInvisibleAnnotations(annotations) => { for annotation in annotations.iter() { if let Ok(annotation) = annotation { self.process_annotation(&annotation, source_class); } } } AttributeContent::RuntimeInvisibleParameterAnnotations(_) => {} AttributeContent::RuntimeInvisibleTypeAnnotations(_) => {} AttributeContent::RuntimeVisibleAnnotations(annotations) => { for annotation in annotations.iter() { if let Ok(annotation) = annotation { self.process_annotation(&annotation, source_class); } } } AttributeContent::RuntimeVisibleParameterAnnotations(_) => {} AttributeContent::RuntimeVisibleTypeAnnotations(_) => {} AttributeContent::Signature(_) => {} AttributeContent::SourceDebugExtension(_) => {} AttributeContent::SourceFile(_sf) => { // This is the literal name of the source file. } AttributeContent::StackMapTable(_) => {} AttributeContent::Synthetic => {} } } fn process_annotation(&mut self, annotation: &Annotation, source_class: IndexedString) { let class_name = annotation.r#type(); if let Some(class_name) = self.get_class_name_from_utf8(class_name) { let class_name = self.constants.put(&class_name); self.record_class_ref(ClassReference { source_class, class_name, }); } for pair in annotation.pairs() { if let Ok(pair) = pair { self.process_annotation_element(pair.value(), source_class); } } } fn process_annotation_element(&mut self, element: &ElementValue, source_class: IndexedString) { match element { ElementValue::Boolean(_) => {} ElementValue::Byte(_) => {} ElementValue::Short(_) => {} ElementValue::Int(_) => {} ElementValue::Long(_) => {} ElementValue::Float(_) => {} ElementValue::Double(_) => {} ElementValue::Char(_) => {} ElementValue::String(s) => { if let Ok(s) = self.cpool.get(*s).map(to_real_string) { if looks_like_class_name(&s) { let class_name = self.constants.put(&s); self.record_dynamic_class_reference(ClassReference { source_class, class_name, }); } } } ElementValue::Class(class_name) => { if let Some(class_name) = self.get_class_name_from_utf8(*class_name) { let class_name = self.constants.put(&class_name); self.record_class_ref(ClassReference { source_class, class_name, }); } } ElementValue::Enum { type_name, const_name: _ } => { if let Some(class_name) = self.get_class_name_from_utf8(*type_name) { let class_name = self.constants.put(&class_name); self.record_class_ref(ClassReference { source_class, class_name, }); } } ElementValue::Annotation(annotation) => { self.process_annotation(annotation, source_class); } ElementValue::Array(array) => { for item in array.iter() { if let Ok(item) = item { self.process_annotation_element(&item, source_class); } } } } } fn walk_instruction( &mut self, source_class: IndexedString, instruction: &noak::reader::attributes::RawInstruction<'cpool>, ) -> () { match instruction { noak::reader::attributes::RawInstruction::CheckCast { index } => { if let Some(class) = self.get_class_name(index) { let class_name = self.constants.put(&class); self.record_class_ref(ClassReference { source_class, class_name, }); } } noak::reader::attributes::RawInstruction::ANewArray { index } => { if let Some(class) = self.get_class_name(index) { let class_name = self.constants.put(&class); self.record_class_ref(ClassReference { source_class, class_name, }); } } noak::reader::attributes::RawInstruction::GetField { index } => { self.handle_field(source_class, false, index); } noak::reader::attributes::RawInstruction::GetStatic { index } => { self.handle_field(source_class, true, index); } noak::reader::attributes::RawInstruction::InstanceOf { index } => { if let Some(class) = self.get_class_name(index) { let class_name = self.constants.put(&class); self.record_class_ref(ClassReference { source_class, class_name, }); } } noak::reader::attributes::RawInstruction::InvokeDynamic { index } => { if let Ok(dynamic) = self.cpool.get(*index) { if let Some(NameAndType { name: _, base_type }) = self.get_name_and_type(&dynamic.name_and_type) { // We don't know what object this invocation is acting on, but if we can at // least report on its type. let _class_name = self.constants.put(&base_type); } } } noak::reader::attributes::RawInstruction::InvokeInterface { index, count: _ } => { if let Ok(interface) = self.cpool.get(*index) { if let Some(reference) = self.get_class_name_type(&interface.class, &interface.name_and_type) { let class_name = self.constants.put(&reference.class_name); let method_name = self.constants.put(&reference.member_name); let return_type = self.constants.put(&reference.member_type); let return_type = Some(return_type); self.record_method_ref(MethodReference { source_class, class_name, method_name, return_type, is_static: false, }); } } } noak::reader::attributes::RawInstruction::InvokeVirtual { index } => { if let Ok(method_ref) = self.cpool.get(*index) { if let Some(reference) = self.get_class_name_type(&method_ref.class, &method_ref.name_and_type) { let class_name = self.constants.put(&reference.class_name); let method_name = self.constants.put(&reference.member_name); let return_type = self.constants.put(&reference.member_type); let return_type = Some(return_type); self.record_method_ref(MethodReference { source_class, class_name, method_name, return_type, is_static: false, }); } } } noak::reader::attributes::RawInstruction::MultiANewArray { index, dimensions: _, } => { if let Some(class_name) = self.get_class_name(index) { let class_name = self.constants.put(&class_name); self.record_class_ref(ClassReference { source_class, class_name, }); } } noak::reader::attributes::RawInstruction::New { index } => { if let Some(class_name) = self.get_class_name(index) { let class_name = self.constants.put(&class_name); self.record_class_ref(ClassReference { source_class, class_name, }); } } noak::reader::attributes::RawInstruction::NewArray { atype: _ } => { // These are only for primitive arrays, so we don't care about them. } noak::reader::attributes::RawInstruction::PutField { index } => { if let Ok(field) = self.cpool.get(*index) { if let Some(reference) = self.get_class_name_type(&field.class, &field.name_and_type) { let class_name = self.constants.put(&reference.class_name); let field_name = self.constants.put(&reference.member_name); let field_type = self.constants.put(&reference.member_type); let field_type = Some(field_type); self.record_field_ref(FieldReference { source_class, class_name, field_name, field_type, is_static: false, }); } } } noak::reader::attributes::RawInstruction::PutStatic { index } => { if let Ok(field) = self.cpool.get(*index) { if let Some(reference) = self.get_class_name_type(&field.class, &field.name_and_type) { let class_name = self.constants.put(&reference.class_name); let field_name = self.constants.put(&reference.member_name); let field_type = self.constants.put(&reference.member_type); let field_type = Some(field_type); self.record_field_ref(FieldReference { source_class, class_name, field_name, field_type, is_static: true, }); } } } _ => {} } } fn handle_field( &mut self, source_class: IndexedString, is_static: bool, index: &cpool::Index<cpool::FieldRef>, ) -> () { if let Ok(field) = self.cpool.get(*index) { if let Some(reference) = self.get_class_name_type(&field.class, &field.name_and_type) { let class_name = self.constants.put(&reference.class_name); let field_name = self.constants.put(&reference.member_name); let field_type = self.constants.put(&reference.member_type); let field_type = Some(field_type); self.record_field_ref(FieldReference { source_class, class_name, field_name, field_type, is_static, }); } } } fn get_class_name_type( &self, class_index: &cpool::Index<cpool::Class>, name_and_type_index: &cpool::Index<cpool::NameAndType>, ) -> Option<ClassNameType> { let class_name = self.get_class_name(class_index); if class_name.is_none() { return None; } let class_name = class_name.unwrap(); let name_and_type = self.get_name_and_type(name_and_type_index); if name_and_type.is_none() { return None; } let name_and_type = name_and_type.unwrap(); Some(ClassNameType::new(class_name, name_and_type)) } fn get_name_and_type(&self, index: &cpool::Index<cpool::NameAndType>) -> Option<NameAndType> { if let Ok(name_and_type) = self.cpool.get(*index) { let mut the_name = String::from("-"); let mut the_type = String::from("-"); if let Ok(name) = self.cpool.get(name_and_type.name).map(to_real_string) { the_name = name; } if let Ok(descriptor) = self .cpool .get(name_and_type.descriptor) .map(|encoded_descriptor| encoded_descriptor.content) .and_then(TypeDescriptor::parse) { the_type = get_type_name(&descriptor); } return Some(NameAndType { name: the_name, base_type: the_type, }); } None } fn get_class_name(&self, index: &cpool::Index<cpool::Class>) -> Option<String> { if let Ok(class) = self.cpool.get(*index) { return self.get_class_name_from_utf8(class.name); } None } fn get_class_name_from_utf8(&self, class_name: cpool::Index<cpool::Utf8>) -> Option<String> { let name = self.cpool.get(class_name); if name.is_err() { return None; } let name = name.unwrap(); let mut name_str = to_real_string(name); if name_str.starts_with("[") { if let Ok(descriptor) = TypeDescriptor::parse(name.content) { return Some(get_type_name(&descriptor)); } } if name_str.starts_with("L") { name_str = name_str[1..].to_string(); } if name_str.ends_with(";") { name_str = name_str[..name_str.len() - 1].to_string(); } Some(name_str) } } fn looks_like_class_name(name: &str) -> bool { if !LOOKS_LIKE_A_CLASS.is_match(name) { return false; } // At least one name component must start with an uppercase letter. name.split(|c| c == '.' || c == '/' || c == '$') .map(|part| part.chars().next()) .any(|c| c.is_some() && c.unwrap().is_uppercase()) } struct ClassNameType { class_name: String, member_name: String, member_type: String, } impl ClassNameType { fn new(class_name: String, name_and_type: NameAndType) -> Self { Self { class_name, member_name: name_and_type.name, member_type: name_and_type.base_type, } } } struct NameAndType { name: String, base_type: String, }
#[doc = "Reader of register DADDR"] pub type R = crate::R<u32, super::DADDR>; #[doc = "Writer for register DADDR"] pub type W = crate::W<u32, super::DADDR>; #[doc = "Register DADDR `reset()`'s with value 0"] impl crate::ResetValue for super::DADDR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `ADD`"] pub type ADD_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ADD`"] pub struct ADD_W<'a> { w: &'a mut W, } impl<'a> ADD_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub unsafe fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub unsafe fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01); self.w } } #[doc = "Reader of field `ADD1`"] pub type ADD1_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ADD1`"] pub struct ADD1_W<'a> { w: &'a mut W, } impl<'a> ADD1_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1); self.w } } #[doc = "Reader of field `ADD2`"] pub type ADD2_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ADD2`"] pub struct ADD2_W<'a> { w: &'a mut W, } impl<'a> ADD2_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2); self.w } } #[doc = "Reader of field `ADD3`"] pub type ADD3_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ADD3`"] pub struct ADD3_W<'a> { w: &'a mut W, } impl<'a> ADD3_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3); self.w } } #[doc = "Reader of field `ADD4`"] pub type ADD4_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ADD4`"] pub struct ADD4_W<'a> { w: &'a mut W, } impl<'a> ADD4_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4); self.w } } #[doc = "Reader of field `ADD5`"] pub type ADD5_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ADD5`"] pub struct ADD5_W<'a> { w: &'a mut W, } impl<'a> ADD5_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5); self.w } } #[doc = "Reader of field `ADD6`"] pub type ADD6_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ADD6`"] pub struct ADD6_W<'a> { w: &'a mut W, } impl<'a> ADD6_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6); self.w } } #[doc = "Enable function\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum EF_A { #[doc = "0: USB device disabled"] DISABLED = 0, #[doc = "1: USB device enabled"] ENABLED = 1, } impl From<EF_A> for bool { #[inline(always)] fn from(variant: EF_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `EF`"] pub type EF_R = crate::R<bool, EF_A>; impl EF_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> EF_A { match self.bits { false => EF_A::DISABLED, true => EF_A::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline(always)] pub fn is_disabled(&self) -> bool { *self == EF_A::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline(always)] pub fn is_enabled(&self) -> bool { *self == EF_A::ENABLED } } #[doc = "Write proxy for field `EF`"] pub struct EF_W<'a> { w: &'a mut W, } impl<'a> EF_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: EF_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "USB device disabled"] #[inline(always)] pub fn disabled(self) -> &'a mut W { self.variant(EF_A::DISABLED) } #[doc = "USB device enabled"] #[inline(always)] pub fn enabled(self) -> &'a mut W { self.variant(EF_A::ENABLED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7); self.w } } impl R { #[doc = "Bit 0 - Device address"] #[inline(always)] pub fn add(&self) -> ADD_R { ADD_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - Device address"] #[inline(always)] pub fn add1(&self) -> ADD1_R { ADD1_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 2 - Device address"] #[inline(always)] pub fn add2(&self) -> ADD2_R { ADD2_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 3 - Device address"] #[inline(always)] pub fn add3(&self) -> ADD3_R { ADD3_R::new(((self.bits >> 3) & 0x01) != 0) } #[doc = "Bit 4 - Device address"] #[inline(always)] pub fn add4(&self) -> ADD4_R { ADD4_R::new(((self.bits >> 4) & 0x01) != 0) } #[doc = "Bit 5 - Device address"] #[inline(always)] pub fn add5(&self) -> ADD5_R { ADD5_R::new(((self.bits >> 5) & 0x01) != 0) } #[doc = "Bit 6 - Device address"] #[inline(always)] pub fn add6(&self) -> ADD6_R { ADD6_R::new(((self.bits >> 6) & 0x01) != 0) } #[doc = "Bit 7 - Enable function"] #[inline(always)] pub fn ef(&self) -> EF_R { EF_R::new(((self.bits >> 7) & 0x01) != 0) } } impl W { #[doc = "Bit 0 - Device address"] #[inline(always)] pub fn add(&mut self) -> ADD_W { ADD_W { w: self } } #[doc = "Bit 1 - Device address"] #[inline(always)] pub fn add1(&mut self) -> ADD1_W { ADD1_W { w: self } } #[doc = "Bit 2 - Device address"] #[inline(always)] pub fn add2(&mut self) -> ADD2_W { ADD2_W { w: self } } #[doc = "Bit 3 - Device address"] #[inline(always)] pub fn add3(&mut self) -> ADD3_W { ADD3_W { w: self } } #[doc = "Bit 4 - Device address"] #[inline(always)] pub fn add4(&mut self) -> ADD4_W { ADD4_W { w: self } } #[doc = "Bit 5 - Device address"] #[inline(always)] pub fn add5(&mut self) -> ADD5_W { ADD5_W { w: self } } #[doc = "Bit 6 - Device address"] #[inline(always)] pub fn add6(&mut self) -> ADD6_W { ADD6_W { w: self } } #[doc = "Bit 7 - Enable function"] #[inline(always)] pub fn ef(&mut self) -> EF_W { EF_W { w: self } } }
//! Data-driven reference test framework for warding //! against breaking changes. #[macro_use] extern crate log; #[macro_use] extern crate serde; pub mod gpu; pub mod raw; #[cfg(feature = "gl")] pub fn init_gl_surface() -> gfx_backend_gl::Surface { use gfx_backend_gl::glutin; let events_loop = glutin::event_loop::EventLoop::new(); let windowed_context = glutin::ContextBuilder::new() .with_gl_profile(glutin::GlProfile::Core) .build_windowed(glutin::window::WindowBuilder::new(), &events_loop) .unwrap(); let (context, _window) = unsafe { windowed_context .make_current() .expect("Unable to make window current") .split() }; gfx_backend_gl::Surface::from_context(context) } #[cfg(feature = "gl-ci")] pub fn init_gl_on_ci() -> gfx_backend_gl::Headless { use gfx_backend_gl::glutin; let events_loop = glutin::event_loop::EventLoop::new(); let context; #[cfg(all(unix, not(target_vendor = "apple")))] { use gfx_backend_gl::glutin::platform::unix::HeadlessContextExt as _; context = glutin::ContextBuilder::new().build_surfaceless(&events_loop); } #[cfg(any(not(unix), target_vendor = "apple"))] { context = glutin::ContextBuilder::new() .build_headless(&events_loop, glutin::dpi::PhysicalSize::new(0, 0)); } let current_context = unsafe { context.unwrap().make_current() }.expect("Unable to make context current"); gfx_backend_gl::Headless::from_context(current_context) }
use std::fs; use users::mock::{Groups, Users}; use users::UsersCache; use crate::config::{LllColorTheme, LllConfig}; use crate::context::LllContext; use crate::fs::{LllDirEntry, LllDirList}; use crate::window; use crate::THEME_T; pub const ERR_COLOR: i16 = 240; pub const EMPTY_COLOR: i16 = 241; const MIN_WIN_WIDTH: usize = 4; pub struct DisplayOptions { pub detailed: bool, } pub const PRIMARY_DISPLAY_OPTION: DisplayOptions = DisplayOptions { detailed: true }; pub fn init_ncurses() { ncurses::setlocale(ncurses::LcCategory::all, ""); ncurses::initscr(); ncurses::cbreak(); ncurses::keypad(ncurses::stdscr(), true); ncurses::start_color(); ncurses::use_default_colors(); ncurses::noecho(); ncurses::set_escdelay(0); ncurses::curs_set(ncurses::CURSOR_VISIBILITY::CURSOR_INVISIBLE); process_theme(); ncurses::refresh(); } fn process_theme() { for pair in THEME_T.colorpair.iter() { ncurses::init_pair(pair.id, pair.fg, pair.bg); } // error message ncurses::init_pair(ERR_COLOR, ncurses::COLOR_RED, -1); // empty ncurses::init_pair(EMPTY_COLOR, ncurses::COLOR_WHITE, ncurses::COLOR_RED); } pub fn end_ncurses() { ncurses::endwin(); } pub fn getmaxyx() -> (i32, i32) { let mut term_rows: i32 = 0; let mut term_cols: i32 = 0; ncurses::getmaxyx(ncurses::stdscr(), &mut term_rows, &mut term_cols); (term_rows, term_cols) } pub fn display_menu(win: &window::LllPanel, vals: &[String]) { ncurses::werase(win.win); ncurses::mvwhline(win.win, 0, 0, 0, win.cols); for (i, val) in vals.iter().enumerate() { ncurses::wmove(win.win, (i + 1) as i32, 0); ncurses::waddstr(win.win, val.as_str()); } ncurses::wnoutrefresh(win.win); } pub fn wprint_msg(win: &window::LllPanel, msg: &str) { ncurses::werase(win.win); ncurses::mvwaddstr(win.win, 0, 0, msg); ncurses::wnoutrefresh(win.win); } pub fn wprint_err(win: &window::LllPanel, msg: &str) { let attr = ncurses::A_BOLD() | ncurses::COLOR_PAIR(ERR_COLOR); ncurses::werase(win.win); ncurses::wattron(win.win, attr); ncurses::mvwaddstr(win.win, 0, 0, msg); ncurses::wattroff(win.win, attr); ncurses::wnoutrefresh(win.win); } pub fn wprint_empty(win: &window::LllPanel, msg: &str) { ncurses::werase(win.win); ncurses::wattron(win.win, ncurses::COLOR_PAIR(EMPTY_COLOR)); ncurses::mvwaddstr(win.win, 0, 0, msg); ncurses::wattroff(win.win, ncurses::COLOR_PAIR(EMPTY_COLOR)); ncurses::wnoutrefresh(win.win); } fn wprint_file_name( win: &window::LllPanel, file_name: &str, coord: (i32, i32), mut space_avail: usize, ) { let name_visual_space = unicode_width::UnicodeWidthStr::width(file_name); if name_visual_space < space_avail { ncurses::mvwaddstr(win.win, coord.0, coord.1, &file_name); return; } if let Some(ext) = file_name.rfind('.') { let extension: &str = &file_name[ext..]; let ext_len = unicode_width::UnicodeWidthStr::width(extension); if space_avail > ext_len { space_avail -= ext_len; ncurses::mvwaddstr(win.win, coord.0, space_avail as i32, &extension); } } if space_avail < 2 { return; } else { space_avail -= 2; } ncurses::wmove(win.win, coord.0, coord.1); let mut trim_index: usize = file_name.len(); let mut total: usize = 0; for (index, ch) in file_name.char_indices() { if total >= space_avail { trim_index = index; break; } total += unicode_width::UnicodeWidthChar::width(ch).unwrap_or(2); } ncurses::waddstr(win.win, &file_name[..trim_index]); ncurses::waddstr(win.win, "…"); } fn wprint_entry( win: &window::LllPanel, file: &LllDirEntry, prefix: (usize, &str), coord: (i32, i32), ) { if win.cols <= prefix.0 as i32 { return; } ncurses::waddstr(win.win, prefix.1); let space_avail = win.cols as usize - prefix.0; wprint_file_name( &win, file.file_name(), (coord.0, coord.1 + prefix.0 as i32), space_avail, ); } fn wprint_entry_detailed( win: &window::LllPanel, file: &LllDirEntry, prefix: (usize, &str), coord: (i32, i32), ) { if win.cols <= prefix.0 as i32 { return; } ncurses::waddstr(win.win, prefix.1); let space_avail = win.cols as usize - prefix.0; let coord = (coord.0, coord.1 + prefix.0 as i32); wprint_file_name(win, file.file_name(), coord, space_avail); } pub fn display_contents( win: &window::LllPanel, dirlist: &mut LllDirList, config_t: &LllConfig, options: &DisplayOptions, ) { if win.cols < MIN_WIN_WIDTH as i32 { return; } let dir_len = dirlist.contents.len(); if dir_len == 0 { wprint_empty(win, "empty"); return; } ncurses::werase(win.win); ncurses::wmove(win.win, 0, 0); let draw_func = if options.detailed { wprint_entry_detailed } else { wprint_entry }; let curr_index = dirlist.index.unwrap(); dirlist .pagestate .update_page_state(curr_index, win.rows, dir_len, config_t.scroll_offset); let (start, end) = (dirlist.pagestate.start, dirlist.pagestate.end); let dir_contents = &dirlist.contents[start..end]; ncurses::werase(win.win); ncurses::wmove(win.win, 0, 0); for (i, entry) in dir_contents.iter().enumerate() { let coord: (i32, i32) = (i as i32, 0); ncurses::wmove(win.win, coord.0, coord.1); let attr = if i + start == curr_index { ncurses::A_STANDOUT() } else { 0 }; let attrs = get_theme_attr(attr, entry); draw_func(win, entry, attrs.0, coord); ncurses::mvwchgat(win.win, coord.0, coord.1, -1, attrs.1, attrs.2); } win.queue_for_refresh(); } pub fn wprint_file_status(win: &window::LllPanel, entry: &LllDirEntry) { ncurses::waddch(win.win, ' ' as ncurses::chtype); let usercache: UsersCache = UsersCache::new(); match usercache.get_user_by_uid(entry.metadata.uid) { Some(s) => match s.name().to_str() { Some(name) => ncurses::waddstr(win.win, name), None => ncurses::waddstr(win.win, "OsStr error"), }, None => ncurses::waddstr(win.win, "unknown user"), }; ncurses::waddch(win.win, ' ' as ncurses::chtype); match usercache.get_group_by_gid(entry.metadata.gid) { Some(s) => match s.name().to_str() { Some(name) => ncurses::waddstr(win.win, name), None => ncurses::waddstr(win.win, "OsStr error"), }, None => ncurses::waddstr(win.win, "unknown user"), }; ncurses::waddstr(win.win, " "); wprint_file_info(win.win, entry); win.queue_for_refresh(); } pub fn wprint_file_info(win: ncurses::WINDOW, file: &LllDirEntry) { #[cfg(unix)] { use std::os::unix::fs::PermissionsExt; let mode = file.metadata.permissions.mode(); ncurses::waddch(win, ' ' as ncurses::chtype); if file.file_path().is_dir() { let is_link: u32 = libc::S_IFLNK as u32; if mode >> 9 & is_link >> 9 == mode >> 9 { if let Ok(path) = fs::read_link(&file.file_path()) { ncurses::waddstr(win, " -> "); ncurses::waddstr(win, path.to_str().unwrap()); } } } } } pub fn redraw_tab_view(win: &window::LllPanel, context: &LllContext) { let tab_len = context.tabs.len(); ncurses::werase(win.win); if tab_len == 1 { } else if tab_len >= 6 { ncurses::wmove(win.win, 0, 0); ncurses::wattron(win.win, ncurses::A_BOLD() | ncurses::A_STANDOUT()); ncurses::waddstr(win.win, &format!("{}", context.curr_tab_index + 1)); ncurses::wattroff(win.win, ncurses::A_STANDOUT()); ncurses::waddstr(win.win, &format!(" {}", tab_len)); ncurses::wattroff(win.win, ncurses::A_BOLD()); } else { ncurses::wattron(win.win, ncurses::A_BOLD()); for i in 0..tab_len { if i == context.curr_tab_index { ncurses::wattron(win.win, ncurses::A_STANDOUT()); ncurses::waddstr(win.win, &format!("{} ", i + 1)); ncurses::wattroff(win.win, ncurses::A_STANDOUT()); } else { ncurses::waddstr(win.win, &format!("{} ", i + 1)); } } ncurses::wattroff(win.win, ncurses::A_BOLD()); } ncurses::wnoutrefresh(win.win); } pub fn show_fs_operation_progress(win: &window::LllPanel, process_info: &fs_extra::TransitProcess) { let percentage: f64 = process_info.copied_bytes as f64 / process_info.total_bytes as f64; let cols: i32 = (f64::from(win.cols) * percentage) as i32; ncurses::mvwchgat( win.win, 0, 0, cols, ncurses::A_STANDOUT(), THEME_T.selection.colorpair, ); win.queue_for_refresh(); } pub fn get_theme_attr( mut attr: ncurses::attr_t, entry: &LllDirEntry, ) -> ((usize, &str), ncurses::attr_t, i16) { use std::os::unix::fs::FileTypeExt; let theme: &LllColorTheme; let colorpair: i16; let file_type = &entry.metadata.file_type; if entry.is_selected() { theme = &THEME_T.selection; colorpair = THEME_T.selection.colorpair; } else if file_type.is_dir() { theme = &THEME_T.directory; colorpair = THEME_T.directory.colorpair; } else if file_type.is_symlink() { theme = &THEME_T.link; colorpair = THEME_T.link.colorpair; } else if file_type.is_block_device() || file_type.is_char_device() || file_type.is_fifo() || file_type.is_socket() { theme = &THEME_T.socket; colorpair = THEME_T.link.colorpair; } else { if let Some(ext) = entry.file_name().rfind('.') { let extension: &str = &entry.file_name()[ext + 1..]; if let Some(s) = THEME_T.ext.get(extension) { theme = &s; colorpair = theme.colorpair; } else { theme = &THEME_T.regular; colorpair = theme.colorpair; } } else { theme = &THEME_T.regular; colorpair = theme.colorpair; } } if theme.bold { attr |= ncurses::A_BOLD(); } if theme.underline { attr |= ncurses::A_UNDERLINE(); } let prefix = match theme.prefix.as_ref() { Some(p) => (p.size(), p.prefix()), None => (1, " "), }; (prefix, attr, colorpair) }
use embedded_graphics::{ mono_font::{MonoFont, MonoTextStyle}, prelude::PixelColor, }; use embedded_gui::{ state::WidgetState, widgets::{ background::{Background, BackgroundProperties}, border::{Border, BorderProperties}, button::Button, fill::{Center, FillParent, HorizontalAndVertical}, label::Label, spacing::Spacing, }, }; use crate::{ themes::default::DefaultTheme, widgets::{ background::BackgroundStyle, border::BorderStyle, label::{ascii::LabelConstructor, LabelStyle, LabelStyling, MonoFontLabelStyling}, }, }; pub mod primary; pub mod secondary; pub trait ButtonStateColors<C: PixelColor> { const LABEL_COLOR: C; const BORDER_COLOR: C; const BACKGROUND_COLOR: C; fn apply_label<S, T>(label: &mut Label<S, T>) where Label<S, T>: LabelStyling<S, Color = C>, { label.set_text_color(Self::LABEL_COLOR); } fn apply_background<W, T>(background: &mut Background<W, T>) where T: BackgroundProperties<Color = C>, { background.set_background_color(Self::BACKGROUND_COLOR); } fn apply_border<W, T>(border: &mut Border<W, T>) where T: BorderProperties<Color = C>, { border.set_border_color(Self::BORDER_COLOR); } } pub trait ButtonStyle<C: PixelColor> { type Inactive: ButtonStateColors<C>; type Idle: ButtonStateColors<C>; type Hovered: ButtonStateColors<C>; type Pressed: ButtonStateColors<C>; const FONT: MonoFont<'static>; fn apply_label<S, T>(label: &mut Label<S, T>, state: WidgetState) where Label<S, T>: LabelStyling<S, Color = C>, { if state.has_state(Button::STATE_INACTIVE) { Self::Inactive::apply_label(label); } else if state.has_state(Button::STATE_HOVERED) { Self::Hovered::apply_label(label); } else if state.has_state(Button::STATE_PRESSED) { Self::Pressed::apply_label(label); } else { Self::Idle::apply_label(label); }; } fn apply_border<W, T>(border: &mut Border<W, T>, state: WidgetState) where T: BorderProperties<Color = C>, { if state.has_state(Button::STATE_INACTIVE) { Self::Inactive::apply_border(border); } else if state.has_state(Button::STATE_HOVERED) { Self::Hovered::apply_border(border); } else if state.has_state(Button::STATE_PRESSED) { Self::Pressed::apply_border(border); } else { Self::Idle::apply_border(border); }; } fn apply_background<W, T>(background: &mut Background<W, T>, state: WidgetState) where T: BackgroundProperties<Color = C>, { if state.has_state(Button::STATE_INACTIVE) { Self::Inactive::apply_background(background); } else if state.has_state(Button::STATE_HOVERED) { Self::Hovered::apply_background(background); } else if state.has_state(Button::STATE_PRESSED) { Self::Pressed::apply_background(background); } else { Self::Idle::apply_background(background); }; } } pub type StyledButton<'a, C> = Button< Background< Border<Spacing<Label<&'static str, LabelStyle<MonoTextStyle<'a, C>>>>, BorderStyle<C>>, BackgroundStyle<C>, >, >; pub fn styled_button<C, S>(label: &'static str) -> StyledButton<C> where C: DefaultTheme, S: ButtonStyle<C>, BorderStyle<C>: Default, BackgroundStyle<C>: Default, { Button::new( Background::new( Border::new( Spacing::new( Label::new(label) .font(&S::FONT) .on_state_changed(S::apply_label), ) .all(1), ) .on_state_changed(S::apply_border), ) .on_state_changed(S::apply_background), ) } pub type StyledButtonStretched<'a, C> = Button< Background< Border< FillParent< Label<&'static str, LabelStyle<MonoTextStyle<'a, C>>>, HorizontalAndVertical, Center, Center, >, BorderStyle<C>, >, BackgroundStyle<C>, >, >; pub fn styled_button_stretched<C, S>(label: &'static str) -> StyledButtonStretched<C> where C: DefaultTheme, S: ButtonStyle<C>, BorderStyle<C>: Default, BackgroundStyle<C>: Default, { Button::new( Background::new( Border::new( FillParent::both( Label::new(label) .font(&S::FONT) .on_state_changed(S::apply_label), ) .align_horizontal(Center) .align_vertical(Center), ) .on_state_changed(S::apply_border), ) .on_state_changed(S::apply_background), ) }
#[macro_use] extern crate log; mod item; mod queue; mod segment; mod state; pub use queue::Queue;
mod search_engine; use matcher::{ExactMatcher, InverseMatcher}; use rayon::prelude::*; use std::ops::{Index, IndexMut}; use types::{CaseMatching, ExactTerm, InverseTerm}; pub use self::search_engine::{CtagsSearcher, GtagsSearcher, QueryType, RegexSearcher}; /// Matcher for filtering out the unqualified usages earlier at the searching stage. #[derive(Debug, Clone, Default)] pub struct UsageMatcher { pub exact_matcher: ExactMatcher, pub inverse_matcher: InverseMatcher, } impl UsageMatcher { pub fn new(exact_terms: Vec<ExactTerm>, inverse_terms: Vec<InverseTerm>) -> Self { Self { exact_matcher: ExactMatcher::new(exact_terms, CaseMatching::Smart), inverse_matcher: InverseMatcher::new(inverse_terms), } } /// Returns the match indices of exact terms if given `line` passes all the checks. fn match_indices(&self, line: &str) -> Option<Vec<usize>> { match ( self.exact_matcher.find_matches(line), self.inverse_matcher.match_any(line), ) { (Some((_, indices)), false) => Some(indices), _ => None, } } /// Returns `true` if the result of The results of applying `self` /// is a superset of applying `other` on the same source. pub fn is_superset(&self, other: &Self) -> bool { self.exact_matcher .exact_terms .iter() .zip(other.exact_matcher.exact_terms.iter()) .all(|(local, other)| local.is_superset(other)) && self .inverse_matcher .inverse_terms() .iter() .zip(other.inverse_matcher.inverse_terms().iter()) .all(|(local, other)| local.is_superset(other)) } pub fn match_jump_line( &self, (jump_line, mut indices): (String, Vec<usize>), ) -> Option<(String, Vec<usize>)> { if let Some(exact_indices) = self.match_indices(&jump_line) { indices.extend(exact_indices); indices.sort_unstable(); indices.dedup(); Some((jump_line, indices)) } else { None } } } #[derive(Clone, Debug, Default)] pub struct Usage { /// Display line. pub line: String, /// Highlights of matched elements. pub indices: Vec<usize>, } impl From<AddressableUsage> for Usage { fn from(addressable_usage: AddressableUsage) -> Self { let AddressableUsage { line, indices, .. } = addressable_usage; Self { line, indices } } } impl Usage { pub fn new(line: String, indices: Vec<usize>) -> Self { Self { line, indices } } } /// [`Usage`] with some structured information. #[derive(Clone, Debug, Default)] pub struct AddressableUsage { pub line: String, pub indices: Vec<usize>, pub path: String, pub line_number: usize, } impl PartialEq for AddressableUsage { fn eq(&self, other: &Self) -> bool { // Equal if the path and lnum are the same. (&self.path, self.line_number) == (&other.path, other.line_number) } } impl Eq for AddressableUsage {} /// All the lines as well as their match indices that can be sent to the vim side directly. #[derive(Clone, Debug, Default)] pub struct Usages(Vec<Usage>); impl From<Vec<Usage>> for Usages { fn from(inner: Vec<Usage>) -> Self { Self(inner) } } impl From<Vec<AddressableUsage>> for Usages { fn from(inner: Vec<AddressableUsage>) -> Self { Self(inner.into_iter().map(Into::into).collect()) } } impl Index<usize> for Usages { type Output = Usage; fn index(&self, index: usize) -> &Self::Output { &self.0[index] } } impl IndexMut<usize> for Usages { fn index_mut(&mut self, index: usize) -> &mut Self::Output { &mut self.0[index] } } impl IntoIterator for Usages { type Item = Usage; type IntoIter = std::vec::IntoIter<Self::Item>; fn into_iter(self) -> Self::IntoIter { self.0.into_iter() } } impl Usages { pub fn is_empty(&self) -> bool { self.0.is_empty() } pub fn len(&self) -> usize { self.0.len() } pub fn iter(&self) -> impl Iterator<Item = &Usage> { self.0.iter() } pub fn par_iter(&self) -> rayon::slice::Iter<'_, Usage> { self.0.par_iter() } pub fn get_line(&self, index: usize) -> Option<&str> { self.0.get(index).map(|usage| usage.line.as_str()) } pub fn retain<F>(&mut self, f: F) where F: FnMut(&Usage) -> bool, { self.0.retain(f); } pub fn append(&mut self, other: Self) { let mut other_usages = other.0; self.0.append(&mut other_usages); } }
use std::{ops::ControlFlow, sync::Arc}; use async_channel::RecvError; use backoff::Backoff; use data_types::{CompactionLevel, ParquetFileParams}; use iox_catalog::interface::{get_table_columns_by_id, CasFailure, Catalog}; use iox_query::exec::Executor; use iox_time::{SystemProvider, TimeProvider}; use metric::DurationHistogram; use observability_deps::tracing::{debug, info, warn}; use parquet_file::{metadata::IoxMetadata, storage::ParquetStorage}; use schema::sort::SortKey; use tokio::{sync::mpsc, time::Instant}; use uuid::Uuid; use crate::persist::compact::compact_persisting_batch; use super::{ compact::CompactedStream, completion_observer::PersistCompletionObserver, context::{Context, PersistError, PersistRequest}, }; /// State shared across workers. #[derive(Debug)] pub(super) struct SharedWorkerState<O> { pub(super) exec: Arc<Executor>, pub(super) store: ParquetStorage, pub(super) catalog: Arc<dyn Catalog>, pub(super) completion_observer: O, } /// The worker routine that drives a [`PersistRequest`] to completion, /// prioritising jobs from the worker-specific queue, and falling back to jobs /// from the global work queue. /// /// Optimistically compacts the [`PersistingData`] using the locally cached sort /// key read from the [`PartitionData`] instance. If this key proves to be /// stale, the compaction is retried with the new key. /// /// See <https://github.com/influxdata/influxdb_iox/issues/6439>. /// /// ```text /// ┌───────┐ /// │COMPACT│ /// └───┬───┘ /// ┌───▽──┐ /// │UPLOAD│ /// └───┬──┘ /// _______▽________ ┌────────────────┐ /// ╱ ╲ │TRY UPDATE │ /// ╱ NEEDS CATALOG ╲___│CATALOG SORT KEY│ /// ╲ SORT KEY UPDATE? ╱yes└────────┬───────┘ /// ╲________________╱ _______▽________ ┌────────────┐ /// │no ╱ ╲ │RESTART WITH│ /// │ ╱ SAW CONCURRENT ╲___│NEW SORT KEY│ /// │ ╲ SORT KEY UPDATE? ╱yes└────────────┘ /// │ ╲________________╱ /// │ │no /// └─────┬────────────────┘ /// ┌─────▽─────┐ /// │ADD PARQUET│ /// │TO CATALOG │ /// └─────┬─────┘ /// ┌───────▽──────┐ /// │NOTIFY PERSIST│ /// │JOB COMPLETE │ /// └──────────────┘ /// ``` /// /// [`PersistingData`]: /// crate::buffer_tree::partition::persisting::PersistingData /// [`PartitionData`]: crate::buffer_tree::partition::PartitionData pub(super) async fn run_task<O>( worker_state: Arc<SharedWorkerState<O>>, global_queue: async_channel::Receiver<PersistRequest>, mut rx: mpsc::UnboundedReceiver<PersistRequest>, queue_duration: DurationHistogram, persist_duration: DurationHistogram, ) where O: PersistCompletionObserver, { loop { let req = tokio::select! { // Bias the channel polling to prioritise work in the // worker-specific queue. // // This causes the worker to do the work assigned to it specifically // first, falling back to taking jobs from the global queue if it // has no assigned work. // // This allows persist jobs to be reordered w.r.t the order in which // they were enqueued with queue_persist(). biased; v = rx.recv() => { match v { Some(v) => v, None => { // The worker channel is closed. return } } } v = global_queue.recv() => { match v { Ok(v) => v, Err(RecvError) => { // The global channel is closed. return }, } } }; let mut ctx = Context::new(req); // Capture the time spent in the queue. let started_at = Instant::now(); queue_duration.record(started_at.duration_since(ctx.enqueued_at())); // Compact the data, generate the parquet file from the result, and // upload it to object storage. // // If this process generated a new sort key that must be added to the // catalog, attempt to update the catalog with a compare-and-swap // operation; if this update fails due to a concurrent sort key update, // the compaction must be redone with the new sort key and uploaded // before continuing. let parquet_table_data = loop { match compact_and_upload(&mut ctx, &worker_state).await { Ok(v) => break v, Err(PersistError::ConcurrentSortKeyUpdate(_)) => continue, }; }; // Make the newly uploaded parquet file visible to other nodes. let object_store_id = update_catalog_parquet(&ctx, &worker_state, &parquet_table_data).await; // And finally mark the persist job as complete and notify any // observers. ctx.mark_complete( object_store_id, parquet_table_data, &worker_state.completion_observer, ) .await; // Capture the time spent actively persisting. let now = Instant::now(); persist_duration.record(now.duration_since(started_at)); } } /// Run a compaction on the [`PersistingData`], generate a parquet file and /// upload it to object storage. /// /// This function composes functionality from the smaller [`compact()`], /// [`upload()`], and [`update_catalog_sort_key()`] functions. /// /// If in the course of this the sort key is updated, this function attempts to /// update the sort key in the catalog. This MAY fail because another node has /// concurrently done the same and the persist must be restarted. /// /// See <https://github.com/influxdata/influxdb_iox/issues/6439>. /// /// [`PersistingData`]: /// crate::buffer_tree::partition::persisting::PersistingData async fn compact_and_upload<O>( ctx: &mut Context, worker_state: &SharedWorkerState<O>, ) -> Result<ParquetFileParams, PersistError> where O: Send + Sync, { let compacted = compact(ctx, worker_state).await; let (sort_key_update, parquet_table_data) = upload(ctx, worker_state, compacted).await; if let Some(update) = sort_key_update { update_catalog_sort_key( ctx, worker_state, update, parquet_table_data.object_store_id, ) .await? } Ok(parquet_table_data) } /// Compact the data in `ctx` using sorted by the sort key returned from /// [`Context::sort_key()`]. async fn compact<O>(ctx: &Context, worker_state: &SharedWorkerState<O>) -> CompactedStream where O: Send + Sync, { let sort_key = ctx.sort_key().get().await; debug!( namespace_id = %ctx.namespace_id(), namespace_name = %ctx.namespace_name(), table_id = %ctx.table_id(), table = %ctx.table(), partition_id = %ctx.partition_id(), partition_key = %ctx.partition_key(), ?sort_key, "compacting partition" ); assert!(!ctx.data().record_batches().is_empty()); // Run a compaction sort the data and resolve any duplicate values. // // This demands the deferred load values and may have to wait for them // to be loaded before compaction starts. compact_persisting_batch( &worker_state.exec, sort_key, ctx.table().get().await.name().clone(), ctx.data().query_adaptor(), ) .await .expect("unable to compact persisting batch") } /// Upload the compacted data in `compacted`, returning the new sort key value /// and parquet metadata to be upserted into the catalog. async fn upload<O>( ctx: &Context, worker_state: &SharedWorkerState<O>, compacted: CompactedStream, ) -> (Option<SortKey>, ParquetFileParams) where O: Send + Sync, { let CompactedStream { stream: record_stream, catalog_sort_key_update, data_sort_key, } = compacted; // Generate a UUID to uniquely identify this parquet file in // object storage. let object_store_id = Uuid::new_v4(); debug!( namespace_id = %ctx.namespace_id(), namespace_name = %ctx.namespace_name(), table_id = %ctx.table_id(), table = %ctx.table(), partition_id = %ctx.partition_id(), partition_key = %ctx.partition_key(), %object_store_id, sort_key = %data_sort_key, "uploading partition parquet" ); // Construct the metadata for this parquet file. let time_now = SystemProvider::new().now(); let iox_metadata = IoxMetadata { object_store_id, creation_timestamp: time_now, namespace_id: ctx.namespace_id(), namespace_name: Arc::clone(&*ctx.namespace_name().get().await), table_id: ctx.table_id(), table_name: Arc::clone(ctx.table().get().await.name()), partition_key: ctx.partition_key().clone(), compaction_level: CompactionLevel::Initial, sort_key: Some(data_sort_key), max_l0_created_at: time_now, }; // Save the compacted data to a parquet file in object storage. // // This call retries until it completes. let pool = worker_state.exec.pool(); let (md, file_size) = worker_state .store .upload(record_stream, ctx.partition_id(), &iox_metadata, pool) .await .expect("unexpected fatal persist error"); debug!( namespace_id = %ctx.namespace_id(), namespace_name = %ctx.namespace_name(), table_id = %ctx.table_id(), table = %ctx.table(), partition_id = %ctx.partition_id(), partition_key = %ctx.partition_key(), %object_store_id, file_size, "partition parquet uploaded" ); // Read the table's columns from the catalog to get a map of column name -> column IDs. let columns = Backoff::new(&Default::default()) .retry_all_errors("get table schema", || async { let mut repos = worker_state.catalog.repositories().await; get_table_columns_by_id(ctx.table_id(), repos.as_mut()).await }) .await .expect("retry forever"); // Build the data that must be inserted into the parquet_files catalog // table in order to make the file visible to queriers. let parquet_table_data = iox_metadata.to_parquet_file(ctx.partition_id().clone(), file_size, &md, |name| { columns .get(name) .unwrap_or_else(|| { panic!( "unknown column {name} in table ID {table_id}", table_id = ctx.table_id().get() ) }) .id }); (catalog_sort_key_update, parquet_table_data) } /// Update the sort key value stored in the catalog for this [`Context`]. /// /// # Concurrent Updates /// /// If a concurrent sort key change is detected (issued by another node) then /// this method updates the sort key in `ctx` to reflect the newly observed /// value and returns [`PersistError::ConcurrentSortKeyUpdate`] to the caller. async fn update_catalog_sort_key<O>( ctx: &mut Context, worker_state: &SharedWorkerState<O>, new_sort_key: SortKey, object_store_id: Uuid, ) -> Result<(), PersistError> where O: Send + Sync, { let old_sort_key = ctx .sort_key() .get() .await .map(|v| v.to_columns().map(|v| v.to_string()).collect::<Vec<_>>()); debug!( %object_store_id, namespace_id = %ctx.namespace_id(), namespace_name = %ctx.namespace_name(), table_id = %ctx.table_id(), table = %ctx.table(), partition_id = %ctx.partition_id(), partition_key = %ctx.partition_key(), ?new_sort_key, ?old_sort_key, "updating partition sort key" ); let update_result = Backoff::new(&Default::default()) .retry_with_backoff("cas_sort_key", || { let old_sort_key = old_sort_key.clone(); let new_sort_key_str = new_sort_key.to_columns().collect::<Vec<_>>(); let catalog = Arc::clone(&worker_state.catalog); let ctx = &ctx; async move { let mut repos = catalog.repositories().await; match repos .partitions() .cas_sort_key(ctx.partition_id(), old_sort_key.clone(), &new_sort_key_str) .await { Ok(_) => ControlFlow::Break(Ok(())), Err(CasFailure::QueryError(e)) => ControlFlow::Continue(e), Err(CasFailure::ValueMismatch(observed)) if observed == new_sort_key_str => { // A CAS failure occurred because of a concurrent // sort key update, however the new catalog sort key // exactly matches the sort key this node wants to // commit. // // This is the sad-happy path, and this task can // continue. info!( %object_store_id, namespace_id = %ctx.namespace_id(), namespace_name = %ctx.namespace_name(), table_id = %ctx.table_id(), table = %ctx.table(), partition_id = %ctx.partition_id(), partition_key = %ctx.partition_key(), expected=?old_sort_key, ?observed, update=?new_sort_key_str, "detected matching concurrent sort key update" ); ControlFlow::Break(Ok(())) } Err(CasFailure::ValueMismatch(observed)) => { // Another ingester concurrently updated the sort // key. // // This breaks a sort-key update invariant - sort // key updates MUST be serialised. This persist must // be retried. // // See: // https://github.com/influxdata/influxdb_iox/issues/6439 // warn!( %object_store_id, namespace_id = %ctx.namespace_id(), namespace_name = %ctx.namespace_name(), table_id = %ctx.table_id(), table = %ctx.table(), partition_id = %ctx.partition_id(), partition_key = %ctx.partition_key(), expected=?old_sort_key, ?observed, update=?new_sort_key_str, "detected concurrent sort key update, regenerating parquet" ); // Stop the retry loop with an error containing the // newly observed sort key. ControlFlow::Break(Err(PersistError::ConcurrentSortKeyUpdate( SortKey::from_columns(observed), ))) } } } }) .await .expect("retry forever"); match update_result { Ok(_) => {} Err(PersistError::ConcurrentSortKeyUpdate(new_key)) => { // Update the cached sort key in the Context (which pushes it // through into the PartitionData also) to reflect the newly // observed value for the next attempt. ctx.set_partition_sort_key(new_key.clone()).await; return Err(PersistError::ConcurrentSortKeyUpdate(new_key)); } } // Update the sort key in the Context & PartitionData. ctx.set_partition_sort_key(new_sort_key.clone()).await; debug!( %object_store_id, namespace_id = %ctx.namespace_id(), namespace_name = %ctx.namespace_name(), table_id = %ctx.table_id(), table = %ctx.table(), partition_id = %ctx.partition_id(), partition_key = %ctx.partition_key(), ?old_sort_key, %new_sort_key, "adjusted partition sort key" ); Ok(()) } async fn update_catalog_parquet<O>( ctx: &Context, worker_state: &SharedWorkerState<O>, parquet_table_data: &ParquetFileParams, ) -> Uuid where O: Send + Sync, { // Extract the object store ID to the local scope so that it can easily // be referenced in debug logging to aid correlation of persist events // for a specific file. let object_store_id = parquet_table_data.object_store_id; debug!( namespace_id = %ctx.namespace_id(), namespace_name = %ctx.namespace_name(), table_id = %ctx.table_id(), table = %ctx.table(), partition_id = %ctx.partition_id(), partition_key = %ctx.partition_key(), %object_store_id, ?parquet_table_data, "updating catalog parquet table" ); // Add the parquet file to the catalog. // // This has the effect of allowing the queriers to "discover" the // parquet file by polling / querying the catalog. Backoff::new(&Default::default()) .retry_all_errors("add parquet file to catalog", || async { let mut repos = worker_state.catalog.repositories().await; let parquet_file = repos .parquet_files() .create(parquet_table_data.clone()) .await?; debug!( namespace_id = %ctx.namespace_id(), namespace_name = %ctx.namespace_name(), table_id = %ctx.table_id(), table = %ctx.table(), partition_id = %ctx.partition_id(), partition_key = %ctx.partition_key(), %object_store_id, ?parquet_table_data, parquet_file_id=?parquet_file.id, "parquet file added to catalog" ); // compiler insisted on getting told the type of the error :shrug: Ok(()) as Result<(), iox_catalog::interface::Error> }) .await .expect("retry forever"); object_store_id }
pub fn flood_fill(mut image: Vec<Vec<i32>>, sr: i32, sc: i32, new_color: i32) -> Vec<Vec<i32>> { let u = |i: i32| i as usize; let i = |x: usize| x as i32; let start_color = image[u(sr)][u(sc)]; if start_color == new_color { return image; } let (width, height) = (image.len(), image[0].len()); let mut queue = std::collections::VecDeque::new(); let dirs: [(i32, i32); 4] = [(-1, 0), (0, 1), (1, 0), (0, -1)]; let mut visited = std::collections::HashSet::new(); queue.push_front((u(sr), u(sc))); while let Some((row, col)) = queue.pop_back() { if visited.contains(&(row, col)) { continue; } image[row][col] = new_color; visited.insert((row, col)); dirs.iter() .map(|(dx, dy)| (i(row) + dx, i(col) + dy)) .filter(|&(x, y)| { x >= 0 && x < i(width) && y >= 0 && y < i(height) && image[u(x)][u(y)] == start_color }) .for_each(|(x, y)| queue.push_front((u(x), u(y)))); } image } #[cfg(test)] mod flood_fill_tests { use super::*; #[test] fn flood_fill_test_one() { assert_eq!( flood_fill(vec![vec![0, 0, 0], vec![0, 0, 0]], 0, 0, 2), vec![vec![2, 2, 2], vec![2, 2, 2]] ); } #[test] fn flood_fill_test_two() { assert_eq!( flood_fill(vec![vec![1, 1, 1], vec![1, 1, 0], vec![1, 0, 1]], 1, 1, 2), vec![vec![2, 2, 2], vec![2, 2, 0], vec![2, 0, 1]] ) } }
use ggez::{graphics, input, Context, event::EventHandler, GameResult}; use ggez::graphics::Color; use super::{ TIME_STEP, simulation::{astro::Astro, Simulation}, ui::{self, ui_manager::UIManager}, utils::vector2::Vector2F, }; pub struct GameState { is_paused: bool, time_step: f32, simulation: Simulation, ui_manager: UIManager, } impl GameState { pub fn new(time_step: f32, g_const: f32, ui_manager: UIManager) -> Self { Self { is_paused: false, time_step: time_step, simulation: Simulation::new(g_const), ui_manager: ui_manager, } } } impl EventHandler<ggez::GameError> for GameState { fn update(&mut self, _ctx: &mut Context) -> GameResult<()> { self.simulation.update_sim(self.time_step); Ok(()) } fn draw(&mut self, ctx: &mut Context) -> GameResult<()> { graphics::clear(ctx, Color::from_rgb(46, 52, 54)); self.simulation.draw_astros(ctx); self.ui_manager.draw_elements(ctx); graphics::present(ctx) } fn key_down_event( &mut self, _ctx: &mut Context, keycode: ggez::event::KeyCode, _keymods: ggez::event::KeyMods, _repeat: bool, ) { match keycode { input::keyboard::KeyCode::P => { if _repeat != false { return; } self.is_paused = !self.is_paused; self.time_step = if self.is_paused == true {0.0} else {1.0}; self.ui_manager.update_simulation_info( self.time_step, if self.is_paused == true { ui::SimulationCommands::Pause } else { ui::SimulationCommands::Unpaused }, ); } input::keyboard::KeyCode::R => { if _repeat != false { return; } self.simulation.reset_astros(); } input::keyboard::KeyCode::Down => { if format!("{:.1}", self.time_step) != "0.0" { self.time_step -= TIME_STEP / (TIME_STEP * 10.0); self.ui_manager.update_simulation_info( self.time_step, ui::SimulationCommands::SpeedChange, ); } } input::keyboard::KeyCode::Up => { self.time_step += TIME_STEP / (TIME_STEP * 10.0); self.ui_manager.update_simulation_info( self.time_step, ui::SimulationCommands::SpeedChange, ); } _ => (), } } fn mouse_button_down_event( &mut self, _ctx: &mut Context, _button: ggez::event::MouseButton, _x: f32, _y: f32, ) { if _button == input::mouse::MouseButton::Left { self.simulation.add_astro(Astro::new( _ctx, 20.0, Vector2F { x: (_x / 2.0), y: (_y / 2.0), }, Vector2F { x: (0.0), y: (0.0) }, )); } } }
use crate::{ handle_error, Error, ErrorResponse, Result, Tarkov, GAME_VERSION, LAUNCHER_ENDPOINT, LAUNCHER_VERSION, PROD_ENDPOINT, }; use actix_web::client::Client; use actix_web::http::StatusCode; use flate2::read::ZlibDecoder; use log::debug; use serde::{Deserialize, Serialize}; use std::io::Read; #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] struct LoginRequest<'a> { email: &'a str, pass: &'a str, hw_code: &'a str, captcha: Option<&'a str>, } #[derive(Debug, Deserialize)] pub(crate) struct Auth { pub aid: String, pub lang: String, pub region: Option<String>, #[serde(rename = "gameVersion")] pub game_version: Option<String>, #[serde(rename = "dataCenters")] pub data_centers: Vec<String>, #[serde(rename = "ipRegion")] pub ip_region: String, pub token_type: String, pub expires_in: u64, pub access_token: String, pub refresh_token: String, } #[derive(Debug, Deserialize)] struct LoginResponse { #[serde(flatten)] error: ErrorResponse, #[serde(default)] data: Option<Auth>, } /// Login error #[derive(Debug, err_derive::Error)] pub enum LoginError { /// Invalid or missing parameters. #[error(display = "invalid or missing login parameters")] MissingParameters, /// 2FA code is required to continue authentication. #[error(display = "2fa is required")] TwoFactorRequired, /// Captcha response is required to continue authentication. #[error(display = "captcha is required")] CaptchaRequired, /// Incorrect 2FA code. #[error(display = "incorrect 2FA code")] BadTwoFactorCode, } pub(crate) async fn login( client: &Client, email: &str, password: &str, captcha: Option<&str>, hwid: &str, ) -> Result<Auth> { if email.is_empty() || password.is_empty() || hwid.is_empty() { return Err(LoginError::MissingParameters)?; } let url = format!( "{}/launcher/login?launcherVersion={}&branch=live", LAUNCHER_ENDPOINT, LAUNCHER_VERSION ); let password = format!("{:x}", md5::compute(&password)); let req = LoginRequest { email, pass: &password, hw_code: hwid, captcha, }; debug!("Sending request to {}...", url); let mut res = client .post(url) .header("User-Agent", format!("BSG Launcher {}", LAUNCHER_VERSION)) .send_json(&req) .await?; match res.status() { StatusCode::OK => { let body = res.body().await?; let mut decode = ZlibDecoder::new(&body[..]); let mut body = String::new(); decode.read_to_string(&mut body)?; debug!("Response: {}", body); let res = serde_json::from_slice::<LoginResponse>(body.as_bytes())?; handle_error(res.error, res.data) } _ => Err(Error::Status(res.status())), } } #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] struct SecurityLoginRequest<'a> { email: &'a str, hw_code: &'a str, activate_code: &'a str, } #[derive(Debug, Deserialize)] struct SecurityLoginResponse { #[serde(flatten)] error: ErrorResponse, } pub(crate) async fn activate_hardware( client: &Client, email: &str, code: &str, hwid: &str, ) -> Result<()> { if email.is_empty() || code.is_empty() || hwid.is_empty() { return Err(LoginError::MissingParameters)?; } let url = format!( "{}/launcher/hardwareCode/activate?launcherVersion={}", LAUNCHER_ENDPOINT, LAUNCHER_VERSION ); let req = SecurityLoginRequest { email, hw_code: hwid, activate_code: code, }; debug!("Sending request to {}...", url); let mut res = client .post(url) .header("User-Agent", format!("BSG Launcher {}", LAUNCHER_VERSION)) .send_json(&req) .await?; match res.status() { StatusCode::OK => { let body = res.body().await?; let mut decode = ZlibDecoder::new(&body[..]); let mut body = String::new(); decode.read_to_string(&mut body)?; debug!("Response: {}", body); let res = serde_json::from_slice::<SecurityLoginResponse>(body.as_bytes())?; handle_error(res.error, Some(())) } _ => Err(Error::Status(res.status())), } } #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] struct ExchangeRequest<'a> { version: ExchangeVersion<'a>, hw_code: &'a str, } #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] struct ExchangeVersion<'a> { major: &'a str, game: &'a str, backend: &'a str, } #[derive(Debug, Deserialize)] struct ExchangeResponse { #[serde(flatten)] error: ErrorResponse, data: Option<Session>, } /// Authenticated user session. #[derive(Debug, Deserialize, Clone, PartialEq)] pub struct Session { queued: bool, /// Session cookie. pub session: String, } pub(crate) async fn exchange_access_token( client: &Client, access_token: &str, hwid: &str, ) -> Result<Session> { let url = format!( "{}/launcher/game/start?launcherVersion={}&branch=live", PROD_ENDPOINT, LAUNCHER_VERSION ); let req = ExchangeRequest { version: ExchangeVersion { major: GAME_VERSION, game: "live", backend: "6", }, hw_code: hwid, }; debug!("Sending request to {}...", url); let mut res = client .post(url) .header("User-Agent", format!("BSG Launcher {}", LAUNCHER_VERSION)) .bearer_auth(access_token) .send_json(&req) .await?; match res.status() { StatusCode::OK => { let body = res.body().await?; let mut decode = ZlibDecoder::new(&body[..]); let mut body = String::new(); decode.read_to_string(&mut body)?; debug!("Response: {}", body); let res = serde_json::from_slice::<ExchangeResponse>(body.as_bytes())?; handle_error(res.error, res.data) } _ => Err(Error::Status(res.status())), } } impl Tarkov { /// Keep the current session alive. Session expires after 30 seconds of idling. pub async fn keep_alive(&self) -> Result<()> { let url = format!("{}/client/game/keepalive", PROD_ENDPOINT); let res: ErrorResponse = self.post_json(&url, &{}).await?; match res.code { 0 => Ok(()), _ => Err(Error::UnknownAPIError(res.code)), } } }
extern crate tcod; use self::tcod::console::{Root}; use self::tcod::input::KeyCode; use game::Game; //Types that implement this trait will handle their own updating and rendering pub trait Updates { fn update(&mut self, KeyCode, &Game); fn render(&self, &mut Root); }
use std::collections::HashMap; use std::sync::Arc; use bevy::prelude::{Commands, Entity, EventReader, Events, ResMut}; use quinn::{IncomingUniStreams, crypto::rustls::TlsSession, generic::RecvStream}; use tokio::{ stream::StreamExt, sync::mpsc::{UnboundedReceiver, UnboundedSender, unbounded_channel} }; use tracing::{error, info, warn}; use super::{ components::Connection, events::{NetworkError, ReceiveEvent, SendEvent}, id::ConnectionId, packets::Packet, }; /// The stage at which [`SendEvent`]s are sent across the network. pub const SEND_NET_EVENT_STAGE: &str = bevy::app::stage::LAST; /// The stage at which [`ReceiveEvent`]s are read from the network. pub const RECEIVE_NET_EVENT_STAGE: &str = bevy::app::stage::FIRST; #[derive(Default)] pub struct NetEventLoggerState { pub event_reader: EventReader<ReceiveEvent>, } pub fn log_net_events(mut state: ResMut<NetEventLoggerState>, receiver: ResMut<Events<ReceiveEvent>>) { for evt in state.event_reader.iter(&receiver) { match evt { ReceiveEvent::Connected(cid, _) => info!("New Connection: {:?}", cid), ReceiveEvent::Disconnected(cid) => info!("Disconnected: {:?}", cid), ReceiveEvent::SocketClosed => warn!("Socket Closed"), ReceiveEvent::NetworkError(err) => error!("Network Error: {:?}", err), _ => {} } } } /// Internal state of the network session system pub struct SessionEventListenerState { /// Map from ConnectionID => PacketSender MPSC pub stream_senders: HashMap<ConnectionId, UnboundedSender<SendEvent>>, /// MPSC sender for the accompanying event_receiver pub event_sender: UnboundedSender<ReceiveEvent>, /// MPSC which receives all events from the network pub event_receiver: UnboundedReceiver<ReceiveEvent>, /// Event reader used for pulling send events and publishing them to the network pub send_event_reader: EventReader<SendEvent>, } /// ECS resources containing a map of active network connections #[derive(Default)] pub struct NetworkConnections { pub connections: HashMap<ConnectionId, Entity> } /// Consume events from the network (sent through MPSCs) and publish them to the ECS pub fn receive_net_events_system( mut commands: Commands, mut session: ResMut<SessionEventListenerState>, mut entities: ResMut<NetworkConnections>, mut net_events: ResMut<Events<ReceiveEvent>> ) { // Break up `session` in a way that Rust is happy with let session: &mut SessionEventListenerState = &mut session; let SessionEventListenerState { event_receiver, .. } = session; // Pull network events from MPSC and publish them while let Ok(event) = event_receiver.try_recv() { match event { // A new connection has opened, allocate an entry in the hashmap ReceiveEvent::Connected(id, ref packet_sender) => { // Create an entity representing this connection commands.spawn(( Connection { id }, )); entities.connections.insert(id, commands.current_entity().expect("`spawn` did not create an entity")); // Store the MPSC to send to this stream in the hashmap session.stream_senders.insert(id, packet_sender.clone()); } ReceiveEvent::Disconnected(id) => { // Delete the entity representing this connection if let Some(e) = entities.connections.remove(&id) { commands.despawn(e); } else { warn!("Failed to delete connection Entity for ConnectionId:{:?}", id); } // drop all stream senders session.stream_senders.remove(&id); } // When the socket closes throw away all session state ReceiveEvent::SocketClosed => { // Delete all connection entities for (_, e) in entities.connections.drain() { commands.despawn(e); } // drop all stream senders session.stream_senders.clear(); } _ => {} } // Publish event for other systems to consume net_events.send(event); } } /// Take ECS events and forward them to MPSCs to be sent over the network pub fn send_net_events_system(mut session: ResMut<SessionEventListenerState>, send_events: ResMut<Events<SendEvent>>) { // Publish packets ready to send to appropriate MPSC channels for send in session.send_event_reader.iter(&send_events) { // Try to get the MPSC sender for this connection, early exit if it does not exist let connection = send.get_connection(); let sender = if let Some(sender) = session.stream_senders.get(&connection) { sender } else { error!("Attempted to send to a non-existant connection: {:?}", connection); continue; }; // Try to send a message through this MPSC. Sending may fail if the receiving end of the // MPSC has been dropped - in that case raise an error. if sender.send(send.clone()).is_err() { warn!("Failed to publish packet from ECS->MPSC"); session.event_sender .send(ReceiveEvent::NetworkError(send.as_stream_sender_error())) .expect("Failed to send error event!"); } } } /// Represents a connection that is still in the process of opening pub struct Connecting { id: ConnectionId, connecting: quinn::Connecting, event_sender: UnboundedSender<ReceiveEvent>, } impl Connecting { pub fn new(connecting: quinn::Connecting, event_sender: UnboundedSender<ReceiveEvent>) -> Self { Connecting { id: ConnectionId::new(), connecting, event_sender } } /// Wait for the connection to finish opening and then spawn the tasks to handle it pub async fn run(self) { info!("connection incoming: {:?}", self.id); // Wait for connection to finish connecting let quinn::NewConnection { connection, uni_streams, .. } = match self.connecting.await { Ok(connection) => connection, Err(e) => { self.event_sender.send(ReceiveEvent::NetworkError( NetworkError::ConnectionError(e) )).expect("Failed to send network event"); return; } }; // Create a new MPSC which the ECS can use to send packets through this connection let (send, recv) = unbounded_channel(); // Send an intial event indicating that this connection opened self.event_sender .send(ReceiveEvent::Connected(self.id, send)) .expect("Failed to send network event"); // Start running tasks to send/receive to this connection tokio::spawn(Connected { id: self.id, send: self.event_sender, connection, uni_streams, recv }.run()); } } /// Represents a connected quinn connection struct Connected { id: ConnectionId, connection: quinn::Connection, uni_streams: IncomingUniStreams, recv: UnboundedReceiver<SendEvent>, send: UnboundedSender<ReceiveEvent> } impl Connected { /// start running the async tasks required to pump this connection pub async fn run(self) { // Spawn a task which polls for new incoming streams tokio::spawn(Self::poll_incoming_streams(self.uni_streams, self.send.clone(), self.id)); // Spawn a task which opens new outgoing streams and sends packets to them tokio::spawn(Self::send_to_streams(self.connection, self.recv, self.send)); } /// keep watch for new incoming streams and spawn async tasks to send/receive to the stream async fn poll_incoming_streams(mut uni_streams: IncomingUniStreams, event_sender: UnboundedSender<ReceiveEvent>, id: ConnectionId) { // Keep getting events from the connection until it closes while let Some(stream) = uni_streams.next().await { match stream { Err(quinn::ConnectionError::ApplicationClosed { .. }) => break, Err(e) => { event_sender.send(ReceiveEvent::NetworkError( NetworkError::ConnectionError(e) )).expect("Failed to send network event"); break; }, Ok(recv) => { tokio::spawn(Self::read_from_stream(id, recv, event_sender.clone())); } }; } // Send a final event indicating that this connection closed event_sender .send(ReceiveEvent::Disconnected(id)) .expect("Failed to send network event"); } /// Pump the MPSCs for new packets that need sending async fn send_to_streams( mut conn: quinn::Connection, mut recv: UnboundedReceiver<SendEvent>, event_sender: UnboundedSender<ReceiveEvent> ) { // Create a list of open streams. When a request comes in to send over a non-existant stream open it and store it here. // Streams are never closed. This is fine since there are a fixed number of streams (as defined in the StreamType enum). let mut stream_lookup = Vec::new(); // Keep pulling events from the stream until "None" is received (indicating that all senders have been dropped). while let Some(evt) = recv.recv().await { // Send the packet and break out of the loop if sending errorred if let Err(err) = evt.send(&mut stream_lookup, &mut conn).await { event_sender.send(ReceiveEvent::NetworkError(err)).expect("Failed to send error event!"); break; } } } /// Handle all the work of reading from a specific stream async fn read_from_stream( connection_id: ConnectionId, mut stream_recv: RecvStream<TlsSession>, event_sender: UnboundedSender<ReceiveEvent>, ) { info!("Stream incoming: conn:{:?}", connection_id); // Pull packets from this stream and publish them to the ECS through the event_sender loop { let pkt = Packet::receive(&mut stream_recv).await; let se = match pkt { Ok(pkt) => event_sender.send(ReceiveEvent::ReceivedPacket { connection: connection_id, data: Arc::new(pkt), }), Err(err) => { event_sender.send(ReceiveEvent::NetworkError( NetworkError::ReceiveError { connection: connection_id, err, } )).expect("Failed to send error event!"); break; }, }; se.expect("Failed to send event"); } } }
use super::*; use proptest::strategy::Strategy; #[test] fn without_list_or_bitstring_second_returns_second() { run!( |arc_process| { ( strategy::term::is_list(arc_process.clone()), strategy::term(arc_process.clone()) .prop_filter("second cannot be a list or bitstring", |second| { !(second.is_list() || second.is_bitstring()) }), ) }, |(first, second)| { prop_assert_eq!(result(first, second), second); Ok(()) }, ); } #[test] fn with_empty_list_second_returns_second() { min(|_, _| Term::NIL, Second); } #[test] fn with_lesser_list_second_returns_second() { min( |_, process| process.cons(process.integer(0), process.integer(0)), Second, ); } #[test] fn with_same_list_second_returns_first() { min(|first, _| first, First); } #[test] fn with_same_value_list_second_returns_first() { min( |_, process| process.cons(process.integer(0), process.integer(1)), First, ); } #[test] fn with_greater_list_second_returns_first() { min( |_, process| process.cons(process.integer(0), process.integer(2)), First, ); } #[test] fn with_bitstring_second_returns_first() { run!( |arc_process| { ( strategy::term::is_list(arc_process.clone()), strategy::term::is_bitstring(arc_process.clone()), ) }, |(first, second)| { prop_assert_eq!(result(first, second), first); Ok(()) }, ); } fn min<R>(second: R, which: FirstSecond) where R: FnOnce(Term, &Process) -> Term, { super::min( |process| process.cons(process.integer(0), process.integer(1)), second, which, ); }
use proconio::input; use proconio::marker::Chars; fn main() { input! { s: Chars, }; for c in "0123456789".chars() { if !s.contains(&c) { println!("{}", c); return; } } unreachable!(); }
use std::collections::VecDeque; use input_i_scanner::InputIScanner; use join::Join; fn main() { let stdin = std::io::stdin(); let mut _i_i = InputIScanner::from(stdin.lock()); macro_rules! scan { (($($t: ty),+)) => { ($(scan!($t)),+) }; ($t: ty) => { _i_i.scan::<$t>() as $t }; (($($t: ty),+); $n: expr) => { std::iter::repeat_with(|| scan!(($($t),+))).take($n).collect::<Vec<_>>() }; ($t: ty; $n: expr) => { std::iter::repeat_with(|| scan!($t)).take($n).collect::<Vec<_>>() }; } let n = scan!(usize); let s = scan!(String); let s: Vec<char> = s.chars().collect(); let mut ques = vec![VecDeque::new(); 26]; for i in (0..n).rev() { let d = s[i] as usize - 'a' as usize; ques[d].push_back(i); } let mut pairs = Vec::new(); let mut k = n; for i in 0..n { let d = s[i] as usize - 'a' as usize; for e in 0..d { let mut found = false; while let Some(j) = ques[e].pop_front() { if i < j && j < k { pairs.push((i, j)); found = true; k = j; break; } } if found { break; } } } let mut s = s; for (i, j) in pairs { s.swap(i, j); } let ans = s.iter().join(""); println!("{}", ans); } // cabaaabbbabcbaba // ^ ^ // aabaaabbbabcbabc // ^ ^ // aaaaaabbbabcbbbc // ^ ^ // aaaaaaabbbbcbbbc
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtWidgets/qtextedit.h // dst-file: /src/widgets/qtextedit.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::qabstractscrollarea::*; // 773 use std::ops::Deref; use super::super::core::qstring::*; // 771 use super::qmenu::*; // 773 use super::super::gui::qtextdocument::*; // 771 use super::super::core::qvariant::*; // 771 use super::super::core::qrect::*; // 771 use super::super::gui::qcolor::*; // 771 use super::super::core::qpoint::*; // 771 use super::super::gui::qtextcursor::*; // 771 use super::super::gui::qtextformat::*; // 771 use super::super::core::qregexp::*; // 771 use super::super::gui::qfont::*; // 771 use super::super::core::qurl::*; // 771 use super::super::core::qobjectdefs::*; // 771 use super::qwidget::*; // 773 use super::super::gui::qpagedpaintdevice::*; // 771 // <= use block end // ext block begin => // #[link(name = "Qt5Core")] // #[link(name = "Qt5Gui")] // #[link(name = "Qt5Widgets")] // #[link(name = "QtInline")] extern { fn QTextEdit_Class_Size() -> c_int; // proto: int QTextEdit::lineWrapColumnOrWidth(); fn C_ZNK9QTextEdit21lineWrapColumnOrWidthEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QTextEdit::setFontFamily(const QString & fontFamily); fn C_ZN9QTextEdit13setFontFamilyERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QString QTextEdit::toPlainText(); fn C_ZNK9QTextEdit11toPlainTextEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QTextEdit::setCursorWidth(int width); fn C_ZN9QTextEdit14setCursorWidthEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: QMenu * QTextEdit::createStandardContextMenu(); fn C_ZN9QTextEdit25createStandardContextMenuEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QTextDocument * QTextEdit::document(); fn C_ZNK9QTextEdit8documentEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QRect QTextEdit::cursorRect(); fn C_ZNK9QTextEdit10cursorRectEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QTextEdit::setTextColor(const QColor & c); fn C_ZN9QTextEdit12setTextColorERK6QColor(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: bool QTextEdit::acceptRichText(); fn C_ZNK9QTextEdit14acceptRichTextEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: void QTextEdit::clear(); fn C_ZN9QTextEdit5clearEv(qthis: u64 /* *mut c_void*/); // proto: void QTextEdit::insertHtml(const QString & text); fn C_ZN9QTextEdit10insertHtmlERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QString QTextEdit::fontFamily(); fn C_ZNK9QTextEdit10fontFamilyEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QTextEdit::setFontUnderline(bool b); fn C_ZN9QTextEdit16setFontUnderlineEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: void QTextEdit::cut(); fn C_ZN9QTextEdit3cutEv(qthis: u64 /* *mut c_void*/); // proto: QString QTextEdit::anchorAt(const QPoint & pos); fn C_ZNK9QTextEdit8anchorAtERK6QPoint(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: int QTextEdit::cursorWidth(); fn C_ZNK9QTextEdit11cursorWidthEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QTextEdit::setTextBackgroundColor(const QColor & c); fn C_ZN9QTextEdit22setTextBackgroundColorERK6QColor(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: int QTextEdit::tabStopWidth(); fn C_ZNK9QTextEdit12tabStopWidthEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QTextEdit::setFontWeight(int w); fn C_ZN9QTextEdit13setFontWeightEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: void QTextEdit::selectAll(); fn C_ZN9QTextEdit9selectAllEv(qthis: u64 /* *mut c_void*/); // proto: void QTextEdit::zoomOut(int range); fn C_ZN9QTextEdit7zoomOutEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: void QTextEdit::redo(); fn C_ZN9QTextEdit4redoEv(qthis: u64 /* *mut c_void*/); // proto: void QTextEdit::setFontPointSize(qreal s); fn C_ZN9QTextEdit16setFontPointSizeEd(qthis: u64 /* *mut c_void*/, arg0: c_double); // proto: bool QTextEdit::overwriteMode(); fn C_ZNK9QTextEdit13overwriteModeEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QTextCursor QTextEdit::textCursor(); fn C_ZNK9QTextEdit10textCursorEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QTextEdit::mergeCurrentCharFormat(const QTextCharFormat & modifier); fn C_ZN9QTextEdit22mergeCurrentCharFormatERK15QTextCharFormat(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QTextEdit::setPlainText(const QString & text); fn C_ZN9QTextEdit12setPlainTextERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QString QTextEdit::placeholderText(); fn C_ZNK9QTextEdit15placeholderTextEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QTextEdit::~QTextEdit(); fn C_ZN9QTextEditD2Ev(qthis: u64 /* *mut c_void*/); // proto: bool QTextEdit::fontItalic(); fn C_ZNK9QTextEdit10fontItalicEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: void QTextEdit::copy(); fn C_ZN9QTextEdit4copyEv(qthis: u64 /* *mut c_void*/); // proto: qreal QTextEdit::fontPointSize(); fn C_ZNK9QTextEdit13fontPointSizeEv(qthis: u64 /* *mut c_void*/) -> c_double; // proto: void QTextEdit::setDocument(QTextDocument * document); fn C_ZN9QTextEdit11setDocumentEP13QTextDocument(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QTextEdit::setOverwriteMode(bool overwrite); fn C_ZN9QTextEdit16setOverwriteModeEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: void QTextEdit::undo(); fn C_ZN9QTextEdit4undoEv(qthis: u64 /* *mut c_void*/); // proto: void QTextEdit::zoomIn(int range); fn C_ZN9QTextEdit6zoomInEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: void QTextEdit::setDocumentTitle(const QString & title); fn C_ZN9QTextEdit16setDocumentTitleERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: bool QTextEdit::canPaste(); fn C_ZNK9QTextEdit8canPasteEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QString QTextEdit::toHtml(); fn C_ZNK9QTextEdit6toHtmlEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QMenu * QTextEdit::createStandardContextMenu(const QPoint & position); fn C_ZN9QTextEdit25createStandardContextMenuERK6QPoint(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: void QTextEdit::setTabStopWidth(int width); fn C_ZN9QTextEdit15setTabStopWidthEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: QString QTextEdit::documentTitle(); fn C_ZNK9QTextEdit13documentTitleEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: bool QTextEdit::isUndoRedoEnabled(); fn C_ZNK9QTextEdit17isUndoRedoEnabledEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: void QTextEdit::setText(const QString & text); fn C_ZN9QTextEdit7setTextERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QTextEdit::ensureCursorVisible(); fn C_ZN9QTextEdit19ensureCursorVisibleEv(qthis: u64 /* *mut c_void*/); // proto: void QTextEdit::setAcceptRichText(bool accept); fn C_ZN9QTextEdit17setAcceptRichTextEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: void QTextEdit::setPlaceholderText(const QString & placeholderText); fn C_ZN9QTextEdit18setPlaceholderTextERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: bool QTextEdit::isReadOnly(); fn C_ZNK9QTextEdit10isReadOnlyEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: void QTextEdit::setUndoRedoEnabled(bool enable); fn C_ZN9QTextEdit18setUndoRedoEnabledEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: QTextCharFormat QTextEdit::currentCharFormat(); fn C_ZNK9QTextEdit17currentCharFormatEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QTextCursor QTextEdit::cursorForPosition(const QPoint & pos); fn C_ZNK9QTextEdit17cursorForPositionERK6QPoint(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: void QTextEdit::scrollToAnchor(const QString & name); fn C_ZN9QTextEdit14scrollToAnchorERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QFont QTextEdit::currentFont(); fn C_ZNK9QTextEdit11currentFontEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QTextEdit::paste(); fn C_ZN9QTextEdit5pasteEv(qthis: u64 /* *mut c_void*/); // proto: void QTextEdit::setTextCursor(const QTextCursor & cursor); fn C_ZN9QTextEdit13setTextCursorERK11QTextCursor(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QTextEdit::setCurrentCharFormat(const QTextCharFormat & format); fn C_ZN9QTextEdit20setCurrentCharFormatERK15QTextCharFormat(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QVariant QTextEdit::loadResource(int type, const QUrl & name); fn C_ZN9QTextEdit12loadResourceEiRK4QUrl(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void) -> *mut c_void; // proto: void QTextEdit::setTabChangesFocus(bool b); fn C_ZN9QTextEdit18setTabChangesFocusEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: void QTextEdit::setHtml(const QString & text); fn C_ZN9QTextEdit7setHtmlERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QRect QTextEdit::cursorRect(const QTextCursor & cursor); fn C_ZNK9QTextEdit10cursorRectERK11QTextCursor(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: void QTextEdit::setLineWrapColumnOrWidth(int w); fn C_ZN9QTextEdit24setLineWrapColumnOrWidthEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: void QTextEdit::setFontItalic(bool b); fn C_ZN9QTextEdit13setFontItalicEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: const QMetaObject * QTextEdit::metaObject(); fn C_ZNK9QTextEdit10metaObjectEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QTextEdit::setCurrentFont(const QFont & f); fn C_ZN9QTextEdit14setCurrentFontERK5QFont(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: bool QTextEdit::tabChangesFocus(); fn C_ZNK9QTextEdit15tabChangesFocusEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QColor QTextEdit::textBackgroundColor(); fn C_ZNK9QTextEdit19textBackgroundColorEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QTextEdit::QTextEdit(const QString & text, QWidget * parent); fn C_ZN9QTextEditC2ERK7QStringP7QWidget(arg0: *mut c_void, arg1: *mut c_void) -> u64; // proto: void QTextEdit::print(QPagedPaintDevice * printer); fn C_ZNK9QTextEdit5printEP17QPagedPaintDevice(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: bool QTextEdit::fontUnderline(); fn C_ZNK9QTextEdit13fontUnderlineEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: void QTextEdit::insertPlainText(const QString & text); fn C_ZN9QTextEdit15insertPlainTextERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: int QTextEdit::fontWeight(); fn C_ZNK9QTextEdit10fontWeightEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: QColor QTextEdit::textColor(); fn C_ZNK9QTextEdit9textColorEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QTextEdit::append(const QString & text); fn C_ZN9QTextEdit6appendERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QTextEdit::QTextEdit(QWidget * parent); fn C_ZN9QTextEditC2EP7QWidget(arg0: *mut c_void) -> u64; // proto: void QTextEdit::setReadOnly(bool ro); fn C_ZN9QTextEdit11setReadOnlyEb(qthis: u64 /* *mut c_void*/, arg0: c_char); fn QTextEdit_SlotProxy_connect__ZN9QTextEdit13undoAvailableEb(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QTextEdit_SlotProxy_connect__ZN9QTextEdit13redoAvailableEb(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QTextEdit_SlotProxy_connect__ZN9QTextEdit13copyAvailableEb(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QTextEdit_SlotProxy_connect__ZN9QTextEdit21cursorPositionChangedEv(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QTextEdit_SlotProxy_connect__ZN9QTextEdit16selectionChangedEv(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QTextEdit_SlotProxy_connect__ZN9QTextEdit24currentCharFormatChangedERK15QTextCharFormat(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QTextEdit_SlotProxy_connect__ZN9QTextEdit11textChangedEv(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); } // <= ext block end // body block begin => // class sizeof(QTextEdit)=1 #[derive(Default)] pub struct QTextEdit { qbase: QAbstractScrollArea, pub qclsinst: u64 /* *mut c_void*/, pub _cursorPositionChanged: QTextEdit_cursorPositionChanged_signal, pub _redoAvailable: QTextEdit_redoAvailable_signal, pub _selectionChanged: QTextEdit_selectionChanged_signal, pub _currentCharFormatChanged: QTextEdit_currentCharFormatChanged_signal, pub _undoAvailable: QTextEdit_undoAvailable_signal, pub _textChanged: QTextEdit_textChanged_signal, pub _copyAvailable: QTextEdit_copyAvailable_signal, } impl /*struct*/ QTextEdit { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QTextEdit { return QTextEdit{qbase: QAbstractScrollArea::inheritFrom(qthis), qclsinst: qthis, ..Default::default()}; } } impl Deref for QTextEdit { type Target = QAbstractScrollArea; fn deref(&self) -> &QAbstractScrollArea { return & self.qbase; } } impl AsRef<QAbstractScrollArea> for QTextEdit { fn as_ref(& self) -> & QAbstractScrollArea { return & self.qbase; } } // proto: int QTextEdit::lineWrapColumnOrWidth(); impl /*struct*/ QTextEdit { pub fn lineWrapColumnOrWidth<RetType, T: QTextEdit_lineWrapColumnOrWidth<RetType>>(& self, overload_args: T) -> RetType { return overload_args.lineWrapColumnOrWidth(self); // return 1; } } pub trait QTextEdit_lineWrapColumnOrWidth<RetType> { fn lineWrapColumnOrWidth(self , rsthis: & QTextEdit) -> RetType; } // proto: int QTextEdit::lineWrapColumnOrWidth(); impl<'a> /*trait*/ QTextEdit_lineWrapColumnOrWidth<i32> for () { fn lineWrapColumnOrWidth(self , rsthis: & QTextEdit) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit21lineWrapColumnOrWidthEv()}; let mut ret = unsafe {C_ZNK9QTextEdit21lineWrapColumnOrWidthEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QTextEdit::setFontFamily(const QString & fontFamily); impl /*struct*/ QTextEdit { pub fn setFontFamily<RetType, T: QTextEdit_setFontFamily<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setFontFamily(self); // return 1; } } pub trait QTextEdit_setFontFamily<RetType> { fn setFontFamily(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setFontFamily(const QString & fontFamily); impl<'a> /*trait*/ QTextEdit_setFontFamily<()> for (&'a QString) { fn setFontFamily(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit13setFontFamilyERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit13setFontFamilyERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QString QTextEdit::toPlainText(); impl /*struct*/ QTextEdit { pub fn toPlainText<RetType, T: QTextEdit_toPlainText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toPlainText(self); // return 1; } } pub trait QTextEdit_toPlainText<RetType> { fn toPlainText(self , rsthis: & QTextEdit) -> RetType; } // proto: QString QTextEdit::toPlainText(); impl<'a> /*trait*/ QTextEdit_toPlainText<QString> for () { fn toPlainText(self , rsthis: & QTextEdit) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit11toPlainTextEv()}; let mut ret = unsafe {C_ZNK9QTextEdit11toPlainTextEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QTextEdit::setCursorWidth(int width); impl /*struct*/ QTextEdit { pub fn setCursorWidth<RetType, T: QTextEdit_setCursorWidth<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setCursorWidth(self); // return 1; } } pub trait QTextEdit_setCursorWidth<RetType> { fn setCursorWidth(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setCursorWidth(int width); impl<'a> /*trait*/ QTextEdit_setCursorWidth<()> for (i32) { fn setCursorWidth(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit14setCursorWidthEi()}; let arg0 = self as c_int; unsafe {C_ZN9QTextEdit14setCursorWidthEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QMenu * QTextEdit::createStandardContextMenu(); impl /*struct*/ QTextEdit { pub fn createStandardContextMenu<RetType, T: QTextEdit_createStandardContextMenu<RetType>>(& self, overload_args: T) -> RetType { return overload_args.createStandardContextMenu(self); // return 1; } } pub trait QTextEdit_createStandardContextMenu<RetType> { fn createStandardContextMenu(self , rsthis: & QTextEdit) -> RetType; } // proto: QMenu * QTextEdit::createStandardContextMenu(); impl<'a> /*trait*/ QTextEdit_createStandardContextMenu<QMenu> for () { fn createStandardContextMenu(self , rsthis: & QTextEdit) -> QMenu { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit25createStandardContextMenuEv()}; let mut ret = unsafe {C_ZN9QTextEdit25createStandardContextMenuEv(rsthis.qclsinst)}; let mut ret1 = QMenu::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QTextDocument * QTextEdit::document(); impl /*struct*/ QTextEdit { pub fn document<RetType, T: QTextEdit_document<RetType>>(& self, overload_args: T) -> RetType { return overload_args.document(self); // return 1; } } pub trait QTextEdit_document<RetType> { fn document(self , rsthis: & QTextEdit) -> RetType; } // proto: QTextDocument * QTextEdit::document(); impl<'a> /*trait*/ QTextEdit_document<QTextDocument> for () { fn document(self , rsthis: & QTextEdit) -> QTextDocument { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit8documentEv()}; let mut ret = unsafe {C_ZNK9QTextEdit8documentEv(rsthis.qclsinst)}; let mut ret1 = QTextDocument::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QRect QTextEdit::cursorRect(); impl /*struct*/ QTextEdit { pub fn cursorRect<RetType, T: QTextEdit_cursorRect<RetType>>(& self, overload_args: T) -> RetType { return overload_args.cursorRect(self); // return 1; } } pub trait QTextEdit_cursorRect<RetType> { fn cursorRect(self , rsthis: & QTextEdit) -> RetType; } // proto: QRect QTextEdit::cursorRect(); impl<'a> /*trait*/ QTextEdit_cursorRect<QRect> for () { fn cursorRect(self , rsthis: & QTextEdit) -> QRect { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit10cursorRectEv()}; let mut ret = unsafe {C_ZNK9QTextEdit10cursorRectEv(rsthis.qclsinst)}; let mut ret1 = QRect::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QTextEdit::setTextColor(const QColor & c); impl /*struct*/ QTextEdit { pub fn setTextColor<RetType, T: QTextEdit_setTextColor<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setTextColor(self); // return 1; } } pub trait QTextEdit_setTextColor<RetType> { fn setTextColor(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setTextColor(const QColor & c); impl<'a> /*trait*/ QTextEdit_setTextColor<()> for (&'a QColor) { fn setTextColor(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit12setTextColorERK6QColor()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit12setTextColorERK6QColor(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QTextEdit::acceptRichText(); impl /*struct*/ QTextEdit { pub fn acceptRichText<RetType, T: QTextEdit_acceptRichText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.acceptRichText(self); // return 1; } } pub trait QTextEdit_acceptRichText<RetType> { fn acceptRichText(self , rsthis: & QTextEdit) -> RetType; } // proto: bool QTextEdit::acceptRichText(); impl<'a> /*trait*/ QTextEdit_acceptRichText<i8> for () { fn acceptRichText(self , rsthis: & QTextEdit) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit14acceptRichTextEv()}; let mut ret = unsafe {C_ZNK9QTextEdit14acceptRichTextEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QTextEdit::clear(); impl /*struct*/ QTextEdit { pub fn clear<RetType, T: QTextEdit_clear<RetType>>(& self, overload_args: T) -> RetType { return overload_args.clear(self); // return 1; } } pub trait QTextEdit_clear<RetType> { fn clear(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::clear(); impl<'a> /*trait*/ QTextEdit_clear<()> for () { fn clear(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit5clearEv()}; unsafe {C_ZN9QTextEdit5clearEv(rsthis.qclsinst)}; // return 1; } } // proto: void QTextEdit::insertHtml(const QString & text); impl /*struct*/ QTextEdit { pub fn insertHtml<RetType, T: QTextEdit_insertHtml<RetType>>(& self, overload_args: T) -> RetType { return overload_args.insertHtml(self); // return 1; } } pub trait QTextEdit_insertHtml<RetType> { fn insertHtml(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::insertHtml(const QString & text); impl<'a> /*trait*/ QTextEdit_insertHtml<()> for (&'a QString) { fn insertHtml(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit10insertHtmlERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit10insertHtmlERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QString QTextEdit::fontFamily(); impl /*struct*/ QTextEdit { pub fn fontFamily<RetType, T: QTextEdit_fontFamily<RetType>>(& self, overload_args: T) -> RetType { return overload_args.fontFamily(self); // return 1; } } pub trait QTextEdit_fontFamily<RetType> { fn fontFamily(self , rsthis: & QTextEdit) -> RetType; } // proto: QString QTextEdit::fontFamily(); impl<'a> /*trait*/ QTextEdit_fontFamily<QString> for () { fn fontFamily(self , rsthis: & QTextEdit) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit10fontFamilyEv()}; let mut ret = unsafe {C_ZNK9QTextEdit10fontFamilyEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QTextEdit::setFontUnderline(bool b); impl /*struct*/ QTextEdit { pub fn setFontUnderline<RetType, T: QTextEdit_setFontUnderline<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setFontUnderline(self); // return 1; } } pub trait QTextEdit_setFontUnderline<RetType> { fn setFontUnderline(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setFontUnderline(bool b); impl<'a> /*trait*/ QTextEdit_setFontUnderline<()> for (i8) { fn setFontUnderline(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit16setFontUnderlineEb()}; let arg0 = self as c_char; unsafe {C_ZN9QTextEdit16setFontUnderlineEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QTextEdit::cut(); impl /*struct*/ QTextEdit { pub fn cut<RetType, T: QTextEdit_cut<RetType>>(& self, overload_args: T) -> RetType { return overload_args.cut(self); // return 1; } } pub trait QTextEdit_cut<RetType> { fn cut(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::cut(); impl<'a> /*trait*/ QTextEdit_cut<()> for () { fn cut(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit3cutEv()}; unsafe {C_ZN9QTextEdit3cutEv(rsthis.qclsinst)}; // return 1; } } // proto: QString QTextEdit::anchorAt(const QPoint & pos); impl /*struct*/ QTextEdit { pub fn anchorAt<RetType, T: QTextEdit_anchorAt<RetType>>(& self, overload_args: T) -> RetType { return overload_args.anchorAt(self); // return 1; } } pub trait QTextEdit_anchorAt<RetType> { fn anchorAt(self , rsthis: & QTextEdit) -> RetType; } // proto: QString QTextEdit::anchorAt(const QPoint & pos); impl<'a> /*trait*/ QTextEdit_anchorAt<QString> for (&'a QPoint) { fn anchorAt(self , rsthis: & QTextEdit) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit8anchorAtERK6QPoint()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK9QTextEdit8anchorAtERK6QPoint(rsthis.qclsinst, arg0)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QTextEdit::cursorWidth(); impl /*struct*/ QTextEdit { pub fn cursorWidth<RetType, T: QTextEdit_cursorWidth<RetType>>(& self, overload_args: T) -> RetType { return overload_args.cursorWidth(self); // return 1; } } pub trait QTextEdit_cursorWidth<RetType> { fn cursorWidth(self , rsthis: & QTextEdit) -> RetType; } // proto: int QTextEdit::cursorWidth(); impl<'a> /*trait*/ QTextEdit_cursorWidth<i32> for () { fn cursorWidth(self , rsthis: & QTextEdit) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit11cursorWidthEv()}; let mut ret = unsafe {C_ZNK9QTextEdit11cursorWidthEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QTextEdit::setTextBackgroundColor(const QColor & c); impl /*struct*/ QTextEdit { pub fn setTextBackgroundColor<RetType, T: QTextEdit_setTextBackgroundColor<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setTextBackgroundColor(self); // return 1; } } pub trait QTextEdit_setTextBackgroundColor<RetType> { fn setTextBackgroundColor(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setTextBackgroundColor(const QColor & c); impl<'a> /*trait*/ QTextEdit_setTextBackgroundColor<()> for (&'a QColor) { fn setTextBackgroundColor(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit22setTextBackgroundColorERK6QColor()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit22setTextBackgroundColorERK6QColor(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int QTextEdit::tabStopWidth(); impl /*struct*/ QTextEdit { pub fn tabStopWidth<RetType, T: QTextEdit_tabStopWidth<RetType>>(& self, overload_args: T) -> RetType { return overload_args.tabStopWidth(self); // return 1; } } pub trait QTextEdit_tabStopWidth<RetType> { fn tabStopWidth(self , rsthis: & QTextEdit) -> RetType; } // proto: int QTextEdit::tabStopWidth(); impl<'a> /*trait*/ QTextEdit_tabStopWidth<i32> for () { fn tabStopWidth(self , rsthis: & QTextEdit) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit12tabStopWidthEv()}; let mut ret = unsafe {C_ZNK9QTextEdit12tabStopWidthEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QTextEdit::setFontWeight(int w); impl /*struct*/ QTextEdit { pub fn setFontWeight<RetType, T: QTextEdit_setFontWeight<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setFontWeight(self); // return 1; } } pub trait QTextEdit_setFontWeight<RetType> { fn setFontWeight(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setFontWeight(int w); impl<'a> /*trait*/ QTextEdit_setFontWeight<()> for (i32) { fn setFontWeight(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit13setFontWeightEi()}; let arg0 = self as c_int; unsafe {C_ZN9QTextEdit13setFontWeightEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QTextEdit::selectAll(); impl /*struct*/ QTextEdit { pub fn selectAll<RetType, T: QTextEdit_selectAll<RetType>>(& self, overload_args: T) -> RetType { return overload_args.selectAll(self); // return 1; } } pub trait QTextEdit_selectAll<RetType> { fn selectAll(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::selectAll(); impl<'a> /*trait*/ QTextEdit_selectAll<()> for () { fn selectAll(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit9selectAllEv()}; unsafe {C_ZN9QTextEdit9selectAllEv(rsthis.qclsinst)}; // return 1; } } // proto: void QTextEdit::zoomOut(int range); impl /*struct*/ QTextEdit { pub fn zoomOut<RetType, T: QTextEdit_zoomOut<RetType>>(& self, overload_args: T) -> RetType { return overload_args.zoomOut(self); // return 1; } } pub trait QTextEdit_zoomOut<RetType> { fn zoomOut(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::zoomOut(int range); impl<'a> /*trait*/ QTextEdit_zoomOut<()> for (Option<i32>) { fn zoomOut(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit7zoomOutEi()}; let arg0 = (if self.is_none() {1} else {self.unwrap()}) as c_int; unsafe {C_ZN9QTextEdit7zoomOutEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QTextEdit::redo(); impl /*struct*/ QTextEdit { pub fn redo<RetType, T: QTextEdit_redo<RetType>>(& self, overload_args: T) -> RetType { return overload_args.redo(self); // return 1; } } pub trait QTextEdit_redo<RetType> { fn redo(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::redo(); impl<'a> /*trait*/ QTextEdit_redo<()> for () { fn redo(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit4redoEv()}; unsafe {C_ZN9QTextEdit4redoEv(rsthis.qclsinst)}; // return 1; } } // proto: void QTextEdit::setFontPointSize(qreal s); impl /*struct*/ QTextEdit { pub fn setFontPointSize<RetType, T: QTextEdit_setFontPointSize<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setFontPointSize(self); // return 1; } } pub trait QTextEdit_setFontPointSize<RetType> { fn setFontPointSize(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setFontPointSize(qreal s); impl<'a> /*trait*/ QTextEdit_setFontPointSize<()> for (f64) { fn setFontPointSize(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit16setFontPointSizeEd()}; let arg0 = self as c_double; unsafe {C_ZN9QTextEdit16setFontPointSizeEd(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QTextEdit::overwriteMode(); impl /*struct*/ QTextEdit { pub fn overwriteMode<RetType, T: QTextEdit_overwriteMode<RetType>>(& self, overload_args: T) -> RetType { return overload_args.overwriteMode(self); // return 1; } } pub trait QTextEdit_overwriteMode<RetType> { fn overwriteMode(self , rsthis: & QTextEdit) -> RetType; } // proto: bool QTextEdit::overwriteMode(); impl<'a> /*trait*/ QTextEdit_overwriteMode<i8> for () { fn overwriteMode(self , rsthis: & QTextEdit) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit13overwriteModeEv()}; let mut ret = unsafe {C_ZNK9QTextEdit13overwriteModeEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QTextCursor QTextEdit::textCursor(); impl /*struct*/ QTextEdit { pub fn textCursor<RetType, T: QTextEdit_textCursor<RetType>>(& self, overload_args: T) -> RetType { return overload_args.textCursor(self); // return 1; } } pub trait QTextEdit_textCursor<RetType> { fn textCursor(self , rsthis: & QTextEdit) -> RetType; } // proto: QTextCursor QTextEdit::textCursor(); impl<'a> /*trait*/ QTextEdit_textCursor<QTextCursor> for () { fn textCursor(self , rsthis: & QTextEdit) -> QTextCursor { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit10textCursorEv()}; let mut ret = unsafe {C_ZNK9QTextEdit10textCursorEv(rsthis.qclsinst)}; let mut ret1 = QTextCursor::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QTextEdit::mergeCurrentCharFormat(const QTextCharFormat & modifier); impl /*struct*/ QTextEdit { pub fn mergeCurrentCharFormat<RetType, T: QTextEdit_mergeCurrentCharFormat<RetType>>(& self, overload_args: T) -> RetType { return overload_args.mergeCurrentCharFormat(self); // return 1; } } pub trait QTextEdit_mergeCurrentCharFormat<RetType> { fn mergeCurrentCharFormat(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::mergeCurrentCharFormat(const QTextCharFormat & modifier); impl<'a> /*trait*/ QTextEdit_mergeCurrentCharFormat<()> for (&'a QTextCharFormat) { fn mergeCurrentCharFormat(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit22mergeCurrentCharFormatERK15QTextCharFormat()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit22mergeCurrentCharFormatERK15QTextCharFormat(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QTextEdit::setPlainText(const QString & text); impl /*struct*/ QTextEdit { pub fn setPlainText<RetType, T: QTextEdit_setPlainText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setPlainText(self); // return 1; } } pub trait QTextEdit_setPlainText<RetType> { fn setPlainText(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setPlainText(const QString & text); impl<'a> /*trait*/ QTextEdit_setPlainText<()> for (&'a QString) { fn setPlainText(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit12setPlainTextERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit12setPlainTextERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QString QTextEdit::placeholderText(); impl /*struct*/ QTextEdit { pub fn placeholderText<RetType, T: QTextEdit_placeholderText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.placeholderText(self); // return 1; } } pub trait QTextEdit_placeholderText<RetType> { fn placeholderText(self , rsthis: & QTextEdit) -> RetType; } // proto: QString QTextEdit::placeholderText(); impl<'a> /*trait*/ QTextEdit_placeholderText<QString> for () { fn placeholderText(self , rsthis: & QTextEdit) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit15placeholderTextEv()}; let mut ret = unsafe {C_ZNK9QTextEdit15placeholderTextEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QTextEdit::~QTextEdit(); impl /*struct*/ QTextEdit { pub fn free<RetType, T: QTextEdit_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QTextEdit_free<RetType> { fn free(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::~QTextEdit(); impl<'a> /*trait*/ QTextEdit_free<()> for () { fn free(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEditD2Ev()}; unsafe {C_ZN9QTextEditD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: bool QTextEdit::fontItalic(); impl /*struct*/ QTextEdit { pub fn fontItalic<RetType, T: QTextEdit_fontItalic<RetType>>(& self, overload_args: T) -> RetType { return overload_args.fontItalic(self); // return 1; } } pub trait QTextEdit_fontItalic<RetType> { fn fontItalic(self , rsthis: & QTextEdit) -> RetType; } // proto: bool QTextEdit::fontItalic(); impl<'a> /*trait*/ QTextEdit_fontItalic<i8> for () { fn fontItalic(self , rsthis: & QTextEdit) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit10fontItalicEv()}; let mut ret = unsafe {C_ZNK9QTextEdit10fontItalicEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QTextEdit::copy(); impl /*struct*/ QTextEdit { pub fn copy<RetType, T: QTextEdit_copy<RetType>>(& self, overload_args: T) -> RetType { return overload_args.copy(self); // return 1; } } pub trait QTextEdit_copy<RetType> { fn copy(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::copy(); impl<'a> /*trait*/ QTextEdit_copy<()> for () { fn copy(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit4copyEv()}; unsafe {C_ZN9QTextEdit4copyEv(rsthis.qclsinst)}; // return 1; } } // proto: qreal QTextEdit::fontPointSize(); impl /*struct*/ QTextEdit { pub fn fontPointSize<RetType, T: QTextEdit_fontPointSize<RetType>>(& self, overload_args: T) -> RetType { return overload_args.fontPointSize(self); // return 1; } } pub trait QTextEdit_fontPointSize<RetType> { fn fontPointSize(self , rsthis: & QTextEdit) -> RetType; } // proto: qreal QTextEdit::fontPointSize(); impl<'a> /*trait*/ QTextEdit_fontPointSize<f64> for () { fn fontPointSize(self , rsthis: & QTextEdit) -> f64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit13fontPointSizeEv()}; let mut ret = unsafe {C_ZNK9QTextEdit13fontPointSizeEv(rsthis.qclsinst)}; return ret as f64; // 1 // return 1; } } // proto: void QTextEdit::setDocument(QTextDocument * document); impl /*struct*/ QTextEdit { pub fn setDocument<RetType, T: QTextEdit_setDocument<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setDocument(self); // return 1; } } pub trait QTextEdit_setDocument<RetType> { fn setDocument(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setDocument(QTextDocument * document); impl<'a> /*trait*/ QTextEdit_setDocument<()> for (&'a QTextDocument) { fn setDocument(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit11setDocumentEP13QTextDocument()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit11setDocumentEP13QTextDocument(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QTextEdit::setOverwriteMode(bool overwrite); impl /*struct*/ QTextEdit { pub fn setOverwriteMode<RetType, T: QTextEdit_setOverwriteMode<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setOverwriteMode(self); // return 1; } } pub trait QTextEdit_setOverwriteMode<RetType> { fn setOverwriteMode(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setOverwriteMode(bool overwrite); impl<'a> /*trait*/ QTextEdit_setOverwriteMode<()> for (i8) { fn setOverwriteMode(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit16setOverwriteModeEb()}; let arg0 = self as c_char; unsafe {C_ZN9QTextEdit16setOverwriteModeEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QTextEdit::undo(); impl /*struct*/ QTextEdit { pub fn undo<RetType, T: QTextEdit_undo<RetType>>(& self, overload_args: T) -> RetType { return overload_args.undo(self); // return 1; } } pub trait QTextEdit_undo<RetType> { fn undo(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::undo(); impl<'a> /*trait*/ QTextEdit_undo<()> for () { fn undo(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit4undoEv()}; unsafe {C_ZN9QTextEdit4undoEv(rsthis.qclsinst)}; // return 1; } } // proto: void QTextEdit::zoomIn(int range); impl /*struct*/ QTextEdit { pub fn zoomIn<RetType, T: QTextEdit_zoomIn<RetType>>(& self, overload_args: T) -> RetType { return overload_args.zoomIn(self); // return 1; } } pub trait QTextEdit_zoomIn<RetType> { fn zoomIn(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::zoomIn(int range); impl<'a> /*trait*/ QTextEdit_zoomIn<()> for (Option<i32>) { fn zoomIn(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit6zoomInEi()}; let arg0 = (if self.is_none() {1} else {self.unwrap()}) as c_int; unsafe {C_ZN9QTextEdit6zoomInEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QTextEdit::setDocumentTitle(const QString & title); impl /*struct*/ QTextEdit { pub fn setDocumentTitle<RetType, T: QTextEdit_setDocumentTitle<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setDocumentTitle(self); // return 1; } } pub trait QTextEdit_setDocumentTitle<RetType> { fn setDocumentTitle(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setDocumentTitle(const QString & title); impl<'a> /*trait*/ QTextEdit_setDocumentTitle<()> for (&'a QString) { fn setDocumentTitle(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit16setDocumentTitleERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit16setDocumentTitleERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QTextEdit::canPaste(); impl /*struct*/ QTextEdit { pub fn canPaste<RetType, T: QTextEdit_canPaste<RetType>>(& self, overload_args: T) -> RetType { return overload_args.canPaste(self); // return 1; } } pub trait QTextEdit_canPaste<RetType> { fn canPaste(self , rsthis: & QTextEdit) -> RetType; } // proto: bool QTextEdit::canPaste(); impl<'a> /*trait*/ QTextEdit_canPaste<i8> for () { fn canPaste(self , rsthis: & QTextEdit) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit8canPasteEv()}; let mut ret = unsafe {C_ZNK9QTextEdit8canPasteEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QString QTextEdit::toHtml(); impl /*struct*/ QTextEdit { pub fn toHtml<RetType, T: QTextEdit_toHtml<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toHtml(self); // return 1; } } pub trait QTextEdit_toHtml<RetType> { fn toHtml(self , rsthis: & QTextEdit) -> RetType; } // proto: QString QTextEdit::toHtml(); impl<'a> /*trait*/ QTextEdit_toHtml<QString> for () { fn toHtml(self , rsthis: & QTextEdit) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit6toHtmlEv()}; let mut ret = unsafe {C_ZNK9QTextEdit6toHtmlEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QMenu * QTextEdit::createStandardContextMenu(const QPoint & position); impl<'a> /*trait*/ QTextEdit_createStandardContextMenu<QMenu> for (&'a QPoint) { fn createStandardContextMenu(self , rsthis: & QTextEdit) -> QMenu { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit25createStandardContextMenuERK6QPoint()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN9QTextEdit25createStandardContextMenuERK6QPoint(rsthis.qclsinst, arg0)}; let mut ret1 = QMenu::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QTextEdit::setTabStopWidth(int width); impl /*struct*/ QTextEdit { pub fn setTabStopWidth<RetType, T: QTextEdit_setTabStopWidth<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setTabStopWidth(self); // return 1; } } pub trait QTextEdit_setTabStopWidth<RetType> { fn setTabStopWidth(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setTabStopWidth(int width); impl<'a> /*trait*/ QTextEdit_setTabStopWidth<()> for (i32) { fn setTabStopWidth(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit15setTabStopWidthEi()}; let arg0 = self as c_int; unsafe {C_ZN9QTextEdit15setTabStopWidthEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QString QTextEdit::documentTitle(); impl /*struct*/ QTextEdit { pub fn documentTitle<RetType, T: QTextEdit_documentTitle<RetType>>(& self, overload_args: T) -> RetType { return overload_args.documentTitle(self); // return 1; } } pub trait QTextEdit_documentTitle<RetType> { fn documentTitle(self , rsthis: & QTextEdit) -> RetType; } // proto: QString QTextEdit::documentTitle(); impl<'a> /*trait*/ QTextEdit_documentTitle<QString> for () { fn documentTitle(self , rsthis: & QTextEdit) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit13documentTitleEv()}; let mut ret = unsafe {C_ZNK9QTextEdit13documentTitleEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QTextEdit::isUndoRedoEnabled(); impl /*struct*/ QTextEdit { pub fn isUndoRedoEnabled<RetType, T: QTextEdit_isUndoRedoEnabled<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isUndoRedoEnabled(self); // return 1; } } pub trait QTextEdit_isUndoRedoEnabled<RetType> { fn isUndoRedoEnabled(self , rsthis: & QTextEdit) -> RetType; } // proto: bool QTextEdit::isUndoRedoEnabled(); impl<'a> /*trait*/ QTextEdit_isUndoRedoEnabled<i8> for () { fn isUndoRedoEnabled(self , rsthis: & QTextEdit) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit17isUndoRedoEnabledEv()}; let mut ret = unsafe {C_ZNK9QTextEdit17isUndoRedoEnabledEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QTextEdit::setText(const QString & text); impl /*struct*/ QTextEdit { pub fn setText<RetType, T: QTextEdit_setText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setText(self); // return 1; } } pub trait QTextEdit_setText<RetType> { fn setText(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setText(const QString & text); impl<'a> /*trait*/ QTextEdit_setText<()> for (&'a QString) { fn setText(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit7setTextERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit7setTextERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QTextEdit::ensureCursorVisible(); impl /*struct*/ QTextEdit { pub fn ensureCursorVisible<RetType, T: QTextEdit_ensureCursorVisible<RetType>>(& self, overload_args: T) -> RetType { return overload_args.ensureCursorVisible(self); // return 1; } } pub trait QTextEdit_ensureCursorVisible<RetType> { fn ensureCursorVisible(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::ensureCursorVisible(); impl<'a> /*trait*/ QTextEdit_ensureCursorVisible<()> for () { fn ensureCursorVisible(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit19ensureCursorVisibleEv()}; unsafe {C_ZN9QTextEdit19ensureCursorVisibleEv(rsthis.qclsinst)}; // return 1; } } // proto: void QTextEdit::setAcceptRichText(bool accept); impl /*struct*/ QTextEdit { pub fn setAcceptRichText<RetType, T: QTextEdit_setAcceptRichText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setAcceptRichText(self); // return 1; } } pub trait QTextEdit_setAcceptRichText<RetType> { fn setAcceptRichText(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setAcceptRichText(bool accept); impl<'a> /*trait*/ QTextEdit_setAcceptRichText<()> for (i8) { fn setAcceptRichText(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit17setAcceptRichTextEb()}; let arg0 = self as c_char; unsafe {C_ZN9QTextEdit17setAcceptRichTextEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QTextEdit::setPlaceholderText(const QString & placeholderText); impl /*struct*/ QTextEdit { pub fn setPlaceholderText<RetType, T: QTextEdit_setPlaceholderText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setPlaceholderText(self); // return 1; } } pub trait QTextEdit_setPlaceholderText<RetType> { fn setPlaceholderText(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setPlaceholderText(const QString & placeholderText); impl<'a> /*trait*/ QTextEdit_setPlaceholderText<()> for (&'a QString) { fn setPlaceholderText(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit18setPlaceholderTextERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit18setPlaceholderTextERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QTextEdit::isReadOnly(); impl /*struct*/ QTextEdit { pub fn isReadOnly<RetType, T: QTextEdit_isReadOnly<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isReadOnly(self); // return 1; } } pub trait QTextEdit_isReadOnly<RetType> { fn isReadOnly(self , rsthis: & QTextEdit) -> RetType; } // proto: bool QTextEdit::isReadOnly(); impl<'a> /*trait*/ QTextEdit_isReadOnly<i8> for () { fn isReadOnly(self , rsthis: & QTextEdit) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit10isReadOnlyEv()}; let mut ret = unsafe {C_ZNK9QTextEdit10isReadOnlyEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QTextEdit::setUndoRedoEnabled(bool enable); impl /*struct*/ QTextEdit { pub fn setUndoRedoEnabled<RetType, T: QTextEdit_setUndoRedoEnabled<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setUndoRedoEnabled(self); // return 1; } } pub trait QTextEdit_setUndoRedoEnabled<RetType> { fn setUndoRedoEnabled(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setUndoRedoEnabled(bool enable); impl<'a> /*trait*/ QTextEdit_setUndoRedoEnabled<()> for (i8) { fn setUndoRedoEnabled(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit18setUndoRedoEnabledEb()}; let arg0 = self as c_char; unsafe {C_ZN9QTextEdit18setUndoRedoEnabledEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QTextCharFormat QTextEdit::currentCharFormat(); impl /*struct*/ QTextEdit { pub fn currentCharFormat<RetType, T: QTextEdit_currentCharFormat<RetType>>(& self, overload_args: T) -> RetType { return overload_args.currentCharFormat(self); // return 1; } } pub trait QTextEdit_currentCharFormat<RetType> { fn currentCharFormat(self , rsthis: & QTextEdit) -> RetType; } // proto: QTextCharFormat QTextEdit::currentCharFormat(); impl<'a> /*trait*/ QTextEdit_currentCharFormat<QTextCharFormat> for () { fn currentCharFormat(self , rsthis: & QTextEdit) -> QTextCharFormat { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit17currentCharFormatEv()}; let mut ret = unsafe {C_ZNK9QTextEdit17currentCharFormatEv(rsthis.qclsinst)}; let mut ret1 = QTextCharFormat::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QTextCursor QTextEdit::cursorForPosition(const QPoint & pos); impl /*struct*/ QTextEdit { pub fn cursorForPosition<RetType, T: QTextEdit_cursorForPosition<RetType>>(& self, overload_args: T) -> RetType { return overload_args.cursorForPosition(self); // return 1; } } pub trait QTextEdit_cursorForPosition<RetType> { fn cursorForPosition(self , rsthis: & QTextEdit) -> RetType; } // proto: QTextCursor QTextEdit::cursorForPosition(const QPoint & pos); impl<'a> /*trait*/ QTextEdit_cursorForPosition<QTextCursor> for (&'a QPoint) { fn cursorForPosition(self , rsthis: & QTextEdit) -> QTextCursor { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit17cursorForPositionERK6QPoint()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK9QTextEdit17cursorForPositionERK6QPoint(rsthis.qclsinst, arg0)}; let mut ret1 = QTextCursor::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QTextEdit::scrollToAnchor(const QString & name); impl /*struct*/ QTextEdit { pub fn scrollToAnchor<RetType, T: QTextEdit_scrollToAnchor<RetType>>(& self, overload_args: T) -> RetType { return overload_args.scrollToAnchor(self); // return 1; } } pub trait QTextEdit_scrollToAnchor<RetType> { fn scrollToAnchor(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::scrollToAnchor(const QString & name); impl<'a> /*trait*/ QTextEdit_scrollToAnchor<()> for (&'a QString) { fn scrollToAnchor(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit14scrollToAnchorERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit14scrollToAnchorERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QFont QTextEdit::currentFont(); impl /*struct*/ QTextEdit { pub fn currentFont<RetType, T: QTextEdit_currentFont<RetType>>(& self, overload_args: T) -> RetType { return overload_args.currentFont(self); // return 1; } } pub trait QTextEdit_currentFont<RetType> { fn currentFont(self , rsthis: & QTextEdit) -> RetType; } // proto: QFont QTextEdit::currentFont(); impl<'a> /*trait*/ QTextEdit_currentFont<QFont> for () { fn currentFont(self , rsthis: & QTextEdit) -> QFont { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit11currentFontEv()}; let mut ret = unsafe {C_ZNK9QTextEdit11currentFontEv(rsthis.qclsinst)}; let mut ret1 = QFont::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QTextEdit::paste(); impl /*struct*/ QTextEdit { pub fn paste<RetType, T: QTextEdit_paste<RetType>>(& self, overload_args: T) -> RetType { return overload_args.paste(self); // return 1; } } pub trait QTextEdit_paste<RetType> { fn paste(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::paste(); impl<'a> /*trait*/ QTextEdit_paste<()> for () { fn paste(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit5pasteEv()}; unsafe {C_ZN9QTextEdit5pasteEv(rsthis.qclsinst)}; // return 1; } } // proto: void QTextEdit::setTextCursor(const QTextCursor & cursor); impl /*struct*/ QTextEdit { pub fn setTextCursor<RetType, T: QTextEdit_setTextCursor<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setTextCursor(self); // return 1; } } pub trait QTextEdit_setTextCursor<RetType> { fn setTextCursor(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setTextCursor(const QTextCursor & cursor); impl<'a> /*trait*/ QTextEdit_setTextCursor<()> for (&'a QTextCursor) { fn setTextCursor(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit13setTextCursorERK11QTextCursor()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit13setTextCursorERK11QTextCursor(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QTextEdit::setCurrentCharFormat(const QTextCharFormat & format); impl /*struct*/ QTextEdit { pub fn setCurrentCharFormat<RetType, T: QTextEdit_setCurrentCharFormat<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setCurrentCharFormat(self); // return 1; } } pub trait QTextEdit_setCurrentCharFormat<RetType> { fn setCurrentCharFormat(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setCurrentCharFormat(const QTextCharFormat & format); impl<'a> /*trait*/ QTextEdit_setCurrentCharFormat<()> for (&'a QTextCharFormat) { fn setCurrentCharFormat(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit20setCurrentCharFormatERK15QTextCharFormat()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit20setCurrentCharFormatERK15QTextCharFormat(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QVariant QTextEdit::loadResource(int type, const QUrl & name); impl /*struct*/ QTextEdit { pub fn loadResource<RetType, T: QTextEdit_loadResource<RetType>>(& self, overload_args: T) -> RetType { return overload_args.loadResource(self); // return 1; } } pub trait QTextEdit_loadResource<RetType> { fn loadResource(self , rsthis: & QTextEdit) -> RetType; } // proto: QVariant QTextEdit::loadResource(int type, const QUrl & name); impl<'a> /*trait*/ QTextEdit_loadResource<QVariant> for (i32, &'a QUrl) { fn loadResource(self , rsthis: & QTextEdit) -> QVariant { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit12loadResourceEiRK4QUrl()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN9QTextEdit12loadResourceEiRK4QUrl(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QVariant::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QTextEdit::setTabChangesFocus(bool b); impl /*struct*/ QTextEdit { pub fn setTabChangesFocus<RetType, T: QTextEdit_setTabChangesFocus<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setTabChangesFocus(self); // return 1; } } pub trait QTextEdit_setTabChangesFocus<RetType> { fn setTabChangesFocus(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setTabChangesFocus(bool b); impl<'a> /*trait*/ QTextEdit_setTabChangesFocus<()> for (i8) { fn setTabChangesFocus(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit18setTabChangesFocusEb()}; let arg0 = self as c_char; unsafe {C_ZN9QTextEdit18setTabChangesFocusEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QTextEdit::setHtml(const QString & text); impl /*struct*/ QTextEdit { pub fn setHtml<RetType, T: QTextEdit_setHtml<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setHtml(self); // return 1; } } pub trait QTextEdit_setHtml<RetType> { fn setHtml(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setHtml(const QString & text); impl<'a> /*trait*/ QTextEdit_setHtml<()> for (&'a QString) { fn setHtml(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit7setHtmlERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit7setHtmlERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QRect QTextEdit::cursorRect(const QTextCursor & cursor); impl<'a> /*trait*/ QTextEdit_cursorRect<QRect> for (&'a QTextCursor) { fn cursorRect(self , rsthis: & QTextEdit) -> QRect { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit10cursorRectERK11QTextCursor()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK9QTextEdit10cursorRectERK11QTextCursor(rsthis.qclsinst, arg0)}; let mut ret1 = QRect::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QTextEdit::setLineWrapColumnOrWidth(int w); impl /*struct*/ QTextEdit { pub fn setLineWrapColumnOrWidth<RetType, T: QTextEdit_setLineWrapColumnOrWidth<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setLineWrapColumnOrWidth(self); // return 1; } } pub trait QTextEdit_setLineWrapColumnOrWidth<RetType> { fn setLineWrapColumnOrWidth(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setLineWrapColumnOrWidth(int w); impl<'a> /*trait*/ QTextEdit_setLineWrapColumnOrWidth<()> for (i32) { fn setLineWrapColumnOrWidth(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit24setLineWrapColumnOrWidthEi()}; let arg0 = self as c_int; unsafe {C_ZN9QTextEdit24setLineWrapColumnOrWidthEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QTextEdit::setFontItalic(bool b); impl /*struct*/ QTextEdit { pub fn setFontItalic<RetType, T: QTextEdit_setFontItalic<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setFontItalic(self); // return 1; } } pub trait QTextEdit_setFontItalic<RetType> { fn setFontItalic(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setFontItalic(bool b); impl<'a> /*trait*/ QTextEdit_setFontItalic<()> for (i8) { fn setFontItalic(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit13setFontItalicEb()}; let arg0 = self as c_char; unsafe {C_ZN9QTextEdit13setFontItalicEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: const QMetaObject * QTextEdit::metaObject(); impl /*struct*/ QTextEdit { pub fn metaObject<RetType, T: QTextEdit_metaObject<RetType>>(& self, overload_args: T) -> RetType { return overload_args.metaObject(self); // return 1; } } pub trait QTextEdit_metaObject<RetType> { fn metaObject(self , rsthis: & QTextEdit) -> RetType; } // proto: const QMetaObject * QTextEdit::metaObject(); impl<'a> /*trait*/ QTextEdit_metaObject<QMetaObject> for () { fn metaObject(self , rsthis: & QTextEdit) -> QMetaObject { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit10metaObjectEv()}; let mut ret = unsafe {C_ZNK9QTextEdit10metaObjectEv(rsthis.qclsinst)}; let mut ret1 = QMetaObject::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QTextEdit::setCurrentFont(const QFont & f); impl /*struct*/ QTextEdit { pub fn setCurrentFont<RetType, T: QTextEdit_setCurrentFont<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setCurrentFont(self); // return 1; } } pub trait QTextEdit_setCurrentFont<RetType> { fn setCurrentFont(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setCurrentFont(const QFont & f); impl<'a> /*trait*/ QTextEdit_setCurrentFont<()> for (&'a QFont) { fn setCurrentFont(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit14setCurrentFontERK5QFont()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit14setCurrentFontERK5QFont(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QTextEdit::tabChangesFocus(); impl /*struct*/ QTextEdit { pub fn tabChangesFocus<RetType, T: QTextEdit_tabChangesFocus<RetType>>(& self, overload_args: T) -> RetType { return overload_args.tabChangesFocus(self); // return 1; } } pub trait QTextEdit_tabChangesFocus<RetType> { fn tabChangesFocus(self , rsthis: & QTextEdit) -> RetType; } // proto: bool QTextEdit::tabChangesFocus(); impl<'a> /*trait*/ QTextEdit_tabChangesFocus<i8> for () { fn tabChangesFocus(self , rsthis: & QTextEdit) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit15tabChangesFocusEv()}; let mut ret = unsafe {C_ZNK9QTextEdit15tabChangesFocusEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QColor QTextEdit::textBackgroundColor(); impl /*struct*/ QTextEdit { pub fn textBackgroundColor<RetType, T: QTextEdit_textBackgroundColor<RetType>>(& self, overload_args: T) -> RetType { return overload_args.textBackgroundColor(self); // return 1; } } pub trait QTextEdit_textBackgroundColor<RetType> { fn textBackgroundColor(self , rsthis: & QTextEdit) -> RetType; } // proto: QColor QTextEdit::textBackgroundColor(); impl<'a> /*trait*/ QTextEdit_textBackgroundColor<QColor> for () { fn textBackgroundColor(self , rsthis: & QTextEdit) -> QColor { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit19textBackgroundColorEv()}; let mut ret = unsafe {C_ZNK9QTextEdit19textBackgroundColorEv(rsthis.qclsinst)}; let mut ret1 = QColor::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QTextEdit::QTextEdit(const QString & text, QWidget * parent); impl /*struct*/ QTextEdit { pub fn new<T: QTextEdit_new>(value: T) -> QTextEdit { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QTextEdit_new { fn new(self) -> QTextEdit; } // proto: void QTextEdit::QTextEdit(const QString & text, QWidget * parent); impl<'a> /*trait*/ QTextEdit_new for (&'a QString, Option<&'a QWidget>) { fn new(self) -> QTextEdit { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEditC2ERK7QStringP7QWidget()}; let ctysz: c_int = unsafe{QTextEdit_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 qthis: u64 = unsafe {C_ZN9QTextEditC2ERK7QStringP7QWidget(arg0, arg1)}; let rsthis = QTextEdit{qbase: QAbstractScrollArea::inheritFrom(qthis), qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QTextEdit::print(QPagedPaintDevice * printer); impl /*struct*/ QTextEdit { pub fn print<RetType, T: QTextEdit_print<RetType>>(& self, overload_args: T) -> RetType { return overload_args.print(self); // return 1; } } pub trait QTextEdit_print<RetType> { fn print(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::print(QPagedPaintDevice * printer); impl<'a> /*trait*/ QTextEdit_print<()> for (&'a QPagedPaintDevice) { fn print(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit5printEP17QPagedPaintDevice()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZNK9QTextEdit5printEP17QPagedPaintDevice(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QTextEdit::fontUnderline(); impl /*struct*/ QTextEdit { pub fn fontUnderline<RetType, T: QTextEdit_fontUnderline<RetType>>(& self, overload_args: T) -> RetType { return overload_args.fontUnderline(self); // return 1; } } pub trait QTextEdit_fontUnderline<RetType> { fn fontUnderline(self , rsthis: & QTextEdit) -> RetType; } // proto: bool QTextEdit::fontUnderline(); impl<'a> /*trait*/ QTextEdit_fontUnderline<i8> for () { fn fontUnderline(self , rsthis: & QTextEdit) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit13fontUnderlineEv()}; let mut ret = unsafe {C_ZNK9QTextEdit13fontUnderlineEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QTextEdit::insertPlainText(const QString & text); impl /*struct*/ QTextEdit { pub fn insertPlainText<RetType, T: QTextEdit_insertPlainText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.insertPlainText(self); // return 1; } } pub trait QTextEdit_insertPlainText<RetType> { fn insertPlainText(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::insertPlainText(const QString & text); impl<'a> /*trait*/ QTextEdit_insertPlainText<()> for (&'a QString) { fn insertPlainText(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit15insertPlainTextERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit15insertPlainTextERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int QTextEdit::fontWeight(); impl /*struct*/ QTextEdit { pub fn fontWeight<RetType, T: QTextEdit_fontWeight<RetType>>(& self, overload_args: T) -> RetType { return overload_args.fontWeight(self); // return 1; } } pub trait QTextEdit_fontWeight<RetType> { fn fontWeight(self , rsthis: & QTextEdit) -> RetType; } // proto: int QTextEdit::fontWeight(); impl<'a> /*trait*/ QTextEdit_fontWeight<i32> for () { fn fontWeight(self , rsthis: & QTextEdit) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit10fontWeightEv()}; let mut ret = unsafe {C_ZNK9QTextEdit10fontWeightEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: QColor QTextEdit::textColor(); impl /*struct*/ QTextEdit { pub fn textColor<RetType, T: QTextEdit_textColor<RetType>>(& self, overload_args: T) -> RetType { return overload_args.textColor(self); // return 1; } } pub trait QTextEdit_textColor<RetType> { fn textColor(self , rsthis: & QTextEdit) -> RetType; } // proto: QColor QTextEdit::textColor(); impl<'a> /*trait*/ QTextEdit_textColor<QColor> for () { fn textColor(self , rsthis: & QTextEdit) -> QColor { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK9QTextEdit9textColorEv()}; let mut ret = unsafe {C_ZNK9QTextEdit9textColorEv(rsthis.qclsinst)}; let mut ret1 = QColor::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QTextEdit::append(const QString & text); impl /*struct*/ QTextEdit { pub fn append<RetType, T: QTextEdit_append<RetType>>(& self, overload_args: T) -> RetType { return overload_args.append(self); // return 1; } } pub trait QTextEdit_append<RetType> { fn append(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::append(const QString & text); impl<'a> /*trait*/ QTextEdit_append<()> for (&'a QString) { fn append(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit6appendERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN9QTextEdit6appendERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QTextEdit::QTextEdit(QWidget * parent); impl<'a> /*trait*/ QTextEdit_new for (Option<&'a QWidget>) { fn new(self) -> QTextEdit { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEditC2EP7QWidget()}; let ctysz: c_int = unsafe{QTextEdit_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_ZN9QTextEditC2EP7QWidget(arg0)}; let rsthis = QTextEdit{qbase: QAbstractScrollArea::inheritFrom(qthis), qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QTextEdit::setReadOnly(bool ro); impl /*struct*/ QTextEdit { pub fn setReadOnly<RetType, T: QTextEdit_setReadOnly<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setReadOnly(self); // return 1; } } pub trait QTextEdit_setReadOnly<RetType> { fn setReadOnly(self , rsthis: & QTextEdit) -> RetType; } // proto: void QTextEdit::setReadOnly(bool ro); impl<'a> /*trait*/ QTextEdit_setReadOnly<()> for (i8) { fn setReadOnly(self , rsthis: & QTextEdit) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN9QTextEdit11setReadOnlyEb()}; let arg0 = self as c_char; unsafe {C_ZN9QTextEdit11setReadOnlyEb(rsthis.qclsinst, arg0)}; // return 1; } } #[derive(Default)] // for QTextEdit_cursorPositionChanged pub struct QTextEdit_cursorPositionChanged_signal{poi:u64} impl /* struct */ QTextEdit { pub fn cursorPositionChanged(&self) -> QTextEdit_cursorPositionChanged_signal { return QTextEdit_cursorPositionChanged_signal{poi:self.qclsinst}; } } impl /* struct */ QTextEdit_cursorPositionChanged_signal { pub fn connect<T: QTextEdit_cursorPositionChanged_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QTextEdit_cursorPositionChanged_signal_connect { fn connect(self, sigthis: QTextEdit_cursorPositionChanged_signal); } #[derive(Default)] // for QTextEdit_redoAvailable pub struct QTextEdit_redoAvailable_signal{poi:u64} impl /* struct */ QTextEdit { pub fn redoAvailable(&self) -> QTextEdit_redoAvailable_signal { return QTextEdit_redoAvailable_signal{poi:self.qclsinst}; } } impl /* struct */ QTextEdit_redoAvailable_signal { pub fn connect<T: QTextEdit_redoAvailable_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QTextEdit_redoAvailable_signal_connect { fn connect(self, sigthis: QTextEdit_redoAvailable_signal); } #[derive(Default)] // for QTextEdit_selectionChanged pub struct QTextEdit_selectionChanged_signal{poi:u64} impl /* struct */ QTextEdit { pub fn selectionChanged(&self) -> QTextEdit_selectionChanged_signal { return QTextEdit_selectionChanged_signal{poi:self.qclsinst}; } } impl /* struct */ QTextEdit_selectionChanged_signal { pub fn connect<T: QTextEdit_selectionChanged_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QTextEdit_selectionChanged_signal_connect { fn connect(self, sigthis: QTextEdit_selectionChanged_signal); } #[derive(Default)] // for QTextEdit_currentCharFormatChanged pub struct QTextEdit_currentCharFormatChanged_signal{poi:u64} impl /* struct */ QTextEdit { pub fn currentCharFormatChanged(&self) -> QTextEdit_currentCharFormatChanged_signal { return QTextEdit_currentCharFormatChanged_signal{poi:self.qclsinst}; } } impl /* struct */ QTextEdit_currentCharFormatChanged_signal { pub fn connect<T: QTextEdit_currentCharFormatChanged_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QTextEdit_currentCharFormatChanged_signal_connect { fn connect(self, sigthis: QTextEdit_currentCharFormatChanged_signal); } #[derive(Default)] // for QTextEdit_undoAvailable pub struct QTextEdit_undoAvailable_signal{poi:u64} impl /* struct */ QTextEdit { pub fn undoAvailable(&self) -> QTextEdit_undoAvailable_signal { return QTextEdit_undoAvailable_signal{poi:self.qclsinst}; } } impl /* struct */ QTextEdit_undoAvailable_signal { pub fn connect<T: QTextEdit_undoAvailable_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QTextEdit_undoAvailable_signal_connect { fn connect(self, sigthis: QTextEdit_undoAvailable_signal); } #[derive(Default)] // for QTextEdit_textChanged pub struct QTextEdit_textChanged_signal{poi:u64} impl /* struct */ QTextEdit { pub fn textChanged(&self) -> QTextEdit_textChanged_signal { return QTextEdit_textChanged_signal{poi:self.qclsinst}; } } impl /* struct */ QTextEdit_textChanged_signal { pub fn connect<T: QTextEdit_textChanged_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QTextEdit_textChanged_signal_connect { fn connect(self, sigthis: QTextEdit_textChanged_signal); } #[derive(Default)] // for QTextEdit_copyAvailable pub struct QTextEdit_copyAvailable_signal{poi:u64} impl /* struct */ QTextEdit { pub fn copyAvailable(&self) -> QTextEdit_copyAvailable_signal { return QTextEdit_copyAvailable_signal{poi:self.qclsinst}; } } impl /* struct */ QTextEdit_copyAvailable_signal { pub fn connect<T: QTextEdit_copyAvailable_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QTextEdit_copyAvailable_signal_connect { fn connect(self, sigthis: QTextEdit_copyAvailable_signal); } // undoAvailable(_Bool) extern fn QTextEdit_undoAvailable_signal_connect_cb_0(rsfptr:fn(i8), arg0: c_char) { println!("{}:{}", file!(), line!()); let rsarg0 = arg0 as i8; rsfptr(rsarg0); } extern fn QTextEdit_undoAvailable_signal_connect_cb_box_0(rsfptr_raw:*mut Box<Fn(i8)>, arg0: c_char) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = arg0 as i8; // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QTextEdit_undoAvailable_signal_connect for fn(i8) { fn connect(self, sigthis: QTextEdit_undoAvailable_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 = QTextEdit_undoAvailable_signal_connect_cb_0 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QTextEdit_SlotProxy_connect__ZN9QTextEdit13undoAvailableEb(arg0, arg1, arg2)}; } } impl /* trait */ QTextEdit_undoAvailable_signal_connect for Box<Fn(i8)> { fn connect(self, sigthis: QTextEdit_undoAvailable_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 = QTextEdit_undoAvailable_signal_connect_cb_box_0 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QTextEdit_SlotProxy_connect__ZN9QTextEdit13undoAvailableEb(arg0, arg1, arg2)}; } } // redoAvailable(_Bool) extern fn QTextEdit_redoAvailable_signal_connect_cb_1(rsfptr:fn(i8), arg0: c_char) { println!("{}:{}", file!(), line!()); let rsarg0 = arg0 as i8; rsfptr(rsarg0); } extern fn QTextEdit_redoAvailable_signal_connect_cb_box_1(rsfptr_raw:*mut Box<Fn(i8)>, arg0: c_char) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = arg0 as i8; // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QTextEdit_redoAvailable_signal_connect for fn(i8) { fn connect(self, sigthis: QTextEdit_redoAvailable_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 = QTextEdit_redoAvailable_signal_connect_cb_1 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QTextEdit_SlotProxy_connect__ZN9QTextEdit13redoAvailableEb(arg0, arg1, arg2)}; } } impl /* trait */ QTextEdit_redoAvailable_signal_connect for Box<Fn(i8)> { fn connect(self, sigthis: QTextEdit_redoAvailable_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 = QTextEdit_redoAvailable_signal_connect_cb_box_1 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QTextEdit_SlotProxy_connect__ZN9QTextEdit13redoAvailableEb(arg0, arg1, arg2)}; } } // copyAvailable(_Bool) extern fn QTextEdit_copyAvailable_signal_connect_cb_2(rsfptr:fn(i8), arg0: c_char) { println!("{}:{}", file!(), line!()); let rsarg0 = arg0 as i8; rsfptr(rsarg0); } extern fn QTextEdit_copyAvailable_signal_connect_cb_box_2(rsfptr_raw:*mut Box<Fn(i8)>, arg0: c_char) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = arg0 as i8; // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QTextEdit_copyAvailable_signal_connect for fn(i8) { fn connect(self, sigthis: QTextEdit_copyAvailable_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 = QTextEdit_copyAvailable_signal_connect_cb_2 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QTextEdit_SlotProxy_connect__ZN9QTextEdit13copyAvailableEb(arg0, arg1, arg2)}; } } impl /* trait */ QTextEdit_copyAvailable_signal_connect for Box<Fn(i8)> { fn connect(self, sigthis: QTextEdit_copyAvailable_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 = QTextEdit_copyAvailable_signal_connect_cb_box_2 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QTextEdit_SlotProxy_connect__ZN9QTextEdit13copyAvailableEb(arg0, arg1, arg2)}; } } // cursorPositionChanged() extern fn QTextEdit_cursorPositionChanged_signal_connect_cb_3(rsfptr:fn(), ) { println!("{}:{}", file!(), line!()); rsfptr(); } extern fn QTextEdit_cursorPositionChanged_signal_connect_cb_box_3(rsfptr_raw:*mut Box<Fn()>, ) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; // rsfptr(); unsafe{(*rsfptr_raw)()}; } impl /* trait */ QTextEdit_cursorPositionChanged_signal_connect for fn() { fn connect(self, sigthis: QTextEdit_cursorPositionChanged_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 = QTextEdit_cursorPositionChanged_signal_connect_cb_3 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QTextEdit_SlotProxy_connect__ZN9QTextEdit21cursorPositionChangedEv(arg0, arg1, arg2)}; } } impl /* trait */ QTextEdit_cursorPositionChanged_signal_connect for Box<Fn()> { fn connect(self, sigthis: QTextEdit_cursorPositionChanged_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 = QTextEdit_cursorPositionChanged_signal_connect_cb_box_3 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QTextEdit_SlotProxy_connect__ZN9QTextEdit21cursorPositionChangedEv(arg0, arg1, arg2)}; } } // selectionChanged() extern fn QTextEdit_selectionChanged_signal_connect_cb_4(rsfptr:fn(), ) { println!("{}:{}", file!(), line!()); rsfptr(); } extern fn QTextEdit_selectionChanged_signal_connect_cb_box_4(rsfptr_raw:*mut Box<Fn()>, ) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; // rsfptr(); unsafe{(*rsfptr_raw)()}; } impl /* trait */ QTextEdit_selectionChanged_signal_connect for fn() { fn connect(self, sigthis: QTextEdit_selectionChanged_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 = QTextEdit_selectionChanged_signal_connect_cb_4 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QTextEdit_SlotProxy_connect__ZN9QTextEdit16selectionChangedEv(arg0, arg1, arg2)}; } } impl /* trait */ QTextEdit_selectionChanged_signal_connect for Box<Fn()> { fn connect(self, sigthis: QTextEdit_selectionChanged_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 = QTextEdit_selectionChanged_signal_connect_cb_box_4 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QTextEdit_SlotProxy_connect__ZN9QTextEdit16selectionChangedEv(arg0, arg1, arg2)}; } } // currentCharFormatChanged(const class QTextCharFormat &) extern fn QTextEdit_currentCharFormatChanged_signal_connect_cb_5(rsfptr:fn(QTextCharFormat), arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsarg0 = QTextCharFormat::inheritFrom(arg0 as u64); rsfptr(rsarg0); } extern fn QTextEdit_currentCharFormatChanged_signal_connect_cb_box_5(rsfptr_raw:*mut Box<Fn(QTextCharFormat)>, arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = QTextCharFormat::inheritFrom(arg0 as u64); // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QTextEdit_currentCharFormatChanged_signal_connect for fn(QTextCharFormat) { fn connect(self, sigthis: QTextEdit_currentCharFormatChanged_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 = QTextEdit_currentCharFormatChanged_signal_connect_cb_5 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QTextEdit_SlotProxy_connect__ZN9QTextEdit24currentCharFormatChangedERK15QTextCharFormat(arg0, arg1, arg2)}; } } impl /* trait */ QTextEdit_currentCharFormatChanged_signal_connect for Box<Fn(QTextCharFormat)> { fn connect(self, sigthis: QTextEdit_currentCharFormatChanged_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 = QTextEdit_currentCharFormatChanged_signal_connect_cb_box_5 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QTextEdit_SlotProxy_connect__ZN9QTextEdit24currentCharFormatChangedERK15QTextCharFormat(arg0, arg1, arg2)}; } } // textChanged() extern fn QTextEdit_textChanged_signal_connect_cb_6(rsfptr:fn(), ) { println!("{}:{}", file!(), line!()); rsfptr(); } extern fn QTextEdit_textChanged_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 */ QTextEdit_textChanged_signal_connect for fn() { fn connect(self, sigthis: QTextEdit_textChanged_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 = QTextEdit_textChanged_signal_connect_cb_6 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QTextEdit_SlotProxy_connect__ZN9QTextEdit11textChangedEv(arg0, arg1, arg2)}; } } impl /* trait */ QTextEdit_textChanged_signal_connect for Box<Fn()> { fn connect(self, sigthis: QTextEdit_textChanged_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 = QTextEdit_textChanged_signal_connect_cb_box_6 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QTextEdit_SlotProxy_connect__ZN9QTextEdit11textChangedEv(arg0, arg1, arg2)}; } } // <= body block end
#[doc = "Reader of register CR2"] pub type R = crate::R<u32, super::CR2>; #[doc = "Writer for register CR2"] pub type W = crate::W<u32, super::CR2>; #[doc = "Register CR2 `reset()`'s with value 0"] impl crate::ResetValue for super::CR2 { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `TAMP1NOER`"] pub type TAMP1NOER_R = crate::R<bool, bool>; #[doc = "Write proxy for field `TAMP1NOER`"] pub struct TAMP1NOER_W<'a> { w: &'a mut W, } impl<'a> TAMP1NOER_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01); self.w } } #[doc = "Reader of field `TAMP2NOER`"] pub type TAMP2NOER_R = crate::R<bool, bool>; #[doc = "Write proxy for field `TAMP2NOER`"] pub struct TAMP2NOER_W<'a> { w: &'a mut W, } impl<'a> TAMP2NOER_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1); self.w } } #[doc = "Reader of field `TAMP1MSK`"] pub type TAMP1MSK_R = crate::R<bool, bool>; #[doc = "Write proxy for field `TAMP1MSK`"] pub struct TAMP1MSK_W<'a> { w: &'a mut W, } impl<'a> TAMP1MSK_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 16)) | (((value as u32) & 0x01) << 16); self.w } } #[doc = "Reader of field `TAMP2MSK`"] pub type TAMP2MSK_R = crate::R<bool, bool>; #[doc = "Write proxy for field `TAMP2MSK`"] pub struct TAMP2MSK_W<'a> { w: &'a mut W, } impl<'a> TAMP2MSK_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 17)) | (((value as u32) & 0x01) << 17); self.w } } #[doc = "Reader of field `TAMP1TRG`"] pub type TAMP1TRG_R = crate::R<bool, bool>; #[doc = "Write proxy for field `TAMP1TRG`"] pub struct TAMP1TRG_W<'a> { w: &'a mut W, } impl<'a> TAMP1TRG_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 24)) | (((value as u32) & 0x01) << 24); self.w } } #[doc = "Reader of field `TAMP2TRG`"] pub type TAMP2TRG_R = crate::R<bool, bool>; #[doc = "Write proxy for field `TAMP2TRG`"] pub struct TAMP2TRG_W<'a> { w: &'a mut W, } impl<'a> TAMP2TRG_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 25)) | (((value as u32) & 0x01) << 25); self.w } } impl R { #[doc = "Bit 0 - TAMP1NOER"] #[inline(always)] pub fn tamp1noer(&self) -> TAMP1NOER_R { TAMP1NOER_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - TAMP2NOER"] #[inline(always)] pub fn tamp2noer(&self) -> TAMP2NOER_R { TAMP2NOER_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 16 - TAMP1MSK"] #[inline(always)] pub fn tamp1msk(&self) -> TAMP1MSK_R { TAMP1MSK_R::new(((self.bits >> 16) & 0x01) != 0) } #[doc = "Bit 17 - TAMP2MSK"] #[inline(always)] pub fn tamp2msk(&self) -> TAMP2MSK_R { TAMP2MSK_R::new(((self.bits >> 17) & 0x01) != 0) } #[doc = "Bit 24 - TAMP1TRG"] #[inline(always)] pub fn tamp1trg(&self) -> TAMP1TRG_R { TAMP1TRG_R::new(((self.bits >> 24) & 0x01) != 0) } #[doc = "Bit 25 - TAMP2TRG"] #[inline(always)] pub fn tamp2trg(&self) -> TAMP2TRG_R { TAMP2TRG_R::new(((self.bits >> 25) & 0x01) != 0) } } impl W { #[doc = "Bit 0 - TAMP1NOER"] #[inline(always)] pub fn tamp1noer(&mut self) -> TAMP1NOER_W { TAMP1NOER_W { w: self } } #[doc = "Bit 1 - TAMP2NOER"] #[inline(always)] pub fn tamp2noer(&mut self) -> TAMP2NOER_W { TAMP2NOER_W { w: self } } #[doc = "Bit 16 - TAMP1MSK"] #[inline(always)] pub fn tamp1msk(&mut self) -> TAMP1MSK_W { TAMP1MSK_W { w: self } } #[doc = "Bit 17 - TAMP2MSK"] #[inline(always)] pub fn tamp2msk(&mut self) -> TAMP2MSK_W { TAMP2MSK_W { w: self } } #[doc = "Bit 24 - TAMP1TRG"] #[inline(always)] pub fn tamp1trg(&mut self) -> TAMP1TRG_W { TAMP1TRG_W { w: self } } #[doc = "Bit 25 - TAMP2TRG"] #[inline(always)] pub fn tamp2trg(&mut self) -> TAMP2TRG_W { TAMP2TRG_W { w: self } } }
use object::{ProcessRef}; use nabi::{Result, Error}; use nebulet_derive::nebulet_abi; #[nebulet_abi] pub fn physical_map(phys_address: u64, count: u32, process: &ProcessRef) -> Result<u32> { let mut instance = process.instance().write(); let memory = &mut instance.memories[0]; memory.physical_map(phys_address, count as usize) .map(|addr| addr as u32) }
use diesel::{self, prelude::*}; use rocket_contrib::json::Json; use crate::niveis_ensino_model::{InsertableNiveisEnsino, NiveisEnsino, UpdatableNiveisEnsino}; use crate::schema; use crate::DbConn; #[post("/niveis_ensino", data = "<niveis_ensino>")] pub fn create_niveis_ensino( conn: DbConn, niveis_ensino: Json<InsertableNiveisEnsino>, ) -> Result<String, String> { let inserted_rows = diesel::insert_into(schema::niveis_ensino::table) .values(&niveis_ensino.0) .execute(&conn.0) .map_err(|err| -> String { println!("Error inserting row: {:?}", err); "Error inserting row into database".into() })?; Ok(format!("Inserted {} row(s).", inserted_rows)) } #[get("/niveis_ensino")] pub fn read_niveis_ensino(conn: DbConn) -> Result<Json<Vec<NiveisEnsino>>, String> { use crate::schema::niveis_ensino::dsl::*; niveis_ensino .load(&conn.0) .map_err(|err| -> String { println!("Error querying page views: {:?}", err); "Error querying page views from the database".into() }) .map(Json) } #[get("/niveis_ensino/<id>")] pub fn read_niveis_ensino_unique(id: i32, conn: DbConn) -> Result<Json<Vec<NiveisEnsino>>, String> { schema::niveis_ensino::table .find(id) .load(&conn.0) .map_err(|err| -> String { println!("Error querying niveis_ensino: {:?}", err); "Error querying niveis_ensino from the database".into() }) .map(Json) } #[put("/niveis_ensino/<id>", data = "<niveis_ensino>")] pub fn update_niveis_ensino( id: i32, conn: DbConn, niveis_ensino: Json<UpdatableNiveisEnsino>, ) -> Result<String, String> { let inserted_rows = diesel::update(schema::niveis_ensino::table.find(id)) .set(&niveis_ensino.0) .execute(&conn.0) .map_err(|err| -> String { println!("Error updating row: {:?}", err); "Error updating row into database".into() })?; Ok(format!("Updated {} row(s).", inserted_rows)) } #[delete("/niveis_ensino/<id>")] pub fn delete_niveis_ensino(id: i32, conn: DbConn) -> Result<String, String> { let deleted_rows = diesel::delete(schema::niveis_ensino::table.find(id)) .execute(&conn.0) .map_err(|err| -> String { println!("Error deleting row: {:?}", err); "Error deleting row into database".into() })?; Ok(format!("Deleted {} row(s).", deleted_rows)) }
//! Elliptic Curve Digital Signature Algorithm //! //! <https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm> pub mod p256; pub mod p384; mod signing_key; mod verifying_key; pub use self::{signing_key::SigningKey, verifying_key::VerifyingKey}; pub use ::ecdsa::{der, elliptic_curve::PrimeCurve, Signature}; use ring::signature::{EcdsaSigningAlgorithm, EcdsaVerificationAlgorithm}; /// Trait for associating a *ring* [`EcdsaSigningAlgorithm`] with an /// elliptic curve pub trait CurveAlg: PrimeCurve { /// *ring* signing algorithm fn signing_alg() -> &'static EcdsaSigningAlgorithm; /// *ring* verify algorithm fn verify_alg() -> &'static EcdsaVerificationAlgorithm; }
//! # Rhusics physics library //! //! A physics library. //! Uses [`cgmath`](https://github.com/brendanzab/cgmath/) for all computation. //! //! Features: //! //! * Two different broad phase collision detection implementations: //! * Brute force //! * Sweep and Prune //! * Narrow phase collision detection using GJK, and optionally EPA for full contact information //! * Functions for collision detection working on user supplied transform, and //! [`CollisionShape`](collide/struct.CollisionShape.html) components. //! Can optionally use broad and/or narrow phase detection. //! Library supplies a transform implementation [`BodyPose`](struct.BodyPose.html) for //! convenience. //! * Uses single precision as default, can be changed to double precision with the `double` //! feature. //! * Has support for doing spatial sort/collision detection using the collision-rs DBVT. //! * Support for doing broad phase using the collision-rs DBVT. //! * Has support for all primitives in collision-rs //! #![deny( missing_docs, trivial_casts, unsafe_code, unstable_features, unused_import_braces, unused_qualifications )] #![allow(unknown_lints, type_complexity, borrowed_box)] extern crate cgmath; extern crate collision; extern crate rhusics_transform; #[cfg(feature = "specs")] extern crate specs; #[cfg(test)] #[macro_use] extern crate approx; #[cfg(feature = "serializable")] #[macro_use] extern crate serde; pub use body_pose::BodyPose; pub use collide::broad::{BroadPhase, BruteForce, SweepAndPrune2, SweepAndPrune3}; pub use collide::narrow::NarrowPhase; pub use collide::{ basic_collide, tree_collide, Collider, CollisionData, CollisionMode, CollisionShape, CollisionStrategy, Contact, ContactEvent, GetId, Primitive, }; pub use physics::simple::{next_frame_integration, next_frame_pose}; pub use physics::{ resolve_contact, ApplyAngular, ForceAccumulator, Inertia, Mass, Material, PartialCrossProduct, PhysicalEntity, ResolveData, SingleChangeSet, Velocity, Volume, WorldParameters, }; pub use rhusics_transform::{PhysicsTime, Pose}; pub mod collide2d; pub mod collide3d; pub mod physics2d; pub mod physics3d; mod body_pose; mod collide; #[cfg(feature = "specs")] mod ecs; mod physics; /// Wrapper for data computed for the next frame #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "serializable", derive(Serialize, Deserialize))] pub struct NextFrame<T> { /// Wrapped value pub value: T, }
use std::rc::Rc; use interpreter::{Value, EvalResult}; pub fn add(args: Vec<Rc<Value>>) -> EvalResult { let mut res = Value::Int(0); for arg in args { res = match (res, arg.as_ref()) { (Value::Int(a), &Value::Int(b)) => Value::Int(a + b), (Value::Real(a), &Value::Int(b)) => Value::Real(a + (b as f64)), (Value::Int(a), &Value::Real(b)) => Value::Real((a as f64) + b), (Value::Real(a), &Value::Real(b)) => Value::Real(a + b), _ => { return Err("`+` takes arguments of type int or real".to_string()); } }; } Ok(Rc::new(res)) } pub fn mul(args: Vec<Rc<Value>>) -> EvalResult { let mut res = Value::Int(1); for arg in args { res = match (res, arg.as_ref()) { (Value::Int(a), &Value::Int(b)) => Value::Int(a * b), (Value::Real(a), &Value::Int(b)) => Value::Real(a * (b as f64)), (Value::Int(a), &Value::Real(b)) => Value::Real((a as f64) * b), (Value::Real(a), &Value::Real(b)) => Value::Real(a * b), _ => { return Err("`*` takes arguments of type int or real".to_string()); } }; } Ok(Rc::new(res)) } pub fn sub(args: Vec<Rc<Value>>) -> EvalResult { if args.len() == 1 { return match args[0].as_ref() { &Value::Int(i) => Ok(Rc::new(Value::Int(-i))), &Value::Real(r) => Ok(Rc::new(Value::Real(-r))), _ => { return Err("`-` takes arguments of type int or real".to_string()); } }; } else if args.len() > 1 { let mut iter = args.into_iter(); let mut res = match iter.next().unwrap().as_ref() { &Value::Int(i) => Value::Int(i), &Value::Real(r) => Value::Real(r), _ => { return Err("`-` takes arguments of type int or real".to_string()); } }; while let Some(arg) = iter.next() { res = match (res, arg.as_ref()) { (Value::Int(a), &Value::Int(b)) => Value::Int(a - b), (Value::Real(a), &Value::Int(b)) => Value::Real(a - (b as f64)), (Value::Int(a), &Value::Real(b)) => Value::Real((a as f64) - b), (Value::Real(a), &Value::Real(b)) => Value::Real(a - b), _ => { return Err("`-` takes arguments of type int or real".to_string()); } }; } return Ok(Rc::new(res)); } else { return Err("`-` takes min. one argument of type int or real".to_string()); } } pub fn equals(args: Vec<Rc<Value>>) -> EvalResult { let mut iter = args.iter(); if let Some(arg0) = iter.next() { while let Some(arg) = iter.next() { if !(arg0.as_ref() == arg.as_ref()) { return Ok(Rc::new(Value::Bool(false))); } } Ok(Rc::new(Value::Bool(true))) } else { Err("`=` takes min. one argument".to_string()) } } pub fn echo(args: Vec<Rc<Value>>) -> EvalResult { for arg in args { print!("{}", arg.to_string()); } println!(); Ok(Rc::new(Value::Nil)) } pub fn bin(args: Vec<Rc<Value>>) -> EvalResult { if args.len() != 1 { return Err("bin takes only one argument of type int".to_string()); } match *args[0] { Value::Int(i) => Ok(Rc::new( Value::Str( format!("{:b}", i) ) )), _ => Err("bin only takes int as argument".to_string()) } } pub fn hex(args: Vec<Rc<Value>>) -> EvalResult { if args.len() != 1 { return Err("hex takes only one argument of type int".to_string()); } match *args[0] { Value::Int(i) => Ok(Rc::new( Value::Str( format!("{:X}", i) ) )), _ => Err("hex only takes int as argument".to_string()) } }
#[macro_use] extern crate pretty_assertions; include!("standard_assertion.rs");
/* Copyright 2020 Timo Saarinen 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 super::*; // ------------------------------------------------------------------------------------------------- /// Type 20: Data Link Management Message #[derive(Clone, Debug, PartialEq)] pub struct DataLinkManagementMessage { /// True if the data is about own vessel, false if about other. pub own_vessel: bool, /// AIS station type. pub station: Station, /// Interrogation case based on data length pub case: InterrogationCase, /// Source MMSI (30 bits) pub mmsi: u32, /// Offset number 1 (12 bits) pub offset1: u16, /// Reserved offset number (4) pub number1: u8, /// Allocation timeout in munites (4 bits) pub timeout1: u8, /// Repeat increment (11 bits) pub increment1: u8, /// Offset number 2 (12 bits) pub offset2: u16, /// Reserved offset number (4) pub number2: u8, /// Allocation timeout in munites (4 bits) pub timeout2: u8, /// Repeat increment (11 bits) pub increment2: u8, /// Offset number 3 (12 bits) pub offset3: u16, /// Reserved offset number (4) pub number3: u8, /// Allocation timeout in munites (4 bits) pub timeout3: u8, /// Repeat increment (11 bits) pub increment3: u8, /// Offset number 4 (12 bits) pub offset4: u16, /// Reserved offset number (4) pub number4: u8, /// Allocation timeout in munites (4 bits) pub timeout4: u8, /// Repeat increment (11 bits) pub increment4: u8, } // ------------------------------------------------------------------------------------------------- /// AIS VDM/VDO type 20: Data Link Management Message pub(crate) fn handle( bv: &BitVec, station: Station, own_vessel: bool, ) -> Result<ParsedMessage, ParseError> { let case = InterrogationCase::new(bv); Ok(ParsedMessage::DataLinkManagementMessage( DataLinkManagementMessage { own_vessel, station, case, mmsi: { pick_u64(&bv, 8, 30) as u32 }, offset1: { pick_u64(&bv, 40, 12) as u16 }, number1: { pick_u64(&bv, 52, 4) as u8 }, timeout1: { pick_u64(&bv, 56, 3) as u8 }, increment1: { pick_u64(&bv, 59, 11) as u8 }, offset2: { pick_u64(&bv, 70, 12) as u16 }, number2: { pick_u64(&bv, 82, 4) as u8 }, timeout2: { pick_u64(&bv, 86, 3) as u8 }, increment2: { pick_u64(&bv, 89, 11) as u8 }, offset3: { pick_u64(&bv, 100, 12) as u16 }, number3: { pick_u64(&bv, 112, 4) as u8 }, timeout3: { pick_u64(&bv, 116, 3) as u8 }, increment3: { pick_u64(&bv, 119, 11) as u8 }, offset4: { pick_u64(&bv, 130, 12) as u16 }, number4: { pick_u64(&bv, 142, 4) as u8 }, timeout4: { pick_u64(&bv, 146, 3) as u8 }, increment4: { pick_u64(&bv, 149, 11) as u8 }, }, )) } // ------------------------------------------------------------------------------------------------- #[cfg(test)] mod test { use super::*; #[test] fn test_parse_vdm_type20() { let mut p = NmeaParser::new(); match p.parse_sentence("!AIVDM,1,1,,A,Dh3OvjB8IN>4,0*1D") { Ok(ps) => { match ps { // The expected result ParsedMessage::DataLinkManagementMessage(dlmm) => { assert_eq!(dlmm.mmsi, 3669705); assert_eq!(dlmm.offset1, 2182); assert_eq!(dlmm.number1, 5); assert_eq!(dlmm.timeout1, 7); assert_eq!(dlmm.increment1, 225); } ParsedMessage::Incomplete => { assert!(false); } _ => { assert!(false); } } } Err(e) => { assert_eq!(e.to_string(), "OK"); } } } }
#[doc = r"Value read from the register"] pub struct R { bits: u8, } #[doc = r"Value to write to the register"] pub struct W { bits: u8, } impl super::RXCSRL5 { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W, { let bits = self.register.get(); self.register.set(f(&R { bits }, &mut W { bits }).bits); } #[doc = r"Reads the contents of the register"] #[inline(always)] pub fn read(&self) -> R { R { bits: self.register.get(), } } #[doc = r"Writes to the register"] #[inline(always)] pub fn write<F>(&self, f: F) where F: FnOnce(&mut W) -> &mut W, { self.register.set( f(&mut W { bits: Self::reset_value(), }) .bits, ); } #[doc = r"Reset value of the register"] #[inline(always)] pub const fn reset_value() -> u8 { 0 } #[doc = r"Writes the reset value to the register"] #[inline(always)] pub fn reset(&self) { self.register.set(Self::reset_value()) } } #[doc = r"Value of the field"] pub struct USB_RXCSRL5_RXRDYR { bits: bool, } impl USB_RXCSRL5_RXRDYR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bit(&self) -> bool { self.bits } #[doc = r"Returns `true` if the bit is clear (0)"] #[inline(always)] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r"Returns `true` if the bit is set (1)"] #[inline(always)] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r"Proxy"] pub struct _USB_RXCSRL5_RXRDYW<'a> { w: &'a mut W, } impl<'a> _USB_RXCSRL5_RXRDYW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 0); self.w.bits |= ((value as u8) & 1) << 0; self.w } } #[doc = r"Value of the field"] pub struct USB_RXCSRL5_FULLR { bits: bool, } impl USB_RXCSRL5_FULLR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bit(&self) -> bool { self.bits } #[doc = r"Returns `true` if the bit is clear (0)"] #[inline(always)] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r"Returns `true` if the bit is set (1)"] #[inline(always)] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r"Proxy"] pub struct _USB_RXCSRL5_FULLW<'a> { w: &'a mut W, } impl<'a> _USB_RXCSRL5_FULLW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 1); self.w.bits |= ((value as u8) & 1) << 1; self.w } } #[doc = r"Value of the field"] pub struct USB_RXCSRL5_OVERR { bits: bool, } impl USB_RXCSRL5_OVERR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bit(&self) -> bool { self.bits } #[doc = r"Returns `true` if the bit is clear (0)"] #[inline(always)] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r"Returns `true` if the bit is set (1)"] #[inline(always)] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r"Proxy"] pub struct _USB_RXCSRL5_OVERW<'a> { w: &'a mut W, } impl<'a> _USB_RXCSRL5_OVERW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 2); self.w.bits |= ((value as u8) & 1) << 2; self.w } } #[doc = r"Value of the field"] pub struct USB_RXCSRL5_DATAERRR { bits: bool, } impl USB_RXCSRL5_DATAERRR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bit(&self) -> bool { self.bits } #[doc = r"Returns `true` if the bit is clear (0)"] #[inline(always)] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r"Returns `true` if the bit is set (1)"] #[inline(always)] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r"Proxy"] pub struct _USB_RXCSRL5_DATAERRW<'a> { w: &'a mut W, } impl<'a> _USB_RXCSRL5_DATAERRW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 3); self.w.bits |= ((value as u8) & 1) << 3; self.w } } #[doc = r"Value of the field"] pub struct USB_RXCSRL5_FLUSHR { bits: bool, } impl USB_RXCSRL5_FLUSHR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bit(&self) -> bool { self.bits } #[doc = r"Returns `true` if the bit is clear (0)"] #[inline(always)] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r"Returns `true` if the bit is set (1)"] #[inline(always)] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r"Proxy"] pub struct _USB_RXCSRL5_FLUSHW<'a> { w: &'a mut W, } impl<'a> _USB_RXCSRL5_FLUSHW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 4); self.w.bits |= ((value as u8) & 1) << 4; self.w } } #[doc = r"Value of the field"] pub struct USB_RXCSRL5_STALLR { bits: bool, } impl USB_RXCSRL5_STALLR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bit(&self) -> bool { self.bits } #[doc = r"Returns `true` if the bit is clear (0)"] #[inline(always)] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r"Returns `true` if the bit is set (1)"] #[inline(always)] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r"Proxy"] pub struct _USB_RXCSRL5_STALLW<'a> { w: &'a mut W, } impl<'a> _USB_RXCSRL5_STALLW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 5); self.w.bits |= ((value as u8) & 1) << 5; self.w } } #[doc = r"Value of the field"] pub struct USB_RXCSRL5_STALLEDR { bits: bool, } impl USB_RXCSRL5_STALLEDR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bit(&self) -> bool { self.bits } #[doc = r"Returns `true` if the bit is clear (0)"] #[inline(always)] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r"Returns `true` if the bit is set (1)"] #[inline(always)] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r"Proxy"] pub struct _USB_RXCSRL5_STALLEDW<'a> { w: &'a mut W, } impl<'a> _USB_RXCSRL5_STALLEDW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 6); self.w.bits |= ((value as u8) & 1) << 6; self.w } } #[doc = r"Value of the field"] pub struct USB_RXCSRL5_CLRDTR { bits: bool, } impl USB_RXCSRL5_CLRDTR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bit(&self) -> bool { self.bits } #[doc = r"Returns `true` if the bit is clear (0)"] #[inline(always)] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r"Returns `true` if the bit is set (1)"] #[inline(always)] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r"Proxy"] pub struct _USB_RXCSRL5_CLRDTW<'a> { w: &'a mut W, } impl<'a> _USB_RXCSRL5_CLRDTW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 7); self.w.bits |= ((value as u8) & 1) << 7; self.w } } #[doc = r"Value of the field"] pub struct USB_RXCSRL5_ERRORR { bits: bool, } impl USB_RXCSRL5_ERRORR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bit(&self) -> bool { self.bits } #[doc = r"Returns `true` if the bit is clear (0)"] #[inline(always)] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r"Returns `true` if the bit is set (1)"] #[inline(always)] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r"Proxy"] pub struct _USB_RXCSRL5_ERRORW<'a> { w: &'a mut W, } impl<'a> _USB_RXCSRL5_ERRORW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 2); self.w.bits |= ((value as u8) & 1) << 2; self.w } } #[doc = r"Value of the field"] pub struct USB_RXCSRL5_NAKTOR { bits: bool, } impl USB_RXCSRL5_NAKTOR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bit(&self) -> bool { self.bits } #[doc = r"Returns `true` if the bit is clear (0)"] #[inline(always)] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r"Returns `true` if the bit is set (1)"] #[inline(always)] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r"Proxy"] pub struct _USB_RXCSRL5_NAKTOW<'a> { w: &'a mut W, } impl<'a> _USB_RXCSRL5_NAKTOW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 3); self.w.bits |= ((value as u8) & 1) << 3; self.w } } #[doc = r"Value of the field"] pub struct USB_RXCSRL5_REQPKTR { bits: bool, } impl USB_RXCSRL5_REQPKTR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bit(&self) -> bool { self.bits } #[doc = r"Returns `true` if the bit is clear (0)"] #[inline(always)] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r"Returns `true` if the bit is set (1)"] #[inline(always)] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r"Proxy"] pub struct _USB_RXCSRL5_REQPKTW<'a> { w: &'a mut W, } impl<'a> _USB_RXCSRL5_REQPKTW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 5); self.w.bits |= ((value as u8) & 1) << 5; self.w } } impl R { #[doc = r"Value of the register as raw bits"] #[inline(always)] pub fn bits(&self) -> u8 { self.bits } #[doc = "Bit 0 - Receive Packet Ready"] #[inline(always)] pub fn usb_rxcsrl5_rxrdy(&self) -> USB_RXCSRL5_RXRDYR { let bits = ((self.bits >> 0) & 1) != 0; USB_RXCSRL5_RXRDYR { bits } } #[doc = "Bit 1 - FIFO Full"] #[inline(always)] pub fn usb_rxcsrl5_full(&self) -> USB_RXCSRL5_FULLR { let bits = ((self.bits >> 1) & 1) != 0; USB_RXCSRL5_FULLR { bits } } #[doc = "Bit 2 - Overrun"] #[inline(always)] pub fn usb_rxcsrl5_over(&self) -> USB_RXCSRL5_OVERR { let bits = ((self.bits >> 2) & 1) != 0; USB_RXCSRL5_OVERR { bits } } #[doc = "Bit 3 - Data Error"] #[inline(always)] pub fn usb_rxcsrl5_dataerr(&self) -> USB_RXCSRL5_DATAERRR { let bits = ((self.bits >> 3) & 1) != 0; USB_RXCSRL5_DATAERRR { bits } } #[doc = "Bit 4 - Flush FIFO"] #[inline(always)] pub fn usb_rxcsrl5_flush(&self) -> USB_RXCSRL5_FLUSHR { let bits = ((self.bits >> 4) & 1) != 0; USB_RXCSRL5_FLUSHR { bits } } #[doc = "Bit 5 - Send STALL"] #[inline(always)] pub fn usb_rxcsrl5_stall(&self) -> USB_RXCSRL5_STALLR { let bits = ((self.bits >> 5) & 1) != 0; USB_RXCSRL5_STALLR { bits } } #[doc = "Bit 6 - Endpoint Stalled"] #[inline(always)] pub fn usb_rxcsrl5_stalled(&self) -> USB_RXCSRL5_STALLEDR { let bits = ((self.bits >> 6) & 1) != 0; USB_RXCSRL5_STALLEDR { bits } } #[doc = "Bit 7 - Clear Data Toggle"] #[inline(always)] pub fn usb_rxcsrl5_clrdt(&self) -> USB_RXCSRL5_CLRDTR { let bits = ((self.bits >> 7) & 1) != 0; USB_RXCSRL5_CLRDTR { bits } } #[doc = "Bit 2 - Error"] #[inline(always)] pub fn usb_rxcsrl5_error(&self) -> USB_RXCSRL5_ERRORR { let bits = ((self.bits >> 2) & 1) != 0; USB_RXCSRL5_ERRORR { bits } } #[doc = "Bit 3 - NAK Timeout"] #[inline(always)] pub fn usb_rxcsrl5_nakto(&self) -> USB_RXCSRL5_NAKTOR { let bits = ((self.bits >> 3) & 1) != 0; USB_RXCSRL5_NAKTOR { bits } } #[doc = "Bit 5 - Request Packet"] #[inline(always)] pub fn usb_rxcsrl5_reqpkt(&self) -> USB_RXCSRL5_REQPKTR { let bits = ((self.bits >> 5) & 1) != 0; USB_RXCSRL5_REQPKTR { bits } } } impl W { #[doc = r"Writes raw bits to the register"] #[inline(always)] pub unsafe fn bits(&mut self, bits: u8) -> &mut Self { self.bits = bits; self } #[doc = "Bit 0 - Receive Packet Ready"] #[inline(always)] pub fn usb_rxcsrl5_rxrdy(&mut self) -> _USB_RXCSRL5_RXRDYW { _USB_RXCSRL5_RXRDYW { w: self } } #[doc = "Bit 1 - FIFO Full"] #[inline(always)] pub fn usb_rxcsrl5_full(&mut self) -> _USB_RXCSRL5_FULLW { _USB_RXCSRL5_FULLW { w: self } } #[doc = "Bit 2 - Overrun"] #[inline(always)] pub fn usb_rxcsrl5_over(&mut self) -> _USB_RXCSRL5_OVERW { _USB_RXCSRL5_OVERW { w: self } } #[doc = "Bit 3 - Data Error"] #[inline(always)] pub fn usb_rxcsrl5_dataerr(&mut self) -> _USB_RXCSRL5_DATAERRW { _USB_RXCSRL5_DATAERRW { w: self } } #[doc = "Bit 4 - Flush FIFO"] #[inline(always)] pub fn usb_rxcsrl5_flush(&mut self) -> _USB_RXCSRL5_FLUSHW { _USB_RXCSRL5_FLUSHW { w: self } } #[doc = "Bit 5 - Send STALL"] #[inline(always)] pub fn usb_rxcsrl5_stall(&mut self) -> _USB_RXCSRL5_STALLW { _USB_RXCSRL5_STALLW { w: self } } #[doc = "Bit 6 - Endpoint Stalled"] #[inline(always)] pub fn usb_rxcsrl5_stalled(&mut self) -> _USB_RXCSRL5_STALLEDW { _USB_RXCSRL5_STALLEDW { w: self } } #[doc = "Bit 7 - Clear Data Toggle"] #[inline(always)] pub fn usb_rxcsrl5_clrdt(&mut self) -> _USB_RXCSRL5_CLRDTW { _USB_RXCSRL5_CLRDTW { w: self } } #[doc = "Bit 2 - Error"] #[inline(always)] pub fn usb_rxcsrl5_error(&mut self) -> _USB_RXCSRL5_ERRORW { _USB_RXCSRL5_ERRORW { w: self } } #[doc = "Bit 3 - NAK Timeout"] #[inline(always)] pub fn usb_rxcsrl5_nakto(&mut self) -> _USB_RXCSRL5_NAKTOW { _USB_RXCSRL5_NAKTOW { w: self } } #[doc = "Bit 5 - Request Packet"] #[inline(always)] pub fn usb_rxcsrl5_reqpkt(&mut self) -> _USB_RXCSRL5_REQPKTW { _USB_RXCSRL5_REQPKTW { w: self } } }
extern crate rusty_markov_chain; use rusty_markov_chain::Markov; fn main() { let mut markov = Markov::new(); //let string = String::from("the theremin is theirs or is it not theirs"); //let string1 = String::from("to be or not to be that is the question"); //markov.chain(string1, 3); //let string2 = String::from("below the thunders of the upper deep far far beneath in the abysmal sea his ancient dreamless uninvaded sleep the kraken sleepeth faintest sunlights flee about his shadowy sides above him swell huge sponges of millennial growth and height and far away into the sickly light from many a wondrous grot and secret cell unnumbered and enormous polypi winnow with giant arms the slumbering green there hath he lain for ages and will lie battening upon huge sea worms in his sleep until the latter fire shall heat the deep then once by man and angels to be seen in roaring he shall rise and on the surface die"); //markov.chain(string2, 3); //println!("{:?}", markov); markov.chain_file(String::from("./file.txt"), 3); markov.generate(String::from("MIT"), 500); }
use std::fs::File; use std::result::Result; use std::io::Error; fn open_file() -> Result<(), Error> { try!(File::create("hoge")); Ok(()) } fn main() { let foo = open_file(); }
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] pub const ADDRESS_TYPE_IANA: u32 = 0u32; pub const ADDRESS_TYPE_IATA: u32 = 1u32; pub const CHANGESTATE: u32 = 4u32; pub const CLIENT_TYPE_BOOTP: u32 = 2u32; pub const CLIENT_TYPE_DHCP: u32 = 1u32; pub const CLIENT_TYPE_NONE: u32 = 100u32; pub const CLIENT_TYPE_RESERVATION_FLAG: u32 = 4u32; pub const CLIENT_TYPE_UNSPECIFIED: u32 = 0u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DATE_TIME { pub dwLowDateTime: u32, pub dwHighDateTime: u32, } impl DATE_TIME {} impl ::core::default::Default for DATE_TIME { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DATE_TIME { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DATE_TIME").field("dwLowDateTime", &self.dwLowDateTime).field("dwHighDateTime", &self.dwHighDateTime).finish() } } impl ::core::cmp::PartialEq for DATE_TIME { fn eq(&self, other: &Self) -> bool { self.dwLowDateTime == other.dwLowDateTime && self.dwHighDateTime == other.dwHighDateTime } } impl ::core::cmp::Eq for DATE_TIME {} unsafe impl ::windows::core::Abi for DATE_TIME { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCPAPI_PARAMS { pub Flags: u32, pub OptionId: u32, pub IsVendor: super::super::Foundation::BOOL, pub Data: *mut u8, pub nBytesData: u32, } #[cfg(feature = "Win32_Foundation")] impl DHCPAPI_PARAMS {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCPAPI_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCPAPI_PARAMS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPAPI_PARAMS").field("Flags", &self.Flags).field("OptionId", &self.OptionId).field("IsVendor", &self.IsVendor).field("Data", &self.Data).field("nBytesData", &self.nBytesData).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCPAPI_PARAMS { fn eq(&self, other: &Self) -> bool { self.Flags == other.Flags && self.OptionId == other.OptionId && self.IsVendor == other.IsVendor && self.Data == other.Data && self.nBytesData == other.nBytesData } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCPAPI_PARAMS {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCPAPI_PARAMS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCPCAPI_CLASSID { pub Flags: u32, pub Data: *mut u8, pub nBytesData: u32, } impl DHCPCAPI_CLASSID {} impl ::core::default::Default for DHCPCAPI_CLASSID { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCPCAPI_CLASSID { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPCAPI_CLASSID").field("Flags", &self.Flags).field("Data", &self.Data).field("nBytesData", &self.nBytesData).finish() } } impl ::core::cmp::PartialEq for DHCPCAPI_CLASSID { fn eq(&self, other: &Self) -> bool { self.Flags == other.Flags && self.Data == other.Data && self.nBytesData == other.nBytesData } } impl ::core::cmp::Eq for DHCPCAPI_CLASSID {} unsafe impl ::windows::core::Abi for DHCPCAPI_CLASSID { type Abi = Self; } pub const DHCPCAPI_DEREGISTER_HANDLE_EVENT: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCPCAPI_PARAMS_ARRAY { pub nParams: u32, pub Params: *mut DHCPAPI_PARAMS, } #[cfg(feature = "Win32_Foundation")] impl DHCPCAPI_PARAMS_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCPCAPI_PARAMS_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCPCAPI_PARAMS_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPCAPI_PARAMS_ARRAY").field("nParams", &self.nParams).field("Params", &self.Params).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCPCAPI_PARAMS_ARRAY { fn eq(&self, other: &Self) -> bool { self.nParams == other.nParams && self.Params == other.Params } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCPCAPI_PARAMS_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCPCAPI_PARAMS_ARRAY { type Abi = Self; } pub const DHCPCAPI_REGISTER_HANDLE_EVENT: u32 = 1u32; pub const DHCPCAPI_REQUEST_ASYNCHRONOUS: u32 = 4u32; pub const DHCPCAPI_REQUEST_CANCEL: u32 = 8u32; pub const DHCPCAPI_REQUEST_MASK: u32 = 15u32; pub const DHCPCAPI_REQUEST_PERSISTENT: u32 = 1u32; pub const DHCPCAPI_REQUEST_SYNCHRONOUS: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCPDS_SERVER { pub Version: u32, pub ServerName: super::super::Foundation::PWSTR, pub ServerAddress: u32, pub Flags: u32, pub State: u32, pub DsLocation: super::super::Foundation::PWSTR, pub DsLocType: u32, } #[cfg(feature = "Win32_Foundation")] impl DHCPDS_SERVER {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCPDS_SERVER { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCPDS_SERVER { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPDS_SERVER").field("Version", &self.Version).field("ServerName", &self.ServerName).field("ServerAddress", &self.ServerAddress).field("Flags", &self.Flags).field("State", &self.State).field("DsLocation", &self.DsLocation).field("DsLocType", &self.DsLocType).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCPDS_SERVER { fn eq(&self, other: &Self) -> bool { self.Version == other.Version && self.ServerName == other.ServerName && self.ServerAddress == other.ServerAddress && self.Flags == other.Flags && self.State == other.State && self.DsLocation == other.DsLocation && self.DsLocType == other.DsLocType } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCPDS_SERVER {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCPDS_SERVER { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCPDS_SERVERS { pub Flags: u32, pub NumElements: u32, pub Servers: *mut DHCPDS_SERVER, } #[cfg(feature = "Win32_Foundation")] impl DHCPDS_SERVERS {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCPDS_SERVERS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCPDS_SERVERS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPDS_SERVERS").field("Flags", &self.Flags).field("NumElements", &self.NumElements).field("Servers", &self.Servers).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCPDS_SERVERS { fn eq(&self, other: &Self) -> bool { self.Flags == other.Flags && self.NumElements == other.NumElements && self.Servers == other.Servers } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCPDS_SERVERS {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCPDS_SERVERS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCPV4_FAILOVER_CLIENT_INFO { pub ClientIpAddress: u32, pub SubnetMask: u32, pub ClientHardwareAddress: DHCP_BINARY_DATA, pub ClientName: super::super::Foundation::PWSTR, pub ClientComment: super::super::Foundation::PWSTR, pub ClientLeaseExpires: DATE_TIME, pub OwnerHost: DHCP_HOST_INFO, pub bClientType: u8, pub AddressState: u8, pub Status: QuarantineStatus, pub ProbationEnds: DATE_TIME, pub QuarantineCapable: super::super::Foundation::BOOL, pub SentPotExpTime: u32, pub AckPotExpTime: u32, pub RecvPotExpTime: u32, pub StartTime: u32, pub CltLastTransTime: u32, pub LastBndUpdTime: u32, pub BndMsgStatus: u32, pub PolicyName: super::super::Foundation::PWSTR, pub Flags: u8, } #[cfg(feature = "Win32_Foundation")] impl DHCPV4_FAILOVER_CLIENT_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCPV4_FAILOVER_CLIENT_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCPV4_FAILOVER_CLIENT_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPV4_FAILOVER_CLIENT_INFO") .field("ClientIpAddress", &self.ClientIpAddress) .field("SubnetMask", &self.SubnetMask) .field("ClientHardwareAddress", &self.ClientHardwareAddress) .field("ClientName", &self.ClientName) .field("ClientComment", &self.ClientComment) .field("ClientLeaseExpires", &self.ClientLeaseExpires) .field("OwnerHost", &self.OwnerHost) .field("bClientType", &self.bClientType) .field("AddressState", &self.AddressState) .field("Status", &self.Status) .field("ProbationEnds", &self.ProbationEnds) .field("QuarantineCapable", &self.QuarantineCapable) .field("SentPotExpTime", &self.SentPotExpTime) .field("AckPotExpTime", &self.AckPotExpTime) .field("RecvPotExpTime", &self.RecvPotExpTime) .field("StartTime", &self.StartTime) .field("CltLastTransTime", &self.CltLastTransTime) .field("LastBndUpdTime", &self.LastBndUpdTime) .field("BndMsgStatus", &self.BndMsgStatus) .field("PolicyName", &self.PolicyName) .field("Flags", &self.Flags) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCPV4_FAILOVER_CLIENT_INFO { fn eq(&self, other: &Self) -> bool { self.ClientIpAddress == other.ClientIpAddress && self.SubnetMask == other.SubnetMask && self.ClientHardwareAddress == other.ClientHardwareAddress && self.ClientName == other.ClientName && self.ClientComment == other.ClientComment && self.ClientLeaseExpires == other.ClientLeaseExpires && self.OwnerHost == other.OwnerHost && self.bClientType == other.bClientType && self.AddressState == other.AddressState && self.Status == other.Status && self.ProbationEnds == other.ProbationEnds && self.QuarantineCapable == other.QuarantineCapable && self.SentPotExpTime == other.SentPotExpTime && self.AckPotExpTime == other.AckPotExpTime && self.RecvPotExpTime == other.RecvPotExpTime && self.StartTime == other.StartTime && self.CltLastTransTime == other.CltLastTransTime && self.LastBndUpdTime == other.LastBndUpdTime && self.BndMsgStatus == other.BndMsgStatus && self.PolicyName == other.PolicyName && self.Flags == other.Flags } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCPV4_FAILOVER_CLIENT_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCPV4_FAILOVER_CLIENT_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCPV4_FAILOVER_CLIENT_INFO_ARRAY { pub NumElements: u32, pub Clients: *mut *mut DHCPV4_FAILOVER_CLIENT_INFO, } #[cfg(feature = "Win32_Foundation")] impl DHCPV4_FAILOVER_CLIENT_INFO_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCPV4_FAILOVER_CLIENT_INFO_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCPV4_FAILOVER_CLIENT_INFO_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPV4_FAILOVER_CLIENT_INFO_ARRAY").field("NumElements", &self.NumElements).field("Clients", &self.Clients).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCPV4_FAILOVER_CLIENT_INFO_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Clients == other.Clients } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCPV4_FAILOVER_CLIENT_INFO_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCPV4_FAILOVER_CLIENT_INFO_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCPV4_FAILOVER_CLIENT_INFO_EX { pub ClientIpAddress: u32, pub SubnetMask: u32, pub ClientHardwareAddress: DHCP_BINARY_DATA, pub ClientName: super::super::Foundation::PWSTR, pub ClientComment: super::super::Foundation::PWSTR, pub ClientLeaseExpires: DATE_TIME, pub OwnerHost: DHCP_HOST_INFO, pub bClientType: u8, pub AddressState: u8, pub Status: QuarantineStatus, pub ProbationEnds: DATE_TIME, pub QuarantineCapable: super::super::Foundation::BOOL, pub SentPotExpTime: u32, pub AckPotExpTime: u32, pub RecvPotExpTime: u32, pub StartTime: u32, pub CltLastTransTime: u32, pub LastBndUpdTime: u32, pub BndMsgStatus: u32, pub PolicyName: super::super::Foundation::PWSTR, pub Flags: u8, pub AddressStateEx: u32, } #[cfg(feature = "Win32_Foundation")] impl DHCPV4_FAILOVER_CLIENT_INFO_EX {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCPV4_FAILOVER_CLIENT_INFO_EX { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCPV4_FAILOVER_CLIENT_INFO_EX { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPV4_FAILOVER_CLIENT_INFO_EX") .field("ClientIpAddress", &self.ClientIpAddress) .field("SubnetMask", &self.SubnetMask) .field("ClientHardwareAddress", &self.ClientHardwareAddress) .field("ClientName", &self.ClientName) .field("ClientComment", &self.ClientComment) .field("ClientLeaseExpires", &self.ClientLeaseExpires) .field("OwnerHost", &self.OwnerHost) .field("bClientType", &self.bClientType) .field("AddressState", &self.AddressState) .field("Status", &self.Status) .field("ProbationEnds", &self.ProbationEnds) .field("QuarantineCapable", &self.QuarantineCapable) .field("SentPotExpTime", &self.SentPotExpTime) .field("AckPotExpTime", &self.AckPotExpTime) .field("RecvPotExpTime", &self.RecvPotExpTime) .field("StartTime", &self.StartTime) .field("CltLastTransTime", &self.CltLastTransTime) .field("LastBndUpdTime", &self.LastBndUpdTime) .field("BndMsgStatus", &self.BndMsgStatus) .field("PolicyName", &self.PolicyName) .field("Flags", &self.Flags) .field("AddressStateEx", &self.AddressStateEx) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCPV4_FAILOVER_CLIENT_INFO_EX { fn eq(&self, other: &Self) -> bool { self.ClientIpAddress == other.ClientIpAddress && self.SubnetMask == other.SubnetMask && self.ClientHardwareAddress == other.ClientHardwareAddress && self.ClientName == other.ClientName && self.ClientComment == other.ClientComment && self.ClientLeaseExpires == other.ClientLeaseExpires && self.OwnerHost == other.OwnerHost && self.bClientType == other.bClientType && self.AddressState == other.AddressState && self.Status == other.Status && self.ProbationEnds == other.ProbationEnds && self.QuarantineCapable == other.QuarantineCapable && self.SentPotExpTime == other.SentPotExpTime && self.AckPotExpTime == other.AckPotExpTime && self.RecvPotExpTime == other.RecvPotExpTime && self.StartTime == other.StartTime && self.CltLastTransTime == other.CltLastTransTime && self.LastBndUpdTime == other.LastBndUpdTime && self.BndMsgStatus == other.BndMsgStatus && self.PolicyName == other.PolicyName && self.Flags == other.Flags && self.AddressStateEx == other.AddressStateEx } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCPV4_FAILOVER_CLIENT_INFO_EX {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCPV4_FAILOVER_CLIENT_INFO_EX { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCPV6CAPI_CLASSID { pub Flags: u32, pub Data: *mut u8, pub nBytesData: u32, } impl DHCPV6CAPI_CLASSID {} impl ::core::default::Default for DHCPV6CAPI_CLASSID { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCPV6CAPI_CLASSID { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPV6CAPI_CLASSID").field("Flags", &self.Flags).field("Data", &self.Data).field("nBytesData", &self.nBytesData).finish() } } impl ::core::cmp::PartialEq for DHCPV6CAPI_CLASSID { fn eq(&self, other: &Self) -> bool { self.Flags == other.Flags && self.Data == other.Data && self.nBytesData == other.nBytesData } } impl ::core::cmp::Eq for DHCPV6CAPI_CLASSID {} unsafe impl ::windows::core::Abi for DHCPV6CAPI_CLASSID { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCPV6CAPI_PARAMS { pub Flags: u32, pub OptionId: u32, pub IsVendor: super::super::Foundation::BOOL, pub Data: *mut u8, pub nBytesData: u32, } #[cfg(feature = "Win32_Foundation")] impl DHCPV6CAPI_PARAMS {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCPV6CAPI_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCPV6CAPI_PARAMS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPV6CAPI_PARAMS").field("Flags", &self.Flags).field("OptionId", &self.OptionId).field("IsVendor", &self.IsVendor).field("Data", &self.Data).field("nBytesData", &self.nBytesData).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCPV6CAPI_PARAMS { fn eq(&self, other: &Self) -> bool { self.Flags == other.Flags && self.OptionId == other.OptionId && self.IsVendor == other.IsVendor && self.Data == other.Data && self.nBytesData == other.nBytesData } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCPV6CAPI_PARAMS {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCPV6CAPI_PARAMS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCPV6CAPI_PARAMS_ARRAY { pub nParams: u32, pub Params: *mut DHCPV6CAPI_PARAMS, } #[cfg(feature = "Win32_Foundation")] impl DHCPV6CAPI_PARAMS_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCPV6CAPI_PARAMS_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCPV6CAPI_PARAMS_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPV6CAPI_PARAMS_ARRAY").field("nParams", &self.nParams).field("Params", &self.Params).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCPV6CAPI_PARAMS_ARRAY { fn eq(&self, other: &Self) -> bool { self.nParams == other.nParams && self.Params == other.Params } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCPV6CAPI_PARAMS_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCPV6CAPI_PARAMS_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCPV6Prefix { pub prefix: [u8; 16], pub prefixLength: u32, pub preferredLifeTime: u32, pub validLifeTime: u32, pub status: StatusCode, } impl DHCPV6Prefix {} impl ::core::default::Default for DHCPV6Prefix { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCPV6Prefix { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPV6Prefix").field("prefix", &self.prefix).field("prefixLength", &self.prefixLength).field("preferredLifeTime", &self.preferredLifeTime).field("validLifeTime", &self.validLifeTime).field("status", &self.status).finish() } } impl ::core::cmp::PartialEq for DHCPV6Prefix { fn eq(&self, other: &Self) -> bool { self.prefix == other.prefix && self.prefixLength == other.prefixLength && self.preferredLifeTime == other.preferredLifeTime && self.validLifeTime == other.validLifeTime && self.status == other.status } } impl ::core::cmp::Eq for DHCPV6Prefix {} unsafe impl ::windows::core::Abi for DHCPV6Prefix { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCPV6PrefixLeaseInformation { pub nPrefixes: u32, pub prefixArray: *mut DHCPV6Prefix, pub iaid: u32, pub T1: i64, pub T2: i64, pub MaxLeaseExpirationTime: i64, pub LastRenewalTime: i64, pub status: StatusCode, pub ServerId: *mut u8, pub ServerIdLen: u32, } impl DHCPV6PrefixLeaseInformation {} impl ::core::default::Default for DHCPV6PrefixLeaseInformation { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCPV6PrefixLeaseInformation { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPV6PrefixLeaseInformation") .field("nPrefixes", &self.nPrefixes) .field("prefixArray", &self.prefixArray) .field("iaid", &self.iaid) .field("T1", &self.T1) .field("T2", &self.T2) .field("MaxLeaseExpirationTime", &self.MaxLeaseExpirationTime) .field("LastRenewalTime", &self.LastRenewalTime) .field("status", &self.status) .field("ServerId", &self.ServerId) .field("ServerIdLen", &self.ServerIdLen) .finish() } } impl ::core::cmp::PartialEq for DHCPV6PrefixLeaseInformation { fn eq(&self, other: &Self) -> bool { self.nPrefixes == other.nPrefixes && self.prefixArray == other.prefixArray && self.iaid == other.iaid && self.T1 == other.T1 && self.T2 == other.T2 && self.MaxLeaseExpirationTime == other.MaxLeaseExpirationTime && self.LastRenewalTime == other.LastRenewalTime && self.status == other.status && self.ServerId == other.ServerId && self.ServerIdLen == other.ServerIdLen } } impl ::core::cmp::Eq for DHCPV6PrefixLeaseInformation {} unsafe impl ::windows::core::Abi for DHCPV6PrefixLeaseInformation { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCPV6_BIND_ELEMENT { pub Flags: u32, pub fBoundToDHCPServer: super::super::Foundation::BOOL, pub AdapterPrimaryAddress: DHCP_IPV6_ADDRESS, pub AdapterSubnetAddress: DHCP_IPV6_ADDRESS, pub IfDescription: super::super::Foundation::PWSTR, pub IpV6IfIndex: u32, pub IfIdSize: u32, pub IfId: *mut u8, } #[cfg(feature = "Win32_Foundation")] impl DHCPV6_BIND_ELEMENT {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCPV6_BIND_ELEMENT { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCPV6_BIND_ELEMENT { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPV6_BIND_ELEMENT") .field("Flags", &self.Flags) .field("fBoundToDHCPServer", &self.fBoundToDHCPServer) .field("AdapterPrimaryAddress", &self.AdapterPrimaryAddress) .field("AdapterSubnetAddress", &self.AdapterSubnetAddress) .field("IfDescription", &self.IfDescription) .field("IpV6IfIndex", &self.IpV6IfIndex) .field("IfIdSize", &self.IfIdSize) .field("IfId", &self.IfId) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCPV6_BIND_ELEMENT { fn eq(&self, other: &Self) -> bool { self.Flags == other.Flags && self.fBoundToDHCPServer == other.fBoundToDHCPServer && self.AdapterPrimaryAddress == other.AdapterPrimaryAddress && self.AdapterSubnetAddress == other.AdapterSubnetAddress && self.IfDescription == other.IfDescription && self.IpV6IfIndex == other.IpV6IfIndex && self.IfIdSize == other.IfIdSize && self.IfId == other.IfId } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCPV6_BIND_ELEMENT {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCPV6_BIND_ELEMENT { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCPV6_BIND_ELEMENT_ARRAY { pub NumElements: u32, pub Elements: *mut DHCPV6_BIND_ELEMENT, } #[cfg(feature = "Win32_Foundation")] impl DHCPV6_BIND_ELEMENT_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCPV6_BIND_ELEMENT_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCPV6_BIND_ELEMENT_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPV6_BIND_ELEMENT_ARRAY").field("NumElements", &self.NumElements).field("Elements", &self.Elements).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCPV6_BIND_ELEMENT_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Elements == other.Elements } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCPV6_BIND_ELEMENT_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCPV6_BIND_ELEMENT_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCPV6_IP_ARRAY { pub NumElements: u32, pub Elements: *mut DHCP_IPV6_ADDRESS, } impl DHCPV6_IP_ARRAY {} impl ::core::default::Default for DHCPV6_IP_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCPV6_IP_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPV6_IP_ARRAY").field("NumElements", &self.NumElements).field("Elements", &self.Elements).finish() } } impl ::core::cmp::PartialEq for DHCPV6_IP_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Elements == other.Elements } } impl ::core::cmp::Eq for DHCPV6_IP_ARRAY {} unsafe impl ::windows::core::Abi for DHCPV6_IP_ARRAY { type Abi = Self; } pub const DHCPV6_OPTION_CLIENTID: u32 = 1u32; pub const DHCPV6_OPTION_DNS_SERVERS: u32 = 23u32; pub const DHCPV6_OPTION_DOMAIN_LIST: u32 = 24u32; pub const DHCPV6_OPTION_IA_NA: u32 = 3u32; pub const DHCPV6_OPTION_IA_PD: u32 = 25u32; pub const DHCPV6_OPTION_IA_TA: u32 = 4u32; pub const DHCPV6_OPTION_NISP_DOMAIN_NAME: u32 = 30u32; pub const DHCPV6_OPTION_NISP_SERVERS: u32 = 28u32; pub const DHCPV6_OPTION_NIS_DOMAIN_NAME: u32 = 29u32; pub const DHCPV6_OPTION_NIS_SERVERS: u32 = 27u32; pub const DHCPV6_OPTION_ORO: u32 = 6u32; pub const DHCPV6_OPTION_PREFERENCE: u32 = 7u32; pub const DHCPV6_OPTION_RAPID_COMMIT: u32 = 14u32; pub const DHCPV6_OPTION_RECONF_MSG: u32 = 19u32; pub const DHCPV6_OPTION_SERVERID: u32 = 2u32; pub const DHCPV6_OPTION_SIP_SERVERS_ADDRS: u32 = 22u32; pub const DHCPV6_OPTION_SIP_SERVERS_NAMES: u32 = 21u32; pub const DHCPV6_OPTION_UNICAST: u32 = 12u32; pub const DHCPV6_OPTION_USER_CLASS: u32 = 15u32; pub const DHCPV6_OPTION_VENDOR_CLASS: u32 = 16u32; pub const DHCPV6_OPTION_VENDOR_OPTS: u32 = 17u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCPV6_STATELESS_PARAMS { pub Status: super::super::Foundation::BOOL, pub PurgeInterval: u32, } #[cfg(feature = "Win32_Foundation")] impl DHCPV6_STATELESS_PARAMS {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCPV6_STATELESS_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCPV6_STATELESS_PARAMS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPV6_STATELESS_PARAMS").field("Status", &self.Status).field("PurgeInterval", &self.PurgeInterval).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCPV6_STATELESS_PARAMS { fn eq(&self, other: &Self) -> bool { self.Status == other.Status && self.PurgeInterval == other.PurgeInterval } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCPV6_STATELESS_PARAMS {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCPV6_STATELESS_PARAMS { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DHCPV6_STATELESS_PARAM_TYPE(pub i32); pub const DhcpStatelessPurgeInterval: DHCPV6_STATELESS_PARAM_TYPE = DHCPV6_STATELESS_PARAM_TYPE(1i32); pub const DhcpStatelessStatus: DHCPV6_STATELESS_PARAM_TYPE = DHCPV6_STATELESS_PARAM_TYPE(2i32); impl ::core::convert::From<i32> for DHCPV6_STATELESS_PARAM_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCPV6_STATELESS_PARAM_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCPV6_STATELESS_SCOPE_STATS { pub SubnetAddress: DHCP_IPV6_ADDRESS, pub NumStatelessClientsAdded: u64, pub NumStatelessClientsRemoved: u64, } impl DHCPV6_STATELESS_SCOPE_STATS {} impl ::core::default::Default for DHCPV6_STATELESS_SCOPE_STATS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCPV6_STATELESS_SCOPE_STATS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPV6_STATELESS_SCOPE_STATS").field("SubnetAddress", &self.SubnetAddress).field("NumStatelessClientsAdded", &self.NumStatelessClientsAdded).field("NumStatelessClientsRemoved", &self.NumStatelessClientsRemoved).finish() } } impl ::core::cmp::PartialEq for DHCPV6_STATELESS_SCOPE_STATS { fn eq(&self, other: &Self) -> bool { self.SubnetAddress == other.SubnetAddress && self.NumStatelessClientsAdded == other.NumStatelessClientsAdded && self.NumStatelessClientsRemoved == other.NumStatelessClientsRemoved } } impl ::core::cmp::Eq for DHCPV6_STATELESS_SCOPE_STATS {} unsafe impl ::windows::core::Abi for DHCPV6_STATELESS_SCOPE_STATS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCPV6_STATELESS_STATS { pub NumScopes: u32, pub ScopeStats: *mut DHCPV6_STATELESS_SCOPE_STATS, } impl DHCPV6_STATELESS_STATS {} impl ::core::default::Default for DHCPV6_STATELESS_STATS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCPV6_STATELESS_STATS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCPV6_STATELESS_STATS").field("NumScopes", &self.NumScopes).field("ScopeStats", &self.ScopeStats).finish() } } impl ::core::cmp::PartialEq for DHCPV6_STATELESS_STATS { fn eq(&self, other: &Self) -> bool { self.NumScopes == other.NumScopes && self.ScopeStats == other.ScopeStats } } impl ::core::cmp::Eq for DHCPV6_STATELESS_STATS {} unsafe impl ::windows::core::Abi for DHCPV6_STATELESS_STATS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_ADDR_PATTERN { pub MatchHWType: super::super::Foundation::BOOL, pub HWType: u8, pub IsWildcard: super::super::Foundation::BOOL, pub Length: u8, pub Pattern: [u8; 255], } #[cfg(feature = "Win32_Foundation")] impl DHCP_ADDR_PATTERN {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_ADDR_PATTERN { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_ADDR_PATTERN { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_ADDR_PATTERN").field("MatchHWType", &self.MatchHWType).field("HWType", &self.HWType).field("IsWildcard", &self.IsWildcard).field("Length", &self.Length).field("Pattern", &self.Pattern).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_ADDR_PATTERN { fn eq(&self, other: &Self) -> bool { self.MatchHWType == other.MatchHWType && self.HWType == other.HWType && self.IsWildcard == other.IsWildcard && self.Length == other.Length && self.Pattern == other.Pattern } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_ADDR_PATTERN {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_ADDR_PATTERN { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_ALL_OPTIONS { pub Flags: u32, pub NonVendorOptions: *mut DHCP_OPTION_ARRAY, pub NumVendorOptions: u32, pub VendorOptions: *mut DHCP_ALL_OPTIONS_0, } #[cfg(feature = "Win32_Foundation")] impl DHCP_ALL_OPTIONS {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_ALL_OPTIONS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_ALL_OPTIONS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_ALL_OPTIONS").field("Flags", &self.Flags).field("NonVendorOptions", &self.NonVendorOptions).field("NumVendorOptions", &self.NumVendorOptions).field("VendorOptions", &self.VendorOptions).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_ALL_OPTIONS { fn eq(&self, other: &Self) -> bool { self.Flags == other.Flags && self.NonVendorOptions == other.NonVendorOptions && self.NumVendorOptions == other.NumVendorOptions && self.VendorOptions == other.VendorOptions } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_ALL_OPTIONS {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_ALL_OPTIONS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_ALL_OPTIONS_0 { pub Option: DHCP_OPTION, pub VendorName: super::super::Foundation::PWSTR, pub ClassName: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl DHCP_ALL_OPTIONS_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_ALL_OPTIONS_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_ALL_OPTIONS_0 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("_Anonymous_e__Struct").field("Option", &self.Option).field("VendorName", &self.VendorName).field("ClassName", &self.ClassName).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_ALL_OPTIONS_0 { fn eq(&self, other: &Self) -> bool { self.Option == other.Option && self.VendorName == other.VendorName && self.ClassName == other.ClassName } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_ALL_OPTIONS_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_ALL_OPTIONS_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_ALL_OPTION_VALUES { pub Flags: u32, pub NumElements: u32, pub Options: *mut DHCP_ALL_OPTION_VALUES_0, } #[cfg(feature = "Win32_Foundation")] impl DHCP_ALL_OPTION_VALUES {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_ALL_OPTION_VALUES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_ALL_OPTION_VALUES { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_ALL_OPTION_VALUES").field("Flags", &self.Flags).field("NumElements", &self.NumElements).field("Options", &self.Options).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_ALL_OPTION_VALUES { fn eq(&self, other: &Self) -> bool { self.Flags == other.Flags && self.NumElements == other.NumElements && self.Options == other.Options } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_ALL_OPTION_VALUES {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_ALL_OPTION_VALUES { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_ALL_OPTION_VALUES_0 { pub ClassName: super::super::Foundation::PWSTR, pub VendorName: super::super::Foundation::PWSTR, pub IsVendor: super::super::Foundation::BOOL, pub OptionsArray: *mut DHCP_OPTION_VALUE_ARRAY, } #[cfg(feature = "Win32_Foundation")] impl DHCP_ALL_OPTION_VALUES_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_ALL_OPTION_VALUES_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_ALL_OPTION_VALUES_0 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("_Anonymous_e__Struct").field("ClassName", &self.ClassName).field("VendorName", &self.VendorName).field("IsVendor", &self.IsVendor).field("OptionsArray", &self.OptionsArray).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_ALL_OPTION_VALUES_0 { fn eq(&self, other: &Self) -> bool { self.ClassName == other.ClassName && self.VendorName == other.VendorName && self.IsVendor == other.IsVendor && self.OptionsArray == other.OptionsArray } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_ALL_OPTION_VALUES_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_ALL_OPTION_VALUES_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_ALL_OPTION_VALUES_PB { pub Flags: u32, pub NumElements: u32, pub Options: *mut DHCP_ALL_OPTION_VALUES_PB_0, } #[cfg(feature = "Win32_Foundation")] impl DHCP_ALL_OPTION_VALUES_PB {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_ALL_OPTION_VALUES_PB { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_ALL_OPTION_VALUES_PB { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_ALL_OPTION_VALUES_PB").field("Flags", &self.Flags).field("NumElements", &self.NumElements).field("Options", &self.Options).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_ALL_OPTION_VALUES_PB { fn eq(&self, other: &Self) -> bool { self.Flags == other.Flags && self.NumElements == other.NumElements && self.Options == other.Options } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_ALL_OPTION_VALUES_PB {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_ALL_OPTION_VALUES_PB { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_ALL_OPTION_VALUES_PB_0 { pub PolicyName: super::super::Foundation::PWSTR, pub VendorName: super::super::Foundation::PWSTR, pub IsVendor: super::super::Foundation::BOOL, pub OptionsArray: *mut DHCP_OPTION_VALUE_ARRAY, } #[cfg(feature = "Win32_Foundation")] impl DHCP_ALL_OPTION_VALUES_PB_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_ALL_OPTION_VALUES_PB_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_ALL_OPTION_VALUES_PB_0 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("_Anonymous_e__Struct").field("PolicyName", &self.PolicyName).field("VendorName", &self.VendorName).field("IsVendor", &self.IsVendor).field("OptionsArray", &self.OptionsArray).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_ALL_OPTION_VALUES_PB_0 { fn eq(&self, other: &Self) -> bool { self.PolicyName == other.PolicyName && self.VendorName == other.VendorName && self.IsVendor == other.IsVendor && self.OptionsArray == other.OptionsArray } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_ALL_OPTION_VALUES_PB_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_ALL_OPTION_VALUES_PB_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_ATTRIB { pub DhcpAttribId: u32, pub DhcpAttribType: u32, pub Anonymous: DHCP_ATTRIB_0, } #[cfg(feature = "Win32_Foundation")] impl DHCP_ATTRIB {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_ATTRIB { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_ATTRIB { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_ATTRIB {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_ATTRIB { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub union DHCP_ATTRIB_0 { pub DhcpAttribBool: super::super::Foundation::BOOL, pub DhcpAttribUlong: u32, } #[cfg(feature = "Win32_Foundation")] impl DHCP_ATTRIB_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_ATTRIB_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_ATTRIB_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_ATTRIB_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_ATTRIB_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_ATTRIB_ARRAY { pub NumElements: u32, pub DhcpAttribs: *mut DHCP_ATTRIB, } #[cfg(feature = "Win32_Foundation")] impl DHCP_ATTRIB_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_ATTRIB_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_ATTRIB_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_ATTRIB_ARRAY").field("NumElements", &self.NumElements).field("DhcpAttribs", &self.DhcpAttribs).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_ATTRIB_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.DhcpAttribs == other.DhcpAttribs } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_ATTRIB_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_ATTRIB_ARRAY { type Abi = Self; } pub const DHCP_ATTRIB_BOOL_IS_ADMIN: u32 = 5u32; pub const DHCP_ATTRIB_BOOL_IS_BINDING_AWARE: u32 = 4u32; pub const DHCP_ATTRIB_BOOL_IS_DYNBOOTP: u32 = 2u32; pub const DHCP_ATTRIB_BOOL_IS_PART_OF_DSDC: u32 = 3u32; pub const DHCP_ATTRIB_BOOL_IS_ROGUE: u32 = 1u32; pub const DHCP_ATTRIB_TYPE_BOOL: u32 = 1u32; pub const DHCP_ATTRIB_TYPE_ULONG: u32 = 2u32; pub const DHCP_ATTRIB_ULONG_RESTORE_STATUS: u32 = 6u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_BINARY_DATA { pub DataLength: u32, pub Data: *mut u8, } impl DHCP_BINARY_DATA {} impl ::core::default::Default for DHCP_BINARY_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_BINARY_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_BINARY_DATA").field("DataLength", &self.DataLength).field("Data", &self.Data).finish() } } impl ::core::cmp::PartialEq for DHCP_BINARY_DATA { fn eq(&self, other: &Self) -> bool { self.DataLength == other.DataLength && self.Data == other.Data } } impl ::core::cmp::Eq for DHCP_BINARY_DATA {} unsafe impl ::windows::core::Abi for DHCP_BINARY_DATA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_BIND_ELEMENT { pub Flags: u32, pub fBoundToDHCPServer: super::super::Foundation::BOOL, pub AdapterPrimaryAddress: u32, pub AdapterSubnetAddress: u32, pub IfDescription: super::super::Foundation::PWSTR, pub IfIdSize: u32, pub IfId: *mut u8, } #[cfg(feature = "Win32_Foundation")] impl DHCP_BIND_ELEMENT {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_BIND_ELEMENT { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_BIND_ELEMENT { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_BIND_ELEMENT") .field("Flags", &self.Flags) .field("fBoundToDHCPServer", &self.fBoundToDHCPServer) .field("AdapterPrimaryAddress", &self.AdapterPrimaryAddress) .field("AdapterSubnetAddress", &self.AdapterSubnetAddress) .field("IfDescription", &self.IfDescription) .field("IfIdSize", &self.IfIdSize) .field("IfId", &self.IfId) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_BIND_ELEMENT { fn eq(&self, other: &Self) -> bool { self.Flags == other.Flags && self.fBoundToDHCPServer == other.fBoundToDHCPServer && self.AdapterPrimaryAddress == other.AdapterPrimaryAddress && self.AdapterSubnetAddress == other.AdapterSubnetAddress && self.IfDescription == other.IfDescription && self.IfIdSize == other.IfIdSize && self.IfId == other.IfId } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_BIND_ELEMENT {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_BIND_ELEMENT { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_BIND_ELEMENT_ARRAY { pub NumElements: u32, pub Elements: *mut DHCP_BIND_ELEMENT, } #[cfg(feature = "Win32_Foundation")] impl DHCP_BIND_ELEMENT_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_BIND_ELEMENT_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_BIND_ELEMENT_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_BIND_ELEMENT_ARRAY").field("NumElements", &self.NumElements).field("Elements", &self.Elements).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_BIND_ELEMENT_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Elements == other.Elements } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_BIND_ELEMENT_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_BIND_ELEMENT_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_BOOTP_IP_RANGE { pub StartAddress: u32, pub EndAddress: u32, pub BootpAllocated: u32, pub MaxBootpAllowed: u32, } impl DHCP_BOOTP_IP_RANGE {} impl ::core::default::Default for DHCP_BOOTP_IP_RANGE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_BOOTP_IP_RANGE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_BOOTP_IP_RANGE").field("StartAddress", &self.StartAddress).field("EndAddress", &self.EndAddress).field("BootpAllocated", &self.BootpAllocated).field("MaxBootpAllowed", &self.MaxBootpAllowed).finish() } } impl ::core::cmp::PartialEq for DHCP_BOOTP_IP_RANGE { fn eq(&self, other: &Self) -> bool { self.StartAddress == other.StartAddress && self.EndAddress == other.EndAddress && self.BootpAllocated == other.BootpAllocated && self.MaxBootpAllowed == other.MaxBootpAllowed } } impl ::core::cmp::Eq for DHCP_BOOTP_IP_RANGE {} unsafe impl ::windows::core::Abi for DHCP_BOOTP_IP_RANGE { type Abi = Self; } #[derive(:: core :: clone :: Clone)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CALLOUT_TABLE { pub DhcpControlHook: ::core::option::Option<LPDHCP_CONTROL>, pub DhcpNewPktHook: ::core::option::Option<LPDHCP_NEWPKT>, pub DhcpPktDropHook: ::core::option::Option<LPDHCP_DROP_SEND>, pub DhcpPktSendHook: ::core::option::Option<LPDHCP_DROP_SEND>, pub DhcpAddressDelHook: ::core::option::Option<LPDHCP_PROB>, pub DhcpAddressOfferHook: ::core::option::Option<LPDHCP_GIVE_ADDRESS>, pub DhcpHandleOptionsHook: ::core::option::Option<LPDHCP_HANDLE_OPTIONS>, pub DhcpDeleteClientHook: ::core::option::Option<LPDHCP_DELETE_CLIENT>, pub DhcpExtensionHook: *mut ::core::ffi::c_void, pub DhcpReservedHook: *mut ::core::ffi::c_void, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CALLOUT_TABLE {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CALLOUT_TABLE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CALLOUT_TABLE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CALLOUT_TABLE").field("DhcpExtensionHook", &self.DhcpExtensionHook).field("DhcpReservedHook", &self.DhcpReservedHook).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CALLOUT_TABLE { fn eq(&self, other: &Self) -> bool { self.DhcpControlHook.map(|f| f as usize) == other.DhcpControlHook.map(|f| f as usize) && self.DhcpNewPktHook.map(|f| f as usize) == other.DhcpNewPktHook.map(|f| f as usize) && self.DhcpPktDropHook.map(|f| f as usize) == other.DhcpPktDropHook.map(|f| f as usize) && self.DhcpPktSendHook.map(|f| f as usize) == other.DhcpPktSendHook.map(|f| f as usize) && self.DhcpAddressDelHook.map(|f| f as usize) == other.DhcpAddressDelHook.map(|f| f as usize) && self.DhcpAddressOfferHook.map(|f| f as usize) == other.DhcpAddressOfferHook.map(|f| f as usize) && self.DhcpHandleOptionsHook.map(|f| f as usize) == other.DhcpHandleOptionsHook.map(|f| f as usize) && self.DhcpDeleteClientHook.map(|f| f as usize) == other.DhcpDeleteClientHook.map(|f| f as usize) && self.DhcpExtensionHook == other.DhcpExtensionHook && self.DhcpReservedHook == other.DhcpReservedHook } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CALLOUT_TABLE {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CALLOUT_TABLE { type Abi = ::core::mem::ManuallyDrop<Self>; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLASS_INFO { pub ClassName: super::super::Foundation::PWSTR, pub ClassComment: super::super::Foundation::PWSTR, pub ClassDataLength: u32, pub IsVendor: super::super::Foundation::BOOL, pub Flags: u32, pub ClassData: *mut u8, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLASS_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLASS_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLASS_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLASS_INFO").field("ClassName", &self.ClassName).field("ClassComment", &self.ClassComment).field("ClassDataLength", &self.ClassDataLength).field("IsVendor", &self.IsVendor).field("Flags", &self.Flags).field("ClassData", &self.ClassData).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLASS_INFO { fn eq(&self, other: &Self) -> bool { self.ClassName == other.ClassName && self.ClassComment == other.ClassComment && self.ClassDataLength == other.ClassDataLength && self.IsVendor == other.IsVendor && self.Flags == other.Flags && self.ClassData == other.ClassData } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLASS_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLASS_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLASS_INFO_ARRAY { pub NumElements: u32, pub Classes: *mut DHCP_CLASS_INFO, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLASS_INFO_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLASS_INFO_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLASS_INFO_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLASS_INFO_ARRAY").field("NumElements", &self.NumElements).field("Classes", &self.Classes).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLASS_INFO_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Classes == other.Classes } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLASS_INFO_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLASS_INFO_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLASS_INFO_ARRAY_V6 { pub NumElements: u32, pub Classes: *mut DHCP_CLASS_INFO_V6, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLASS_INFO_ARRAY_V6 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLASS_INFO_ARRAY_V6 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLASS_INFO_ARRAY_V6 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLASS_INFO_ARRAY_V6").field("NumElements", &self.NumElements).field("Classes", &self.Classes).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLASS_INFO_ARRAY_V6 { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Classes == other.Classes } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLASS_INFO_ARRAY_V6 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLASS_INFO_ARRAY_V6 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLASS_INFO_V6 { pub ClassName: super::super::Foundation::PWSTR, pub ClassComment: super::super::Foundation::PWSTR, pub ClassDataLength: u32, pub IsVendor: super::super::Foundation::BOOL, pub EnterpriseNumber: u32, pub Flags: u32, pub ClassData: *mut u8, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLASS_INFO_V6 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLASS_INFO_V6 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLASS_INFO_V6 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLASS_INFO_V6") .field("ClassName", &self.ClassName) .field("ClassComment", &self.ClassComment) .field("ClassDataLength", &self.ClassDataLength) .field("IsVendor", &self.IsVendor) .field("EnterpriseNumber", &self.EnterpriseNumber) .field("Flags", &self.Flags) .field("ClassData", &self.ClassData) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLASS_INFO_V6 { fn eq(&self, other: &Self) -> bool { self.ClassName == other.ClassName && self.ClassComment == other.ClassComment && self.ClassDataLength == other.ClassDataLength && self.IsVendor == other.IsVendor && self.EnterpriseNumber == other.EnterpriseNumber && self.Flags == other.Flags && self.ClassData == other.ClassData } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLASS_INFO_V6 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLASS_INFO_V6 { type Abi = Self; } pub const DHCP_CLIENT_BOOTP: u32 = 805306371u32; pub const DHCP_CLIENT_DHCP: u32 = 805306372u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLIENT_FILTER_STATUS_INFO { pub ClientIpAddress: u32, pub SubnetMask: u32, pub ClientHardwareAddress: DHCP_BINARY_DATA, pub ClientName: super::super::Foundation::PWSTR, pub ClientComment: super::super::Foundation::PWSTR, pub ClientLeaseExpires: DATE_TIME, pub OwnerHost: DHCP_HOST_INFO, pub bClientType: u8, pub AddressState: u8, pub Status: QuarantineStatus, pub ProbationEnds: DATE_TIME, pub QuarantineCapable: super::super::Foundation::BOOL, pub FilterStatus: u32, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLIENT_FILTER_STATUS_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLIENT_FILTER_STATUS_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLIENT_FILTER_STATUS_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLIENT_FILTER_STATUS_INFO") .field("ClientIpAddress", &self.ClientIpAddress) .field("SubnetMask", &self.SubnetMask) .field("ClientHardwareAddress", &self.ClientHardwareAddress) .field("ClientName", &self.ClientName) .field("ClientComment", &self.ClientComment) .field("ClientLeaseExpires", &self.ClientLeaseExpires) .field("OwnerHost", &self.OwnerHost) .field("bClientType", &self.bClientType) .field("AddressState", &self.AddressState) .field("Status", &self.Status) .field("ProbationEnds", &self.ProbationEnds) .field("QuarantineCapable", &self.QuarantineCapable) .field("FilterStatus", &self.FilterStatus) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLIENT_FILTER_STATUS_INFO { fn eq(&self, other: &Self) -> bool { self.ClientIpAddress == other.ClientIpAddress && self.SubnetMask == other.SubnetMask && self.ClientHardwareAddress == other.ClientHardwareAddress && self.ClientName == other.ClientName && self.ClientComment == other.ClientComment && self.ClientLeaseExpires == other.ClientLeaseExpires && self.OwnerHost == other.OwnerHost && self.bClientType == other.bClientType && self.AddressState == other.AddressState && self.Status == other.Status && self.ProbationEnds == other.ProbationEnds && self.QuarantineCapable == other.QuarantineCapable && self.FilterStatus == other.FilterStatus } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLIENT_FILTER_STATUS_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLIENT_FILTER_STATUS_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLIENT_FILTER_STATUS_INFO_ARRAY { pub NumElements: u32, pub Clients: *mut *mut DHCP_CLIENT_FILTER_STATUS_INFO, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLIENT_FILTER_STATUS_INFO_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLIENT_FILTER_STATUS_INFO_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLIENT_FILTER_STATUS_INFO_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLIENT_FILTER_STATUS_INFO_ARRAY").field("NumElements", &self.NumElements).field("Clients", &self.Clients).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLIENT_FILTER_STATUS_INFO_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Clients == other.Clients } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLIENT_FILTER_STATUS_INFO_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLIENT_FILTER_STATUS_INFO_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLIENT_INFO { pub ClientIpAddress: u32, pub SubnetMask: u32, pub ClientHardwareAddress: DHCP_BINARY_DATA, pub ClientName: super::super::Foundation::PWSTR, pub ClientComment: super::super::Foundation::PWSTR, pub ClientLeaseExpires: DATE_TIME, pub OwnerHost: DHCP_HOST_INFO, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLIENT_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLIENT_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLIENT_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLIENT_INFO") .field("ClientIpAddress", &self.ClientIpAddress) .field("SubnetMask", &self.SubnetMask) .field("ClientHardwareAddress", &self.ClientHardwareAddress) .field("ClientName", &self.ClientName) .field("ClientComment", &self.ClientComment) .field("ClientLeaseExpires", &self.ClientLeaseExpires) .field("OwnerHost", &self.OwnerHost) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLIENT_INFO { fn eq(&self, other: &Self) -> bool { self.ClientIpAddress == other.ClientIpAddress && self.SubnetMask == other.SubnetMask && self.ClientHardwareAddress == other.ClientHardwareAddress && self.ClientName == other.ClientName && self.ClientComment == other.ClientComment && self.ClientLeaseExpires == other.ClientLeaseExpires && self.OwnerHost == other.OwnerHost } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLIENT_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLIENT_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLIENT_INFO_ARRAY { pub NumElements: u32, pub Clients: *mut *mut DHCP_CLIENT_INFO, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLIENT_INFO_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLIENT_INFO_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLIENT_INFO_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLIENT_INFO_ARRAY").field("NumElements", &self.NumElements).field("Clients", &self.Clients).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLIENT_INFO_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Clients == other.Clients } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLIENT_INFO_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLIENT_INFO_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLIENT_INFO_ARRAY_V4 { pub NumElements: u32, pub Clients: *mut *mut DHCP_CLIENT_INFO_V4, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLIENT_INFO_ARRAY_V4 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLIENT_INFO_ARRAY_V4 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLIENT_INFO_ARRAY_V4 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLIENT_INFO_ARRAY_V4").field("NumElements", &self.NumElements).field("Clients", &self.Clients).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLIENT_INFO_ARRAY_V4 { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Clients == other.Clients } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLIENT_INFO_ARRAY_V4 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLIENT_INFO_ARRAY_V4 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLIENT_INFO_ARRAY_V5 { pub NumElements: u32, pub Clients: *mut *mut DHCP_CLIENT_INFO_V5, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLIENT_INFO_ARRAY_V5 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLIENT_INFO_ARRAY_V5 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLIENT_INFO_ARRAY_V5 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLIENT_INFO_ARRAY_V5").field("NumElements", &self.NumElements).field("Clients", &self.Clients).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLIENT_INFO_ARRAY_V5 { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Clients == other.Clients } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLIENT_INFO_ARRAY_V5 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLIENT_INFO_ARRAY_V5 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLIENT_INFO_ARRAY_V6 { pub NumElements: u32, pub Clients: *mut *mut DHCP_CLIENT_INFO_V6, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLIENT_INFO_ARRAY_V6 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLIENT_INFO_ARRAY_V6 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLIENT_INFO_ARRAY_V6 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLIENT_INFO_ARRAY_V6").field("NumElements", &self.NumElements).field("Clients", &self.Clients).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLIENT_INFO_ARRAY_V6 { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Clients == other.Clients } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLIENT_INFO_ARRAY_V6 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLIENT_INFO_ARRAY_V6 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLIENT_INFO_ARRAY_VQ { pub NumElements: u32, pub Clients: *mut *mut DHCP_CLIENT_INFO_VQ, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLIENT_INFO_ARRAY_VQ {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLIENT_INFO_ARRAY_VQ { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLIENT_INFO_ARRAY_VQ { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLIENT_INFO_ARRAY_VQ").field("NumElements", &self.NumElements).field("Clients", &self.Clients).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLIENT_INFO_ARRAY_VQ { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Clients == other.Clients } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLIENT_INFO_ARRAY_VQ {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLIENT_INFO_ARRAY_VQ { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLIENT_INFO_EX { pub ClientIpAddress: u32, pub SubnetMask: u32, pub ClientHardwareAddress: DHCP_BINARY_DATA, pub ClientName: super::super::Foundation::PWSTR, pub ClientComment: super::super::Foundation::PWSTR, pub ClientLeaseExpires: DATE_TIME, pub OwnerHost: DHCP_HOST_INFO, pub bClientType: u8, pub AddressState: u8, pub Status: QuarantineStatus, pub ProbationEnds: DATE_TIME, pub QuarantineCapable: super::super::Foundation::BOOL, pub FilterStatus: u32, pub PolicyName: super::super::Foundation::PWSTR, pub Properties: *mut DHCP_PROPERTY_ARRAY, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLIENT_INFO_EX {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLIENT_INFO_EX { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLIENT_INFO_EX { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLIENT_INFO_EX") .field("ClientIpAddress", &self.ClientIpAddress) .field("SubnetMask", &self.SubnetMask) .field("ClientHardwareAddress", &self.ClientHardwareAddress) .field("ClientName", &self.ClientName) .field("ClientComment", &self.ClientComment) .field("ClientLeaseExpires", &self.ClientLeaseExpires) .field("OwnerHost", &self.OwnerHost) .field("bClientType", &self.bClientType) .field("AddressState", &self.AddressState) .field("Status", &self.Status) .field("ProbationEnds", &self.ProbationEnds) .field("QuarantineCapable", &self.QuarantineCapable) .field("FilterStatus", &self.FilterStatus) .field("PolicyName", &self.PolicyName) .field("Properties", &self.Properties) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLIENT_INFO_EX { fn eq(&self, other: &Self) -> bool { self.ClientIpAddress == other.ClientIpAddress && self.SubnetMask == other.SubnetMask && self.ClientHardwareAddress == other.ClientHardwareAddress && self.ClientName == other.ClientName && self.ClientComment == other.ClientComment && self.ClientLeaseExpires == other.ClientLeaseExpires && self.OwnerHost == other.OwnerHost && self.bClientType == other.bClientType && self.AddressState == other.AddressState && self.Status == other.Status && self.ProbationEnds == other.ProbationEnds && self.QuarantineCapable == other.QuarantineCapable && self.FilterStatus == other.FilterStatus && self.PolicyName == other.PolicyName && self.Properties == other.Properties } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLIENT_INFO_EX {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLIENT_INFO_EX { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLIENT_INFO_EX_ARRAY { pub NumElements: u32, pub Clients: *mut *mut DHCP_CLIENT_INFO_EX, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLIENT_INFO_EX_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLIENT_INFO_EX_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLIENT_INFO_EX_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLIENT_INFO_EX_ARRAY").field("NumElements", &self.NumElements).field("Clients", &self.Clients).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLIENT_INFO_EX_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Clients == other.Clients } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLIENT_INFO_EX_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLIENT_INFO_EX_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLIENT_INFO_PB { pub ClientIpAddress: u32, pub SubnetMask: u32, pub ClientHardwareAddress: DHCP_BINARY_DATA, pub ClientName: super::super::Foundation::PWSTR, pub ClientComment: super::super::Foundation::PWSTR, pub ClientLeaseExpires: DATE_TIME, pub OwnerHost: DHCP_HOST_INFO, pub bClientType: u8, pub AddressState: u8, pub Status: QuarantineStatus, pub ProbationEnds: DATE_TIME, pub QuarantineCapable: super::super::Foundation::BOOL, pub FilterStatus: u32, pub PolicyName: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLIENT_INFO_PB {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLIENT_INFO_PB { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLIENT_INFO_PB { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLIENT_INFO_PB") .field("ClientIpAddress", &self.ClientIpAddress) .field("SubnetMask", &self.SubnetMask) .field("ClientHardwareAddress", &self.ClientHardwareAddress) .field("ClientName", &self.ClientName) .field("ClientComment", &self.ClientComment) .field("ClientLeaseExpires", &self.ClientLeaseExpires) .field("OwnerHost", &self.OwnerHost) .field("bClientType", &self.bClientType) .field("AddressState", &self.AddressState) .field("Status", &self.Status) .field("ProbationEnds", &self.ProbationEnds) .field("QuarantineCapable", &self.QuarantineCapable) .field("FilterStatus", &self.FilterStatus) .field("PolicyName", &self.PolicyName) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLIENT_INFO_PB { fn eq(&self, other: &Self) -> bool { self.ClientIpAddress == other.ClientIpAddress && self.SubnetMask == other.SubnetMask && self.ClientHardwareAddress == other.ClientHardwareAddress && self.ClientName == other.ClientName && self.ClientComment == other.ClientComment && self.ClientLeaseExpires == other.ClientLeaseExpires && self.OwnerHost == other.OwnerHost && self.bClientType == other.bClientType && self.AddressState == other.AddressState && self.Status == other.Status && self.ProbationEnds == other.ProbationEnds && self.QuarantineCapable == other.QuarantineCapable && self.FilterStatus == other.FilterStatus && self.PolicyName == other.PolicyName } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLIENT_INFO_PB {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLIENT_INFO_PB { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLIENT_INFO_PB_ARRAY { pub NumElements: u32, pub Clients: *mut *mut DHCP_CLIENT_INFO_PB, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLIENT_INFO_PB_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLIENT_INFO_PB_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLIENT_INFO_PB_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLIENT_INFO_PB_ARRAY").field("NumElements", &self.NumElements).field("Clients", &self.Clients).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLIENT_INFO_PB_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Clients == other.Clients } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLIENT_INFO_PB_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLIENT_INFO_PB_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLIENT_INFO_V4 { pub ClientIpAddress: u32, pub SubnetMask: u32, pub ClientHardwareAddress: DHCP_BINARY_DATA, pub ClientName: super::super::Foundation::PWSTR, pub ClientComment: super::super::Foundation::PWSTR, pub ClientLeaseExpires: DATE_TIME, pub OwnerHost: DHCP_HOST_INFO, pub bClientType: u8, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLIENT_INFO_V4 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLIENT_INFO_V4 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLIENT_INFO_V4 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLIENT_INFO_V4") .field("ClientIpAddress", &self.ClientIpAddress) .field("SubnetMask", &self.SubnetMask) .field("ClientHardwareAddress", &self.ClientHardwareAddress) .field("ClientName", &self.ClientName) .field("ClientComment", &self.ClientComment) .field("ClientLeaseExpires", &self.ClientLeaseExpires) .field("OwnerHost", &self.OwnerHost) .field("bClientType", &self.bClientType) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLIENT_INFO_V4 { fn eq(&self, other: &Self) -> bool { self.ClientIpAddress == other.ClientIpAddress && self.SubnetMask == other.SubnetMask && self.ClientHardwareAddress == other.ClientHardwareAddress && self.ClientName == other.ClientName && self.ClientComment == other.ClientComment && self.ClientLeaseExpires == other.ClientLeaseExpires && self.OwnerHost == other.OwnerHost && self.bClientType == other.bClientType } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLIENT_INFO_V4 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLIENT_INFO_V4 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLIENT_INFO_V5 { pub ClientIpAddress: u32, pub SubnetMask: u32, pub ClientHardwareAddress: DHCP_BINARY_DATA, pub ClientName: super::super::Foundation::PWSTR, pub ClientComment: super::super::Foundation::PWSTR, pub ClientLeaseExpires: DATE_TIME, pub OwnerHost: DHCP_HOST_INFO, pub bClientType: u8, pub AddressState: u8, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLIENT_INFO_V5 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLIENT_INFO_V5 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLIENT_INFO_V5 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLIENT_INFO_V5") .field("ClientIpAddress", &self.ClientIpAddress) .field("SubnetMask", &self.SubnetMask) .field("ClientHardwareAddress", &self.ClientHardwareAddress) .field("ClientName", &self.ClientName) .field("ClientComment", &self.ClientComment) .field("ClientLeaseExpires", &self.ClientLeaseExpires) .field("OwnerHost", &self.OwnerHost) .field("bClientType", &self.bClientType) .field("AddressState", &self.AddressState) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLIENT_INFO_V5 { fn eq(&self, other: &Self) -> bool { self.ClientIpAddress == other.ClientIpAddress && self.SubnetMask == other.SubnetMask && self.ClientHardwareAddress == other.ClientHardwareAddress && self.ClientName == other.ClientName && self.ClientComment == other.ClientComment && self.ClientLeaseExpires == other.ClientLeaseExpires && self.OwnerHost == other.OwnerHost && self.bClientType == other.bClientType && self.AddressState == other.AddressState } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLIENT_INFO_V5 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLIENT_INFO_V5 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLIENT_INFO_V6 { pub ClientIpAddress: DHCP_IPV6_ADDRESS, pub ClientDUID: DHCP_BINARY_DATA, pub AddressType: u32, pub IAID: u32, pub ClientName: super::super::Foundation::PWSTR, pub ClientComment: super::super::Foundation::PWSTR, pub ClientValidLeaseExpires: DATE_TIME, pub ClientPrefLeaseExpires: DATE_TIME, pub OwnerHost: DHCP_HOST_INFO_V6, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLIENT_INFO_V6 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLIENT_INFO_V6 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLIENT_INFO_V6 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLIENT_INFO_V6") .field("ClientIpAddress", &self.ClientIpAddress) .field("ClientDUID", &self.ClientDUID) .field("AddressType", &self.AddressType) .field("IAID", &self.IAID) .field("ClientName", &self.ClientName) .field("ClientComment", &self.ClientComment) .field("ClientValidLeaseExpires", &self.ClientValidLeaseExpires) .field("ClientPrefLeaseExpires", &self.ClientPrefLeaseExpires) .field("OwnerHost", &self.OwnerHost) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLIENT_INFO_V6 { fn eq(&self, other: &Self) -> bool { self.ClientIpAddress == other.ClientIpAddress && self.ClientDUID == other.ClientDUID && self.AddressType == other.AddressType && self.IAID == other.IAID && self.ClientName == other.ClientName && self.ClientComment == other.ClientComment && self.ClientValidLeaseExpires == other.ClientValidLeaseExpires && self.ClientPrefLeaseExpires == other.ClientPrefLeaseExpires && self.OwnerHost == other.OwnerHost } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLIENT_INFO_V6 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLIENT_INFO_V6 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_CLIENT_INFO_VQ { pub ClientIpAddress: u32, pub SubnetMask: u32, pub ClientHardwareAddress: DHCP_BINARY_DATA, pub ClientName: super::super::Foundation::PWSTR, pub ClientComment: super::super::Foundation::PWSTR, pub ClientLeaseExpires: DATE_TIME, pub OwnerHost: DHCP_HOST_INFO, pub bClientType: u8, pub AddressState: u8, pub Status: QuarantineStatus, pub ProbationEnds: DATE_TIME, pub QuarantineCapable: super::super::Foundation::BOOL, } #[cfg(feature = "Win32_Foundation")] impl DHCP_CLIENT_INFO_VQ {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_CLIENT_INFO_VQ { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_CLIENT_INFO_VQ { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_CLIENT_INFO_VQ") .field("ClientIpAddress", &self.ClientIpAddress) .field("SubnetMask", &self.SubnetMask) .field("ClientHardwareAddress", &self.ClientHardwareAddress) .field("ClientName", &self.ClientName) .field("ClientComment", &self.ClientComment) .field("ClientLeaseExpires", &self.ClientLeaseExpires) .field("OwnerHost", &self.OwnerHost) .field("bClientType", &self.bClientType) .field("AddressState", &self.AddressState) .field("Status", &self.Status) .field("ProbationEnds", &self.ProbationEnds) .field("QuarantineCapable", &self.QuarantineCapable) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_CLIENT_INFO_VQ { fn eq(&self, other: &Self) -> bool { self.ClientIpAddress == other.ClientIpAddress && self.SubnetMask == other.SubnetMask && self.ClientHardwareAddress == other.ClientHardwareAddress && self.ClientName == other.ClientName && self.ClientComment == other.ClientComment && self.ClientLeaseExpires == other.ClientLeaseExpires && self.OwnerHost == other.OwnerHost && self.bClientType == other.bClientType && self.AddressState == other.AddressState && self.Status == other.Status && self.ProbationEnds == other.ProbationEnds && self.QuarantineCapable == other.QuarantineCapable } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_CLIENT_INFO_VQ {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_CLIENT_INFO_VQ { type Abi = Self; } #[repr(C)] #[derive(:: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy)] pub struct DHCP_CLIENT_SEARCH_UNION(pub u8); pub const DHCP_CONTROL_CONTINUE: u32 = 4u32; pub const DHCP_CONTROL_PAUSE: u32 = 3u32; pub const DHCP_CONTROL_START: u32 = 1u32; pub const DHCP_CONTROL_STOP: u32 = 2u32; pub const DHCP_DROP_DUPLICATE: u32 = 1u32; pub const DHCP_DROP_GEN_FAILURE: u32 = 256u32; pub const DHCP_DROP_INTERNAL_ERROR: u32 = 3u32; pub const DHCP_DROP_INVALID: u32 = 8u32; pub const DHCP_DROP_NOADDRESS: u32 = 10u32; pub const DHCP_DROP_NOMEM: u32 = 2u32; pub const DHCP_DROP_NO_SUBNETS: u32 = 7u32; pub const DHCP_DROP_PAUSED: u32 = 6u32; pub const DHCP_DROP_PROCESSED: u32 = 11u32; pub const DHCP_DROP_TIMEOUT: u32 = 4u32; pub const DHCP_DROP_UNAUTH: u32 = 5u32; pub const DHCP_DROP_WRONG_SERVER: u32 = 9u32; pub const DHCP_ENDPOINT_FLAG_CANT_MODIFY: u32 = 1u32; pub const DHCP_FAILOVER_DELETE_SCOPES: u32 = 1u32; pub const DHCP_FAILOVER_MAX_NUM_ADD_SCOPES: u32 = 400u32; pub const DHCP_FAILOVER_MAX_NUM_REL: u32 = 31u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DHCP_FAILOVER_MODE(pub i32); pub const LoadBalance: DHCP_FAILOVER_MODE = DHCP_FAILOVER_MODE(0i32); pub const HotStandby: DHCP_FAILOVER_MODE = DHCP_FAILOVER_MODE(1i32); impl ::core::convert::From<i32> for DHCP_FAILOVER_MODE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_FAILOVER_MODE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_FAILOVER_RELATIONSHIP { pub PrimaryServer: u32, pub SecondaryServer: u32, pub Mode: DHCP_FAILOVER_MODE, pub ServerType: DHCP_FAILOVER_SERVER, pub State: FSM_STATE, pub PrevState: FSM_STATE, pub Mclt: u32, pub SafePeriod: u32, pub RelationshipName: super::super::Foundation::PWSTR, pub PrimaryServerName: super::super::Foundation::PWSTR, pub SecondaryServerName: super::super::Foundation::PWSTR, pub pScopes: *mut DHCP_IP_ARRAY, pub Percentage: u8, pub SharedSecret: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl DHCP_FAILOVER_RELATIONSHIP {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_FAILOVER_RELATIONSHIP { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_FAILOVER_RELATIONSHIP { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_FAILOVER_RELATIONSHIP") .field("PrimaryServer", &self.PrimaryServer) .field("SecondaryServer", &self.SecondaryServer) .field("Mode", &self.Mode) .field("ServerType", &self.ServerType) .field("State", &self.State) .field("PrevState", &self.PrevState) .field("Mclt", &self.Mclt) .field("SafePeriod", &self.SafePeriod) .field("RelationshipName", &self.RelationshipName) .field("PrimaryServerName", &self.PrimaryServerName) .field("SecondaryServerName", &self.SecondaryServerName) .field("pScopes", &self.pScopes) .field("Percentage", &self.Percentage) .field("SharedSecret", &self.SharedSecret) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_FAILOVER_RELATIONSHIP { fn eq(&self, other: &Self) -> bool { self.PrimaryServer == other.PrimaryServer && self.SecondaryServer == other.SecondaryServer && self.Mode == other.Mode && self.ServerType == other.ServerType && self.State == other.State && self.PrevState == other.PrevState && self.Mclt == other.Mclt && self.SafePeriod == other.SafePeriod && self.RelationshipName == other.RelationshipName && self.PrimaryServerName == other.PrimaryServerName && self.SecondaryServerName == other.SecondaryServerName && self.pScopes == other.pScopes && self.Percentage == other.Percentage && self.SharedSecret == other.SharedSecret } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_FAILOVER_RELATIONSHIP {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_FAILOVER_RELATIONSHIP { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_FAILOVER_RELATIONSHIP_ARRAY { pub NumElements: u32, pub pRelationships: *mut DHCP_FAILOVER_RELATIONSHIP, } #[cfg(feature = "Win32_Foundation")] impl DHCP_FAILOVER_RELATIONSHIP_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_FAILOVER_RELATIONSHIP_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_FAILOVER_RELATIONSHIP_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_FAILOVER_RELATIONSHIP_ARRAY").field("NumElements", &self.NumElements).field("pRelationships", &self.pRelationships).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_FAILOVER_RELATIONSHIP_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.pRelationships == other.pRelationships } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_FAILOVER_RELATIONSHIP_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_FAILOVER_RELATIONSHIP_ARRAY { 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 DHCP_FAILOVER_SERVER(pub i32); pub const PrimaryServer: DHCP_FAILOVER_SERVER = DHCP_FAILOVER_SERVER(0i32); pub const SecondaryServer: DHCP_FAILOVER_SERVER = DHCP_FAILOVER_SERVER(1i32); impl ::core::convert::From<i32> for DHCP_FAILOVER_SERVER { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_FAILOVER_SERVER { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_FAILOVER_STATISTICS { pub NumAddr: u32, pub AddrFree: u32, pub AddrInUse: u32, pub PartnerAddrFree: u32, pub ThisAddrFree: u32, pub PartnerAddrInUse: u32, pub ThisAddrInUse: u32, } impl DHCP_FAILOVER_STATISTICS {} impl ::core::default::Default for DHCP_FAILOVER_STATISTICS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_FAILOVER_STATISTICS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_FAILOVER_STATISTICS") .field("NumAddr", &self.NumAddr) .field("AddrFree", &self.AddrFree) .field("AddrInUse", &self.AddrInUse) .field("PartnerAddrFree", &self.PartnerAddrFree) .field("ThisAddrFree", &self.ThisAddrFree) .field("PartnerAddrInUse", &self.PartnerAddrInUse) .field("ThisAddrInUse", &self.ThisAddrInUse) .finish() } } impl ::core::cmp::PartialEq for DHCP_FAILOVER_STATISTICS { fn eq(&self, other: &Self) -> bool { self.NumAddr == other.NumAddr && self.AddrFree == other.AddrFree && self.AddrInUse == other.AddrInUse && self.PartnerAddrFree == other.PartnerAddrFree && self.ThisAddrFree == other.ThisAddrFree && self.PartnerAddrInUse == other.PartnerAddrInUse && self.ThisAddrInUse == other.ThisAddrInUse } } impl ::core::cmp::Eq for DHCP_FAILOVER_STATISTICS {} unsafe impl ::windows::core::Abi for DHCP_FAILOVER_STATISTICS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_FILTER_ADD_INFO { pub AddrPatt: DHCP_ADDR_PATTERN, pub Comment: super::super::Foundation::PWSTR, pub ListType: DHCP_FILTER_LIST_TYPE, } #[cfg(feature = "Win32_Foundation")] impl DHCP_FILTER_ADD_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_FILTER_ADD_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_FILTER_ADD_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_FILTER_ADD_INFO").field("AddrPatt", &self.AddrPatt).field("Comment", &self.Comment).field("ListType", &self.ListType).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_FILTER_ADD_INFO { fn eq(&self, other: &Self) -> bool { self.AddrPatt == other.AddrPatt && self.Comment == other.Comment && self.ListType == other.ListType } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_FILTER_ADD_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_FILTER_ADD_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_FILTER_ENUM_INFO { pub NumElements: u32, pub pEnumRecords: *mut DHCP_FILTER_RECORD, } #[cfg(feature = "Win32_Foundation")] impl DHCP_FILTER_ENUM_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_FILTER_ENUM_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_FILTER_ENUM_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_FILTER_ENUM_INFO").field("NumElements", &self.NumElements).field("pEnumRecords", &self.pEnumRecords).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_FILTER_ENUM_INFO { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.pEnumRecords == other.pEnumRecords } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_FILTER_ENUM_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_FILTER_ENUM_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_FILTER_GLOBAL_INFO { pub EnforceAllowList: super::super::Foundation::BOOL, pub EnforceDenyList: super::super::Foundation::BOOL, } #[cfg(feature = "Win32_Foundation")] impl DHCP_FILTER_GLOBAL_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_FILTER_GLOBAL_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_FILTER_GLOBAL_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_FILTER_GLOBAL_INFO").field("EnforceAllowList", &self.EnforceAllowList).field("EnforceDenyList", &self.EnforceDenyList).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_FILTER_GLOBAL_INFO { fn eq(&self, other: &Self) -> bool { self.EnforceAllowList == other.EnforceAllowList && self.EnforceDenyList == other.EnforceDenyList } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_FILTER_GLOBAL_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_FILTER_GLOBAL_INFO { 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 DHCP_FILTER_LIST_TYPE(pub i32); pub const Deny: DHCP_FILTER_LIST_TYPE = DHCP_FILTER_LIST_TYPE(0i32); pub const Allow: DHCP_FILTER_LIST_TYPE = DHCP_FILTER_LIST_TYPE(1i32); impl ::core::convert::From<i32> for DHCP_FILTER_LIST_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_FILTER_LIST_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_FILTER_RECORD { pub AddrPatt: DHCP_ADDR_PATTERN, pub Comment: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl DHCP_FILTER_RECORD {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_FILTER_RECORD { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_FILTER_RECORD { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_FILTER_RECORD").field("AddrPatt", &self.AddrPatt).field("Comment", &self.Comment).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_FILTER_RECORD { fn eq(&self, other: &Self) -> bool { self.AddrPatt == other.AddrPatt && self.Comment == other.Comment } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_FILTER_RECORD {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_FILTER_RECORD { type Abi = Self; } pub const DHCP_FLAGS_DONT_ACCESS_DS: u32 = 1u32; pub const DHCP_FLAGS_DONT_DO_RPC: u32 = 2u32; pub const DHCP_FLAGS_OPTION_IS_VENDOR: u32 = 3u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DHCP_FORCE_FLAG(pub i32); pub const DhcpFullForce: DHCP_FORCE_FLAG = DHCP_FORCE_FLAG(0i32); pub const DhcpNoForce: DHCP_FORCE_FLAG = DHCP_FORCE_FLAG(1i32); pub const DhcpFailoverForce: DHCP_FORCE_FLAG = DHCP_FORCE_FLAG(2i32); impl ::core::convert::From<i32> for DHCP_FORCE_FLAG { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_FORCE_FLAG { type Abi = Self; } pub const DHCP_GIVE_ADDRESS_NEW: u32 = 805306369u32; pub const DHCP_GIVE_ADDRESS_OLD: u32 = 805306370u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_HOST_INFO { pub IpAddress: u32, pub NetBiosName: super::super::Foundation::PWSTR, pub HostName: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl DHCP_HOST_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_HOST_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_HOST_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_HOST_INFO").field("IpAddress", &self.IpAddress).field("NetBiosName", &self.NetBiosName).field("HostName", &self.HostName).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_HOST_INFO { fn eq(&self, other: &Self) -> bool { self.IpAddress == other.IpAddress && self.NetBiosName == other.NetBiosName && self.HostName == other.HostName } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_HOST_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_HOST_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_HOST_INFO_V6 { pub IpAddress: DHCP_IPV6_ADDRESS, pub NetBiosName: super::super::Foundation::PWSTR, pub HostName: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl DHCP_HOST_INFO_V6 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_HOST_INFO_V6 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_HOST_INFO_V6 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_HOST_INFO_V6").field("IpAddress", &self.IpAddress).field("NetBiosName", &self.NetBiosName).field("HostName", &self.HostName).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_HOST_INFO_V6 { fn eq(&self, other: &Self) -> bool { self.IpAddress == other.IpAddress && self.NetBiosName == other.NetBiosName && self.HostName == other.HostName } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_HOST_INFO_V6 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_HOST_INFO_V6 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_IPV6_ADDRESS { pub HighOrderBits: u64, pub LowOrderBits: u64, } impl DHCP_IPV6_ADDRESS {} impl ::core::default::Default for DHCP_IPV6_ADDRESS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_IPV6_ADDRESS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_IPV6_ADDRESS").field("HighOrderBits", &self.HighOrderBits).field("LowOrderBits", &self.LowOrderBits).finish() } } impl ::core::cmp::PartialEq for DHCP_IPV6_ADDRESS { fn eq(&self, other: &Self) -> bool { self.HighOrderBits == other.HighOrderBits && self.LowOrderBits == other.LowOrderBits } } impl ::core::cmp::Eq for DHCP_IPV6_ADDRESS {} unsafe impl ::windows::core::Abi for DHCP_IPV6_ADDRESS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_IP_ARRAY { pub NumElements: u32, pub Elements: *mut u32, } impl DHCP_IP_ARRAY {} impl ::core::default::Default for DHCP_IP_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_IP_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_IP_ARRAY").field("NumElements", &self.NumElements).field("Elements", &self.Elements).finish() } } impl ::core::cmp::PartialEq for DHCP_IP_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Elements == other.Elements } } impl ::core::cmp::Eq for DHCP_IP_ARRAY {} unsafe impl ::windows::core::Abi for DHCP_IP_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_IP_CLUSTER { pub ClusterAddress: u32, pub ClusterMask: u32, } impl DHCP_IP_CLUSTER {} impl ::core::default::Default for DHCP_IP_CLUSTER { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_IP_CLUSTER { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_IP_CLUSTER").field("ClusterAddress", &self.ClusterAddress).field("ClusterMask", &self.ClusterMask).finish() } } impl ::core::cmp::PartialEq for DHCP_IP_CLUSTER { fn eq(&self, other: &Self) -> bool { self.ClusterAddress == other.ClusterAddress && self.ClusterMask == other.ClusterMask } } impl ::core::cmp::Eq for DHCP_IP_CLUSTER {} unsafe impl ::windows::core::Abi for DHCP_IP_CLUSTER { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_IP_RANGE { pub StartAddress: u32, pub EndAddress: u32, } impl DHCP_IP_RANGE {} impl ::core::default::Default for DHCP_IP_RANGE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_IP_RANGE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_IP_RANGE").field("StartAddress", &self.StartAddress).field("EndAddress", &self.EndAddress).finish() } } impl ::core::cmp::PartialEq for DHCP_IP_RANGE { fn eq(&self, other: &Self) -> bool { self.StartAddress == other.StartAddress && self.EndAddress == other.EndAddress } } impl ::core::cmp::Eq for DHCP_IP_RANGE {} unsafe impl ::windows::core::Abi for DHCP_IP_RANGE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_IP_RANGE_ARRAY { pub NumElements: u32, pub Elements: *mut DHCP_IP_RANGE, } impl DHCP_IP_RANGE_ARRAY {} impl ::core::default::Default for DHCP_IP_RANGE_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_IP_RANGE_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_IP_RANGE_ARRAY").field("NumElements", &self.NumElements).field("Elements", &self.Elements).finish() } } impl ::core::cmp::PartialEq for DHCP_IP_RANGE_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Elements == other.Elements } } impl ::core::cmp::Eq for DHCP_IP_RANGE_ARRAY {} unsafe impl ::windows::core::Abi for DHCP_IP_RANGE_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_IP_RANGE_V6 { pub StartAddress: DHCP_IPV6_ADDRESS, pub EndAddress: DHCP_IPV6_ADDRESS, } impl DHCP_IP_RANGE_V6 {} impl ::core::default::Default for DHCP_IP_RANGE_V6 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_IP_RANGE_V6 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_IP_RANGE_V6").field("StartAddress", &self.StartAddress).field("EndAddress", &self.EndAddress).finish() } } impl ::core::cmp::PartialEq for DHCP_IP_RANGE_V6 { fn eq(&self, other: &Self) -> bool { self.StartAddress == other.StartAddress && self.EndAddress == other.EndAddress } } impl ::core::cmp::Eq for DHCP_IP_RANGE_V6 {} unsafe impl ::windows::core::Abi for DHCP_IP_RANGE_V6 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_IP_RESERVATION { pub ReservedIpAddress: u32, pub ReservedForClient: *mut DHCP_BINARY_DATA, } impl DHCP_IP_RESERVATION {} impl ::core::default::Default for DHCP_IP_RESERVATION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_IP_RESERVATION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_IP_RESERVATION").field("ReservedIpAddress", &self.ReservedIpAddress).field("ReservedForClient", &self.ReservedForClient).finish() } } impl ::core::cmp::PartialEq for DHCP_IP_RESERVATION { fn eq(&self, other: &Self) -> bool { self.ReservedIpAddress == other.ReservedIpAddress && self.ReservedForClient == other.ReservedForClient } } impl ::core::cmp::Eq for DHCP_IP_RESERVATION {} unsafe impl ::windows::core::Abi for DHCP_IP_RESERVATION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_IP_RESERVATION_INFO { pub ReservedIpAddress: u32, pub ReservedForClient: DHCP_BINARY_DATA, pub ReservedClientName: super::super::Foundation::PWSTR, pub ReservedClientDesc: super::super::Foundation::PWSTR, pub bAllowedClientTypes: u8, pub fOptionsPresent: u8, } #[cfg(feature = "Win32_Foundation")] impl DHCP_IP_RESERVATION_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_IP_RESERVATION_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_IP_RESERVATION_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_IP_RESERVATION_INFO") .field("ReservedIpAddress", &self.ReservedIpAddress) .field("ReservedForClient", &self.ReservedForClient) .field("ReservedClientName", &self.ReservedClientName) .field("ReservedClientDesc", &self.ReservedClientDesc) .field("bAllowedClientTypes", &self.bAllowedClientTypes) .field("fOptionsPresent", &self.fOptionsPresent) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_IP_RESERVATION_INFO { fn eq(&self, other: &Self) -> bool { self.ReservedIpAddress == other.ReservedIpAddress && self.ReservedForClient == other.ReservedForClient && self.ReservedClientName == other.ReservedClientName && self.ReservedClientDesc == other.ReservedClientDesc && self.bAllowedClientTypes == other.bAllowedClientTypes && self.fOptionsPresent == other.fOptionsPresent } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_IP_RESERVATION_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_IP_RESERVATION_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_IP_RESERVATION_V4 { pub ReservedIpAddress: u32, pub ReservedForClient: *mut DHCP_BINARY_DATA, pub bAllowedClientTypes: u8, } impl DHCP_IP_RESERVATION_V4 {} impl ::core::default::Default for DHCP_IP_RESERVATION_V4 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_IP_RESERVATION_V4 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_IP_RESERVATION_V4").field("ReservedIpAddress", &self.ReservedIpAddress).field("ReservedForClient", &self.ReservedForClient).field("bAllowedClientTypes", &self.bAllowedClientTypes).finish() } } impl ::core::cmp::PartialEq for DHCP_IP_RESERVATION_V4 { fn eq(&self, other: &Self) -> bool { self.ReservedIpAddress == other.ReservedIpAddress && self.ReservedForClient == other.ReservedForClient && self.bAllowedClientTypes == other.bAllowedClientTypes } } impl ::core::cmp::Eq for DHCP_IP_RESERVATION_V4 {} unsafe impl ::windows::core::Abi for DHCP_IP_RESERVATION_V4 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_IP_RESERVATION_V6 { pub ReservedIpAddress: DHCP_IPV6_ADDRESS, pub ReservedForClient: *mut DHCP_BINARY_DATA, pub InterfaceId: u32, } impl DHCP_IP_RESERVATION_V6 {} impl ::core::default::Default for DHCP_IP_RESERVATION_V6 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_IP_RESERVATION_V6 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_IP_RESERVATION_V6").field("ReservedIpAddress", &self.ReservedIpAddress).field("ReservedForClient", &self.ReservedForClient).field("InterfaceId", &self.InterfaceId).finish() } } impl ::core::cmp::PartialEq for DHCP_IP_RESERVATION_V6 { fn eq(&self, other: &Self) -> bool { self.ReservedIpAddress == other.ReservedIpAddress && self.ReservedForClient == other.ReservedForClient && self.InterfaceId == other.InterfaceId } } impl ::core::cmp::Eq for DHCP_IP_RESERVATION_V6 {} unsafe impl ::windows::core::Abi for DHCP_IP_RESERVATION_V6 { type Abi = Self; } pub const DHCP_MAX_DELAY: u32 = 1000u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_MIB_INFO { pub Discovers: u32, pub Offers: u32, pub Requests: u32, pub Acks: u32, pub Naks: u32, pub Declines: u32, pub Releases: u32, pub ServerStartTime: DATE_TIME, pub Scopes: u32, pub ScopeInfo: *mut SCOPE_MIB_INFO, } impl DHCP_MIB_INFO {} impl ::core::default::Default for DHCP_MIB_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_MIB_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_MIB_INFO") .field("Discovers", &self.Discovers) .field("Offers", &self.Offers) .field("Requests", &self.Requests) .field("Acks", &self.Acks) .field("Naks", &self.Naks) .field("Declines", &self.Declines) .field("Releases", &self.Releases) .field("ServerStartTime", &self.ServerStartTime) .field("Scopes", &self.Scopes) .field("ScopeInfo", &self.ScopeInfo) .finish() } } impl ::core::cmp::PartialEq for DHCP_MIB_INFO { fn eq(&self, other: &Self) -> bool { self.Discovers == other.Discovers && self.Offers == other.Offers && self.Requests == other.Requests && self.Acks == other.Acks && self.Naks == other.Naks && self.Declines == other.Declines && self.Releases == other.Releases && self.ServerStartTime == other.ServerStartTime && self.Scopes == other.Scopes && self.ScopeInfo == other.ScopeInfo } } impl ::core::cmp::Eq for DHCP_MIB_INFO {} unsafe impl ::windows::core::Abi for DHCP_MIB_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_MIB_INFO_V5 { pub Discovers: u32, pub Offers: u32, pub Requests: u32, pub Acks: u32, pub Naks: u32, pub Declines: u32, pub Releases: u32, pub ServerStartTime: DATE_TIME, pub QtnNumLeases: u32, pub QtnPctQtnLeases: u32, pub QtnProbationLeases: u32, pub QtnNonQtnLeases: u32, pub QtnExemptLeases: u32, pub QtnCapableClients: u32, pub QtnIASErrors: u32, pub DelayedOffers: u32, pub ScopesWithDelayedOffers: u32, pub Scopes: u32, pub ScopeInfo: *mut SCOPE_MIB_INFO_V5, } impl DHCP_MIB_INFO_V5 {} impl ::core::default::Default for DHCP_MIB_INFO_V5 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_MIB_INFO_V5 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_MIB_INFO_V5") .field("Discovers", &self.Discovers) .field("Offers", &self.Offers) .field("Requests", &self.Requests) .field("Acks", &self.Acks) .field("Naks", &self.Naks) .field("Declines", &self.Declines) .field("Releases", &self.Releases) .field("ServerStartTime", &self.ServerStartTime) .field("QtnNumLeases", &self.QtnNumLeases) .field("QtnPctQtnLeases", &self.QtnPctQtnLeases) .field("QtnProbationLeases", &self.QtnProbationLeases) .field("QtnNonQtnLeases", &self.QtnNonQtnLeases) .field("QtnExemptLeases", &self.QtnExemptLeases) .field("QtnCapableClients", &self.QtnCapableClients) .field("QtnIASErrors", &self.QtnIASErrors) .field("DelayedOffers", &self.DelayedOffers) .field("ScopesWithDelayedOffers", &self.ScopesWithDelayedOffers) .field("Scopes", &self.Scopes) .field("ScopeInfo", &self.ScopeInfo) .finish() } } impl ::core::cmp::PartialEq for DHCP_MIB_INFO_V5 { fn eq(&self, other: &Self) -> bool { self.Discovers == other.Discovers && self.Offers == other.Offers && self.Requests == other.Requests && self.Acks == other.Acks && self.Naks == other.Naks && self.Declines == other.Declines && self.Releases == other.Releases && self.ServerStartTime == other.ServerStartTime && self.QtnNumLeases == other.QtnNumLeases && self.QtnPctQtnLeases == other.QtnPctQtnLeases && self.QtnProbationLeases == other.QtnProbationLeases && self.QtnNonQtnLeases == other.QtnNonQtnLeases && self.QtnExemptLeases == other.QtnExemptLeases && self.QtnCapableClients == other.QtnCapableClients && self.QtnIASErrors == other.QtnIASErrors && self.DelayedOffers == other.DelayedOffers && self.ScopesWithDelayedOffers == other.ScopesWithDelayedOffers && self.Scopes == other.Scopes && self.ScopeInfo == other.ScopeInfo } } impl ::core::cmp::Eq for DHCP_MIB_INFO_V5 {} unsafe impl ::windows::core::Abi for DHCP_MIB_INFO_V5 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_MIB_INFO_V6 { pub Solicits: u32, pub Advertises: u32, pub Requests: u32, pub Renews: u32, pub Rebinds: u32, pub Replies: u32, pub Confirms: u32, pub Declines: u32, pub Releases: u32, pub Informs: u32, pub ServerStartTime: DATE_TIME, pub Scopes: u32, pub ScopeInfo: *mut SCOPE_MIB_INFO_V6, } impl DHCP_MIB_INFO_V6 {} impl ::core::default::Default for DHCP_MIB_INFO_V6 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_MIB_INFO_V6 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_MIB_INFO_V6") .field("Solicits", &self.Solicits) .field("Advertises", &self.Advertises) .field("Requests", &self.Requests) .field("Renews", &self.Renews) .field("Rebinds", &self.Rebinds) .field("Replies", &self.Replies) .field("Confirms", &self.Confirms) .field("Declines", &self.Declines) .field("Releases", &self.Releases) .field("Informs", &self.Informs) .field("ServerStartTime", &self.ServerStartTime) .field("Scopes", &self.Scopes) .field("ScopeInfo", &self.ScopeInfo) .finish() } } impl ::core::cmp::PartialEq for DHCP_MIB_INFO_V6 { fn eq(&self, other: &Self) -> bool { self.Solicits == other.Solicits && self.Advertises == other.Advertises && self.Requests == other.Requests && self.Renews == other.Renews && self.Rebinds == other.Rebinds && self.Replies == other.Replies && self.Confirms == other.Confirms && self.Declines == other.Declines && self.Releases == other.Releases && self.Informs == other.Informs && self.ServerStartTime == other.ServerStartTime && self.Scopes == other.Scopes && self.ScopeInfo == other.ScopeInfo } } impl ::core::cmp::Eq for DHCP_MIB_INFO_V6 {} unsafe impl ::windows::core::Abi for DHCP_MIB_INFO_V6 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_MIB_INFO_VQ { pub Discovers: u32, pub Offers: u32, pub Requests: u32, pub Acks: u32, pub Naks: u32, pub Declines: u32, pub Releases: u32, pub ServerStartTime: DATE_TIME, pub QtnNumLeases: u32, pub QtnPctQtnLeases: u32, pub QtnProbationLeases: u32, pub QtnNonQtnLeases: u32, pub QtnExemptLeases: u32, pub QtnCapableClients: u32, pub QtnIASErrors: u32, pub Scopes: u32, pub ScopeInfo: *mut SCOPE_MIB_INFO_VQ, } impl DHCP_MIB_INFO_VQ {} impl ::core::default::Default for DHCP_MIB_INFO_VQ { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_MIB_INFO_VQ { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_MIB_INFO_VQ") .field("Discovers", &self.Discovers) .field("Offers", &self.Offers) .field("Requests", &self.Requests) .field("Acks", &self.Acks) .field("Naks", &self.Naks) .field("Declines", &self.Declines) .field("Releases", &self.Releases) .field("ServerStartTime", &self.ServerStartTime) .field("QtnNumLeases", &self.QtnNumLeases) .field("QtnPctQtnLeases", &self.QtnPctQtnLeases) .field("QtnProbationLeases", &self.QtnProbationLeases) .field("QtnNonQtnLeases", &self.QtnNonQtnLeases) .field("QtnExemptLeases", &self.QtnExemptLeases) .field("QtnCapableClients", &self.QtnCapableClients) .field("QtnIASErrors", &self.QtnIASErrors) .field("Scopes", &self.Scopes) .field("ScopeInfo", &self.ScopeInfo) .finish() } } impl ::core::cmp::PartialEq for DHCP_MIB_INFO_VQ { fn eq(&self, other: &Self) -> bool { self.Discovers == other.Discovers && self.Offers == other.Offers && self.Requests == other.Requests && self.Acks == other.Acks && self.Naks == other.Naks && self.Declines == other.Declines && self.Releases == other.Releases && self.ServerStartTime == other.ServerStartTime && self.QtnNumLeases == other.QtnNumLeases && self.QtnPctQtnLeases == other.QtnPctQtnLeases && self.QtnProbationLeases == other.QtnProbationLeases && self.QtnNonQtnLeases == other.QtnNonQtnLeases && self.QtnExemptLeases == other.QtnExemptLeases && self.QtnCapableClients == other.QtnCapableClients && self.QtnIASErrors == other.QtnIASErrors && self.Scopes == other.Scopes && self.ScopeInfo == other.ScopeInfo } } impl ::core::cmp::Eq for DHCP_MIB_INFO_VQ {} unsafe impl ::windows::core::Abi for DHCP_MIB_INFO_VQ { type Abi = Self; } pub const DHCP_MIN_DELAY: u32 = 0u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_OPTION { pub OptionID: u32, pub OptionName: super::super::Foundation::PWSTR, pub OptionComment: super::super::Foundation::PWSTR, pub DefaultValue: DHCP_OPTION_DATA, pub OptionType: DHCP_OPTION_TYPE, } #[cfg(feature = "Win32_Foundation")] impl DHCP_OPTION {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_OPTION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_OPTION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_OPTION").field("OptionID", &self.OptionID).field("OptionName", &self.OptionName).field("OptionComment", &self.OptionComment).field("DefaultValue", &self.DefaultValue).field("OptionType", &self.OptionType).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_OPTION { fn eq(&self, other: &Self) -> bool { self.OptionID == other.OptionID && self.OptionName == other.OptionName && self.OptionComment == other.OptionComment && self.DefaultValue == other.DefaultValue && self.OptionType == other.OptionType } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_OPTION {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_OPTION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_OPTION_ARRAY { pub NumElements: u32, pub Options: *mut DHCP_OPTION, } #[cfg(feature = "Win32_Foundation")] impl DHCP_OPTION_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_OPTION_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_OPTION_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_OPTION_ARRAY").field("NumElements", &self.NumElements).field("Options", &self.Options).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_OPTION_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Options == other.Options } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_OPTION_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_OPTION_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_OPTION_DATA { pub NumElements: u32, pub Elements: *mut DHCP_OPTION_DATA_ELEMENT, } #[cfg(feature = "Win32_Foundation")] impl DHCP_OPTION_DATA {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_OPTION_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_OPTION_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_OPTION_DATA").field("NumElements", &self.NumElements).field("Elements", &self.Elements).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_OPTION_DATA { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Elements == other.Elements } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_OPTION_DATA {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_OPTION_DATA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_OPTION_DATA_ELEMENT { pub OptionType: DHCP_OPTION_DATA_TYPE, pub Element: DHCP_OPTION_DATA_ELEMENT_0, } #[cfg(feature = "Win32_Foundation")] impl DHCP_OPTION_DATA_ELEMENT {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_OPTION_DATA_ELEMENT { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_OPTION_DATA_ELEMENT { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_OPTION_DATA_ELEMENT {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_OPTION_DATA_ELEMENT { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub union DHCP_OPTION_DATA_ELEMENT_0 { pub ByteOption: u8, pub WordOption: u16, pub DWordOption: u32, pub DWordDWordOption: DWORD_DWORD, pub IpAddressOption: u32, pub StringDataOption: super::super::Foundation::PWSTR, pub BinaryDataOption: DHCP_BINARY_DATA, pub EncapsulatedDataOption: DHCP_BINARY_DATA, pub Ipv6AddressDataOption: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl DHCP_OPTION_DATA_ELEMENT_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_OPTION_DATA_ELEMENT_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_OPTION_DATA_ELEMENT_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_OPTION_DATA_ELEMENT_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_OPTION_DATA_ELEMENT_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 DHCP_OPTION_DATA_TYPE(pub i32); pub const DhcpByteOption: DHCP_OPTION_DATA_TYPE = DHCP_OPTION_DATA_TYPE(0i32); pub const DhcpWordOption: DHCP_OPTION_DATA_TYPE = DHCP_OPTION_DATA_TYPE(1i32); pub const DhcpDWordOption: DHCP_OPTION_DATA_TYPE = DHCP_OPTION_DATA_TYPE(2i32); pub const DhcpDWordDWordOption: DHCP_OPTION_DATA_TYPE = DHCP_OPTION_DATA_TYPE(3i32); pub const DhcpIpAddressOption: DHCP_OPTION_DATA_TYPE = DHCP_OPTION_DATA_TYPE(4i32); pub const DhcpStringDataOption: DHCP_OPTION_DATA_TYPE = DHCP_OPTION_DATA_TYPE(5i32); pub const DhcpBinaryDataOption: DHCP_OPTION_DATA_TYPE = DHCP_OPTION_DATA_TYPE(6i32); pub const DhcpEncapsulatedDataOption: DHCP_OPTION_DATA_TYPE = DHCP_OPTION_DATA_TYPE(7i32); pub const DhcpIpv6AddressOption: DHCP_OPTION_DATA_TYPE = DHCP_OPTION_DATA_TYPE(8i32); impl ::core::convert::From<i32> for DHCP_OPTION_DATA_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_OPTION_DATA_TYPE { type Abi = Self; } #[repr(C)] #[derive(:: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy)] pub struct DHCP_OPTION_ELEMENT_UNION(pub u8); #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_OPTION_LIST { pub NumOptions: u32, pub Options: *mut DHCP_OPTION_VALUE, } #[cfg(feature = "Win32_Foundation")] impl DHCP_OPTION_LIST {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_OPTION_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_OPTION_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_OPTION_LIST").field("NumOptions", &self.NumOptions).field("Options", &self.Options).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_OPTION_LIST { fn eq(&self, other: &Self) -> bool { self.NumOptions == other.NumOptions && self.Options == other.Options } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_OPTION_LIST {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_OPTION_LIST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_OPTION_SCOPE_INFO { pub ScopeType: DHCP_OPTION_SCOPE_TYPE, pub ScopeInfo: DHCP_OPTION_SCOPE_INFO_0, } #[cfg(feature = "Win32_Foundation")] impl DHCP_OPTION_SCOPE_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_OPTION_SCOPE_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_OPTION_SCOPE_INFO { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_OPTION_SCOPE_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_OPTION_SCOPE_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub union DHCP_OPTION_SCOPE_INFO_0 { pub DefaultScopeInfo: *mut ::core::ffi::c_void, pub GlobalScopeInfo: *mut ::core::ffi::c_void, pub SubnetScopeInfo: u32, pub ReservedScopeInfo: DHCP_RESERVED_SCOPE, pub MScopeInfo: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl DHCP_OPTION_SCOPE_INFO_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_OPTION_SCOPE_INFO_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_OPTION_SCOPE_INFO_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_OPTION_SCOPE_INFO_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_OPTION_SCOPE_INFO_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_OPTION_SCOPE_INFO6 { pub ScopeType: DHCP_OPTION_SCOPE_TYPE6, pub ScopeInfo: DHCP_OPTION_SCOPE_INFO6_0, } impl DHCP_OPTION_SCOPE_INFO6 {} impl ::core::default::Default for DHCP_OPTION_SCOPE_INFO6 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for DHCP_OPTION_SCOPE_INFO6 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for DHCP_OPTION_SCOPE_INFO6 {} unsafe impl ::windows::core::Abi for DHCP_OPTION_SCOPE_INFO6 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub union DHCP_OPTION_SCOPE_INFO6_0 { pub DefaultScopeInfo: *mut ::core::ffi::c_void, pub SubnetScopeInfo: DHCP_IPV6_ADDRESS, pub ReservedScopeInfo: DHCP_RESERVED_SCOPE6, } impl DHCP_OPTION_SCOPE_INFO6_0 {} impl ::core::default::Default for DHCP_OPTION_SCOPE_INFO6_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for DHCP_OPTION_SCOPE_INFO6_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for DHCP_OPTION_SCOPE_INFO6_0 {} unsafe impl ::windows::core::Abi for DHCP_OPTION_SCOPE_INFO6_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 DHCP_OPTION_SCOPE_TYPE(pub i32); pub const DhcpDefaultOptions: DHCP_OPTION_SCOPE_TYPE = DHCP_OPTION_SCOPE_TYPE(0i32); pub const DhcpGlobalOptions: DHCP_OPTION_SCOPE_TYPE = DHCP_OPTION_SCOPE_TYPE(1i32); pub const DhcpSubnetOptions: DHCP_OPTION_SCOPE_TYPE = DHCP_OPTION_SCOPE_TYPE(2i32); pub const DhcpReservedOptions: DHCP_OPTION_SCOPE_TYPE = DHCP_OPTION_SCOPE_TYPE(3i32); pub const DhcpMScopeOptions: DHCP_OPTION_SCOPE_TYPE = DHCP_OPTION_SCOPE_TYPE(4i32); impl ::core::convert::From<i32> for DHCP_OPTION_SCOPE_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_OPTION_SCOPE_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 DHCP_OPTION_SCOPE_TYPE6(pub i32); pub const DhcpDefaultOptions6: DHCP_OPTION_SCOPE_TYPE6 = DHCP_OPTION_SCOPE_TYPE6(0i32); pub const DhcpScopeOptions6: DHCP_OPTION_SCOPE_TYPE6 = DHCP_OPTION_SCOPE_TYPE6(1i32); pub const DhcpReservedOptions6: DHCP_OPTION_SCOPE_TYPE6 = DHCP_OPTION_SCOPE_TYPE6(2i32); pub const DhcpGlobalOptions6: DHCP_OPTION_SCOPE_TYPE6 = DHCP_OPTION_SCOPE_TYPE6(3i32); impl ::core::convert::From<i32> for DHCP_OPTION_SCOPE_TYPE6 { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_OPTION_SCOPE_TYPE6 { type Abi = Self; } #[repr(C)] #[derive(:: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy)] pub struct DHCP_OPTION_SCOPE_UNION6(pub u8); #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DHCP_OPTION_TYPE(pub i32); pub const DhcpUnaryElementTypeOption: DHCP_OPTION_TYPE = DHCP_OPTION_TYPE(0i32); pub const DhcpArrayTypeOption: DHCP_OPTION_TYPE = DHCP_OPTION_TYPE(1i32); impl ::core::convert::From<i32> for DHCP_OPTION_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_OPTION_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_OPTION_VALUE { pub OptionID: u32, pub Value: DHCP_OPTION_DATA, } #[cfg(feature = "Win32_Foundation")] impl DHCP_OPTION_VALUE {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_OPTION_VALUE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_OPTION_VALUE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_OPTION_VALUE").field("OptionID", &self.OptionID).field("Value", &self.Value).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_OPTION_VALUE { fn eq(&self, other: &Self) -> bool { self.OptionID == other.OptionID && self.Value == other.Value } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_OPTION_VALUE {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_OPTION_VALUE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_OPTION_VALUE_ARRAY { pub NumElements: u32, pub Values: *mut DHCP_OPTION_VALUE, } #[cfg(feature = "Win32_Foundation")] impl DHCP_OPTION_VALUE_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_OPTION_VALUE_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_OPTION_VALUE_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_OPTION_VALUE_ARRAY").field("NumElements", &self.NumElements).field("Values", &self.Values).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_OPTION_VALUE_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Values == other.Values } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_OPTION_VALUE_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_OPTION_VALUE_ARRAY { type Abi = Self; } pub const DHCP_OPT_ENUM_IGNORE_VENDOR: u32 = 1u32; pub const DHCP_OPT_ENUM_USE_CLASSNAME: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_PERF_STATS { pub dwNumPacketsReceived: u32, pub dwNumPacketsDuplicate: u32, pub dwNumPacketsExpired: u32, pub dwNumMilliSecondsProcessed: u32, pub dwNumPacketsInActiveQueue: u32, pub dwNumPacketsInPingQueue: u32, pub dwNumDiscoversReceived: u32, pub dwNumOffersSent: u32, pub dwNumRequestsReceived: u32, pub dwNumInformsReceived: u32, pub dwNumAcksSent: u32, pub dwNumNacksSent: u32, pub dwNumDeclinesReceived: u32, pub dwNumReleasesReceived: u32, pub dwNumDelayedOfferInQueue: u32, pub dwNumPacketsProcessed: u32, pub dwNumPacketsInQuarWaitingQueue: u32, pub dwNumPacketsInQuarReadyQueue: u32, pub dwNumPacketsInQuarDecisionQueue: u32, } impl DHCP_PERF_STATS {} impl ::core::default::Default for DHCP_PERF_STATS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_PERF_STATS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_PERF_STATS") .field("dwNumPacketsReceived", &self.dwNumPacketsReceived) .field("dwNumPacketsDuplicate", &self.dwNumPacketsDuplicate) .field("dwNumPacketsExpired", &self.dwNumPacketsExpired) .field("dwNumMilliSecondsProcessed", &self.dwNumMilliSecondsProcessed) .field("dwNumPacketsInActiveQueue", &self.dwNumPacketsInActiveQueue) .field("dwNumPacketsInPingQueue", &self.dwNumPacketsInPingQueue) .field("dwNumDiscoversReceived", &self.dwNumDiscoversReceived) .field("dwNumOffersSent", &self.dwNumOffersSent) .field("dwNumRequestsReceived", &self.dwNumRequestsReceived) .field("dwNumInformsReceived", &self.dwNumInformsReceived) .field("dwNumAcksSent", &self.dwNumAcksSent) .field("dwNumNacksSent", &self.dwNumNacksSent) .field("dwNumDeclinesReceived", &self.dwNumDeclinesReceived) .field("dwNumReleasesReceived", &self.dwNumReleasesReceived) .field("dwNumDelayedOfferInQueue", &self.dwNumDelayedOfferInQueue) .field("dwNumPacketsProcessed", &self.dwNumPacketsProcessed) .field("dwNumPacketsInQuarWaitingQueue", &self.dwNumPacketsInQuarWaitingQueue) .field("dwNumPacketsInQuarReadyQueue", &self.dwNumPacketsInQuarReadyQueue) .field("dwNumPacketsInQuarDecisionQueue", &self.dwNumPacketsInQuarDecisionQueue) .finish() } } impl ::core::cmp::PartialEq for DHCP_PERF_STATS { fn eq(&self, other: &Self) -> bool { self.dwNumPacketsReceived == other.dwNumPacketsReceived && self.dwNumPacketsDuplicate == other.dwNumPacketsDuplicate && self.dwNumPacketsExpired == other.dwNumPacketsExpired && self.dwNumMilliSecondsProcessed == other.dwNumMilliSecondsProcessed && self.dwNumPacketsInActiveQueue == other.dwNumPacketsInActiveQueue && self.dwNumPacketsInPingQueue == other.dwNumPacketsInPingQueue && self.dwNumDiscoversReceived == other.dwNumDiscoversReceived && self.dwNumOffersSent == other.dwNumOffersSent && self.dwNumRequestsReceived == other.dwNumRequestsReceived && self.dwNumInformsReceived == other.dwNumInformsReceived && self.dwNumAcksSent == other.dwNumAcksSent && self.dwNumNacksSent == other.dwNumNacksSent && self.dwNumDeclinesReceived == other.dwNumDeclinesReceived && self.dwNumReleasesReceived == other.dwNumReleasesReceived && self.dwNumDelayedOfferInQueue == other.dwNumDelayedOfferInQueue && self.dwNumPacketsProcessed == other.dwNumPacketsProcessed && self.dwNumPacketsInQuarWaitingQueue == other.dwNumPacketsInQuarWaitingQueue && self.dwNumPacketsInQuarReadyQueue == other.dwNumPacketsInQuarReadyQueue && self.dwNumPacketsInQuarDecisionQueue == other.dwNumPacketsInQuarDecisionQueue } } impl ::core::cmp::Eq for DHCP_PERF_STATS {} unsafe impl ::windows::core::Abi for DHCP_PERF_STATS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_POLICY { pub PolicyName: super::super::Foundation::PWSTR, pub IsGlobalPolicy: super::super::Foundation::BOOL, pub Subnet: u32, pub ProcessingOrder: u32, pub Conditions: *mut DHCP_POL_COND_ARRAY, pub Expressions: *mut DHCP_POL_EXPR_ARRAY, pub Ranges: *mut DHCP_IP_RANGE_ARRAY, pub Description: super::super::Foundation::PWSTR, pub Enabled: super::super::Foundation::BOOL, } #[cfg(feature = "Win32_Foundation")] impl DHCP_POLICY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_POLICY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_POLICY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_POLICY") .field("PolicyName", &self.PolicyName) .field("IsGlobalPolicy", &self.IsGlobalPolicy) .field("Subnet", &self.Subnet) .field("ProcessingOrder", &self.ProcessingOrder) .field("Conditions", &self.Conditions) .field("Expressions", &self.Expressions) .field("Ranges", &self.Ranges) .field("Description", &self.Description) .field("Enabled", &self.Enabled) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_POLICY { fn eq(&self, other: &Self) -> bool { self.PolicyName == other.PolicyName && self.IsGlobalPolicy == other.IsGlobalPolicy && self.Subnet == other.Subnet && self.ProcessingOrder == other.ProcessingOrder && self.Conditions == other.Conditions && self.Expressions == other.Expressions && self.Ranges == other.Ranges && self.Description == other.Description && self.Enabled == other.Enabled } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_POLICY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_POLICY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_POLICY_ARRAY { pub NumElements: u32, pub Elements: *mut DHCP_POLICY, } #[cfg(feature = "Win32_Foundation")] impl DHCP_POLICY_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_POLICY_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_POLICY_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_POLICY_ARRAY").field("NumElements", &self.NumElements).field("Elements", &self.Elements).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_POLICY_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Elements == other.Elements } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_POLICY_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_POLICY_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_POLICY_EX { pub PolicyName: super::super::Foundation::PWSTR, pub IsGlobalPolicy: super::super::Foundation::BOOL, pub Subnet: u32, pub ProcessingOrder: u32, pub Conditions: *mut DHCP_POL_COND_ARRAY, pub Expressions: *mut DHCP_POL_EXPR_ARRAY, pub Ranges: *mut DHCP_IP_RANGE_ARRAY, pub Description: super::super::Foundation::PWSTR, pub Enabled: super::super::Foundation::BOOL, pub Properties: *mut DHCP_PROPERTY_ARRAY, } #[cfg(feature = "Win32_Foundation")] impl DHCP_POLICY_EX {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_POLICY_EX { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_POLICY_EX { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_POLICY_EX") .field("PolicyName", &self.PolicyName) .field("IsGlobalPolicy", &self.IsGlobalPolicy) .field("Subnet", &self.Subnet) .field("ProcessingOrder", &self.ProcessingOrder) .field("Conditions", &self.Conditions) .field("Expressions", &self.Expressions) .field("Ranges", &self.Ranges) .field("Description", &self.Description) .field("Enabled", &self.Enabled) .field("Properties", &self.Properties) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_POLICY_EX { fn eq(&self, other: &Self) -> bool { self.PolicyName == other.PolicyName && self.IsGlobalPolicy == other.IsGlobalPolicy && self.Subnet == other.Subnet && self.ProcessingOrder == other.ProcessingOrder && self.Conditions == other.Conditions && self.Expressions == other.Expressions && self.Ranges == other.Ranges && self.Description == other.Description && self.Enabled == other.Enabled && self.Properties == other.Properties } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_POLICY_EX {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_POLICY_EX { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_POLICY_EX_ARRAY { pub NumElements: u32, pub Elements: *mut DHCP_POLICY_EX, } #[cfg(feature = "Win32_Foundation")] impl DHCP_POLICY_EX_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_POLICY_EX_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_POLICY_EX_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_POLICY_EX_ARRAY").field("NumElements", &self.NumElements).field("Elements", &self.Elements).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_POLICY_EX_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Elements == other.Elements } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_POLICY_EX_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_POLICY_EX_ARRAY { 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 DHCP_POLICY_FIELDS_TO_UPDATE(pub i32); pub const DhcpUpdatePolicyName: DHCP_POLICY_FIELDS_TO_UPDATE = DHCP_POLICY_FIELDS_TO_UPDATE(1i32); pub const DhcpUpdatePolicyOrder: DHCP_POLICY_FIELDS_TO_UPDATE = DHCP_POLICY_FIELDS_TO_UPDATE(2i32); pub const DhcpUpdatePolicyExpr: DHCP_POLICY_FIELDS_TO_UPDATE = DHCP_POLICY_FIELDS_TO_UPDATE(4i32); pub const DhcpUpdatePolicyRanges: DHCP_POLICY_FIELDS_TO_UPDATE = DHCP_POLICY_FIELDS_TO_UPDATE(8i32); pub const DhcpUpdatePolicyDescr: DHCP_POLICY_FIELDS_TO_UPDATE = DHCP_POLICY_FIELDS_TO_UPDATE(16i32); pub const DhcpUpdatePolicyStatus: DHCP_POLICY_FIELDS_TO_UPDATE = DHCP_POLICY_FIELDS_TO_UPDATE(32i32); pub const DhcpUpdatePolicyDnsSuffix: DHCP_POLICY_FIELDS_TO_UPDATE = DHCP_POLICY_FIELDS_TO_UPDATE(64i32); impl ::core::convert::From<i32> for DHCP_POLICY_FIELDS_TO_UPDATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_POLICY_FIELDS_TO_UPDATE { 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 DHCP_POL_ATTR_TYPE(pub i32); pub const DhcpAttrHWAddr: DHCP_POL_ATTR_TYPE = DHCP_POL_ATTR_TYPE(0i32); pub const DhcpAttrOption: DHCP_POL_ATTR_TYPE = DHCP_POL_ATTR_TYPE(1i32); pub const DhcpAttrSubOption: DHCP_POL_ATTR_TYPE = DHCP_POL_ATTR_TYPE(2i32); pub const DhcpAttrFqdn: DHCP_POL_ATTR_TYPE = DHCP_POL_ATTR_TYPE(3i32); pub const DhcpAttrFqdnSingleLabel: DHCP_POL_ATTR_TYPE = DHCP_POL_ATTR_TYPE(4i32); impl ::core::convert::From<i32> for DHCP_POL_ATTR_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_POL_ATTR_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 DHCP_POL_COMPARATOR(pub i32); pub const DhcpCompEqual: DHCP_POL_COMPARATOR = DHCP_POL_COMPARATOR(0i32); pub const DhcpCompNotEqual: DHCP_POL_COMPARATOR = DHCP_POL_COMPARATOR(1i32); pub const DhcpCompBeginsWith: DHCP_POL_COMPARATOR = DHCP_POL_COMPARATOR(2i32); pub const DhcpCompNotBeginWith: DHCP_POL_COMPARATOR = DHCP_POL_COMPARATOR(3i32); pub const DhcpCompEndsWith: DHCP_POL_COMPARATOR = DHCP_POL_COMPARATOR(4i32); pub const DhcpCompNotEndWith: DHCP_POL_COMPARATOR = DHCP_POL_COMPARATOR(5i32); impl ::core::convert::From<i32> for DHCP_POL_COMPARATOR { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_POL_COMPARATOR { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_POL_COND { pub ParentExpr: u32, pub Type: DHCP_POL_ATTR_TYPE, pub OptionID: u32, pub SubOptionID: u32, pub VendorName: super::super::Foundation::PWSTR, pub Operator: DHCP_POL_COMPARATOR, pub Value: *mut u8, pub ValueLength: u32, } #[cfg(feature = "Win32_Foundation")] impl DHCP_POL_COND {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_POL_COND { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_POL_COND { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_POL_COND") .field("ParentExpr", &self.ParentExpr) .field("Type", &self.Type) .field("OptionID", &self.OptionID) .field("SubOptionID", &self.SubOptionID) .field("VendorName", &self.VendorName) .field("Operator", &self.Operator) .field("Value", &self.Value) .field("ValueLength", &self.ValueLength) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_POL_COND { fn eq(&self, other: &Self) -> bool { self.ParentExpr == other.ParentExpr && self.Type == other.Type && self.OptionID == other.OptionID && self.SubOptionID == other.SubOptionID && self.VendorName == other.VendorName && self.Operator == other.Operator && self.Value == other.Value && self.ValueLength == other.ValueLength } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_POL_COND {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_POL_COND { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_POL_COND_ARRAY { pub NumElements: u32, pub Elements: *mut DHCP_POL_COND, } #[cfg(feature = "Win32_Foundation")] impl DHCP_POL_COND_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_POL_COND_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_POL_COND_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_POL_COND_ARRAY").field("NumElements", &self.NumElements).field("Elements", &self.Elements).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_POL_COND_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Elements == other.Elements } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_POL_COND_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_POL_COND_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_POL_EXPR { pub ParentExpr: u32, pub Operator: DHCP_POL_LOGIC_OPER, } impl DHCP_POL_EXPR {} impl ::core::default::Default for DHCP_POL_EXPR { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_POL_EXPR { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_POL_EXPR").field("ParentExpr", &self.ParentExpr).field("Operator", &self.Operator).finish() } } impl ::core::cmp::PartialEq for DHCP_POL_EXPR { fn eq(&self, other: &Self) -> bool { self.ParentExpr == other.ParentExpr && self.Operator == other.Operator } } impl ::core::cmp::Eq for DHCP_POL_EXPR {} unsafe impl ::windows::core::Abi for DHCP_POL_EXPR { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_POL_EXPR_ARRAY { pub NumElements: u32, pub Elements: *mut DHCP_POL_EXPR, } impl DHCP_POL_EXPR_ARRAY {} impl ::core::default::Default for DHCP_POL_EXPR_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_POL_EXPR_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_POL_EXPR_ARRAY").field("NumElements", &self.NumElements).field("Elements", &self.Elements).finish() } } impl ::core::cmp::PartialEq for DHCP_POL_EXPR_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Elements == other.Elements } } impl ::core::cmp::Eq for DHCP_POL_EXPR_ARRAY {} unsafe impl ::windows::core::Abi for DHCP_POL_EXPR_ARRAY { 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 DHCP_POL_LOGIC_OPER(pub i32); pub const DhcpLogicalOr: DHCP_POL_LOGIC_OPER = DHCP_POL_LOGIC_OPER(0i32); pub const DhcpLogicalAnd: DHCP_POL_LOGIC_OPER = DHCP_POL_LOGIC_OPER(1i32); impl ::core::convert::From<i32> for DHCP_POL_LOGIC_OPER { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_POL_LOGIC_OPER { type Abi = Self; } pub const DHCP_PROB_CONFLICT: u32 = 536870913u32; pub const DHCP_PROB_DECLINE: u32 = 536870914u32; pub const DHCP_PROB_NACKED: u32 = 536870916u32; pub const DHCP_PROB_RELEASE: u32 = 536870915u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_PROPERTY { pub ID: DHCP_PROPERTY_ID, pub Type: DHCP_PROPERTY_TYPE, pub Value: DHCP_PROPERTY_0, } #[cfg(feature = "Win32_Foundation")] impl DHCP_PROPERTY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_PROPERTY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_PROPERTY { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_PROPERTY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_PROPERTY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub union DHCP_PROPERTY_0 { pub ByteValue: u8, pub WordValue: u16, pub DWordValue: u32, pub StringValue: super::super::Foundation::PWSTR, pub BinaryValue: DHCP_BINARY_DATA, } #[cfg(feature = "Win32_Foundation")] impl DHCP_PROPERTY_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_PROPERTY_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_PROPERTY_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_PROPERTY_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_PROPERTY_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_PROPERTY_ARRAY { pub NumElements: u32, pub Elements: *mut DHCP_PROPERTY, } #[cfg(feature = "Win32_Foundation")] impl DHCP_PROPERTY_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_PROPERTY_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_PROPERTY_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_PROPERTY_ARRAY").field("NumElements", &self.NumElements).field("Elements", &self.Elements).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_PROPERTY_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Elements == other.Elements } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_PROPERTY_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_PROPERTY_ARRAY { 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 DHCP_PROPERTY_ID(pub i32); pub const DhcpPropIdPolicyDnsSuffix: DHCP_PROPERTY_ID = DHCP_PROPERTY_ID(0i32); pub const DhcpPropIdClientAddressStateEx: DHCP_PROPERTY_ID = DHCP_PROPERTY_ID(1i32); impl ::core::convert::From<i32> for DHCP_PROPERTY_ID { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_PROPERTY_ID { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DHCP_PROPERTY_TYPE(pub i32); pub const DhcpPropTypeByte: DHCP_PROPERTY_TYPE = DHCP_PROPERTY_TYPE(0i32); pub const DhcpPropTypeWord: DHCP_PROPERTY_TYPE = DHCP_PROPERTY_TYPE(1i32); pub const DhcpPropTypeDword: DHCP_PROPERTY_TYPE = DHCP_PROPERTY_TYPE(2i32); pub const DhcpPropTypeString: DHCP_PROPERTY_TYPE = DHCP_PROPERTY_TYPE(3i32); pub const DhcpPropTypeBinary: DHCP_PROPERTY_TYPE = DHCP_PROPERTY_TYPE(4i32); impl ::core::convert::From<i32> for DHCP_PROPERTY_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_PROPERTY_TYPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_RESERVATION_INFO_ARRAY { pub NumElements: u32, pub Elements: *mut *mut DHCP_IP_RESERVATION_INFO, } #[cfg(feature = "Win32_Foundation")] impl DHCP_RESERVATION_INFO_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_RESERVATION_INFO_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_RESERVATION_INFO_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_RESERVATION_INFO_ARRAY").field("NumElements", &self.NumElements).field("Elements", &self.Elements).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_RESERVATION_INFO_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Elements == other.Elements } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_RESERVATION_INFO_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_RESERVATION_INFO_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_RESERVED_SCOPE { pub ReservedIpAddress: u32, pub ReservedIpSubnetAddress: u32, } impl DHCP_RESERVED_SCOPE {} impl ::core::default::Default for DHCP_RESERVED_SCOPE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_RESERVED_SCOPE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_RESERVED_SCOPE").field("ReservedIpAddress", &self.ReservedIpAddress).field("ReservedIpSubnetAddress", &self.ReservedIpSubnetAddress).finish() } } impl ::core::cmp::PartialEq for DHCP_RESERVED_SCOPE { fn eq(&self, other: &Self) -> bool { self.ReservedIpAddress == other.ReservedIpAddress && self.ReservedIpSubnetAddress == other.ReservedIpSubnetAddress } } impl ::core::cmp::Eq for DHCP_RESERVED_SCOPE {} unsafe impl ::windows::core::Abi for DHCP_RESERVED_SCOPE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_RESERVED_SCOPE6 { pub ReservedIpAddress: DHCP_IPV6_ADDRESS, pub ReservedIpSubnetAddress: DHCP_IPV6_ADDRESS, } impl DHCP_RESERVED_SCOPE6 {} impl ::core::default::Default for DHCP_RESERVED_SCOPE6 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_RESERVED_SCOPE6 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_RESERVED_SCOPE6").field("ReservedIpAddress", &self.ReservedIpAddress).field("ReservedIpSubnetAddress", &self.ReservedIpSubnetAddress).finish() } } impl ::core::cmp::PartialEq for DHCP_RESERVED_SCOPE6 { fn eq(&self, other: &Self) -> bool { self.ReservedIpAddress == other.ReservedIpAddress && self.ReservedIpSubnetAddress == other.ReservedIpSubnetAddress } } impl ::core::cmp::Eq for DHCP_RESERVED_SCOPE6 {} unsafe impl ::windows::core::Abi for DHCP_RESERVED_SCOPE6 { 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 DHCP_SCAN_FLAG(pub i32); pub const DhcpRegistryFix: DHCP_SCAN_FLAG = DHCP_SCAN_FLAG(0i32); pub const DhcpDatabaseFix: DHCP_SCAN_FLAG = DHCP_SCAN_FLAG(1i32); impl ::core::convert::From<i32> for DHCP_SCAN_FLAG { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_SCAN_FLAG { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_SCAN_ITEM { pub IpAddress: u32, pub ScanFlag: DHCP_SCAN_FLAG, } impl DHCP_SCAN_ITEM {} impl ::core::default::Default for DHCP_SCAN_ITEM { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_SCAN_ITEM { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SCAN_ITEM").field("IpAddress", &self.IpAddress).field("ScanFlag", &self.ScanFlag).finish() } } impl ::core::cmp::PartialEq for DHCP_SCAN_ITEM { fn eq(&self, other: &Self) -> bool { self.IpAddress == other.IpAddress && self.ScanFlag == other.ScanFlag } } impl ::core::cmp::Eq for DHCP_SCAN_ITEM {} unsafe impl ::windows::core::Abi for DHCP_SCAN_ITEM { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_SCAN_LIST { pub NumScanItems: u32, pub ScanItems: *mut DHCP_SCAN_ITEM, } impl DHCP_SCAN_LIST {} impl ::core::default::Default for DHCP_SCAN_LIST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_SCAN_LIST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SCAN_LIST").field("NumScanItems", &self.NumScanItems).field("ScanItems", &self.ScanItems).finish() } } impl ::core::cmp::PartialEq for DHCP_SCAN_LIST { fn eq(&self, other: &Self) -> bool { self.NumScanItems == other.NumScanItems && self.ScanItems == other.ScanItems } } impl ::core::cmp::Eq for DHCP_SCAN_LIST {} unsafe impl ::windows::core::Abi for DHCP_SCAN_LIST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SEARCH_INFO { pub SearchType: DHCP_SEARCH_INFO_TYPE, pub SearchInfo: DHCP_SEARCH_INFO_0, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SEARCH_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SEARCH_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SEARCH_INFO { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SEARCH_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SEARCH_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub union DHCP_SEARCH_INFO_0 { pub ClientIpAddress: u32, pub ClientHardwareAddress: DHCP_BINARY_DATA, pub ClientName: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SEARCH_INFO_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SEARCH_INFO_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SEARCH_INFO_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SEARCH_INFO_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SEARCH_INFO_0 { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DHCP_SEARCH_INFO_TYPE(pub i32); pub const DhcpClientIpAddress: DHCP_SEARCH_INFO_TYPE = DHCP_SEARCH_INFO_TYPE(0i32); pub const DhcpClientHardwareAddress: DHCP_SEARCH_INFO_TYPE = DHCP_SEARCH_INFO_TYPE(1i32); pub const DhcpClientName: DHCP_SEARCH_INFO_TYPE = DHCP_SEARCH_INFO_TYPE(2i32); impl ::core::convert::From<i32> for DHCP_SEARCH_INFO_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_SEARCH_INFO_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 DHCP_SEARCH_INFO_TYPE_V6(pub i32); pub const Dhcpv6ClientIpAddress: DHCP_SEARCH_INFO_TYPE_V6 = DHCP_SEARCH_INFO_TYPE_V6(0i32); pub const Dhcpv6ClientDUID: DHCP_SEARCH_INFO_TYPE_V6 = DHCP_SEARCH_INFO_TYPE_V6(1i32); pub const Dhcpv6ClientName: DHCP_SEARCH_INFO_TYPE_V6 = DHCP_SEARCH_INFO_TYPE_V6(2i32); impl ::core::convert::From<i32> for DHCP_SEARCH_INFO_TYPE_V6 { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_SEARCH_INFO_TYPE_V6 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SEARCH_INFO_V6 { pub SearchType: DHCP_SEARCH_INFO_TYPE_V6, pub SearchInfo: DHCP_SEARCH_INFO_V6_0, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SEARCH_INFO_V6 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SEARCH_INFO_V6 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SEARCH_INFO_V6 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SEARCH_INFO_V6 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SEARCH_INFO_V6 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub union DHCP_SEARCH_INFO_V6_0 { pub ClientIpAddress: DHCP_IPV6_ADDRESS, pub ClientDUID: DHCP_BINARY_DATA, pub ClientName: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SEARCH_INFO_V6_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SEARCH_INFO_V6_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SEARCH_INFO_V6_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SEARCH_INFO_V6_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SEARCH_INFO_V6_0 { type Abi = Self; } pub const DHCP_SEND_PACKET: u32 = 268435456u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SERVER_CONFIG_INFO { pub APIProtocolSupport: u32, pub DatabaseName: super::super::Foundation::PWSTR, pub DatabasePath: super::super::Foundation::PWSTR, pub BackupPath: super::super::Foundation::PWSTR, pub BackupInterval: u32, pub DatabaseLoggingFlag: u32, pub RestoreFlag: u32, pub DatabaseCleanupInterval: u32, pub DebugFlag: u32, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SERVER_CONFIG_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SERVER_CONFIG_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_SERVER_CONFIG_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SERVER_CONFIG_INFO") .field("APIProtocolSupport", &self.APIProtocolSupport) .field("DatabaseName", &self.DatabaseName) .field("DatabasePath", &self.DatabasePath) .field("BackupPath", &self.BackupPath) .field("BackupInterval", &self.BackupInterval) .field("DatabaseLoggingFlag", &self.DatabaseLoggingFlag) .field("RestoreFlag", &self.RestoreFlag) .field("DatabaseCleanupInterval", &self.DatabaseCleanupInterval) .field("DebugFlag", &self.DebugFlag) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SERVER_CONFIG_INFO { fn eq(&self, other: &Self) -> bool { self.APIProtocolSupport == other.APIProtocolSupport && self.DatabaseName == other.DatabaseName && self.DatabasePath == other.DatabasePath && self.BackupPath == other.BackupPath && self.BackupInterval == other.BackupInterval && self.DatabaseLoggingFlag == other.DatabaseLoggingFlag && self.RestoreFlag == other.RestoreFlag && self.DatabaseCleanupInterval == other.DatabaseCleanupInterval && self.DebugFlag == other.DebugFlag } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SERVER_CONFIG_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SERVER_CONFIG_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SERVER_CONFIG_INFO_V4 { pub APIProtocolSupport: u32, pub DatabaseName: super::super::Foundation::PWSTR, pub DatabasePath: super::super::Foundation::PWSTR, pub BackupPath: super::super::Foundation::PWSTR, pub BackupInterval: u32, pub DatabaseLoggingFlag: u32, pub RestoreFlag: u32, pub DatabaseCleanupInterval: u32, pub DebugFlag: u32, pub dwPingRetries: u32, pub cbBootTableString: u32, pub wszBootTableString: super::super::Foundation::PWSTR, pub fAuditLog: super::super::Foundation::BOOL, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SERVER_CONFIG_INFO_V4 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SERVER_CONFIG_INFO_V4 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_SERVER_CONFIG_INFO_V4 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SERVER_CONFIG_INFO_V4") .field("APIProtocolSupport", &self.APIProtocolSupport) .field("DatabaseName", &self.DatabaseName) .field("DatabasePath", &self.DatabasePath) .field("BackupPath", &self.BackupPath) .field("BackupInterval", &self.BackupInterval) .field("DatabaseLoggingFlag", &self.DatabaseLoggingFlag) .field("RestoreFlag", &self.RestoreFlag) .field("DatabaseCleanupInterval", &self.DatabaseCleanupInterval) .field("DebugFlag", &self.DebugFlag) .field("dwPingRetries", &self.dwPingRetries) .field("cbBootTableString", &self.cbBootTableString) .field("wszBootTableString", &self.wszBootTableString) .field("fAuditLog", &self.fAuditLog) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SERVER_CONFIG_INFO_V4 { fn eq(&self, other: &Self) -> bool { self.APIProtocolSupport == other.APIProtocolSupport && self.DatabaseName == other.DatabaseName && self.DatabasePath == other.DatabasePath && self.BackupPath == other.BackupPath && self.BackupInterval == other.BackupInterval && self.DatabaseLoggingFlag == other.DatabaseLoggingFlag && self.RestoreFlag == other.RestoreFlag && self.DatabaseCleanupInterval == other.DatabaseCleanupInterval && self.DebugFlag == other.DebugFlag && self.dwPingRetries == other.dwPingRetries && self.cbBootTableString == other.cbBootTableString && self.wszBootTableString == other.wszBootTableString && self.fAuditLog == other.fAuditLog } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SERVER_CONFIG_INFO_V4 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SERVER_CONFIG_INFO_V4 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SERVER_CONFIG_INFO_V6 { pub UnicastFlag: super::super::Foundation::BOOL, pub RapidCommitFlag: super::super::Foundation::BOOL, pub PreferredLifetime: u32, pub ValidLifetime: u32, pub T1: u32, pub T2: u32, pub PreferredLifetimeIATA: u32, pub ValidLifetimeIATA: u32, pub fAuditLog: super::super::Foundation::BOOL, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SERVER_CONFIG_INFO_V6 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SERVER_CONFIG_INFO_V6 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_SERVER_CONFIG_INFO_V6 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SERVER_CONFIG_INFO_V6") .field("UnicastFlag", &self.UnicastFlag) .field("RapidCommitFlag", &self.RapidCommitFlag) .field("PreferredLifetime", &self.PreferredLifetime) .field("ValidLifetime", &self.ValidLifetime) .field("T1", &self.T1) .field("T2", &self.T2) .field("PreferredLifetimeIATA", &self.PreferredLifetimeIATA) .field("ValidLifetimeIATA", &self.ValidLifetimeIATA) .field("fAuditLog", &self.fAuditLog) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SERVER_CONFIG_INFO_V6 { fn eq(&self, other: &Self) -> bool { self.UnicastFlag == other.UnicastFlag && self.RapidCommitFlag == other.RapidCommitFlag && self.PreferredLifetime == other.PreferredLifetime && self.ValidLifetime == other.ValidLifetime && self.T1 == other.T1 && self.T2 == other.T2 && self.PreferredLifetimeIATA == other.PreferredLifetimeIATA && self.ValidLifetimeIATA == other.ValidLifetimeIATA && self.fAuditLog == other.fAuditLog } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SERVER_CONFIG_INFO_V6 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SERVER_CONFIG_INFO_V6 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SERVER_CONFIG_INFO_VQ { pub APIProtocolSupport: u32, pub DatabaseName: super::super::Foundation::PWSTR, pub DatabasePath: super::super::Foundation::PWSTR, pub BackupPath: super::super::Foundation::PWSTR, pub BackupInterval: u32, pub DatabaseLoggingFlag: u32, pub RestoreFlag: u32, pub DatabaseCleanupInterval: u32, pub DebugFlag: u32, pub dwPingRetries: u32, pub cbBootTableString: u32, pub wszBootTableString: super::super::Foundation::PWSTR, pub fAuditLog: super::super::Foundation::BOOL, pub QuarantineOn: super::super::Foundation::BOOL, pub QuarDefFail: u32, pub QuarRuntimeStatus: super::super::Foundation::BOOL, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SERVER_CONFIG_INFO_VQ {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SERVER_CONFIG_INFO_VQ { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_SERVER_CONFIG_INFO_VQ { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SERVER_CONFIG_INFO_VQ") .field("APIProtocolSupport", &self.APIProtocolSupport) .field("DatabaseName", &self.DatabaseName) .field("DatabasePath", &self.DatabasePath) .field("BackupPath", &self.BackupPath) .field("BackupInterval", &self.BackupInterval) .field("DatabaseLoggingFlag", &self.DatabaseLoggingFlag) .field("RestoreFlag", &self.RestoreFlag) .field("DatabaseCleanupInterval", &self.DatabaseCleanupInterval) .field("DebugFlag", &self.DebugFlag) .field("dwPingRetries", &self.dwPingRetries) .field("cbBootTableString", &self.cbBootTableString) .field("wszBootTableString", &self.wszBootTableString) .field("fAuditLog", &self.fAuditLog) .field("QuarantineOn", &self.QuarantineOn) .field("QuarDefFail", &self.QuarDefFail) .field("QuarRuntimeStatus", &self.QuarRuntimeStatus) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SERVER_CONFIG_INFO_VQ { fn eq(&self, other: &Self) -> bool { self.APIProtocolSupport == other.APIProtocolSupport && self.DatabaseName == other.DatabaseName && self.DatabasePath == other.DatabasePath && self.BackupPath == other.BackupPath && self.BackupInterval == other.BackupInterval && self.DatabaseLoggingFlag == other.DatabaseLoggingFlag && self.RestoreFlag == other.RestoreFlag && self.DatabaseCleanupInterval == other.DatabaseCleanupInterval && self.DebugFlag == other.DebugFlag && self.dwPingRetries == other.dwPingRetries && self.cbBootTableString == other.cbBootTableString && self.wszBootTableString == other.wszBootTableString && self.fAuditLog == other.fAuditLog && self.QuarantineOn == other.QuarantineOn && self.QuarDefFail == other.QuarDefFail && self.QuarRuntimeStatus == other.QuarRuntimeStatus } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SERVER_CONFIG_INFO_VQ {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SERVER_CONFIG_INFO_VQ { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SERVER_OPTIONS { pub MessageType: *mut u8, pub SubnetMask: *mut u32, pub RequestedAddress: *mut u32, pub RequestLeaseTime: *mut u32, pub OverlayFields: *mut u8, pub RouterAddress: *mut u32, pub Server: *mut u32, pub ParameterRequestList: *mut u8, pub ParameterRequestListLength: u32, pub MachineName: super::super::Foundation::PSTR, pub MachineNameLength: u32, pub ClientHardwareAddressType: u8, pub ClientHardwareAddressLength: u8, pub ClientHardwareAddress: *mut u8, pub ClassIdentifier: super::super::Foundation::PSTR, pub ClassIdentifierLength: u32, pub VendorClass: *mut u8, pub VendorClassLength: u32, pub DNSFlags: u32, pub DNSNameLength: u32, pub DNSName: *mut u8, pub DSDomainNameRequested: super::super::Foundation::BOOLEAN, pub DSDomainName: super::super::Foundation::PSTR, pub DSDomainNameLen: u32, pub ScopeId: *mut u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl DHCP_SERVER_OPTIONS {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SERVER_OPTIONS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_SERVER_OPTIONS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SERVER_OPTIONS") .field("MessageType", &self.MessageType) .field("SubnetMask", &self.SubnetMask) .field("RequestedAddress", &self.RequestedAddress) .field("RequestLeaseTime", &self.RequestLeaseTime) .field("OverlayFields", &self.OverlayFields) .field("RouterAddress", &self.RouterAddress) .field("Server", &self.Server) .field("ParameterRequestList", &self.ParameterRequestList) .field("ParameterRequestListLength", &self.ParameterRequestListLength) .field("MachineName", &self.MachineName) .field("MachineNameLength", &self.MachineNameLength) .field("ClientHardwareAddressType", &self.ClientHardwareAddressType) .field("ClientHardwareAddressLength", &self.ClientHardwareAddressLength) .field("ClientHardwareAddress", &self.ClientHardwareAddress) .field("ClassIdentifier", &self.ClassIdentifier) .field("ClassIdentifierLength", &self.ClassIdentifierLength) .field("VendorClass", &self.VendorClass) .field("VendorClassLength", &self.VendorClassLength) .field("DNSFlags", &self.DNSFlags) .field("DNSNameLength", &self.DNSNameLength) .field("DNSName", &self.DNSName) .field("DSDomainNameRequested", &self.DSDomainNameRequested) .field("DSDomainName", &self.DSDomainName) .field("DSDomainNameLen", &self.DSDomainNameLen) .field("ScopeId", &self.ScopeId) .finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SERVER_OPTIONS { fn eq(&self, other: &Self) -> bool { self.MessageType == other.MessageType && self.SubnetMask == other.SubnetMask && self.RequestedAddress == other.RequestedAddress && self.RequestLeaseTime == other.RequestLeaseTime && self.OverlayFields == other.OverlayFields && self.RouterAddress == other.RouterAddress && self.Server == other.Server && self.ParameterRequestList == other.ParameterRequestList && self.ParameterRequestListLength == other.ParameterRequestListLength && self.MachineName == other.MachineName && self.MachineNameLength == other.MachineNameLength && self.ClientHardwareAddressType == other.ClientHardwareAddressType && self.ClientHardwareAddressLength == other.ClientHardwareAddressLength && self.ClientHardwareAddress == other.ClientHardwareAddress && self.ClassIdentifier == other.ClassIdentifier && self.ClassIdentifierLength == other.ClassIdentifierLength && self.VendorClass == other.VendorClass && self.VendorClassLength == other.VendorClassLength && self.DNSFlags == other.DNSFlags && self.DNSNameLength == other.DNSNameLength && self.DNSName == other.DNSName && self.DSDomainNameRequested == other.DSDomainNameRequested && self.DSDomainName == other.DSDomainName && self.DSDomainNameLen == other.DSDomainNameLen && self.ScopeId == other.ScopeId } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SERVER_OPTIONS {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SERVER_OPTIONS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SERVER_OPTIONS { pub MessageType: *mut u8, pub SubnetMask: *mut u32, pub RequestedAddress: *mut u32, pub RequestLeaseTime: *mut u32, pub OverlayFields: *mut u8, pub RouterAddress: *mut u32, pub Server: *mut u32, pub ParameterRequestList: *mut u8, pub ParameterRequestListLength: u32, pub MachineName: super::super::Foundation::PSTR, pub MachineNameLength: u32, pub ClientHardwareAddressType: u8, pub ClientHardwareAddressLength: u8, pub ClientHardwareAddress: *mut u8, pub ClassIdentifier: super::super::Foundation::PSTR, pub ClassIdentifierLength: u32, pub VendorClass: *mut u8, pub VendorClassLength: u32, pub DNSFlags: u32, pub DNSNameLength: u32, pub DNSName: *mut u8, pub DSDomainNameRequested: super::super::Foundation::BOOLEAN, pub DSDomainName: super::super::Foundation::PSTR, pub DSDomainNameLen: u32, pub ScopeId: *mut u32, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl DHCP_SERVER_OPTIONS {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SERVER_OPTIONS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_SERVER_OPTIONS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SERVER_OPTIONS") .field("MessageType", &self.MessageType) .field("SubnetMask", &self.SubnetMask) .field("RequestedAddress", &self.RequestedAddress) .field("RequestLeaseTime", &self.RequestLeaseTime) .field("OverlayFields", &self.OverlayFields) .field("RouterAddress", &self.RouterAddress) .field("Server", &self.Server) .field("ParameterRequestList", &self.ParameterRequestList) .field("ParameterRequestListLength", &self.ParameterRequestListLength) .field("MachineName", &self.MachineName) .field("MachineNameLength", &self.MachineNameLength) .field("ClientHardwareAddressType", &self.ClientHardwareAddressType) .field("ClientHardwareAddressLength", &self.ClientHardwareAddressLength) .field("ClientHardwareAddress", &self.ClientHardwareAddress) .field("ClassIdentifier", &self.ClassIdentifier) .field("ClassIdentifierLength", &self.ClassIdentifierLength) .field("VendorClass", &self.VendorClass) .field("VendorClassLength", &self.VendorClassLength) .field("DNSFlags", &self.DNSFlags) .field("DNSNameLength", &self.DNSNameLength) .field("DNSName", &self.DNSName) .field("DSDomainNameRequested", &self.DSDomainNameRequested) .field("DSDomainName", &self.DSDomainName) .field("DSDomainNameLen", &self.DSDomainNameLen) .field("ScopeId", &self.ScopeId) .finish() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SERVER_OPTIONS { fn eq(&self, other: &Self) -> bool { self.MessageType == other.MessageType && self.SubnetMask == other.SubnetMask && self.RequestedAddress == other.RequestedAddress && self.RequestLeaseTime == other.RequestLeaseTime && self.OverlayFields == other.OverlayFields && self.RouterAddress == other.RouterAddress && self.Server == other.Server && self.ParameterRequestList == other.ParameterRequestList && self.ParameterRequestListLength == other.ParameterRequestListLength && self.MachineName == other.MachineName && self.MachineNameLength == other.MachineNameLength && self.ClientHardwareAddressType == other.ClientHardwareAddressType && self.ClientHardwareAddressLength == other.ClientHardwareAddressLength && self.ClientHardwareAddress == other.ClientHardwareAddress && self.ClassIdentifier == other.ClassIdentifier && self.ClassIdentifierLength == other.ClassIdentifierLength && self.VendorClass == other.VendorClass && self.VendorClassLength == other.VendorClassLength && self.DNSFlags == other.DNSFlags && self.DNSNameLength == other.DNSNameLength && self.DNSName == other.DNSName && self.DSDomainNameRequested == other.DSDomainNameRequested && self.DSDomainName == other.DSDomainName && self.DSDomainNameLen == other.DSDomainNameLen && self.ScopeId == other.ScopeId } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SERVER_OPTIONS {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SERVER_OPTIONS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SERVER_SPECIFIC_STRINGS { pub DefaultVendorClassName: super::super::Foundation::PWSTR, pub DefaultUserClassName: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SERVER_SPECIFIC_STRINGS {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SERVER_SPECIFIC_STRINGS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_SERVER_SPECIFIC_STRINGS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SERVER_SPECIFIC_STRINGS").field("DefaultVendorClassName", &self.DefaultVendorClassName).field("DefaultUserClassName", &self.DefaultUserClassName).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SERVER_SPECIFIC_STRINGS { fn eq(&self, other: &Self) -> bool { self.DefaultVendorClassName == other.DefaultVendorClassName && self.DefaultUserClassName == other.DefaultUserClassName } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SERVER_SPECIFIC_STRINGS {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SERVER_SPECIFIC_STRINGS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SUBNET_ELEMENT_DATA { pub ElementType: DHCP_SUBNET_ELEMENT_TYPE, pub Element: DHCP_SUBNET_ELEMENT_DATA_0, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SUBNET_ELEMENT_DATA {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SUBNET_ELEMENT_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SUBNET_ELEMENT_DATA { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SUBNET_ELEMENT_DATA {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SUBNET_ELEMENT_DATA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub union DHCP_SUBNET_ELEMENT_DATA_0 { pub IpRange: *mut DHCP_IP_RANGE, pub SecondaryHost: *mut DHCP_HOST_INFO, pub ReservedIp: *mut DHCP_IP_RESERVATION, pub ExcludeIpRange: *mut DHCP_IP_RANGE, pub IpUsedCluster: *mut DHCP_IP_CLUSTER, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SUBNET_ELEMENT_DATA_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SUBNET_ELEMENT_DATA_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SUBNET_ELEMENT_DATA_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SUBNET_ELEMENT_DATA_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SUBNET_ELEMENT_DATA_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SUBNET_ELEMENT_DATA_V4 { pub ElementType: DHCP_SUBNET_ELEMENT_TYPE, pub Element: DHCP_SUBNET_ELEMENT_DATA_V4_0, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SUBNET_ELEMENT_DATA_V4 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SUBNET_ELEMENT_DATA_V4 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SUBNET_ELEMENT_DATA_V4 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SUBNET_ELEMENT_DATA_V4 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SUBNET_ELEMENT_DATA_V4 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub union DHCP_SUBNET_ELEMENT_DATA_V4_0 { pub IpRange: *mut DHCP_IP_RANGE, pub SecondaryHost: *mut DHCP_HOST_INFO, pub ReservedIp: *mut DHCP_IP_RESERVATION_V4, pub ExcludeIpRange: *mut DHCP_IP_RANGE, pub IpUsedCluster: *mut DHCP_IP_CLUSTER, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SUBNET_ELEMENT_DATA_V4_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SUBNET_ELEMENT_DATA_V4_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SUBNET_ELEMENT_DATA_V4_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SUBNET_ELEMENT_DATA_V4_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SUBNET_ELEMENT_DATA_V4_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SUBNET_ELEMENT_DATA_V5 { pub ElementType: DHCP_SUBNET_ELEMENT_TYPE, pub Element: DHCP_SUBNET_ELEMENT_DATA_V5_0, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SUBNET_ELEMENT_DATA_V5 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SUBNET_ELEMENT_DATA_V5 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SUBNET_ELEMENT_DATA_V5 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SUBNET_ELEMENT_DATA_V5 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SUBNET_ELEMENT_DATA_V5 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub union DHCP_SUBNET_ELEMENT_DATA_V5_0 { pub IpRange: *mut DHCP_BOOTP_IP_RANGE, pub SecondaryHost: *mut DHCP_HOST_INFO, pub ReservedIp: *mut DHCP_IP_RESERVATION_V4, pub ExcludeIpRange: *mut DHCP_IP_RANGE, pub IpUsedCluster: *mut DHCP_IP_CLUSTER, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SUBNET_ELEMENT_DATA_V5_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SUBNET_ELEMENT_DATA_V5_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SUBNET_ELEMENT_DATA_V5_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SUBNET_ELEMENT_DATA_V5_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SUBNET_ELEMENT_DATA_V5_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_SUBNET_ELEMENT_DATA_V6 { pub ElementType: DHCP_SUBNET_ELEMENT_TYPE_V6, pub Element: DHCP_SUBNET_ELEMENT_DATA_V6_0, } impl DHCP_SUBNET_ELEMENT_DATA_V6 {} impl ::core::default::Default for DHCP_SUBNET_ELEMENT_DATA_V6 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for DHCP_SUBNET_ELEMENT_DATA_V6 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for DHCP_SUBNET_ELEMENT_DATA_V6 {} unsafe impl ::windows::core::Abi for DHCP_SUBNET_ELEMENT_DATA_V6 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub union DHCP_SUBNET_ELEMENT_DATA_V6_0 { pub IpRange: *mut DHCP_IP_RANGE_V6, pub ReservedIp: *mut DHCP_IP_RESERVATION_V6, pub ExcludeIpRange: *mut DHCP_IP_RANGE_V6, } impl DHCP_SUBNET_ELEMENT_DATA_V6_0 {} impl ::core::default::Default for DHCP_SUBNET_ELEMENT_DATA_V6_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for DHCP_SUBNET_ELEMENT_DATA_V6_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for DHCP_SUBNET_ELEMENT_DATA_V6_0 {} unsafe impl ::windows::core::Abi for DHCP_SUBNET_ELEMENT_DATA_V6_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SUBNET_ELEMENT_INFO_ARRAY { pub NumElements: u32, pub Elements: *mut DHCP_SUBNET_ELEMENT_DATA, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SUBNET_ELEMENT_INFO_ARRAY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SUBNET_ELEMENT_INFO_ARRAY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_SUBNET_ELEMENT_INFO_ARRAY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SUBNET_ELEMENT_INFO_ARRAY").field("NumElements", &self.NumElements).field("Elements", &self.Elements).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SUBNET_ELEMENT_INFO_ARRAY { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Elements == other.Elements } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SUBNET_ELEMENT_INFO_ARRAY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SUBNET_ELEMENT_INFO_ARRAY { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SUBNET_ELEMENT_INFO_ARRAY_V4 { pub NumElements: u32, pub Elements: *mut DHCP_SUBNET_ELEMENT_DATA_V4, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SUBNET_ELEMENT_INFO_ARRAY_V4 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SUBNET_ELEMENT_INFO_ARRAY_V4 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_SUBNET_ELEMENT_INFO_ARRAY_V4 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SUBNET_ELEMENT_INFO_ARRAY_V4").field("NumElements", &self.NumElements).field("Elements", &self.Elements).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SUBNET_ELEMENT_INFO_ARRAY_V4 { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Elements == other.Elements } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SUBNET_ELEMENT_INFO_ARRAY_V4 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SUBNET_ELEMENT_INFO_ARRAY_V4 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SUBNET_ELEMENT_INFO_ARRAY_V5 { pub NumElements: u32, pub Elements: *mut DHCP_SUBNET_ELEMENT_DATA_V5, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SUBNET_ELEMENT_INFO_ARRAY_V5 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SUBNET_ELEMENT_INFO_ARRAY_V5 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_SUBNET_ELEMENT_INFO_ARRAY_V5 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SUBNET_ELEMENT_INFO_ARRAY_V5").field("NumElements", &self.NumElements).field("Elements", &self.Elements).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SUBNET_ELEMENT_INFO_ARRAY_V5 { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Elements == other.Elements } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SUBNET_ELEMENT_INFO_ARRAY_V5 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SUBNET_ELEMENT_INFO_ARRAY_V5 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DHCP_SUBNET_ELEMENT_INFO_ARRAY_V6 { pub NumElements: u32, pub Elements: *mut DHCP_SUBNET_ELEMENT_DATA_V6, } impl DHCP_SUBNET_ELEMENT_INFO_ARRAY_V6 {} impl ::core::default::Default for DHCP_SUBNET_ELEMENT_INFO_ARRAY_V6 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DHCP_SUBNET_ELEMENT_INFO_ARRAY_V6 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SUBNET_ELEMENT_INFO_ARRAY_V6").field("NumElements", &self.NumElements).field("Elements", &self.Elements).finish() } } impl ::core::cmp::PartialEq for DHCP_SUBNET_ELEMENT_INFO_ARRAY_V6 { fn eq(&self, other: &Self) -> bool { self.NumElements == other.NumElements && self.Elements == other.Elements } } impl ::core::cmp::Eq for DHCP_SUBNET_ELEMENT_INFO_ARRAY_V6 {} unsafe impl ::windows::core::Abi for DHCP_SUBNET_ELEMENT_INFO_ARRAY_V6 { 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 DHCP_SUBNET_ELEMENT_TYPE(pub i32); pub const DhcpIpRanges: DHCP_SUBNET_ELEMENT_TYPE = DHCP_SUBNET_ELEMENT_TYPE(0i32); pub const DhcpSecondaryHosts: DHCP_SUBNET_ELEMENT_TYPE = DHCP_SUBNET_ELEMENT_TYPE(1i32); pub const DhcpReservedIps: DHCP_SUBNET_ELEMENT_TYPE = DHCP_SUBNET_ELEMENT_TYPE(2i32); pub const DhcpExcludedIpRanges: DHCP_SUBNET_ELEMENT_TYPE = DHCP_SUBNET_ELEMENT_TYPE(3i32); pub const DhcpIpUsedClusters: DHCP_SUBNET_ELEMENT_TYPE = DHCP_SUBNET_ELEMENT_TYPE(4i32); pub const DhcpIpRangesDhcpOnly: DHCP_SUBNET_ELEMENT_TYPE = DHCP_SUBNET_ELEMENT_TYPE(5i32); pub const DhcpIpRangesDhcpBootp: DHCP_SUBNET_ELEMENT_TYPE = DHCP_SUBNET_ELEMENT_TYPE(6i32); pub const DhcpIpRangesBootpOnly: DHCP_SUBNET_ELEMENT_TYPE = DHCP_SUBNET_ELEMENT_TYPE(7i32); impl ::core::convert::From<i32> for DHCP_SUBNET_ELEMENT_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_SUBNET_ELEMENT_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 DHCP_SUBNET_ELEMENT_TYPE_V6(pub i32); pub const Dhcpv6IpRanges: DHCP_SUBNET_ELEMENT_TYPE_V6 = DHCP_SUBNET_ELEMENT_TYPE_V6(0i32); pub const Dhcpv6ReservedIps: DHCP_SUBNET_ELEMENT_TYPE_V6 = DHCP_SUBNET_ELEMENT_TYPE_V6(1i32); pub const Dhcpv6ExcludedIpRanges: DHCP_SUBNET_ELEMENT_TYPE_V6 = DHCP_SUBNET_ELEMENT_TYPE_V6(2i32); impl ::core::convert::From<i32> for DHCP_SUBNET_ELEMENT_TYPE_V6 { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_SUBNET_ELEMENT_TYPE_V6 { type Abi = Self; } #[repr(C)] #[derive(:: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy)] pub struct DHCP_SUBNET_ELEMENT_UNION(pub u8); #[repr(C)] #[derive(:: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy)] pub struct DHCP_SUBNET_ELEMENT_UNION_V4(pub u8); #[repr(C)] #[derive(:: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy)] pub struct DHCP_SUBNET_ELEMENT_UNION_V6(pub u8); #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SUBNET_INFO { pub SubnetAddress: u32, pub SubnetMask: u32, pub SubnetName: super::super::Foundation::PWSTR, pub SubnetComment: super::super::Foundation::PWSTR, pub PrimaryHost: DHCP_HOST_INFO, pub SubnetState: DHCP_SUBNET_STATE, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SUBNET_INFO {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SUBNET_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_SUBNET_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SUBNET_INFO").field("SubnetAddress", &self.SubnetAddress).field("SubnetMask", &self.SubnetMask).field("SubnetName", &self.SubnetName).field("SubnetComment", &self.SubnetComment).field("PrimaryHost", &self.PrimaryHost).field("SubnetState", &self.SubnetState).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SUBNET_INFO { fn eq(&self, other: &Self) -> bool { self.SubnetAddress == other.SubnetAddress && self.SubnetMask == other.SubnetMask && self.SubnetName == other.SubnetName && self.SubnetComment == other.SubnetComment && self.PrimaryHost == other.PrimaryHost && self.SubnetState == other.SubnetState } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SUBNET_INFO {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SUBNET_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SUBNET_INFO_V6 { pub SubnetAddress: DHCP_IPV6_ADDRESS, pub Prefix: u32, pub Preference: u16, pub SubnetName: super::super::Foundation::PWSTR, pub SubnetComment: super::super::Foundation::PWSTR, pub State: u32, pub ScopeId: u32, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SUBNET_INFO_V6 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SUBNET_INFO_V6 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_SUBNET_INFO_V6 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SUBNET_INFO_V6") .field("SubnetAddress", &self.SubnetAddress) .field("Prefix", &self.Prefix) .field("Preference", &self.Preference) .field("SubnetName", &self.SubnetName) .field("SubnetComment", &self.SubnetComment) .field("State", &self.State) .field("ScopeId", &self.ScopeId) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SUBNET_INFO_V6 { fn eq(&self, other: &Self) -> bool { self.SubnetAddress == other.SubnetAddress && self.Prefix == other.Prefix && self.Preference == other.Preference && self.SubnetName == other.SubnetName && self.SubnetComment == other.SubnetComment && self.State == other.State && self.ScopeId == other.ScopeId } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SUBNET_INFO_V6 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SUBNET_INFO_V6 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SUBNET_INFO_VQ { pub SubnetAddress: u32, pub SubnetMask: u32, pub SubnetName: super::super::Foundation::PWSTR, pub SubnetComment: super::super::Foundation::PWSTR, pub PrimaryHost: DHCP_HOST_INFO, pub SubnetState: DHCP_SUBNET_STATE, pub QuarantineOn: u32, pub Reserved1: u32, pub Reserved2: u32, pub Reserved3: i64, pub Reserved4: i64, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SUBNET_INFO_VQ {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SUBNET_INFO_VQ { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_SUBNET_INFO_VQ { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SUBNET_INFO_VQ") .field("SubnetAddress", &self.SubnetAddress) .field("SubnetMask", &self.SubnetMask) .field("SubnetName", &self.SubnetName) .field("SubnetComment", &self.SubnetComment) .field("PrimaryHost", &self.PrimaryHost) .field("SubnetState", &self.SubnetState) .field("QuarantineOn", &self.QuarantineOn) .field("Reserved1", &self.Reserved1) .field("Reserved2", &self.Reserved2) .field("Reserved3", &self.Reserved3) .field("Reserved4", &self.Reserved4) .finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SUBNET_INFO_VQ { fn eq(&self, other: &Self) -> bool { self.SubnetAddress == other.SubnetAddress && self.SubnetMask == other.SubnetMask && self.SubnetName == other.SubnetName && self.SubnetComment == other.SubnetComment && self.PrimaryHost == other.PrimaryHost && self.SubnetState == other.SubnetState && self.QuarantineOn == other.QuarantineOn && self.Reserved1 == other.Reserved1 && self.Reserved2 == other.Reserved2 && self.Reserved3 == other.Reserved3 && self.Reserved4 == other.Reserved4 } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SUBNET_INFO_VQ {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SUBNET_INFO_VQ { type Abi = Self; } pub const DHCP_SUBNET_INFO_VQ_FLAG_QUARANTINE: u32 = 1u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct DHCP_SUBNET_STATE(pub i32); pub const DhcpSubnetEnabled: DHCP_SUBNET_STATE = DHCP_SUBNET_STATE(0i32); pub const DhcpSubnetDisabled: DHCP_SUBNET_STATE = DHCP_SUBNET_STATE(1i32); pub const DhcpSubnetEnabledSwitched: DHCP_SUBNET_STATE = DHCP_SUBNET_STATE(2i32); pub const DhcpSubnetDisabledSwitched: DHCP_SUBNET_STATE = DHCP_SUBNET_STATE(3i32); pub const DhcpSubnetInvalidState: DHCP_SUBNET_STATE = DHCP_SUBNET_STATE(4i32); impl ::core::convert::From<i32> for DHCP_SUBNET_STATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for DHCP_SUBNET_STATE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SUPER_SCOPE_TABLE { pub cEntries: u32, pub pEntries: *mut DHCP_SUPER_SCOPE_TABLE_ENTRY, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SUPER_SCOPE_TABLE {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SUPER_SCOPE_TABLE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_SUPER_SCOPE_TABLE { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SUPER_SCOPE_TABLE").field("cEntries", &self.cEntries).field("pEntries", &self.pEntries).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SUPER_SCOPE_TABLE { fn eq(&self, other: &Self) -> bool { self.cEntries == other.cEntries && self.pEntries == other.pEntries } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SUPER_SCOPE_TABLE {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SUPER_SCOPE_TABLE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct DHCP_SUPER_SCOPE_TABLE_ENTRY { pub SubnetAddress: u32, pub SuperScopeNumber: u32, pub NextInSuperScope: u32, pub SuperScopeName: super::super::Foundation::PWSTR, } #[cfg(feature = "Win32_Foundation")] impl DHCP_SUPER_SCOPE_TABLE_ENTRY {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for DHCP_SUPER_SCOPE_TABLE_ENTRY { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for DHCP_SUPER_SCOPE_TABLE_ENTRY { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DHCP_SUPER_SCOPE_TABLE_ENTRY").field("SubnetAddress", &self.SubnetAddress).field("SuperScopeNumber", &self.SuperScopeNumber).field("NextInSuperScope", &self.NextInSuperScope).field("SuperScopeName", &self.SuperScopeName).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for DHCP_SUPER_SCOPE_TABLE_ENTRY { fn eq(&self, other: &Self) -> bool { self.SubnetAddress == other.SubnetAddress && self.SuperScopeNumber == other.SuperScopeNumber && self.NextInSuperScope == other.NextInSuperScope && self.SuperScopeName == other.SuperScopeName } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for DHCP_SUPER_SCOPE_TABLE_ENTRY {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for DHCP_SUPER_SCOPE_TABLE_ENTRY { type Abi = Self; } pub const DNS_FLAG_CLEANUP_EXPIRED: u32 = 4u32; pub const DNS_FLAG_DISABLE_PTR_UPDATE: u32 = 64u32; pub const DNS_FLAG_ENABLED: u32 = 1u32; pub const DNS_FLAG_HAS_DNS_SUFFIX: u32 = 128u32; pub const DNS_FLAG_UPDATE_BOTH_ALWAYS: u32 = 16u32; pub const DNS_FLAG_UPDATE_DHCID: u32 = 32u32; pub const DNS_FLAG_UPDATE_DOWNLEVEL: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DWORD_DWORD { pub DWord1: u32, pub DWord2: u32, } impl DWORD_DWORD {} impl ::core::default::Default for DWORD_DWORD { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for DWORD_DWORD { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("DWORD_DWORD").field("DWord1", &self.DWord1).field("DWord2", &self.DWord2).finish() } } impl ::core::cmp::PartialEq for DWORD_DWORD { fn eq(&self, other: &Self) -> bool { self.DWord1 == other.DWord1 && self.DWord2 == other.DWord2 } } impl ::core::cmp::Eq for DWORD_DWORD {} unsafe impl ::windows::core::Abi for DWORD_DWORD { type Abi = Self; } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpAddFilterV4<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(serveripaddress: Param0, addfilterinfo: *const DHCP_FILTER_ADD_INFO, forceflag: Param2) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpAddFilterV4(serveripaddress: super::super::Foundation::PWSTR, addfilterinfo: *const DHCP_FILTER_ADD_INFO, forceflag: super::super::Foundation::BOOL) -> u32; } ::core::mem::transmute(DhcpAddFilterV4(serveripaddress.into_param().abi(), ::core::mem::transmute(addfilterinfo), forceflag.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpAddSecurityGroup<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pserver: Param0) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpAddSecurityGroup(pserver: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(DhcpAddSecurityGroup(pserver.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpAddServer(flags: u32, idinfo: *mut ::core::ffi::c_void, newserver: *mut DHCPDS_SERVER, callbackfn: *mut ::core::ffi::c_void, callbackdata: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpAddServer(flags: u32, idinfo: *mut ::core::ffi::c_void, newserver: *mut DHCPDS_SERVER, callbackfn: *mut ::core::ffi::c_void, callbackdata: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(DhcpAddServer(::core::mem::transmute(flags), ::core::mem::transmute(idinfo), ::core::mem::transmute(newserver), ::core::mem::transmute(callbackfn), ::core::mem::transmute(callbackdata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpAddSubnetElement<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, addelementinfo: *const DHCP_SUBNET_ELEMENT_DATA) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpAddSubnetElement(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, addelementinfo: *const DHCP_SUBNET_ELEMENT_DATA) -> u32; } ::core::mem::transmute(DhcpAddSubnetElement(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(addelementinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpAddSubnetElementV4<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, addelementinfo: *const DHCP_SUBNET_ELEMENT_DATA_V4) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpAddSubnetElementV4(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, addelementinfo: *const DHCP_SUBNET_ELEMENT_DATA_V4) -> u32; } ::core::mem::transmute(DhcpAddSubnetElementV4(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(addelementinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpAddSubnetElementV5<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, addelementinfo: *const DHCP_SUBNET_ELEMENT_DATA_V5) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpAddSubnetElementV5(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, addelementinfo: *const DHCP_SUBNET_ELEMENT_DATA_V5) -> u32; } ::core::mem::transmute(DhcpAddSubnetElementV5(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(addelementinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpAddSubnetElementV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, DHCP_IPV6_ADDRESS>>(serveripaddress: Param0, subnetaddress: Param1, addelementinfo: *mut DHCP_SUBNET_ELEMENT_DATA_V6) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpAddSubnetElementV6(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: DHCP_IPV6_ADDRESS, addelementinfo: *mut DHCP_SUBNET_ELEMENT_DATA_V6) -> u32; } ::core::mem::transmute(DhcpAddSubnetElementV6(serveripaddress.into_param().abi(), subnetaddress.into_param().abi(), ::core::mem::transmute(addelementinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpAuditLogGetParams<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, flags: u32, auditlogdir: *mut super::super::Foundation::PWSTR, diskcheckinterval: *mut u32, maxlogfilessize: *mut u32, minspaceondisk: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpAuditLogGetParams(serveripaddress: super::super::Foundation::PWSTR, flags: u32, auditlogdir: *mut super::super::Foundation::PWSTR, diskcheckinterval: *mut u32, maxlogfilessize: *mut u32, minspaceondisk: *mut u32) -> u32; } ::core::mem::transmute(DhcpAuditLogGetParams(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(auditlogdir), ::core::mem::transmute(diskcheckinterval), ::core::mem::transmute(maxlogfilessize), ::core::mem::transmute(minspaceondisk))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpAuditLogSetParams<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, flags: u32, auditlogdir: Param2, diskcheckinterval: u32, maxlogfilessize: u32, minspaceondisk: u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpAuditLogSetParams(serveripaddress: super::super::Foundation::PWSTR, flags: u32, auditlogdir: super::super::Foundation::PWSTR, diskcheckinterval: u32, maxlogfilessize: u32, minspaceondisk: u32) -> u32; } ::core::mem::transmute(DhcpAuditLogSetParams(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), auditlogdir.into_param().abi(), ::core::mem::transmute(diskcheckinterval), ::core::mem::transmute(maxlogfilessize), ::core::mem::transmute(minspaceondisk))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn DhcpCApiCleanup() { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpCApiCleanup(); } ::core::mem::transmute(DhcpCApiCleanup()) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn DhcpCApiInitialize(version: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpCApiInitialize(version: *mut u32) -> u32; } ::core::mem::transmute(DhcpCApiInitialize(::core::mem::transmute(version))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpCreateClass<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, reservedmustbezero: u32, classinfo: *mut DHCP_CLASS_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpCreateClass(serveripaddress: super::super::Foundation::PWSTR, reservedmustbezero: u32, classinfo: *mut DHCP_CLASS_INFO) -> u32; } ::core::mem::transmute(DhcpCreateClass(serveripaddress.into_param().abi(), ::core::mem::transmute(reservedmustbezero), ::core::mem::transmute(classinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpCreateClassV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, reservedmustbezero: u32, classinfo: *mut DHCP_CLASS_INFO_V6) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpCreateClassV6(serveripaddress: super::super::Foundation::PWSTR, reservedmustbezero: u32, classinfo: *mut DHCP_CLASS_INFO_V6) -> u32; } ::core::mem::transmute(DhcpCreateClassV6(serveripaddress.into_param().abi(), ::core::mem::transmute(reservedmustbezero), ::core::mem::transmute(classinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpCreateClientInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, clientinfo: *const DHCP_CLIENT_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpCreateClientInfo(serveripaddress: super::super::Foundation::PWSTR, clientinfo: *const DHCP_CLIENT_INFO) -> u32; } ::core::mem::transmute(DhcpCreateClientInfo(serveripaddress.into_param().abi(), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpCreateClientInfoV4<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, clientinfo: *const DHCP_CLIENT_INFO_V4) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpCreateClientInfoV4(serveripaddress: super::super::Foundation::PWSTR, clientinfo: *const DHCP_CLIENT_INFO_V4) -> u32; } ::core::mem::transmute(DhcpCreateClientInfoV4(serveripaddress.into_param().abi(), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpCreateClientInfoVQ<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, clientinfo: *const DHCP_CLIENT_INFO_VQ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpCreateClientInfoVQ(serveripaddress: super::super::Foundation::PWSTR, clientinfo: *const DHCP_CLIENT_INFO_VQ) -> u32; } ::core::mem::transmute(DhcpCreateClientInfoVQ(serveripaddress.into_param().abi(), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpCreateOption<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, optionid: u32, optioninfo: *const DHCP_OPTION) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpCreateOption(serveripaddress: super::super::Foundation::PWSTR, optionid: u32, optioninfo: *const DHCP_OPTION) -> u32; } ::core::mem::transmute(DhcpCreateOption(serveripaddress.into_param().abi(), ::core::mem::transmute(optionid), ::core::mem::transmute(optioninfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpCreateOptionV5<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, classname: Param3, vendorname: Param4, optioninfo: *mut DHCP_OPTION) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpCreateOptionV5(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, optioninfo: *mut DHCP_OPTION) -> u32; } ::core::mem::transmute(DhcpCreateOptionV5(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(optioninfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpCreateOptionV6<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, classname: Param3, vendorname: Param4, optioninfo: *mut DHCP_OPTION) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpCreateOptionV6(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, optioninfo: *mut DHCP_OPTION) -> u32; } ::core::mem::transmute(DhcpCreateOptionV6(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(optioninfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpCreateSubnet<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, subnetinfo: *const DHCP_SUBNET_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpCreateSubnet(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, subnetinfo: *const DHCP_SUBNET_INFO) -> u32; } ::core::mem::transmute(DhcpCreateSubnet(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(subnetinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpCreateSubnetV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, DHCP_IPV6_ADDRESS>>(serveripaddress: Param0, subnetaddress: Param1, subnetinfo: *mut DHCP_SUBNET_INFO_V6) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpCreateSubnetV6(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: DHCP_IPV6_ADDRESS, subnetinfo: *mut DHCP_SUBNET_INFO_V6) -> u32; } ::core::mem::transmute(DhcpCreateSubnetV6(serveripaddress.into_param().abi(), subnetaddress.into_param().abi(), ::core::mem::transmute(subnetinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpCreateSubnetVQ<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, subnetinfo: *const DHCP_SUBNET_INFO_VQ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpCreateSubnetVQ(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, subnetinfo: *const DHCP_SUBNET_INFO_VQ) -> u32; } ::core::mem::transmute(DhcpCreateSubnetVQ(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(subnetinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn DhcpDeRegisterParamChange(flags: u32, reserved: *mut ::core::ffi::c_void, event: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpDeRegisterParamChange(flags: u32, reserved: *mut ::core::ffi::c_void, event: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(DhcpDeRegisterParamChange(::core::mem::transmute(flags), ::core::mem::transmute(reserved), ::core::mem::transmute(event))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpDeleteClass<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, reservedmustbezero: u32, classname: Param2) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpDeleteClass(serveripaddress: super::super::Foundation::PWSTR, reservedmustbezero: u32, classname: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(DhcpDeleteClass(serveripaddress.into_param().abi(), ::core::mem::transmute(reservedmustbezero), classname.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpDeleteClassV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, reservedmustbezero: u32, classname: Param2) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpDeleteClassV6(serveripaddress: super::super::Foundation::PWSTR, reservedmustbezero: u32, classname: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(DhcpDeleteClassV6(serveripaddress.into_param().abi(), ::core::mem::transmute(reservedmustbezero), classname.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpDeleteClientInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, clientinfo: *const DHCP_SEARCH_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpDeleteClientInfo(serveripaddress: super::super::Foundation::PWSTR, clientinfo: *const DHCP_SEARCH_INFO) -> u32; } ::core::mem::transmute(DhcpDeleteClientInfo(serveripaddress.into_param().abi(), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpDeleteClientInfoV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, clientinfo: *const DHCP_SEARCH_INFO_V6) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpDeleteClientInfoV6(serveripaddress: super::super::Foundation::PWSTR, clientinfo: *const DHCP_SEARCH_INFO_V6) -> u32; } ::core::mem::transmute(DhcpDeleteClientInfoV6(serveripaddress.into_param().abi(), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpDeleteFilterV4<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, deletefilterinfo: *const DHCP_ADDR_PATTERN) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpDeleteFilterV4(serveripaddress: super::super::Foundation::PWSTR, deletefilterinfo: *const DHCP_ADDR_PATTERN) -> u32; } ::core::mem::transmute(DhcpDeleteFilterV4(serveripaddress.into_param().abi(), ::core::mem::transmute(deletefilterinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpDeleteServer(flags: u32, idinfo: *mut ::core::ffi::c_void, newserver: *mut DHCPDS_SERVER, callbackfn: *mut ::core::ffi::c_void, callbackdata: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpDeleteServer(flags: u32, idinfo: *mut ::core::ffi::c_void, newserver: *mut DHCPDS_SERVER, callbackfn: *mut ::core::ffi::c_void, callbackdata: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(DhcpDeleteServer(::core::mem::transmute(flags), ::core::mem::transmute(idinfo), ::core::mem::transmute(newserver), ::core::mem::transmute(callbackfn), ::core::mem::transmute(callbackdata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpDeleteSubnet<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, forceflag: DHCP_FORCE_FLAG) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpDeleteSubnet(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, forceflag: DHCP_FORCE_FLAG) -> u32; } ::core::mem::transmute(DhcpDeleteSubnet(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(forceflag))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpDeleteSubnetV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, DHCP_IPV6_ADDRESS>>(serveripaddress: Param0, subnetaddress: Param1, forceflag: DHCP_FORCE_FLAG) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpDeleteSubnetV6(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: DHCP_IPV6_ADDRESS, forceflag: DHCP_FORCE_FLAG) -> u32; } ::core::mem::transmute(DhcpDeleteSubnetV6(serveripaddress.into_param().abi(), subnetaddress.into_param().abi(), ::core::mem::transmute(forceflag))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpDeleteSuperScopeV4<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, superscopename: Param1) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpDeleteSuperScopeV4(serveripaddress: super::super::Foundation::PWSTR, superscopename: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(DhcpDeleteSuperScopeV4(serveripaddress.into_param().abi(), superscopename.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn DhcpDsCleanup() { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpDsCleanup(); } ::core::mem::transmute(DhcpDsCleanup()) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn DhcpDsInit() -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpDsInit() -> u32; } ::core::mem::transmute(DhcpDsInit()) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumClasses<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, reservedmustbezero: u32, resumehandle: *mut u32, preferredmaximum: u32, classinfoarray: *mut *mut DHCP_CLASS_INFO_ARRAY, nread: *mut u32, ntotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumClasses(serveripaddress: super::super::Foundation::PWSTR, reservedmustbezero: u32, resumehandle: *mut u32, preferredmaximum: u32, classinfoarray: *mut *mut DHCP_CLASS_INFO_ARRAY, nread: *mut u32, ntotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumClasses(serveripaddress.into_param().abi(), ::core::mem::transmute(reservedmustbezero), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(classinfoarray), ::core::mem::transmute(nread), ::core::mem::transmute(ntotal))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumClassesV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, reservedmustbezero: u32, resumehandle: *mut u32, preferredmaximum: u32, classinfoarray: *mut *mut DHCP_CLASS_INFO_ARRAY_V6, nread: *mut u32, ntotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumClassesV6(serveripaddress: super::super::Foundation::PWSTR, reservedmustbezero: u32, resumehandle: *mut u32, preferredmaximum: u32, classinfoarray: *mut *mut DHCP_CLASS_INFO_ARRAY_V6, nread: *mut u32, ntotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumClassesV6(serveripaddress.into_param().abi(), ::core::mem::transmute(reservedmustbezero), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(classinfoarray), ::core::mem::transmute(nread), ::core::mem::transmute(ntotal))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumFilterV4<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, resumehandle: *mut DHCP_ADDR_PATTERN, preferredmaximum: u32, listtype: DHCP_FILTER_LIST_TYPE, enumfilterinfo: *mut *mut DHCP_FILTER_ENUM_INFO, elementsread: *mut u32, elementstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumFilterV4(serveripaddress: super::super::Foundation::PWSTR, resumehandle: *mut DHCP_ADDR_PATTERN, preferredmaximum: u32, listtype: DHCP_FILTER_LIST_TYPE, enumfilterinfo: *mut *mut DHCP_FILTER_ENUM_INFO, elementsread: *mut u32, elementstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumFilterV4(serveripaddress.into_param().abi(), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(listtype), ::core::mem::transmute(enumfilterinfo), ::core::mem::transmute(elementsread), ::core::mem::transmute(elementstotal))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumOptionValues<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, scopeinfo: *const DHCP_OPTION_SCOPE_INFO, resumehandle: *mut u32, preferredmaximum: u32, optionvalues: *mut *mut DHCP_OPTION_VALUE_ARRAY, optionsread: *mut u32, optionstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumOptionValues(serveripaddress: super::super::Foundation::PWSTR, scopeinfo: *const DHCP_OPTION_SCOPE_INFO, resumehandle: *mut u32, preferredmaximum: u32, optionvalues: *mut *mut DHCP_OPTION_VALUE_ARRAY, optionsread: *mut u32, optionstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumOptionValues(serveripaddress.into_param().abi(), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(optionvalues), ::core::mem::transmute(optionsread), ::core::mem::transmute(optionstotal))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumOptionValuesV5<'a, Param0: ::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>>( serveripaddress: Param0, flags: u32, classname: Param2, vendorname: Param3, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, resumehandle: *mut u32, preferredmaximum: u32, optionvalues: *mut *mut DHCP_OPTION_VALUE_ARRAY, optionsread: *mut u32, optionstotal: *mut u32, ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumOptionValuesV5(serveripaddress: super::super::Foundation::PWSTR, flags: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, resumehandle: *mut u32, preferredmaximum: u32, optionvalues: *mut *mut DHCP_OPTION_VALUE_ARRAY, optionsread: *mut u32, optionstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumOptionValuesV5( serveripaddress.into_param().abi(), ::core::mem::transmute(flags), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(optionvalues), ::core::mem::transmute(optionsread), ::core::mem::transmute(optionstotal), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumOptionValuesV6<'a, Param0: ::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>>( serveripaddress: Param0, flags: u32, classname: Param2, vendorname: Param3, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO6, resumehandle: *mut u32, preferredmaximum: u32, optionvalues: *mut *mut DHCP_OPTION_VALUE_ARRAY, optionsread: *mut u32, optionstotal: *mut u32, ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumOptionValuesV6(serveripaddress: super::super::Foundation::PWSTR, flags: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO6, resumehandle: *mut u32, preferredmaximum: u32, optionvalues: *mut *mut DHCP_OPTION_VALUE_ARRAY, optionsread: *mut u32, optionstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumOptionValuesV6( serveripaddress.into_param().abi(), ::core::mem::transmute(flags), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(optionvalues), ::core::mem::transmute(optionsread), ::core::mem::transmute(optionstotal), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumOptions<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, resumehandle: *mut u32, preferredmaximum: u32, options: *mut *mut DHCP_OPTION_ARRAY, optionsread: *mut u32, optionstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumOptions(serveripaddress: super::super::Foundation::PWSTR, resumehandle: *mut u32, preferredmaximum: u32, options: *mut *mut DHCP_OPTION_ARRAY, optionsread: *mut u32, optionstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumOptions(serveripaddress.into_param().abi(), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(options), ::core::mem::transmute(optionsread), ::core::mem::transmute(optionstotal))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumOptionsV5<'a, Param0: ::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>>(serveripaddress: Param0, flags: u32, classname: Param2, vendorname: Param3, resumehandle: *mut u32, preferredmaximum: u32, options: *mut *mut DHCP_OPTION_ARRAY, optionsread: *mut u32, optionstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumOptionsV5(serveripaddress: super::super::Foundation::PWSTR, flags: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, resumehandle: *mut u32, preferredmaximum: u32, options: *mut *mut DHCP_OPTION_ARRAY, optionsread: *mut u32, optionstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumOptionsV5( serveripaddress.into_param().abi(), ::core::mem::transmute(flags), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(options), ::core::mem::transmute(optionsread), ::core::mem::transmute(optionstotal), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumOptionsV6<'a, Param0: ::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>>(serveripaddress: Param0, flags: u32, classname: Param2, vendorname: Param3, resumehandle: *mut u32, preferredmaximum: u32, options: *mut *mut DHCP_OPTION_ARRAY, optionsread: *mut u32, optionstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumOptionsV6(serveripaddress: super::super::Foundation::PWSTR, flags: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, resumehandle: *mut u32, preferredmaximum: u32, options: *mut *mut DHCP_OPTION_ARRAY, optionsread: *mut u32, optionstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumOptionsV6( serveripaddress.into_param().abi(), ::core::mem::transmute(flags), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(options), ::core::mem::transmute(optionsread), ::core::mem::transmute(optionstotal), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumServers(flags: u32, idinfo: *mut ::core::ffi::c_void, servers: *mut *mut DHCPDS_SERVERS, callbackfn: *mut ::core::ffi::c_void, callbackdata: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumServers(flags: u32, idinfo: *mut ::core::ffi::c_void, servers: *mut *mut DHCPDS_SERVERS, callbackfn: *mut ::core::ffi::c_void, callbackdata: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(DhcpEnumServers(::core::mem::transmute(flags), ::core::mem::transmute(idinfo), ::core::mem::transmute(servers), ::core::mem::transmute(callbackfn), ::core::mem::transmute(callbackdata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumSubnetClients<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, resumehandle: *mut u32, preferredmaximum: u32, clientinfo: *mut *mut DHCP_CLIENT_INFO_ARRAY, clientsread: *mut u32, clientstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumSubnetClients(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, resumehandle: *mut u32, preferredmaximum: u32, clientinfo: *mut *mut DHCP_CLIENT_INFO_ARRAY, clientsread: *mut u32, clientstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumSubnetClients(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(clientinfo), ::core::mem::transmute(clientsread), ::core::mem::transmute(clientstotal))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumSubnetClientsFilterStatusInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, resumehandle: *mut u32, preferredmaximum: u32, clientinfo: *mut *mut DHCP_CLIENT_FILTER_STATUS_INFO_ARRAY, clientsread: *mut u32, clientstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumSubnetClientsFilterStatusInfo(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, resumehandle: *mut u32, preferredmaximum: u32, clientinfo: *mut *mut DHCP_CLIENT_FILTER_STATUS_INFO_ARRAY, clientsread: *mut u32, clientstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumSubnetClientsFilterStatusInfo( serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(clientinfo), ::core::mem::transmute(clientsread), ::core::mem::transmute(clientstotal), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumSubnetClientsV4<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, resumehandle: *mut u32, preferredmaximum: u32, clientinfo: *mut *mut DHCP_CLIENT_INFO_ARRAY_V4, clientsread: *mut u32, clientstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumSubnetClientsV4(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, resumehandle: *mut u32, preferredmaximum: u32, clientinfo: *mut *mut DHCP_CLIENT_INFO_ARRAY_V4, clientsread: *mut u32, clientstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumSubnetClientsV4(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(clientinfo), ::core::mem::transmute(clientsread), ::core::mem::transmute(clientstotal))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumSubnetClientsV5<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, resumehandle: *mut u32, preferredmaximum: u32, clientinfo: *mut *mut DHCP_CLIENT_INFO_ARRAY_V5, clientsread: *mut u32, clientstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumSubnetClientsV5(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, resumehandle: *mut u32, preferredmaximum: u32, clientinfo: *mut *mut DHCP_CLIENT_INFO_ARRAY_V5, clientsread: *mut u32, clientstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumSubnetClientsV5(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(clientinfo), ::core::mem::transmute(clientsread), ::core::mem::transmute(clientstotal))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumSubnetClientsV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, DHCP_IPV6_ADDRESS>>(serveripaddress: Param0, subnetaddress: Param1, resumehandle: *mut DHCP_IPV6_ADDRESS, preferredmaximum: u32, clientinfo: *mut *mut DHCP_CLIENT_INFO_ARRAY_V6, clientsread: *mut u32, clientstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumSubnetClientsV6(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: DHCP_IPV6_ADDRESS, resumehandle: *mut DHCP_IPV6_ADDRESS, preferredmaximum: u32, clientinfo: *mut *mut DHCP_CLIENT_INFO_ARRAY_V6, clientsread: *mut u32, clientstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumSubnetClientsV6(serveripaddress.into_param().abi(), subnetaddress.into_param().abi(), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(clientinfo), ::core::mem::transmute(clientsread), ::core::mem::transmute(clientstotal))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumSubnetClientsVQ<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, resumehandle: *mut u32, preferredmaximum: u32, clientinfo: *mut *mut DHCP_CLIENT_INFO_ARRAY_VQ, clientsread: *mut u32, clientstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumSubnetClientsVQ(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, resumehandle: *mut u32, preferredmaximum: u32, clientinfo: *mut *mut DHCP_CLIENT_INFO_ARRAY_VQ, clientsread: *mut u32, clientstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumSubnetClientsVQ(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(clientinfo), ::core::mem::transmute(clientsread), ::core::mem::transmute(clientstotal))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumSubnetElements<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, enumelementtype: DHCP_SUBNET_ELEMENT_TYPE, resumehandle: *mut u32, preferredmaximum: u32, enumelementinfo: *mut *mut DHCP_SUBNET_ELEMENT_INFO_ARRAY, elementsread: *mut u32, elementstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumSubnetElements(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, enumelementtype: DHCP_SUBNET_ELEMENT_TYPE, resumehandle: *mut u32, preferredmaximum: u32, enumelementinfo: *mut *mut DHCP_SUBNET_ELEMENT_INFO_ARRAY, elementsread: *mut u32, elementstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumSubnetElements( serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(enumelementtype), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(enumelementinfo), ::core::mem::transmute(elementsread), ::core::mem::transmute(elementstotal), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumSubnetElementsV4<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, enumelementtype: DHCP_SUBNET_ELEMENT_TYPE, resumehandle: *mut u32, preferredmaximum: u32, enumelementinfo: *mut *mut DHCP_SUBNET_ELEMENT_INFO_ARRAY_V4, elementsread: *mut u32, elementstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumSubnetElementsV4(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, enumelementtype: DHCP_SUBNET_ELEMENT_TYPE, resumehandle: *mut u32, preferredmaximum: u32, enumelementinfo: *mut *mut DHCP_SUBNET_ELEMENT_INFO_ARRAY_V4, elementsread: *mut u32, elementstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumSubnetElementsV4( serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(enumelementtype), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(enumelementinfo), ::core::mem::transmute(elementsread), ::core::mem::transmute(elementstotal), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumSubnetElementsV5<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, enumelementtype: DHCP_SUBNET_ELEMENT_TYPE, resumehandle: *mut u32, preferredmaximum: u32, enumelementinfo: *mut *mut DHCP_SUBNET_ELEMENT_INFO_ARRAY_V5, elementsread: *mut u32, elementstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumSubnetElementsV5(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, enumelementtype: DHCP_SUBNET_ELEMENT_TYPE, resumehandle: *mut u32, preferredmaximum: u32, enumelementinfo: *mut *mut DHCP_SUBNET_ELEMENT_INFO_ARRAY_V5, elementsread: *mut u32, elementstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumSubnetElementsV5( serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(enumelementtype), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(enumelementinfo), ::core::mem::transmute(elementsread), ::core::mem::transmute(elementstotal), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumSubnetElementsV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, DHCP_IPV6_ADDRESS>>(serveripaddress: Param0, subnetaddress: Param1, enumelementtype: DHCP_SUBNET_ELEMENT_TYPE_V6, resumehandle: *mut u32, preferredmaximum: u32, enumelementinfo: *mut *mut DHCP_SUBNET_ELEMENT_INFO_ARRAY_V6, elementsread: *mut u32, elementstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumSubnetElementsV6(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: DHCP_IPV6_ADDRESS, enumelementtype: DHCP_SUBNET_ELEMENT_TYPE_V6, resumehandle: *mut u32, preferredmaximum: u32, enumelementinfo: *mut *mut DHCP_SUBNET_ELEMENT_INFO_ARRAY_V6, elementsread: *mut u32, elementstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumSubnetElementsV6( serveripaddress.into_param().abi(), subnetaddress.into_param().abi(), ::core::mem::transmute(enumelementtype), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(enumelementinfo), ::core::mem::transmute(elementsread), ::core::mem::transmute(elementstotal), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumSubnets<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, resumehandle: *mut u32, preferredmaximum: u32, enuminfo: *mut *mut DHCP_IP_ARRAY, elementsread: *mut u32, elementstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumSubnets(serveripaddress: super::super::Foundation::PWSTR, resumehandle: *mut u32, preferredmaximum: u32, enuminfo: *mut *mut DHCP_IP_ARRAY, elementsread: *mut u32, elementstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumSubnets(serveripaddress.into_param().abi(), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(enuminfo), ::core::mem::transmute(elementsread), ::core::mem::transmute(elementstotal))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpEnumSubnetsV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, resumehandle: *mut u32, preferredmaximum: u32, enuminfo: *mut *mut DHCPV6_IP_ARRAY, elementsread: *mut u32, elementstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpEnumSubnetsV6(serveripaddress: super::super::Foundation::PWSTR, resumehandle: *mut u32, preferredmaximum: u32, enuminfo: *mut *mut DHCPV6_IP_ARRAY, elementsread: *mut u32, elementstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpEnumSubnetsV6(serveripaddress.into_param().abi(), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(enuminfo), ::core::mem::transmute(elementsread), ::core::mem::transmute(elementstotal))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetAllOptionValues<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, flags: u32, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, values: *mut *mut DHCP_ALL_OPTION_VALUES) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetAllOptionValues(serveripaddress: super::super::Foundation::PWSTR, flags: u32, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, values: *mut *mut DHCP_ALL_OPTION_VALUES) -> u32; } ::core::mem::transmute(DhcpGetAllOptionValues(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(values))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetAllOptionValuesV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, flags: u32, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO6, values: *mut *mut DHCP_ALL_OPTION_VALUES) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetAllOptionValuesV6(serveripaddress: super::super::Foundation::PWSTR, flags: u32, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO6, values: *mut *mut DHCP_ALL_OPTION_VALUES) -> u32; } ::core::mem::transmute(DhcpGetAllOptionValuesV6(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(values))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetAllOptions<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, flags: u32, optionstruct: *mut *mut DHCP_ALL_OPTIONS) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetAllOptions(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionstruct: *mut *mut DHCP_ALL_OPTIONS) -> u32; } ::core::mem::transmute(DhcpGetAllOptions(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionstruct))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetAllOptionsV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, flags: u32, optionstruct: *mut *mut DHCP_ALL_OPTIONS) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetAllOptionsV6(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionstruct: *mut *mut DHCP_ALL_OPTIONS) -> u32; } ::core::mem::transmute(DhcpGetAllOptionsV6(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionstruct))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetClassInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, reservedmustbezero: u32, partialclassinfo: *mut DHCP_CLASS_INFO, filledclassinfo: *mut *mut DHCP_CLASS_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetClassInfo(serveripaddress: super::super::Foundation::PWSTR, reservedmustbezero: u32, partialclassinfo: *mut DHCP_CLASS_INFO, filledclassinfo: *mut *mut DHCP_CLASS_INFO) -> u32; } ::core::mem::transmute(DhcpGetClassInfo(serveripaddress.into_param().abi(), ::core::mem::transmute(reservedmustbezero), ::core::mem::transmute(partialclassinfo), ::core::mem::transmute(filledclassinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetClientInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, searchinfo: *const DHCP_SEARCH_INFO, clientinfo: *mut *mut DHCP_CLIENT_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetClientInfo(serveripaddress: super::super::Foundation::PWSTR, searchinfo: *const DHCP_SEARCH_INFO, clientinfo: *mut *mut DHCP_CLIENT_INFO) -> u32; } ::core::mem::transmute(DhcpGetClientInfo(serveripaddress.into_param().abi(), ::core::mem::transmute(searchinfo), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetClientInfoV4<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, searchinfo: *const DHCP_SEARCH_INFO, clientinfo: *mut *mut DHCP_CLIENT_INFO_V4) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetClientInfoV4(serveripaddress: super::super::Foundation::PWSTR, searchinfo: *const DHCP_SEARCH_INFO, clientinfo: *mut *mut DHCP_CLIENT_INFO_V4) -> u32; } ::core::mem::transmute(DhcpGetClientInfoV4(serveripaddress.into_param().abi(), ::core::mem::transmute(searchinfo), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetClientInfoV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, searchinfo: *const DHCP_SEARCH_INFO_V6, clientinfo: *mut *mut DHCP_CLIENT_INFO_V6) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetClientInfoV6(serveripaddress: super::super::Foundation::PWSTR, searchinfo: *const DHCP_SEARCH_INFO_V6, clientinfo: *mut *mut DHCP_CLIENT_INFO_V6) -> u32; } ::core::mem::transmute(DhcpGetClientInfoV6(serveripaddress.into_param().abi(), ::core::mem::transmute(searchinfo), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetClientInfoVQ<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, searchinfo: *const DHCP_SEARCH_INFO, clientinfo: *mut *mut DHCP_CLIENT_INFO_VQ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetClientInfoVQ(serveripaddress: super::super::Foundation::PWSTR, searchinfo: *const DHCP_SEARCH_INFO, clientinfo: *mut *mut DHCP_CLIENT_INFO_VQ) -> u32; } ::core::mem::transmute(DhcpGetClientInfoVQ(serveripaddress.into_param().abi(), ::core::mem::transmute(searchinfo), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetClientOptions<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, clientipaddress: u32, clientsubnetmask: u32, clientoptions: *mut *mut DHCP_OPTION_LIST) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetClientOptions(serveripaddress: super::super::Foundation::PWSTR, clientipaddress: u32, clientsubnetmask: u32, clientoptions: *mut *mut DHCP_OPTION_LIST) -> u32; } ::core::mem::transmute(DhcpGetClientOptions(serveripaddress.into_param().abi(), ::core::mem::transmute(clientipaddress), ::core::mem::transmute(clientsubnetmask), ::core::mem::transmute(clientoptions))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetFilterV4<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, globalfilterinfo: *mut DHCP_FILTER_GLOBAL_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetFilterV4(serveripaddress: super::super::Foundation::PWSTR, globalfilterinfo: *mut DHCP_FILTER_GLOBAL_INFO) -> u32; } ::core::mem::transmute(DhcpGetFilterV4(serveripaddress.into_param().abi(), ::core::mem::transmute(globalfilterinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetMibInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, mibinfo: *mut *mut DHCP_MIB_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetMibInfo(serveripaddress: super::super::Foundation::PWSTR, mibinfo: *mut *mut DHCP_MIB_INFO) -> u32; } ::core::mem::transmute(DhcpGetMibInfo(serveripaddress.into_param().abi(), ::core::mem::transmute(mibinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetMibInfoV5<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, mibinfo: *mut *mut DHCP_MIB_INFO_V5) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetMibInfoV5(serveripaddress: super::super::Foundation::PWSTR, mibinfo: *mut *mut DHCP_MIB_INFO_V5) -> u32; } ::core::mem::transmute(DhcpGetMibInfoV5(serveripaddress.into_param().abi(), ::core::mem::transmute(mibinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetMibInfoV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, mibinfo: *mut *mut DHCP_MIB_INFO_V6) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetMibInfoV6(serveripaddress: super::super::Foundation::PWSTR, mibinfo: *mut *mut DHCP_MIB_INFO_V6) -> u32; } ::core::mem::transmute(DhcpGetMibInfoV6(serveripaddress.into_param().abi(), ::core::mem::transmute(mibinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetOptionInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, optionid: u32, optioninfo: *mut *mut DHCP_OPTION) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetOptionInfo(serveripaddress: super::super::Foundation::PWSTR, optionid: u32, optioninfo: *mut *mut DHCP_OPTION) -> u32; } ::core::mem::transmute(DhcpGetOptionInfo(serveripaddress.into_param().abi(), ::core::mem::transmute(optionid), ::core::mem::transmute(optioninfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetOptionInfoV5<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, classname: Param3, vendorname: Param4, optioninfo: *mut *mut DHCP_OPTION) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetOptionInfoV5(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, optioninfo: *mut *mut DHCP_OPTION) -> u32; } ::core::mem::transmute(DhcpGetOptionInfoV5(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(optioninfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetOptionInfoV6<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, classname: Param3, vendorname: Param4, optioninfo: *mut *mut DHCP_OPTION) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetOptionInfoV6(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, optioninfo: *mut *mut DHCP_OPTION) -> u32; } ::core::mem::transmute(DhcpGetOptionInfoV6(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(optioninfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetOptionValue<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, optionid: u32, scopeinfo: *const DHCP_OPTION_SCOPE_INFO, optionvalue: *mut *mut DHCP_OPTION_VALUE) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetOptionValue(serveripaddress: super::super::Foundation::PWSTR, optionid: u32, scopeinfo: *const DHCP_OPTION_SCOPE_INFO, optionvalue: *mut *mut DHCP_OPTION_VALUE) -> u32; } ::core::mem::transmute(DhcpGetOptionValue(serveripaddress.into_param().abi(), ::core::mem::transmute(optionid), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(optionvalue))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetOptionValueV5<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, classname: Param3, vendorname: Param4, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, optionvalue: *mut *mut DHCP_OPTION_VALUE) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetOptionValueV5(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, optionvalue: *mut *mut DHCP_OPTION_VALUE) -> u32; } ::core::mem::transmute(DhcpGetOptionValueV5(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(optionvalue))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetOptionValueV6<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, classname: Param3, vendorname: Param4, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO6, optionvalue: *mut *mut DHCP_OPTION_VALUE) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetOptionValueV6(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO6, optionvalue: *mut *mut DHCP_OPTION_VALUE) -> u32; } ::core::mem::transmute(DhcpGetOptionValueV6(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(optionvalue))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetOriginalSubnetMask<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(sadaptername: Param0, dwsubnetmask: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetOriginalSubnetMask(sadaptername: super::super::Foundation::PWSTR, dwsubnetmask: *mut u32) -> u32; } ::core::mem::transmute(DhcpGetOriginalSubnetMask(sadaptername.into_param().abi(), ::core::mem::transmute(dwsubnetmask))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetServerBindingInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, flags: u32, bindelementsinfo: *mut *mut DHCP_BIND_ELEMENT_ARRAY) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetServerBindingInfo(serveripaddress: super::super::Foundation::PWSTR, flags: u32, bindelementsinfo: *mut *mut DHCP_BIND_ELEMENT_ARRAY) -> u32; } ::core::mem::transmute(DhcpGetServerBindingInfo(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(bindelementsinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetServerBindingInfoV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, flags: u32, bindelementsinfo: *mut *mut DHCPV6_BIND_ELEMENT_ARRAY) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetServerBindingInfoV6(serveripaddress: super::super::Foundation::PWSTR, flags: u32, bindelementsinfo: *mut *mut DHCPV6_BIND_ELEMENT_ARRAY) -> u32; } ::core::mem::transmute(DhcpGetServerBindingInfoV6(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(bindelementsinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetServerSpecificStrings<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, serverspecificstrings: *mut *mut DHCP_SERVER_SPECIFIC_STRINGS) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetServerSpecificStrings(serveripaddress: super::super::Foundation::PWSTR, serverspecificstrings: *mut *mut DHCP_SERVER_SPECIFIC_STRINGS) -> u32; } ::core::mem::transmute(DhcpGetServerSpecificStrings(serveripaddress.into_param().abi(), ::core::mem::transmute(serverspecificstrings))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetSubnetDelayOffer<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, timedelayinmilliseconds: *mut u16) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetSubnetDelayOffer(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, timedelayinmilliseconds: *mut u16) -> u32; } ::core::mem::transmute(DhcpGetSubnetDelayOffer(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(timedelayinmilliseconds))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetSubnetInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, subnetinfo: *mut *mut DHCP_SUBNET_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetSubnetInfo(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, subnetinfo: *mut *mut DHCP_SUBNET_INFO) -> u32; } ::core::mem::transmute(DhcpGetSubnetInfo(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(subnetinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetSubnetInfoV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, DHCP_IPV6_ADDRESS>>(serveripaddress: Param0, subnetaddress: Param1, subnetinfo: *mut *mut DHCP_SUBNET_INFO_V6) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetSubnetInfoV6(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: DHCP_IPV6_ADDRESS, subnetinfo: *mut *mut DHCP_SUBNET_INFO_V6) -> u32; } ::core::mem::transmute(DhcpGetSubnetInfoV6(serveripaddress.into_param().abi(), subnetaddress.into_param().abi(), ::core::mem::transmute(subnetinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetSubnetInfoVQ<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, subnetinfo: *mut *mut DHCP_SUBNET_INFO_VQ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetSubnetInfoVQ(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, subnetinfo: *mut *mut DHCP_SUBNET_INFO_VQ) -> u32; } ::core::mem::transmute(DhcpGetSubnetInfoVQ(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(subnetinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetSuperScopeInfoV4<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, superscopetable: *mut *mut DHCP_SUPER_SCOPE_TABLE) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetSuperScopeInfoV4(serveripaddress: super::super::Foundation::PWSTR, superscopetable: *mut *mut DHCP_SUPER_SCOPE_TABLE) -> u32; } ::core::mem::transmute(DhcpGetSuperScopeInfoV4(serveripaddress.into_param().abi(), ::core::mem::transmute(superscopetable))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn DhcpGetThreadOptions(pflags: *mut u32, reserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetThreadOptions(pflags: *mut u32, reserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(DhcpGetThreadOptions(::core::mem::transmute(pflags), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpGetVersion<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, majorversion: *mut u32, minorversion: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpGetVersion(serveripaddress: super::super::Foundation::PWSTR, majorversion: *mut u32, minorversion: *mut u32) -> u32; } ::core::mem::transmute(DhcpGetVersion(serveripaddress.into_param().abi(), ::core::mem::transmute(majorversion), ::core::mem::transmute(minorversion))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprAddV4PolicyCondition<'a, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(policy: *mut DHCP_POLICY, parentexpr: u32, r#type: DHCP_POL_ATTR_TYPE, optionid: u32, suboptionid: u32, vendorname: Param5, operator: DHCP_POL_COMPARATOR, value: *const u8, valuelength: u32, conditionindex: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprAddV4PolicyCondition(policy: *mut DHCP_POLICY, parentexpr: u32, r#type: DHCP_POL_ATTR_TYPE, optionid: u32, suboptionid: u32, vendorname: super::super::Foundation::PWSTR, operator: DHCP_POL_COMPARATOR, value: *const u8, valuelength: u32, conditionindex: *mut u32) -> u32; } ::core::mem::transmute(DhcpHlprAddV4PolicyCondition( ::core::mem::transmute(policy), ::core::mem::transmute(parentexpr), ::core::mem::transmute(r#type), ::core::mem::transmute(optionid), ::core::mem::transmute(suboptionid), vendorname.into_param().abi(), ::core::mem::transmute(operator), ::core::mem::transmute(value), ::core::mem::transmute(valuelength), ::core::mem::transmute(conditionindex), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprAddV4PolicyExpr(policy: *mut DHCP_POLICY, parentexpr: u32, operator: DHCP_POL_LOGIC_OPER, exprindex: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprAddV4PolicyExpr(policy: *mut DHCP_POLICY, parentexpr: u32, operator: DHCP_POL_LOGIC_OPER, exprindex: *mut u32) -> u32; } ::core::mem::transmute(DhcpHlprAddV4PolicyExpr(::core::mem::transmute(policy), ::core::mem::transmute(parentexpr), ::core::mem::transmute(operator), ::core::mem::transmute(exprindex))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprAddV4PolicyRange(policy: *mut DHCP_POLICY, range: *const DHCP_IP_RANGE) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprAddV4PolicyRange(policy: *mut DHCP_POLICY, range: *const DHCP_IP_RANGE) -> u32; } ::core::mem::transmute(DhcpHlprAddV4PolicyRange(::core::mem::transmute(policy), ::core::mem::transmute(range))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprCreateV4Policy<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param6: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>( policyname: Param0, fglobalpolicy: Param1, subnet: u32, processingorder: u32, rootoperator: DHCP_POL_LOGIC_OPER, description: Param5, enabled: Param6, policy: *mut *mut DHCP_POLICY, ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprCreateV4Policy(policyname: super::super::Foundation::PWSTR, fglobalpolicy: super::super::Foundation::BOOL, subnet: u32, processingorder: u32, rootoperator: DHCP_POL_LOGIC_OPER, description: super::super::Foundation::PWSTR, enabled: super::super::Foundation::BOOL, policy: *mut *mut DHCP_POLICY) -> u32; } ::core::mem::transmute(DhcpHlprCreateV4Policy(policyname.into_param().abi(), fglobalpolicy.into_param().abi(), ::core::mem::transmute(subnet), ::core::mem::transmute(processingorder), ::core::mem::transmute(rootoperator), description.into_param().abi(), enabled.into_param().abi(), ::core::mem::transmute(policy))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprCreateV4PolicyEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param6: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>( policyname: Param0, fglobalpolicy: Param1, subnet: u32, processingorder: u32, rootoperator: DHCP_POL_LOGIC_OPER, description: Param5, enabled: Param6, policy: *mut *mut DHCP_POLICY_EX, ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprCreateV4PolicyEx(policyname: super::super::Foundation::PWSTR, fglobalpolicy: super::super::Foundation::BOOL, subnet: u32, processingorder: u32, rootoperator: DHCP_POL_LOGIC_OPER, description: super::super::Foundation::PWSTR, enabled: super::super::Foundation::BOOL, policy: *mut *mut DHCP_POLICY_EX) -> u32; } ::core::mem::transmute(DhcpHlprCreateV4PolicyEx(policyname.into_param().abi(), fglobalpolicy.into_param().abi(), ::core::mem::transmute(subnet), ::core::mem::transmute(processingorder), ::core::mem::transmute(rootoperator), description.into_param().abi(), enabled.into_param().abi(), ::core::mem::transmute(policy))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprFindV4DhcpProperty(propertyarray: *const DHCP_PROPERTY_ARRAY, id: DHCP_PROPERTY_ID, r#type: DHCP_PROPERTY_TYPE) -> *mut DHCP_PROPERTY { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprFindV4DhcpProperty(propertyarray: *const DHCP_PROPERTY_ARRAY, id: DHCP_PROPERTY_ID, r#type: DHCP_PROPERTY_TYPE) -> *mut DHCP_PROPERTY; } ::core::mem::transmute(DhcpHlprFindV4DhcpProperty(::core::mem::transmute(propertyarray), ::core::mem::transmute(id), ::core::mem::transmute(r#type))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprFreeV4DhcpProperty(property: *mut DHCP_PROPERTY) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprFreeV4DhcpProperty(property: *mut DHCP_PROPERTY); } ::core::mem::transmute(DhcpHlprFreeV4DhcpProperty(::core::mem::transmute(property))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprFreeV4DhcpPropertyArray(propertyarray: *mut DHCP_PROPERTY_ARRAY) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprFreeV4DhcpPropertyArray(propertyarray: *mut DHCP_PROPERTY_ARRAY); } ::core::mem::transmute(DhcpHlprFreeV4DhcpPropertyArray(::core::mem::transmute(propertyarray))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprFreeV4Policy(policy: *mut DHCP_POLICY) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprFreeV4Policy(policy: *mut DHCP_POLICY); } ::core::mem::transmute(DhcpHlprFreeV4Policy(::core::mem::transmute(policy))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprFreeV4PolicyArray(policyarray: *mut DHCP_POLICY_ARRAY) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprFreeV4PolicyArray(policyarray: *mut DHCP_POLICY_ARRAY); } ::core::mem::transmute(DhcpHlprFreeV4PolicyArray(::core::mem::transmute(policyarray))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprFreeV4PolicyEx(policyex: *mut DHCP_POLICY_EX) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprFreeV4PolicyEx(policyex: *mut DHCP_POLICY_EX); } ::core::mem::transmute(DhcpHlprFreeV4PolicyEx(::core::mem::transmute(policyex))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprFreeV4PolicyExArray(policyexarray: *mut DHCP_POLICY_EX_ARRAY) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprFreeV4PolicyExArray(policyexarray: *mut DHCP_POLICY_EX_ARRAY); } ::core::mem::transmute(DhcpHlprFreeV4PolicyExArray(::core::mem::transmute(policyexarray))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprIsV4PolicySingleUC(policy: *const DHCP_POLICY) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprIsV4PolicySingleUC(policy: *const DHCP_POLICY) -> super::super::Foundation::BOOL; } ::core::mem::transmute(DhcpHlprIsV4PolicySingleUC(::core::mem::transmute(policy))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprIsV4PolicyValid(ppolicy: *const DHCP_POLICY) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprIsV4PolicyValid(ppolicy: *const DHCP_POLICY) -> u32; } ::core::mem::transmute(DhcpHlprIsV4PolicyValid(::core::mem::transmute(ppolicy))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprIsV4PolicyWellFormed(ppolicy: *const DHCP_POLICY) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprIsV4PolicyWellFormed(ppolicy: *const DHCP_POLICY) -> super::super::Foundation::BOOL; } ::core::mem::transmute(DhcpHlprIsV4PolicyWellFormed(::core::mem::transmute(ppolicy))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprModifyV4PolicyExpr(policy: *mut DHCP_POLICY, operator: DHCP_POL_LOGIC_OPER) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprModifyV4PolicyExpr(policy: *mut DHCP_POLICY, operator: DHCP_POL_LOGIC_OPER) -> u32; } ::core::mem::transmute(DhcpHlprModifyV4PolicyExpr(::core::mem::transmute(policy), ::core::mem::transmute(operator))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpHlprResetV4PolicyExpr(policy: *mut DHCP_POLICY) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpHlprResetV4PolicyExpr(policy: *mut DHCP_POLICY) -> u32; } ::core::mem::transmute(DhcpHlprResetV4PolicyExpr(::core::mem::transmute(policy))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpModifyClass<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, reservedmustbezero: u32, classinfo: *mut DHCP_CLASS_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpModifyClass(serveripaddress: super::super::Foundation::PWSTR, reservedmustbezero: u32, classinfo: *mut DHCP_CLASS_INFO) -> u32; } ::core::mem::transmute(DhcpModifyClass(serveripaddress.into_param().abi(), ::core::mem::transmute(reservedmustbezero), ::core::mem::transmute(classinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpModifyClassV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, reservedmustbezero: u32, classinfo: *mut DHCP_CLASS_INFO_V6) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpModifyClassV6(serveripaddress: super::super::Foundation::PWSTR, reservedmustbezero: u32, classinfo: *mut DHCP_CLASS_INFO_V6) -> u32; } ::core::mem::transmute(DhcpModifyClassV6(serveripaddress.into_param().abi(), ::core::mem::transmute(reservedmustbezero), ::core::mem::transmute(classinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpRegisterParamChange<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, DHCPCAPI_PARAMS_ARRAY>>(flags: u32, reserved: *mut ::core::ffi::c_void, adaptername: Param2, classid: *mut DHCPCAPI_CLASSID, params: Param4, handle: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpRegisterParamChange(flags: u32, reserved: *mut ::core::ffi::c_void, adaptername: super::super::Foundation::PWSTR, classid: *mut DHCPCAPI_CLASSID, params: DHCPCAPI_PARAMS_ARRAY, handle: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(DhcpRegisterParamChange(::core::mem::transmute(flags), ::core::mem::transmute(reserved), adaptername.into_param().abi(), ::core::mem::transmute(classid), params.into_param().abi(), ::core::mem::transmute(handle))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn DhcpRemoveDNSRegistrations() -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpRemoveDNSRegistrations() -> u32; } ::core::mem::transmute(DhcpRemoveDNSRegistrations()) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpRemoveOption<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, optionid: u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpRemoveOption(serveripaddress: super::super::Foundation::PWSTR, optionid: u32) -> u32; } ::core::mem::transmute(DhcpRemoveOption(serveripaddress.into_param().abi(), ::core::mem::transmute(optionid))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpRemoveOptionV5<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, classname: Param3, vendorname: Param4) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpRemoveOptionV5(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(DhcpRemoveOptionV5(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), classname.into_param().abi(), vendorname.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpRemoveOptionV6<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, classname: Param3, vendorname: Param4) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpRemoveOptionV6(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(DhcpRemoveOptionV6(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), classname.into_param().abi(), vendorname.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpRemoveOptionValue<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, optionid: u32, scopeinfo: *const DHCP_OPTION_SCOPE_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpRemoveOptionValue(serveripaddress: super::super::Foundation::PWSTR, optionid: u32, scopeinfo: *const DHCP_OPTION_SCOPE_INFO) -> u32; } ::core::mem::transmute(DhcpRemoveOptionValue(serveripaddress.into_param().abi(), ::core::mem::transmute(optionid), ::core::mem::transmute(scopeinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpRemoveOptionValueV5<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, classname: Param3, vendorname: Param4, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpRemoveOptionValueV5(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO) -> u32; } ::core::mem::transmute(DhcpRemoveOptionValueV5(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(scopeinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpRemoveOptionValueV6<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, classname: Param3, vendorname: Param4, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO6) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpRemoveOptionValueV6(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO6) -> u32; } ::core::mem::transmute(DhcpRemoveOptionValueV6(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(scopeinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpRemoveSubnetElement<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, removeelementinfo: *const DHCP_SUBNET_ELEMENT_DATA, forceflag: DHCP_FORCE_FLAG) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpRemoveSubnetElement(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, removeelementinfo: *const DHCP_SUBNET_ELEMENT_DATA, forceflag: DHCP_FORCE_FLAG) -> u32; } ::core::mem::transmute(DhcpRemoveSubnetElement(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(removeelementinfo), ::core::mem::transmute(forceflag))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpRemoveSubnetElementV4<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, removeelementinfo: *const DHCP_SUBNET_ELEMENT_DATA_V4, forceflag: DHCP_FORCE_FLAG) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpRemoveSubnetElementV4(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, removeelementinfo: *const DHCP_SUBNET_ELEMENT_DATA_V4, forceflag: DHCP_FORCE_FLAG) -> u32; } ::core::mem::transmute(DhcpRemoveSubnetElementV4(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(removeelementinfo), ::core::mem::transmute(forceflag))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpRemoveSubnetElementV5<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, removeelementinfo: *const DHCP_SUBNET_ELEMENT_DATA_V5, forceflag: DHCP_FORCE_FLAG) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpRemoveSubnetElementV5(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, removeelementinfo: *const DHCP_SUBNET_ELEMENT_DATA_V5, forceflag: DHCP_FORCE_FLAG) -> u32; } ::core::mem::transmute(DhcpRemoveSubnetElementV5(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(removeelementinfo), ::core::mem::transmute(forceflag))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpRemoveSubnetElementV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, DHCP_IPV6_ADDRESS>>(serveripaddress: Param0, subnetaddress: Param1, removeelementinfo: *mut DHCP_SUBNET_ELEMENT_DATA_V6, forceflag: DHCP_FORCE_FLAG) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpRemoveSubnetElementV6(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: DHCP_IPV6_ADDRESS, removeelementinfo: *mut DHCP_SUBNET_ELEMENT_DATA_V6, forceflag: DHCP_FORCE_FLAG) -> u32; } ::core::mem::transmute(DhcpRemoveSubnetElementV6(serveripaddress.into_param().abi(), subnetaddress.into_param().abi(), ::core::mem::transmute(removeelementinfo), ::core::mem::transmute(forceflag))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpRequestParams<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, DHCPCAPI_PARAMS_ARRAY>, Param5: ::windows::core::IntoParam<'a, DHCPCAPI_PARAMS_ARRAY>, Param8: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>( flags: u32, reserved: *mut ::core::ffi::c_void, adaptername: Param2, classid: *mut DHCPCAPI_CLASSID, sendparams: Param4, recdparams: Param5, buffer: *mut u8, psize: *mut u32, requestidstr: Param8, ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpRequestParams(flags: u32, reserved: *mut ::core::ffi::c_void, adaptername: super::super::Foundation::PWSTR, classid: *mut DHCPCAPI_CLASSID, sendparams: DHCPCAPI_PARAMS_ARRAY, recdparams: DHCPCAPI_PARAMS_ARRAY, buffer: *mut u8, psize: *mut u32, requestidstr: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(DhcpRequestParams( ::core::mem::transmute(flags), ::core::mem::transmute(reserved), adaptername.into_param().abi(), ::core::mem::transmute(classid), sendparams.into_param().abi(), recdparams.into_param().abi(), ::core::mem::transmute(buffer), ::core::mem::transmute(psize), requestidstr.into_param().abi(), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn DhcpRpcFreeMemory(bufferpointer: *mut ::core::ffi::c_void) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpRpcFreeMemory(bufferpointer: *mut ::core::ffi::c_void); } ::core::mem::transmute(DhcpRpcFreeMemory(::core::mem::transmute(bufferpointer))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpScanDatabase<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, fixflag: u32, scanlist: *mut *mut DHCP_SCAN_LIST) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpScanDatabase(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, fixflag: u32, scanlist: *mut *mut DHCP_SCAN_LIST) -> u32; } ::core::mem::transmute(DhcpScanDatabase(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(fixflag), ::core::mem::transmute(scanlist))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerAuditlogParamsFree(configinfo: *mut DHCP_SERVER_CONFIG_INFO_VQ) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerAuditlogParamsFree(configinfo: *mut DHCP_SERVER_CONFIG_INFO_VQ); } ::core::mem::transmute(DhcpServerAuditlogParamsFree(::core::mem::transmute(configinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerBackupDatabase<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, path: Param1) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerBackupDatabase(serveripaddress: super::super::Foundation::PWSTR, path: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(DhcpServerBackupDatabase(serveripaddress.into_param().abi(), path.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerGetConfig<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, configinfo: *mut *mut DHCP_SERVER_CONFIG_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerGetConfig(serveripaddress: super::super::Foundation::PWSTR, configinfo: *mut *mut DHCP_SERVER_CONFIG_INFO) -> u32; } ::core::mem::transmute(DhcpServerGetConfig(serveripaddress.into_param().abi(), ::core::mem::transmute(configinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerGetConfigV4<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, configinfo: *mut *mut DHCP_SERVER_CONFIG_INFO_V4) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerGetConfigV4(serveripaddress: super::super::Foundation::PWSTR, configinfo: *mut *mut DHCP_SERVER_CONFIG_INFO_V4) -> u32; } ::core::mem::transmute(DhcpServerGetConfigV4(serveripaddress.into_param().abi(), ::core::mem::transmute(configinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerGetConfigV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO6, configinfo: *mut *mut DHCP_SERVER_CONFIG_INFO_V6) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerGetConfigV6(serveripaddress: super::super::Foundation::PWSTR, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO6, configinfo: *mut *mut DHCP_SERVER_CONFIG_INFO_V6) -> u32; } ::core::mem::transmute(DhcpServerGetConfigV6(serveripaddress.into_param().abi(), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(configinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerGetConfigVQ<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, configinfo: *mut *mut DHCP_SERVER_CONFIG_INFO_VQ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerGetConfigVQ(serveripaddress: super::super::Foundation::PWSTR, configinfo: *mut *mut DHCP_SERVER_CONFIG_INFO_VQ) -> u32; } ::core::mem::transmute(DhcpServerGetConfigVQ(serveripaddress.into_param().abi(), ::core::mem::transmute(configinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerQueryAttribute<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddr: Param0, dwreserved: u32, dhcpattribid: u32, pdhcpattrib: *mut *mut DHCP_ATTRIB) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerQueryAttribute(serveripaddr: super::super::Foundation::PWSTR, dwreserved: u32, dhcpattribid: u32, pdhcpattrib: *mut *mut DHCP_ATTRIB) -> u32; } ::core::mem::transmute(DhcpServerQueryAttribute(serveripaddr.into_param().abi(), ::core::mem::transmute(dwreserved), ::core::mem::transmute(dhcpattribid), ::core::mem::transmute(pdhcpattrib))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerQueryAttributes<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddr: Param0, dwreserved: u32, dwattribcount: u32, pdhcpattribs: *mut u32, pdhcpattribarr: *mut *mut DHCP_ATTRIB_ARRAY) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerQueryAttributes(serveripaddr: super::super::Foundation::PWSTR, dwreserved: u32, dwattribcount: u32, pdhcpattribs: *mut u32, pdhcpattribarr: *mut *mut DHCP_ATTRIB_ARRAY) -> u32; } ::core::mem::transmute(DhcpServerQueryAttributes(serveripaddr.into_param().abi(), ::core::mem::transmute(dwreserved), ::core::mem::transmute(dwattribcount), ::core::mem::transmute(pdhcpattribs), ::core::mem::transmute(pdhcpattribarr))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerQueryDnsRegCredentials<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, unamesize: u32, uname: super::super::Foundation::PWSTR, domainsize: u32, domain: super::super::Foundation::PWSTR) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerQueryDnsRegCredentials(serveripaddress: super::super::Foundation::PWSTR, unamesize: u32, uname: super::super::Foundation::PWSTR, domainsize: u32, domain: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(DhcpServerQueryDnsRegCredentials(serveripaddress.into_param().abi(), ::core::mem::transmute(unamesize), ::core::mem::transmute(uname), ::core::mem::transmute(domainsize), ::core::mem::transmute(domain))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerRedoAuthorization<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddr: Param0, dwreserved: u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerRedoAuthorization(serveripaddr: super::super::Foundation::PWSTR, dwreserved: u32) -> u32; } ::core::mem::transmute(DhcpServerRedoAuthorization(serveripaddr.into_param().abi(), ::core::mem::transmute(dwreserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerRestoreDatabase<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, path: Param1) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerRestoreDatabase(serveripaddress: super::super::Foundation::PWSTR, path: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(DhcpServerRestoreDatabase(serveripaddress.into_param().abi(), path.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerSetConfig<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, fieldstoset: u32, configinfo: *mut DHCP_SERVER_CONFIG_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerSetConfig(serveripaddress: super::super::Foundation::PWSTR, fieldstoset: u32, configinfo: *mut DHCP_SERVER_CONFIG_INFO) -> u32; } ::core::mem::transmute(DhcpServerSetConfig(serveripaddress.into_param().abi(), ::core::mem::transmute(fieldstoset), ::core::mem::transmute(configinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerSetConfigV4<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, fieldstoset: u32, configinfo: *mut DHCP_SERVER_CONFIG_INFO_V4) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerSetConfigV4(serveripaddress: super::super::Foundation::PWSTR, fieldstoset: u32, configinfo: *mut DHCP_SERVER_CONFIG_INFO_V4) -> u32; } ::core::mem::transmute(DhcpServerSetConfigV4(serveripaddress.into_param().abi(), ::core::mem::transmute(fieldstoset), ::core::mem::transmute(configinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerSetConfigV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO6, fieldstoset: u32, configinfo: *mut DHCP_SERVER_CONFIG_INFO_V6) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerSetConfigV6(serveripaddress: super::super::Foundation::PWSTR, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO6, fieldstoset: u32, configinfo: *mut DHCP_SERVER_CONFIG_INFO_V6) -> u32; } ::core::mem::transmute(DhcpServerSetConfigV6(serveripaddress.into_param().abi(), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(fieldstoset), ::core::mem::transmute(configinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerSetConfigVQ<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, fieldstoset: u32, configinfo: *mut DHCP_SERVER_CONFIG_INFO_VQ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerSetConfigVQ(serveripaddress: super::super::Foundation::PWSTR, fieldstoset: u32, configinfo: *mut DHCP_SERVER_CONFIG_INFO_VQ) -> u32; } ::core::mem::transmute(DhcpServerSetConfigVQ(serveripaddress.into_param().abi(), ::core::mem::transmute(fieldstoset), ::core::mem::transmute(configinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerSetDnsRegCredentials<'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>>(serveripaddress: Param0, uname: Param1, domain: Param2, passwd: Param3) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerSetDnsRegCredentials(serveripaddress: super::super::Foundation::PWSTR, uname: super::super::Foundation::PWSTR, domain: super::super::Foundation::PWSTR, passwd: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(DhcpServerSetDnsRegCredentials(serveripaddress.into_param().abi(), uname.into_param().abi(), domain.into_param().abi(), passwd.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpServerSetDnsRegCredentialsV5<'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>>(serveripaddress: Param0, uname: Param1, domain: Param2, passwd: Param3) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpServerSetDnsRegCredentialsV5(serveripaddress: super::super::Foundation::PWSTR, uname: super::super::Foundation::PWSTR, domain: super::super::Foundation::PWSTR, passwd: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(DhcpServerSetDnsRegCredentialsV5(serveripaddress.into_param().abi(), uname.into_param().abi(), domain.into_param().abi(), passwd.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetClientInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, clientinfo: *const DHCP_CLIENT_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetClientInfo(serveripaddress: super::super::Foundation::PWSTR, clientinfo: *const DHCP_CLIENT_INFO) -> u32; } ::core::mem::transmute(DhcpSetClientInfo(serveripaddress.into_param().abi(), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetClientInfoV4<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, clientinfo: *const DHCP_CLIENT_INFO_V4) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetClientInfoV4(serveripaddress: super::super::Foundation::PWSTR, clientinfo: *const DHCP_CLIENT_INFO_V4) -> u32; } ::core::mem::transmute(DhcpSetClientInfoV4(serveripaddress.into_param().abi(), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetClientInfoV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, clientinfo: *const DHCP_CLIENT_INFO_V6) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetClientInfoV6(serveripaddress: super::super::Foundation::PWSTR, clientinfo: *const DHCP_CLIENT_INFO_V6) -> u32; } ::core::mem::transmute(DhcpSetClientInfoV6(serveripaddress.into_param().abi(), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetClientInfoVQ<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, clientinfo: *const DHCP_CLIENT_INFO_VQ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetClientInfoVQ(serveripaddress: super::super::Foundation::PWSTR, clientinfo: *const DHCP_CLIENT_INFO_VQ) -> u32; } ::core::mem::transmute(DhcpSetClientInfoVQ(serveripaddress.into_param().abi(), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetFilterV4<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, globalfilterinfo: *const DHCP_FILTER_GLOBAL_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetFilterV4(serveripaddress: super::super::Foundation::PWSTR, globalfilterinfo: *const DHCP_FILTER_GLOBAL_INFO) -> u32; } ::core::mem::transmute(DhcpSetFilterV4(serveripaddress.into_param().abi(), ::core::mem::transmute(globalfilterinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetOptionInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, optionid: u32, optioninfo: *const DHCP_OPTION) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetOptionInfo(serveripaddress: super::super::Foundation::PWSTR, optionid: u32, optioninfo: *const DHCP_OPTION) -> u32; } ::core::mem::transmute(DhcpSetOptionInfo(serveripaddress.into_param().abi(), ::core::mem::transmute(optionid), ::core::mem::transmute(optioninfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetOptionInfoV5<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, classname: Param3, vendorname: Param4, optioninfo: *mut DHCP_OPTION) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetOptionInfoV5(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, optioninfo: *mut DHCP_OPTION) -> u32; } ::core::mem::transmute(DhcpSetOptionInfoV5(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(optioninfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetOptionInfoV6<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, classname: Param3, vendorname: Param4, optioninfo: *mut DHCP_OPTION) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetOptionInfoV6(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, optioninfo: *mut DHCP_OPTION) -> u32; } ::core::mem::transmute(DhcpSetOptionInfoV6(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(optioninfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetOptionValue<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, optionid: u32, scopeinfo: *const DHCP_OPTION_SCOPE_INFO, optionvalue: *const DHCP_OPTION_DATA) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetOptionValue(serveripaddress: super::super::Foundation::PWSTR, optionid: u32, scopeinfo: *const DHCP_OPTION_SCOPE_INFO, optionvalue: *const DHCP_OPTION_DATA) -> u32; } ::core::mem::transmute(DhcpSetOptionValue(serveripaddress.into_param().abi(), ::core::mem::transmute(optionid), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(optionvalue))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetOptionValueV5<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, classname: Param3, vendorname: Param4, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, optionvalue: *mut DHCP_OPTION_DATA) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetOptionValueV5(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, optionvalue: *mut DHCP_OPTION_DATA) -> u32; } ::core::mem::transmute(DhcpSetOptionValueV5(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(optionvalue))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetOptionValueV6<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, classname: Param3, vendorname: Param4, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO6, optionvalue: *mut DHCP_OPTION_DATA) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetOptionValueV6(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO6, optionvalue: *mut DHCP_OPTION_DATA) -> u32; } ::core::mem::transmute(DhcpSetOptionValueV6(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(optionvalue))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetOptionValues<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, scopeinfo: *const DHCP_OPTION_SCOPE_INFO, optionvalues: *const DHCP_OPTION_VALUE_ARRAY) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetOptionValues(serveripaddress: super::super::Foundation::PWSTR, scopeinfo: *const DHCP_OPTION_SCOPE_INFO, optionvalues: *const DHCP_OPTION_VALUE_ARRAY) -> u32; } ::core::mem::transmute(DhcpSetOptionValues(serveripaddress.into_param().abi(), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(optionvalues))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetOptionValuesV5<'a, Param0: ::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>>(serveripaddress: Param0, flags: u32, classname: Param2, vendorname: Param3, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, optionvalues: *mut DHCP_OPTION_VALUE_ARRAY) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetOptionValuesV5(serveripaddress: super::super::Foundation::PWSTR, flags: u32, classname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, optionvalues: *mut DHCP_OPTION_VALUE_ARRAY) -> u32; } ::core::mem::transmute(DhcpSetOptionValuesV5(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), classname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(optionvalues))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetServerBindingInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, flags: u32, bindelementinfo: *mut DHCP_BIND_ELEMENT_ARRAY) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetServerBindingInfo(serveripaddress: super::super::Foundation::PWSTR, flags: u32, bindelementinfo: *mut DHCP_BIND_ELEMENT_ARRAY) -> u32; } ::core::mem::transmute(DhcpSetServerBindingInfo(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(bindelementinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetServerBindingInfoV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, flags: u32, bindelementinfo: *mut DHCPV6_BIND_ELEMENT_ARRAY) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetServerBindingInfoV6(serveripaddress: super::super::Foundation::PWSTR, flags: u32, bindelementinfo: *mut DHCPV6_BIND_ELEMENT_ARRAY) -> u32; } ::core::mem::transmute(DhcpSetServerBindingInfoV6(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(bindelementinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetSubnetDelayOffer<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, timedelayinmilliseconds: u16) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetSubnetDelayOffer(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, timedelayinmilliseconds: u16) -> u32; } ::core::mem::transmute(DhcpSetSubnetDelayOffer(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(timedelayinmilliseconds))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetSubnetInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, subnetinfo: *const DHCP_SUBNET_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetSubnetInfo(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, subnetinfo: *const DHCP_SUBNET_INFO) -> u32; } ::core::mem::transmute(DhcpSetSubnetInfo(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(subnetinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetSubnetInfoV6<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, DHCP_IPV6_ADDRESS>>(serveripaddress: Param0, subnetaddress: Param1, subnetinfo: *mut DHCP_SUBNET_INFO_V6) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetSubnetInfoV6(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: DHCP_IPV6_ADDRESS, subnetinfo: *mut DHCP_SUBNET_INFO_V6) -> u32; } ::core::mem::transmute(DhcpSetSubnetInfoV6(serveripaddress.into_param().abi(), subnetaddress.into_param().abi(), ::core::mem::transmute(subnetinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetSubnetInfoVQ<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, subnetinfo: *const DHCP_SUBNET_INFO_VQ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetSubnetInfoVQ(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, subnetinfo: *const DHCP_SUBNET_INFO_VQ) -> u32; } ::core::mem::transmute(DhcpSetSubnetInfoVQ(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(subnetinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpSetSuperScopeV4<'a, Param0: ::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::BOOL>>(serveripaddress: Param0, subnetaddress: u32, superscopename: Param2, changeexisting: Param3) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetSuperScopeV4(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, superscopename: super::super::Foundation::PWSTR, changeexisting: super::super::Foundation::BOOL) -> u32; } ::core::mem::transmute(DhcpSetSuperScopeV4(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), superscopename.into_param().abi(), changeexisting.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn DhcpSetThreadOptions(flags: u32, reserved: *mut ::core::ffi::c_void) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpSetThreadOptions(flags: u32, reserved: *mut ::core::ffi::c_void) -> u32; } ::core::mem::transmute(DhcpSetThreadOptions(::core::mem::transmute(flags), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpUndoRequestParams<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(flags: u32, reserved: *mut ::core::ffi::c_void, adaptername: Param2, requestidstr: Param3) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpUndoRequestParams(flags: u32, reserved: *mut ::core::ffi::c_void, adaptername: super::super::Foundation::PWSTR, requestidstr: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(DhcpUndoRequestParams(::core::mem::transmute(flags), ::core::mem::transmute(reserved), adaptername.into_param().abi(), requestidstr.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4AddPolicyRange<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, policyname: Param2, range: *const DHCP_IP_RANGE) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4AddPolicyRange(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, policyname: super::super::Foundation::PWSTR, range: *const DHCP_IP_RANGE) -> u32; } ::core::mem::transmute(DhcpV4AddPolicyRange(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), policyname.into_param().abi(), ::core::mem::transmute(range))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4CreateClientInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, clientinfo: *const DHCP_CLIENT_INFO_PB) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4CreateClientInfo(serveripaddress: super::super::Foundation::PWSTR, clientinfo: *const DHCP_CLIENT_INFO_PB) -> u32; } ::core::mem::transmute(DhcpV4CreateClientInfo(serveripaddress.into_param().abi(), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4CreateClientInfoEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, clientinfo: *const DHCP_CLIENT_INFO_EX) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4CreateClientInfoEx(serveripaddress: super::super::Foundation::PWSTR, clientinfo: *const DHCP_CLIENT_INFO_EX) -> u32; } ::core::mem::transmute(DhcpV4CreateClientInfoEx(serveripaddress.into_param().abi(), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4CreatePolicy<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, ppolicy: *const DHCP_POLICY) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4CreatePolicy(serveripaddress: super::super::Foundation::PWSTR, ppolicy: *const DHCP_POLICY) -> u32; } ::core::mem::transmute(DhcpV4CreatePolicy(serveripaddress.into_param().abi(), ::core::mem::transmute(ppolicy))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4CreatePolicyEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, policyex: *const DHCP_POLICY_EX) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4CreatePolicyEx(serveripaddress: super::super::Foundation::PWSTR, policyex: *const DHCP_POLICY_EX) -> u32; } ::core::mem::transmute(DhcpV4CreatePolicyEx(serveripaddress.into_param().abi(), ::core::mem::transmute(policyex))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4DeletePolicy<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, fglobalpolicy: Param1, subnetaddress: u32, policyname: Param3) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4DeletePolicy(serveripaddress: super::super::Foundation::PWSTR, fglobalpolicy: super::super::Foundation::BOOL, subnetaddress: u32, policyname: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(DhcpV4DeletePolicy(serveripaddress.into_param().abi(), fglobalpolicy.into_param().abi(), ::core::mem::transmute(subnetaddress), policyname.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4EnumPolicies<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(serveripaddress: Param0, resumehandle: *mut u32, preferredmaximum: u32, fglobalpolicy: Param3, subnetaddress: u32, enuminfo: *mut *mut DHCP_POLICY_ARRAY, elementsread: *mut u32, elementstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4EnumPolicies(serveripaddress: super::super::Foundation::PWSTR, resumehandle: *mut u32, preferredmaximum: u32, fglobalpolicy: super::super::Foundation::BOOL, subnetaddress: u32, enuminfo: *mut *mut DHCP_POLICY_ARRAY, elementsread: *mut u32, elementstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpV4EnumPolicies( serveripaddress.into_param().abi(), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), fglobalpolicy.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(enuminfo), ::core::mem::transmute(elementsread), ::core::mem::transmute(elementstotal), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4EnumPoliciesEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(serveripaddress: Param0, resumehandle: *mut u32, preferredmaximum: u32, globalpolicy: Param3, subnetaddress: u32, enuminfo: *mut *mut DHCP_POLICY_EX_ARRAY, elementsread: *mut u32, elementstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4EnumPoliciesEx(serveripaddress: super::super::Foundation::PWSTR, resumehandle: *mut u32, preferredmaximum: u32, globalpolicy: super::super::Foundation::BOOL, subnetaddress: u32, enuminfo: *mut *mut DHCP_POLICY_EX_ARRAY, elementsread: *mut u32, elementstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpV4EnumPoliciesEx( serveripaddress.into_param().abi(), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), globalpolicy.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(enuminfo), ::core::mem::transmute(elementsread), ::core::mem::transmute(elementstotal), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4EnumSubnetClients<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, resumehandle: *mut u32, preferredmaximum: u32, clientinfo: *mut *mut DHCP_CLIENT_INFO_PB_ARRAY, clientsread: *mut u32, clientstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4EnumSubnetClients(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, resumehandle: *mut u32, preferredmaximum: u32, clientinfo: *mut *mut DHCP_CLIENT_INFO_PB_ARRAY, clientsread: *mut u32, clientstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpV4EnumSubnetClients(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(clientinfo), ::core::mem::transmute(clientsread), ::core::mem::transmute(clientstotal))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4EnumSubnetClientsEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, resumehandle: *mut u32, preferredmaximum: u32, clientinfo: *mut *mut DHCP_CLIENT_INFO_EX_ARRAY, clientsread: *mut u32, clientstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4EnumSubnetClientsEx(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, resumehandle: *mut u32, preferredmaximum: u32, clientinfo: *mut *mut DHCP_CLIENT_INFO_EX_ARRAY, clientsread: *mut u32, clientstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpV4EnumSubnetClientsEx(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(clientinfo), ::core::mem::transmute(clientsread), ::core::mem::transmute(clientstotal))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4EnumSubnetReservations<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, resumehandle: *mut u32, preferredmaximum: u32, enumelementinfo: *mut *mut DHCP_RESERVATION_INFO_ARRAY, elementsread: *mut u32, elementstotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4EnumSubnetReservations(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, resumehandle: *mut u32, preferredmaximum: u32, enumelementinfo: *mut *mut DHCP_RESERVATION_INFO_ARRAY, elementsread: *mut u32, elementstotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpV4EnumSubnetReservations( serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(enumelementinfo), ::core::mem::transmute(elementsread), ::core::mem::transmute(elementstotal), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4FailoverAddScopeToRelationship<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, prelationship: *const DHCP_FAILOVER_RELATIONSHIP) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4FailoverAddScopeToRelationship(serveripaddress: super::super::Foundation::PWSTR, prelationship: *const DHCP_FAILOVER_RELATIONSHIP) -> u32; } ::core::mem::transmute(DhcpV4FailoverAddScopeToRelationship(serveripaddress.into_param().abi(), ::core::mem::transmute(prelationship))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4FailoverCreateRelationship<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, prelationship: *const DHCP_FAILOVER_RELATIONSHIP) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4FailoverCreateRelationship(serveripaddress: super::super::Foundation::PWSTR, prelationship: *const DHCP_FAILOVER_RELATIONSHIP) -> u32; } ::core::mem::transmute(DhcpV4FailoverCreateRelationship(serveripaddress.into_param().abi(), ::core::mem::transmute(prelationship))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4FailoverDeleteRelationship<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, prelationshipname: Param1) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4FailoverDeleteRelationship(serveripaddress: super::super::Foundation::PWSTR, prelationshipname: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(DhcpV4FailoverDeleteRelationship(serveripaddress.into_param().abi(), prelationshipname.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4FailoverDeleteScopeFromRelationship<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, prelationship: *const DHCP_FAILOVER_RELATIONSHIP) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4FailoverDeleteScopeFromRelationship(serveripaddress: super::super::Foundation::PWSTR, prelationship: *const DHCP_FAILOVER_RELATIONSHIP) -> u32; } ::core::mem::transmute(DhcpV4FailoverDeleteScopeFromRelationship(serveripaddress.into_param().abi(), ::core::mem::transmute(prelationship))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4FailoverEnumRelationship<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, resumehandle: *mut u32, preferredmaximum: u32, prelationship: *mut *mut DHCP_FAILOVER_RELATIONSHIP_ARRAY, relationshipread: *mut u32, relationshiptotal: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4FailoverEnumRelationship(serveripaddress: super::super::Foundation::PWSTR, resumehandle: *mut u32, preferredmaximum: u32, prelationship: *mut *mut DHCP_FAILOVER_RELATIONSHIP_ARRAY, relationshipread: *mut u32, relationshiptotal: *mut u32) -> u32; } ::core::mem::transmute(DhcpV4FailoverEnumRelationship(serveripaddress.into_param().abi(), ::core::mem::transmute(resumehandle), ::core::mem::transmute(preferredmaximum), ::core::mem::transmute(prelationship), ::core::mem::transmute(relationshipread), ::core::mem::transmute(relationshiptotal))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4FailoverGetAddressStatus<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, pstatus: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4FailoverGetAddressStatus(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, pstatus: *mut u32) -> u32; } ::core::mem::transmute(DhcpV4FailoverGetAddressStatus(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(pstatus))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4FailoverGetClientInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, searchinfo: *const DHCP_SEARCH_INFO, clientinfo: *mut *mut DHCPV4_FAILOVER_CLIENT_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4FailoverGetClientInfo(serveripaddress: super::super::Foundation::PWSTR, searchinfo: *const DHCP_SEARCH_INFO, clientinfo: *mut *mut DHCPV4_FAILOVER_CLIENT_INFO) -> u32; } ::core::mem::transmute(DhcpV4FailoverGetClientInfo(serveripaddress.into_param().abi(), ::core::mem::transmute(searchinfo), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4FailoverGetRelationship<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, prelationshipname: Param1, prelationship: *mut *mut DHCP_FAILOVER_RELATIONSHIP) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4FailoverGetRelationship(serveripaddress: super::super::Foundation::PWSTR, prelationshipname: super::super::Foundation::PWSTR, prelationship: *mut *mut DHCP_FAILOVER_RELATIONSHIP) -> u32; } ::core::mem::transmute(DhcpV4FailoverGetRelationship(serveripaddress.into_param().abi(), prelationshipname.into_param().abi(), ::core::mem::transmute(prelationship))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4FailoverGetScopeRelationship<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, scopeid: u32, prelationship: *mut *mut DHCP_FAILOVER_RELATIONSHIP) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4FailoverGetScopeRelationship(serveripaddress: super::super::Foundation::PWSTR, scopeid: u32, prelationship: *mut *mut DHCP_FAILOVER_RELATIONSHIP) -> u32; } ::core::mem::transmute(DhcpV4FailoverGetScopeRelationship(serveripaddress.into_param().abi(), ::core::mem::transmute(scopeid), ::core::mem::transmute(prelationship))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4FailoverGetScopeStatistics<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, scopeid: u32, pstats: *mut *mut DHCP_FAILOVER_STATISTICS) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4FailoverGetScopeStatistics(serveripaddress: super::super::Foundation::PWSTR, scopeid: u32, pstats: *mut *mut DHCP_FAILOVER_STATISTICS) -> u32; } ::core::mem::transmute(DhcpV4FailoverGetScopeStatistics(serveripaddress.into_param().abi(), ::core::mem::transmute(scopeid), ::core::mem::transmute(pstats))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4FailoverGetSystemTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, ptime: *mut u32, pmaxalloweddeltatime: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4FailoverGetSystemTime(serveripaddress: super::super::Foundation::PWSTR, ptime: *mut u32, pmaxalloweddeltatime: *mut u32) -> u32; } ::core::mem::transmute(DhcpV4FailoverGetSystemTime(serveripaddress.into_param().abi(), ::core::mem::transmute(ptime), ::core::mem::transmute(pmaxalloweddeltatime))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4FailoverSetRelationship<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, flags: u32, prelationship: *const DHCP_FAILOVER_RELATIONSHIP) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4FailoverSetRelationship(serveripaddress: super::super::Foundation::PWSTR, flags: u32, prelationship: *const DHCP_FAILOVER_RELATIONSHIP) -> u32; } ::core::mem::transmute(DhcpV4FailoverSetRelationship(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(prelationship))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4FailoverTriggerAddrAllocation<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, pfailrelname: Param1) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4FailoverTriggerAddrAllocation(serveripaddress: super::super::Foundation::PWSTR, pfailrelname: super::super::Foundation::PWSTR) -> u32; } ::core::mem::transmute(DhcpV4FailoverTriggerAddrAllocation(serveripaddress.into_param().abi(), pfailrelname.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4GetAllOptionValues<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, flags: u32, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, values: *mut *mut DHCP_ALL_OPTION_VALUES_PB) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4GetAllOptionValues(serveripaddress: super::super::Foundation::PWSTR, flags: u32, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, values: *mut *mut DHCP_ALL_OPTION_VALUES_PB) -> u32; } ::core::mem::transmute(DhcpV4GetAllOptionValues(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(values))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4GetClientInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, searchinfo: *const DHCP_SEARCH_INFO, clientinfo: *mut *mut DHCP_CLIENT_INFO_PB) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4GetClientInfo(serveripaddress: super::super::Foundation::PWSTR, searchinfo: *const DHCP_SEARCH_INFO, clientinfo: *mut *mut DHCP_CLIENT_INFO_PB) -> u32; } ::core::mem::transmute(DhcpV4GetClientInfo(serveripaddress.into_param().abi(), ::core::mem::transmute(searchinfo), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4GetClientInfoEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, searchinfo: *const DHCP_SEARCH_INFO, clientinfo: *mut *mut DHCP_CLIENT_INFO_EX) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4GetClientInfoEx(serveripaddress: super::super::Foundation::PWSTR, searchinfo: *const DHCP_SEARCH_INFO, clientinfo: *mut *mut DHCP_CLIENT_INFO_EX) -> u32; } ::core::mem::transmute(DhcpV4GetClientInfoEx(serveripaddress.into_param().abi(), ::core::mem::transmute(searchinfo), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4GetFreeIPAddress<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, scopeid: u32, startip: u32, endip: u32, numfreeaddrreq: u32, ipaddrlist: *mut *mut DHCP_IP_ARRAY) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4GetFreeIPAddress(serveripaddress: super::super::Foundation::PWSTR, scopeid: u32, startip: u32, endip: u32, numfreeaddrreq: u32, ipaddrlist: *mut *mut DHCP_IP_ARRAY) -> u32; } ::core::mem::transmute(DhcpV4GetFreeIPAddress(serveripaddress.into_param().abi(), ::core::mem::transmute(scopeid), ::core::mem::transmute(startip), ::core::mem::transmute(endip), ::core::mem::transmute(numfreeaddrreq), ::core::mem::transmute(ipaddrlist))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4GetOptionValue<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, policyname: Param3, vendorname: Param4, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, optionvalue: *mut *mut DHCP_OPTION_VALUE) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4GetOptionValue(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, policyname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, optionvalue: *mut *mut DHCP_OPTION_VALUE) -> u32; } ::core::mem::transmute(DhcpV4GetOptionValue(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), policyname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(optionvalue))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4GetPolicy<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, fglobalpolicy: Param1, subnetaddress: u32, policyname: Param3, policy: *mut *mut DHCP_POLICY) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4GetPolicy(serveripaddress: super::super::Foundation::PWSTR, fglobalpolicy: super::super::Foundation::BOOL, subnetaddress: u32, policyname: super::super::Foundation::PWSTR, policy: *mut *mut DHCP_POLICY) -> u32; } ::core::mem::transmute(DhcpV4GetPolicy(serveripaddress.into_param().abi(), fglobalpolicy.into_param().abi(), ::core::mem::transmute(subnetaddress), policyname.into_param().abi(), ::core::mem::transmute(policy))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4GetPolicyEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, globalpolicy: Param1, subnetaddress: u32, policyname: Param3, policy: *mut *mut DHCP_POLICY_EX) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4GetPolicyEx(serveripaddress: super::super::Foundation::PWSTR, globalpolicy: super::super::Foundation::BOOL, subnetaddress: u32, policyname: super::super::Foundation::PWSTR, policy: *mut *mut DHCP_POLICY_EX) -> u32; } ::core::mem::transmute(DhcpV4GetPolicyEx(serveripaddress.into_param().abi(), globalpolicy.into_param().abi(), ::core::mem::transmute(subnetaddress), policyname.into_param().abi(), ::core::mem::transmute(policy))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4QueryPolicyEnforcement<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(serveripaddress: Param0, fglobalpolicy: Param1, subnetaddress: u32, enabled: *mut super::super::Foundation::BOOL) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4QueryPolicyEnforcement(serveripaddress: super::super::Foundation::PWSTR, fglobalpolicy: super::super::Foundation::BOOL, subnetaddress: u32, enabled: *mut super::super::Foundation::BOOL) -> u32; } ::core::mem::transmute(DhcpV4QueryPolicyEnforcement(serveripaddress.into_param().abi(), fglobalpolicy.into_param().abi(), ::core::mem::transmute(subnetaddress), ::core::mem::transmute(enabled))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4RemoveOptionValue<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, policyname: Param3, vendorname: Param4, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4RemoveOptionValue(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, policyname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO) -> u32; } ::core::mem::transmute(DhcpV4RemoveOptionValue(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), policyname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(scopeinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4RemovePolicyRange<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, subnetaddress: u32, policyname: Param2, range: *const DHCP_IP_RANGE) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4RemovePolicyRange(serveripaddress: super::super::Foundation::PWSTR, subnetaddress: u32, policyname: super::super::Foundation::PWSTR, range: *const DHCP_IP_RANGE) -> u32; } ::core::mem::transmute(DhcpV4RemovePolicyRange(serveripaddress.into_param().abi(), ::core::mem::transmute(subnetaddress), policyname.into_param().abi(), ::core::mem::transmute(range))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4SetOptionValue<'a, Param0: ::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::PWSTR>>(serveripaddress: Param0, flags: u32, optionid: u32, policyname: Param3, vendorname: Param4, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, optionvalue: *mut DHCP_OPTION_DATA) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4SetOptionValue(serveripaddress: super::super::Foundation::PWSTR, flags: u32, optionid: u32, policyname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, optionvalue: *mut DHCP_OPTION_DATA) -> u32; } ::core::mem::transmute(DhcpV4SetOptionValue(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(optionid), policyname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(optionvalue))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4SetOptionValues<'a, Param0: ::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>>(serveripaddress: Param0, flags: u32, policyname: Param2, vendorname: Param3, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, optionvalues: *mut DHCP_OPTION_VALUE_ARRAY) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4SetOptionValues(serveripaddress: super::super::Foundation::PWSTR, flags: u32, policyname: super::super::Foundation::PWSTR, vendorname: super::super::Foundation::PWSTR, scopeinfo: *mut DHCP_OPTION_SCOPE_INFO, optionvalues: *mut DHCP_OPTION_VALUE_ARRAY) -> u32; } ::core::mem::transmute(DhcpV4SetOptionValues(serveripaddress.into_param().abi(), ::core::mem::transmute(flags), policyname.into_param().abi(), vendorname.into_param().abi(), ::core::mem::transmute(scopeinfo), ::core::mem::transmute(optionvalues))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4SetPolicy<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, fieldsmodified: u32, fglobalpolicy: Param2, subnetaddress: u32, policyname: Param4, policy: *const DHCP_POLICY) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4SetPolicy(serveripaddress: super::super::Foundation::PWSTR, fieldsmodified: u32, fglobalpolicy: super::super::Foundation::BOOL, subnetaddress: u32, policyname: super::super::Foundation::PWSTR, policy: *const DHCP_POLICY) -> u32; } ::core::mem::transmute(DhcpV4SetPolicy(serveripaddress.into_param().abi(), ::core::mem::transmute(fieldsmodified), fglobalpolicy.into_param().abi(), ::core::mem::transmute(subnetaddress), policyname.into_param().abi(), ::core::mem::transmute(policy))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4SetPolicyEnforcement<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(serveripaddress: Param0, fglobalpolicy: Param1, subnetaddress: u32, enable: Param3) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4SetPolicyEnforcement(serveripaddress: super::super::Foundation::PWSTR, fglobalpolicy: super::super::Foundation::BOOL, subnetaddress: u32, enable: super::super::Foundation::BOOL) -> u32; } ::core::mem::transmute(DhcpV4SetPolicyEnforcement(serveripaddress.into_param().abi(), fglobalpolicy.into_param().abi(), ::core::mem::transmute(subnetaddress), enable.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV4SetPolicyEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, fieldsmodified: u32, globalpolicy: Param2, subnetaddress: u32, policyname: Param4, policy: *const DHCP_POLICY_EX) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV4SetPolicyEx(serveripaddress: super::super::Foundation::PWSTR, fieldsmodified: u32, globalpolicy: super::super::Foundation::BOOL, subnetaddress: u32, policyname: super::super::Foundation::PWSTR, policy: *const DHCP_POLICY_EX) -> u32; } ::core::mem::transmute(DhcpV4SetPolicyEx(serveripaddress.into_param().abi(), ::core::mem::transmute(fieldsmodified), globalpolicy.into_param().abi(), ::core::mem::transmute(subnetaddress), policyname.into_param().abi(), ::core::mem::transmute(policy))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV6CreateClientInfo<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, clientinfo: *const DHCP_CLIENT_INFO_V6) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV6CreateClientInfo(serveripaddress: super::super::Foundation::PWSTR, clientinfo: *const DHCP_CLIENT_INFO_V6) -> u32; } ::core::mem::transmute(DhcpV6CreateClientInfo(serveripaddress.into_param().abi(), ::core::mem::transmute(clientinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV6GetFreeIPAddress<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, DHCP_IPV6_ADDRESS>, Param2: ::windows::core::IntoParam<'a, DHCP_IPV6_ADDRESS>, Param3: ::windows::core::IntoParam<'a, DHCP_IPV6_ADDRESS>>(serveripaddress: Param0, scopeid: Param1, startip: Param2, endip: Param3, numfreeaddrreq: u32, ipaddrlist: *mut *mut DHCPV6_IP_ARRAY) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV6GetFreeIPAddress(serveripaddress: super::super::Foundation::PWSTR, scopeid: DHCP_IPV6_ADDRESS, startip: DHCP_IPV6_ADDRESS, endip: DHCP_IPV6_ADDRESS, numfreeaddrreq: u32, ipaddrlist: *mut *mut DHCPV6_IP_ARRAY) -> u32; } ::core::mem::transmute(DhcpV6GetFreeIPAddress(serveripaddress.into_param().abi(), scopeid.into_param().abi(), startip.into_param().abi(), endip.into_param().abi(), ::core::mem::transmute(numfreeaddrreq), ::core::mem::transmute(ipaddrlist))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV6GetStatelessStatistics<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(serveripaddress: Param0, statelessstats: *mut *mut DHCPV6_STATELESS_STATS) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV6GetStatelessStatistics(serveripaddress: super::super::Foundation::PWSTR, statelessstats: *mut *mut DHCPV6_STATELESS_STATS) -> u32; } ::core::mem::transmute(DhcpV6GetStatelessStatistics(serveripaddress.into_param().abi(), ::core::mem::transmute(statelessstats))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV6GetStatelessStoreParams<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>, Param2: ::windows::core::IntoParam<'a, DHCP_IPV6_ADDRESS>>(serveripaddress: Param0, fserverlevel: Param1, subnetaddress: Param2, params: *mut *mut DHCPV6_STATELESS_PARAMS) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV6GetStatelessStoreParams(serveripaddress: super::super::Foundation::PWSTR, fserverlevel: super::super::Foundation::BOOL, subnetaddress: DHCP_IPV6_ADDRESS, params: *mut *mut DHCPV6_STATELESS_PARAMS) -> u32; } ::core::mem::transmute(DhcpV6GetStatelessStoreParams(serveripaddress.into_param().abi(), fserverlevel.into_param().abi(), subnetaddress.into_param().abi(), ::core::mem::transmute(params))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DhcpV6SetStatelessStoreParams<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>, Param2: ::windows::core::IntoParam<'a, DHCP_IPV6_ADDRESS>>(serveripaddress: Param0, fserverlevel: Param1, subnetaddress: Param2, fieldmodified: u32, params: *const DHCPV6_STATELESS_PARAMS) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DhcpV6SetStatelessStoreParams(serveripaddress: super::super::Foundation::PWSTR, fserverlevel: super::super::Foundation::BOOL, subnetaddress: DHCP_IPV6_ADDRESS, fieldmodified: u32, params: *const DHCPV6_STATELESS_PARAMS) -> u32; } ::core::mem::transmute(DhcpV6SetStatelessStoreParams(serveripaddress.into_param().abi(), fserverlevel.into_param().abi(), subnetaddress.into_param().abi(), ::core::mem::transmute(fieldmodified), ::core::mem::transmute(params))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn Dhcpv6CApiCleanup() { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn Dhcpv6CApiCleanup(); } ::core::mem::transmute(Dhcpv6CApiCleanup()) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn Dhcpv6CApiInitialize(version: *mut u32) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn Dhcpv6CApiInitialize(version: *mut u32); } ::core::mem::transmute(Dhcpv6CApiInitialize(::core::mem::transmute(version))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn Dhcpv6ReleasePrefix<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(adaptername: Param0, classid: *mut DHCPV6CAPI_CLASSID, leaseinfo: *mut DHCPV6PrefixLeaseInformation) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn Dhcpv6ReleasePrefix(adaptername: super::super::Foundation::PWSTR, classid: *mut DHCPV6CAPI_CLASSID, leaseinfo: *mut DHCPV6PrefixLeaseInformation) -> u32; } ::core::mem::transmute(Dhcpv6ReleasePrefix(adaptername.into_param().abi(), ::core::mem::transmute(classid), ::core::mem::transmute(leaseinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn Dhcpv6RenewPrefix<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(adaptername: Param0, pclassid: *mut DHCPV6CAPI_CLASSID, prefixleaseinfo: *mut DHCPV6PrefixLeaseInformation, pdwtimetowait: *mut u32, bvalidateprefix: u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn Dhcpv6RenewPrefix(adaptername: super::super::Foundation::PWSTR, pclassid: *mut DHCPV6CAPI_CLASSID, prefixleaseinfo: *mut DHCPV6PrefixLeaseInformation, pdwtimetowait: *mut u32, bvalidateprefix: u32) -> u32; } ::core::mem::transmute(Dhcpv6RenewPrefix(adaptername.into_param().abi(), ::core::mem::transmute(pclassid), ::core::mem::transmute(prefixleaseinfo), ::core::mem::transmute(pdwtimetowait), ::core::mem::transmute(bvalidateprefix))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn Dhcpv6RequestParams<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, DHCPV6CAPI_PARAMS_ARRAY>>(forcenewinform: Param0, reserved: *mut ::core::ffi::c_void, adaptername: Param2, classid: *mut DHCPV6CAPI_CLASSID, recdparams: Param4, buffer: *mut u8, psize: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn Dhcpv6RequestParams(forcenewinform: super::super::Foundation::BOOL, reserved: *mut ::core::ffi::c_void, adaptername: super::super::Foundation::PWSTR, classid: *mut DHCPV6CAPI_CLASSID, recdparams: DHCPV6CAPI_PARAMS_ARRAY, buffer: *mut u8, psize: *mut u32) -> u32; } ::core::mem::transmute(Dhcpv6RequestParams(forcenewinform.into_param().abi(), ::core::mem::transmute(reserved), adaptername.into_param().abi(), ::core::mem::transmute(classid), recdparams.into_param().abi(), ::core::mem::transmute(buffer), ::core::mem::transmute(psize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn Dhcpv6RequestPrefix<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(adaptername: Param0, pclassid: *mut DHCPV6CAPI_CLASSID, prefixleaseinfo: *mut DHCPV6PrefixLeaseInformation, pdwtimetowait: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn Dhcpv6RequestPrefix(adaptername: super::super::Foundation::PWSTR, pclassid: *mut DHCPV6CAPI_CLASSID, prefixleaseinfo: *mut DHCPV6PrefixLeaseInformation, pdwtimetowait: *mut u32) -> u32; } ::core::mem::transmute(Dhcpv6RequestPrefix(adaptername.into_param().abi(), ::core::mem::transmute(pclassid), ::core::mem::transmute(prefixleaseinfo), ::core::mem::transmute(pdwtimetowait))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const ERROR_DDS_CLASS_DOES_NOT_EXIST: u32 = 20078u32; pub const ERROR_DDS_CLASS_EXISTS: u32 = 20077u32; pub const ERROR_DDS_DHCP_SERVER_NOT_FOUND: u32 = 20074u32; pub const ERROR_DDS_NO_DHCP_ROOT: u32 = 20071u32; pub const ERROR_DDS_NO_DS_AVAILABLE: u32 = 20070u32; pub const ERROR_DDS_OPTION_ALREADY_EXISTS: u32 = 20075u32; pub const ERROR_DDS_OPTION_DOES_NOT_EXIST: u32 = 20076u32; pub const ERROR_DDS_POSSIBLE_RANGE_CONFLICT: u32 = 20087u32; pub const ERROR_DDS_RANGE_DOES_NOT_EXIST: u32 = 20088u32; pub const ERROR_DDS_RESERVATION_CONFLICT: u32 = 20086u32; pub const ERROR_DDS_RESERVATION_NOT_PRESENT: u32 = 20085u32; pub const ERROR_DDS_SERVER_ADDRESS_MISMATCH: u32 = 20081u32; pub const ERROR_DDS_SERVER_ALREADY_EXISTS: u32 = 20079u32; pub const ERROR_DDS_SERVER_DOES_NOT_EXIST: u32 = 20080u32; pub const ERROR_DDS_SUBNET_EXISTS: u32 = 20082u32; pub const ERROR_DDS_SUBNET_HAS_DIFF_SSCOPE: u32 = 20083u32; pub const ERROR_DDS_SUBNET_NOT_PRESENT: u32 = 20084u32; pub const ERROR_DDS_TOO_MANY_ERRORS: u32 = 20073u32; pub const ERROR_DDS_UNEXPECTED_ERROR: u32 = 20072u32; pub const ERROR_DHCP_ADDRESS_NOT_AVAILABLE: u32 = 20011u32; pub const ERROR_DHCP_CANNOT_MODIFY_BINDINGS: u32 = 20051u32; pub const ERROR_DHCP_CANT_CHANGE_ATTRIBUTE: u32 = 20048u32; pub const ERROR_DHCP_CLASS_ALREADY_EXISTS: u32 = 20045u32; pub const ERROR_DHCP_CLASS_NOT_FOUND: u32 = 20044u32; pub const ERROR_DHCP_CLIENT_EXISTS: u32 = 20014u32; pub const ERROR_DHCP_DATABASE_INIT_FAILED: u32 = 20001u32; pub const ERROR_DHCP_DEFAULT_SCOPE_EXITS: u32 = 20047u32; pub const ERROR_DHCP_DELETE_BUILTIN_CLASS: u32 = 20089u32; pub const ERROR_DHCP_ELEMENT_CANT_REMOVE: u32 = 20007u32; pub const ERROR_DHCP_EXEMPTION_EXISTS: u32 = 20055u32; pub const ERROR_DHCP_EXEMPTION_NOT_PRESENT: u32 = 20056u32; pub const ERROR_DHCP_FO_ADDSCOPE_LEASES_NOT_SYNCED: u32 = 20127u32; pub const ERROR_DHCP_FO_BOOT_NOT_SUPPORTED: u32 = 20131u32; pub const ERROR_DHCP_FO_FEATURE_NOT_SUPPORTED: u32 = 20134u32; pub const ERROR_DHCP_FO_IPRANGE_TYPE_CONV_ILLEGAL: u32 = 20129u32; pub const ERROR_DHCP_FO_MAX_ADD_SCOPES: u32 = 20130u32; pub const ERROR_DHCP_FO_MAX_RELATIONSHIPS: u32 = 20128u32; pub const ERROR_DHCP_FO_NOT_SUPPORTED: u32 = 20118u32; pub const ERROR_DHCP_FO_RANGE_PART_OF_REL: u32 = 20132u32; pub const ERROR_DHCP_FO_RELATIONSHIP_DOES_NOT_EXIST: u32 = 20115u32; pub const ERROR_DHCP_FO_RELATIONSHIP_EXISTS: u32 = 20114u32; pub const ERROR_DHCP_FO_RELATIONSHIP_NAME_TOO_LONG: u32 = 20125u32; pub const ERROR_DHCP_FO_RELATION_IS_SECONDARY: u32 = 20117u32; pub const ERROR_DHCP_FO_SCOPE_ALREADY_IN_RELATIONSHIP: u32 = 20113u32; pub const ERROR_DHCP_FO_SCOPE_NOT_IN_RELATIONSHIP: u32 = 20116u32; pub const ERROR_DHCP_FO_SCOPE_SYNC_IN_PROGRESS: u32 = 20133u32; pub const ERROR_DHCP_FO_STATE_NOT_NORMAL: u32 = 20120u32; pub const ERROR_DHCP_FO_TIME_OUT_OF_SYNC: u32 = 20119u32; pub const ERROR_DHCP_HARDWARE_ADDRESS_TYPE_ALREADY_EXEMPT: u32 = 20101u32; pub const ERROR_DHCP_INVALID_DELAY: u32 = 20092u32; pub const ERROR_DHCP_INVALID_DHCP_CLIENT: u32 = 20016u32; pub const ERROR_DHCP_INVALID_DHCP_MESSAGE: u32 = 20015u32; pub const ERROR_DHCP_INVALID_PARAMETER_OPTION32: u32 = 20057u32; pub const ERROR_DHCP_INVALID_POLICY_EXPRESSION: u32 = 20109u32; pub const ERROR_DHCP_INVALID_PROCESSING_ORDER: u32 = 20110u32; pub const ERROR_DHCP_INVALID_RANGE: u32 = 20023u32; pub const ERROR_DHCP_INVALID_SUBNET_PREFIX: u32 = 20091u32; pub const ERROR_DHCP_IPRANGE_CONV_ILLEGAL: u32 = 20049u32; pub const ERROR_DHCP_IPRANGE_EXITS: u32 = 20021u32; pub const ERROR_DHCP_IP_ADDRESS_IN_USE: u32 = 20032u32; pub const ERROR_DHCP_JET97_CONV_REQUIRED: u32 = 20036u32; pub const ERROR_DHCP_JET_CONV_REQUIRED: u32 = 20027u32; pub const ERROR_DHCP_JET_ERROR: u32 = 20013u32; pub const ERROR_DHCP_LINKLAYER_ADDRESS_DOES_NOT_EXIST: u32 = 20095u32; pub const ERROR_DHCP_LINKLAYER_ADDRESS_EXISTS: u32 = 20093u32; pub const ERROR_DHCP_LINKLAYER_ADDRESS_RESERVATION_EXISTS: u32 = 20094u32; pub const ERROR_DHCP_LOG_FILE_PATH_TOO_LONG: u32 = 20033u32; pub const ERROR_DHCP_MSCOPE_EXISTS: u32 = 20053u32; pub const ERROR_DHCP_NAP_NOT_SUPPORTED: u32 = 20138u32; pub const ERROR_DHCP_NETWORK_CHANGED: u32 = 20050u32; pub const ERROR_DHCP_NETWORK_INIT_FAILED: u32 = 20003u32; pub const ERROR_DHCP_NOT_RESERVED_CLIENT: u32 = 20018u32; pub const ERROR_DHCP_NO_ADMIN_PERMISSION: u32 = 20121u32; pub const ERROR_DHCP_OPTION_EXITS: u32 = 20009u32; pub const ERROR_DHCP_OPTION_NOT_PRESENT: u32 = 20010u32; pub const ERROR_DHCP_OPTION_TYPE_MISMATCH: u32 = 20103u32; pub const ERROR_DHCP_POLICY_BAD_PARENT_EXPR: u32 = 20104u32; pub const ERROR_DHCP_POLICY_EDIT_FQDN_UNSUPPORTED: u32 = 20137u32; pub const ERROR_DHCP_POLICY_EXISTS: u32 = 20105u32; pub const ERROR_DHCP_POLICY_FQDN_OPTION_UNSUPPORTED: u32 = 20136u32; pub const ERROR_DHCP_POLICY_FQDN_RANGE_UNSUPPORTED: u32 = 20135u32; pub const ERROR_DHCP_POLICY_NOT_FOUND: u32 = 20111u32; pub const ERROR_DHCP_POLICY_RANGE_BAD: u32 = 20107u32; pub const ERROR_DHCP_POLICY_RANGE_EXISTS: u32 = 20106u32; pub const ERROR_DHCP_PRIMARY_NOT_FOUND: u32 = 20006u32; pub const ERROR_DHCP_RANGE_EXTENDED: u32 = 20024u32; pub const ERROR_DHCP_RANGE_FULL: u32 = 20012u32; pub const ERROR_DHCP_RANGE_INVALID_IN_SERVER_POLICY: u32 = 20108u32; pub const ERROR_DHCP_RANGE_TOO_SMALL: u32 = 20020u32; pub const ERROR_DHCP_REACHED_END_OF_SELECTION: u32 = 20126u32; pub const ERROR_DHCP_REGISTRY_INIT_FAILED: u32 = 20000u32; pub const ERROR_DHCP_RESERVEDIP_EXITS: u32 = 20022u32; pub const ERROR_DHCP_RESERVED_CLIENT: u32 = 20019u32; pub const ERROR_DHCP_ROGUE_DS_CONFLICT: u32 = 20041u32; pub const ERROR_DHCP_ROGUE_DS_UNREACHABLE: u32 = 20040u32; pub const ERROR_DHCP_ROGUE_INIT_FAILED: u32 = 20037u32; pub const ERROR_DHCP_ROGUE_NOT_AUTHORIZED: u32 = 20039u32; pub const ERROR_DHCP_ROGUE_NOT_OUR_ENTERPRISE: u32 = 20042u32; pub const ERROR_DHCP_ROGUE_SAMSHUTDOWN: u32 = 20038u32; pub const ERROR_DHCP_ROGUE_STANDALONE_IN_DS: u32 = 20043u32; pub const ERROR_DHCP_RPC_INIT_FAILED: u32 = 20002u32; pub const ERROR_DHCP_SCOPE_NAME_TOO_LONG: u32 = 20046u32; pub const ERROR_DHCP_SERVER_NAME_NOT_RESOLVED: u32 = 20124u32; pub const ERROR_DHCP_SERVER_NOT_REACHABLE: u32 = 20122u32; pub const ERROR_DHCP_SERVER_NOT_RUNNING: u32 = 20123u32; pub const ERROR_DHCP_SERVICE_PAUSED: u32 = 20017u32; pub const ERROR_DHCP_SUBNET_EXISTS: u32 = 20052u32; pub const ERROR_DHCP_SUBNET_EXITS: u32 = 20004u32; pub const ERROR_DHCP_SUBNET_NOT_PRESENT: u32 = 20005u32; pub const ERROR_DHCP_SUPER_SCOPE_NAME_TOO_LONG: u32 = 20030u32; pub const ERROR_DHCP_UNDEFINED_HARDWARE_ADDRESS_TYPE: u32 = 20102u32; pub const ERROR_DHCP_UNSUPPORTED_CLIENT: u32 = 20034u32; pub const ERROR_EXTEND_TOO_SMALL: u32 = 20025u32; pub const ERROR_LAST_DHCP_SERVER_ERROR: u32 = 20139u32; pub const ERROR_MSCOPE_RANGE_TOO_SMALL: u32 = 20054u32; pub const ERROR_SCOPE_RANGE_POLICY_RANGE_CONFLICT: u32 = 20112u32; pub const ERROR_SERVER_INVALID_BOOT_FILE_TABLE: u32 = 20028u32; pub const ERROR_SERVER_UNKNOWN_BOOT_FILE_NAME: u32 = 20029u32; pub const FILTER_STATUS_FULL_MATCH_IN_ALLOW_LIST: u32 = 2u32; pub const FILTER_STATUS_FULL_MATCH_IN_DENY_LIST: u32 = 4u32; pub const FILTER_STATUS_NONE: u32 = 1u32; pub const FILTER_STATUS_WILDCARD_MATCH_IN_ALLOW_LIST: u32 = 8u32; pub const FILTER_STATUS_WILDCARD_MATCH_IN_DENY_LIST: u32 = 16u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct FSM_STATE(pub i32); pub const NO_STATE: FSM_STATE = FSM_STATE(0i32); pub const INIT: FSM_STATE = FSM_STATE(1i32); pub const STARTUP: FSM_STATE = FSM_STATE(2i32); pub const NORMAL: FSM_STATE = FSM_STATE(3i32); pub const COMMUNICATION_INT: FSM_STATE = FSM_STATE(4i32); pub const PARTNER_DOWN: FSM_STATE = FSM_STATE(5i32); pub const POTENTIAL_CONFLICT: FSM_STATE = FSM_STATE(6i32); pub const CONFLICT_DONE: FSM_STATE = FSM_STATE(7i32); pub const RESOLUTION_INT: FSM_STATE = FSM_STATE(8i32); pub const RECOVER: FSM_STATE = FSM_STATE(9i32); pub const RECOVER_WAIT: FSM_STATE = FSM_STATE(10i32); pub const RECOVER_DONE: FSM_STATE = FSM_STATE(11i32); pub const PAUSED: FSM_STATE = FSM_STATE(12i32); pub const SHUTDOWN: FSM_STATE = FSM_STATE(13i32); impl ::core::convert::From<i32> for FSM_STATE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for FSM_STATE { type Abi = Self; } pub const HWTYPE_ETHERNET_10MB: u32 = 1u32; pub type LPDHCP_CONTROL = unsafe extern "system" fn(dwcontrolcode: u32, lpreserved: *mut ::core::ffi::c_void) -> u32; pub type LPDHCP_DELETE_CLIENT = unsafe extern "system" fn(ipaddress: u32, hwaddress: *mut u8, hwaddresslength: u32, reserved: u32, clienttype: u32) -> u32; pub type LPDHCP_DROP_SEND = unsafe extern "system" fn(packet: *mut *mut u8, packetsize: *mut u32, controlcode: u32, ipaddress: u32, reserved: *mut ::core::ffi::c_void, pktcontext: *mut ::core::ffi::c_void) -> u32; #[cfg(feature = "Win32_Foundation")] pub type LPDHCP_ENTRY_POINT_FUNC = unsafe extern "system" fn(chaindlls: super::super::Foundation::PWSTR, calloutversion: u32, callouttbl: *mut ::core::mem::ManuallyDrop<DHCP_CALLOUT_TABLE>) -> u32; pub type LPDHCP_GIVE_ADDRESS = unsafe extern "system" fn(packet: *mut u8, packetsize: u32, controlcode: u32, ipaddress: u32, altaddress: u32, addrtype: u32, leasetime: u32, reserved: *mut ::core::ffi::c_void, pktcontext: *mut ::core::ffi::c_void) -> u32; #[cfg(feature = "Win32_Foundation")] pub type LPDHCP_HANDLE_OPTIONS = unsafe extern "system" fn(packet: *mut u8, packetsize: u32, reserved: *mut ::core::ffi::c_void, pktcontext: *mut ::core::ffi::c_void, serveroptions: *mut DHCP_SERVER_OPTIONS) -> u32; pub type LPDHCP_NEWPKT = unsafe extern "system" fn(packet: *mut *mut u8, packetsize: *mut u32, ipaddress: u32, reserved: *mut ::core::ffi::c_void, pktcontext: *mut *mut ::core::ffi::c_void, processit: *mut i32) -> u32; pub type LPDHCP_PROB = unsafe extern "system" fn(packet: *mut u8, packetsize: u32, controlcode: u32, ipaddress: u32, altaddress: u32, reserved: *mut ::core::ffi::c_void, pktcontext: *mut ::core::ffi::c_void) -> u32; pub const MAC_ADDRESS_LENGTH: u32 = 6u32; pub const MAX_PATTERN_LENGTH: u32 = 255u32; pub const MCLT: u32 = 1u32; pub const MODE: u32 = 16u32; pub const OPTION_ALL_SUBNETS_MTU: u32 = 27u32; pub const OPTION_ARP_CACHE_TIMEOUT: u32 = 35u32; pub const OPTION_BE_A_MASK_SUPPLIER: u32 = 30u32; pub const OPTION_BE_A_ROUTER: u32 = 19u32; pub const OPTION_BOOTFILE_NAME: u32 = 67u32; pub const OPTION_BOOT_FILE_SIZE: u32 = 13u32; pub const OPTION_BROADCAST_ADDRESS: u32 = 28u32; pub const OPTION_CLIENT_CLASS_INFO: u32 = 60u32; pub const OPTION_CLIENT_ID: u32 = 61u32; pub const OPTION_COOKIE_SERVERS: u32 = 8u32; pub const OPTION_DEFAULT_TTL: u32 = 23u32; pub const OPTION_DOMAIN_NAME: u32 = 15u32; pub const OPTION_DOMAIN_NAME_SERVERS: u32 = 6u32; pub const OPTION_END: u32 = 255u32; pub const OPTION_ETHERNET_ENCAPSULATION: u32 = 36u32; pub const OPTION_EXTENSIONS_PATH: u32 = 18u32; pub const OPTION_HOST_NAME: u32 = 12u32; pub const OPTION_IEN116_NAME_SERVERS: u32 = 5u32; pub const OPTION_IMPRESS_SERVERS: u32 = 10u32; pub const OPTION_KEEP_ALIVE_DATA_SIZE: u32 = 39u32; pub const OPTION_KEEP_ALIVE_INTERVAL: u32 = 38u32; pub const OPTION_LEASE_TIME: u32 = 51u32; pub const OPTION_LOG_SERVERS: u32 = 7u32; pub const OPTION_LPR_SERVERS: u32 = 9u32; pub const OPTION_MAX_REASSEMBLY_SIZE: u32 = 22u32; pub const OPTION_MERIT_DUMP_FILE: u32 = 14u32; pub const OPTION_MESSAGE: u32 = 56u32; pub const OPTION_MESSAGE_LENGTH: u32 = 57u32; pub const OPTION_MESSAGE_TYPE: u32 = 53u32; pub const OPTION_MSFT_IE_PROXY: u32 = 252u32; pub const OPTION_MTU: u32 = 26u32; pub const OPTION_NETBIOS_DATAGRAM_SERVER: u32 = 45u32; pub const OPTION_NETBIOS_NAME_SERVER: u32 = 44u32; pub const OPTION_NETBIOS_NODE_TYPE: u32 = 46u32; pub const OPTION_NETBIOS_SCOPE_OPTION: u32 = 47u32; pub const OPTION_NETWORK_INFO_SERVERS: u32 = 41u32; pub const OPTION_NETWORK_INFO_SERVICE_DOM: u32 = 40u32; pub const OPTION_NETWORK_TIME_SERVERS: u32 = 42u32; pub const OPTION_NON_LOCAL_SOURCE_ROUTING: u32 = 20u32; pub const OPTION_OK_TO_OVERLAY: u32 = 52u32; pub const OPTION_PAD: u32 = 0u32; pub const OPTION_PARAMETER_REQUEST_LIST: u32 = 55u32; pub const OPTION_PERFORM_MASK_DISCOVERY: u32 = 29u32; pub const OPTION_PERFORM_ROUTER_DISCOVERY: u32 = 31u32; pub const OPTION_PMTU_AGING_TIMEOUT: u32 = 24u32; pub const OPTION_PMTU_PLATEAU_TABLE: u32 = 25u32; pub const OPTION_POLICY_FILTER_FOR_NLSR: u32 = 21u32; pub const OPTION_REBIND_TIME: u32 = 59u32; pub const OPTION_RENEWAL_TIME: u32 = 58u32; pub const OPTION_REQUESTED_ADDRESS: u32 = 50u32; pub const OPTION_RLP_SERVERS: u32 = 11u32; pub const OPTION_ROOT_DISK: u32 = 17u32; pub const OPTION_ROUTER_ADDRESS: u32 = 3u32; pub const OPTION_ROUTER_SOLICITATION_ADDR: u32 = 32u32; pub const OPTION_SERVER_IDENTIFIER: u32 = 54u32; pub const OPTION_STATIC_ROUTES: u32 = 33u32; pub const OPTION_SUBNET_MASK: u32 = 1u32; pub const OPTION_SWAP_SERVER: u32 = 16u32; pub const OPTION_TFTP_SERVER_NAME: u32 = 66u32; pub const OPTION_TIME_OFFSET: u32 = 2u32; pub const OPTION_TIME_SERVERS: u32 = 4u32; pub const OPTION_TRAILERS: u32 = 34u32; pub const OPTION_TTL: u32 = 37u32; pub const OPTION_VENDOR_SPEC_INFO: u32 = 43u32; pub const OPTION_XWINDOW_DISPLAY_MANAGER: u32 = 49u32; pub const OPTION_XWINDOW_FONT_SERVER: u32 = 48u32; pub const PERCENTAGE: u32 = 8u32; pub const PREVSTATE: u32 = 32u32; pub const QUARANTINE_CONFIG_OPTION: u32 = 43222u32; pub const QUARANTINE_SCOPE_QUARPROFILE_OPTION: u32 = 43221u32; pub const QUARANTIN_OPTION_BASE: u32 = 43220u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct QuarantineStatus(pub i32); pub const NOQUARANTINE: QuarantineStatus = QuarantineStatus(0i32); pub const RESTRICTEDACCESS: QuarantineStatus = QuarantineStatus(1i32); pub const DROPPACKET: QuarantineStatus = QuarantineStatus(2i32); pub const PROBATION: QuarantineStatus = QuarantineStatus(3i32); pub const EXEMPT: QuarantineStatus = QuarantineStatus(4i32); pub const DEFAULTQUARSETTING: QuarantineStatus = QuarantineStatus(5i32); pub const NOQUARINFO: QuarantineStatus = QuarantineStatus(6i32); impl ::core::convert::From<i32> for QuarantineStatus { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for QuarantineStatus { type Abi = Self; } pub const SAFEPERIOD: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SCOPE_MIB_INFO { pub Subnet: u32, pub NumAddressesInuse: u32, pub NumAddressesFree: u32, pub NumPendingOffers: u32, } impl SCOPE_MIB_INFO {} impl ::core::default::Default for SCOPE_MIB_INFO { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SCOPE_MIB_INFO { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SCOPE_MIB_INFO").field("Subnet", &self.Subnet).field("NumAddressesInuse", &self.NumAddressesInuse).field("NumAddressesFree", &self.NumAddressesFree).field("NumPendingOffers", &self.NumPendingOffers).finish() } } impl ::core::cmp::PartialEq for SCOPE_MIB_INFO { fn eq(&self, other: &Self) -> bool { self.Subnet == other.Subnet && self.NumAddressesInuse == other.NumAddressesInuse && self.NumAddressesFree == other.NumAddressesFree && self.NumPendingOffers == other.NumPendingOffers } } impl ::core::cmp::Eq for SCOPE_MIB_INFO {} unsafe impl ::windows::core::Abi for SCOPE_MIB_INFO { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SCOPE_MIB_INFO_V5 { pub Subnet: u32, pub NumAddressesInuse: u32, pub NumAddressesFree: u32, pub NumPendingOffers: u32, } impl SCOPE_MIB_INFO_V5 {} impl ::core::default::Default for SCOPE_MIB_INFO_V5 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SCOPE_MIB_INFO_V5 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SCOPE_MIB_INFO_V5").field("Subnet", &self.Subnet).field("NumAddressesInuse", &self.NumAddressesInuse).field("NumAddressesFree", &self.NumAddressesFree).field("NumPendingOffers", &self.NumPendingOffers).finish() } } impl ::core::cmp::PartialEq for SCOPE_MIB_INFO_V5 { fn eq(&self, other: &Self) -> bool { self.Subnet == other.Subnet && self.NumAddressesInuse == other.NumAddressesInuse && self.NumAddressesFree == other.NumAddressesFree && self.NumPendingOffers == other.NumPendingOffers } } impl ::core::cmp::Eq for SCOPE_MIB_INFO_V5 {} unsafe impl ::windows::core::Abi for SCOPE_MIB_INFO_V5 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SCOPE_MIB_INFO_V6 { pub Subnet: DHCP_IPV6_ADDRESS, pub NumAddressesInuse: u64, pub NumAddressesFree: u64, pub NumPendingAdvertises: u64, } impl SCOPE_MIB_INFO_V6 {} impl ::core::default::Default for SCOPE_MIB_INFO_V6 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SCOPE_MIB_INFO_V6 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SCOPE_MIB_INFO_V6").field("Subnet", &self.Subnet).field("NumAddressesInuse", &self.NumAddressesInuse).field("NumAddressesFree", &self.NumAddressesFree).field("NumPendingAdvertises", &self.NumPendingAdvertises).finish() } } impl ::core::cmp::PartialEq for SCOPE_MIB_INFO_V6 { fn eq(&self, other: &Self) -> bool { self.Subnet == other.Subnet && self.NumAddressesInuse == other.NumAddressesInuse && self.NumAddressesFree == other.NumAddressesFree && self.NumPendingAdvertises == other.NumPendingAdvertises } } impl ::core::cmp::Eq for SCOPE_MIB_INFO_V6 {} unsafe impl ::windows::core::Abi for SCOPE_MIB_INFO_V6 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct SCOPE_MIB_INFO_VQ { pub Subnet: u32, pub NumAddressesInuse: u32, pub NumAddressesFree: u32, pub NumPendingOffers: u32, pub QtnNumLeases: u32, pub QtnPctQtnLeases: u32, pub QtnProbationLeases: u32, pub QtnNonQtnLeases: u32, pub QtnExemptLeases: u32, pub QtnCapableClients: u32, } impl SCOPE_MIB_INFO_VQ {} impl ::core::default::Default for SCOPE_MIB_INFO_VQ { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for SCOPE_MIB_INFO_VQ { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SCOPE_MIB_INFO_VQ") .field("Subnet", &self.Subnet) .field("NumAddressesInuse", &self.NumAddressesInuse) .field("NumAddressesFree", &self.NumAddressesFree) .field("NumPendingOffers", &self.NumPendingOffers) .field("QtnNumLeases", &self.QtnNumLeases) .field("QtnPctQtnLeases", &self.QtnPctQtnLeases) .field("QtnProbationLeases", &self.QtnProbationLeases) .field("QtnNonQtnLeases", &self.QtnNonQtnLeases) .field("QtnExemptLeases", &self.QtnExemptLeases) .field("QtnCapableClients", &self.QtnCapableClients) .finish() } } impl ::core::cmp::PartialEq for SCOPE_MIB_INFO_VQ { fn eq(&self, other: &Self) -> bool { self.Subnet == other.Subnet && self.NumAddressesInuse == other.NumAddressesInuse && self.NumAddressesFree == other.NumAddressesFree && self.NumPendingOffers == other.NumPendingOffers && self.QtnNumLeases == other.QtnNumLeases && self.QtnPctQtnLeases == other.QtnPctQtnLeases && self.QtnProbationLeases == other.QtnProbationLeases && self.QtnNonQtnLeases == other.QtnNonQtnLeases && self.QtnExemptLeases == other.QtnExemptLeases && self.QtnCapableClients == other.QtnCapableClients } } impl ::core::cmp::Eq for SCOPE_MIB_INFO_VQ {} unsafe impl ::windows::core::Abi for SCOPE_MIB_INFO_VQ { type Abi = Self; } pub const SHAREDSECRET: u32 = 64u32; pub const Set_APIProtocolSupport: u32 = 1u32; pub const Set_AuditLogState: u32 = 2048u32; pub const Set_BackupInterval: u32 = 16u32; pub const Set_BackupPath: u32 = 8u32; pub const Set_BootFileTable: u32 = 1024u32; pub const Set_DatabaseCleanupInterval: u32 = 128u32; pub const Set_DatabaseLoggingFlag: u32 = 32u32; pub const Set_DatabaseName: u32 = 2u32; pub const Set_DatabasePath: u32 = 4u32; pub const Set_DebugFlag: u32 = 256u32; pub const Set_PingRetries: u32 = 512u32; pub const Set_PreferredLifetime: u32 = 4u32; pub const Set_PreferredLifetimeIATA: u32 = 64u32; pub const Set_QuarantineDefFail: u32 = 8192u32; pub const Set_QuarantineON: u32 = 4096u32; pub const Set_RapidCommitFlag: u32 = 2u32; pub const Set_RestoreFlag: u32 = 64u32; pub const Set_T1: u32 = 16u32; pub const Set_T2: u32 = 32u32; pub const Set_UnicastFlag: u32 = 1u32; pub const Set_ValidLifetime: u32 = 8u32; pub const Set_ValidLifetimeIATA: u32 = 128u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct StatusCode(pub i32); pub const STATUS_NO_ERROR: StatusCode = StatusCode(0i32); pub const STATUS_UNSPECIFIED_FAILURE: StatusCode = StatusCode(1i32); pub const STATUS_NO_BINDING: StatusCode = StatusCode(3i32); pub const STATUS_NOPREFIX_AVAIL: StatusCode = StatusCode(6i32); impl ::core::convert::From<i32> for StatusCode { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for StatusCode { type Abi = Self; } pub const V5_ADDRESS_BIT_BOTH_REC: u32 = 32u32; pub const V5_ADDRESS_BIT_DELETED: u32 = 128u32; pub const V5_ADDRESS_BIT_UNREGISTERED: u32 = 64u32; pub const V5_ADDRESS_EX_BIT_DISABLE_PTR_RR: u32 = 1u32; pub const V5_ADDRESS_STATE_ACTIVE: u32 = 1u32; pub const V5_ADDRESS_STATE_DECLINED: u32 = 2u32; pub const V5_ADDRESS_STATE_DOOM: u32 = 3u32; pub const V5_ADDRESS_STATE_OFFERED: u32 = 0u32; pub const WARNING_EXTENDED_LESS: i32 = 20026i32;
use serde::Deserialize; use super::helpers::deserealize_currency; /// Информация о виртуальном итеме покупки /// https://developers.xsolla.com/ru/api/v2/getting-started/#api_param_webhooks_payment_purchase_virtual_items #[derive(Debug, Deserialize)] pub struct VirtualItem{ pub sku: String, pub amount: i32 } /// Информация о виртуальных покупаемых итемах /// https://developers.xsolla.com/ru/api/v2/getting-started/#api_param_webhooks_payment_purchase_virtual_items #[derive(Debug, Deserialize)] pub struct VirtualItems { pub items: Vec<VirtualItem>, #[serde(deserialize_with = "deserealize_currency")] pub currency: &'static iso4217::CurrencyCode, pub amount: f32, }
pub struct Solution; impl Solution { pub fn missing_number(nums: Vec<i32>) -> i32 { let n = nums.len() as i32; let mut total = 0; for i in 0..=n { total ^= i; } for i in nums { total ^= i; } total } } #[test] fn test0268() { fn case(nums: Vec<i32>, want: i32) { let got = Solution::missing_number(nums); assert_eq!(got, want); } case(vec![3, 0, 1], 2); case(vec![9, 6, 4, 2, 3, 5, 7, 0, 1], 8); }
use anyhow::Result; use clap::{App, AppSettings, ArgMatches}; pub static DEFAULT_CLAP_SETTINGS: &[AppSettings] = &[ AppSettings::DontCollapseArgsInUsage, AppSettings::UnifiedHelpMessage, ]; pub enum ParameterGroup { Encoder = 0, Classifier = 1, EncoderNoWeightDecay = 2, ClassifierNoWeightDecay = 3, } pub trait SyntaxDotApp where Self: Sized, { fn app() -> App<'static, 'static>; fn parse(matches: &ArgMatches) -> Result<Self>; fn run(&self) -> Result<()>; } pub trait SyntaxDotOption { type Value; fn add_to_app(app: App<'static, 'static>) -> App<'static, 'static>; fn parse(matches: &ArgMatches) -> Result<Self::Value>; }
extern crate rustrip; extern crate regex; extern crate rand; use std::env::args; use std::io::{stdin, Read}; use regex::Regex; use rand::distributions::{IndependentSample, Range}; fn gen_pass(min: usize, max: usize) -> String { let mut buf = String::new(); let mut rng = rand::weak_rng(); let ascii_range: Range<u8> = Range::new(33, 127); let length = Range::new(min, max).ind_sample(&mut rng); for _ in 0..length { buf.push(ascii_range.ind_sample(&mut rng) as char); } buf } fn main() { let mut input: String = String::new(); if args().count() < 2 { let stdin = stdin(); { stdin.lock().read_to_string(&mut input).unwrap(); } } else { input = args().skip(1).nth(0).unwrap(); } let regex = Regex::new(&input).expect("Invalid regular expression."); loop { let pass: &str = &gen_pass(4, 12); { let tripcode = rustrip::encode(pass).expect("Password failed to encode..."); if regex.is_match(&tripcode) { println!("{} -> {}", pass, tripcode); } } } }
// Setup ctdb for high availability NFSv3 extern crate ipnetwork; extern crate pnet; use std::io::{Read, Write}; use std::net::IpAddr; use std::str::FromStr; use self::ipnetwork::{IpNetworkError, IpNetwork, Ipv4Network, Ipv6Network}; use self::pnet::datalink::{interfaces, NetworkInterface}; #[derive(Debug, Eq, PartialEq)] pub struct VirtualIp { pub cidr: IpNetwork, pub interface: String, } impl ToString for VirtualIp { fn to_string(&self) -> String { match self.cidr { IpNetwork::V4(v4) => format!("{} {}", v4, self.interface), IpNetwork::V6(v6) => format!("{} {}", v6, self.interface), } } } /// Write the ctdb configuration file out to disk pub fn render_ctdb_configuration<T: Write>(f: &mut T) -> Result<usize, ::std::io::Error> { let mut bytes_written = 0; bytes_written += f.write(b"CTDB_LOGGING=file:/var/log/ctdb/ctdb.log\n")?; bytes_written += f.write(b"CTDB_NODES=/etc/ctdb/nodes\n")?; bytes_written += f.write(b"CTDB_PUBLIC_ADDRESSES=/etc/ctdb/public_addresses\n")?; bytes_written += f.write(b"CTDB_RECOVERY_LOCK=/mnt/glusterfs/.CTDB-lockfile\n")?; Ok(bytes_written) } /// Create the public nodes file for ctdb cluster to find all the other peers /// the cluster Vec should contain all nodes that are participating in the cluster pub fn render_ctdb_cluster_nodes<T: Write>(f: &mut T, cluster: &Vec<IpAddr>) -> Result<usize, ::std::io::Error> { let mut bytes_written = 0; for node in cluster { bytes_written += f.write(&format!("{}\n", node).as_bytes())?; } Ok(bytes_written) } /// Create the public addresses file for ctdb cluster to find all the virtual /// ip addresses to float across the cluster. pub fn render_ctdb_public_addresses<T: Write>(f: &mut T, cluster_networks: &Vec<VirtualIp>) -> Result<usize, ::std::io::Error> { let mut bytes_written = 0; for node in cluster_networks { bytes_written += f.write(&format!("{}\n", node.to_string()).as_bytes())?; } Ok(bytes_written) } #[test] fn test_render_ctdb_cluster_nodes() { // Test IPV5 let ctdb_cluster = vec![::std::net::IpAddr::V4(::std::net::Ipv4Addr::new(192, 168, 1, 2)), ::std::net::IpAddr::V4(::std::net::Ipv4Addr::new(192, 168, 1, 3))]; let expected_result = "192.168.1.2\n192.168.1.3\n"; let mut buff = ::std::io::Cursor::new(vec![0; 24]); render_ctdb_cluster_nodes(&mut buff, &ctdb_cluster).unwrap(); let result = String::from_utf8_lossy(&buff.into_inner()).into_owned(); println!("test_render_ctdb_cluster_nodes: \"{}\"", result); assert_eq!(expected_result, result); // Test IPV6 let addr1 = ::std::net::Ipv6Addr::from_str("2001:0db8:85a3:0000:0000:8a2e:0370:7334").unwrap(); let addr2 = ::std::net::Ipv6Addr::from_str("2001:cdba:0000:0000:0000:0000:3257:9652").unwrap(); let ctdb_cluster = vec![::std::net::IpAddr::V6(addr1), ::std::net::IpAddr::V6(addr2)]; let expected_result = "2001:db8:85a3::8a2e:370:7334\n2001:cdba::3257:9652\n"; let mut buff = ::std::io::Cursor::new(vec![0; 49]); render_ctdb_cluster_nodes(&mut buff, &ctdb_cluster).unwrap(); let result = String::from_utf8_lossy(&buff.into_inner()).into_owned(); println!("test_render_ctdb_cluster_nodes ipv6: \"{}\"", result); assert_eq!(expected_result, result); } pub fn ipnetwork_from_str(s: &str) -> Result<IpNetwork, String> { let v4addr: Result<Ipv4Network, IpNetworkError> = s.parse(); let v6addr: Result<Ipv6Network, IpNetworkError> = s.parse(); if v4addr.is_ok() { Ok(IpNetwork::V4(v4addr.unwrap())) } else if v6addr.is_ok() { Ok(IpNetwork::V6(v6addr.unwrap())) } else { // Failed to parse ip address Err(format!("Unable to parse network cidr: {}", s)) } } /// Return all virtual ip cidr networks that are being managed by ctdb /// located at file f. /etc/ctdb/public_addresses is the usual location #[allow(dead_code)] pub fn get_virtual_addrs<T: Read>(f: &mut T) -> Result<Vec<VirtualIp>, String> { let mut networks: Vec<VirtualIp> = Vec::new(); let mut buf = String::new(); f.read_to_string(&mut buf).map_err(|e| e.to_string())?; for line in buf.lines() { let parts: Vec<&str> = line.split(" ").collect(); if parts.len() < 2 { return Err(format!("Unable to parse network: {}", line)); } let addr: IpNetwork = ipnetwork_from_str(parts[0])?; let interface = parts[1].trim().to_string(); networks.push(VirtualIp { cidr: addr, interface: interface, }); } Ok(networks) } fn get_interface_for_ipv4_address(cidr_address: Ipv4Network, interfaces: Vec<NetworkInterface>) -> Option<String> { // Loop through every interface for iface in interfaces { // Loop through every ip address the interface is serving if let Some(ip_addrs) = iface.ips { for iface_ip in ip_addrs { match iface_ip { IpAddr::V4(v4_addr) => { if cidr_address.contains(v4_addr) { return Some(iface.name); } else { // No match continue; } } _ => { // It's a ipv6 address. Can't match against ipv4 continue; } }; } } } None } #[test] fn test_get_interfaces_for_ipv4_address() { let addr: Ipv4Network = "192.168.1.200/24".parse().unwrap(); let addr1 = ::std::net::Ipv4Addr::from_str("192.168.1.2").unwrap(); let addr2 = ::std::net::Ipv4Addr::from_str("192.168.2.2").unwrap(); let interfaces = vec![NetworkInterface { name: "eth0".to_string(), index: 0, mac: None, ips: Some(vec![::std::net::IpAddr::V4(addr1)]), flags: 0, }, NetworkInterface { name: "eth1".to_string(), index: 1, mac: None, ips: Some(vec![::std::net::IpAddr::V4(addr2)]), flags: 0, }]; let result = get_interface_for_ipv4_address(addr, interfaces); println!("get_interface_for_ipv4_address: {:?}", result); assert_eq!(Some("eth0".to_string()), result); } fn get_interface_for_ipv6_address(cidr_address: Ipv6Network, interfaces: Vec<NetworkInterface>) -> Option<String> { // Loop through every interface for iface in interfaces { // Loop through every ip address the interface is serving if let Some(ip_addrs) = iface.ips { for iface_ip in ip_addrs { match iface_ip { IpAddr::V6(v6_addr) => { if cidr_address.contains(v6_addr) { return Some(iface.name); } else { // No match continue; } } _ => { // It's a ipv4 address. Can't match against ipv6 continue; } }; } } } None } #[test] fn test_get_interfaces_for_ipv6_address() { let addr: Ipv6Network = "2001:0db8:85a3:0000:0000:8a2e:0370:7334/120".parse().unwrap(); let addr1 = ::std::net::Ipv6Addr::from_str("2001:db8:85a3:0:0:8a2e:370:7300").unwrap(); let addr2 = ::std::net::Ipv6Addr::from_str("fd36:d456:3a78::").unwrap(); let interfaces = vec![NetworkInterface { name: "eth0".to_string(), index: 0, mac: None, ips: Some(vec![::std::net::IpAddr::V6(addr1)]), flags: 0, }, NetworkInterface { name: "eth1".to_string(), index: 1, mac: None, ips: Some(vec![::std::net::IpAddr::V6(addr2)]), flags: 0, }]; let result = get_interface_for_ipv6_address(addr, interfaces); println!("get_interface_for_ipv6_address: {:?}", result); assert_eq!(Some("eth0".to_string()), result); } /// Return the network interface that serves the subnet for this ip address pub fn get_interface_for_address(cidr_address: IpNetwork) -> Option<String> { let interfaces = interfaces(); match cidr_address { IpNetwork::V4(v4_addr) => get_interface_for_ipv4_address(v4_addr, interfaces), IpNetwork::V6(v6_addr) => get_interface_for_ipv6_address(v6_addr, interfaces), } } /// Constructs a new `IpNetwork` from a given &str with a prefix denoting the /// network size. If the prefix is larger than 32 (for IPv4) or 128 (for IPv6), this /// will raise an `IpNetworkError::InvalidPrefix` error. #[allow(dead_code)] pub fn parse_ipnetwork(s: &str) -> Result<IpNetwork, IpNetworkError> { let v4addr: Result<Ipv4Network, IpNetworkError> = s.parse(); let v6addr: Result<Ipv6Network, IpNetworkError> = s.parse(); if v4addr.is_ok() { Ok(IpNetwork::V4(v4addr.unwrap())) } else if v6addr.is_ok() { Ok(IpNetwork::V6(v6addr.unwrap())) } else { Err(IpNetworkError::InvalidAddr(s.to_string())) } } #[test] fn test_parse_virtual_addrs() { let test_str = "10.0.0.6/24 eth2\n10.0.0.7/24 eth2".as_bytes(); let mut c = ::std::io::Cursor::new(&test_str); let result = get_virtual_addrs(&mut c).unwrap(); println!("test_parse_virtual_addrs: {:?}", result); let expected = vec![VirtualIp { cidr: IpNetwork::V4(Ipv4Network::new(::std::net::Ipv4Addr::new(10, 0, 0, 6), 24) .unwrap()), interface: "eth2".to_string(), }, VirtualIp { cidr: IpNetwork::V4(Ipv4Network::new(::std::net::Ipv4Addr::new(10, 0, 0, 7), 24) .unwrap()), interface: "eth2".to_string(), }]; assert_eq!(expected, result); } #[test] fn test_parse_virtual_addrs_v6() { let test_str = "2001:0db8:85a3:0000:0000:8a2e:0370:7334/24 \ eth2\n2001:cdba:0000:0000:0000:0000:3257:9652/24 eth2" .as_bytes(); let mut c = ::std::io::Cursor::new(&test_str); let result = get_virtual_addrs(&mut c).unwrap(); println!("test_get_virtual_addrs: {:?}", result); let addr1 = ::std::net::Ipv6Addr::from_str("2001:0db8:85a3:0000:0000:8a2e:0370:7334").unwrap(); let addr2 = ::std::net::Ipv6Addr::from_str("2001:cdba:0000:0000:0000:0000:3257:9652").unwrap(); let expected = vec![VirtualIp { cidr: IpNetwork::V6(Ipv6Network::new(addr1, 24).unwrap()), interface: "eth2".to_string(), }, VirtualIp { cidr: IpNetwork::V6(Ipv6Network::new(addr2, 24).unwrap()), interface: "eth2".to_string(), }]; assert_eq!(expected, result); } /// Return all ctdb nodes that are contained in the file f /// /etc/ctdb/nodes is the usual location #[allow(dead_code)] pub fn get_ctdb_nodes<T: Read>(f: &mut T) -> Result<Vec<IpAddr>, String> { let mut addrs: Vec<IpAddr> = Vec::new(); let mut buf = String::new(); f.read_to_string(&mut buf).map_err(|e| e.to_string())?; for line in buf.lines() { let addr = IpAddr::from_str(line).map_err(|e| e.to_string())?; addrs.push(addr); } Ok(addrs) } #[test] fn test_get_ctdb_nodes() { let test_str = "10.0.0.1\n10.0.0.2".as_bytes(); let mut c = ::std::io::Cursor::new(&test_str); let result = get_ctdb_nodes(&mut c).unwrap(); println!("test_get_ctdb_nodes: {:?}", result); let addr1 = ::std::net::Ipv4Addr::new(10, 0, 0, 1); let addr2 = ::std::net::Ipv4Addr::new(10, 0, 0, 2); let expected = vec![IpAddr::V4(addr1), IpAddr::V4(addr2)]; assert_eq!(expected, result); } #[test] fn test_get_ctdb_nodes_v6() { let test_str = "2001:0db8:85a3:0000:0000:8a2e:0370:7334\n2001:cdba:0000:0000:0000:0000:3257:\ 9652" .as_bytes(); let mut c = ::std::io::Cursor::new(&test_str); let result = get_ctdb_nodes(&mut c).unwrap(); println!("test_get_ctdb_nodes_v6: {:?}", result); let addr1 = ::std::net::Ipv6Addr::from_str("2001:0db8:85a3:0000:0000:8a2e:0370:7334").unwrap(); let addr2 = ::std::net::Ipv6Addr::from_str("2001:cdba:0000:0000:0000:0000:3257:9652").unwrap(); let expected = vec![IpAddr::V6(addr1), IpAddr::V6(addr2)]; assert_eq!(expected, result); }
use crate::common::token_parser; use crate::types::MetricType; use nom::branch::alt; use nom::bytes::complete::tag; use nom::character::complete::not_line_ending; use nom::character::complete::{newline, space0, space1}; use nom::combinator::{map, opt}; #[cfg(test)] use nom::error::ErrorKind; use nom::sequence::{delimited, preceded, tuple}; #[cfg(test)] use nom::Err::Error; use nom::IResult; #[derive(Debug, PartialEq)] pub enum CommentType<'a> { Type(&'a str, MetricType), Help(&'a str), Other, } /// Parse comments that starts with "# TYPE" fn type_parser(i: &str) -> IResult<&str, (&str, MetricType)> { let metric_parser = map( opt(preceded( space1, alt(( map(tag("counter"), |_| MetricType::Counter), map(tag("gauge"), |_| MetricType::Gauge), map(tag("histogram"), |_| MetricType::Histogram), map(tag("untyped"), |_| MetricType::Untyped), map(tag("summary"), |_| MetricType::Summary), )), )), |x| x.unwrap_or(MetricType::Untyped), ); delimited( tuple((tag("#"), space1, tag("TYPE"), space1)), tuple((token_parser, metric_parser)), tuple((space0, newline)), )(i) } fn other_comment_parser(i: &str) -> IResult<&str, ()> { map(delimited(tag("#"), not_line_ending, newline), |_| ())(i) } /// Parse comments that starts with "# HELP" fn help_parser(i: &str) -> IResult<&str, &str> { delimited( tuple((tag("#"), space1, tag("HELP"), space1)), not_line_ending, newline, )(i) } /// Parses a comment and return the different types /// TODO make help optional pub fn comment_parser(i: &str) -> IResult<&str, CommentType> { alt(( map(type_parser, |(name, tpe)| CommentType::Type(name, tpe)), map(help_parser, |s| CommentType::Help(s)), map(other_comment_parser, |_| CommentType::Other), ))(i) } // TODO can we make this asserts easier to read/write #[test] fn test_type_parser() { assert_eq!( type_parser("# TYPE http_request_duration_seconds histogram\n"), Ok(("", ("http_request_duration_seconds", MetricType::Histogram))) ); assert_eq!( type_parser("# TYPE http_request_duration_seconds\n"), Ok(("", ("http_request_duration_seconds", MetricType::Untyped))) ); assert_eq!( type_parser("# TYPE http_request_duration_seconds \n"), Ok(("", ("http_request_duration_seconds", MetricType::Untyped))) ); assert_eq!( type_parser("# TYPE http_request_duration_seconds \nfoo"), Ok(( "foo", ("http_request_duration_seconds", MetricType::Untyped) )) ); assert_eq!( type_parser("# TYPE http_request_duration_seconds summary\n"), Ok(("", ("http_request_duration_seconds", MetricType::Summary))) ); assert_eq!( type_parser("# TYPE http_request_duration_seconds sometype\n"), Err(Error(("sometype\n", ErrorKind::Char))) ); } #[test] fn test_other_comment_parser() { assert_eq!( other_comment_parser("# TYPE http_request_duration_seconds histogram\n"), Ok(("", ())) ); assert_eq!( other_comment_parser("# TYPE http_request_duration_seconds histogram\nfoo"), Ok(("foo", ())) ); assert_eq!( other_comment_parser("#This is a comment and we don't care about it\n"), Ok(("", ())) ); assert_eq!( other_comment_parser("foo bar\n"), Err(Error(("foo bar\n", ErrorKind::Tag))) ); } #[test] fn test_help_parser() { assert_eq!( help_parser("# TYPE http_request_duration_seconds histogram\n"), Err(Error(( "TYPE http_request_duration_seconds histogram\n", ErrorKind::Tag ))) ); assert_eq!( help_parser("# HELP http_request_duration_seconds histogram\nfoo"), Ok(("foo", "http_request_duration_seconds histogram")) ); assert_eq!( help_parser("# This is a comment and we don't care about it\n"), Err(Error(( "This is a comment and we don't care about it\n", ErrorKind::Tag ))) ); } #[test] fn test_comment_parser() { assert_eq!( comment_parser("_TYPE histogram\n"), Err(Error(("_TYPE histogram\n", ErrorKind::Tag))) ); assert_eq!( comment_parser("# http_request_duration_seconds histogram\n"), Ok(("", CommentType::Other)) ); assert_eq!( comment_parser("# HELP some info\n"), Ok(("", CommentType::Help("some info"))) ); assert_eq!( comment_parser("# TYPE http_request_duration_seconds histogram\n"), Ok(( "", CommentType::Type("http_request_duration_seconds", MetricType::Histogram,) )) ); }
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationAttribute(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationAttribute { type Vtable = ISyndicationAttribute_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x71e8f969_526e_4001_9a91_e84f83161ab1); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationAttribute_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationAttributeFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationAttributeFactory { type Vtable = ISyndicationAttributeFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x624f1599_ed3e_420f_be86_640414886e4b); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationAttributeFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, attributename: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, attributenamespace: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, attributevalue: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationCategory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationCategory { type Vtable = ISyndicationCategory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8715626f_0cba_4a7f_89ff_ecb5281423b6); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationCategory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationCategoryFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationCategoryFactory { type Vtable = ISyndicationCategoryFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xab42802f_49e0_4525_8ab2_ab45c02528ff); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationCategoryFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, term: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, term: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, scheme: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, label: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ISyndicationClient(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationClient { type Vtable = ISyndicationClient_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9e18a9b7_7249_4b45_b229_7df895a5a1f5); } impl ISyndicationClient { #[cfg(feature = "Security_Credentials")] pub fn ServerCredential(&self) -> ::windows::core::Result<super::super::Security::Credentials::PasswordCredential> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Security::Credentials::PasswordCredential>(result__) } } #[cfg(feature = "Security_Credentials")] pub fn SetServerCredential<'a, Param0: ::windows::core::IntoParam<'a, super::super::Security::Credentials::PasswordCredential>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Security_Credentials")] pub fn ProxyCredential(&self) -> ::windows::core::Result<super::super::Security::Credentials::PasswordCredential> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Security::Credentials::PasswordCredential>(result__) } } #[cfg(feature = "Security_Credentials")] pub fn SetProxyCredential<'a, Param0: ::windows::core::IntoParam<'a, super::super::Security::Credentials::PasswordCredential>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn MaxResponseBufferSize(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn SetMaxResponseBufferSize(&self, value: u32) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value).ok() } } pub fn Timeout(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn SetTimeout(&self, value: u32) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value).ok() } } pub fn BypassCacheOnRetrieve(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetBypassCacheOnRetrieve(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value).ok() } } pub fn SetRequestHeader<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, name: Param0, value: Param1) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), name.into_param().abi(), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn RetrieveFeedAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, uri: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperationWithProgress<SyndicationFeed, RetrievalProgress>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), uri.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperationWithProgress<SyndicationFeed, RetrievalProgress>>(result__) } } } unsafe impl ::windows::core::RuntimeType for ISyndicationClient { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{9e18a9b7-7249-4b45-b229-7df895a5a1f5}"); } impl ::core::convert::From<ISyndicationClient> for ::windows::core::IUnknown { fn from(value: ISyndicationClient) -> Self { value.0 .0 } } impl ::core::convert::From<&ISyndicationClient> for ::windows::core::IUnknown { fn from(value: &ISyndicationClient) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISyndicationClient { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISyndicationClient { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ISyndicationClient> for ::windows::core::IInspectable { fn from(value: ISyndicationClient) -> Self { value.0 } } impl ::core::convert::From<&ISyndicationClient> for ::windows::core::IInspectable { fn from(value: &ISyndicationClient) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ISyndicationClient { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a ISyndicationClient { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct ISyndicationClient_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Security_Credentials")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Security_Credentials"))] usize, #[cfg(feature = "Security_Credentials")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Security_Credentials"))] usize, #[cfg(feature = "Security_Credentials")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Security_Credentials"))] usize, #[cfg(feature = "Security_Credentials")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Security_Credentials"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, name: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, uri: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationClientFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationClientFactory { type Vtable = ISyndicationClientFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2ec4b32c_a79b_4114_b29a_05dffbafb9a4); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationClientFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Security_Credentials")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, servercredential: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Security_Credentials"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationContent(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationContent { type Vtable = ISyndicationContent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4641fefe_0e55_40d0_b8d0_6a2ccba9fc7c); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationContent_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationContentFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationContentFactory { type Vtable = ISyndicationContentFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3d2fbb93_9520_4173_9388_7e2df324a8a0); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationContentFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, text: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, r#type: SyndicationTextType, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, sourceuri: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationErrorStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationErrorStatics { type Vtable = ISyndicationErrorStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1fbb2361_45c7_4833_8aa0_be5f3b58a7f4); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationErrorStatics_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, hresult: i32, result__: *mut SyndicationErrorStatus) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationFeed(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationFeed { type Vtable = ISyndicationFeed_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7ffe3cd2_5b66_4d62_8403_1bc10d910d6b); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationFeed_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::DateTime) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::Foundation::DateTime) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut SyndicationFormat) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, feed: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Data_Xml_Dom")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, feeddocument: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Data_Xml_Dom"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationFeedFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationFeedFactory { type Vtable = ISyndicationFeedFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x23472232_8be9_48b7_8934_6205131d9357); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationFeedFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, title: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, subtitle: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, uri: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationGenerator(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationGenerator { type Vtable = ISyndicationGenerator_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9768b379_fb2b_4f6d_b41c_088a5868825c); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationGenerator_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationGeneratorFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationGeneratorFactory { type Vtable = ISyndicationGeneratorFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa34083e3_1e26_4dbc_ba9d_1ab84beff97b); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationGeneratorFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, text: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationItem(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationItem { type Vtable = ISyndicationItem_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x548db883_c384_45c1_8ae8_a378c4ec486c); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationItem_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::DateTime) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::Foundation::DateTime) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::DateTime) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::Foundation::DateTime) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, item: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Data_Xml_Dom")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, itemdocument: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Data_Xml_Dom"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationItemFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationItemFactory { type Vtable = ISyndicationItemFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x251d434f_7db8_487a_85e4_10d191e66ebb); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationItemFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, title: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, content: ::windows::core::RawPtr, uri: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationLink(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationLink { type Vtable = ISyndicationLink_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x27553abd_a10e_41b5_86bd_9759086eb0c5); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationLink_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationLinkFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationLinkFactory { type Vtable = ISyndicationLinkFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5ed863d4_5535_48ac_98d4_c190995080b3); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationLinkFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, uri: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, uri: ::windows::core::RawPtr, relationship: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, title: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, mediatype: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, length: u32, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ISyndicationNode(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationNode { type Vtable = ISyndicationNode_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x753cef78_51f8_45c0_a9f5_f1719dec3fb2); } impl ISyndicationNode { pub fn NodeName(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeNamespace(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeNamespace<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeValue(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeValue<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Language(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn BaseUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetBaseUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn AttributeExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationAttribute>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationAttribute>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ElementExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<ISyndicationNode>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<ISyndicationNode>>(result__) } } #[cfg(feature = "Data_Xml_Dom")] pub fn GetXmlDocument(&self, format: SyndicationFormat) -> ::windows::core::Result<super::super::Data::Xml::Dom::XmlDocument> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), format, &mut result__).from_abi::<super::super::Data::Xml::Dom::XmlDocument>(result__) } } } unsafe impl ::windows::core::RuntimeType for ISyndicationNode { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{753cef78-51f8-45c0-a9f5-f1719dec3fb2}"); } impl ::core::convert::From<ISyndicationNode> for ::windows::core::IUnknown { fn from(value: ISyndicationNode) -> Self { value.0 .0 } } impl ::core::convert::From<&ISyndicationNode> for ::windows::core::IUnknown { fn from(value: &ISyndicationNode) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISyndicationNode { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISyndicationNode { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ISyndicationNode> for ::windows::core::IInspectable { fn from(value: ISyndicationNode) -> Self { value.0 } } impl ::core::convert::From<&ISyndicationNode> for ::windows::core::IInspectable { fn from(value: &ISyndicationNode) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ISyndicationNode { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a ISyndicationNode { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct ISyndicationNode_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, #[cfg(feature = "Data_Xml_Dom")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, format: SyndicationFormat, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Data_Xml_Dom"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationNodeFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationNodeFactory { type Vtable = ISyndicationNodeFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x12902188_4acb_49a8_b777_a5eb92e18a79); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationNodeFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, nodename: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, nodenamespace: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, nodevalue: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationPerson(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationPerson { type Vtable = ISyndicationPerson_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfa1ee5da_a7c6_4517_a096_0143faf29327); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationPerson_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationPersonFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationPersonFactory { type Vtable = ISyndicationPersonFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xdcf4886d_229d_4b58_a49b_f3d2f0f5c99f); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationPersonFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, name: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, name: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, email: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, uri: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ISyndicationText(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationText { type Vtable = ISyndicationText_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb9cc5e80_313a_4091_a2a6_243e0ee923f9); } impl ISyndicationText { pub fn Text(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetText<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Type(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetType<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Data_Xml_Dom")] pub fn Xml(&self) -> ::windows::core::Result<super::super::Data::Xml::Dom::XmlDocument> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Data::Xml::Dom::XmlDocument>(result__) } } #[cfg(feature = "Data_Xml_Dom")] pub fn SetXml<'a, Param0: ::windows::core::IntoParam<'a, super::super::Data::Xml::Dom::XmlDocument>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeName(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeNamespace(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeNamespace<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeValue(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeValue<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Language(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn BaseUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetBaseUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn AttributeExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationAttribute>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationAttribute>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ElementExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<ISyndicationNode>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<ISyndicationNode>>(result__) } } #[cfg(feature = "Data_Xml_Dom")] pub fn GetXmlDocument(&self, format: SyndicationFormat) -> ::windows::core::Result<super::super::Data::Xml::Dom::XmlDocument> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), format, &mut result__).from_abi::<super::super::Data::Xml::Dom::XmlDocument>(result__) } } } unsafe impl ::windows::core::RuntimeType for ISyndicationText { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{b9cc5e80-313a-4091-a2a6-243e0ee923f9}"); } impl ::core::convert::From<ISyndicationText> for ::windows::core::IUnknown { fn from(value: ISyndicationText) -> Self { value.0 .0 } } impl ::core::convert::From<&ISyndicationText> for ::windows::core::IUnknown { fn from(value: &ISyndicationText) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISyndicationText { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a ISyndicationText { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ISyndicationText> for ::windows::core::IInspectable { fn from(value: ISyndicationText) -> Self { value.0 } } impl ::core::convert::From<&ISyndicationText> for ::windows::core::IInspectable { fn from(value: &ISyndicationText) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ISyndicationText { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a ISyndicationText { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<ISyndicationText> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: ISyndicationText) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&ISyndicationText> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: &ISyndicationText) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for ISyndicationText { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for &ISyndicationText { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::core::convert::TryInto::<ISyndicationNode>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(C)] #[doc(hidden)] pub struct ISyndicationText_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Data_Xml_Dom")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Data_Xml_Dom"))] usize, #[cfg(feature = "Data_Xml_Dom")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Data_Xml_Dom"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISyndicationTextFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISyndicationTextFactory { type Vtable = ISyndicationTextFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xee7342f7_11c6_4b25_ab62_e596bd162946); } #[repr(C)] #[doc(hidden)] pub struct ISyndicationTextFactory_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, text: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, text: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, r#type: SyndicationTextType, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct RetrievalProgress { pub BytesRetrieved: u32, pub TotalBytesToRetrieve: u32, } impl RetrievalProgress {} impl ::core::default::Default for RetrievalProgress { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for RetrievalProgress { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("RetrievalProgress").field("BytesRetrieved", &self.BytesRetrieved).field("TotalBytesToRetrieve", &self.TotalBytesToRetrieve).finish() } } impl ::core::cmp::PartialEq for RetrievalProgress { fn eq(&self, other: &Self) -> bool { self.BytesRetrieved == other.BytesRetrieved && self.TotalBytesToRetrieve == other.TotalBytesToRetrieve } } impl ::core::cmp::Eq for RetrievalProgress {} unsafe impl ::windows::core::Abi for RetrievalProgress { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for RetrievalProgress { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"struct(Windows.Web.Syndication.RetrievalProgress;u4;u4)"); } impl ::windows::core::DefaultType for RetrievalProgress { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SyndicationAttribute(pub ::windows::core::IInspectable); impl SyndicationAttribute { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationAttribute, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn Name(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Namespace(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNamespace<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Value(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetValue<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn CreateSyndicationAttribute<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param2: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(attributename: Param0, attributenamespace: Param1, attributevalue: Param2) -> ::windows::core::Result<SyndicationAttribute> { Self::ISyndicationAttributeFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), attributename.into_param().abi(), attributenamespace.into_param().abi(), attributevalue.into_param().abi(), &mut result__).from_abi::<SyndicationAttribute>(result__) }) } pub fn ISyndicationAttributeFactory<R, F: FnOnce(&ISyndicationAttributeFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationAttribute, ISyndicationAttributeFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SyndicationAttribute { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Web.Syndication.SyndicationAttribute;{71e8f969-526e-4001-9a91-e84f83161ab1})"); } unsafe impl ::windows::core::Interface for SyndicationAttribute { type Vtable = ISyndicationAttribute_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x71e8f969_526e_4001_9a91_e84f83161ab1); } impl ::windows::core::RuntimeName for SyndicationAttribute { const NAME: &'static str = "Windows.Web.Syndication.SyndicationAttribute"; } impl ::core::convert::From<SyndicationAttribute> for ::windows::core::IUnknown { fn from(value: SyndicationAttribute) -> Self { value.0 .0 } } impl ::core::convert::From<&SyndicationAttribute> for ::windows::core::IUnknown { fn from(value: &SyndicationAttribute) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SyndicationAttribute { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SyndicationAttribute { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SyndicationAttribute> for ::windows::core::IInspectable { fn from(value: SyndicationAttribute) -> Self { value.0 } } impl ::core::convert::From<&SyndicationAttribute> for ::windows::core::IInspectable { fn from(value: &SyndicationAttribute) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SyndicationAttribute { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SyndicationAttribute { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for SyndicationAttribute {} unsafe impl ::core::marker::Sync for SyndicationAttribute {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SyndicationCategory(pub ::windows::core::IInspectable); impl SyndicationCategory { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationCategory, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn Label(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetLabel<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Scheme(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetScheme<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Term(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetTerm<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeName(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeNamespace(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeNamespace<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeValue(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeValue<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Language(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn BaseUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetBaseUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn AttributeExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationAttribute>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationAttribute>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ElementExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<ISyndicationNode>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<ISyndicationNode>>(result__) } } #[cfg(feature = "Data_Xml_Dom")] pub fn GetXmlDocument(&self, format: SyndicationFormat) -> ::windows::core::Result<super::super::Data::Xml::Dom::XmlDocument> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), format, &mut result__).from_abi::<super::super::Data::Xml::Dom::XmlDocument>(result__) } } pub fn CreateSyndicationCategory<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(term: Param0) -> ::windows::core::Result<SyndicationCategory> { Self::ISyndicationCategoryFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), term.into_param().abi(), &mut result__).from_abi::<SyndicationCategory>(result__) }) } pub fn CreateSyndicationCategoryEx<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param2: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(term: Param0, scheme: Param1, label: Param2) -> ::windows::core::Result<SyndicationCategory> { Self::ISyndicationCategoryFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), term.into_param().abi(), scheme.into_param().abi(), label.into_param().abi(), &mut result__).from_abi::<SyndicationCategory>(result__) }) } pub fn ISyndicationCategoryFactory<R, F: FnOnce(&ISyndicationCategoryFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationCategory, ISyndicationCategoryFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SyndicationCategory { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Web.Syndication.SyndicationCategory;{8715626f-0cba-4a7f-89ff-ecb5281423b6})"); } unsafe impl ::windows::core::Interface for SyndicationCategory { type Vtable = ISyndicationCategory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8715626f_0cba_4a7f_89ff_ecb5281423b6); } impl ::windows::core::RuntimeName for SyndicationCategory { const NAME: &'static str = "Windows.Web.Syndication.SyndicationCategory"; } impl ::core::convert::From<SyndicationCategory> for ::windows::core::IUnknown { fn from(value: SyndicationCategory) -> Self { value.0 .0 } } impl ::core::convert::From<&SyndicationCategory> for ::windows::core::IUnknown { fn from(value: &SyndicationCategory) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SyndicationCategory { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SyndicationCategory { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SyndicationCategory> for ::windows::core::IInspectable { fn from(value: SyndicationCategory) -> Self { value.0 } } impl ::core::convert::From<&SyndicationCategory> for ::windows::core::IInspectable { fn from(value: &SyndicationCategory) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SyndicationCategory { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SyndicationCategory { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<SyndicationCategory> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: SyndicationCategory) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SyndicationCategory> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: &SyndicationCategory) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for SyndicationCategory { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for &SyndicationCategory { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::core::convert::TryInto::<ISyndicationNode>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for SyndicationCategory {} unsafe impl ::core::marker::Sync for SyndicationCategory {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SyndicationClient(pub ::windows::core::IInspectable); impl SyndicationClient { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationClient, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Security_Credentials")] pub fn ServerCredential(&self) -> ::windows::core::Result<super::super::Security::Credentials::PasswordCredential> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Security::Credentials::PasswordCredential>(result__) } } #[cfg(feature = "Security_Credentials")] pub fn SetServerCredential<'a, Param0: ::windows::core::IntoParam<'a, super::super::Security::Credentials::PasswordCredential>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Security_Credentials")] pub fn ProxyCredential(&self) -> ::windows::core::Result<super::super::Security::Credentials::PasswordCredential> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Security::Credentials::PasswordCredential>(result__) } } #[cfg(feature = "Security_Credentials")] pub fn SetProxyCredential<'a, Param0: ::windows::core::IntoParam<'a, super::super::Security::Credentials::PasswordCredential>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn MaxResponseBufferSize(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn SetMaxResponseBufferSize(&self, value: u32) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value).ok() } } pub fn Timeout(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn SetTimeout(&self, value: u32) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value).ok() } } pub fn BypassCacheOnRetrieve(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetBypassCacheOnRetrieve(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value).ok() } } pub fn SetRequestHeader<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, name: Param0, value: Param1) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), name.into_param().abi(), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn RetrieveFeedAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, uri: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperationWithProgress<SyndicationFeed, RetrievalProgress>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), uri.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperationWithProgress<SyndicationFeed, RetrievalProgress>>(result__) } } #[cfg(feature = "Security_Credentials")] pub fn CreateSyndicationClient<'a, Param0: ::windows::core::IntoParam<'a, super::super::Security::Credentials::PasswordCredential>>(servercredential: Param0) -> ::windows::core::Result<SyndicationClient> { Self::ISyndicationClientFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), servercredential.into_param().abi(), &mut result__).from_abi::<SyndicationClient>(result__) }) } pub fn ISyndicationClientFactory<R, F: FnOnce(&ISyndicationClientFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationClient, ISyndicationClientFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SyndicationClient { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Web.Syndication.SyndicationClient;{9e18a9b7-7249-4b45-b229-7df895a5a1f5})"); } unsafe impl ::windows::core::Interface for SyndicationClient { type Vtable = ISyndicationClient_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9e18a9b7_7249_4b45_b229_7df895a5a1f5); } impl ::windows::core::RuntimeName for SyndicationClient { const NAME: &'static str = "Windows.Web.Syndication.SyndicationClient"; } impl ::core::convert::From<SyndicationClient> for ::windows::core::IUnknown { fn from(value: SyndicationClient) -> Self { value.0 .0 } } impl ::core::convert::From<&SyndicationClient> for ::windows::core::IUnknown { fn from(value: &SyndicationClient) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SyndicationClient { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SyndicationClient { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SyndicationClient> for ::windows::core::IInspectable { fn from(value: SyndicationClient) -> Self { value.0 } } impl ::core::convert::From<&SyndicationClient> for ::windows::core::IInspectable { fn from(value: &SyndicationClient) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SyndicationClient { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SyndicationClient { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<SyndicationClient> for ISyndicationClient { fn from(value: SyndicationClient) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&SyndicationClient> for ISyndicationClient { fn from(value: &SyndicationClient) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationClient> for SyndicationClient { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationClient> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationClient> for &SyndicationClient { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationClient> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for SyndicationClient {} unsafe impl ::core::marker::Sync for SyndicationClient {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SyndicationContent(pub ::windows::core::IInspectable); impl SyndicationContent { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationContent, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Foundation")] pub fn SourceUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetSourceUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeName(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeNamespace(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeNamespace<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeValue(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeValue<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Language(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn BaseUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetBaseUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn AttributeExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationAttribute>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationAttribute>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ElementExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<ISyndicationNode>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<ISyndicationNode>>(result__) } } #[cfg(feature = "Data_Xml_Dom")] pub fn GetXmlDocument(&self, format: SyndicationFormat) -> ::windows::core::Result<super::super::Data::Xml::Dom::XmlDocument> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), format, &mut result__).from_abi::<super::super::Data::Xml::Dom::XmlDocument>(result__) } } pub fn Text(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationText>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetText<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationText>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Type(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationText>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetType<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationText>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Data_Xml_Dom")] pub fn Xml(&self) -> ::windows::core::Result<super::super::Data::Xml::Dom::XmlDocument> { let this = &::windows::core::Interface::cast::<ISyndicationText>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Data::Xml::Dom::XmlDocument>(result__) } } #[cfg(feature = "Data_Xml_Dom")] pub fn SetXml<'a, Param0: ::windows::core::IntoParam<'a, super::super::Data::Xml::Dom::XmlDocument>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationText>(self)?; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn CreateSyndicationContent<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(text: Param0, r#type: SyndicationTextType) -> ::windows::core::Result<SyndicationContent> { Self::ISyndicationContentFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), text.into_param().abi(), r#type, &mut result__).from_abi::<SyndicationContent>(result__) }) } #[cfg(feature = "Foundation")] pub fn CreateSyndicationContentWithSourceUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(sourceuri: Param0) -> ::windows::core::Result<SyndicationContent> { Self::ISyndicationContentFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), sourceuri.into_param().abi(), &mut result__).from_abi::<SyndicationContent>(result__) }) } pub fn ISyndicationContentFactory<R, F: FnOnce(&ISyndicationContentFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationContent, ISyndicationContentFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SyndicationContent { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Web.Syndication.SyndicationContent;{4641fefe-0e55-40d0-b8d0-6a2ccba9fc7c})"); } unsafe impl ::windows::core::Interface for SyndicationContent { type Vtable = ISyndicationContent_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4641fefe_0e55_40d0_b8d0_6a2ccba9fc7c); } impl ::windows::core::RuntimeName for SyndicationContent { const NAME: &'static str = "Windows.Web.Syndication.SyndicationContent"; } impl ::core::convert::From<SyndicationContent> for ::windows::core::IUnknown { fn from(value: SyndicationContent) -> Self { value.0 .0 } } impl ::core::convert::From<&SyndicationContent> for ::windows::core::IUnknown { fn from(value: &SyndicationContent) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SyndicationContent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SyndicationContent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SyndicationContent> for ::windows::core::IInspectable { fn from(value: SyndicationContent) -> Self { value.0 } } impl ::core::convert::From<&SyndicationContent> for ::windows::core::IInspectable { fn from(value: &SyndicationContent) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SyndicationContent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SyndicationContent { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<SyndicationContent> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: SyndicationContent) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SyndicationContent> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: &SyndicationContent) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for SyndicationContent { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for &SyndicationContent { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::core::convert::TryInto::<ISyndicationNode>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } impl ::core::convert::TryFrom<SyndicationContent> for ISyndicationText { type Error = ::windows::core::Error; fn try_from(value: SyndicationContent) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SyndicationContent> for ISyndicationText { type Error = ::windows::core::Error; fn try_from(value: &SyndicationContent) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationText> for SyndicationContent { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationText> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationText> for &SyndicationContent { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationText> { ::core::convert::TryInto::<ISyndicationText>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for SyndicationContent {} unsafe impl ::core::marker::Sync for SyndicationContent {} pub struct SyndicationError {} impl SyndicationError { pub fn GetStatus(hresult: i32) -> ::windows::core::Result<SyndicationErrorStatus> { Self::ISyndicationErrorStatics(|this| unsafe { let mut result__: SyndicationErrorStatus = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), hresult, &mut result__).from_abi::<SyndicationErrorStatus>(result__) }) } pub fn ISyndicationErrorStatics<R, F: FnOnce(&ISyndicationErrorStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationError, ISyndicationErrorStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } impl ::windows::core::RuntimeName for SyndicationError { const NAME: &'static str = "Windows.Web.Syndication.SyndicationError"; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct SyndicationErrorStatus(pub i32); impl SyndicationErrorStatus { pub const Unknown: SyndicationErrorStatus = SyndicationErrorStatus(0i32); pub const MissingRequiredElement: SyndicationErrorStatus = SyndicationErrorStatus(1i32); pub const MissingRequiredAttribute: SyndicationErrorStatus = SyndicationErrorStatus(2i32); pub const InvalidXml: SyndicationErrorStatus = SyndicationErrorStatus(3i32); pub const UnexpectedContent: SyndicationErrorStatus = SyndicationErrorStatus(4i32); pub const UnsupportedFormat: SyndicationErrorStatus = SyndicationErrorStatus(5i32); } impl ::core::convert::From<i32> for SyndicationErrorStatus { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SyndicationErrorStatus { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for SyndicationErrorStatus { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Web.Syndication.SyndicationErrorStatus;i4)"); } impl ::windows::core::DefaultType for SyndicationErrorStatus { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SyndicationFeed(pub ::windows::core::IInspectable); impl SyndicationFeed { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationFeed, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Foundation_Collections")] pub fn Authors(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationPerson>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationPerson>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn Categories(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationCategory>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationCategory>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn Contributors(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationPerson>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationPerson>>(result__) } } pub fn Generator(&self) -> ::windows::core::Result<SyndicationGenerator> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<SyndicationGenerator>(result__) } } pub fn SetGenerator<'a, Param0: ::windows::core::IntoParam<'a, SyndicationGenerator>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn IconUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetIconUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Id(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetId<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn Items(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationItem>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationItem>>(result__) } } #[cfg(feature = "Foundation")] pub fn LastUpdatedTime(&self) -> ::windows::core::Result<super::super::Foundation::DateTime> { let this = self; unsafe { let mut result__: super::super::Foundation::DateTime = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::DateTime>(result__) } } #[cfg(feature = "Foundation")] pub fn SetLastUpdatedTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::DateTime>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn Links(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationLink>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationLink>>(result__) } } #[cfg(feature = "Foundation")] pub fn ImageUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).19)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetImageUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).20)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Rights(&self) -> ::windows::core::Result<ISyndicationText> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).21)(::core::mem::transmute_copy(this), &mut result__).from_abi::<ISyndicationText>(result__) } } pub fn SetRights<'a, Param0: ::windows::core::IntoParam<'a, ISyndicationText>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).22)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Subtitle(&self) -> ::windows::core::Result<ISyndicationText> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).23)(::core::mem::transmute_copy(this), &mut result__).from_abi::<ISyndicationText>(result__) } } pub fn SetSubtitle<'a, Param0: ::windows::core::IntoParam<'a, ISyndicationText>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).24)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Title(&self) -> ::windows::core::Result<ISyndicationText> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).25)(::core::mem::transmute_copy(this), &mut result__).from_abi::<ISyndicationText>(result__) } } pub fn SetTitle<'a, Param0: ::windows::core::IntoParam<'a, ISyndicationText>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).26)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn FirstUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).27)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn LastUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).28)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn NextUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).29)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn PreviousUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).30)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } pub fn SourceFormat(&self) -> ::windows::core::Result<SyndicationFormat> { let this = self; unsafe { let mut result__: SyndicationFormat = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).31)(::core::mem::transmute_copy(this), &mut result__).from_abi::<SyndicationFormat>(result__) } } pub fn Load<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, feed: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).32)(::core::mem::transmute_copy(this), feed.into_param().abi()).ok() } } #[cfg(feature = "Data_Xml_Dom")] pub fn LoadFromXml<'a, Param0: ::windows::core::IntoParam<'a, super::super::Data::Xml::Dom::XmlDocument>>(&self, feeddocument: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).33)(::core::mem::transmute_copy(this), feeddocument.into_param().abi()).ok() } } pub fn NodeName(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeNamespace(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeNamespace<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeValue(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeValue<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Language(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn BaseUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetBaseUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn AttributeExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationAttribute>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationAttribute>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ElementExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<ISyndicationNode>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<ISyndicationNode>>(result__) } } #[cfg(feature = "Data_Xml_Dom")] pub fn GetXmlDocument(&self, format: SyndicationFormat) -> ::windows::core::Result<super::super::Data::Xml::Dom::XmlDocument> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), format, &mut result__).from_abi::<super::super::Data::Xml::Dom::XmlDocument>(result__) } } #[cfg(feature = "Foundation")] pub fn CreateSyndicationFeed<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(title: Param0, subtitle: Param1, uri: Param2) -> ::windows::core::Result<SyndicationFeed> { Self::ISyndicationFeedFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), title.into_param().abi(), subtitle.into_param().abi(), uri.into_param().abi(), &mut result__).from_abi::<SyndicationFeed>(result__) }) } pub fn ISyndicationFeedFactory<R, F: FnOnce(&ISyndicationFeedFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationFeed, ISyndicationFeedFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SyndicationFeed { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Web.Syndication.SyndicationFeed;{7ffe3cd2-5b66-4d62-8403-1bc10d910d6b})"); } unsafe impl ::windows::core::Interface for SyndicationFeed { type Vtable = ISyndicationFeed_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7ffe3cd2_5b66_4d62_8403_1bc10d910d6b); } impl ::windows::core::RuntimeName for SyndicationFeed { const NAME: &'static str = "Windows.Web.Syndication.SyndicationFeed"; } impl ::core::convert::From<SyndicationFeed> for ::windows::core::IUnknown { fn from(value: SyndicationFeed) -> Self { value.0 .0 } } impl ::core::convert::From<&SyndicationFeed> for ::windows::core::IUnknown { fn from(value: &SyndicationFeed) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SyndicationFeed { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SyndicationFeed { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SyndicationFeed> for ::windows::core::IInspectable { fn from(value: SyndicationFeed) -> Self { value.0 } } impl ::core::convert::From<&SyndicationFeed> for ::windows::core::IInspectable { fn from(value: &SyndicationFeed) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SyndicationFeed { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SyndicationFeed { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<SyndicationFeed> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: SyndicationFeed) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SyndicationFeed> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: &SyndicationFeed) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for SyndicationFeed { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for &SyndicationFeed { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::core::convert::TryInto::<ISyndicationNode>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for SyndicationFeed {} unsafe impl ::core::marker::Sync for SyndicationFeed {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct SyndicationFormat(pub i32); impl SyndicationFormat { pub const Atom10: SyndicationFormat = SyndicationFormat(0i32); pub const Rss20: SyndicationFormat = SyndicationFormat(1i32); pub const Rss10: SyndicationFormat = SyndicationFormat(2i32); pub const Rss092: SyndicationFormat = SyndicationFormat(3i32); pub const Rss091: SyndicationFormat = SyndicationFormat(4i32); pub const Atom03: SyndicationFormat = SyndicationFormat(5i32); } impl ::core::convert::From<i32> for SyndicationFormat { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SyndicationFormat { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for SyndicationFormat { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Web.Syndication.SyndicationFormat;i4)"); } impl ::windows::core::DefaultType for SyndicationFormat { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SyndicationGenerator(pub ::windows::core::IInspectable); impl SyndicationGenerator { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationGenerator, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn Text(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetText<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Uri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Version(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetVersion<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeName(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeNamespace(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeNamespace<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeValue(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeValue<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Language(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn BaseUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetBaseUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn AttributeExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationAttribute>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationAttribute>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ElementExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<ISyndicationNode>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<ISyndicationNode>>(result__) } } #[cfg(feature = "Data_Xml_Dom")] pub fn GetXmlDocument(&self, format: SyndicationFormat) -> ::windows::core::Result<super::super::Data::Xml::Dom::XmlDocument> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), format, &mut result__).from_abi::<super::super::Data::Xml::Dom::XmlDocument>(result__) } } pub fn CreateSyndicationGenerator<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(text: Param0) -> ::windows::core::Result<SyndicationGenerator> { Self::ISyndicationGeneratorFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), text.into_param().abi(), &mut result__).from_abi::<SyndicationGenerator>(result__) }) } pub fn ISyndicationGeneratorFactory<R, F: FnOnce(&ISyndicationGeneratorFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationGenerator, ISyndicationGeneratorFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SyndicationGenerator { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Web.Syndication.SyndicationGenerator;{9768b379-fb2b-4f6d-b41c-088a5868825c})"); } unsafe impl ::windows::core::Interface for SyndicationGenerator { type Vtable = ISyndicationGenerator_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9768b379_fb2b_4f6d_b41c_088a5868825c); } impl ::windows::core::RuntimeName for SyndicationGenerator { const NAME: &'static str = "Windows.Web.Syndication.SyndicationGenerator"; } impl ::core::convert::From<SyndicationGenerator> for ::windows::core::IUnknown { fn from(value: SyndicationGenerator) -> Self { value.0 .0 } } impl ::core::convert::From<&SyndicationGenerator> for ::windows::core::IUnknown { fn from(value: &SyndicationGenerator) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SyndicationGenerator { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SyndicationGenerator { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SyndicationGenerator> for ::windows::core::IInspectable { fn from(value: SyndicationGenerator) -> Self { value.0 } } impl ::core::convert::From<&SyndicationGenerator> for ::windows::core::IInspectable { fn from(value: &SyndicationGenerator) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SyndicationGenerator { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SyndicationGenerator { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<SyndicationGenerator> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: SyndicationGenerator) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SyndicationGenerator> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: &SyndicationGenerator) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for SyndicationGenerator { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for &SyndicationGenerator { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::core::convert::TryInto::<ISyndicationNode>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for SyndicationGenerator {} unsafe impl ::core::marker::Sync for SyndicationGenerator {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SyndicationItem(pub ::windows::core::IInspectable); impl SyndicationItem { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationItem, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Foundation_Collections")] pub fn Authors(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationPerson>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationPerson>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn Categories(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationCategory>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationCategory>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn Contributors(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationPerson>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationPerson>>(result__) } } pub fn Content(&self) -> ::windows::core::Result<SyndicationContent> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<SyndicationContent>(result__) } } pub fn SetContent<'a, Param0: ::windows::core::IntoParam<'a, SyndicationContent>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Id(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetId<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn LastUpdatedTime(&self) -> ::windows::core::Result<super::super::Foundation::DateTime> { let this = self; unsafe { let mut result__: super::super::Foundation::DateTime = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::DateTime>(result__) } } #[cfg(feature = "Foundation")] pub fn SetLastUpdatedTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::DateTime>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn Links(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationLink>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationLink>>(result__) } } #[cfg(feature = "Foundation")] pub fn PublishedDate(&self) -> ::windows::core::Result<super::super::Foundation::DateTime> { let this = self; unsafe { let mut result__: super::super::Foundation::DateTime = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::DateTime>(result__) } } #[cfg(feature = "Foundation")] pub fn SetPublishedDate<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::DateTime>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Rights(&self) -> ::windows::core::Result<ISyndicationText> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), &mut result__).from_abi::<ISyndicationText>(result__) } } pub fn SetRights<'a, Param0: ::windows::core::IntoParam<'a, ISyndicationText>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).19)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Source(&self) -> ::windows::core::Result<SyndicationFeed> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).20)(::core::mem::transmute_copy(this), &mut result__).from_abi::<SyndicationFeed>(result__) } } pub fn SetSource<'a, Param0: ::windows::core::IntoParam<'a, SyndicationFeed>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).21)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Summary(&self) -> ::windows::core::Result<ISyndicationText> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).22)(::core::mem::transmute_copy(this), &mut result__).from_abi::<ISyndicationText>(result__) } } pub fn SetSummary<'a, Param0: ::windows::core::IntoParam<'a, ISyndicationText>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).23)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Title(&self) -> ::windows::core::Result<ISyndicationText> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).24)(::core::mem::transmute_copy(this), &mut result__).from_abi::<ISyndicationText>(result__) } } pub fn SetTitle<'a, Param0: ::windows::core::IntoParam<'a, ISyndicationText>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).25)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn CommentsUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).26)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetCommentsUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).27)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn EditUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).28)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn EditMediaUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).29)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } pub fn ETag(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).30)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn ItemUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).31)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } pub fn Load<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, item: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).32)(::core::mem::transmute_copy(this), item.into_param().abi()).ok() } } #[cfg(feature = "Data_Xml_Dom")] pub fn LoadFromXml<'a, Param0: ::windows::core::IntoParam<'a, super::super::Data::Xml::Dom::XmlDocument>>(&self, itemdocument: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).33)(::core::mem::transmute_copy(this), itemdocument.into_param().abi()).ok() } } pub fn NodeName(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeNamespace(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeNamespace<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeValue(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeValue<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Language(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn BaseUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetBaseUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn AttributeExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationAttribute>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationAttribute>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ElementExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<ISyndicationNode>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<ISyndicationNode>>(result__) } } #[cfg(feature = "Data_Xml_Dom")] pub fn GetXmlDocument(&self, format: SyndicationFormat) -> ::windows::core::Result<super::super::Data::Xml::Dom::XmlDocument> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), format, &mut result__).from_abi::<super::super::Data::Xml::Dom::XmlDocument>(result__) } } #[cfg(feature = "Foundation")] pub fn CreateSyndicationItem<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param1: ::windows::core::IntoParam<'a, SyndicationContent>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(title: Param0, content: Param1, uri: Param2) -> ::windows::core::Result<SyndicationItem> { Self::ISyndicationItemFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), title.into_param().abi(), content.into_param().abi(), uri.into_param().abi(), &mut result__).from_abi::<SyndicationItem>(result__) }) } pub fn ISyndicationItemFactory<R, F: FnOnce(&ISyndicationItemFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationItem, ISyndicationItemFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SyndicationItem { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Web.Syndication.SyndicationItem;{548db883-c384-45c1-8ae8-a378c4ec486c})"); } unsafe impl ::windows::core::Interface for SyndicationItem { type Vtable = ISyndicationItem_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x548db883_c384_45c1_8ae8_a378c4ec486c); } impl ::windows::core::RuntimeName for SyndicationItem { const NAME: &'static str = "Windows.Web.Syndication.SyndicationItem"; } impl ::core::convert::From<SyndicationItem> for ::windows::core::IUnknown { fn from(value: SyndicationItem) -> Self { value.0 .0 } } impl ::core::convert::From<&SyndicationItem> for ::windows::core::IUnknown { fn from(value: &SyndicationItem) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SyndicationItem { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SyndicationItem { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SyndicationItem> for ::windows::core::IInspectable { fn from(value: SyndicationItem) -> Self { value.0 } } impl ::core::convert::From<&SyndicationItem> for ::windows::core::IInspectable { fn from(value: &SyndicationItem) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SyndicationItem { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SyndicationItem { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<SyndicationItem> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: SyndicationItem) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SyndicationItem> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: &SyndicationItem) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for SyndicationItem { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for &SyndicationItem { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::core::convert::TryInto::<ISyndicationNode>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for SyndicationItem {} unsafe impl ::core::marker::Sync for SyndicationItem {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SyndicationLink(pub ::windows::core::IInspectable); impl SyndicationLink { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationLink, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn Length(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn SetLength(&self, value: u32) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value).ok() } } pub fn MediaType(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetMediaType<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Relationship(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetRelationship<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Title(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetTitle<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Uri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn ResourceLanguage(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetResourceLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeName(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeNamespace(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeNamespace<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeValue(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeValue<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Language(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn BaseUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetBaseUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn AttributeExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationAttribute>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationAttribute>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ElementExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<ISyndicationNode>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<ISyndicationNode>>(result__) } } #[cfg(feature = "Data_Xml_Dom")] pub fn GetXmlDocument(&self, format: SyndicationFormat) -> ::windows::core::Result<super::super::Data::Xml::Dom::XmlDocument> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), format, &mut result__).from_abi::<super::super::Data::Xml::Dom::XmlDocument>(result__) } } #[cfg(feature = "Foundation")] pub fn CreateSyndicationLink<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(uri: Param0) -> ::windows::core::Result<SyndicationLink> { Self::ISyndicationLinkFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), uri.into_param().abi(), &mut result__).from_abi::<SyndicationLink>(result__) }) } #[cfg(feature = "Foundation")] pub fn CreateSyndicationLinkEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param2: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param3: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(uri: Param0, relationship: Param1, title: Param2, mediatype: Param3, length: u32) -> ::windows::core::Result<SyndicationLink> { Self::ISyndicationLinkFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), uri.into_param().abi(), relationship.into_param().abi(), title.into_param().abi(), mediatype.into_param().abi(), length, &mut result__).from_abi::<SyndicationLink>(result__) }) } pub fn ISyndicationLinkFactory<R, F: FnOnce(&ISyndicationLinkFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationLink, ISyndicationLinkFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SyndicationLink { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Web.Syndication.SyndicationLink;{27553abd-a10e-41b5-86bd-9759086eb0c5})"); } unsafe impl ::windows::core::Interface for SyndicationLink { type Vtable = ISyndicationLink_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x27553abd_a10e_41b5_86bd_9759086eb0c5); } impl ::windows::core::RuntimeName for SyndicationLink { const NAME: &'static str = "Windows.Web.Syndication.SyndicationLink"; } impl ::core::convert::From<SyndicationLink> for ::windows::core::IUnknown { fn from(value: SyndicationLink) -> Self { value.0 .0 } } impl ::core::convert::From<&SyndicationLink> for ::windows::core::IUnknown { fn from(value: &SyndicationLink) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SyndicationLink { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SyndicationLink { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SyndicationLink> for ::windows::core::IInspectable { fn from(value: SyndicationLink) -> Self { value.0 } } impl ::core::convert::From<&SyndicationLink> for ::windows::core::IInspectable { fn from(value: &SyndicationLink) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SyndicationLink { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SyndicationLink { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<SyndicationLink> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: SyndicationLink) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SyndicationLink> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: &SyndicationLink) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for SyndicationLink { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for &SyndicationLink { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::core::convert::TryInto::<ISyndicationNode>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for SyndicationLink {} unsafe impl ::core::marker::Sync for SyndicationLink {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SyndicationNode(pub ::windows::core::IInspectable); impl SyndicationNode { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationNode, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn NodeName(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeNamespace(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeNamespace<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeValue(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeValue<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Language(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn BaseUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetBaseUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn AttributeExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationAttribute>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationAttribute>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ElementExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<ISyndicationNode>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<ISyndicationNode>>(result__) } } #[cfg(feature = "Data_Xml_Dom")] pub fn GetXmlDocument(&self, format: SyndicationFormat) -> ::windows::core::Result<super::super::Data::Xml::Dom::XmlDocument> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), format, &mut result__).from_abi::<super::super::Data::Xml::Dom::XmlDocument>(result__) } } pub fn CreateSyndicationNode<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param2: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(nodename: Param0, nodenamespace: Param1, nodevalue: Param2) -> ::windows::core::Result<SyndicationNode> { Self::ISyndicationNodeFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), nodename.into_param().abi(), nodenamespace.into_param().abi(), nodevalue.into_param().abi(), &mut result__).from_abi::<SyndicationNode>(result__) }) } pub fn ISyndicationNodeFactory<R, F: FnOnce(&ISyndicationNodeFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationNode, ISyndicationNodeFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SyndicationNode { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Web.Syndication.SyndicationNode;{753cef78-51f8-45c0-a9f5-f1719dec3fb2})"); } unsafe impl ::windows::core::Interface for SyndicationNode { type Vtable = ISyndicationNode_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x753cef78_51f8_45c0_a9f5_f1719dec3fb2); } impl ::windows::core::RuntimeName for SyndicationNode { const NAME: &'static str = "Windows.Web.Syndication.SyndicationNode"; } impl ::core::convert::From<SyndicationNode> for ::windows::core::IUnknown { fn from(value: SyndicationNode) -> Self { value.0 .0 } } impl ::core::convert::From<&SyndicationNode> for ::windows::core::IUnknown { fn from(value: &SyndicationNode) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SyndicationNode { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SyndicationNode { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SyndicationNode> for ::windows::core::IInspectable { fn from(value: SyndicationNode) -> Self { value.0 } } impl ::core::convert::From<&SyndicationNode> for ::windows::core::IInspectable { fn from(value: &SyndicationNode) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SyndicationNode { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SyndicationNode { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<SyndicationNode> for ISyndicationNode { fn from(value: SyndicationNode) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&SyndicationNode> for ISyndicationNode { fn from(value: &SyndicationNode) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for SyndicationNode { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for &SyndicationNode { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for SyndicationNode {} unsafe impl ::core::marker::Sync for SyndicationNode {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SyndicationPerson(pub ::windows::core::IInspectable); impl SyndicationPerson { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationPerson, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn Email(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetEmail<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Name(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Uri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeName(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeNamespace(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeNamespace<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeValue(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeValue<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Language(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn BaseUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetBaseUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn AttributeExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationAttribute>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationAttribute>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ElementExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<ISyndicationNode>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<ISyndicationNode>>(result__) } } #[cfg(feature = "Data_Xml_Dom")] pub fn GetXmlDocument(&self, format: SyndicationFormat) -> ::windows::core::Result<super::super::Data::Xml::Dom::XmlDocument> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), format, &mut result__).from_abi::<super::super::Data::Xml::Dom::XmlDocument>(result__) } } pub fn CreateSyndicationPerson<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(name: Param0) -> ::windows::core::Result<SyndicationPerson> { Self::ISyndicationPersonFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), name.into_param().abi(), &mut result__).from_abi::<SyndicationPerson>(result__) }) } #[cfg(feature = "Foundation")] pub fn CreateSyndicationPersonEx<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(name: Param0, email: Param1, uri: Param2) -> ::windows::core::Result<SyndicationPerson> { Self::ISyndicationPersonFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), name.into_param().abi(), email.into_param().abi(), uri.into_param().abi(), &mut result__).from_abi::<SyndicationPerson>(result__) }) } pub fn ISyndicationPersonFactory<R, F: FnOnce(&ISyndicationPersonFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationPerson, ISyndicationPersonFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SyndicationPerson { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Web.Syndication.SyndicationPerson;{fa1ee5da-a7c6-4517-a096-0143faf29327})"); } unsafe impl ::windows::core::Interface for SyndicationPerson { type Vtable = ISyndicationPerson_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfa1ee5da_a7c6_4517_a096_0143faf29327); } impl ::windows::core::RuntimeName for SyndicationPerson { const NAME: &'static str = "Windows.Web.Syndication.SyndicationPerson"; } impl ::core::convert::From<SyndicationPerson> for ::windows::core::IUnknown { fn from(value: SyndicationPerson) -> Self { value.0 .0 } } impl ::core::convert::From<&SyndicationPerson> for ::windows::core::IUnknown { fn from(value: &SyndicationPerson) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SyndicationPerson { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SyndicationPerson { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SyndicationPerson> for ::windows::core::IInspectable { fn from(value: SyndicationPerson) -> Self { value.0 } } impl ::core::convert::From<&SyndicationPerson> for ::windows::core::IInspectable { fn from(value: &SyndicationPerson) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SyndicationPerson { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SyndicationPerson { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<SyndicationPerson> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: SyndicationPerson) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SyndicationPerson> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: &SyndicationPerson) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for SyndicationPerson { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for &SyndicationPerson { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::core::convert::TryInto::<ISyndicationNode>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for SyndicationPerson {} unsafe impl ::core::marker::Sync for SyndicationPerson {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SyndicationText(pub ::windows::core::IInspectable); impl SyndicationText { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationText, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn Text(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetText<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Type(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetType<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Data_Xml_Dom")] pub fn Xml(&self) -> ::windows::core::Result<super::super::Data::Xml::Dom::XmlDocument> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Data::Xml::Dom::XmlDocument>(result__) } } #[cfg(feature = "Data_Xml_Dom")] pub fn SetXml<'a, Param0: ::windows::core::IntoParam<'a, super::super::Data::Xml::Dom::XmlDocument>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeName(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeNamespace(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeNamespace<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn NodeValue(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetNodeValue<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Language(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn BaseUri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn SetBaseUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn AttributeExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<SyndicationAttribute>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<SyndicationAttribute>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ElementExtensions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<ISyndicationNode>> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVector<ISyndicationNode>>(result__) } } #[cfg(feature = "Data_Xml_Dom")] pub fn GetXmlDocument(&self, format: SyndicationFormat) -> ::windows::core::Result<super::super::Data::Xml::Dom::XmlDocument> { let this = &::windows::core::Interface::cast::<ISyndicationNode>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), format, &mut result__).from_abi::<super::super::Data::Xml::Dom::XmlDocument>(result__) } } pub fn CreateSyndicationText<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(text: Param0) -> ::windows::core::Result<SyndicationText> { Self::ISyndicationTextFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), text.into_param().abi(), &mut result__).from_abi::<SyndicationText>(result__) }) } pub fn CreateSyndicationTextEx<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(text: Param0, r#type: SyndicationTextType) -> ::windows::core::Result<SyndicationText> { Self::ISyndicationTextFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), text.into_param().abi(), r#type, &mut result__).from_abi::<SyndicationText>(result__) }) } pub fn ISyndicationTextFactory<R, F: FnOnce(&ISyndicationTextFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SyndicationText, ISyndicationTextFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for SyndicationText { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Web.Syndication.SyndicationText;{b9cc5e80-313a-4091-a2a6-243e0ee923f9})"); } unsafe impl ::windows::core::Interface for SyndicationText { type Vtable = ISyndicationText_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb9cc5e80_313a_4091_a2a6_243e0ee923f9); } impl ::windows::core::RuntimeName for SyndicationText { const NAME: &'static str = "Windows.Web.Syndication.SyndicationText"; } impl ::core::convert::From<SyndicationText> for ::windows::core::IUnknown { fn from(value: SyndicationText) -> Self { value.0 .0 } } impl ::core::convert::From<&SyndicationText> for ::windows::core::IUnknown { fn from(value: &SyndicationText) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SyndicationText { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SyndicationText { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SyndicationText> for ::windows::core::IInspectable { fn from(value: SyndicationText) -> Self { value.0 } } impl ::core::convert::From<&SyndicationText> for ::windows::core::IInspectable { fn from(value: &SyndicationText) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SyndicationText { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SyndicationText { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<SyndicationText> for ISyndicationText { fn from(value: SyndicationText) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&SyndicationText> for ISyndicationText { fn from(value: &SyndicationText) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationText> for SyndicationText { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationText> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationText> for &SyndicationText { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationText> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } impl ::core::convert::TryFrom<SyndicationText> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: SyndicationText) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SyndicationText> for ISyndicationNode { type Error = ::windows::core::Error; fn try_from(value: &SyndicationText) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for SyndicationText { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, ISyndicationNode> for &SyndicationText { fn into_param(self) -> ::windows::core::Param<'a, ISyndicationNode> { ::core::convert::TryInto::<ISyndicationNode>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for SyndicationText {} unsafe impl ::core::marker::Sync for SyndicationText {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct SyndicationTextType(pub i32); impl SyndicationTextType { pub const Text: SyndicationTextType = SyndicationTextType(0i32); pub const Html: SyndicationTextType = SyndicationTextType(1i32); pub const Xhtml: SyndicationTextType = SyndicationTextType(2i32); } impl ::core::convert::From<i32> for SyndicationTextType { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SyndicationTextType { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for SyndicationTextType { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Web.Syndication.SyndicationTextType;i4)"); } impl ::windows::core::DefaultType for SyndicationTextType { type DefaultType = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct TransferProgress { pub BytesSent: u32, pub TotalBytesToSend: u32, pub BytesRetrieved: u32, pub TotalBytesToRetrieve: u32, } impl TransferProgress {} impl ::core::default::Default for TransferProgress { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for TransferProgress { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TransferProgress").field("BytesSent", &self.BytesSent).field("TotalBytesToSend", &self.TotalBytesToSend).field("BytesRetrieved", &self.BytesRetrieved).field("TotalBytesToRetrieve", &self.TotalBytesToRetrieve).finish() } } impl ::core::cmp::PartialEq for TransferProgress { fn eq(&self, other: &Self) -> bool { self.BytesSent == other.BytesSent && self.TotalBytesToSend == other.TotalBytesToSend && self.BytesRetrieved == other.BytesRetrieved && self.TotalBytesToRetrieve == other.TotalBytesToRetrieve } } impl ::core::cmp::Eq for TransferProgress {} unsafe impl ::windows::core::Abi for TransferProgress { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TransferProgress { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"struct(Windows.Web.Syndication.TransferProgress;u4;u4;u4;u4)"); } impl ::windows::core::DefaultType for TransferProgress { type DefaultType = Self; }
// This file is part of linux-epoll. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file. // Copyright © 2019 The developers of linux-epoll. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-epoll/master/COPYRIGHT. /// Used to pass a constructor across threads. pub trait ArenasRegistration { /// Register all arenas with the `arenas_registrar` when called. /// /// Will be called once per thread. fn register_all_arenas<AR: ArenasRegistrar>(&self, arenas_registrar: &mut AR); }
use std::io::{Read, Result as IOResult}; use crate::lump_data::{LumpData, LumpType}; use crate::PrimitiveRead; pub struct Face { pub plane_index: u16, pub size: u8, pub is_on_node: bool, // u8 in struct pub first_edge: i32, pub edges_count: i16, pub texture_info: i16, pub displacement_info: i16, pub surface_fog_volume_id: i16, pub styles: [u8; 4], pub light_offset: i32, pub area: f32, pub lightmap_texture_mins_in_luxels: [i32; 2], pub lightmap_texture_size_in_luxels: [i32; 2], pub original_face: i32, pub primitives_count: u16, pub first_primitive_id: u16, pub smoothing_group: u32 } impl LumpData for Face { fn lump_type() -> LumpType { LumpType::Faces } fn lump_type_hdr() -> Option<LumpType> { Some(LumpType::FacesHDR) } fn element_size(_version: i32) -> usize { 56 } fn read(reader: &mut dyn Read, _version: i32) -> IOResult<Self> { let plane_number = reader.read_u16()?; let size = reader.read_u8()?; let is_on_node = reader.read_u8()? != 0; let first_edge = reader.read_i32()?; let edges_count = reader.read_i16()?; let texture_info = reader.read_i16()?; let displacement_info = reader.read_i16()?; let surface_fog_volume_id = reader.read_i16()?; let styles = [ reader.read_u8()?, reader.read_u8()?, reader.read_u8()?, reader.read_u8()? ]; let light_offset = reader.read_i32()?; let area = reader.read_f32()?; let lightmap_texture_mins_in_luxels = [reader.read_i32()?, reader.read_i32()?]; let lightmap_texture_size_in_luxels = [reader.read_i32()?, reader.read_i32()?]; let original_face = reader.read_i32()?; let primitives_count = reader.read_u16()?; let first_primitive_id = reader.read_u16()?; let smoothing_group = reader.read_u32()?; Ok(Self { plane_index: plane_number, size, is_on_node, first_edge, edges_count, texture_info, displacement_info, surface_fog_volume_id, styles, light_offset, area, lightmap_texture_mins_in_luxels, lightmap_texture_size_in_luxels, original_face, primitives_count, first_primitive_id, smoothing_group }) } }
/* * Copyright © 2019-today Peter M. Stahl pemistahl@gmail.com * * 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 expressed or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //! ## 1. What does this tool do? //! //! *grex* is a library as well as a command-line utility that is meant to simplify the often //! complicated and tedious task of creating regular expressions. It does so by automatically //! generating a single regular expression from user-provided test cases. The resulting //! expression is guaranteed to match the test cases which it was generated from. //! //! This project has started as a Rust port of the JavaScript tool //! [*regexgen*](https://github.com/devongovett/regexgen) written by //! [Devon Govett](https://github.com/devongovett). Although a lot of further useful features //! could be added to it, its development was apparently ceased several years ago. The plan //! is now to add these new features to *grex* as Rust really shines when it comes to //! command-line tools. *grex* offers all features that *regexgen* provides, and more. //! //! The philosophy of this project is to generate the most specific regular expression //! possible by default which exactly matches the given input only and nothing else. //! With the use of command-line flags (in the CLI tool) or preprocessing methods //! (in the library), more generalized expressions can be created. //! //! The produced expressions are [Perl-compatible regular expressions](https://www.pcre.org) //! which are also compatible with the regular expression parser in Rust's //! [*regex crate*](https://crates.io/crates/regex). //! Other regular expression parsers or respective libraries from other programming languages //! have not been tested so far, but they ought to be mostly compatible as well. //! //! ## 2. Do I still need to learn to write regexes then? //! //! **Definitely, yes!** Using the standard settings, *grex* produces a regular expression that //! is guaranteed to match only the test cases given as input and nothing else. This has been //! verified by [property tests](https://github.com/pemistahl/grex/blob/main/tests/property_tests.rs). //! However, if the conversion to shorthand character classes such as `\w` is enabled, the //! resulting regex matches a much wider scope of test cases. Knowledge about the consequences of //! this conversion is essential for finding a correct regular expression for your business domain. //! //! *grex* uses an algorithm that tries to find the shortest possible regex for the given test cases. //! Very often though, the resulting expression is still longer or more complex than it needs to be. //! In such cases, a more compact or elegant regex can be created only by hand. //! Also, every regular expression engine has different built-in optimizations. //! *grex* does not know anything about those and therefore cannot optimize its regexes //! for a specific engine. //! //! **So, please learn how to write regular expressions!** The currently best use case for *grex* //! is to find an initial correct regex which should be inspected by hand if further optimizations //! are possible. //! //! ## 3. Current features //! //! - literals //! - character classes //! - detection of common prefixes and suffixes //! - detection of repeated substrings and conversion to `{min,max}` quantifier notation //! - alternation using `|` operator //! - optionality using `?` quantifier //! - escaping of non-ascii characters, with optional conversion of astral code points to surrogate pairs //! - case-sensitive or case-insensitive matching //! - capturing or non-capturing groups //! - optional anchors `^` and `$` //! - fully compliant to [Unicode Standard 15.0](https://unicode.org/versions/Unicode15.0.0) //! - fully compatible with [*regex* crate 1.9.0+](https://crates.io/crates/regex) //! - correctly handles graphemes consisting of multiple Unicode symbols //! - reads input strings from the command-line or from a file //! - produces more readable expressions indented on multiple using optional verbose mode //! //! ## 4. How to use? //! //! The code snippets below show how to use the public api. //! //! For [more detailed examples](https://github.com/pemistahl/grex/tree/main#53-examples), please //! take a look at the project's readme file on GitHub. //! //! ### 4.1 Default settings //! //! Test cases are passed either from a collection via [`RegExpBuilder::from()`] //! or from a file via [`RegExpBuilder::from_file()`]. //! //! ``` //! use grex::RegExpBuilder; //! //! let regexp = RegExpBuilder::from(&["a", "aa", "aaa"]).build(); //! assert_eq!(regexp, "^a(?:aa?)?$"); //! ``` //! //! ### 4.2 Convert to character classes //! //! ``` //! use grex::RegExpBuilder; //! //! let regexp = RegExpBuilder::from(&["a", "aa", "123"]) //! .with_conversion_of_digits() //! .with_conversion_of_words() //! .build(); //! assert_eq!(regexp, "^(?:\\d\\d\\d|\\w(?:\\w)?)$"); //! ``` //! //! ### 4.3 Convert repeated substrings //! //! ``` //! use grex::RegExpBuilder; //! //! let regexp = RegExpBuilder::from(&["aa", "bcbc", "defdefdef"]) //! .with_conversion_of_repetitions() //! .build(); //! assert_eq!(regexp, "^(?:a{2}|(?:bc){2}|(?:def){3})$"); //! ``` //! //! By default, *grex* converts each substring this way which is at least a single character long //! and which is subsequently repeated at least once. You can customize these two parameters //! if you like. //! //! In the following example, the test case `aa` is not converted to `a{2}` because the repeated //! substring `a` has a length of 1, but the minimum substring length has been set to 2. //! //! ``` //! use grex::RegExpBuilder; //! //! let regexp = RegExpBuilder::from(&["aa", "bcbc", "defdefdef"]) //! .with_conversion_of_repetitions() //! .with_minimum_substring_length(2) //! .build(); //! assert_eq!(regexp, "^(?:aa|(?:bc){2}|(?:def){3})$"); //! ``` //! //! Setting a minimum number of 2 repetitions in the next example, only the test case `defdefdef` //! will be converted because it is the only one that is repeated twice. //! //! ``` //! use grex::RegExpBuilder; //! //! let regexp = RegExpBuilder::from(&["aa", "bcbc", "defdefdef"]) //! .with_conversion_of_repetitions() //! .with_minimum_repetitions(2) //! .build(); //! assert_eq!(regexp, "^(?:bcbc|aa|(?:def){3})$"); //! ``` //! //! ### 4.4 Escape non-ascii characters //! //! ``` //! use grex::RegExpBuilder; //! //! let regexp = RegExpBuilder::from(&["You smell like 💩."]) //! .with_escaping_of_non_ascii_chars(false) //! .build(); //! assert_eq!(regexp, "^You smell like \\u{1f4a9}\\.$"); //! ``` //! //! Old versions of JavaScript do not support unicode escape sequences for //! the astral code planes (range `U+010000` to `U+10FFFF`). In order to //! support these symbols in JavaScript regular expressions, the conversion //! to surrogate pairs is necessary. More information on that matter can be //! found [here](https://mathiasbynens.be/notes/javascript-unicode). //! //! ``` //! use grex::RegExpBuilder; //! //! let regexp = RegExpBuilder::from(&["You smell like 💩."]) //! .with_escaping_of_non_ascii_chars(true) //! .build(); //! assert_eq!(regexp, "^You smell like \\u{d83d}\\u{dca9}\\.$"); //! ``` //! //! ### 4.5 Case-insensitive matching //! //! The regular expressions that *grex* generates are case-sensitive by default. //! Case-insensitive matching can be enabled like so: //! //! ``` //! use grex::RegExpBuilder; //! //! let regexp = RegExpBuilder::from(&["big", "BIGGER"]) //! .with_case_insensitive_matching() //! .build(); //! assert_eq!(regexp, "(?i)^big(?:ger)?$"); //! ``` //! //! ### 4.6 Capturing Groups //! //! Non-capturing groups are used by default. //! Extending the previous example, you can switch to capturing groups instead. //! //! ``` //! use grex::RegExpBuilder; //! //! let regexp = RegExpBuilder::from(&["big", "BIGGER"]) //! .with_case_insensitive_matching() //! .with_capturing_groups() //! .build(); //! assert_eq!(regexp, "(?i)^big(ger)?$"); //! ``` //! //! ### 4.7 Verbose mode //! //! If you find the generated regular expression hard to read, you can enable verbose mode. //! The expression is then put on multiple lines and indented to make it more pleasant to the eyes. //! //! ``` //! use grex::RegExpBuilder; //! use indoc::indoc; //! //! let regexp = RegExpBuilder::from(&["a", "b", "bcd"]) //! .with_verbose_mode() //! .build(); //! //! assert_eq!(regexp, indoc!( //! r#" //! (?x) //! ^ //! (?: //! b //! (?: //! cd //! )? //! | //! a //! ) //! $"# //! )); //! ``` //! //! ### 4.8 Disable anchors //! //! By default, the anchors `^` and `$` are put around every generated regular expression in order //! to ensure that it matches only the test cases given as input. Often enough, however, it is //! desired to use the generated pattern as part of a larger one. For this purpose, the anchors //! can be disabled, either separately or both of them. //! //! ``` //! use grex::RegExpBuilder; //! //! let regexp = RegExpBuilder::from(&["a", "aa", "aaa"]) //! .without_anchors() //! .build(); //! assert_eq!(regexp, "a(?:aa?)?"); //! ``` //! //! ### 5. How does it work? //! //! 1. A [deterministic finite automaton](https://en.wikipedia.org/wiki/Deterministic_finite_automaton) (DFA) //! is created from the input strings. //! //! 2. The number of states and transitions between states in the DFA is reduced by applying //! [Hopcroft's DFA minimization algorithm](https://en.wikipedia.org/wiki/DFA_minimization#Hopcroft.27s_algorithm). //! //! 3. The minimized DFA is expressed as a system of linear equations which are solved with //! [Brzozowski's algebraic method](http://cs.stackexchange.com/questions/2016/how-to-convert-finite-automata-to-regular-expressions#2392), //! resulting in the final regular expression. #[macro_use] mod macros; mod builder; mod cluster; mod component; mod config; mod dfa; mod expression; mod format; mod grapheme; mod quantifier; mod regexp; mod substring; mod unicode_tables; #[cfg(feature = "python")] mod python; #[cfg(target_family = "wasm")] mod wasm; pub use builder::RegExpBuilder; #[cfg(target_family = "wasm")] pub use wasm::RegExpBuilder as WasmRegExpBuilder;
use crate::{ core::{ cppstd::CppString, error::Error, refptr::{OpaquePtr, Ref, RefMut}, }, deep::{ deep_image::{DeepImageRef, DeepImageRefMut}, deep_image_channel::{ DeepChannelF16Ref, DeepChannelF16RefMut, DeepChannelF32Ref, DeepChannelF32RefMut, DeepChannelU32Ref, DeepChannelU32RefMut, }, }, }; use imath_traits::Bound2; use openexr_sys as sys; type Result<T, E = Error> = std::result::Result<T, E>; #[repr(transparent)] pub struct DeepImageLevel(pub(crate) *mut sys::Imf_DeepImageLevel_t); unsafe impl OpaquePtr for DeepImageLevel { type SysPointee = sys::Imf_DeepImageLevel_t; type Pointee = DeepImageLevel; } pub type DeepImageLevelRef<'a, P = DeepImageLevel> = Ref<'a, P>; pub type DeepImageLevelRefMut<'a, P = DeepImageLevel> = RefMut<'a, P>; impl DeepImageLevel { /// Get the level number of this level in the `x` direction /// pub fn x_level_number(&self) -> i32 { let mut v = 0; unsafe { sys::Imf_DeepImageLevel_xLevelNumber(self.0, &mut v); } v } /// Get the level number of this level in the `y` direction /// pub fn y_level_number(&self) -> i32 { let mut v = 0; unsafe { sys::Imf_DeepImageLevel_yLevelNumber(self.0, &mut v); } v } /// Get the data window for this levels /// pub fn data_window<B: Bound2<i32>>(&self) -> &B { let mut ptr = std::ptr::null(); unsafe { sys::Imf_DeepImageLevel_dataWindow(self.0, &mut ptr); &*(ptr as *const B) } } /// Get the [`DeepImage`](crate::deep::deep_image::DeepImage) to which this level belongs /// pub fn deep_image(&self) -> DeepImageRef { let mut ptr = std::ptr::null(); unsafe { sys::Imf_DeepImageLevel_deepImage_const(self.0, &mut ptr); DeepImageRef::new(ptr) } } /// Get a mutable reference to the [`DeepImage`](crate::deep::deep_image::DeepImage) to which this level belongs /// pub fn deep_image_mut(&mut self) -> DeepImageRefMut { let mut ptr = std::ptr::null_mut(); unsafe { sys::Imf_DeepImageLevel_deepImage(self.0, &mut ptr); DeepImageRefMut::new(ptr) } } /// Find a [`DeepChannelF16`](crate::deep::deep_image_channel::DeepChannelF16) with the given name /// pub fn find_channel_f16(&self, name: &str) -> Option<DeepChannelF16Ref> { let mut ptr = std::ptr::null(); unsafe { let s = CppString::new(name); sys::Imf_DeepImageLevel_findTypedChannel_half_const( self.0, &mut ptr, s.0, ); if ptr.is_null() { None } else { Some(DeepChannelF16Ref::new(ptr)) } } } /// Find a [`DeepChannelF16`](crate::deep::deep_image_channel::DeepChannelF16) with the given name and get a mutable reference /// to it /// pub fn find_channel_f16_mut( &self, name: &str, ) -> Option<DeepChannelF16RefMut> { let mut ptr = std::ptr::null_mut(); unsafe { let s = CppString::new(name); sys::Imf_DeepImageLevel_findTypedChannel_half( self.0, &mut ptr, s.0, ); if ptr.is_null() { None } else { Some(DeepChannelF16RefMut::new(ptr)) } } } /// Find a [`DeepChannelF32`](crate::deep::deep_image_channel::DeepChannelF32) with the given name /// pub fn find_channel_f32(&self, name: &str) -> Option<DeepChannelF32Ref> { let mut ptr = std::ptr::null(); unsafe { let s = CppString::new(name); sys::Imf_DeepImageLevel_findTypedChannel_float_const( self.0, &mut ptr, s.0, ); if ptr.is_null() { None } else { Some(DeepChannelF32Ref::new(ptr)) } } } /// Find a [`DeepChannelF32`](crate::deep::deep_image_channel::DeepChannelF32) with the given name and get a mutable reference /// to it /// pub fn find_channel_f32_mut( &self, name: &str, ) -> Option<DeepChannelF32RefMut> { let mut ptr = std::ptr::null_mut(); unsafe { let s = CppString::new(name); sys::Imf_DeepImageLevel_findTypedChannel_float( self.0, &mut ptr, s.0, ); if ptr.is_null() { None } else { Some(DeepChannelF32RefMut::new(ptr)) } } } /// Find a [`DeepChannelU32`](crate::deep::deep_image_channel::DeepChannelU32) with the given name /// pub fn find_channel_u32(&self, name: &str) -> Option<DeepChannelU32Ref> { let mut ptr = std::ptr::null(); unsafe { let s = CppString::new(name); sys::Imf_DeepImageLevel_findTypedChannel_uint_const( self.0, &mut ptr, s.0, ); if ptr.is_null() { None } else { Some(DeepChannelU32Ref::new(ptr)) } } } /// Find a [`DeepChannelU32`](crate::deep::deep_image_channel::DeepChannelU32) with the given name and get a mutable reference /// to it /// pub fn find_channel_u32_mut( &self, name: &str, ) -> Option<DeepChannelU32RefMut> { let mut ptr = std::ptr::null_mut(); unsafe { let s = CppString::new(name); sys::Imf_DeepImageLevel_findTypedChannel_uint( self.0, &mut ptr, s.0, ); if ptr.is_null() { None } else { Some(DeepChannelU32RefMut::new(ptr)) } } } }
use rocket_contrib::json::Json; use crate::model::*; type Id = TableId; type Table = Machine; #[post("/machine", data = "<obj>")] pub fn insert(conn: crate::db::Database, obj: Json<Table>) -> Json<ObjResult<Table>> { Json(obj.insert(&conn).into()) } #[get("/machine/<id>")] pub fn get(conn: crate::db::Database, id: Id) -> Json<ObjResult<Table>> { Json(Table::get(&conn, id).into()) } #[get("/machine")] pub fn get_all(conn: crate::db::Database) -> Json<ObjResult<Vec<Table>>> { Json(Table::get_all(&conn).into()) } #[put("/machine/<id>", data = "<obj>")] pub fn update(conn: crate::db::Database, id: Id, mut obj: Json<Table>) -> Json<BoolResult> { obj.id = Some(id); Json(obj.update(&conn).into()) } #[delete("/machine/<id>")] pub fn delete(conn: crate::db::Database, id: Id) -> Json<BoolResult> { Json(Table::delete(&conn, id).into()) }
use bellman::groth16::*; use pairing::*; use pairing::bls12_381::{Fr, FrRepr, Bls12}; use bellman::*; use rand::thread_rng; use jubjub::*; use base::*; use convert::*; use std::fs::File; struct B2Ccircuit<'a> { generators: &'a [(Vec<Fr>, Vec<Fr>)], j: &'a JubJub, //r_cm rcm: Assignment<Fr>, //value va: Assignment<Fr>, //addr addr: (Assignment<Fr>, Assignment<Fr>), //random number, random: Assignment<Fr>, //addr_sk addr_sk: Vec<Assignment<bool>>, //result res: &'a mut Vec<FrRepr>, } impl<'a> B2Ccircuit<'a> { fn blank( generators: &'a [(Vec<Fr>, Vec<Fr>)], j: &'a JubJub, res: &'a mut Vec<FrRepr>, ) -> B2Ccircuit<'a> { B2Ccircuit { generators, j, rcm: Assignment::unknown(), va: Assignment::unknown(), addr: (Assignment::unknown(), Assignment::unknown()), random: Assignment::unknown(), addr_sk: (0..ADSK).map(|_| Assignment::unknown()).collect(), res, } } fn new( generators: &'a [(Vec<Fr>, Vec<Fr>)], j: &'a JubJub, rcm: Fr, va: Fr, addr: (Fr, Fr), random: Fr, addr_sk: Vec<bool>, res: &'a mut Vec<FrRepr>, ) -> B2Ccircuit<'a> { assert_eq!(res.len(), 0); B2Ccircuit { generators, j, rcm: Assignment::known(rcm), va: Assignment::known(va), addr: (Assignment::known(addr.0), Assignment::known(addr.1)), random: Assignment::known(random), addr_sk: addr_sk.iter().map(|&b| Assignment::known(b)).collect(), res, } } } struct B2CcircuitInput { //value va: Num<Bls12>, //coin coin: Num<Bls12>, //rP rp: (Num<Bls12>, Num<Bls12>), //enc enc: Num<Bls12>, //addr addr: (Num<Bls12>, Num<Bls12>) } impl<'a> Input<Bls12> for B2CcircuitInput { fn synthesize<CS: PublicConstraintSystem<Bls12>>(self, cs: &mut CS) -> Result<(), Error> { let coin_input = cs.alloc_input(|| Ok(*self.coin.getvalue().get()?))?; let va_input = cs.alloc_input(|| Ok(*self.va.getvalue().get()?))?; let rpx_input = cs.alloc_input(|| Ok(*self.rp.0.getvalue().get()?))?; let rpy_input = cs.alloc_input(|| Ok(*self.rp.1.getvalue().get()?))?; let enc_input = cs.alloc_input(|| Ok(*self.enc.getvalue().get()?))?; let addrx_input = cs.alloc_input(|| Ok(*self.addr.0.getvalue().get()?))?; let addry_input = cs.alloc_input(|| Ok(*self.addr.1.getvalue().get()?))?; cs.enforce( LinearCombination::zero() + self.coin.getvar(), LinearCombination::zero() + CS::one(), LinearCombination::zero() + coin_input, ); cs.enforce( LinearCombination::zero() + self.va.getvar(), LinearCombination::zero() + CS::one(), LinearCombination::zero() + va_input, ); cs.enforce( LinearCombination::zero() + self.rp.0.getvar(), LinearCombination::zero() + CS::one(), LinearCombination::zero() + rpx_input, ); cs.enforce( LinearCombination::zero() + self.rp.1.getvar(), LinearCombination::zero() + CS::one(), LinearCombination::zero() + rpy_input, ); cs.enforce( LinearCombination::zero() + self.enc.getvar(), LinearCombination::zero() + CS::one(), LinearCombination::zero() + enc_input, ); cs.enforce( LinearCombination::zero() + self.addr.0.getvar(), LinearCombination::zero() + CS::one(), LinearCombination::zero() + addrx_input, ); cs.enforce( LinearCombination::zero() + self.addr.1.getvar(), LinearCombination::zero() + CS::one(), LinearCombination::zero() + addry_input, ); Ok(()) } } impl<'a> Circuit<Bls12> for B2Ccircuit<'a> { type InputMap = B2CcircuitInput; fn synthesize<CS: ConstraintSystem<Bls12>>(self, cs: &mut CS) -> Result<Self::InputMap, Error> { let rcm_num = Num::new(cs, self.rcm)?; let mut rcm = rcm_num.unpack_sized(cs, RCMBIT)?; let random_num = Num::new(cs, self.random)?; let random = random_num.unpack_sized(cs, 256)?; let addr_x_num = Num::new(cs, self.addr.0)?; let addr_x_bit = addr_x_num.unpack_sized(cs, PHOUT)?; let addr_y_num = Num::new(cs, self.addr.1)?; let va = Num::new(cs, self.va)?; let bit_va = va.unpack_sized(cs, VBIT)?; assert_eq!(bit_va.len(), VBIT); //prepare table let p1 = Point::enc_point_table(256, 1, cs)?; //coin = PH(addr|value|rcm) let vin = { for b in bit_va.iter() { rcm.push(*b); } for b in addr_x_bit.iter() { rcm.push(*b); } rcm }; assert_eq!(vin.len(), PHIN); let coin = pedersen_hash(cs, &vin, self.generators, self.j)?; if let Ok(x) = coin.getvalue().get() { self.res.push(x.into_repr()); } //Enc let message = { let b128 = Num::new( cs, Assignment::known(Fr::from_repr(FrRepr::from_serial([0, 0, 1, 0])).unwrap()), )?; va.mul(cs, &b128)?.add(cs, &rcm_num) }?; let qtable = Point::point_mul_table((&addr_x_num, &addr_y_num), 256, cs)?; let rp = Point::multiply(&p1, &random, cs)?; let rq = Point::multiply(&qtable, &random, cs)?; if let (Ok(x), Ok(y)) = (rp.0.getvalue().get(), rp.1.getvalue().get()) { self.res.push(x.into_repr()); self.res.push(y.into_repr()); } let key = rq.0; let enc = key.add(cs, &message)?; if let Ok(x) = enc.getvalue().get() { self.res.push(x.into_repr()); } let mut addr_sk = Vec::with_capacity(ADSK); for b in self.addr_sk.iter() { addr_sk.push(Bit::alloc(cs, *b)?); } let p1 = Point::enc_point_table(ADSK, 1, cs)?; let addr = Point::multiply(&p1, &addr_sk, cs)?; Ok(B2CcircuitInput { va, coin, rp, enc ,addr }) } } pub fn b2c_info( rcm: [u64; 2], va: [u64; 2], addr: String, addr_sk: String, enc_random: [u64; 4], ) -> Result< (String,String,String), Error> { let addr = str2point(addr); let addr_sk = str2sk(addr_sk); let rng = &mut thread_rng(); let j = JubJub::new(); let mut res: Vec<FrRepr> = vec![]; let proof = create_random_proof::<Bls12, _, _, _>( B2Ccircuit::new( &ph_generator(), &j, Fr::from_repr(FrRepr([rcm[0], rcm[1], 0, 0])).unwrap(), Fr::from_repr(FrRepr([va[0], va[1], 0, 0])).unwrap(), ( Fr::from_repr(FrRepr(addr.0)).unwrap(), Fr::from_repr(FrRepr(addr.1)).unwrap(), ), Fr::from_serial(enc_random), addr_sk, &mut res, ), b2c_param()?, rng, )?.serial(); let coin = res[0].serial(); let enc = (res[1].serial(), res[2].serial(),res[3].serial()); Ok((proof2str(proof), u6442str(coin), enc2str(enc))) } pub fn b2c_verify( va: [u64; 2], coin: String, enc: String, address:String, proof: String, ) -> Result<bool, Error> { let coin = str2u644(coin); let enc = str2enc(enc); let address = str2point(address); let proof = str2proof(proof); verify_proof(&b2c_vk()?, &Proof::from_serial(proof), |cs| { let coin = Fr::from_repr(FrRepr::from_serial(coin)).unwrap(); let va = Fr::from_repr(FrRepr([va[0], va[1], 0, 0])).unwrap(); let rpx = Fr::from_repr(FrRepr::from_serial(enc.0)).unwrap(); let rpy = Fr::from_repr(FrRepr::from_serial(enc.1)).unwrap(); let enc = Fr::from_repr(FrRepr::from_serial(enc.2)).unwrap(); let addrx = Fr::from_repr(FrRepr::from_serial(address.0)).unwrap(); let addry = Fr::from_repr(FrRepr::from_serial(address.1)).unwrap(); Ok(B2CcircuitInput { coin: Num::new(cs, Assignment::known(coin))?, va: Num::new(cs, Assignment::known(va))?, rp: ( Num::new(cs, Assignment::known(rpx))?, Num::new(cs, Assignment::known(rpy))?, ), enc: Num::new(cs, Assignment::known(enc))?, addr:( Num::new(cs, Assignment::known(addrx))?, Num::new(cs, Assignment::known(addry))? ) }) }) } pub(crate) fn gen_b2c_param() { let b2c_param_path = b2c_param_path(); let b2c_param_path = b2c_param_path.to_str().unwrap(); let rng = &mut thread_rng(); let params = generate_random_parameters::<Bls12, _, _>( B2Ccircuit::blank(&ph_generator(), &JubJub::new(), &mut vec![]), rng, ).unwrap(); params .write(&mut File::create(b2c_param_path).unwrap()) .unwrap(); } fn b2c_param() -> Result<ProverStream, Error> { let b2c_param_path = b2c_param_path(); let b2c_param_path = b2c_param_path.to_str().unwrap(); let params = ProverStream::new(b2c_param_path).unwrap(); Ok(params) } fn b2c_vk() -> Result<(PreparedVerifyingKey<Bls12>), Error> { let b2c_param_path = b2c_param_path(); let b2c_param_path = b2c_param_path.to_str().unwrap(); let mut params = ProverStream::new(b2c_param_path)?; let vk2 = params.get_vk(8)?; let vk = prepare_verifying_key(&vk2); Ok(vk) }
use crate::{dir_utils::default_subdir, ConfigBootstrap, LOG_TARGET}; use config::Config; use log::{debug, info}; use multiaddr::{Multiaddr, Protocol}; use std::{fs, path::Path}; //------------------------------------- Main API functions --------------------------------------// pub fn load_configuration(bootstrap: &ConfigBootstrap) -> Result<Config, String> { debug!( target: LOG_TARGET, "Loading configuration file from {}", bootstrap.config.to_str().unwrap_or("[??]") ); let mut cfg = default_config(bootstrap); // Load the configuration file let filename = bootstrap .config .to_str() .ok_or_else(|| "Invalid config file path".to_string())?; let config_file = config::File::with_name(filename); match cfg.merge(config_file) { Ok(_) => { info!(target: LOG_TARGET, "Configuration file loaded."); Ok(cfg) }, Err(e) => Err(format!( "There was an error loading the configuration file. {}", e.to_string() )), } } /// Installs a new configuration file template, copied from `rincewind-simple.toml` to the given path. pub fn install_default_config_file(path: &Path) -> Result<(), std::io::Error> { let source = include_str!("../../config/presets/rincewind-simple.toml"); fs::write(path, source) } //------------------------------------- Configuration file defaults --------------------------------------// /// Generate the global Tari configuration instance. /// /// The `Config` object that is returned holds _all_ the default values possible in the `~/.tari.config.toml` file. /// These will typically be overridden by userland settings in envars, the config file, or the command line. pub fn default_config(bootstrap: &ConfigBootstrap) -> Config { let mut cfg = Config::new(); let local_ip_addr = get_local_ip().unwrap_or_else(|| "/ip4/1.2.3.4".parse().unwrap()); // Common settings cfg.set_default("common.message_cache_size", 10).unwrap(); cfg.set_default("common.message_cache_ttl", 1440).unwrap(); cfg.set_default("common.peer_whitelist", Vec::<String>::new()).unwrap(); cfg.set_default("common.liveness_max_sessions", 0).unwrap(); cfg.set_default( "common.peer_database ", default_subdir("peers", Some(&bootstrap.base_path)), ) .unwrap(); cfg.set_default("common.blacklist_ban_period ", 1440).unwrap(); // Wallet settings cfg.set_default("wallet.grpc_enabled", false).unwrap(); cfg.set_default("wallet.grpc_address", "tcp://127.0.0.1:18040").unwrap(); cfg.set_default( "wallet.wallet_file", default_subdir("wallet/wallet.dat", Some(&bootstrap.base_path)), ) .unwrap(); //---------------------------------- Mainnet Defaults --------------------------------------------// cfg.set_default("base_node.network", "mainnet").unwrap(); // Mainnet base node defaults cfg.set_default("base_node.mainnet.db_type", "lmdb").unwrap(); cfg.set_default("base_node.mainnet.peer_seeds", Vec::<String>::new()) .unwrap(); cfg.set_default("base_node.mainnet.block_sync_strategy", "ViaBestChainMetadata") .unwrap(); cfg.set_default("base_node.mainnet.blocking_threads", 4).unwrap(); cfg.set_default("base_node.mainnet.core_threads", 6).unwrap(); cfg.set_default( "base_node.mainnet.data_dir", default_subdir("mainnet/", Some(&bootstrap.base_path)), ) .unwrap(); cfg.set_default( "base_node.mainnet.identity_file", default_subdir("mainnet/node_id.json", Some(&bootstrap.base_path)), ) .unwrap(); cfg.set_default( "base_node.mainnet.tor_identity_file", default_subdir("mainnet/tor.json", Some(&bootstrap.base_path)), ) .unwrap(); cfg.set_default( "base_node.mainnet.wallet_identity_file", default_subdir("mainnet/wallet-identity.json", Some(&bootstrap.base_path)), ) .unwrap(); cfg.set_default( "base_node.mainnet.wallet_tor_identity_file", default_subdir("mainnet/wallet-tor.json", Some(&bootstrap.base_path)), ) .unwrap(); cfg.set_default( "base_node.mainnet.public_address", format!("{}/tcp/18041", local_ip_addr), ) .unwrap(); cfg.set_default("base_node.mainnet.grpc_enabled", false).unwrap(); cfg.set_default("base_node.mainnet.grpc_address", "tcp://127.0.0.1:18041") .unwrap(); cfg.set_default("base_node.mainnet.enable_mining", false).unwrap(); cfg.set_default("base_node.mainnet.num_mining_threads", 1).unwrap(); //---------------------------------- Rincewind Defaults --------------------------------------------// cfg.set_default("base_node.rincewind.db_type", "lmdb").unwrap(); cfg.set_default("base_node.rincewind.peer_seeds", Vec::<String>::new()) .unwrap(); cfg.set_default("base_node.rincewind.block_sync_strategy", "ViaBestChainMetadata") .unwrap(); cfg.set_default("base_node.rincewind.blocking_threads", 4).unwrap(); cfg.set_default("base_node.rincewind.core_threads", 4).unwrap(); cfg.set_default( "base_node.rincewind.data_dir", default_subdir("rincewind/", Some(&bootstrap.base_path)), ) .unwrap(); cfg.set_default( "base_node.rincewind.tor_identity_file", default_subdir("rincewind/tor.json", Some(&bootstrap.base_path)), ) .unwrap(); cfg.set_default( "base_node.rincewind.wallet_identity_file", default_subdir("rincewind/wallet-identity.json", Some(&bootstrap.base_path)), ) .unwrap(); cfg.set_default( "base_node.rincewind.wallet_tor_identity_file", default_subdir("rincewind/wallet-tor.json", Some(&bootstrap.base_path)), ) .unwrap(); cfg.set_default( "base_node.rincewind.identity_file", default_subdir("rincewind/node_id.json", Some(&bootstrap.base_path)), ) .unwrap(); cfg.set_default( "base_node.rincewind.public_address", format!("{}/tcp/18141", local_ip_addr), ) .unwrap(); cfg.set_default("base_node.rincewind.grpc_enabled", false).unwrap(); cfg.set_default("base_node.rincewind.grpc_address", "tcp://127.0.0.1:18141") .unwrap(); cfg.set_default("base_node.rincewind.enable_mining", false).unwrap(); cfg.set_default("base_node.rincewind.num_mining_threads", 1).unwrap(); set_transport_defaults(&mut cfg); cfg } fn set_transport_defaults(cfg: &mut Config) { // Mainnet // Default transport for mainnet is tcp cfg.set_default("base_node.mainnet.transport", "tcp").unwrap(); cfg.set_default("base_node.mainnet.tcp_listener_address", "/ip4/0.0.0.0/tcp/18089") .unwrap(); cfg.set_default("base_node.mainnet.tor_control_address", "/ip4/127.0.0.1/tcp/9051") .unwrap(); cfg.set_default("base_node.mainnet.tor_control_auth", "none").unwrap(); cfg.set_default("base_node.mainnet.tor_forward_address", "/ip4/127.0.0.1/tcp/18141") .unwrap(); cfg.set_default("base_node.mainnet.tor_onion_port", "18141").unwrap(); cfg.set_default("base_node.mainnet.socks5_proxy_address", "/ip4/0.0.0.0/tcp/9050") .unwrap(); cfg.set_default("base_node.mainnet.socks5_listener_address", "/ip4/0.0.0.0/tcp/18099") .unwrap(); cfg.set_default("base_node.mainnet.socks5_auth", "none").unwrap(); // rincewind // Default transport for rincewind is tcp cfg.set_default("base_node.rincewind.transport", "tcp").unwrap(); cfg.set_default("base_node.rincewind.tcp_listener_address", "/ip4/0.0.0.0/tcp/18189") .unwrap(); cfg.set_default("base_node.rincewind.tor_control_address", "/ip4/127.0.0.1/tcp/9051") .unwrap(); cfg.set_default("base_node.rincewind.tor_control_auth", "none").unwrap(); cfg.set_default("base_node.rincewind.tor_forward_address", "/ip4/127.0.0.1/tcp/18041") .unwrap(); cfg.set_default("base_node.rincewind.tor_onion_port", "18141").unwrap(); cfg.set_default("base_node.rincewind.socks5_proxy_address", "/ip4/0.0.0.0/tcp/9150") .unwrap(); cfg.set_default("base_node.rincewind.socks5_listener_address", "/ip4/0.0.0.0/tcp/18199") .unwrap(); cfg.set_default("base_node.rincewind.socks5_auth", "none").unwrap(); } fn get_local_ip() -> Option<Multiaddr> { use std::net::IpAddr; get_if_addrs::get_if_addrs().ok().and_then(|if_addrs| { if_addrs .into_iter() .find(|if_addr| !if_addr.is_loopback()) .map(|if_addr| { let mut addr = Multiaddr::empty(); match if_addr.ip() { IpAddr::V4(ip) => { addr.push(Protocol::Ip4(ip)); }, IpAddr::V6(ip) => { addr.push(Protocol::Ip6(ip)); }, } addr }) }) }
use clap::{Arg, ArgMatches, SubCommand, App}; pub fn get<'a>() -> ArgMatches<'a> { App::new("som") .version("0.1") .author("Maciej Śniegocki <m.w.sniegocki@gmail.com") .subcommand(SubCommand::with_name("train-img") .arg(Arg::with_name("config") .long("config") .short("c") .takes_value(true) .default_value("Config.json") .help("training configuration file")) .arg(Arg::with_name("net_defn") .long("net-defn") .short("n") .takes_value(true) .default_value("Som.json") .help("network definition file")) .arg(Arg::with_name("input") .required(true) .index(1) .help("input image file to train the map on")) .arg(Arg::with_name("lab") .long("lab") .short("l") .help("if given, the input image is converted to Lab space first")) .arg(Arg::with_name("output") .long("output") .short("o") .takes_value(true) .default_value("Model.bc") .help("output file for the model")) .arg(Arg::with_name("image") .long("image") .short("i") .takes_value(true) .default_value("map.png") .help("path to image file with map visualization")) .about("train a self-organizing map on an image")) .get_matches() }
#![cfg_attr(not(feature = "std"), no_std)] #![allow(clippy::too_many_arguments)] #![allow(clippy::unnecessary_mut_passed)] use sp_std::vec::Vec; use frame_support::Parameter; //use serde::{Deserialize, Serialize}; //use pallet_massbit::WorkerStatus; // Here we declare the runtime API. It is implemented it the `impl` block in // runtime amalgamator file (the `runtime/src/lib.rs`) sp_api::decl_runtime_apis! { pub trait MassbitApi<AccountId,WorkerIndex,JobProposalIndex> where AccountId: Parameter, WorkerIndex: Parameter, JobProposalIndex: Parameter, { fn get_workers() -> Vec<(WorkerIndex,Vec<u8>,AccountId, bool, JobProposalIndex)>; fn get_job_reports() -> Vec<(u32,Vec<u8>,Vec<u8>)>; fn get_job_proposals() -> Vec<(JobProposalIndex, AccountId, Vec<u8>, u64, Vec<u8>, Vec<u8>)>; } } // #[derive(Clone, Copy, PartialEq, Eq, Deserialize, Serialize)] // pub enum WorkerStatus { // NormalStatus, // BlackList // }
use std::io::{self, BufRead, Read}; #[derive(PartialEq, Debug, Copy, Clone)] struct Rule { letter: char, first: usize, second: usize, } fn parse_line(line: String) -> (Rule, String) { let tokens: Vec<String> = line.split("-").map(|val| val.to_string()).collect(); let min = tokens[0].parse::<usize>().unwrap(); let rest: Vec<String> = tokens[1].split(" ").map(|val| val.to_string()).collect(); let max = rest[0].parse::<usize>().unwrap(); let letter: Vec<&str> = rest[1].split(":").collect(); let letter = letter[0].chars().nth(0).unwrap(); let password = rest[2].to_string(); ( Rule { letter, first: min, second: max, }, password, ) } fn check_simple_rule(rule: Rule, passwd: String) -> bool { let count = passwd.matches(&rule.letter.to_string()).count(); count >= rule.first && count <= rule.second } fn check_complicated_rule(rule: Rule, passwd: String) -> bool { let chars = passwd.as_bytes(); (chars[rule.first - 1] as char == rule.letter) ^ (chars[rule.second - 1] as char == rule.letter) } pub fn solve_puzzle<T: Read>(reader: T) { let reader = io::BufReader::new(reader); let mut complicated_count = 0; let mut simple_count = 0; for line in reader.lines() { let (rule, passwd) = parse_line(line.unwrap()); if check_complicated_rule(rule, passwd.clone()) { complicated_count += 1; } if check_simple_rule(rule, passwd) { simple_count += 1; } } println!("number of correct passwd simple={}", simple_count); println!("number of correct passwd complicated={}", complicated_count); } #[cfg(test)] mod tests { use super::*; #[test] fn test_parse_line() { let line = "4-8 t: pctpfqtrtttmvptvfmws".to_string(); let expected_passwd = "pctpfqtrtttmvptvfmws".to_string(); let expected_rule = Rule { letter: 't', first: 4, second: 8, }; let (actual_rule, actual_passwd) = parse_line(line); assert_eq!(expected_rule, actual_rule); assert_eq!(expected_passwd, actual_passwd); } }
/* * 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. */ #[macro_export] // https://github.com/rust-lang/rust/issues/57966#issuecomment-461077932 /// Intended to simplify simple polling functions that just return internal events from a /// internal queue. macro_rules! event_polling { ($func_name:ident, $event_field_name:ident, $poll_type:ty) => { fn $func_name( &mut self, _: &mut std::task::Context, _: &mut impl libp2p::swarm::PollParameters, ) -> std::task::Poll<$poll_type> { use std::task::Poll; if let Some(event) = self.$event_field_name.pop_front() { return Poll::Ready(event); } Poll::Pending } }; } #[macro_export] // https://github.com/rust-lang/rust/issues/57966#issuecomment-461077932 /// Generates a type of events produced by Swarm by its name macro_rules! generate_swarm_event_type { ($swarm_type_name:ty) => { ::libp2p::swarm::NetworkBehaviourAction< <<<$swarm_type_name as ::libp2p::swarm::NetworkBehaviour>::ProtocolsHandler as ::libp2p::swarm::IntoProtocolsHandler>::Handler as ::libp2p::swarm::protocols_handler::ProtocolsHandler>::InEvent, // InEvent <$swarm_type_name as ::libp2p::swarm::NetworkBehaviour>::OutEvent // OutEvent > } }
use crate::heap::*; pub unsafe extern "C" fn rt_lookup_property( heap: *mut Heap, obj: *mut u8, key: *mut u8, insert: bool, ) -> isize { let map = HObject::map_s(obj); let space = (*(map as *mut HMap)).space(); let mask = HObject::mask(obj); let is_array = HValue::get_tag(obj) == HeapTag::Array; let key_ptr; let mut numkey = 0; let mut hash = 0; if is_array { numkey = HNumber::integral_value(rt_to_number(heap, key)); key_ptr = HNumber::to_ptr(numkey); hash = crate::compute_hash(numkey as u64); if numkey < 0 { return HeapTag::Nil as u8 as isize; } if insert && HArray::length(obj, false) <= numkey as isize { HArray::set_length(obj, numkey as isize + 1); } } else { assert!(HValue::get_tag(obj) == HeapTag::Object); key_ptr = key; } if is_array && HArray::is_dense(obj) { let index = numkey * std::mem::size_of::<usize>() as i64; if index as u32 > mask { if insert { rt_grow_object(heap, obj, numkey as _); return rt_lookup_property(heap, obj, key_ptr, insert); } else { return HeapTag::Nil as u8 as isize; } } return HMap::SPACE_OFFSET as isize + (index as isize & mask as isize); } else { let start = hash & mask; let mut index = start; let mut key_slot; let mut needs_grow = true; loop { key_slot = *(space.offset(index as _) as *mut *mut u8); if key_slot == HNil::new() && (is_array && key_slot == key_ptr) || rt_strict_cmp(heap, key_slot, key) == 0 { needs_grow = false; break; } index += std::mem::size_of::<usize>() as u32; index = index & mask; if index == start { break; } } if insert { if needs_grow { rt_grow_object(heap, obj, 0); return rt_lookup_property(heap, obj, key_ptr, insert); } } if key_slot == HNil::new() { let proto_slot = HObject::proto_slot_s(obj); *(proto_slot as *mut usize) = IC_DISABLED_VALUE; } return HMap::SPACE_OFFSET + index as isize + (mask as isize + std::mem::size_of::<isize>() as isize); } } pub unsafe extern "C" fn rt_grow_object(heap: *mut Heap, obj: *mut u8, min_size: usize) -> isize { let map_addr = HObject::map_slot_s(obj); let map = (*map_addr) as *mut HMap; let mut size = (*map).size() << 1; let mut original_size = size; if min_size > size as usize { size = min_size.pow(2) as u32; } let new_map = HMap::new_empty(&mut *heap, size as _); *map_addr = new_map; let mask = (size as usize) .wrapping_sub(1) .wrapping_mul(std::mem::size_of::<usize>()); *HObject::mask_slot(obj) = mask as u32; if HValue::get_tag(obj) == HeapTag::Array && HArray::is_dense(obj) { original_size = original_size << 1; for i in 0..original_size { let value = *(*map).get_slot_address(i as _); if value == HNil::new() { continue; } *HObject::lookup_property(heap, obj, HNumber::to_ptr(i as _), true) = value; } } else { for i in 0..original_size { let key = *(*map).get_slot_address(i); if key == HNil::new() { continue; } let value = *(*map).get_slot_address(i + original_size); *HObject::lookup_property(heap, obj, key, true) = value; } } return 0; } pub unsafe extern "C" fn rt_to_number(heap: *mut Heap, value: *mut u8) -> *mut u8 { let tag = HValue::get_tag(value); match tag { HeapTag::String => { let string = HString::value(heap, value); let length = HString::static_length(value); let string = std::slice::from_raw_parts(string, length as _); let string = String::from_utf8(string.to_vec()).unwrap(); return HNumber::newf( &mut *heap, Tenure::New, string.parse::<f64>().unwrap_or(std::f64::NAN), ); } HeapTag::Boolean => { let val = HBoolean::value(value); return HNumber::newf(&mut *heap, Tenure::New, val as i32 as f64); } HeapTag::Number => return value, _ => return HNumber::newf(&mut *heap, Tenure::New, 0.0), } } pub unsafe extern "C" fn rt_strict_cmp(heap: *mut Heap, lhs: *mut u8, rhs: *mut u8) -> i32 { // Fast case - pointers are equal if lhs == rhs { return 0; } let tag = HValue::get_tag(lhs); let rtag = HValue::get_tag(rhs); // We can only compare objects with equal type if rtag != tag { return -1; } match tag { HeapTag::String => return rt_strcmp(heap, lhs, rhs), HeapTag::Boolean => { if HBoolean::value(lhs) == HBoolean::value(rhs) { return 0; } else { return -1; } } HeapTag::Number => { if HNumber::double_value(lhs) == HNumber::double_value(rhs) { return 0; } else { return -1; } } _ => return -1, } } pub unsafe extern "C" fn rt_strcmp(heap: *mut Heap, lhs: *mut u8, rhs: *mut u8) -> i32 { let lhs_len = HString::static_length(lhs); let rhs_len = HString::static_length(rhs); if lhs_len < rhs_len { return -1; } else if lhs_len > rhs_len { return 1; } else { return libc::strncmp( HString::value(heap, lhs) as *const _, HString::value(heap, rhs) as *const _, lhs_len as _, ); }; }
use clap::{crate_authors, crate_description, crate_version, App, AppSettings, Arg, SubCommand}; pub fn build_cli() -> App<'static, 'static> { App::new("miner") .version(crate_version!()) .author(crate_authors!()) .about(crate_description!()) .setting(AppSettings::SubcommandRequiredElseHelp) .setting(AppSettings::ColoredHelp) .arg( Arg::with_name("root") .short("r") .long("root") .takes_value(true) .default_value(".") .help("Directory to use as root of project") ) .arg( Arg::with_name("config") .short("c") .long("config") .takes_value(true) .help("Path to a config file other than config.toml in the root of project") ) .subcommands(vec![ SubCommand::with_name("init") .about("Create a new project") .args(&[ Arg::with_name("name") .default_value(".") .help("Name of the project. Will create a new directory with that name in the current directory"), Arg::with_name("force") .short("f") .takes_value(false) .help("Force creation of project even if directory is non-empty") ]), SubCommand::with_name("serve") .about("Serve the miner serve") .args(&[ Arg::with_name("address") .short("a") .long("address") .default_value("0.0.0.0") .help("Interface to bind on"), Arg::with_name("port") .short("p") .long("port") .default_value("8888") .help("Which port to use"), ]), SubCommand::with_name("generate") .about("Generate a random account") .args(&[ Arg::with_name("words") .short("w") .long("words") .default_value("12") .help("The number of words in the phrase to generate. One of 12 (default), 15, 18, 21 and 24"), ]), SubCommand::with_name("job") .about("Scheduling tasks for miner") .args(&[ Arg::with_name("name") .short("n") .long("name") .default_value("all") .help("scheduling tasks for miner") ]), ]) }
use time::{format_description::FormatItem, macros::format_description, PrimitiveDateTime}; use crate::{InputValueError, InputValueResult, Scalar, ScalarType, Value}; const PRIMITIVE_DATE_TIME_FORMAT: &[FormatItem<'_>] = format_description!("[year]-[month]-[day]T[hour]:[minute]:[second].[subsecond]"); /// A local datetime without timezone offset. /// /// The input/output is a string in ISO 8601 format without timezone, including /// subseconds. E.g. "2022-01-12T07:30:19.12345". #[Scalar(internal, name = "LocalDateTime")] impl ScalarType for PrimitiveDateTime { fn parse(value: Value) -> InputValueResult<Self> { match &value { Value::String(s) => Ok(Self::parse(s, &PRIMITIVE_DATE_TIME_FORMAT)?), _ => Err(InputValueError::expected_type(value)), } } fn to_value(&self) -> Value { Value::String( self.format(&PRIMITIVE_DATE_TIME_FORMAT) .unwrap_or_else(|e| panic!("Failed to format `PrimitiveDateTime`: {}", e)), ) } } #[cfg(test)] mod tests { use time::{macros::datetime, PrimitiveDateTime}; use crate::{ScalarType, Value}; #[test] fn test_primitive_date_time_to_value() { let cases = [ ( datetime!(2022-01-12 07:30:19.12345), "2022-01-12T07:30:19.12345", ), (datetime!(2022-01-12 07:30:19), "2022-01-12T07:30:19.0"), ]; for (value, expected) in cases { let value = value.to_value(); if let Value::String(s) = value { assert_eq!(s, expected); } else { panic!( "Unexpected Value type when formatting PrimitiveDateTime: {:?}", value ); } } } #[test] fn test_primitive_date_time_parse() { let cases = [ ( "2022-01-12T07:30:19.12345", datetime!(2022-01-12 07:30:19.12345), ), ("2022-01-12T07:30:19.0", datetime!(2022-01-12 07:30:19)), ]; for (value, expected) in cases { let value = Value::String(value.to_string()); let parsed = <PrimitiveDateTime as ScalarType>::parse(value).unwrap(); assert_eq!(parsed, expected); } } }
use super::process::abort_with_message; use libc::{c_int, c_void, memcpy, size_t}; use wasmer_runtime_core::Instance; /// emscripten: _emscripten_memcpy_big pub extern "C" fn _emscripten_memcpy_big( dest: u32, src: u32, len: u32, instance: &mut Instance, ) -> u32 { debug!( "emscripten::_emscripten_memcpy_big {}, {}, {}", dest, src, len ); let dest_addr = instance.memory_offset_addr(0, dest as usize) as *mut c_void; let src_addr = instance.memory_offset_addr(0, src as usize) as *mut c_void; unsafe { memcpy(dest_addr, src_addr, len as size_t); } dest } /// emscripten: getTotalMemory pub extern "C" fn get_total_memory(_instance: &mut Instance) -> u32 { debug!("emscripten::get_total_memory"); // instance.memories[0].current_pages() 16_777_216 } /// emscripten: enlargeMemory pub extern "C" fn enlarge_memory(_instance: &mut Instance) { debug!("emscripten::enlarge_memory"); // instance.memories[0].grow(100); } /// emscripten: abortOnCannotGrowMemory pub extern "C" fn abort_on_cannot_grow_memory() { debug!("emscripten::abort_on_cannot_grow_memory"); abort_with_message("Cannot enlarge memory arrays!"); } /// emscripten: ___map_file pub extern "C" fn ___map_file() -> c_int { debug!("emscripten::___map_file"); // NOTE: TODO: Em returns -1 here as well. May need to implement properly -1 }
#![cfg_attr(feature = "no_std", feature(no_std, core))] #![cfg_attr(feature = "no_std", no_std)] #![allow(non_camel_case_types)] extern crate libc; #[cfg(feature = "no_std")] extern crate core; pub mod scancode; pub mod keycode; pub mod audio; pub mod clipboard; pub mod controller; pub mod cpuinfo; pub mod event; pub mod filesystem; pub mod haptic; pub mod gesture; pub mod joystick; pub mod keyboard; pub mod messagebox; pub mod rect; pub mod pixels; pub mod render; pub mod rwops; pub mod surface; pub mod touch; pub mod video; pub mod mouse; pub mod sdl; pub mod timer; pub mod version; pub mod hint; pub mod log; pub use scancode::*; pub use keycode::*; pub use audio::*; pub use clipboard::*; pub use controller::*; pub use cpuinfo::*; pub use event::*; pub use filesystem::*; pub use haptic::*; pub use gesture::*; pub use joystick::*; pub use keyboard::*; pub use messagebox::*; pub use rect::*; pub use pixels::*; pub use render::*; pub use rwops::*; pub use surface::*; pub use touch::*; pub use video::*; pub use mouse::*; pub use sdl::*; pub use timer::*; pub use version::*; pub use hint::*; pub use log::*;
//! Crate für einfache Matrix berechnungen und so /// Matrixmultiplikation pub fn matrix_mul(a: &Vec<i32>,b: &Vec<i32>,l: usize,m: usize,n: usize) -> Vec<i32>{ // l -> Zeilen von Matrix a // m -> Spalten von Matrix a bzw. Spalten von Matrix b // n -> Spalten von Matrix b let r = l * n; //Anzahl der Elemente der Matrix c //c hat l Zeilen und n Spalten let mut c: Vec<i32> = vec![0;r]; for i in 0..r{ for j in 0..m{ c[i] = c[i] + (a[i / n * m + j] * b[(i % n) + j * n]); } } return c; } ///Matrixaddition pub fn vector_add(a: &Vec<i32>,b: &Vec<i32>,s: usize) -> Vec<i32>{ let mut c: Vec<i32> = Vec::new(); for i in 0..s{ c.push(a[i]+b[i]); } // println!("a: {:?}",a); // println!("b: {:?}",b); // println!("c: {:?}",c); return c; }
use crate::utils::get_current_directory; use serde::Deserialize; use std::{collections::HashMap, fs}; #[derive(Clone, Debug, Deserialize)] pub struct PageTexts { pub title: String, pub description: String, } #[derive(Clone, Debug, Deserialize)] pub struct HeaderTexts { pub nav_home: String, pub nav_projects: String, pub nav_blog: String, } #[derive(Clone, Debug, Deserialize)] pub struct ExtraTexts { pub en: String, pub es: String, pub of: String, pub months: Vec<String>, } #[derive(Clone, Debug, Deserialize)] pub struct HomeTexts { pub profession: String, pub about_me_title: String, pub messages: Vec<String>, pub skills_title: String, } #[derive(Clone, Debug, Deserialize)] pub struct ProjectError { pub title: String, pub description: String, } #[derive(Clone, Debug, Deserialize)] pub struct ProjectsTexts { pub view: String, pub project_error: ProjectError, pub project_titles_content: String, } #[derive(Clone, Debug, Deserialize)] pub struct Language { pub pages: HashMap<String, PageTexts>, pub header: HeaderTexts, pub extra: ExtraTexts, pub home: HomeTexts, pub projects: ProjectsTexts, pub footer: String, } pub fn get_language(lang: &String) -> Result<Language, String> { let file_rute: String = format!("{}assets/languages/{}.json", get_current_directory(), lang); match fs::read_to_string(&file_rute) { Ok(language_json) => match serde_json::from_str(&language_json) { Ok(language) => Ok(language), Err(_) => Err(format!("Cannot parse file: {}", file_rute)), }, Err(_) => Err(format!("Cannot read file: {}", file_rute)), } } pub fn get_langague_or(lang: &String, or: &str) -> Result<Language, String> { match get_language(lang) { Ok(language) => Ok(language), Err(_) => get_language(&or.to_string()), } }
pub mod bitset; pub mod common; pub mod control; pub mod dict; pub mod dyn_; pub mod floating; pub mod fraction; pub mod functional; pub mod list; pub mod maybe; pub mod numeric; pub mod stepper; pub mod tuple;
use failure::Error; use serde_json; use std::collections::HashMap; use std::fs::File; use std::io::Read; use std::io::Write; use std::path::Path; use std::time::SystemTime; use typemap::Key; static CONFIG_NAME: &'static str = "boogie_points.json"; pub struct UsersInfo; impl UsersInfo { pub fn load() -> Result<HashMap<u64, UserInfo>, Error> { let mut s = String::new(); let path = Path::new(CONFIG_NAME); let mut f = if path.exists() { File::open(path)? } else { let mut f = File::create(path)?; if let Err(why) = f.write(b"{}") { error!("Err writing to new file: {}", why); } File::open(path)? }; f.read_to_string(&mut s)?; Ok(serde_json::from_str::<HashMap<u64, UserInfo>>(&s)?) } pub fn save(map: &HashMap<u64, UserInfo>) -> Result<(), Error> { let body = serde_json::to_string(map)?; let mut f = File::create(CONFIG_NAME)?; let _ = f.write(body.as_bytes())?; Ok(()) } } impl Key for UsersInfo { type Value = HashMap<u64, UserInfo>; } #[derive(Deserialize, Serialize, Debug)] pub struct UserInfo { pub points: usize, pub collecting_sinse: SystemTime, // #[serde(skip, default = "SystemTime::now")] pub last_check: SystemTime, } impl Default for UserInfo { fn default() -> Self { UserInfo { points: 100, collecting_sinse: SystemTime::now(), last_check: SystemTime::now(), } } }
#[doc = "Reader of register AFRH"] pub type R = crate::R<u32, super::AFRH>; #[doc = "Writer for register AFRH"] pub type W = crate::W<u32, super::AFRH>; #[doc = "Register AFRH `reset()`'s with value 0"] impl crate::ResetValue for super::AFRH { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum AFR8_A { #[doc = "0: AF0"] AF0 = 0, #[doc = "1: AF1"] AF1 = 1, #[doc = "2: AF2"] AF2 = 2, #[doc = "3: AF3"] AF3 = 3, #[doc = "4: AF4"] AF4 = 4, #[doc = "5: AF5"] AF5 = 5, #[doc = "6: AF6"] AF6 = 6, #[doc = "7: AF7"] AF7 = 7, #[doc = "8: AF8"] AF8 = 8, #[doc = "9: AF9"] AF9 = 9, #[doc = "10: AF10"] AF10 = 10, #[doc = "11: AF11"] AF11 = 11, #[doc = "12: AF12"] AF12 = 12, #[doc = "13: AF13"] AF13 = 13, #[doc = "14: AF14"] AF14 = 14, #[doc = "15: AF15"] AF15 = 15, } impl From<AFR8_A> for u8 { #[inline(always)] fn from(variant: AFR8_A) -> Self { variant as _ } } #[doc = "Reader of field `AFR8`"] pub type AFR8_R = crate::R<u8, AFR8_A>; impl AFR8_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> AFR8_A { match self.bits { 0 => AFR8_A::AF0, 1 => AFR8_A::AF1, 2 => AFR8_A::AF2, 3 => AFR8_A::AF3, 4 => AFR8_A::AF4, 5 => AFR8_A::AF5, 6 => AFR8_A::AF6, 7 => AFR8_A::AF7, 8 => AFR8_A::AF8, 9 => AFR8_A::AF9, 10 => AFR8_A::AF10, 11 => AFR8_A::AF11, 12 => AFR8_A::AF12, 13 => AFR8_A::AF13, 14 => AFR8_A::AF14, 15 => AFR8_A::AF15, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `AF0`"] #[inline(always)] pub fn is_af0(&self) -> bool { *self == AFR8_A::AF0 } #[doc = "Checks if the value of the field is `AF1`"] #[inline(always)] pub fn is_af1(&self) -> bool { *self == AFR8_A::AF1 } #[doc = "Checks if the value of the field is `AF2`"] #[inline(always)] pub fn is_af2(&self) -> bool { *self == AFR8_A::AF2 } #[doc = "Checks if the value of the field is `AF3`"] #[inline(always)] pub fn is_af3(&self) -> bool { *self == AFR8_A::AF3 } #[doc = "Checks if the value of the field is `AF4`"] #[inline(always)] pub fn is_af4(&self) -> bool { *self == AFR8_A::AF4 } #[doc = "Checks if the value of the field is `AF5`"] #[inline(always)] pub fn is_af5(&self) -> bool { *self == AFR8_A::AF5 } #[doc = "Checks if the value of the field is `AF6`"] #[inline(always)] pub fn is_af6(&self) -> bool { *self == AFR8_A::AF6 } #[doc = "Checks if the value of the field is `AF7`"] #[inline(always)] pub fn is_af7(&self) -> bool { *self == AFR8_A::AF7 } #[doc = "Checks if the value of the field is `AF8`"] #[inline(always)] pub fn is_af8(&self) -> bool { *self == AFR8_A::AF8 } #[doc = "Checks if the value of the field is `AF9`"] #[inline(always)] pub fn is_af9(&self) -> bool { *self == AFR8_A::AF9 } #[doc = "Checks if the value of the field is `AF10`"] #[inline(always)] pub fn is_af10(&self) -> bool { *self == AFR8_A::AF10 } #[doc = "Checks if the value of the field is `AF11`"] #[inline(always)] pub fn is_af11(&self) -> bool { *self == AFR8_A::AF11 } #[doc = "Checks if the value of the field is `AF12`"] #[inline(always)] pub fn is_af12(&self) -> bool { *self == AFR8_A::AF12 } #[doc = "Checks if the value of the field is `AF13`"] #[inline(always)] pub fn is_af13(&self) -> bool { *self == AFR8_A::AF13 } #[doc = "Checks if the value of the field is `AF14`"] #[inline(always)] pub fn is_af14(&self) -> bool { *self == AFR8_A::AF14 } #[doc = "Checks if the value of the field is `AF15`"] #[inline(always)] pub fn is_af15(&self) -> bool { *self == AFR8_A::AF15 } } #[doc = "Write proxy for field `AFR8`"] pub struct AFR8_W<'a> { w: &'a mut W, } impl<'a> AFR8_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AFR8_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "AF0"] #[inline(always)] pub fn af0(self) -> &'a mut W { self.variant(AFR8_A::AF0) } #[doc = "AF1"] #[inline(always)] pub fn af1(self) -> &'a mut W { self.variant(AFR8_A::AF1) } #[doc = "AF2"] #[inline(always)] pub fn af2(self) -> &'a mut W { self.variant(AFR8_A::AF2) } #[doc = "AF3"] #[inline(always)] pub fn af3(self) -> &'a mut W { self.variant(AFR8_A::AF3) } #[doc = "AF4"] #[inline(always)] pub fn af4(self) -> &'a mut W { self.variant(AFR8_A::AF4) } #[doc = "AF5"] #[inline(always)] pub fn af5(self) -> &'a mut W { self.variant(AFR8_A::AF5) } #[doc = "AF6"] #[inline(always)] pub fn af6(self) -> &'a mut W { self.variant(AFR8_A::AF6) } #[doc = "AF7"] #[inline(always)] pub fn af7(self) -> &'a mut W { self.variant(AFR8_A::AF7) } #[doc = "AF8"] #[inline(always)] pub fn af8(self) -> &'a mut W { self.variant(AFR8_A::AF8) } #[doc = "AF9"] #[inline(always)] pub fn af9(self) -> &'a mut W { self.variant(AFR8_A::AF9) } #[doc = "AF10"] #[inline(always)] pub fn af10(self) -> &'a mut W { self.variant(AFR8_A::AF10) } #[doc = "AF11"] #[inline(always)] pub fn af11(self) -> &'a mut W { self.variant(AFR8_A::AF11) } #[doc = "AF12"] #[inline(always)] pub fn af12(self) -> &'a mut W { self.variant(AFR8_A::AF12) } #[doc = "AF13"] #[inline(always)] pub fn af13(self) -> &'a mut W { self.variant(AFR8_A::AF13) } #[doc = "AF14"] #[inline(always)] pub fn af14(self) -> &'a mut W { self.variant(AFR8_A::AF14) } #[doc = "AF15"] #[inline(always)] pub fn af15(self) -> &'a mut W { self.variant(AFR8_A::AF15) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f); self.w } } #[doc = "3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] pub type AFR9_A = AFR8_A; #[doc = "Reader of field `AFR9`"] pub type AFR9_R = crate::R<u8, AFR8_A>; #[doc = "Write proxy for field `AFR9`"] pub struct AFR9_W<'a> { w: &'a mut W, } impl<'a> AFR9_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AFR9_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "AF0"] #[inline(always)] pub fn af0(self) -> &'a mut W { self.variant(AFR8_A::AF0) } #[doc = "AF1"] #[inline(always)] pub fn af1(self) -> &'a mut W { self.variant(AFR8_A::AF1) } #[doc = "AF2"] #[inline(always)] pub fn af2(self) -> &'a mut W { self.variant(AFR8_A::AF2) } #[doc = "AF3"] #[inline(always)] pub fn af3(self) -> &'a mut W { self.variant(AFR8_A::AF3) } #[doc = "AF4"] #[inline(always)] pub fn af4(self) -> &'a mut W { self.variant(AFR8_A::AF4) } #[doc = "AF5"] #[inline(always)] pub fn af5(self) -> &'a mut W { self.variant(AFR8_A::AF5) } #[doc = "AF6"] #[inline(always)] pub fn af6(self) -> &'a mut W { self.variant(AFR8_A::AF6) } #[doc = "AF7"] #[inline(always)] pub fn af7(self) -> &'a mut W { self.variant(AFR8_A::AF7) } #[doc = "AF8"] #[inline(always)] pub fn af8(self) -> &'a mut W { self.variant(AFR8_A::AF8) } #[doc = "AF9"] #[inline(always)] pub fn af9(self) -> &'a mut W { self.variant(AFR8_A::AF9) } #[doc = "AF10"] #[inline(always)] pub fn af10(self) -> &'a mut W { self.variant(AFR8_A::AF10) } #[doc = "AF11"] #[inline(always)] pub fn af11(self) -> &'a mut W { self.variant(AFR8_A::AF11) } #[doc = "AF12"] #[inline(always)] pub fn af12(self) -> &'a mut W { self.variant(AFR8_A::AF12) } #[doc = "AF13"] #[inline(always)] pub fn af13(self) -> &'a mut W { self.variant(AFR8_A::AF13) } #[doc = "AF14"] #[inline(always)] pub fn af14(self) -> &'a mut W { self.variant(AFR8_A::AF14) } #[doc = "AF15"] #[inline(always)] pub fn af15(self) -> &'a mut W { self.variant(AFR8_A::AF15) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x0f << 4)) | (((value as u32) & 0x0f) << 4); self.w } } #[doc = "3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] pub type AFR10_A = AFR8_A; #[doc = "Reader of field `AFR10`"] pub type AFR10_R = crate::R<u8, AFR8_A>; #[doc = "Write proxy for field `AFR10`"] pub struct AFR10_W<'a> { w: &'a mut W, } impl<'a> AFR10_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AFR10_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "AF0"] #[inline(always)] pub fn af0(self) -> &'a mut W { self.variant(AFR8_A::AF0) } #[doc = "AF1"] #[inline(always)] pub fn af1(self) -> &'a mut W { self.variant(AFR8_A::AF1) } #[doc = "AF2"] #[inline(always)] pub fn af2(self) -> &'a mut W { self.variant(AFR8_A::AF2) } #[doc = "AF3"] #[inline(always)] pub fn af3(self) -> &'a mut W { self.variant(AFR8_A::AF3) } #[doc = "AF4"] #[inline(always)] pub fn af4(self) -> &'a mut W { self.variant(AFR8_A::AF4) } #[doc = "AF5"] #[inline(always)] pub fn af5(self) -> &'a mut W { self.variant(AFR8_A::AF5) } #[doc = "AF6"] #[inline(always)] pub fn af6(self) -> &'a mut W { self.variant(AFR8_A::AF6) } #[doc = "AF7"] #[inline(always)] pub fn af7(self) -> &'a mut W { self.variant(AFR8_A::AF7) } #[doc = "AF8"] #[inline(always)] pub fn af8(self) -> &'a mut W { self.variant(AFR8_A::AF8) } #[doc = "AF9"] #[inline(always)] pub fn af9(self) -> &'a mut W { self.variant(AFR8_A::AF9) } #[doc = "AF10"] #[inline(always)] pub fn af10(self) -> &'a mut W { self.variant(AFR8_A::AF10) } #[doc = "AF11"] #[inline(always)] pub fn af11(self) -> &'a mut W { self.variant(AFR8_A::AF11) } #[doc = "AF12"] #[inline(always)] pub fn af12(self) -> &'a mut W { self.variant(AFR8_A::AF12) } #[doc = "AF13"] #[inline(always)] pub fn af13(self) -> &'a mut W { self.variant(AFR8_A::AF13) } #[doc = "AF14"] #[inline(always)] pub fn af14(self) -> &'a mut W { self.variant(AFR8_A::AF14) } #[doc = "AF15"] #[inline(always)] pub fn af15(self) -> &'a mut W { self.variant(AFR8_A::AF15) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x0f << 8)) | (((value as u32) & 0x0f) << 8); self.w } } #[doc = "3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] pub type AFR11_A = AFR8_A; #[doc = "Reader of field `AFR11`"] pub type AFR11_R = crate::R<u8, AFR8_A>; #[doc = "Write proxy for field `AFR11`"] pub struct AFR11_W<'a> { w: &'a mut W, } impl<'a> AFR11_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AFR11_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "AF0"] #[inline(always)] pub fn af0(self) -> &'a mut W { self.variant(AFR8_A::AF0) } #[doc = "AF1"] #[inline(always)] pub fn af1(self) -> &'a mut W { self.variant(AFR8_A::AF1) } #[doc = "AF2"] #[inline(always)] pub fn af2(self) -> &'a mut W { self.variant(AFR8_A::AF2) } #[doc = "AF3"] #[inline(always)] pub fn af3(self) -> &'a mut W { self.variant(AFR8_A::AF3) } #[doc = "AF4"] #[inline(always)] pub fn af4(self) -> &'a mut W { self.variant(AFR8_A::AF4) } #[doc = "AF5"] #[inline(always)] pub fn af5(self) -> &'a mut W { self.variant(AFR8_A::AF5) } #[doc = "AF6"] #[inline(always)] pub fn af6(self) -> &'a mut W { self.variant(AFR8_A::AF6) } #[doc = "AF7"] #[inline(always)] pub fn af7(self) -> &'a mut W { self.variant(AFR8_A::AF7) } #[doc = "AF8"] #[inline(always)] pub fn af8(self) -> &'a mut W { self.variant(AFR8_A::AF8) } #[doc = "AF9"] #[inline(always)] pub fn af9(self) -> &'a mut W { self.variant(AFR8_A::AF9) } #[doc = "AF10"] #[inline(always)] pub fn af10(self) -> &'a mut W { self.variant(AFR8_A::AF10) } #[doc = "AF11"] #[inline(always)] pub fn af11(self) -> &'a mut W { self.variant(AFR8_A::AF11) } #[doc = "AF12"] #[inline(always)] pub fn af12(self) -> &'a mut W { self.variant(AFR8_A::AF12) } #[doc = "AF13"] #[inline(always)] pub fn af13(self) -> &'a mut W { self.variant(AFR8_A::AF13) } #[doc = "AF14"] #[inline(always)] pub fn af14(self) -> &'a mut W { self.variant(AFR8_A::AF14) } #[doc = "AF15"] #[inline(always)] pub fn af15(self) -> &'a mut W { self.variant(AFR8_A::AF15) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x0f << 12)) | (((value as u32) & 0x0f) << 12); self.w } } #[doc = "3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] pub type AFR12_A = AFR8_A; #[doc = "Reader of field `AFR12`"] pub type AFR12_R = crate::R<u8, AFR8_A>; #[doc = "Write proxy for field `AFR12`"] pub struct AFR12_W<'a> { w: &'a mut W, } impl<'a> AFR12_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AFR12_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "AF0"] #[inline(always)] pub fn af0(self) -> &'a mut W { self.variant(AFR8_A::AF0) } #[doc = "AF1"] #[inline(always)] pub fn af1(self) -> &'a mut W { self.variant(AFR8_A::AF1) } #[doc = "AF2"] #[inline(always)] pub fn af2(self) -> &'a mut W { self.variant(AFR8_A::AF2) } #[doc = "AF3"] #[inline(always)] pub fn af3(self) -> &'a mut W { self.variant(AFR8_A::AF3) } #[doc = "AF4"] #[inline(always)] pub fn af4(self) -> &'a mut W { self.variant(AFR8_A::AF4) } #[doc = "AF5"] #[inline(always)] pub fn af5(self) -> &'a mut W { self.variant(AFR8_A::AF5) } #[doc = "AF6"] #[inline(always)] pub fn af6(self) -> &'a mut W { self.variant(AFR8_A::AF6) } #[doc = "AF7"] #[inline(always)] pub fn af7(self) -> &'a mut W { self.variant(AFR8_A::AF7) } #[doc = "AF8"] #[inline(always)] pub fn af8(self) -> &'a mut W { self.variant(AFR8_A::AF8) } #[doc = "AF9"] #[inline(always)] pub fn af9(self) -> &'a mut W { self.variant(AFR8_A::AF9) } #[doc = "AF10"] #[inline(always)] pub fn af10(self) -> &'a mut W { self.variant(AFR8_A::AF10) } #[doc = "AF11"] #[inline(always)] pub fn af11(self) -> &'a mut W { self.variant(AFR8_A::AF11) } #[doc = "AF12"] #[inline(always)] pub fn af12(self) -> &'a mut W { self.variant(AFR8_A::AF12) } #[doc = "AF13"] #[inline(always)] pub fn af13(self) -> &'a mut W { self.variant(AFR8_A::AF13) } #[doc = "AF14"] #[inline(always)] pub fn af14(self) -> &'a mut W { self.variant(AFR8_A::AF14) } #[doc = "AF15"] #[inline(always)] pub fn af15(self) -> &'a mut W { self.variant(AFR8_A::AF15) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x0f << 16)) | (((value as u32) & 0x0f) << 16); self.w } } #[doc = "3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] pub type AFR13_A = AFR8_A; #[doc = "Reader of field `AFR13`"] pub type AFR13_R = crate::R<u8, AFR8_A>; #[doc = "Write proxy for field `AFR13`"] pub struct AFR13_W<'a> { w: &'a mut W, } impl<'a> AFR13_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AFR13_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "AF0"] #[inline(always)] pub fn af0(self) -> &'a mut W { self.variant(AFR8_A::AF0) } #[doc = "AF1"] #[inline(always)] pub fn af1(self) -> &'a mut W { self.variant(AFR8_A::AF1) } #[doc = "AF2"] #[inline(always)] pub fn af2(self) -> &'a mut W { self.variant(AFR8_A::AF2) } #[doc = "AF3"] #[inline(always)] pub fn af3(self) -> &'a mut W { self.variant(AFR8_A::AF3) } #[doc = "AF4"] #[inline(always)] pub fn af4(self) -> &'a mut W { self.variant(AFR8_A::AF4) } #[doc = "AF5"] #[inline(always)] pub fn af5(self) -> &'a mut W { self.variant(AFR8_A::AF5) } #[doc = "AF6"] #[inline(always)] pub fn af6(self) -> &'a mut W { self.variant(AFR8_A::AF6) } #[doc = "AF7"] #[inline(always)] pub fn af7(self) -> &'a mut W { self.variant(AFR8_A::AF7) } #[doc = "AF8"] #[inline(always)] pub fn af8(self) -> &'a mut W { self.variant(AFR8_A::AF8) } #[doc = "AF9"] #[inline(always)] pub fn af9(self) -> &'a mut W { self.variant(AFR8_A::AF9) } #[doc = "AF10"] #[inline(always)] pub fn af10(self) -> &'a mut W { self.variant(AFR8_A::AF10) } #[doc = "AF11"] #[inline(always)] pub fn af11(self) -> &'a mut W { self.variant(AFR8_A::AF11) } #[doc = "AF12"] #[inline(always)] pub fn af12(self) -> &'a mut W { self.variant(AFR8_A::AF12) } #[doc = "AF13"] #[inline(always)] pub fn af13(self) -> &'a mut W { self.variant(AFR8_A::AF13) } #[doc = "AF14"] #[inline(always)] pub fn af14(self) -> &'a mut W { self.variant(AFR8_A::AF14) } #[doc = "AF15"] #[inline(always)] pub fn af15(self) -> &'a mut W { self.variant(AFR8_A::AF15) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x0f << 20)) | (((value as u32) & 0x0f) << 20); self.w } } #[doc = "3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] pub type AFR14_A = AFR8_A; #[doc = "Reader of field `AFR14`"] pub type AFR14_R = crate::R<u8, AFR8_A>; #[doc = "Write proxy for field `AFR14`"] pub struct AFR14_W<'a> { w: &'a mut W, } impl<'a> AFR14_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AFR14_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "AF0"] #[inline(always)] pub fn af0(self) -> &'a mut W { self.variant(AFR8_A::AF0) } #[doc = "AF1"] #[inline(always)] pub fn af1(self) -> &'a mut W { self.variant(AFR8_A::AF1) } #[doc = "AF2"] #[inline(always)] pub fn af2(self) -> &'a mut W { self.variant(AFR8_A::AF2) } #[doc = "AF3"] #[inline(always)] pub fn af3(self) -> &'a mut W { self.variant(AFR8_A::AF3) } #[doc = "AF4"] #[inline(always)] pub fn af4(self) -> &'a mut W { self.variant(AFR8_A::AF4) } #[doc = "AF5"] #[inline(always)] pub fn af5(self) -> &'a mut W { self.variant(AFR8_A::AF5) } #[doc = "AF6"] #[inline(always)] pub fn af6(self) -> &'a mut W { self.variant(AFR8_A::AF6) } #[doc = "AF7"] #[inline(always)] pub fn af7(self) -> &'a mut W { self.variant(AFR8_A::AF7) } #[doc = "AF8"] #[inline(always)] pub fn af8(self) -> &'a mut W { self.variant(AFR8_A::AF8) } #[doc = "AF9"] #[inline(always)] pub fn af9(self) -> &'a mut W { self.variant(AFR8_A::AF9) } #[doc = "AF10"] #[inline(always)] pub fn af10(self) -> &'a mut W { self.variant(AFR8_A::AF10) } #[doc = "AF11"] #[inline(always)] pub fn af11(self) -> &'a mut W { self.variant(AFR8_A::AF11) } #[doc = "AF12"] #[inline(always)] pub fn af12(self) -> &'a mut W { self.variant(AFR8_A::AF12) } #[doc = "AF13"] #[inline(always)] pub fn af13(self) -> &'a mut W { self.variant(AFR8_A::AF13) } #[doc = "AF14"] #[inline(always)] pub fn af14(self) -> &'a mut W { self.variant(AFR8_A::AF14) } #[doc = "AF15"] #[inline(always)] pub fn af15(self) -> &'a mut W { self.variant(AFR8_A::AF15) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x0f << 24)) | (((value as u32) & 0x0f) << 24); self.w } } #[doc = "3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] pub type AFR15_A = AFR8_A; #[doc = "Reader of field `AFR15`"] pub type AFR15_R = crate::R<u8, AFR8_A>; #[doc = "Write proxy for field `AFR15`"] pub struct AFR15_W<'a> { w: &'a mut W, } impl<'a> AFR15_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: AFR15_A) -> &'a mut W { { self.bits(variant.into()) } } #[doc = "AF0"] #[inline(always)] pub fn af0(self) -> &'a mut W { self.variant(AFR8_A::AF0) } #[doc = "AF1"] #[inline(always)] pub fn af1(self) -> &'a mut W { self.variant(AFR8_A::AF1) } #[doc = "AF2"] #[inline(always)] pub fn af2(self) -> &'a mut W { self.variant(AFR8_A::AF2) } #[doc = "AF3"] #[inline(always)] pub fn af3(self) -> &'a mut W { self.variant(AFR8_A::AF3) } #[doc = "AF4"] #[inline(always)] pub fn af4(self) -> &'a mut W { self.variant(AFR8_A::AF4) } #[doc = "AF5"] #[inline(always)] pub fn af5(self) -> &'a mut W { self.variant(AFR8_A::AF5) } #[doc = "AF6"] #[inline(always)] pub fn af6(self) -> &'a mut W { self.variant(AFR8_A::AF6) } #[doc = "AF7"] #[inline(always)] pub fn af7(self) -> &'a mut W { self.variant(AFR8_A::AF7) } #[doc = "AF8"] #[inline(always)] pub fn af8(self) -> &'a mut W { self.variant(AFR8_A::AF8) } #[doc = "AF9"] #[inline(always)] pub fn af9(self) -> &'a mut W { self.variant(AFR8_A::AF9) } #[doc = "AF10"] #[inline(always)] pub fn af10(self) -> &'a mut W { self.variant(AFR8_A::AF10) } #[doc = "AF11"] #[inline(always)] pub fn af11(self) -> &'a mut W { self.variant(AFR8_A::AF11) } #[doc = "AF12"] #[inline(always)] pub fn af12(self) -> &'a mut W { self.variant(AFR8_A::AF12) } #[doc = "AF13"] #[inline(always)] pub fn af13(self) -> &'a mut W { self.variant(AFR8_A::AF13) } #[doc = "AF14"] #[inline(always)] pub fn af14(self) -> &'a mut W { self.variant(AFR8_A::AF14) } #[doc = "AF15"] #[inline(always)] pub fn af15(self) -> &'a mut W { self.variant(AFR8_A::AF15) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x0f << 28)) | (((value as u32) & 0x0f) << 28); self.w } } impl R { #[doc = "Bits 0:3 - 3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] #[inline(always)] pub fn afr8(&self) -> AFR8_R { AFR8_R::new((self.bits & 0x0f) as u8) } #[doc = "Bits 4:7 - 3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] #[inline(always)] pub fn afr9(&self) -> AFR9_R { AFR9_R::new(((self.bits >> 4) & 0x0f) as u8) } #[doc = "Bits 8:11 - 3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] #[inline(always)] pub fn afr10(&self) -> AFR10_R { AFR10_R::new(((self.bits >> 8) & 0x0f) as u8) } #[doc = "Bits 12:15 - 3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] #[inline(always)] pub fn afr11(&self) -> AFR11_R { AFR11_R::new(((self.bits >> 12) & 0x0f) as u8) } #[doc = "Bits 16:19 - 3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] #[inline(always)] pub fn afr12(&self) -> AFR12_R { AFR12_R::new(((self.bits >> 16) & 0x0f) as u8) } #[doc = "Bits 20:23 - 3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] #[inline(always)] pub fn afr13(&self) -> AFR13_R { AFR13_R::new(((self.bits >> 20) & 0x0f) as u8) } #[doc = "Bits 24:27 - 3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] #[inline(always)] pub fn afr14(&self) -> AFR14_R { AFR14_R::new(((self.bits >> 24) & 0x0f) as u8) } #[doc = "Bits 28:31 - 3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] #[inline(always)] pub fn afr15(&self) -> AFR15_R { AFR15_R::new(((self.bits >> 28) & 0x0f) as u8) } } impl W { #[doc = "Bits 0:3 - 3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] #[inline(always)] pub fn afr8(&mut self) -> AFR8_W { AFR8_W { w: self } } #[doc = "Bits 4:7 - 3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] #[inline(always)] pub fn afr9(&mut self) -> AFR9_W { AFR9_W { w: self } } #[doc = "Bits 8:11 - 3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] #[inline(always)] pub fn afr10(&mut self) -> AFR10_W { AFR10_W { w: self } } #[doc = "Bits 12:15 - 3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] #[inline(always)] pub fn afr11(&mut self) -> AFR11_W { AFR11_W { w: self } } #[doc = "Bits 16:19 - 3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] #[inline(always)] pub fn afr12(&mut self) -> AFR12_W { AFR12_W { w: self } } #[doc = "Bits 20:23 - 3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] #[inline(always)] pub fn afr13(&mut self) -> AFR13_W { AFR13_W { w: self } } #[doc = "Bits 24:27 - 3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] #[inline(always)] pub fn afr14(&mut self) -> AFR14_W { AFR14_W { w: self } } #[doc = "Bits 28:31 - 3:0\\]: Alternate function selection for port x pin y (y = 8..15) These bits are written by software to configure alternate function I/Os"] #[inline(always)] pub fn afr15(&mut self) -> AFR15_W { AFR15_W { w: self } } }
// Copyright 2019-2020 PolkaX. Licensed under MIT or Apache-2.0. use crate::hash::HashBits; #[cfg(not(feature = "test-hash"))] #[test] fn test_hash() { use crate::hash::hash; let h1 = hash("abcd"); let h2 = hash("abce"); let first = [184_u8, 123, 183, 214, 70, 86, 205, 79]; let second = [5, 245, 47, 205, 203, 64, 38, 66]; assert_eq!(h1, first); assert_eq!(h2, second); let h3 = hash("hello world"); assert_eq!(h3, [83, 63, 96, 70, 235, 127, 97, 14]); let h4 = hash(b"hello world"); assert_eq!(h4, [83, 63, 96, 70, 235, 127, 97, 14]); let h5 = hash("一二三"); assert_eq!(h5, [37, 41, 47, 183, 147, 168, 177, 225]); } #[test] fn test_hash_bits_overflow() { let buf = [255_u8]; let bit_width = 1; let mut hb = HashBits::new(buf.as_ref(), bit_width); for _i in 0..8 { let bit = hb.next().unwrap(); assert_eq!(bit, 1); } assert_eq!(hb.next(), None) } #[test] fn test_hash_bits_uneven() { let buf = [255_u8, 127, 79, 45, 116, 99, 35, 17]; let bit_width = 4; let mut hb = HashBits::new(buf.as_ref(), bit_width); let v = hb.next(); assert_eq!(v, Some(15)); let v = hb.next(); assert_eq!(v, Some(15)); hb.bit_width = 3; let v = hb.next(); assert_eq!(v, Some(3)); let v = hb.next(); assert_eq!(v, Some(7)); let v = hb.next(); assert_eq!(v, Some(6)); hb.bit_width = 15; let v = hb.next(); assert_eq!(v, Some(20269)); }
use janus::Statuser; use ops_core::{async_trait, CheckResponse, Checker}; const ACTION: &str = "Troubleshoot Janus"; /// Checks a Janus backend is healthy. pub struct JanusChecker<S> where S: Statuser + Send + Sync, { statuser: S, impact: String, } impl<S> JanusChecker<S> where S: Statuser + Send + Sync, { /// Creates a new Janus health checker pub fn new(statuser: S, impact: &str) -> Self { Self { statuser, impact: impact.to_owned(), } } } #[async_trait] impl<S> Checker for JanusChecker<S> where S: Statuser + Send + Sync, { async fn check(&self) -> CheckResponse { match self.statuser.status() { Ok(_) => CheckResponse::healthy("Janus is reachable"), Err(err) => CheckResponse::unhealthy( &format!("Cannot get Janus status: {}", err), ACTION, &self.impact, ), } } }
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AcquireDeveloperLicense<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(hwndparent: Param0) -> ::windows::core::Result<super::super::Foundation::FILETIME> { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn AcquireDeveloperLicense(hwndparent: super::super::Foundation::HWND, pexpiration: *mut super::super::Foundation::FILETIME) -> ::windows::core::HRESULT; } let mut result__: <super::super::Foundation::FILETIME as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); AcquireDeveloperLicense(hwndparent.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::FILETIME>(result__) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CheckDeveloperLicense() -> ::windows::core::Result<super::super::Foundation::FILETIME> { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CheckDeveloperLicense(pexpiration: *mut super::super::Foundation::FILETIME) -> ::windows::core::HRESULT; } let mut result__: <super::super::Foundation::FILETIME as ::windows::core::Abi>::Abi = ::core::mem::zeroed(); CheckDeveloperLicense(&mut result__).from_abi::<super::super::Foundation::FILETIME>(result__) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn RemoveDeveloperLicense<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(hwndparent: Param0) -> ::windows::core::Result<()> { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn RemoveDeveloperLicense(hwndparent: super::super::Foundation::HWND) -> ::windows::core::HRESULT; } RemoveDeveloperLicense(hwndparent.into_param().abi()).ok() } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); }
use std::collections::VecDeque; use std::convert::TryFrom; use std::fmt::Display; use std::fs; use std::path::Path; use std::sync::Arc; use firefly_diagnostics::{CodeMap, SourceSpan}; use firefly_intern::Symbol; use firefly_parser::{FileMapSource, Scanner, Source}; use crate::lexer::{AtomToken, SymbolToken, TokenConvertError}; use crate::lexer::{Lexed, Lexer, LexicalToken, Token}; use super::macros::NoArgsMacroCall; use super::token_stream::TokenStream; use super::{MacroCall, MacroContainer, PreprocessorError, Result}; pub trait TokenReader: Sized { type Source; fn new(codemap: Arc<CodeMap>, tokens: Self::Source) -> Self; fn inject_include<P>(&mut self, path: P, directive: SourceSpan) -> Result<()> where P: AsRef<Path>; fn read<V: ReadFrom>(&mut self) -> Result<V> { V::read_from(self) } fn try_read<V: ReadFrom>(&mut self) -> Result<Option<V>> { V::try_read_from(self) } fn try_read_macro_call(&mut self, macros: &MacroContainer) -> Result<Option<MacroCall>> { if let Some(call) = self.try_read::<NoArgsMacroCall>()? { let span = call.span(); let start = span.start(); let mut call = MacroCall { _question: SymbolToken(start, Token::Question, start), name: call.name, args: None, }; // The logic for macro resolve/execution is as follows, in order: // 1. If there is only a constant macro of the given name and not // a function macro, apply the const without looking ahead. // 2. If there exists a function macro with the given name, and // there is a paren open following the macro identifier, then // try to resolve and execute the macro. If there is not a // function macro of the correct arity defined, error. // 3. If there is a constant macro, apply that. // 4. Error. // If there is a function macro defined with the name... if macros.defined_func(&call.name()) { let paren_ahead = if let Some(lex_tok) = self.try_read_token()? { let res = if let LexicalToken(_, Token::LParen, _) = lex_tok { true } else { false }; self.unread_token(lex_tok); res } else { false }; // If there is a following LParen, read arguments if paren_ahead { call.args = Some(self.read()?); } } Ok(Some(call)) } else { Ok(None) } } fn read_expected<V>(&mut self, expected: &V::Value) -> Result<V> where V: ReadFrom + Expect + Into<LexicalToken>, { V::read_expected(self, expected) } fn try_read_expected<V>(&mut self, expected: &V::Value) -> Result<Option<V>> where V: ReadFrom + Expect + Into<LexicalToken>, { V::try_read_expected(self, expected) } fn try_read_token(&mut self) -> Result<Option<LexicalToken>>; fn read_token(&mut self) -> Result<LexicalToken>; fn unread_token(&mut self, token: LexicalToken); } /// Reads tokens from an in-memory buffer (VecDeque) pub struct TokenBufferReader { codemap: Arc<CodeMap>, tokens: VecDeque<Lexed>, unread: VecDeque<LexicalToken>, } impl TokenReader for TokenBufferReader { type Source = VecDeque<Lexed>; fn new(codemap: Arc<CodeMap>, tokens: Self::Source) -> Self { TokenBufferReader { codemap: codemap.clone(), tokens, unread: VecDeque::new(), } } // Adds tokens from the provided path fn inject_include<P>(&mut self, path: P, directive: SourceSpan) -> Result<()> where P: AsRef<Path>, { let path = path.as_ref(); let content = std::fs::read_to_string(path).map_err(|source| PreprocessorError::IncludeError { source, path: path.to_owned(), span: directive, })?; let id = self.codemap.add(path, content); let file = self.codemap.get(id).unwrap(); let source = FileMapSource::new(file); let scanner = Scanner::new(source); let lexer = Lexer::new(scanner); let mut tokens: VecDeque<Lexed> = lexer.collect(); tokens.append(&mut self.tokens); self.tokens = tokens; Ok(()) } fn try_read_token(&mut self) -> Result<Option<LexicalToken>> { if let Some(token) = self.unread.pop_front() { return Ok(Some(token)); } self.tokens .pop_front() .transpose() .map_err(PreprocessorError::from) } fn read_token(&mut self) -> Result<LexicalToken> { if let Some(token) = self.try_read_token()? { Ok(token) } else { Err(PreprocessorError::UnexpectedEOF) } } fn unread_token(&mut self, token: LexicalToken) { self.unread.push_front(token); } } /// Reads tokens from a TokenStream (backed by a Lexer) pub struct TokenStreamReader<S> { codemap: Arc<CodeMap>, tokens: TokenStream<S>, unread: VecDeque<LexicalToken>, } impl<S> TokenReader for TokenStreamReader<S> where S: Source, { type Source = Lexer<S>; fn new(codemap: Arc<CodeMap>, tokens: Self::Source) -> Self { TokenStreamReader { codemap: codemap.clone(), tokens: TokenStream::new(tokens), unread: VecDeque::new(), } } // Adds tokens from the provided path fn inject_include<P>(&mut self, path: P, directive: SourceSpan) -> Result<()> where P: AsRef<Path>, { let path = path.as_ref(); let content = fs::read_to_string(path).map_err(|source| PreprocessorError::IncludeError { source, path: path.to_owned(), span: directive, })?; let id = self.codemap.add_child(path, content, directive); let file = self.codemap.get(id).unwrap(); let source = Source::new(file); let scanner = Scanner::new(source); let lexer = Lexer::new(scanner); self.tokens.include(lexer); Ok(()) } fn try_read_token(&mut self) -> Result<Option<LexicalToken>> { if let Some(token) = self.unread.pop_front() { return Ok(Some(token)); } self.tokens .next() .transpose() .map_err(PreprocessorError::from) } fn read_token(&mut self) -> Result<LexicalToken> { if let Some(token) = self.try_read_token()? { Ok(token) } else { Err(PreprocessorError::UnexpectedEOF) } } fn unread_token(&mut self, token: LexicalToken) { self.unread.push_front(token); } } pub trait ReadFrom: Sized { fn read_from<R, S>(reader: &mut R) -> Result<Self> where R: TokenReader<Source = S>, { let directive = Self::try_read_from(reader)?; Ok(directive.unwrap()) } fn try_read_from<R, S>(reader: &mut R) -> Result<Option<Self>> where R: TokenReader<Source = S>, { Self::read_from(reader).map(Some).or_else(|e| match e { PreprocessorError::UnexpectedToken { token, .. } => { reader.unread_token(token.clone()); return Ok(None); } PreprocessorError::InvalidTokenType { token, .. } => { reader.unread_token(token.clone()); return Ok(None); } PreprocessorError::UnexpectedEOF => { return Ok(None); } _ => Err(e), }) } fn read_expected<R, S>(reader: &mut R, expected: &Self::Value) -> Result<Self> where R: TokenReader<Source = S>, Self: Expect + Into<LexicalToken>, { Self::read_from(reader) .map_err(|err| match err { PreprocessorError::UnexpectedToken { token, .. } => { PreprocessorError::UnexpectedToken { token, expected: vec![expected.to_string()], } } PreprocessorError::InvalidTokenType { token, .. } => { PreprocessorError::InvalidTokenType { token, expected: expected.to_string(), } } _ => err, }) .and_then(|token| { if token.expect(expected) { Ok(token) } else { Err(PreprocessorError::UnexpectedToken { token: token.into(), expected: vec![expected.to_string()], }) } }) } fn try_read_expected<R, S>(reader: &mut R, expected: &Self::Value) -> Result<Option<Self>> where R: TokenReader<Source = S>, Self: Expect + Into<LexicalToken>, { Self::try_read_from(reader).map(|token| { token.and_then(|token| { if token.expect(expected) { Some(token) } else { reader.unread_token(token.into()); None } }) }) } } /// Default implementation for all TryFrom<LexicalToken> supporting types impl<T> ReadFrom for T where T: TryFrom<LexicalToken, Error = TokenConvertError>, { fn read_from<R, S>(reader: &mut R) -> Result<Self> where R: TokenReader<Source = S>, { let token = reader.read_token()?; Self::try_from(token).map_err(PreprocessorError::from) } } pub trait Expect { type Value: PartialEq + Display + ?Sized; fn expect(&self, expected: &Self::Value) -> bool; } impl Expect for AtomToken { type Value = Symbol; fn expect(&self, expected: &Self::Value) -> bool { self.symbol() == *expected } } impl Expect for SymbolToken { type Value = Token; fn expect(&self, expected: &Self::Value) -> bool { expected.eq(&self.token()) } }
use std::rc::Rc; use crate::ray::Ray; use crate::vec3::{Point3, Vec3}; use crate::material::Material; use crate::aabb::AABB; pub struct HitRecord { pub p: Point3, pub normal: Vec3, pub material: Rc<dyn Material>, pub t: f32, pub u: f32, pub v: f32, pub is_front_face: bool, } pub trait Hittable { fn hit(&self, r: &Ray, t_min: f32, t_max: f32) -> Option<HitRecord>; fn bounding_box(&self, t0: f32, t1: f32) -> Option<AABB>; } impl HitRecord { pub fn new(t: f32, spot: Point3, u: f32, v: f32, is_front_face: bool, outward_normal: Vec3, material: &Rc<dyn Material>) -> Self { HitRecord { t: t, p: spot, u: u, v: v, is_front_face: is_front_face, normal: if is_front_face { outward_normal } else { -outward_normal }, material: Rc::clone(material), } } } pub struct Translate { pub object: Box<dyn Hittable>, pub offset: Vec3, } impl Hittable for Translate { fn bounding_box(&self, time0: f32, time1: f32) -> Option<AABB> { if let Some(output_box) = self.object.bounding_box(time0, time1) { Some(AABB { min: output_box.min + self.offset, max: output_box.max + self.offset, }) } else { None } } fn hit(&self, r: &Ray, t_min: f32, t_max: f32) -> Option<HitRecord> { let moved_r = Ray { origin: r.origin - self.offset, direction: r.direction, time: r.time }; if let Some(mut hit_record) = self.object.hit(&moved_r, t_min, t_max) { hit_record.p += self.offset; let is_front_face = moved_r.direction.dot(hit_record.normal) < 0.; hit_record.is_front_face = is_front_face; hit_record.normal = if is_front_face { hit_record.normal } else { -hit_record.normal }; Some(hit_record) } else { None } } } pub struct RotateY { object: Box<dyn Hittable>, sin_theta: f32, cos_theta: f32, bbox: Option<AABB>, } impl RotateY { pub fn new(p: Box<dyn Hittable>, angle: f32) -> Self { let radians = angle.to_radians(); let sin_theta = radians.sin(); let cos_theta = radians.cos(); let bbox = p.bounding_box(0., 1.); if let Some(b) = bbox { let mut min = Vec3{ x: f32::INFINITY, y: f32::INFINITY, z: f32::INFINITY }; let mut max = Vec3{ x: f32::NEG_INFINITY, y: f32::NEG_INFINITY, z: f32::NEG_INFINITY }; for i in 0..2 { for j in 0..2 { for k in 0..2 { let x = (i as f32) * b.max.x + ((1 - i) as f32) * b.min.x; let y = (j as f32) * b.max.y + ((1 - j) as f32) * b.min.y; let z = (k as f32) * b.max.z + ((1 - k) as f32) * b.min.z; let new_x = cos_theta * x + sin_theta * z; let new_z = -sin_theta * x + cos_theta * z; let tester = Vec3 { x: new_x, y: y, z: new_z }; min.x = min.x.min(tester.x); min.y = min.y.min(tester.y); min.z = min.z.min(tester.z); max.x = max.x.max(tester.x); max.y = max.y.max(tester.y); max.z = max.z.max(tester.z); } } } Self { object: p, sin_theta: sin_theta, cos_theta: cos_theta, bbox: Some(AABB { min: min, max: max }), } } else { Self { object: p, sin_theta: sin_theta, cos_theta: cos_theta, bbox: None } } } } impl Hittable for RotateY { fn bounding_box(&self, _: f32, _: f32) -> Option<AABB> { if let Some(bbox) = &self.bbox { Some(AABB { min: bbox.min, max: bbox.max }) } else { None } } fn hit(&self, r: &Ray, t_min: f32, t_max: f32) -> Option<HitRecord> { let mut origin = r.origin; let mut direction = r.direction; origin.x = self.cos_theta * r.origin[0] - self.sin_theta * r.origin[2]; origin.z = self.sin_theta * r.origin[0] + self.cos_theta * r.origin[2]; direction.x = self.cos_theta * r.direction[0] - self.sin_theta * r.direction[2]; direction.z = self.sin_theta * r.direction[0] + self.cos_theta * r.direction[2]; let rotated_r = Ray { origin: origin, direction: direction, time: r.time }; if let Some(mut record) = self.object.hit(&rotated_r, t_min, t_max) { let mut p = record.p; let mut normal = record.normal; p.x = self.cos_theta * record.p[0] + self.sin_theta * record.p[2]; p.z = - self.sin_theta * record.p[0] + self.cos_theta * record.p[2]; normal.x = self.cos_theta * record.normal[0] + self.sin_theta * record.normal[2]; normal.z = - self.sin_theta * record.normal[0] + self.cos_theta * record.normal[2]; record.p = p; let is_front_face = rotated_r.direction.dot(record.normal) < 0.; record.is_front_face = is_front_face; record.normal = if is_front_face { normal } else { -normal }; Some(record) } else { None } } }
use P41::*; pub fn main() { for (n, p1, p2) in goldbach_list_limited(1, 2000, 50) { println!("{} = {} + {}", n, p1, p2); } }
use std::{ pin::Pin, task::{Context, Poll}, }; use futures_core::{ready, stream::Stream}; use log::error; use pin_project_lite::pin_project; use crate::{ actor::{Actor, ActorContext, ActorState, AsyncContext, SpawnHandle}, fut::ActorFuture, }; /// Stream handling for Actors. /// /// This is helper trait that allows handling [`Stream`]s in a similar way to normal actor messages. /// When stream resolves its next item, `handle()` is called with that item. /// /// When the stream completes, `finished()` is called. By default, it stops Actor execution. /// /// # Examples /// ``` /// use actix::prelude::*; /// use futures_util::stream::once; /// /// #[derive(Message)] /// #[rtype(result = "()")] /// struct Ping; /// /// struct MyActor; /// /// impl StreamHandler<Ping> for MyActor { /// fn handle(&mut self, item: Ping, ctx: &mut Context<MyActor>) { /// println!("PING"); /// System::current().stop() /// } /// /// fn finished(&mut self, ctx: &mut Self::Context) { /// println!("finished"); /// } /// } /// /// impl Actor for MyActor { /// type Context = Context<Self>; /// /// fn started(&mut self, ctx: &mut Context<Self>) { /// Self::add_stream(once(async { Ping }), ctx); /// } /// } /// /// #[actix::main] /// async fn main() { /// MyActor.start(); /// # System::current().stop(); /// } /// ``` #[allow(unused_variables)] pub trait StreamHandler<I> where Self: Actor, { /// Called for every message emitted by the stream. fn handle(&mut self, item: I, ctx: &mut Self::Context); /// Called when stream emits first item. /// /// Default implementation does nothing. fn started(&mut self, ctx: &mut Self::Context) {} /// Called when stream finishes. /// /// Default implementation stops Actor execution. fn finished(&mut self, ctx: &mut Self::Context) { ctx.stop() } /// Register a Stream to the actor context. fn add_stream<S>(stream: S, ctx: &mut Self::Context) -> SpawnHandle where S: Stream + 'static, Self: StreamHandler<S::Item>, Self::Context: AsyncContext<Self>, { if ctx.state() == ActorState::Stopped { error!("Context::add_stream called for stopped actor."); SpawnHandle::default() } else { ctx.spawn(ActorStream::new(stream)) } } } pin_project! { pub(crate) struct ActorStream<S> { #[pin] stream: S, started: bool, } } impl<S> ActorStream<S> { pub fn new(fut: S) -> Self { Self { stream: fut, started: false, } } } impl<A, S> ActorFuture<A> for ActorStream<S> where S: Stream, A: Actor + StreamHandler<S::Item>, A::Context: AsyncContext<A>, { type Output = (); fn poll( self: Pin<&mut Self>, act: &mut A, ctx: &mut A::Context, task: &mut Context<'_>, ) -> Poll<Self::Output> { let mut this = self.project(); if !*this.started { *this.started = true; <A as StreamHandler<S::Item>>::started(act, ctx); } let mut polled = 0; while let Some(msg) = ready!(this.stream.as_mut().poll_next(task)) { A::handle(act, msg, ctx); polled += 1; if ctx.waiting() { return Poll::Pending; } else if polled == 16 { // Yield after 16 consecutive polls on this stream and self wake up. // This is to prevent starvation of other actor futures when this stream yield // too many item in short period of time. task.waker().wake_by_ref(); return Poll::Pending; } } A::finished(act, ctx); Poll::Ready(()) } }
//! Ports of macros in //! <https://github.com/devkitPro/libctru/blob/master/libctru/include/3ds/result.h> use crate::Result; /// Checks whether a result code indicates success. pub fn R_SUCCEEDED(res: Result) -> bool { res >= 0 } /// Checks whether a result code indicates failure. pub fn R_FAILED(res: Result) -> bool { res < 0 } /// Returns the level of a result code. pub fn R_LEVEL(res: Result) -> Result { (res >> 27) & 0x1F } /// Returns the summary of a result code. pub fn R_SUMMARY(res: Result) -> Result { (res >> 21) & 0x3F } /// Returns the module ID of a result code. pub fn R_MODULE(res: Result) -> Result { (res >> 10) & 0xFF } /// Returns the description of a result code. pub fn R_DESCRIPTION(res: Result) -> Result { res & 0x3FF } /// Builds a result code from its constituent components. pub fn MAKERESULT(level: Result, summary: Result, module: Result, description: Result) -> Result { ((level & 0x1F) << 27) | ((summary & 0x3F) << 21) | ((module & 0xFF) << 10) | (description & 0x3FF) }
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 mod account_proof; pub use account_proof::AccountProof;
// Copyright 2011 Google Inc. All Rights Reserved. // Copyright 2017 The Ninja-rs Project Developers. All Rights Reserved. // // 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::cell::{Cell, RefCell}; use std::collections::{BTreeMap, BTreeSet, btree_map}; use super::state::State; use super::deps_log::DepsLog; use super::build_log::BuildLog; use super::disk_interface::DiskInterface; use super::graph::{NodeIndex, EdgeIndex, DependencyScan}; use super::exit_status::ExitStatus; use super::metrics::Stopwatch; use super::metrics::get_time_millis; use super::debug_flags::KEEP_RSP; use super::timestamp::TimeStamp; use super::subprocess::SubprocessSet; use super::utils::{get_load_average, pathbuf_from_bytes}; use super::line_printer::{LinePrinter, LinePrinterLineType}; pub enum EdgeResult { EdgeFailed, EdgeSucceeded, } /// Plan stores the state of a build plan: what we intend to build, /// which steps we're ready to execute. pub struct Plan { wanted_edges: usize, command_edges: usize, /// Keep track of which edges we want to build in this plan. If this map does /// not contain an entry for an edge, we do not want to build the entry or its /// dependents. If an entry maps to false, we do not want to build it, but we /// might want to build one of its dependents. If the entry maps to true, we /// want to build it. want: BTreeMap<EdgeIndex, bool>, ready: BTreeSet<EdgeIndex>, } trait IsVacant { fn is_vacant(&self) -> bool; } impl<'a, K, V> IsVacant for btree_map::Entry<'a, K, V> { fn is_vacant(&self) -> bool { match self { &btree_map::Entry::Vacant(_) => true, _ => false, } } } impl Plan { pub fn new() -> Self { Plan { wanted_edges: 0usize, command_edges: 0usize, want: BTreeMap::new(), ready: BTreeSet::new(), } } /// Add a target to our plan (including all its dependencies). /// Returns false if we don't need to build this target; may /// fill in |err| with an error message if there's a problem. pub fn add_target(&mut self, state: &State, node: NodeIndex) -> Result<bool, String> { self.add_sub_target(state, node, None) } pub fn add_sub_target( &mut self, state: &State, node_idx: NodeIndex, dependent: Option<NodeIndex>, ) -> Result<bool, String> { let node = state.node_state.get_node(node_idx); let edge_idx = node.in_edge(); if edge_idx.is_none() { if node.is_dirty() { let mut err = format!("'{}'", String::from_utf8_lossy(node.path())); if let Some(dependent) = dependent { err += &format!( ", needed by '{}',", String::from_utf8_lossy(state.node_state.get_node(dependent).path()) ); } err += " missing and no known rule to make it"; return Err(err); } return Ok(false); } let edge_idx = edge_idx.unwrap(); let edge = state.edge_state.get_edge(edge_idx); if edge.outputs_ready() { return Ok(false); // Don't need to do anything. } // If an entry in want_ does not already exist for edge, create an entry which // maps to false, indicating that we do not want to build this entry itself. let want = self.want.get(&edge_idx).cloned(); let vacant = want.is_none(); if node.is_dirty() && want.unwrap_or(false) == false { self.want.insert(edge_idx, true); self.wanted_edges += 1; if edge.all_inputs_ready(state) { self.schedule_work(state, edge_idx); } if !edge.is_phony() { self.command_edges += 1; } } if vacant { for input_node_idx in edge.inputs.iter() { self.add_sub_target(state, *input_node_idx, Some(node_idx))?; } } return Ok(true); } /// Number of edges with commands to run. fn command_edge_count(&self) -> usize { return self.command_edges; } /// Reset state. Clears want and ready sets. fn reset(&mut self) { self.command_edges = 0; self.wanted_edges = 0; self.ready.clear(); self.want.clear(); } /// Returns true if there's more work to be done. pub fn more_to_do(&self) -> bool { self.wanted_edges > 0 && self.command_edges > 0 } /// Submits a ready edge as a candidate for execution. /// The edge may be delayed from running, for example if it's a member of a /// currently-full pool. pub fn schedule_work(&mut self, state: &State, edge_idx: EdgeIndex) { if self.ready.get(&edge_idx).is_some() { // This edge has already been scheduled. We can get here again if an edge // and one of its dependencies share an order-only input, or if a node // duplicates an out edge (see https://github.com/ninja-build/ninja/pull/519). // Avoid scheduling the work again. return; } let edge = state.edge_state.get_edge(edge_idx); let mut pool = edge.pool.borrow_mut(); if pool.should_delay_edge() { pool.delay_edge(state, edge_idx); pool.retrieve_ready_edges(state, &mut self.ready); } else { pool.edge_scheduled(state, edge_idx); self.ready.insert(edge_idx); } } // Pop a ready edge off the queue of edges to build. // Returns NULL if there's no work to do. pub fn find_work(&mut self) -> Option<EdgeIndex> { match self.ready.iter().next().cloned() { Some(idx) => { self.ready.remove(&idx); Some(idx) } None => None, } } /// Mark an edge as done building (whether it succeeded or failed). pub fn edge_finished(&mut self, state: &mut State, edge_idx: EdgeIndex, result: EdgeResult) { let directly_wanted = self.want.get(&edge_idx).unwrap().clone(); { let edge = state.edge_state.get_edge(edge_idx); // See if this job frees up any delayed jobs. if directly_wanted { edge.pool.borrow_mut().edge_finished(state, edge_idx); } edge.pool.borrow_mut().retrieve_ready_edges( state, &mut self.ready, ); } match result { EdgeResult::EdgeSucceeded => { if directly_wanted { self.wanted_edges -= 1; } self.want.remove(&edge_idx); state.edge_state.get_edge_mut(edge_idx).outputs_ready = true; // Check off any nodes we were waiting for with this edge. for output_node_idx in state .edge_state .get_edge_mut(edge_idx) .outputs .clone() .into_iter() { self.node_finished(state, output_node_idx); } } _ => {} }; } pub fn node_finished(&mut self, state: &mut State, node_idx: NodeIndex) { // See if we we want any edges from this node. for out_edge_idx in state .node_state .get_node(node_idx) .out_edges() .to_owned() .into_iter() { let want_e = self.want.get(&out_edge_idx).cloned(); if want_e.is_none() { continue; } { let oe = state.edge_state.get_edge(out_edge_idx); if !oe.all_inputs_ready(state) { continue; } } if want_e.unwrap() { self.schedule_work(state, out_edge_idx); } else { // We do not need to build this edge, but we might need to build one of // its dependents. self.edge_finished(state, out_edge_idx, EdgeResult::EdgeSucceeded); } } } /// Clean the given node during the build. /// Return false on error. pub fn clean_node( &mut self, scan: &DependencyScan, State: &State, node_idx: NodeIndex, ) -> Result<(), String> { unimplemented!() } } /* struct Plan { Plan(); /// Dumps the current state of the plan. void Dump(); enum EdgeResult { kEdgeFailed, kEdgeSucceeded }; /// Clean the given node during the build. /// Return false on error. bool CleanNode(DependencyScan* scan, Node* node, string* err); /// Reset state. Clears want and ready sets. void Reset(); private: bool AddSubTarget(Node* node, Node* dependent, string* err); void NodeFinished(Node* node); set<Edge*> ready_; /// Total number of edges that have commands (not phony). int command_edges_; /// Total remaining number of wanted edges. int wanted_edges_; }; */ /// CommandRunner is an interface that wraps running the build /// subcommands. This allows tests to abstract out running commands. /// RealCommandRunner is an implementation that actually runs commands. /// The result of waiting for a command. pub struct CommandRunnerResult { pub edge: EdgeIndex, pub status: ExitStatus, pub output: Vec<u8>, } impl CommandRunnerResult { fn is_success(&self) -> bool { match self.status { ExitStatus::ExitSuccess => true, _ => false, } } } pub trait CommandRunner { fn can_run_more(&self) -> bool; fn start_command(&mut self, state: &State, edge: EdgeIndex) -> bool; /// Wait for a command to complete, or return false if interrupted. fn wait_for_command(&mut self) -> Option<CommandRunnerResult>; fn get_active_edges(&self) -> Vec<EdgeIndex>; fn abort(&mut self); } pub enum BuildConfigVerbosity { NORMAL, QUIET, // No output -- used when testing. VERBOSE, } /// Options (e.g. verbosity, parallelism) passed to a build. pub struct BuildConfig { pub verbosity: BuildConfigVerbosity, pub dry_run: bool, pub parallelism: usize, pub failures_allowed: usize, pub max_load_average: f64, } impl BuildConfig { pub fn new() -> Self { BuildConfig { verbosity: BuildConfigVerbosity::NORMAL, dry_run: false, parallelism: 1, failures_allowed: 1, max_load_average: -0.0f64, } } } /* struct BuildConfig { BuildConfig() : verbosity(NORMAL), dry_run(false), parallelism(1), failures_allowed(1), max_load_average(-0.0f) {} enum Verbosity { NORMAL, QUIET, // No output -- used when testing. VERBOSE }; Verbosity verbosity; bool dry_run; int parallelism; int failures_allowed; /// The maximum load average we must not exceed. A negative value /// means that we do not have any limit. double max_load_average; }; */ /// Builder wraps the build process: starting commands, updating status. pub struct Builder<'s, 'p, 'a, 'b, 'c> where 's: 'a, { state: &'s mut State, config: &'p BuildConfig, plan: Plan, command_runner: Option<Box<CommandRunner + 'p>>, disk_interface: &'c DiskInterface, scan: DependencyScan<'s, 'a, 'b, 'c>, status: BuildStatus<'p>, } impl<'s, 'p, 'a, 'b, 'c> Builder<'s, 'p, 'a, 'b, 'c> where 's: 'a, { pub fn new( state: &'s mut State, config: &'p BuildConfig, build_log: &'a BuildLog<'s>, deps_log: &'b DepsLog, disk_interface: &'c DiskInterface, ) -> Self { Builder { state, config, plan: Plan::new(), command_runner: None, disk_interface, scan: DependencyScan::new(build_log, deps_log, disk_interface), status: BuildStatus::new(config), } } /// Add a target to the build, scanning dependencies. /// @return false on error. pub fn add_target(&mut self, node_idx: NodeIndex) -> Result<(), String> { self.scan.recompute_dirty(self.state, node_idx)?; if let Some(in_edge) = self.state.node_state.get_node(node_idx).in_edge() { if self.state.edge_state.get_edge(in_edge).outputs_ready() { return Ok(()); // Nothing to do. } } self.plan.add_target(self.state, node_idx)?; Ok(()) } /// Returns true if the build targets are already up to date. pub fn is_already_up_to_date(&mut self) -> bool { !self.plan.more_to_do() } /// Run the build. Returns false on error. /// It is an error to call this function when AlreadyUpToDate() is true. pub fn build(&mut self) -> Result<(), String> { assert!(!self.is_already_up_to_date()); self.status.plan_has_total_edges( self.plan.command_edge_count(), ); let mut pending_commands = 0; let mut failures_allowed = self.config.failures_allowed; // Set up the command runner if we haven't done so already. let config = self.config; if self.command_runner.is_none() { self.command_runner = Some(if config.dry_run { Box::new(DryRunCommandRunner::new()) } else { Box::new(RealCommandRunner::new(config)) }); } // We are about to start the build process. self.status.build_started(); // This main loop runs the entire build process. // It is structured like this: // First, we attempt to start as many commands as allowed by the // command runner. // Second, we attempt to wait for / reap the next finished command. while self.plan.more_to_do() { // See if we can start any more commands. if failures_allowed > 0 && self.command_runner.as_ref().unwrap().can_run_more() { if let Some(edge_idx) = self.plan.find_work() { if let Err(e) = self.start_edge(edge_idx) { self.cleanup(); self.status.build_finished(); return Err(e); }; if self.state.edge_state.get_edge(edge_idx).is_phony() { self.plan.edge_finished( self.state, edge_idx, EdgeResult::EdgeSucceeded, ); } else { pending_commands += 1; } // We made some progress; go back to the main loop. continue; } } // See if we can reap any finished commands. if pending_commands > 0 { let result = self.command_runner.as_mut().unwrap().wait_for_command(); if result.is_none() || result.as_ref().unwrap().status == ExitStatus::ExitInterrupted { self.cleanup(); self.status.build_finished(); return Err("interrupted by user".to_owned()); } pending_commands -= 1; let result = self.finish_command(result.unwrap()); if let Err(e) = result { self.cleanup(); self.status.build_finished(); return Err(e); } let result = result.unwrap(); if !result.is_success() { if failures_allowed > 0 { failures_allowed -= 1; } } // We made some progress; start the main loop over. continue; } // If we get here, we cannot make any more progress. self.status.build_finished(); return match failures_allowed { 0 if config.failures_allowed > 1 => Err("subcommands failed".to_owned()), 0 => Err("subcommand failed".to_owned()), _ if failures_allowed < self.config.failures_allowed => Err( "cannot make progress due to previous errors" .to_owned(), ), _ => Err("stuck [this is a bug]".to_owned()), }; } self.status.build_finished(); return Ok(()); } fn start_edge(&mut self, edge_idx: EdgeIndex) -> Result<(), String> { metric_record!("StartEdge"); let edge = self.state.edge_state.get_edge(edge_idx); if edge.is_phony() { return Ok(()); } self.status.build_edge_started(self.state, edge_idx); // Create directories necessary for outputs. // XXX: this will block; do we care? for out_idx in edge.outputs.iter() { let path = pathbuf_from_bytes( self.state.node_state.get_node(*out_idx).path().to_owned(), ).map_err(|e| { format!("invalid utf-8 filename: {}", String::from_utf8_lossy(&e)) })?; if let Some(parent) = path.parent() { self.disk_interface.make_dirs(parent).map_err( |e| format!("{}", e), )?; } } // Create response file, if needed // XXX: this may also block; do we care? let rspfile = edge.get_unescaped_rspfile(&self.state.node_state); if !rspfile.as_ref().is_empty() { let content = edge.get_binding(&self.state.node_state, b"rspfile_content"); let rspfile_path = pathbuf_from_bytes(rspfile.into_owned()).map_err(|e| { format!("invalid utf-8 filename: {}", String::from_utf8_lossy(&e)) })?; self.disk_interface .write_file(&rspfile_path, content.as_ref()) .map_err(|_| String::new())?; } // start command computing and run it if !self.command_runner.as_mut().unwrap().start_command( self.state, edge_idx, ) { return Err(format!( "command '{}' failed.", String::from_utf8_lossy( &edge.evaluate_command(&self.state.node_state), ) )); } Ok(()) } /// Update status ninja logs following a command termination. /// @return false if the build can not proceed further due to a fatal error. fn finish_command( &mut self, mut result: CommandRunnerResult, ) -> Result<CommandRunnerResult, String> { use errno; metric_record!("FinishCommand"); let edge_idx = result.edge; // First try to extract dependencies from the result, if any. // This must happen first as it filters the command output (we want // to filter /showIncludes output, even on compile failure) and // extraction itself can fail, which makes the command fail from a // build perspective. let mut deps_nodes = Vec::new(); let (deps_type, deps_prefix) = { let edge = self.state.edge_state.get_edge(edge_idx); let deps_type = edge.get_binding(&self.state.node_state, b"deps"); let deps_prefix = edge.get_binding(&self.state.node_state, b"msvc_deps_prefix"); (deps_type.into_owned(), deps_prefix.into_owned()) }; if !deps_type.is_empty() { match self.extract_deps(&mut result, deps_type.as_ref(), deps_prefix.as_ref()) { Ok(n) => { deps_nodes = n; } Err(e) => { if result.is_success() { if !result.output.is_empty() { result.output.extend_from_slice(b"\n".as_ref()); } result.output.extend_from_slice(e.as_bytes()); result.status = ExitStatus::ExitFailure; } } } } let (start_time, end_time) = self.status.build_edge_finished( self.state, edge_idx, result.is_success(), &result.output, ); if !result.is_success() { self.plan.edge_finished( self.state, edge_idx, EdgeResult::EdgeFailed, ); return Ok(result); } // The rest of this function only applies to successful commands. // Restat the edge outputs let mut output_mtime = TimeStamp(0); let restat = self.state.edge_state.get_edge(edge_idx).get_binding_bool( &self.state .node_state, b"restat", ); if !self.config.dry_run { let edge = self.state.edge_state.get_edge(edge_idx); let mut node_cleaned = false; for o_node_idx in edge.outputs.iter() { let o_node = self.state.node_state.get_node(*o_node_idx); let path = pathbuf_from_bytes(o_node.path().to_owned()).map_err(|e| { format!("Invalid utf-8 pathname {}", String::from_utf8_lossy(&e)) })?; let new_mtime = self.disk_interface.stat(&path)?; if new_mtime > output_mtime { output_mtime = new_mtime; } if o_node.mtime() == new_mtime && restat { // The rule command did not change the output. Propagate the clean // state through the build graph. // Note that this also applies to nonexistent outputs (mtime == 0). self.plan.clean_node(&self.scan, self.state, *o_node_idx)?; node_cleaned = true; } } if node_cleaned { let mut restat_mtime = TimeStamp(0); // If any output was cleaned, find the most recent mtime of any // (existing) non-order-only input or the depfile. for i_idx in edge.inputs[edge.non_order_only_deps_range()].iter() { let path = pathbuf_from_bytes( self.state.node_state.get_node(*i_idx).path().to_owned(), ).map_err(|e| { format!("invalid utf-8 filename: {}", String::from_utf8_lossy(&e)) })?; let input_mtime = self.disk_interface.stat(&path)?; if input_mtime > restat_mtime { restat_mtime = input_mtime; } } let depfile = edge.get_unescaped_depfile(&self.state.node_state); if restat_mtime.0 != 0 && deps_type.is_empty() && !depfile.is_empty() { let path = pathbuf_from_bytes(depfile.into_owned()).map_err(|e| { format!("invalid utf-8 filename: {}", String::from_utf8_lossy(&e)) })?; let depfile_mtime = self.disk_interface.stat(&path)?; if depfile_mtime > restat_mtime { restat_mtime = depfile_mtime; } } // The total number of edges in the plan may have changed as a result // of a restat. self.status.plan_has_total_edges( self.plan.command_edge_count(), ); output_mtime = restat_mtime; } } self.plan.edge_finished( self.state, edge_idx, EdgeResult::EdgeSucceeded, ); let edge = self.state.edge_state.get_edge(edge_idx); let rspfile = edge.get_unescaped_rspfile(&self.state.node_state); if !rspfile.is_empty() && !KEEP_RSP { if let Ok(path) = pathbuf_from_bytes(rspfile.into_owned()) { let _ = self.disk_interface.remove_file(&path); }; } if let Some(build_log) = self.scan.build_log() { build_log .record_command(self.state, edge_idx, start_time, end_time, output_mtime) .map_err(|e| { format!("Error writing to build log: {}", errno::errno()) })?; } if !deps_type.is_empty() && !self.config.dry_run { assert!(edge.outputs.len() == 1); //or it should have been rejected by parser. let out_idx = edge.outputs[0]; let out = self.state.node_state.get_node(out_idx); let path = pathbuf_from_bytes(out.path().to_owned()).map_err(|e| { format!("Invalid utf-8 pathname {}", String::from_utf8_lossy(&e)) })?; let deps_mtime = self.disk_interface.stat(&path)?; self.scan .deps_log() .record_deps(self.state, out_idx, deps_mtime, &deps_nodes) .map_err(|e| format!("Error writing to deps log: {}", errno::errno()))?; } Ok(result) } /// Clean up after interrupted commands by deleting output files. pub fn cleanup(&mut self) { if self.command_runner.is_none() { return; } let command_runner = self.command_runner.as_mut().unwrap(); let active_edges = command_runner.get_active_edges(); command_runner.abort(); for edge_idx in active_edges.into_iter() { let edge = self.state.edge_state.get_edge(edge_idx); let depfile = edge.get_unescaped_depfile(&self.state.node_state) .into_owned(); for out_idx in edge.outputs.iter() { // Only delete this output if it was actually modified. This is // important for things like the generator where we don't want to // delete the manifest file if we can avoid it. But if the rule // uses a depfile, always delete. (Consider the case where we // need to rebuild an output because of a modified header file // mentioned in a depfile, and the command touches its depfile // but is interrupted before it touches its output file.) let out_node = self.state.node_state.get_node(*out_idx); match pathbuf_from_bytes(out_node.path().to_owned()) { Err(e) => { error!("invalid utf-8 filename: {}", String::from_utf8_lossy(&e)); } Ok(path) => { match self.disk_interface.stat(&path) { Err(e) => { error!("{}", e); } Ok(new_mtime) => { if !depfile.is_empty() || out_node.mtime() != new_mtime { let _ = self.disk_interface.remove_file(&path); } } } } } } if !depfile.is_empty() { match pathbuf_from_bytes(depfile) { Err(e) => { error!("invalid utf-8 filename: {}", String::from_utf8_lossy(&e)); } Ok(path) => { let _ = self.disk_interface.remove_file(&path); } }; } } } fn extract_deps( &self, result: &mut CommandRunnerResult, deps_type: &[u8], deps_prefix: &[u8], ) -> Result<Vec<NodeIndex>, String> { if deps_type == b"msvc" { /* CLParser parser; string output; if (!parser.Parse(result->output, deps_prefix, &output, err)) return false; result->output = output; for (set<string>::iterator i = parser.includes_.begin(); i != parser.includes_.end(); ++i) { // ~0 is assuming that with MSVC-parsed headers, it's ok to always make // all backslashes (as some of the slashes will certainly be backslashes // anyway). This could be fixed if necessary with some additional // complexity in IncludesNormalize::Relativize. deps_nodes->push_back(state_->GetNode(*i, ~0u)); } */ return Ok(Vec::new()); unimplemented!{} } else if deps_type == b"gcc" { /* string depfile = result->edge->GetUnescapedDepfile(); if (depfile.empty()) { *err = string("edge with deps=gcc but no depfile makes no sense"); return false; } // Read depfile content. Treat a missing depfile as empty. string content; switch (disk_interface_->ReadFile(depfile, &content, err)) { case DiskInterface::Okay: break; case DiskInterface::NotFound: err->clear(); break; case DiskInterface::OtherError: return false; } if (content.empty()) return true; DepfileParser deps; if (!deps.Parse(&content, err)) return false; // XXX check depfile matches expected output. deps_nodes->reserve(deps.ins_.size()); for (vector<StringPiece>::iterator i = deps.ins_.begin(); i != deps.ins_.end(); ++i) { uint64_t slash_bits; if (!CanonicalizePath(const_cast<char*>(i->str_), &i->len_, &slash_bits, err)) return false; deps_nodes->push_back(state_->GetNode(*i, slash_bits)); } if (!g_keep_depfile) { if (disk_interface_->RemoveFile(depfile) < 0) { *err = string("deleting depfile: ") + strerror(errno) + string("\n"); return false; } } */ return Ok(Vec::new()); unimplemented!{} } else { fatal!("unknown deps type '{}'", String::from_utf8_lossy(deps_type)); unreachable!(); } } } impl<'s, 'p, 'a, 'b, 'c> Drop for Builder<'s, 'p, 'a, 'b, 'c> { fn drop(&mut self) { self.cleanup(); } } /* struct Builder { Builder(State* state, const BuildConfig& config, BuildLog* build_log, DepsLog* deps_log, DiskInterface* disk_interface); ~Builder(); /// Clean up after interrupted commands by deleting output files. void Cleanup(); Node* AddTarget(const string& name, string* err); /// Used for tests. void SetBuildLog(BuildLog* log) { scan_.set_build_log(log); } State* state_; const BuildConfig& config_; Plan plan_; auto_ptr<CommandRunner> command_runner_; BuildStatus* status_; private: bool ExtractDeps(CommandRunner::Result* result, const string& deps_type, const string& deps_prefix, vector<Node*>* deps_nodes, string* err); DiskInterface* disk_interface_; DependencyScan scan_; // Unimplemented copy ctor and operator= ensure we don't copy the auto_ptr. Builder(const Builder &other); // DO NOT IMPLEMENT void operator=(const Builder &other); // DO NOT IMPLEMENT }; */ enum BuildStatusEdgeStatus { EdgeStarted, EdgeFinished, } /// Tracks the status of a build: completion fraction, printing updates. struct BuildStatus<'a> { config: &'a BuildConfig, /// Time the build started. start_time_millis: u64, started_edges: usize, running_edges: BTreeMap<EdgeIndex, u64>, /// Map of running edge to time the edge started running. finished_edges: usize, total_edges: usize, /// The custom progress status format to use. progress_status_format: Vec<u8>, /// Prints progress output. printer: LinePrinter, overall_rate: RefCell<RateInfo>, current_rate: RefCell<SlidingRateInfo>, } impl<'a> BuildStatus<'a> { pub fn new(config: &'a BuildConfig) -> Self { let v = BuildStatus { config, start_time_millis: get_time_millis(), started_edges: 0, running_edges: BTreeMap::new(), finished_edges: 0, total_edges: 0, progress_status_format: Vec::new(), // TODO printer: LinePrinter::new(), overall_rate: RefCell::new(RateInfo::new()), current_rate: RefCell::new(SlidingRateInfo::new(config.parallelism)), }; return v; unimplemented!{} } pub fn plan_has_total_edges(&mut self, total: usize) { self.total_edges = total; } pub fn build_started(&mut self) { self.overall_rate.borrow_mut().restart(); self.current_rate.borrow_mut().restart(); } pub fn build_finished(&mut self) { self.printer.set_console_locked(false); self.printer.print_on_new_line(b""); } pub fn build_edge_started(&mut self, state: &State, edge_idx: EdgeIndex) { let start_time = get_time_millis() - self.start_time_millis; self.running_edges.insert(edge_idx, start_time); self.started_edges += 1; let edge_use_console = state.edge_state.get_edge(edge_idx).use_console(); if edge_use_console || self.printer.is_smart_terminal() { self.print_status(state, edge_idx, BuildStatusEdgeStatus::EdgeStarted); } if edge_use_console { self.printer.set_console_locked(true); } } pub fn build_edge_finished( &mut self, state: &State, edge_idx: EdgeIndex, success: bool, output: &[u8], ) -> (u64, u64) { let now = get_time_millis(); self.finished_edges += 1; let start_time = self.running_edges.remove(&edge_idx).unwrap(); let end_time = now - self.start_time_millis; if state.edge_state.get_edge(edge_idx).use_console() { self.printer.set_console_locked(false); } match self.config.verbosity { BuildConfigVerbosity::QUIET => { return (start_time, end_time); } _ => {} }; /* if (!edge->use_console()) PrintStatus(edge, kEdgeFinished); // Print the command that is spewing before printing its output. if (!success) { string outputs; for (vector<Node*>::const_iterator o = edge->outputs_.begin(); o != edge->outputs_.end(); ++o) outputs += (*o)->path() + " "; printer_.PrintOnNewLine("FAILED: " + outputs + "\n"); printer_.PrintOnNewLine(edge->EvaluateCommand() + "\n"); } if (!output.empty()) { // ninja sets stdout and stderr of subprocesses to a pipe, to be able to // check if the output is empty. Some compilers, e.g. clang, check // isatty(stderr) to decide if they should print colored output. // To make it possible to use colored output with ninja, subprocesses should // be run with a flag that forces them to always print color escape codes. // To make sure these escape codes don't show up in a file if ninja's output // is piped to a file, ninja strips ansi escape codes again if it's not // writing to a |smart_terminal_|. // (Launching subprocesses in pseudo ttys doesn't work because there are // only a few hundred available on some systems, and ninja can launch // thousands of parallel compile commands.) // TODO: There should be a flag to disable escape code stripping. string final_output; if (!printer_.is_smart_terminal()) final_output = StripAnsiEscapeCodes(output); else final_output = output; #ifdef _WIN32 // Fix extra CR being added on Windows, writing out CR CR LF (#773) _setmode(_fileno(stdout), _O_BINARY); // Begin Windows extra CR fix #endif printer_.PrintOnNewLine(final_output); #ifdef _WIN32 _setmode(_fileno(stdout), _O_TEXT); // End Windows extra CR fix #endif } */ return (start_time, end_time); unimplemented!(); } /// Format the progress status string by replacing the placeholders. /// See the user manual for more information about the available /// placeholders. /// @param progress_status_format The format of the progress status. /// @param status The status of the edge. pub fn format_progress_status( progress_status_format: &[u8], status: BuildStatusEdgeStatus, ) -> Vec<u8> { return Vec::new(); unimplemented!() } fn print_status(&self, state: &State, edge_idx: EdgeIndex, status: BuildStatusEdgeStatus) { let force_full_command = match self.config.verbosity { BuildConfigVerbosity::QUIET => { return; } BuildConfigVerbosity::VERBOSE => true, BuildConfigVerbosity::NORMAL => false, }; let edge = state.edge_state.get_edge(edge_idx); let mut desc_or_cmd = edge.get_binding(&state.node_state, b"description"); if desc_or_cmd.is_empty() || force_full_command { desc_or_cmd = edge.get_binding(&state.node_state, b"command"); } let mut to_print = Self::format_progress_status(&self.progress_status_format, status); to_print.extend_from_slice(&desc_or_cmd); let ty = if force_full_command { LinePrinterLineType::Full } else { LinePrinterLineType::Elide }; self.printer.print(&to_print, ty); } } /* struct BuildStatus { explicit BuildStatus(const BuildConfig& config); void PlanHasTotalEdges(int total); void BuildEdgeStarted(Edge* edge); void BuildEdgeFinished(Edge* edge, bool success, const string& output, int* start_time, int* end_time); void BuildStarted(); void BuildFinished(); private: void PrintStatus(Edge* edge, EdgeStatus status); template<size_t S> void SnprintfRate(double rate, char(&buf)[S], const char* format) const { if (rate == -1) snprintf(buf, S, "?"); else snprintf(buf, S, format, rate); } */ struct RateInfo { rate: f64, stopwatch: Stopwatch, } impl RateInfo { pub fn new() -> Self { RateInfo { rate: -1f64, stopwatch: Stopwatch::new(), } } pub fn restart(&mut self) { self.stopwatch.restart() } } /* struct RateInfo { RateInfo() : rate_(-1) {} void Restart() { stopwatch_.Restart(); } double Elapsed() const { return stopwatch_.Elapsed(); } double rate() { return rate_; } void UpdateRate(int edges) { if (edges && stopwatch_.Elapsed()) rate_ = edges / stopwatch_.Elapsed(); } private: double rate_; Stopwatch stopwatch_; }; */ struct SlidingRateInfo { rate: f64, stopwatch: Stopwatch, max_len: usize, times: VecDeque<f64>, last_update: isize, } impl SlidingRateInfo { pub fn new(n: usize) -> Self { SlidingRateInfo { rate: -1.0f64, stopwatch: Stopwatch::new(), max_len: n, times: VecDeque::new(), last_update: -1, } } pub fn restart(&mut self) { self.stopwatch.restart(); } } /* struct SlidingRateInfo { SlidingRateInfo(int n) : rate_(-1), N(n), last_update_(-1) {} void Restart() { stopwatch_.Restart(); } double rate() { return rate_; } void UpdateRate(int update_hint) { if (update_hint == last_update_) return; last_update_ = update_hint; if (times_.size() == N) times_.pop(); times_.push(stopwatch_.Elapsed()); if (times_.back() != times_.front()) rate_ = times_.size() / (times_.back() - times_.front()); } private: double rate_; Stopwatch stopwatch_; const size_t N; queue<double> times_; int last_update_; }; mutable RateInfo overall_rate_; mutable SlidingRateInfo current_rate_; }; #endif // NINJA_BUILD_H_ */ /* // Copyright 2011 Google Inc. All Rights Reserved. // // 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. #include "build.h" #include <assert.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <functional> #ifdef _WIN32 #include <fcntl.h> #include <io.h> #endif #if defined(__SVR4) && defined(__sun) #include <sys/termios.h> #endif #include "build_log.h" #include "clparser.h" #include "debug_flags.h" #include "depfile_parser.h" #include "deps_log.h" #include "disk_interface.h" #include "graph.h" #include "state.h" #include "subprocess.h" #include "util.h" */ use std::collections::VecDeque; struct DryRunCommandRunner { finished: VecDeque<EdgeIndex>, } impl DryRunCommandRunner { pub fn new() -> Self { DryRunCommandRunner { finished: VecDeque::new() } } } impl CommandRunner for DryRunCommandRunner { fn can_run_more(&self) -> bool { true } fn start_command(&mut self, _: &State, edge: EdgeIndex) -> bool { self.finished.push_back(edge); true } fn wait_for_command(&mut self) -> Option<CommandRunnerResult> { match self.finished.pop_front() { None => None, Some(e) => Some(CommandRunnerResult { edge: e, status: ExitStatus::ExitSuccess, output: Vec::new(), }), } } fn get_active_edges(&self) -> Vec<EdgeIndex> { Vec::new() } fn abort(&mut self) { //do nothing } } /* BuildStatus::BuildStatus(const BuildConfig& config) : config_(config), start_time_millis_(GetTimeMillis()), started_edges_(0), finished_edges_(0), total_edges_(0), progress_status_format_(NULL), overall_rate_(), current_rate_(config.parallelism) { // Don't do anything fancy in verbose mode. if (config_.verbosity != BuildConfig::NORMAL) printer_.set_smart_terminal(false); progress_status_format_ = getenv("NINJA_STATUS"); if (!progress_status_format_) progress_status_format_ = "[%f/%t] "; } void BuildStatus::PlanHasTotalEdges(int total) { total_edges_ = total; } void BuildStatus::BuildEdgeStarted(Edge* edge) { int start_time = (int)(GetTimeMillis() - start_time_millis_); running_edges_.insert(make_pair(edge, start_time)); ++started_edges_; if (edge->use_console() || printer_.is_smart_terminal()) PrintStatus(edge, kEdgeStarted); if (edge->use_console()) printer_.SetConsoleLocked(true); } void BuildStatus::BuildEdgeFinished(Edge* edge, bool success, const string& output, int* start_time, int* end_time) { int64_t now = GetTimeMillis(); ++finished_edges_; RunningEdgeMap::iterator i = running_edges_.find(edge); *start_time = i->second; *end_time = (int)(now - start_time_millis_); running_edges_.erase(i); if (edge->use_console()) printer_.SetConsoleLocked(false); if (config_.verbosity == BuildConfig::QUIET) return; if (!edge->use_console()) PrintStatus(edge, kEdgeFinished); // Print the command that is spewing before printing its output. if (!success) { string outputs; for (vector<Node*>::const_iterator o = edge->outputs_.begin(); o != edge->outputs_.end(); ++o) outputs += (*o)->path() + " "; printer_.PrintOnNewLine("FAILED: " + outputs + "\n"); printer_.PrintOnNewLine(edge->EvaluateCommand() + "\n"); } if (!output.empty()) { // ninja sets stdout and stderr of subprocesses to a pipe, to be able to // check if the output is empty. Some compilers, e.g. clang, check // isatty(stderr) to decide if they should print colored output. // To make it possible to use colored output with ninja, subprocesses should // be run with a flag that forces them to always print color escape codes. // To make sure these escape codes don't show up in a file if ninja's output // is piped to a file, ninja strips ansi escape codes again if it's not // writing to a |smart_terminal_|. // (Launching subprocesses in pseudo ttys doesn't work because there are // only a few hundred available on some systems, and ninja can launch // thousands of parallel compile commands.) // TODO: There should be a flag to disable escape code stripping. string final_output; if (!printer_.is_smart_terminal()) final_output = StripAnsiEscapeCodes(output); else final_output = output; #ifdef _WIN32 // Fix extra CR being added on Windows, writing out CR CR LF (#773) _setmode(_fileno(stdout), _O_BINARY); // Begin Windows extra CR fix #endif printer_.PrintOnNewLine(final_output); #ifdef _WIN32 _setmode(_fileno(stdout), _O_TEXT); // End Windows extra CR fix #endif } } void BuildStatus::BuildStarted() { overall_rate_.Restart(); current_rate_.Restart(); } void BuildStatus::BuildFinished() { printer_.SetConsoleLocked(false); printer_.PrintOnNewLine(""); } string BuildStatus::FormatProgressStatus( const char* progress_status_format, EdgeStatus status) const { string out; char buf[32]; int percent; for (const char* s = progress_status_format; *s != '\0'; ++s) { if (*s == '%') { ++s; switch (*s) { case '%': out.push_back('%'); break; // Started edges. case 's': snprintf(buf, sizeof(buf), "%d", started_edges_); out += buf; break; // Total edges. case 't': snprintf(buf, sizeof(buf), "%d", total_edges_); out += buf; break; // Running edges. case 'r': { int running_edges = started_edges_ - finished_edges_; // count the edge that just finished as a running edge if (status == kEdgeFinished) running_edges++; snprintf(buf, sizeof(buf), "%d", running_edges); out += buf; break; } // Unstarted edges. case 'u': snprintf(buf, sizeof(buf), "%d", total_edges_ - started_edges_); out += buf; break; // Finished edges. case 'f': snprintf(buf, sizeof(buf), "%d", finished_edges_); out += buf; break; // Overall finished edges per second. case 'o': overall_rate_.UpdateRate(finished_edges_); SnprintfRate(overall_rate_.rate(), buf, "%.1f"); out += buf; break; // Current rate, average over the last '-j' jobs. case 'c': current_rate_.UpdateRate(finished_edges_); SnprintfRate(current_rate_.rate(), buf, "%.1f"); out += buf; break; // Percentage case 'p': percent = (100 * finished_edges_) / total_edges_; snprintf(buf, sizeof(buf), "%3i%%", percent); out += buf; break; case 'e': { double elapsed = overall_rate_.Elapsed(); snprintf(buf, sizeof(buf), "%.3f", elapsed); out += buf; break; } default: Fatal("unknown placeholder '%%%c' in $NINJA_STATUS", *s); return ""; } } else { out.push_back(*s); } } return out; } void BuildStatus::PrintStatus(Edge* edge, EdgeStatus status) { if (config_.verbosity == BuildConfig::QUIET) return; bool force_full_command = config_.verbosity == BuildConfig::VERBOSE; string to_print = edge->GetBinding("description"); if (to_print.empty() || force_full_command) to_print = edge->GetBinding("command"); to_print = FormatProgressStatus(progress_status_format_, status) + to_print; printer_.Print(to_print, force_full_command ? LinePrinter::FULL : LinePrinter::ELIDE); } Plan::Plan() : command_edges_(0), wanted_edges_(0) {} bool Plan::CleanNode(DependencyScan* scan, Node* node, string* err) { node->set_dirty(false); for (vector<Edge*>::const_iterator oe = node->out_edges().begin(); oe != node->out_edges().end(); ++oe) { // Don't process edges that we don't actually want. map<Edge*, bool>::iterator want_e = want_.find(*oe); if (want_e == want_.end() || !want_e->second) continue; // Don't attempt to clean an edge if it failed to load deps. if ((*oe)->deps_missing_) continue; // If all non-order-only inputs for this edge are now clean, // we might have changed the dirty state of the outputs. vector<Node*>::iterator begin = (*oe)->inputs_.begin(), end = (*oe)->inputs_.end() - (*oe)->order_only_deps_; if (find_if(begin, end, mem_fun(&Node::dirty)) == end) { // Recompute most_recent_input. Node* most_recent_input = NULL; for (vector<Node*>::iterator i = begin; i != end; ++i) { if (!most_recent_input || (*i)->mtime() > most_recent_input->mtime()) most_recent_input = *i; } // Now, this edge is dirty if any of the outputs are dirty. // If the edge isn't dirty, clean the outputs and mark the edge as not // wanted. bool outputs_dirty = false; if (!scan->RecomputeOutputsDirty(*oe, most_recent_input, &outputs_dirty, err)) { return false; } if (!outputs_dirty) { for (vector<Node*>::iterator o = (*oe)->outputs_.begin(); o != (*oe)->outputs_.end(); ++o) { if (!CleanNode(scan, *o, err)) return false; } want_e->second = false; --wanted_edges_; if (!(*oe)->is_phony()) --command_edges_; } } } return true; } void Plan::Dump() { printf("pending: %d\n", (int)want_.size()); for (map<Edge*, bool>::iterator e = want_.begin(); e != want_.end(); ++e) { if (e->second) printf("want "); e->first->Dump(); } printf("ready: %d\n", (int)ready_.size()); } */ struct RealCommandRunner<'a> { config: &'a BuildConfig, subprocs: SubprocessSet<EdgeIndex>, } impl<'a> RealCommandRunner<'a> { pub fn new(config: &'a BuildConfig) -> Self { RealCommandRunner { config, subprocs: SubprocessSet::new(), } } } impl<'a> CommandRunner for RealCommandRunner<'a> { fn can_run_more(&self) -> bool { let subproc_number = self.subprocs.running().len() + self.subprocs.finished().len(); if subproc_number >= self.config.parallelism { return false; } if self.subprocs.running().is_empty() { return true; } if self.config.max_load_average <= 0.0f64 { return true; } if get_load_average().unwrap_or(-0.0f64) < self.config.max_load_average { return true; } return false; } fn start_command(&mut self, state: &State, edge_idx: EdgeIndex) -> bool { let edge = state.edge_state.get_edge(edge_idx); let command = edge.evaluate_command(&state.node_state); return self.subprocs .add(&command, edge.use_console(), edge_idx) .is_some(); } fn wait_for_command(&mut self) -> Option<CommandRunnerResult> { let (mut subproc, edge_idx) = loop { if let Some(next_finished) = self.subprocs.next_finished() { break next_finished; } if self.subprocs.do_work().is_err() { //interrupted return None; } }; let status = subproc.finish(); let output = subproc.output().to_owned(); Some(CommandRunnerResult { status, output, edge: edge_idx, }) } fn get_active_edges(&self) -> Vec<EdgeIndex> { self.subprocs.iter().map(|x| x.1).collect() } fn abort(&mut self) { self.subprocs.clear(); } } /* struct RealCommandRunner : public CommandRunner { explicit RealCommandRunner(const BuildConfig& config) : config_(config) {} virtual ~RealCommandRunner() {} virtual bool CanRunMore(); virtual bool StartCommand(Edge* edge); virtual bool WaitForCommand(Result* result); virtual vector<Edge*> GetActiveEdges(); virtual void Abort(); const BuildConfig& config_; SubprocessSet subprocs_; map<Subprocess*, Edge*> subproc_to_edge_; }; bool RealCommandRunner::CanRunMore() { size_t subproc_number = subprocs_.running_.size() + subprocs_.finished_.size(); return (int)subproc_number < config_.parallelism && ((subprocs_.running_.empty() || config_.max_load_average <= 0.0f) || GetLoadAverage() < config_.max_load_average); } bool RealCommandRunner::StartCommand(Edge* edge) { string command = edge->EvaluateCommand(); Subprocess* subproc = subprocs_.Add(command, edge->use_console()); if (!subproc) return false; subproc_to_edge_.insert(make_pair(subproc, edge)); return true; } bool RealCommandRunner::WaitForCommand(Result* result) { Subprocess* subproc; while ((subproc = subprocs_.NextFinished()) == NULL) { bool interrupted = subprocs_.DoWork(); if (interrupted) return false; } result->status = subproc->Finish(); result->output = subproc->GetOutput(); map<Subprocess*, Edge*>::iterator e = subproc_to_edge_.find(subproc); result->edge = e->second; subproc_to_edge_.erase(e); delete subproc; return true; } Builder::Builder(State* state, const BuildConfig& config, BuildLog* build_log, DepsLog* deps_log, DiskInterface* disk_interface) : state_(state), config_(config), disk_interface_(disk_interface), scan_(state, build_log, deps_log, disk_interface) { status_ = new BuildStatus(config); } Node* Builder::AddTarget(const string& name, string* err) { Node* node = state_->LookupNode(name); if (!node) { *err = "unknown target: '" + name + "'"; return NULL; } if (!AddTarget(node, err)) return NULL; return node; } bool Builder::AddTarget(Node* node, string* err) { if (!scan_.RecomputeDirty(node, err)) return false; if (Edge* in_edge = node->in_edge()) { if (in_edge->outputs_ready()) return true; // Nothing to do. } if (!plan_.AddTarget(node, err)) return false; return true; } bool Builder::ExtractDeps(CommandRunner::Result* result, const string& deps_type, const string& deps_prefix, vector<Node*>* deps_nodes, string* err) { if (deps_type == "msvc") { CLParser parser; string output; if (!parser.Parse(result->output, deps_prefix, &output, err)) return false; result->output = output; for (set<string>::iterator i = parser.includes_.begin(); i != parser.includes_.end(); ++i) { // ~0 is assuming that with MSVC-parsed headers, it's ok to always make // all backslashes (as some of the slashes will certainly be backslashes // anyway). This could be fixed if necessary with some additional // complexity in IncludesNormalize::Relativize. deps_nodes->push_back(state_->GetNode(*i, ~0u)); } } else if (deps_type == "gcc") { string depfile = result->edge->GetUnescapedDepfile(); if (depfile.empty()) { *err = string("edge with deps=gcc but no depfile makes no sense"); return false; } // Read depfile content. Treat a missing depfile as empty. string content; switch (disk_interface_->ReadFile(depfile, &content, err)) { case DiskInterface::Okay: break; case DiskInterface::NotFound: err->clear(); break; case DiskInterface::OtherError: return false; } if (content.empty()) return true; DepfileParser deps; if (!deps.Parse(&content, err)) return false; // XXX check depfile matches expected output. deps_nodes->reserve(deps.ins_.size()); for (vector<StringPiece>::iterator i = deps.ins_.begin(); i != deps.ins_.end(); ++i) { uint64_t slash_bits; if (!CanonicalizePath(const_cast<char*>(i->str_), &i->len_, &slash_bits, err)) return false; deps_nodes->push_back(state_->GetNode(*i, slash_bits)); } if (!g_keep_depfile) { if (disk_interface_->RemoveFile(depfile) < 0) { *err = string("deleting depfile: ") + strerror(errno) + string("\n"); return false; } } } else { Fatal("unknown deps type '%s'", deps_type.c_str()); } return true; } */ #[cfg(test)] mod tests { use super::*; use super::super::test::TestWithStateAndVFS; use super::super::graph::Node; /// Fixture for tests involving Plan. // Though Plan doesn't use State, it's useful to have one around // to create Nodes and Edges. struct PlanTestData { plan: Plan, } impl Default for PlanTestData { fn default() -> Self { PlanTestData { plan: Plan::new() } } } type PlanTest = TestWithStateAndVFS<PlanTestData>; impl PlanTest { pub fn new() -> Self { Self::new_with_builtin_rule() } } /* /// Fixture for tests involving Plan. // Though Plan doesn't use State, it's useful to have one around // to create Nodes and Edges. struct PlanTest : public StateTestWithBuiltinRules { Plan plan_; /// Because FindWork does not return Edges in any sort of predictable order, // provide a means to get available Edges in order and in a format which is // easy to write tests around. void FindWorkSorted(deque<Edge*>* ret, int count) { struct CompareEdgesByOutput { static bool cmp(const Edge* a, const Edge* b) { return a->outputs_[0]->path() < b->outputs_[0]->path(); } }; for (int i = 0; i < count; ++i) { ASSERT_TRUE(plan_.more_to_do()); Edge* edge = plan_.FindWork(); ASSERT_TRUE(edge); ret->push_back(edge); } ASSERT_FALSE(plan_.FindWork()); sort(ret->begin(), ret->end(), CompareEdgesByOutput::cmp); } void TestPoolWithDepthOne(const char *test_case); }; */ #[test] fn plantest_basic() { let mut plantest = PlanTest::new(); plantest.assert_parse( concat!("build out: cat mid\n", "build mid: cat in\n").as_bytes(), ); plantest.assert_with_node_mut(b"mid", Node::mark_dirty); plantest.assert_with_node_mut(b"out", Node::mark_dirty); let out_node_idx = plantest.assert_node_idx(b"out"); let mut state = plantest.state.borrow_mut(); let state = &mut *state; let plan = &mut plantest.other.plan; assert_eq!(Ok(true), plan.add_target(state, out_node_idx)); assert_eq!(true, plan.more_to_do()); let edge_idx = plan.find_work().unwrap(); { let edge = state.edge_state.get_edge(edge_idx); let input0 = edge.inputs[0]; assert_eq!(b"in", state.node_state.get_node(input0).path()); let output0 = edge.outputs[0]; assert_eq!(b"mid", state.node_state.get_node(output0).path()); } assert_eq!(None, plan.find_work()); plan.edge_finished(state, edge_idx, EdgeResult::EdgeSucceeded); let edge_idx = plan.find_work().unwrap(); { let edge = state.edge_state.get_edge(edge_idx); let input0 = edge.inputs[0]; assert_eq!(b"mid", state.node_state.get_node(input0).path()); let output0 = edge.outputs[0]; assert_eq!(b"out", state.node_state.get_node(output0).path()); } plan.edge_finished(state, edge_idx, EdgeResult::EdgeSucceeded); assert_eq!(false, plan.more_to_do()); assert_eq!(None, plan.find_work()); } // Test that two outputs from one rule can be handled as inputs to the next. #[test] fn plantest_double_output_direct() { let mut plantest = PlanTest::new(); plantest.assert_parse( concat!("build out: cat mid1 mid2\n", "build mid1 mid2: cat in\n").as_bytes(), ); plantest.assert_with_node_mut(b"mid1", Node::mark_dirty); plantest.assert_with_node_mut(b"mid2", Node::mark_dirty); plantest.assert_with_node_mut(b"out", Node::mark_dirty); let out_node_idx = plantest.assert_node_idx(b"out"); let mut state = plantest.state.borrow_mut(); let state = &mut *state; let plan = &mut plantest.other.plan; assert_eq!(Ok(true), plan.add_target(state, out_node_idx)); assert_eq!(true, plan.more_to_do()); let edge_idx = plan.find_work().unwrap(); // cat in plan.edge_finished(state, edge_idx, EdgeResult::EdgeSucceeded); let edge_idx = plan.find_work().unwrap(); // cat mid1 mid2 plan.edge_finished(state, edge_idx, EdgeResult::EdgeSucceeded); assert_eq!(None, plan.find_work()); // done } // Test that two outputs from one rule can eventually be routed to another. #[test] fn plantest_double_output_indirect() { let mut plantest = PlanTest::new(); plantest.assert_parse( concat!( "build out: cat b1 b2\n", "build b1: cat a1\n", "build b2: cat a2\n", "build a1 a2: cat in\n" ).as_bytes(), ); plantest.assert_with_node_mut(b"a1", Node::mark_dirty); plantest.assert_with_node_mut(b"a2", Node::mark_dirty); plantest.assert_with_node_mut(b"b1", Node::mark_dirty); plantest.assert_with_node_mut(b"b2", Node::mark_dirty); plantest.assert_with_node_mut(b"out", Node::mark_dirty); let out_node_idx = plantest.assert_node_idx(b"out"); let mut state = plantest.state.borrow_mut(); let state = &mut *state; let plan = &mut plantest.other.plan; assert_eq!(Ok(true), plan.add_target(state, out_node_idx)); assert_eq!(true, plan.more_to_do()); let edge_idx = plan.find_work().unwrap(); // cat in plan.edge_finished(state, edge_idx, EdgeResult::EdgeSucceeded); let edge_idx = plan.find_work().unwrap(); // cat a1 plan.edge_finished(state, edge_idx, EdgeResult::EdgeSucceeded); let edge_idx = plan.find_work().unwrap(); // cat a2 plan.edge_finished(state, edge_idx, EdgeResult::EdgeSucceeded); let edge_idx = plan.find_work().unwrap(); // cat b1 b2 plan.edge_finished(state, edge_idx, EdgeResult::EdgeSucceeded); assert_eq!(None, plan.find_work()); // done } // Test that two edges from one output can both execute. #[test] fn plantest_double_dependent() { let mut plantest = PlanTest::new(); plantest.assert_parse( concat!( "build out: cat a1 a2\n", "build a1: cat mid\n", "build a2: cat mid\n", "build mid: cat in\n" ).as_bytes(), ); plantest.assert_with_node_mut(b"mid", Node::mark_dirty); plantest.assert_with_node_mut(b"a1", Node::mark_dirty); plantest.assert_with_node_mut(b"a2", Node::mark_dirty); plantest.assert_with_node_mut(b"out", Node::mark_dirty); let out_node_idx = plantest.assert_node_idx(b"out"); let mut state = plantest.state.borrow_mut(); let state = &mut *state; let plan = &mut plantest.other.plan; assert_eq!(Ok(true), plan.add_target(state, out_node_idx)); assert_eq!(true, plan.more_to_do()); let edge_idx = plan.find_work().unwrap(); // cat in plan.edge_finished(state, edge_idx, EdgeResult::EdgeSucceeded); let edge_idx = plan.find_work().unwrap(); // cat mid plan.edge_finished(state, edge_idx, EdgeResult::EdgeSucceeded); let edge_idx = plan.find_work().unwrap(); // cat mid plan.edge_finished(state, edge_idx, EdgeResult::EdgeSucceeded); let edge_idx = plan.find_work().unwrap(); // cat a1 a2 plan.edge_finished(state, edge_idx, EdgeResult::EdgeSucceeded); assert_eq!(None, plan.find_work()); // done } fn test_pool_with_depth_one_helper(plantest: &mut PlanTest, test_case: &[u8]) { plantest.assert_parse(test_case); plantest.assert_with_node_mut(b"out1", Node::mark_dirty); plantest.assert_with_node_mut(b"out2", Node::mark_dirty); let out1_node_idx = plantest.assert_node_idx(b"out1"); let out2_node_idx = plantest.assert_node_idx(b"out2"); let mut state = plantest.state.borrow_mut(); let state = &mut *state; let plan = &mut plantest.other.plan; assert_eq!(Ok(true), plan.add_target(state, out1_node_idx)); assert_eq!(Ok(true), plan.add_target(state, out2_node_idx)); assert_eq!(true, plan.more_to_do()); let edge_idx = plan.find_work().unwrap(); { let edge = state.edge_state.get_edge(edge_idx); let edge_in0_idx = edge.inputs.get(0).cloned().unwrap(); let edge_in0_node = state.node_state.get_node(edge_in0_idx); assert_eq!(b"in".as_ref(), edge_in0_node.path()); let edge_out0_idx = edge.outputs.get(0).cloned().unwrap(); let edge_out0_node = state.node_state.get_node(edge_out0_idx); assert_eq!(b"out1".as_ref(), edge_out0_node.path()); } // This will be false since poolcat is serialized assert!(plan.find_work().is_none()); plan.edge_finished(state, edge_idx, EdgeResult::EdgeSucceeded); let edge_idx = plan.find_work().unwrap(); { let edge = state.edge_state.get_edge(edge_idx); let edge_in0_idx = edge.inputs.get(0).cloned().unwrap(); let edge_in0_node = state.node_state.get_node(edge_in0_idx); assert_eq!(b"in".as_ref(), edge_in0_node.path()); let edge_out0_idx = edge.outputs.get(0).cloned().unwrap(); let edge_out0_node = state.node_state.get_node(edge_out0_idx); assert_eq!(b"out2".as_ref(), edge_out0_node.path()); } // This will be false since poolcat is serialized assert!(plan.find_work().is_none()); plan.edge_finished(state, edge_idx, EdgeResult::EdgeSucceeded); assert_eq!(false, plan.more_to_do()); assert_eq!(None, plan.find_work()); // done } #[test] fn plantest_pool_with_depth_one() { let mut plantest = PlanTest::new(); test_pool_with_depth_one_helper( &mut plantest, concat!( "pool foobar\n", " depth = 1\n", "rule poolcat\n", " command = cat $in > $out\n", " pool = foobar\n", "build out1: poolcat in\n", "build out2: poolcat in\n" ).as_bytes(), ); } #[test] fn plantest_console_pool() { let mut plantest = PlanTest::new(); test_pool_with_depth_one_helper( &mut plantest, concat!( "rule poolcat\n", " command = cat $in > $out\n", " pool = console\n", "build out1: poolcat in\n", "build out2: poolcat in\n", ).as_bytes(), ); } /// Because FindWork does not return Edges in any sort of predictable order, // provide a means to get available Edges in order and in a format which is // easy to write tests around. fn find_work_sorted_helper( plan: &mut Plan, state: &State, count: usize, ) -> VecDeque<EdgeIndex> { let mut result = (0..count) .map(|i| { assert!(plan.more_to_do()); plan.find_work().unwrap() }) .collect::<Vec<_>>(); assert!(plan.find_work().is_none()); result.sort_by_key(|e| { state .node_state .get_node(state.edge_state.get_edge(*e).outputs[0]) .path() }); result.into_iter().collect() } #[test] fn plantest_pools_with_depth_two() { let mut plantest = PlanTest::new(); plantest.assert_parse( concat!( "pool foobar\n", " depth = 2\n", "pool bazbin\n", " depth = 2\n", "rule foocat\n", " command = cat $in > $out\n", " pool = foobar\n", "rule bazcat\n", " command = cat $in > $out\n", " pool = bazbin\n", "build out1: foocat in\n", "build out2: foocat in\n", "build out3: foocat in\n", "build outb1: bazcat in\n", "build outb2: bazcat in\n", "build outb3: bazcat in\n", " pool =\n", "build allTheThings: cat out1 out2 out3 outb1 outb2 outb3\n" ).as_bytes(), ); [ b"out1".as_ref(), b"out2".as_ref(), b"out3".as_ref(), b"outb1".as_ref(), b"outb2".as_ref(), b"outb3".as_ref(), b"allTheThings".as_ref(), ].as_ref() .iter() .for_each(|path| { plantest.assert_with_node_mut(path, Node::mark_dirty); }); let mut state = plantest.state.borrow_mut(); let state = &mut *state; let plan = &mut plantest.other.plan; let all_the_things_node = state.node_state.lookup_node(b"allTheThings").unwrap(); assert_eq!(Ok(true), plan.add_target(state, all_the_things_node)); let mut edges = find_work_sorted_helper(plan, state, 5); { let edge_idx = edges[0]; let edge = state.edge_state.get_edge(edge_idx); assert_eq!( b"in".as_ref(), state.node_state.get_node(edge.inputs[0]).path() ); assert_eq!( b"out1".as_ref(), state.node_state.get_node(edge.outputs[0]).path() ) } { let edge_idx = edges[1]; let edge = state.edge_state.get_edge(edge_idx); assert_eq!( b"in".as_ref(), state.node_state.get_node(edge.inputs[0]).path() ); assert_eq!( b"out2".as_ref(), state.node_state.get_node(edge.outputs[0]).path() ) } { let edge_idx = edges[2]; let edge = state.edge_state.get_edge(edge_idx); assert_eq!( b"in".as_ref(), state.node_state.get_node(edge.inputs[0]).path() ); assert_eq!( b"outb1".as_ref(), state.node_state.get_node(edge.outputs[0]).path() ) } { let edge_idx = edges[3]; let edge = state.edge_state.get_edge(edge_idx); assert_eq!( b"in".as_ref(), state.node_state.get_node(edge.inputs[0]).path() ); assert_eq!( b"outb2".as_ref(), state.node_state.get_node(edge.outputs[0]).path() ) } { let edge_idx = edges[4]; let edge = state.edge_state.get_edge(edge_idx); assert_eq!( b"in".as_ref(), state.node_state.get_node(edge.inputs[0]).path() ); assert_eq!( b"outb3".as_ref(), state.node_state.get_node(edge.outputs[0]).path() ) } // finish out1 plan.edge_finished(state, edges.pop_front().unwrap(), EdgeResult::EdgeSucceeded); let out3_idx = plan.find_work().unwrap(); { let edge = state.edge_state.get_edge(out3_idx); assert_eq!( b"in".as_ref(), state.node_state.get_node(edge.inputs[0]).path() ); assert_eq!( b"out3".as_ref(), state.node_state.get_node(edge.outputs[0]).path() ) } assert!(plan.find_work().is_none()); plan.edge_finished(state, out3_idx, EdgeResult::EdgeSucceeded); assert!(plan.find_work().is_none()); edges.into_iter().for_each(|edge_idx| { plan.edge_finished(state, edge_idx, EdgeResult::EdgeSucceeded); }); let last_idx = plan.find_work().unwrap(); { let edge = state.edge_state.get_edge(last_idx); assert_eq!( b"allTheThings".as_ref(), state.node_state.get_node(edge.outputs[0]).path() ) } plan.edge_finished(state, last_idx, EdgeResult::EdgeSucceeded); assert_eq!(false, plan.more_to_do()); assert_eq!(None, plan.find_work()); // done } /* TEST_F(PlanTest, PoolWithRedundantEdges) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "pool compile\n" " depth = 1\n" "rule gen_foo\n" " command = touch foo.cpp\n" "rule gen_bar\n" " command = touch bar.cpp\n" "rule echo\n" " command = echo $out > $out\n" "build foo.cpp.obj: echo foo.cpp || foo.cpp\n" " pool = compile\n" "build bar.cpp.obj: echo bar.cpp || bar.cpp\n" " pool = compile\n" "build libfoo.a: echo foo.cpp.obj bar.cpp.obj\n" "build foo.cpp: gen_foo\n" "build bar.cpp: gen_bar\n" "build all: phony libfoo.a\n")); GetNode("foo.cpp")->MarkDirty(); GetNode("foo.cpp.obj")->MarkDirty(); GetNode("bar.cpp")->MarkDirty(); GetNode("bar.cpp.obj")->MarkDirty(); GetNode("libfoo.a")->MarkDirty(); GetNode("all")->MarkDirty(); string err; EXPECT_TRUE(plan_.AddTarget(GetNode("all"), &err)); ASSERT_EQ("", err); ASSERT_TRUE(plan_.more_to_do()); Edge* edge = NULL; deque<Edge*> initial_edges; FindWorkSorted(&initial_edges, 2); edge = initial_edges[1]; // Foo first ASSERT_EQ("foo.cpp", edge->outputs_[0]->path()); plan_.EdgeFinished(edge, Plan::kEdgeSucceeded); edge = plan_.FindWork(); ASSERT_TRUE(edge); ASSERT_FALSE(plan_.FindWork()); ASSERT_EQ("foo.cpp", edge->inputs_[0]->path()); ASSERT_EQ("foo.cpp", edge->inputs_[1]->path()); ASSERT_EQ("foo.cpp.obj", edge->outputs_[0]->path()); plan_.EdgeFinished(edge, Plan::kEdgeSucceeded); edge = initial_edges[0]; // Now for bar ASSERT_EQ("bar.cpp", edge->outputs_[0]->path()); plan_.EdgeFinished(edge, Plan::kEdgeSucceeded); edge = plan_.FindWork(); ASSERT_TRUE(edge); ASSERT_FALSE(plan_.FindWork()); ASSERT_EQ("bar.cpp", edge->inputs_[0]->path()); ASSERT_EQ("bar.cpp", edge->inputs_[1]->path()); ASSERT_EQ("bar.cpp.obj", edge->outputs_[0]->path()); plan_.EdgeFinished(edge, Plan::kEdgeSucceeded); edge = plan_.FindWork(); ASSERT_TRUE(edge); ASSERT_FALSE(plan_.FindWork()); ASSERT_EQ("foo.cpp.obj", edge->inputs_[0]->path()); ASSERT_EQ("bar.cpp.obj", edge->inputs_[1]->path()); ASSERT_EQ("libfoo.a", edge->outputs_[0]->path()); plan_.EdgeFinished(edge, Plan::kEdgeSucceeded); edge = plan_.FindWork(); ASSERT_TRUE(edge); ASSERT_FALSE(plan_.FindWork()); ASSERT_EQ("libfoo.a", edge->inputs_[0]->path()); ASSERT_EQ("all", edge->outputs_[0]->path()); plan_.EdgeFinished(edge, Plan::kEdgeSucceeded); edge = plan_.FindWork(); ASSERT_FALSE(edge); ASSERT_FALSE(plan_.more_to_do()); } TEST_F(PlanTest, PoolWithFailingEdge) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "pool foobar\n" " depth = 1\n" "rule poolcat\n" " command = cat $in > $out\n" " pool = foobar\n" "build out1: poolcat in\n" "build out2: poolcat in\n")); GetNode("out1")->MarkDirty(); GetNode("out2")->MarkDirty(); string err; EXPECT_TRUE(plan_.AddTarget(GetNode("out1"), &err)); ASSERT_EQ("", err); EXPECT_TRUE(plan_.AddTarget(GetNode("out2"), &err)); ASSERT_EQ("", err); ASSERT_TRUE(plan_.more_to_do()); Edge* edge = plan_.FindWork(); ASSERT_TRUE(edge); ASSERT_EQ("in", edge->inputs_[0]->path()); ASSERT_EQ("out1", edge->outputs_[0]->path()); // This will be false since poolcat is serialized ASSERT_FALSE(plan_.FindWork()); plan_.EdgeFinished(edge, Plan::kEdgeFailed); edge = plan_.FindWork(); ASSERT_TRUE(edge); ASSERT_EQ("in", edge->inputs_[0]->path()); ASSERT_EQ("out2", edge->outputs_[0]->path()); ASSERT_FALSE(plan_.FindWork()); plan_.EdgeFinished(edge, Plan::kEdgeFailed); ASSERT_TRUE(plan_.more_to_do()); // Jobs have failed edge = plan_.FindWork(); ASSERT_EQ(0, edge); } /// Fake implementation of CommandRunner, useful for tests. struct FakeCommandRunner : public CommandRunner { explicit FakeCommandRunner(VirtualFileSystem* fs) : last_command_(NULL), fs_(fs) {} // CommandRunner impl virtual bool CanRunMore(); virtual bool StartCommand(Edge* edge); virtual bool WaitForCommand(Result* result); virtual vector<Edge*> GetActiveEdges(); virtual void Abort(); vector<string> commands_ran_; Edge* last_command_; VirtualFileSystem* fs_; }; */ /* struct BuildTest : public StateTestWithBuiltinRules, public BuildLogUser { BuildTest() : config_(MakeConfig()), command_runner_(&fs_), builder_(&state_, config_, NULL, NULL, &fs_), status_(config_) { } virtual void SetUp() { StateTestWithBuiltinRules::SetUp(); builder_.command_runner_.reset(&command_runner_); AssertParse(&state_, "build cat1: cat in1\n" "build cat2: cat in1 in2\n" "build cat12: cat cat1 cat2\n"); fs_.Create("in1", ""); fs_.Create("in2", ""); } ~BuildTest() { builder_.command_runner_.release(); } virtual bool IsPathDead(StringPiece s) const { return false; } /// Rebuild target in the 'working tree' (fs_). /// State of command_runner_ and logs contents (if specified) ARE MODIFIED. /// Handy to check for NOOP builds, and higher-level rebuild tests. void RebuildTarget(const string& target, const char* manifest, const char* log_path = NULL, const char* deps_path = NULL, State* state = NULL); // Mark a path dirty. void Dirty(const string& path); BuildConfig MakeConfig() { BuildConfig config; config.verbosity = BuildConfig::QUIET; return config; } BuildConfig config_; FakeCommandRunner command_runner_; VirtualFileSystem fs_; Builder builder_; BuildStatus status_; }; void BuildTest::RebuildTarget(const string& target, const char* manifest, const char* log_path, const char* deps_path, State* state) { State local_state, *pstate = &local_state; if (state) pstate = state; ASSERT_NO_FATAL_FAILURE(AddCatRule(pstate)); AssertParse(pstate, manifest); string err; BuildLog build_log, *pbuild_log = NULL; if (log_path) { ASSERT_TRUE(build_log.Load(log_path, &err)); ASSERT_TRUE(build_log.OpenForWrite(log_path, *this, &err)); ASSERT_EQ("", err); pbuild_log = &build_log; } DepsLog deps_log, *pdeps_log = NULL; if (deps_path) { ASSERT_TRUE(deps_log.Load(deps_path, pstate, &err)); ASSERT_TRUE(deps_log.OpenForWrite(deps_path, &err)); ASSERT_EQ("", err); pdeps_log = &deps_log; } Builder builder(pstate, config_, pbuild_log, pdeps_log, &fs_); EXPECT_TRUE(builder.AddTarget(target, &err)); command_runner_.commands_ran_.clear(); builder.command_runner_.reset(&command_runner_); if (!builder.AlreadyUpToDate()) { bool build_res = builder.Build(&err); EXPECT_TRUE(build_res); } builder.command_runner_.release(); } bool FakeCommandRunner::CanRunMore() { // Only run one at a time. return last_command_ == NULL; } bool FakeCommandRunner::StartCommand(Edge* edge) { assert(!last_command_); commands_ran_.push_back(edge->EvaluateCommand()); if (edge->rule().name() == "cat" || edge->rule().name() == "cat_rsp" || edge->rule().name() == "cat_rsp_out" || edge->rule().name() == "cc" || edge->rule().name() == "touch" || edge->rule().name() == "touch-interrupt" || edge->rule().name() == "touch-fail-tick2") { for (vector<Node*>::iterator out = edge->outputs_.begin(); out != edge->outputs_.end(); ++out) { fs_->Create((*out)->path(), ""); } } else if (edge->rule().name() == "true" || edge->rule().name() == "fail" || edge->rule().name() == "interrupt" || edge->rule().name() == "console") { // Don't do anything. } else { printf("unknown command\n"); return false; } last_command_ = edge; return true; } bool FakeCommandRunner::WaitForCommand(Result* result) { if (!last_command_) return false; Edge* edge = last_command_; result->edge = edge; if (edge->rule().name() == "interrupt" || edge->rule().name() == "touch-interrupt") { result->status = ExitInterrupted; return true; } if (edge->rule().name() == "console") { if (edge->use_console()) result->status = ExitSuccess; else result->status = ExitFailure; last_command_ = NULL; return true; } if (edge->rule().name() == "fail" || (edge->rule().name() == "touch-fail-tick2" && fs_->now_ == 2)) result->status = ExitFailure; else result->status = ExitSuccess; last_command_ = NULL; return true; } vector<Edge*> FakeCommandRunner::GetActiveEdges() { vector<Edge*> edges; if (last_command_) edges.push_back(last_command_); return edges; } void FakeCommandRunner::Abort() { last_command_ = NULL; } void BuildTest::Dirty(const string& path) { Node* node = GetNode(path); node->MarkDirty(); // If it's an input file, mark that we've already stat()ed it and // it's missing. if (!node->in_edge()) node->MarkMissing(); } TEST_F(BuildTest, NoWork) { string err; EXPECT_TRUE(builder_.AlreadyUpToDate()); } TEST_F(BuildTest, OneStep) { // Given a dirty target with one ready input, // we should rebuild the target. Dirty("cat1"); string err; EXPECT_TRUE(builder_.AddTarget("cat1", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); EXPECT_EQ("cat in1 > cat1", command_runner_.commands_ran_[0]); } TEST_F(BuildTest, OneStep2) { // Given a target with one dirty input, // we should rebuild the target. Dirty("cat1"); string err; EXPECT_TRUE(builder_.AddTarget("cat1", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); EXPECT_EQ("", err); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); EXPECT_EQ("cat in1 > cat1", command_runner_.commands_ran_[0]); } TEST_F(BuildTest, TwoStep) { string err; EXPECT_TRUE(builder_.AddTarget("cat12", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); EXPECT_EQ("", err); ASSERT_EQ(3u, command_runner_.commands_ran_.size()); // Depending on how the pointers work out, we could've ran // the first two commands in either order. EXPECT_TRUE((command_runner_.commands_ran_[0] == "cat in1 > cat1" && command_runner_.commands_ran_[1] == "cat in1 in2 > cat2") || (command_runner_.commands_ran_[1] == "cat in1 > cat1" && command_runner_.commands_ran_[0] == "cat in1 in2 > cat2")); EXPECT_EQ("cat cat1 cat2 > cat12", command_runner_.commands_ran_[2]); fs_.Tick(); // Modifying in2 requires rebuilding one intermediate file // and the final file. fs_.Create("in2", ""); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("cat12", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); ASSERT_EQ(5u, command_runner_.commands_ran_.size()); EXPECT_EQ("cat in1 in2 > cat2", command_runner_.commands_ran_[3]); EXPECT_EQ("cat cat1 cat2 > cat12", command_runner_.commands_ran_[4]); } TEST_F(BuildTest, TwoOutputs) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule touch\n" " command = touch $out\n" "build out1 out2: touch in.txt\n")); fs_.Create("in.txt", ""); string err; EXPECT_TRUE(builder_.AddTarget("out1", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); EXPECT_EQ("", err); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); EXPECT_EQ("touch out1 out2", command_runner_.commands_ran_[0]); } TEST_F(BuildTest, ImplicitOutput) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule touch\n" " command = touch $out $out.imp\n" "build out | out.imp: touch in.txt\n")); fs_.Create("in.txt", ""); string err; EXPECT_TRUE(builder_.AddTarget("out.imp", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); EXPECT_EQ("", err); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); EXPECT_EQ("touch out out.imp", command_runner_.commands_ran_[0]); } // Test case from // https://github.com/ninja-build/ninja/issues/148 TEST_F(BuildTest, MultiOutIn) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule touch\n" " command = touch $out\n" "build in1 otherfile: touch in\n" "build out: touch in | in1\n")); fs_.Create("in", ""); fs_.Tick(); fs_.Create("in1", ""); string err; EXPECT_TRUE(builder_.AddTarget("out", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); EXPECT_EQ("", err); } TEST_F(BuildTest, Chain) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "build c2: cat c1\n" "build c3: cat c2\n" "build c4: cat c3\n" "build c5: cat c4\n")); fs_.Create("c1", ""); string err; EXPECT_TRUE(builder_.AddTarget("c5", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); EXPECT_EQ("", err); ASSERT_EQ(4u, command_runner_.commands_ran_.size()); err.clear(); command_runner_.commands_ran_.clear(); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("c5", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.AlreadyUpToDate()); fs_.Tick(); fs_.Create("c3", ""); err.clear(); command_runner_.commands_ran_.clear(); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("c5", &err)); ASSERT_EQ("", err); EXPECT_FALSE(builder_.AlreadyUpToDate()); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ(2u, command_runner_.commands_ran_.size()); // 3->4, 4->5 } TEST_F(BuildTest, MissingInput) { // Input is referenced by build file, but no rule for it. string err; Dirty("in1"); EXPECT_FALSE(builder_.AddTarget("cat1", &err)); EXPECT_EQ("'in1', needed by 'cat1', missing and no known rule to make it", err); } TEST_F(BuildTest, MissingTarget) { // Target is not referenced by build file. string err; EXPECT_FALSE(builder_.AddTarget("meow", &err)); EXPECT_EQ("unknown target: 'meow'", err); } TEST_F(BuildTest, MakeDirs) { string err; #ifdef _WIN32 ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "build subdir\\dir2\\file: cat in1\n")); #else ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "build subdir/dir2/file: cat in1\n")); #endif EXPECT_TRUE(builder_.AddTarget("subdir/dir2/file", &err)); EXPECT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); ASSERT_EQ(2u, fs_.directories_made_.size()); EXPECT_EQ("subdir", fs_.directories_made_[0]); EXPECT_EQ("subdir/dir2", fs_.directories_made_[1]); } TEST_F(BuildTest, DepFileMissing) { string err; ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule cc\n command = cc $in\n depfile = $out.d\n" "build fo$ o.o: cc foo.c\n")); fs_.Create("foo.c", ""); EXPECT_TRUE(builder_.AddTarget("fo o.o", &err)); ASSERT_EQ("", err); ASSERT_EQ(1u, fs_.files_read_.size()); EXPECT_EQ("fo o.o.d", fs_.files_read_[0]); } TEST_F(BuildTest, DepFileOK) { string err; int orig_edges = state_.edges_.size(); ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule cc\n command = cc $in\n depfile = $out.d\n" "build foo.o: cc foo.c\n")); Edge* edge = state_.edges_.back(); fs_.Create("foo.c", ""); GetNode("bar.h")->MarkDirty(); // Mark bar.h as missing. fs_.Create("foo.o.d", "foo.o: blah.h bar.h\n"); EXPECT_TRUE(builder_.AddTarget("foo.o", &err)); ASSERT_EQ("", err); ASSERT_EQ(1u, fs_.files_read_.size()); EXPECT_EQ("foo.o.d", fs_.files_read_[0]); // Expect three new edges: one generating foo.o, and two more from // loading the depfile. ASSERT_EQ(orig_edges + 3, (int)state_.edges_.size()); // Expect our edge to now have three inputs: foo.c and two headers. ASSERT_EQ(3u, edge->inputs_.size()); // Expect the command line we generate to only use the original input. ASSERT_EQ("cc foo.c", edge->EvaluateCommand()); } TEST_F(BuildTest, DepFileParseError) { string err; ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule cc\n command = cc $in\n depfile = $out.d\n" "build foo.o: cc foo.c\n")); fs_.Create("foo.c", ""); fs_.Create("foo.o.d", "randomtext\n"); EXPECT_FALSE(builder_.AddTarget("foo.o", &err)); EXPECT_EQ("foo.o.d: expected ':' in depfile", err); } TEST_F(BuildTest, EncounterReadyTwice) { string err; ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule touch\n" " command = touch $out\n" "build c: touch\n" "build b: touch || c\n" "build a: touch | b || c\n")); vector<Edge*> c_out = GetNode("c")->out_edges(); ASSERT_EQ(2u, c_out.size()); EXPECT_EQ("b", c_out[0]->outputs_[0]->path()); EXPECT_EQ("a", c_out[1]->outputs_[0]->path()); fs_.Create("b", ""); EXPECT_TRUE(builder_.AddTarget("a", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); ASSERT_EQ(2u, command_runner_.commands_ran_.size()); } TEST_F(BuildTest, OrderOnlyDeps) { string err; ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule cc\n command = cc $in\n depfile = $out.d\n" "build foo.o: cc foo.c || otherfile\n")); Edge* edge = state_.edges_.back(); fs_.Create("foo.c", ""); fs_.Create("otherfile", ""); fs_.Create("foo.o.d", "foo.o: blah.h bar.h\n"); EXPECT_TRUE(builder_.AddTarget("foo.o", &err)); ASSERT_EQ("", err); // One explicit, two implicit, one order only. ASSERT_EQ(4u, edge->inputs_.size()); EXPECT_EQ(2, edge->implicit_deps_); EXPECT_EQ(1, edge->order_only_deps_); // Verify the inputs are in the order we expect // (explicit then implicit then orderonly). EXPECT_EQ("foo.c", edge->inputs_[0]->path()); EXPECT_EQ("blah.h", edge->inputs_[1]->path()); EXPECT_EQ("bar.h", edge->inputs_[2]->path()); EXPECT_EQ("otherfile", edge->inputs_[3]->path()); // Expect the command line we generate to only use the original input. ASSERT_EQ("cc foo.c", edge->EvaluateCommand()); // explicit dep dirty, expect a rebuild. EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); fs_.Tick(); // Recreate the depfile, as it should have been deleted by the build. fs_.Create("foo.o.d", "foo.o: blah.h bar.h\n"); // implicit dep dirty, expect a rebuild. fs_.Create("blah.h", ""); fs_.Create("bar.h", ""); command_runner_.commands_ran_.clear(); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("foo.o", &err)); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); fs_.Tick(); // Recreate the depfile, as it should have been deleted by the build. fs_.Create("foo.o.d", "foo.o: blah.h bar.h\n"); // order only dep dirty, no rebuild. fs_.Create("otherfile", ""); command_runner_.commands_ran_.clear(); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("foo.o", &err)); EXPECT_EQ("", err); EXPECT_TRUE(builder_.AlreadyUpToDate()); // implicit dep missing, expect rebuild. fs_.RemoveFile("bar.h"); command_runner_.commands_ran_.clear(); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("foo.o", &err)); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); } TEST_F(BuildTest, RebuildOrderOnlyDeps) { string err; ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule cc\n command = cc $in\n" "rule true\n command = true\n" "build oo.h: cc oo.h.in\n" "build foo.o: cc foo.c || oo.h\n")); fs_.Create("foo.c", ""); fs_.Create("oo.h.in", ""); // foo.o and order-only dep dirty, build both. EXPECT_TRUE(builder_.AddTarget("foo.o", &err)); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); ASSERT_EQ(2u, command_runner_.commands_ran_.size()); // all clean, no rebuild. command_runner_.commands_ran_.clear(); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("foo.o", &err)); EXPECT_EQ("", err); EXPECT_TRUE(builder_.AlreadyUpToDate()); // order-only dep missing, build it only. fs_.RemoveFile("oo.h"); command_runner_.commands_ran_.clear(); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("foo.o", &err)); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); ASSERT_EQ("cc oo.h.in", command_runner_.commands_ran_[0]); fs_.Tick(); // order-only dep dirty, build it only. fs_.Create("oo.h.in", ""); command_runner_.commands_ran_.clear(); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("foo.o", &err)); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); ASSERT_EQ("cc oo.h.in", command_runner_.commands_ran_[0]); } #ifdef _WIN32 TEST_F(BuildTest, DepFileCanonicalize) { string err; int orig_edges = state_.edges_.size(); ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule cc\n command = cc $in\n depfile = $out.d\n" "build gen/stuff\\things/foo.o: cc x\\y/z\\foo.c\n")); Edge* edge = state_.edges_.back(); fs_.Create("x/y/z/foo.c", ""); GetNode("bar.h")->MarkDirty(); // Mark bar.h as missing. // Note, different slashes from manifest. fs_.Create("gen/stuff\\things/foo.o.d", "gen\\stuff\\things\\foo.o: blah.h bar.h\n"); EXPECT_TRUE(builder_.AddTarget("gen/stuff/things/foo.o", &err)); ASSERT_EQ("", err); ASSERT_EQ(1u, fs_.files_read_.size()); // The depfile path does not get Canonicalize as it seems unnecessary. EXPECT_EQ("gen/stuff\\things/foo.o.d", fs_.files_read_[0]); // Expect three new edges: one generating foo.o, and two more from // loading the depfile. ASSERT_EQ(orig_edges + 3, (int)state_.edges_.size()); // Expect our edge to now have three inputs: foo.c and two headers. ASSERT_EQ(3u, edge->inputs_.size()); // Expect the command line we generate to only use the original input, and // using the slashes from the manifest. ASSERT_EQ("cc x\\y/z\\foo.c", edge->EvaluateCommand()); } #endif TEST_F(BuildTest, Phony) { string err; ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "build out: cat bar.cc\n" "build all: phony out\n")); fs_.Create("bar.cc", ""); EXPECT_TRUE(builder_.AddTarget("all", &err)); ASSERT_EQ("", err); // Only one command to run, because phony runs no command. EXPECT_FALSE(builder_.AlreadyUpToDate()); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); } TEST_F(BuildTest, PhonyNoWork) { string err; ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "build out: cat bar.cc\n" "build all: phony out\n")); fs_.Create("bar.cc", ""); fs_.Create("out", ""); EXPECT_TRUE(builder_.AddTarget("all", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.AlreadyUpToDate()); } // Test a self-referencing phony. Ideally this should not work, but // ninja 1.7 and below tolerated and CMake 2.8.12.x and 3.0.x both // incorrectly produce it. We tolerate it for compatibility. TEST_F(BuildTest, PhonySelfReference) { string err; ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "build a: phony a\n")); EXPECT_TRUE(builder_.AddTarget("a", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.AlreadyUpToDate()); } TEST_F(BuildTest, Fail) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule fail\n" " command = fail\n" "build out1: fail\n")); string err; EXPECT_TRUE(builder_.AddTarget("out1", &err)); ASSERT_EQ("", err); EXPECT_FALSE(builder_.Build(&err)); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); ASSERT_EQ("subcommand failed", err); } TEST_F(BuildTest, SwallowFailures) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule fail\n" " command = fail\n" "build out1: fail\n" "build out2: fail\n" "build out3: fail\n" "build all: phony out1 out2 out3\n")); // Swallow two failures, die on the third. config_.failures_allowed = 3; string err; EXPECT_TRUE(builder_.AddTarget("all", &err)); ASSERT_EQ("", err); EXPECT_FALSE(builder_.Build(&err)); ASSERT_EQ(3u, command_runner_.commands_ran_.size()); ASSERT_EQ("subcommands failed", err); } TEST_F(BuildTest, SwallowFailuresLimit) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule fail\n" " command = fail\n" "build out1: fail\n" "build out2: fail\n" "build out3: fail\n" "build final: cat out1 out2 out3\n")); // Swallow ten failures; we should stop before building final. config_.failures_allowed = 11; string err; EXPECT_TRUE(builder_.AddTarget("final", &err)); ASSERT_EQ("", err); EXPECT_FALSE(builder_.Build(&err)); ASSERT_EQ(3u, command_runner_.commands_ran_.size()); ASSERT_EQ("cannot make progress due to previous errors", err); } TEST_F(BuildTest, SwallowFailuresPool) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "pool failpool\n" " depth = 1\n" "rule fail\n" " command = fail\n" " pool = failpool\n" "build out1: fail\n" "build out2: fail\n" "build out3: fail\n" "build final: cat out1 out2 out3\n")); // Swallow ten failures; we should stop before building final. config_.failures_allowed = 11; string err; EXPECT_TRUE(builder_.AddTarget("final", &err)); ASSERT_EQ("", err); EXPECT_FALSE(builder_.Build(&err)); ASSERT_EQ(3u, command_runner_.commands_ran_.size()); ASSERT_EQ("cannot make progress due to previous errors", err); } TEST_F(BuildTest, PoolEdgesReadyButNotWanted) { fs_.Create("x", ""); const char* manifest = "pool some_pool\n" " depth = 4\n" "rule touch\n" " command = touch $out\n" " pool = some_pool\n" "rule cc\n" " command = touch grit\n" "\n" "build B.d.stamp: cc | x\n" "build C.stamp: touch B.d.stamp\n" "build final.stamp: touch || C.stamp\n"; RebuildTarget("final.stamp", manifest); fs_.RemoveFile("B.d.stamp"); State save_state; RebuildTarget("final.stamp", manifest, NULL, NULL, &save_state); EXPECT_GE(save_state.LookupPool("some_pool")->current_use(), 0); } struct BuildWithLogTest : public BuildTest { BuildWithLogTest() { builder_.SetBuildLog(&build_log_); } BuildLog build_log_; }; TEST_F(BuildWithLogTest, NotInLogButOnDisk) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule cc\n" " command = cc\n" "build out1: cc in\n")); // Create input/output that would be considered up to date when // not considering the command line hash. fs_.Create("in", ""); fs_.Create("out1", ""); string err; // Because it's not in the log, it should not be up-to-date until // we build again. EXPECT_TRUE(builder_.AddTarget("out1", &err)); EXPECT_FALSE(builder_.AlreadyUpToDate()); command_runner_.commands_ran_.clear(); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("out1", &err)); EXPECT_TRUE(builder_.Build(&err)); EXPECT_TRUE(builder_.AlreadyUpToDate()); } TEST_F(BuildWithLogTest, RebuildAfterFailure) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule touch-fail-tick2\n" " command = touch-fail-tick2\n" "build out1: touch-fail-tick2 in\n")); string err; fs_.Create("in", ""); // Run once successfully to get out1 in the log EXPECT_TRUE(builder_.AddTarget("out1", &err)); EXPECT_TRUE(builder_.Build(&err)); EXPECT_EQ("", err); EXPECT_EQ(1u, command_runner_.commands_ran_.size()); command_runner_.commands_ran_.clear(); state_.Reset(); builder_.Cleanup(); builder_.plan_.Reset(); fs_.Tick(); fs_.Create("in", ""); // Run again with a failure that updates the output file timestamp EXPECT_TRUE(builder_.AddTarget("out1", &err)); EXPECT_FALSE(builder_.Build(&err)); EXPECT_EQ("subcommand failed", err); EXPECT_EQ(1u, command_runner_.commands_ran_.size()); command_runner_.commands_ran_.clear(); state_.Reset(); builder_.Cleanup(); builder_.plan_.Reset(); fs_.Tick(); // Run again, should rerun even though the output file is up to date on disk EXPECT_TRUE(builder_.AddTarget("out1", &err)); EXPECT_FALSE(builder_.AlreadyUpToDate()); EXPECT_TRUE(builder_.Build(&err)); EXPECT_EQ(1u, command_runner_.commands_ran_.size()); EXPECT_EQ("", err); } TEST_F(BuildWithLogTest, RebuildWithNoInputs) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule touch\n" " command = touch\n" "build out1: touch\n" "build out2: touch in\n")); string err; fs_.Create("in", ""); EXPECT_TRUE(builder_.AddTarget("out1", &err)); EXPECT_TRUE(builder_.AddTarget("out2", &err)); EXPECT_TRUE(builder_.Build(&err)); EXPECT_EQ("", err); EXPECT_EQ(2u, command_runner_.commands_ran_.size()); command_runner_.commands_ran_.clear(); state_.Reset(); fs_.Tick(); fs_.Create("in", ""); EXPECT_TRUE(builder_.AddTarget("out1", &err)); EXPECT_TRUE(builder_.AddTarget("out2", &err)); EXPECT_TRUE(builder_.Build(&err)); EXPECT_EQ("", err); EXPECT_EQ(1u, command_runner_.commands_ran_.size()); } TEST_F(BuildWithLogTest, RestatTest) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule true\n" " command = true\n" " restat = 1\n" "rule cc\n" " command = cc\n" " restat = 1\n" "build out1: cc in\n" "build out2: true out1\n" "build out3: cat out2\n")); fs_.Create("out1", ""); fs_.Create("out2", ""); fs_.Create("out3", ""); fs_.Tick(); fs_.Create("in", ""); // Do a pre-build so that there's commands in the log for the outputs, // otherwise, the lack of an entry in the build log will cause out3 to rebuild // regardless of restat. string err; EXPECT_TRUE(builder_.AddTarget("out3", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); EXPECT_EQ("[3/3]", builder_.status_->FormatProgressStatus("[%s/%t]", BuildStatus::kEdgeStarted)); command_runner_.commands_ran_.clear(); state_.Reset(); fs_.Tick(); fs_.Create("in", ""); // "cc" touches out1, so we should build out2. But because "true" does not // touch out2, we should cancel the build of out3. EXPECT_TRUE(builder_.AddTarget("out3", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ(2u, command_runner_.commands_ran_.size()); // If we run again, it should be a no-op, because the build log has recorded // that we've already built out2 with an input timestamp of 2 (from out1). command_runner_.commands_ran_.clear(); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("out3", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.AlreadyUpToDate()); fs_.Tick(); fs_.Create("in", ""); // The build log entry should not, however, prevent us from rebuilding out2 // if out1 changes. command_runner_.commands_ran_.clear(); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("out3", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ(2u, command_runner_.commands_ran_.size()); } TEST_F(BuildWithLogTest, RestatMissingFile) { // If a restat rule doesn't create its output, and the output didn't // exist before the rule was run, consider that behavior equivalent // to a rule that doesn't modify its existent output file. ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule true\n" " command = true\n" " restat = 1\n" "rule cc\n" " command = cc\n" "build out1: true in\n" "build out2: cc out1\n")); fs_.Create("in", ""); fs_.Create("out2", ""); // Do a pre-build so that there's commands in the log for the outputs, // otherwise, the lack of an entry in the build log will cause out2 to rebuild // regardless of restat. string err; EXPECT_TRUE(builder_.AddTarget("out2", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); command_runner_.commands_ran_.clear(); state_.Reset(); fs_.Tick(); fs_.Create("in", ""); fs_.Create("out2", ""); // Run a build, expect only the first command to run. // It doesn't touch its output (due to being the "true" command), so // we shouldn't run the dependent build. EXPECT_TRUE(builder_.AddTarget("out2", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); } TEST_F(BuildWithLogTest, RestatSingleDependentOutputDirty) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule true\n" " command = true\n" " restat = 1\n" "rule touch\n" " command = touch\n" "build out1: true in\n" "build out2 out3: touch out1\n" "build out4: touch out2\n" )); // Create the necessary files fs_.Create("in", ""); string err; EXPECT_TRUE(builder_.AddTarget("out4", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); ASSERT_EQ(3u, command_runner_.commands_ran_.size()); fs_.Tick(); fs_.Create("in", ""); fs_.RemoveFile("out3"); // Since "in" is missing, out1 will be built. Since "out3" is missing, // out2 and out3 will be built even though "in" is not touched when built. // Then, since out2 is rebuilt, out4 should be rebuilt -- the restat on the // "true" rule should not lead to the "touch" edge writing out2 and out3 being // cleard. command_runner_.commands_ran_.clear(); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("out4", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ("", err); ASSERT_EQ(3u, command_runner_.commands_ran_.size()); } // Test scenario, in which an input file is removed, but output isn't changed // https://github.com/ninja-build/ninja/issues/295 TEST_F(BuildWithLogTest, RestatMissingInput) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule true\n" " command = true\n" " depfile = $out.d\n" " restat = 1\n" "rule cc\n" " command = cc\n" "build out1: true in\n" "build out2: cc out1\n")); // Create all necessary files fs_.Create("in", ""); // The implicit dependencies and the depfile itself // are newer than the output TimeStamp restat_mtime = fs_.Tick(); fs_.Create("out1.d", "out1: will.be.deleted restat.file\n"); fs_.Create("will.be.deleted", ""); fs_.Create("restat.file", ""); // Run the build, out1 and out2 get built string err; EXPECT_TRUE(builder_.AddTarget("out2", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ(2u, command_runner_.commands_ran_.size()); // See that an entry in the logfile is created, capturing // the right mtime BuildLog::LogEntry* log_entry = build_log_.LookupByOutput("out1"); ASSERT_TRUE(NULL != log_entry); ASSERT_EQ(restat_mtime, log_entry->mtime); // Now remove a file, referenced from depfile, so that target becomes // dirty, but the output does not change fs_.RemoveFile("will.be.deleted"); // Trigger the build again - only out1 gets built command_runner_.commands_ran_.clear(); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("out2", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); // Check that the logfile entry remains correctly set log_entry = build_log_.LookupByOutput("out1"); ASSERT_TRUE(NULL != log_entry); ASSERT_EQ(restat_mtime, log_entry->mtime); } struct BuildDryRun : public BuildWithLogTest { BuildDryRun() { config_.dry_run = true; } }; TEST_F(BuildDryRun, AllCommandsShown) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule true\n" " command = true\n" " restat = 1\n" "rule cc\n" " command = cc\n" " restat = 1\n" "build out1: cc in\n" "build out2: true out1\n" "build out3: cat out2\n")); fs_.Create("out1", ""); fs_.Create("out2", ""); fs_.Create("out3", ""); fs_.Tick(); fs_.Create("in", ""); // "cc" touches out1, so we should build out2. But because "true" does not // touch out2, we should cancel the build of out3. string err; EXPECT_TRUE(builder_.AddTarget("out3", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ(3u, command_runner_.commands_ran_.size()); } // Test that RSP files are created when & where appropriate and deleted after // successful execution. TEST_F(BuildTest, RspFileSuccess) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule cat_rsp\n" " command = cat $rspfile > $out\n" " rspfile = $rspfile\n" " rspfile_content = $long_command\n" "rule cat_rsp_out\n" " command = cat $rspfile > $out\n" " rspfile = $out.rsp\n" " rspfile_content = $long_command\n" "build out1: cat in\n" "build out2: cat_rsp in\n" " rspfile = out 2.rsp\n" " long_command = Some very long command\n" "build out$ 3: cat_rsp_out in\n" " long_command = Some very long command\n")); fs_.Create("out1", ""); fs_.Create("out2", ""); fs_.Create("out 3", ""); fs_.Tick(); fs_.Create("in", ""); string err; EXPECT_TRUE(builder_.AddTarget("out1", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.AddTarget("out2", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.AddTarget("out 3", &err)); ASSERT_EQ("", err); size_t files_created = fs_.files_created_.size(); size_t files_removed = fs_.files_removed_.size(); EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ(3u, command_runner_.commands_ran_.size()); // The RSP files were created ASSERT_EQ(files_created + 2, fs_.files_created_.size()); ASSERT_EQ(1u, fs_.files_created_.count("out 2.rsp")); ASSERT_EQ(1u, fs_.files_created_.count("out 3.rsp")); // The RSP files were removed ASSERT_EQ(files_removed + 2, fs_.files_removed_.size()); ASSERT_EQ(1u, fs_.files_removed_.count("out 2.rsp")); ASSERT_EQ(1u, fs_.files_removed_.count("out 3.rsp")); } // Test that RSP file is created but not removed for commands, which fail TEST_F(BuildTest, RspFileFailure) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule fail\n" " command = fail\n" " rspfile = $rspfile\n" " rspfile_content = $long_command\n" "build out: fail in\n" " rspfile = out.rsp\n" " long_command = Another very long command\n")); fs_.Create("out", ""); fs_.Tick(); fs_.Create("in", ""); string err; EXPECT_TRUE(builder_.AddTarget("out", &err)); ASSERT_EQ("", err); size_t files_created = fs_.files_created_.size(); size_t files_removed = fs_.files_removed_.size(); EXPECT_FALSE(builder_.Build(&err)); ASSERT_EQ("subcommand failed", err); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); // The RSP file was created ASSERT_EQ(files_created + 1, fs_.files_created_.size()); ASSERT_EQ(1u, fs_.files_created_.count("out.rsp")); // The RSP file was NOT removed ASSERT_EQ(files_removed, fs_.files_removed_.size()); ASSERT_EQ(0u, fs_.files_removed_.count("out.rsp")); // The RSP file contains what it should ASSERT_EQ("Another very long command", fs_.files_["out.rsp"].contents); } // Test that contents of the RSP file behaves like a regular part of // command line, i.e. triggers a rebuild if changed TEST_F(BuildWithLogTest, RspFileCmdLineChange) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule cat_rsp\n" " command = cat $rspfile > $out\n" " rspfile = $rspfile\n" " rspfile_content = $long_command\n" "build out: cat_rsp in\n" " rspfile = out.rsp\n" " long_command = Original very long command\n")); fs_.Create("out", ""); fs_.Tick(); fs_.Create("in", ""); string err; EXPECT_TRUE(builder_.AddTarget("out", &err)); ASSERT_EQ("", err); // 1. Build for the 1st time (-> populate log) EXPECT_TRUE(builder_.Build(&err)); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); // 2. Build again (no change) command_runner_.commands_ran_.clear(); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("out", &err)); EXPECT_EQ("", err); ASSERT_TRUE(builder_.AlreadyUpToDate()); // 3. Alter the entry in the logfile // (to simulate a change in the command line between 2 builds) BuildLog::LogEntry* log_entry = build_log_.LookupByOutput("out"); ASSERT_TRUE(NULL != log_entry); ASSERT_NO_FATAL_FAILURE(AssertHash( "cat out.rsp > out;rspfile=Original very long command", log_entry->command_hash)); log_entry->command_hash++; // Change the command hash to something else. // Now expect the target to be rebuilt command_runner_.commands_ran_.clear(); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("out", &err)); EXPECT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); EXPECT_EQ(1u, command_runner_.commands_ran_.size()); } TEST_F(BuildTest, InterruptCleanup) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule interrupt\n" " command = interrupt\n" "rule touch-interrupt\n" " command = touch-interrupt\n" "build out1: interrupt in1\n" "build out2: touch-interrupt in2\n")); fs_.Create("out1", ""); fs_.Create("out2", ""); fs_.Tick(); fs_.Create("in1", ""); fs_.Create("in2", ""); // An untouched output of an interrupted command should be retained. string err; EXPECT_TRUE(builder_.AddTarget("out1", &err)); EXPECT_EQ("", err); EXPECT_FALSE(builder_.Build(&err)); EXPECT_EQ("interrupted by user", err); builder_.Cleanup(); EXPECT_GT(fs_.Stat("out1", &err), 0); err = ""; // A touched output of an interrupted command should be deleted. EXPECT_TRUE(builder_.AddTarget("out2", &err)); EXPECT_EQ("", err); EXPECT_FALSE(builder_.Build(&err)); EXPECT_EQ("interrupted by user", err); builder_.Cleanup(); EXPECT_EQ(0, fs_.Stat("out2", &err)); } TEST_F(BuildTest, StatFailureAbortsBuild) { const string kTooLongToStat(400, 'i'); ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, ("build " + kTooLongToStat + ": cat in\n").c_str())); fs_.Create("in", ""); // This simulates a stat failure: fs_.files_[kTooLongToStat].mtime = -1; fs_.files_[kTooLongToStat].stat_error = "stat failed"; string err; EXPECT_FALSE(builder_.AddTarget(kTooLongToStat, &err)); EXPECT_EQ("stat failed", err); } TEST_F(BuildTest, PhonyWithNoInputs) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "build nonexistent: phony\n" "build out1: cat || nonexistent\n" "build out2: cat nonexistent\n")); fs_.Create("out1", ""); fs_.Create("out2", ""); // out1 should be up to date even though its input is dirty, because its // order-only dependency has nothing to do. string err; EXPECT_TRUE(builder_.AddTarget("out1", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.AlreadyUpToDate()); // out2 should still be out of date though, because its input is dirty. err.clear(); command_runner_.commands_ran_.clear(); state_.Reset(); EXPECT_TRUE(builder_.AddTarget("out2", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); EXPECT_EQ("", err); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); } TEST_F(BuildTest, DepsGccWithEmptyDepfileErrorsOut) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule cc\n" " command = cc\n" " deps = gcc\n" "build out: cc\n")); Dirty("out"); string err; EXPECT_TRUE(builder_.AddTarget("out", &err)); ASSERT_EQ("", err); EXPECT_FALSE(builder_.AlreadyUpToDate()); EXPECT_FALSE(builder_.Build(&err)); ASSERT_EQ("subcommand failed", err); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); } TEST_F(BuildTest, StatusFormatElapsed) { status_.BuildStarted(); // Before any task is done, the elapsed time must be zero. EXPECT_EQ("[%/e0.000]", status_.FormatProgressStatus("[%%/e%e]", BuildStatus::kEdgeStarted)); } TEST_F(BuildTest, StatusFormatReplacePlaceholder) { EXPECT_EQ("[%/s0/t0/r0/u0/f0]", status_.FormatProgressStatus("[%%/s%s/t%t/r%r/u%u/f%f]", BuildStatus::kEdgeStarted)); } TEST_F(BuildTest, FailedDepsParse) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "build bad_deps.o: cat in1\n" " deps = gcc\n" " depfile = in1.d\n")); string err; EXPECT_TRUE(builder_.AddTarget("bad_deps.o", &err)); ASSERT_EQ("", err); // These deps will fail to parse, as they should only have one // path to the left of the colon. fs_.Create("in1.d", "AAA BBB"); EXPECT_FALSE(builder_.Build(&err)); EXPECT_EQ("subcommand failed", err); } /// Tests of builds involving deps logs necessarily must span /// multiple builds. We reuse methods on BuildTest but not the /// builder_ it sets up, because we want pristine objects for /// each build. struct BuildWithDepsLogTest : public BuildTest { BuildWithDepsLogTest() {} virtual void SetUp() { BuildTest::SetUp(); temp_dir_.CreateAndEnter("BuildWithDepsLogTest"); } virtual void TearDown() { temp_dir_.Cleanup(); } ScopedTempDir temp_dir_; /// Shadow parent class builder_ so we don't accidentally use it. void* builder_; }; /// Run a straightforwad build where the deps log is used. TEST_F(BuildWithDepsLogTest, Straightforward) { string err; // Note: in1 was created by the superclass SetUp(). const char* manifest = "build out: cat in1\n" " deps = gcc\n" " depfile = in1.d\n"; { State state; ASSERT_NO_FATAL_FAILURE(AddCatRule(&state)); ASSERT_NO_FATAL_FAILURE(AssertParse(&state, manifest)); // Run the build once, everything should be ok. DepsLog deps_log; ASSERT_TRUE(deps_log.OpenForWrite("ninja_deps", &err)); ASSERT_EQ("", err); Builder builder(&state, config_, NULL, &deps_log, &fs_); builder.command_runner_.reset(&command_runner_); EXPECT_TRUE(builder.AddTarget("out", &err)); ASSERT_EQ("", err); fs_.Create("in1.d", "out: in2"); EXPECT_TRUE(builder.Build(&err)); EXPECT_EQ("", err); // The deps file should have been removed. EXPECT_EQ(0, fs_.Stat("in1.d", &err)); // Recreate it for the next step. fs_.Create("in1.d", "out: in2"); deps_log.Close(); builder.command_runner_.release(); } { State state; ASSERT_NO_FATAL_FAILURE(AddCatRule(&state)); ASSERT_NO_FATAL_FAILURE(AssertParse(&state, manifest)); // Touch the file only mentioned in the deps. fs_.Tick(); fs_.Create("in2", ""); // Run the build again. DepsLog deps_log; ASSERT_TRUE(deps_log.Load("ninja_deps", &state, &err)); ASSERT_TRUE(deps_log.OpenForWrite("ninja_deps", &err)); Builder builder(&state, config_, NULL, &deps_log, &fs_); builder.command_runner_.reset(&command_runner_); command_runner_.commands_ran_.clear(); EXPECT_TRUE(builder.AddTarget("out", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder.Build(&err)); EXPECT_EQ("", err); // We should have rebuilt the output due to in2 being // out of date. EXPECT_EQ(1u, command_runner_.commands_ran_.size()); builder.command_runner_.release(); } } /// Verify that obsolete dependency info causes a rebuild. /// 1) Run a successful build where everything has time t, record deps. /// 2) Move input/output to time t+1 -- despite files in alignment, /// should still need to rebuild due to deps at older time. TEST_F(BuildWithDepsLogTest, ObsoleteDeps) { string err; // Note: in1 was created by the superclass SetUp(). const char* manifest = "build out: cat in1\n" " deps = gcc\n" " depfile = in1.d\n"; { // Run an ordinary build that gathers dependencies. fs_.Create("in1", ""); fs_.Create("in1.d", "out: "); State state; ASSERT_NO_FATAL_FAILURE(AddCatRule(&state)); ASSERT_NO_FATAL_FAILURE(AssertParse(&state, manifest)); // Run the build once, everything should be ok. DepsLog deps_log; ASSERT_TRUE(deps_log.OpenForWrite("ninja_deps", &err)); ASSERT_EQ("", err); Builder builder(&state, config_, NULL, &deps_log, &fs_); builder.command_runner_.reset(&command_runner_); EXPECT_TRUE(builder.AddTarget("out", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder.Build(&err)); EXPECT_EQ("", err); deps_log.Close(); builder.command_runner_.release(); } // Push all files one tick forward so that only the deps are out // of date. fs_.Tick(); fs_.Create("in1", ""); fs_.Create("out", ""); // The deps file should have been removed, so no need to timestamp it. EXPECT_EQ(0, fs_.Stat("in1.d", &err)); { State state; ASSERT_NO_FATAL_FAILURE(AddCatRule(&state)); ASSERT_NO_FATAL_FAILURE(AssertParse(&state, manifest)); DepsLog deps_log; ASSERT_TRUE(deps_log.Load("ninja_deps", &state, &err)); ASSERT_TRUE(deps_log.OpenForWrite("ninja_deps", &err)); Builder builder(&state, config_, NULL, &deps_log, &fs_); builder.command_runner_.reset(&command_runner_); command_runner_.commands_ran_.clear(); EXPECT_TRUE(builder.AddTarget("out", &err)); ASSERT_EQ("", err); // Recreate the deps file here because the build expects them to exist. fs_.Create("in1.d", "out: "); EXPECT_TRUE(builder.Build(&err)); EXPECT_EQ("", err); // We should have rebuilt the output due to the deps being // out of date. EXPECT_EQ(1u, command_runner_.commands_ran_.size()); builder.command_runner_.release(); } } TEST_F(BuildWithDepsLogTest, DepsIgnoredInDryRun) { const char* manifest = "build out: cat in1\n" " deps = gcc\n" " depfile = in1.d\n"; fs_.Create("out", ""); fs_.Tick(); fs_.Create("in1", ""); State state; ASSERT_NO_FATAL_FAILURE(AddCatRule(&state)); ASSERT_NO_FATAL_FAILURE(AssertParse(&state, manifest)); // The deps log is NULL in dry runs. config_.dry_run = true; Builder builder(&state, config_, NULL, NULL, &fs_); builder.command_runner_.reset(&command_runner_); command_runner_.commands_ran_.clear(); string err; EXPECT_TRUE(builder.AddTarget("out", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder.Build(&err)); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); builder.command_runner_.release(); } /// Check that a restat rule generating a header cancels compilations correctly. TEST_F(BuildTest, RestatDepfileDependency) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule true\n" " command = true\n" // Would be "write if out-of-date" in reality. " restat = 1\n" "build header.h: true header.in\n" "build out: cat in1\n" " depfile = in1.d\n")); fs_.Create("header.h", ""); fs_.Create("in1.d", "out: header.h"); fs_.Tick(); fs_.Create("header.in", ""); string err; EXPECT_TRUE(builder_.AddTarget("out", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); EXPECT_EQ("", err); } /// Check that a restat rule generating a header cancels compilations correctly, /// depslog case. TEST_F(BuildWithDepsLogTest, RestatDepfileDependencyDepsLog) { string err; // Note: in1 was created by the superclass SetUp(). const char* manifest = "rule true\n" " command = true\n" // Would be "write if out-of-date" in reality. " restat = 1\n" "build header.h: true header.in\n" "build out: cat in1\n" " deps = gcc\n" " depfile = in1.d\n"; { State state; ASSERT_NO_FATAL_FAILURE(AddCatRule(&state)); ASSERT_NO_FATAL_FAILURE(AssertParse(&state, manifest)); // Run the build once, everything should be ok. DepsLog deps_log; ASSERT_TRUE(deps_log.OpenForWrite("ninja_deps", &err)); ASSERT_EQ("", err); Builder builder(&state, config_, NULL, &deps_log, &fs_); builder.command_runner_.reset(&command_runner_); EXPECT_TRUE(builder.AddTarget("out", &err)); ASSERT_EQ("", err); fs_.Create("in1.d", "out: header.h"); EXPECT_TRUE(builder.Build(&err)); EXPECT_EQ("", err); deps_log.Close(); builder.command_runner_.release(); } { State state; ASSERT_NO_FATAL_FAILURE(AddCatRule(&state)); ASSERT_NO_FATAL_FAILURE(AssertParse(&state, manifest)); // Touch the input of the restat rule. fs_.Tick(); fs_.Create("header.in", ""); // Run the build again. DepsLog deps_log; ASSERT_TRUE(deps_log.Load("ninja_deps", &state, &err)); ASSERT_TRUE(deps_log.OpenForWrite("ninja_deps", &err)); Builder builder(&state, config_, NULL, &deps_log, &fs_); builder.command_runner_.reset(&command_runner_); command_runner_.commands_ran_.clear(); EXPECT_TRUE(builder.AddTarget("out", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder.Build(&err)); EXPECT_EQ("", err); // Rule "true" should have run again, but the build of "out" should have // been cancelled due to restat propagating through the depfile header. EXPECT_EQ(1u, command_runner_.commands_ran_.size()); builder.command_runner_.release(); } } TEST_F(BuildWithDepsLogTest, DepFileOKDepsLog) { string err; const char* manifest = "rule cc\n command = cc $in\n depfile = $out.d\n deps = gcc\n" "build fo$ o.o: cc foo.c\n"; fs_.Create("foo.c", ""); { State state; ASSERT_NO_FATAL_FAILURE(AssertParse(&state, manifest)); // Run the build once, everything should be ok. DepsLog deps_log; ASSERT_TRUE(deps_log.OpenForWrite("ninja_deps", &err)); ASSERT_EQ("", err); Builder builder(&state, config_, NULL, &deps_log, &fs_); builder.command_runner_.reset(&command_runner_); EXPECT_TRUE(builder.AddTarget("fo o.o", &err)); ASSERT_EQ("", err); fs_.Create("fo o.o.d", "fo\\ o.o: blah.h bar.h\n"); EXPECT_TRUE(builder.Build(&err)); EXPECT_EQ("", err); deps_log.Close(); builder.command_runner_.release(); } { State state; ASSERT_NO_FATAL_FAILURE(AssertParse(&state, manifest)); DepsLog deps_log; ASSERT_TRUE(deps_log.Load("ninja_deps", &state, &err)); ASSERT_TRUE(deps_log.OpenForWrite("ninja_deps", &err)); ASSERT_EQ("", err); Builder builder(&state, config_, NULL, &deps_log, &fs_); builder.command_runner_.reset(&command_runner_); Edge* edge = state.edges_.back(); state.GetNode("bar.h", 0)->MarkDirty(); // Mark bar.h as missing. EXPECT_TRUE(builder.AddTarget("fo o.o", &err)); ASSERT_EQ("", err); // Expect three new edges: one generating fo o.o, and two more from // loading the depfile. ASSERT_EQ(3u, state.edges_.size()); // Expect our edge to now have three inputs: foo.c and two headers. ASSERT_EQ(3u, edge->inputs_.size()); // Expect the command line we generate to only use the original input. ASSERT_EQ("cc foo.c", edge->EvaluateCommand()); deps_log.Close(); builder.command_runner_.release(); } } #ifdef _WIN32 TEST_F(BuildWithDepsLogTest, DepFileDepsLogCanonicalize) { string err; const char* manifest = "rule cc\n command = cc $in\n depfile = $out.d\n deps = gcc\n" "build a/b\\c\\d/e/fo$ o.o: cc x\\y/z\\foo.c\n"; fs_.Create("x/y/z/foo.c", ""); { State state; ASSERT_NO_FATAL_FAILURE(AssertParse(&state, manifest)); // Run the build once, everything should be ok. DepsLog deps_log; ASSERT_TRUE(deps_log.OpenForWrite("ninja_deps", &err)); ASSERT_EQ("", err); Builder builder(&state, config_, NULL, &deps_log, &fs_); builder.command_runner_.reset(&command_runner_); EXPECT_TRUE(builder.AddTarget("a/b/c/d/e/fo o.o", &err)); ASSERT_EQ("", err); // Note, different slashes from manifest. fs_.Create("a/b\\c\\d/e/fo o.o.d", "a\\b\\c\\d\\e\\fo\\ o.o: blah.h bar.h\n"); EXPECT_TRUE(builder.Build(&err)); EXPECT_EQ("", err); deps_log.Close(); builder.command_runner_.release(); } { State state; ASSERT_NO_FATAL_FAILURE(AssertParse(&state, manifest)); DepsLog deps_log; ASSERT_TRUE(deps_log.Load("ninja_deps", &state, &err)); ASSERT_TRUE(deps_log.OpenForWrite("ninja_deps", &err)); ASSERT_EQ("", err); Builder builder(&state, config_, NULL, &deps_log, &fs_); builder.command_runner_.reset(&command_runner_); Edge* edge = state.edges_.back(); state.GetNode("bar.h", 0)->MarkDirty(); // Mark bar.h as missing. EXPECT_TRUE(builder.AddTarget("a/b/c/d/e/fo o.o", &err)); ASSERT_EQ("", err); // Expect three new edges: one generating fo o.o, and two more from // loading the depfile. ASSERT_EQ(3u, state.edges_.size()); // Expect our edge to now have three inputs: foo.c and two headers. ASSERT_EQ(3u, edge->inputs_.size()); // Expect the command line we generate to only use the original input. // Note, slashes from manifest, not .d. ASSERT_EQ("cc x\\y/z\\foo.c", edge->EvaluateCommand()); deps_log.Close(); builder.command_runner_.release(); } } #endif /// Check that a restat rule doesn't clear an edge if the depfile is missing. /// Follows from: https://github.com/ninja-build/ninja/issues/603 TEST_F(BuildTest, RestatMissingDepfile) { const char* manifest = "rule true\n" " command = true\n" // Would be "write if out-of-date" in reality. " restat = 1\n" "build header.h: true header.in\n" "build out: cat header.h\n" " depfile = out.d\n"; fs_.Create("header.h", ""); fs_.Tick(); fs_.Create("out", ""); fs_.Create("header.in", ""); // Normally, only 'header.h' would be rebuilt, as // its rule doesn't touch the output and has 'restat=1' set. // But we are also missing the depfile for 'out', // which should force its command to run anyway! RebuildTarget("out", manifest); ASSERT_EQ(2u, command_runner_.commands_ran_.size()); } /// Check that a restat rule doesn't clear an edge if the deps are missing. /// https://github.com/ninja-build/ninja/issues/603 TEST_F(BuildWithDepsLogTest, RestatMissingDepfileDepslog) { string err; const char* manifest = "rule true\n" " command = true\n" // Would be "write if out-of-date" in reality. " restat = 1\n" "build header.h: true header.in\n" "build out: cat header.h\n" " deps = gcc\n" " depfile = out.d\n"; // Build once to populate ninja deps logs from out.d fs_.Create("header.in", ""); fs_.Create("out.d", "out: header.h"); fs_.Create("header.h", ""); RebuildTarget("out", manifest, "build_log", "ninja_deps"); ASSERT_EQ(2u, command_runner_.commands_ran_.size()); // Sanity: this rebuild should be NOOP RebuildTarget("out", manifest, "build_log", "ninja_deps"); ASSERT_EQ(0u, command_runner_.commands_ran_.size()); // Touch 'header.in', blank dependencies log (create a different one). // Building header.h triggers 'restat' outputs cleanup. // Validate that out is rebuilt netherless, as deps are missing. fs_.Tick(); fs_.Create("header.in", ""); // (switch to a new blank deps_log "ninja_deps2") RebuildTarget("out", manifest, "build_log", "ninja_deps2"); ASSERT_EQ(2u, command_runner_.commands_ran_.size()); // Sanity: this build should be NOOP RebuildTarget("out", manifest, "build_log", "ninja_deps2"); ASSERT_EQ(0u, command_runner_.commands_ran_.size()); // Check that invalidating deps by target timestamp also works here // Repeat the test but touch target instead of blanking the log. fs_.Tick(); fs_.Create("header.in", ""); fs_.Create("out", ""); RebuildTarget("out", manifest, "build_log", "ninja_deps2"); ASSERT_EQ(2u, command_runner_.commands_ran_.size()); // And this build should be NOOP again RebuildTarget("out", manifest, "build_log", "ninja_deps2"); ASSERT_EQ(0u, command_runner_.commands_ran_.size()); } TEST_F(BuildTest, WrongOutputInDepfileCausesRebuild) { string err; const char* manifest = "rule cc\n" " command = cc $in\n" " depfile = $out.d\n" "build foo.o: cc foo.c\n"; fs_.Create("foo.c", ""); fs_.Create("foo.o", ""); fs_.Create("header.h", ""); fs_.Create("foo.o.d", "bar.o.d: header.h\n"); RebuildTarget("foo.o", manifest, "build_log", "ninja_deps"); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); } TEST_F(BuildTest, Console) { ASSERT_NO_FATAL_FAILURE(AssertParse(&state_, "rule console\n" " command = console\n" " pool = console\n" "build cons: console in.txt\n")); fs_.Create("in.txt", ""); string err; EXPECT_TRUE(builder_.AddTarget("cons", &err)); ASSERT_EQ("", err); EXPECT_TRUE(builder_.Build(&err)); EXPECT_EQ("", err); ASSERT_EQ(1u, command_runner_.commands_ran_.size()); } */ }
mod word_counter; mod spell_checker; pub fn clean_line(input: &str) -> String { input .trim() .chars() .filter(|&a| is_valid_symbol(a)) .collect() } fn is_valid_symbol(c: char) -> bool { c == '-' || c == '\'' || c.is_alphabetic() || c.is_whitespace() } fn main() { } #[cfg(test)] mod tests { use super::*; #[test] fn clean_line_with_already_cleaned_line() { let line = "i'm a clean-mf-line"; assert_eq!(line, clean_line(line)); } #[test] fn clean_line_removes_leading_and_trailing_spaces() { let line = " abc \n"; assert_eq!(clean_line(line), "abc"); } #[test] fn clean_line_with_characters_to_remove() { let line = "abc-1 @#"; assert_eq!(clean_line(line), "abc- "); } }
use std::str::FromStr; use firefly_diagnostics::*; use firefly_intern::Symbol; use firefly_number::{Float, Integer}; use firefly_parser::{Scanner, Source}; use firefly_syntax_erl::LexicalError; use super::{LexicalToken, Token}; pub struct Lexer<S> { scanner: Scanner<S>, token: Token, token_start: SourceIndex, token_end: SourceIndex, eof: bool, buffer: String, } impl<S> Lexer<S> where S: Source, { pub fn new(scanner: Scanner<S>) -> Self { let start = scanner.start(); let mut lexer = Self { scanner, token: Token::EOF, token_start: start, token_end: start, eof: false, buffer: String::new(), }; lexer.advance(); lexer } pub fn lex(&mut self) -> Option<<Self as Iterator>::Item> { if self.eof && self.token == Token::EOF { return None; } let token = std::mem::replace(&mut self.token, Token::EOF); let result = Some(Ok(LexicalToken( self.token_start.clone(), token, self.token_end.clone(), ))); self.advance(); result } fn advance(&mut self) { self.advance_start(); self.token = self.tokenize(); } fn advance_start(&mut self) { let mut position: SourceIndex; loop { let (pos, c) = self.scanner.read(); position = pos; if c == '\0' { self.eof = true; return; } if c.is_whitespace() { self.scanner.advance(); continue; } break; } self.token_start = position; } fn pop(&mut self) -> char { let (pos, c) = self.scanner.pop(); self.token_end = pos + ByteOffset::from_char_len(c); c } fn peek(&mut self) -> char { self.scanner.peek().1 } fn read(&mut self) -> char { self.scanner.read().1 } fn skip(&mut self) { self.pop(); } pub fn span(&self) -> SourceSpan { SourceSpan::new(self.token_start, self.token_end) } fn slice(&self) -> &str { self.scanner.slice(self.span()) } fn skip_whitespace(&mut self) { while self.read().is_whitespace() { self.skip(); } } fn lex_unquoted_atom(&mut self) -> Token { let c = self.pop(); debug_assert!(c.is_ascii_lowercase()); loop { match self.read() { '_' => self.skip(), '@' => self.skip(), '0'..='9' => self.skip(), c if c.is_alphanumeric() => self.skip(), _ => break, } } Token::from_bare_atom(self.slice()) } fn lex_quoted_atom(&mut self) -> Token { let c = self.pop(); debug_assert!(c == '\''); self.buffer.clear(); loop { match self.read() { '\\' => unimplemented!(), '\'' => { self.skip(); break; } c => { self.skip(); self.buffer.push(c); } } } Token::from_bare_atom(self.buffer.as_str()) } fn lex_string(&mut self) -> Token { let c = self.pop(); debug_assert!(c == '"'); self.buffer.clear(); loop { match self.read() { '\\' => unimplemented!(), '"' => { self.skip(); break; } c => { self.skip(); self.buffer.push(c); } } } Token::StringLiteral(Symbol::intern(&self.buffer)) } #[inline] fn lex_digits( &mut self, radix: u32, allow_leading_underscore: bool, num: &mut String, ) -> Result<(), LexicalError> { let mut last_underscore = !allow_leading_underscore; let mut c = self.read(); loop { match c { c if c.is_digit(radix) => { last_underscore = false; num.push(self.pop()); } '_' if last_underscore => { return Err(LexicalError::UnexpectedCharacter { start: self.span().start(), found: c, }); } '_' if self.peek().is_digit(radix) => { last_underscore = true; self.pop(); } _ => break, } c = self.read(); } Ok(()) } fn lex_number(&mut self) -> Token { let mut num = String::new(); let mut c; // Expect the first character to be either a sign on digit c = self.read(); debug_assert!(c == '-' || c == '+' || c.is_digit(10), "got {}", c); // If sign, consume it // // -10 // ^ // let negative = c == '-'; if c == '-' || c == '+' { num.push(self.pop()); } // Consume leading digits // // -10.0 // ^^ // // 10e10 // ^^ // if let Err(err) = self.lex_digits(10, false, &mut num) { return Token::Error(err); } // If we have a dot with a trailing number, we lex a float. // Otherwise we return consumed digits as an integer token. // // 10.0 // ^ lex_float() // // fn() -> 10 + 10. // ^ return integer token // c = self.read(); if c == '.' { if self.peek().is_digit(10) { // Pushes . num.push(self.pop()); return self.lex_float(num, false); } return to_integer_literal(&num, 10); } // Consume exponent marker // // 10e10 // ^ lex_float() // // 10e-10 // ^^ lex_float() if c == 'e' || c == 'E' { let c2 = self.peek(); if c2 == '-' || c2 == '+' { num.push(self.pop()); num.push(self.pop()); return self.lex_float(num, true); } else if c2.is_digit(10) { num.push(self.pop()); return self.lex_float(num, true); } } to_integer_literal(&num, 10) } fn lex_float(&mut self) -> Token { let c = self.pop(); debug_assert!(c.is_digit(10)); while self.read().is_digit(10) { self.pop(); } match f64::from_str(self.slice()) { Ok(f) => Token::FloatLiteral(Float::new(f)), Err(e) => panic!("unhandled float parsing error: {}", &e), } } // Called after consuming a number up to and including the '.' #[inline] fn lex_float(&mut self, num: String, seen_e: bool) -> Token { let mut num = num; let mut c = self.pop(); debug_assert!(c.is_digit(10), "got {}", c); num.push(c); if let Err(err) = self.lex_digits(10, true, &mut num) { return Token::Error(err); } c = self.read(); // If we've already seen e|E, then we're done if seen_e { return self.to_float_literal(num); } if c == 'E' || c == 'e' { num.push(self.pop()); c = self.read(); if c == '-' || c == '+' { num.push(self.pop()); c = self.read(); } if !c.is_digit(10) { return Token::Error(LexicalError::InvalidFloat { span: self.span(), reason: "expected digits after scientific notation".to_string(), }); } if let Err(err) = self.lex_digits(10, false, &mut num) { return Token::Error(err); } } self.to_float_literal(num) } fn to_float_literal(&self, num: String) -> Token { let reason = match f64::from_str(&num) { Ok(f) => match Float::new(f) { Ok(f) => return Token::Float(f), Err(FloatError::Nan) => "float cannot be NaN".to_string(), Err(FloatError::Infinite) => "float cannot be -Inf or Inf".to_string(), }, Err(e) => e.to_string(), }; Token::Error(LexicalError::InvalidFloat { span: self.span(), reason, }) } } macro_rules! pop { ($lex:ident) => {{ $lex.skip(); }}; ($lex:ident, $code:expr) => {{ $lex.skip(); $code }}; } impl<S> Lexer<S> where S: Source, { fn tokenize(&mut self) -> Token { let c = self.read(); if c == '\0' { self.eof = true; return Token::EOF; } if c.is_whitespace() { self.skip_whitespace(); } match self.read() { '{' => pop!(self, Token::CurlyOpen), '}' => pop!(self, Token::CurlyClose), '[' => pop!(self, Token::SquareOpen), ']' => pop!(self, Token::SquareClose), ',' => pop!(self, Token::Comma), '.' => pop!(self, Token::Dot), '|' => pop!(self, Token::Pipe), 'a'..='z' | 'A'..='Z' => self.lex_unquoted_atom(), '0'..='9' => self.lex_number(), '\'' => self.lex_quoted_atom(), '"' => self.lex_string(), c => unimplemented!("{}", c), } } } impl<S> Iterator for Lexer<S> where S: Source, { type Item = Result<(SourceIndex, Token, SourceIndex), ()>; fn next(&mut self) -> Option<Self::Item> { self.lex() } } // Converts the string literal into either a `i64` or arbitrary precision integer, preferring `i64`. // // This function panics if the literal is unparseable due to being invalid for the given radix, // or containing non-ASCII digits. fn to_integer_literal(literal: &str, radix: u32) -> Token { let int = Integer::from_string_radix(literal, radix).unwrap(); Token::IntegerLiteral(int) }
use node::Node; use states::State; pub struct ListBegin { pub node: Node } impl State for ListBegin { fn transfer(&self, node: State) -> State { return node; } fn extract(&self) -> Node { return self.node; } } pub struct ListEnd { pub node: Node } impl State for ListEnd { fn transfer(&self, node: State) -> State { return node; } fn extract(&self) -> Node { return self.node; } }
/* Make sure we can spawn tasks that take different types of parameters. This is based on a test case for #520 provided by Rob Arnold. */ use std; import std::str; type ctx = chan[int]; fn iotask(cx: ctx, ip: str) { assert (str::eq(ip, "localhost")); } fn main() { let p: port[int] = port(); spawn iotask(chan(p), "localhost"); }
use crate::{SMResult, AST}; pub fn expand(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn expand_logical(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn expand_piecewise(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn expand_power(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn expand_all(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn expand_complex(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn expand_function(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn factor(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn factor_list(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn factor_terms(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn factor_terms_list(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn factor_square_free(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn factor_square_free_list(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn apart(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn apart_square_free(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn together(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn collect(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } }
use std::str::from_utf8; use std::io::{Acceptor, Listener}; use std::io::net::ip::SocketAddr; use std::from_str::from_str; use std::io; use std::io::{TcpListener, TcpStream}; use std::sync::Arc; struct Hook { stream: TcpStream, interest: String, function: String, id: String } fn handle_sensor(mut stream: TcpStream, all_hooks: Vec<Hook>) { let mut buffer = [0u8, ..1024]; while(true) { stream.read(buffer); let req = from_utf8(buffer).expect("unable to parse buffer to a utf8 string").to_owned(); let v: Vec<&str> = req.as_slice().split_str(":").collect(); println!("{:s}", v[0]); // stream.write(format!("{:s}", req).as_bytes()) } drop(stream); } fn handle_hook(mut stream: TcpStream, mut all_hooks: Vec<Hook>) { let mut tmp = [0u8, ..1024]; stream.read(tmp); let req = from_utf8(tmp).expect("unable to parse buffer to a utf8 string").to_owned(); let v: Vec<&str> = req.as_slice().split_str(":").collect(); let h = Hook {stream: stream.clone(), id: String::from_str(v[0]), interest: String::from_str(v[1]), function: String::from_str(v[2])}; all_hooks.push(h); let mut buffer = [0u8, ..1024]; while(true) { stream.read(buffer); let req = from_utf8(buffer).expect("unable to parse buffer to a utf8 string").to_owned(); println!("{:s}", req); // stream.write(format!("{:s}", req).as_bytes()) } drop(stream) } fn hooks_loop(all_hooks: Vec<Hook>) { let hook_listener = TcpListener::bind("127.0.0.1", 8079); let mut hook = hook_listener.listen(); // accept connections and process them, spawning a new tasks for each one for stream in hook.incoming() { match stream { Err(e) => { /* connection failed */ } Ok(stream) => spawn(proc() { // connection succeeded handle_hook(stream, all_hooks) }) } } drop(hook) } fn sensors_loop(all_hooks: Vec<Hook>) { let sensor_listener = TcpListener::bind("127.0.0.1", 8080); let mut sensors = sensor_listener.listen(); // accept connections and process them, spawning a new tasks for each one for stream in sensors.incoming() { match stream { Err(e) => { /* connection failed */ } Ok(stream) => spawn(proc() { // connection succeeded handle_sensor(stream, all_hooks) }) } } drop(sensors); } fn main() { let mut all_hooks: Vec<Hook> = Vec::new(); spawn(proc() { hooks_loop(all_hooks.clone()); }); sensors_loop(all_hooks.clone()); }
use crate::generated::game::*; use spatialos_sdk::worker::entity::Entity as WorkerEntity; use spatialos_sdk::worker::entity_builder::EntityBuilder; use spatialos_specs::*; use specs::prelude::*; pub struct ClientBootstrap { pub has_requested_player: bool, } impl<'a> System<'a> for ClientBootstrap { type SystemData = ( SpatialReadStorage<'a, PlayerCreator>, EntityIds<'a>, CommandSender<'a, PlayerCreator>, ); fn run(&mut self, (creator, entity_ids, mut player_command_sender): Self::SystemData) { if !self.has_requested_player { match (&creator, &entity_ids).join().next() { Some((_, player_creator_entity_id)) => { self.has_requested_player = true; player_command_sender.send_command( *player_creator_entity_id, PlayerCreatorCommandRequest::CreatePlayer(CreatePlayerRequest { name: "MyName".to_string(), }), |result, _| match result { Ok(result) => println!("Created player: {:?}", result), Err(status) => println!("Error creating player: {:?}", status), }, ) } None => {} } } } } pub struct PlayerCreatorSys; impl<'a> System<'a> for PlayerCreatorSys { type SystemData = (CommandRequests<'a, PlayerCreator>, SystemCommandSender<'a>); fn run(&mut self, (mut requests, mut sys_command_sender): Self::SystemData) { for request in (&mut requests).join() { request.respond(|request, caller_worker_id, _| match request { PlayerCreatorCommandRequest::CreatePlayer(request) => { let player_name = request.name.clone(); let caller_worker_id = caller_worker_id.clone(); sys_command_sender.reserve_entity_ids(1, move |result, system_data| { let (_, mut sys_command_sender) = system_data.fetch::<Self>(); let entity = Self::create_player_entity(player_name); let reserved_id = result.unwrap().next().unwrap(); sys_command_sender.create_entity( entity, Some(reserved_id), move |result, _| { println!( "Created player entity for {}: {:?}", caller_worker_id, result ); }, ); }); Some(PlayerCreatorCommandResponse::CreatePlayer( CreatePlayerResponse {}, )) } }); } } } impl PlayerCreatorSys { fn create_player_entity(name: String) -> WorkerEntity { let mut builder = EntityBuilder::new(0.0, 0.0, 0.0, "managed"); builder.add_component( Player { name, current_direction: 0, }, "managed", ); builder.set_metadata("Player", "managed"); builder.set_entity_acl_write_access("managed"); builder.build().unwrap() } }
use std::prelude::v1::*; extern crate rust_base58; use serde_derive; use std::fmt; pub type Result<T> = std::result::Result<T, Error>; #[derive(serde_derive::Serialize, serde_derive::Deserialize)] pub struct Error { repr: Repr, } impl fmt::Debug for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&self.repr, f) } } #[derive(serde_derive::Serialize, serde_derive::Deserialize)] enum Repr { Simple(ErrorKind), #[serde(skip)] Custom(Box<Custom>), } #[derive(Debug)] struct Custom { kind: ErrorKind, error: Box<dyn std::error::Error + Send + Sync>, } #[derive( serde_derive::Serialize, serde_derive::Deserialize, Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )] pub enum ErrorKind { TooSmallNumOfkeysError = 1, CurveParamNilError, NotExactTheSameCurveInputError, KeyParamNotMatchError, ParseError, InvalidAddressError, InvalidPrivaiteKeyError, CryptoError, ErrInvalidRawEntropyLength, ErrInvalidEntropyLength, ErrStrengthNotSupported, ErrLanguageNotSupported, ErrMnemonicNumNotValid, ErrMnemonicChecksumIncorrect, ErrCryptographyNotSupported, LimbUnspecifiedError, InvalidBigNumError, Unknown, } impl ErrorKind { pub(crate) fn as_str(self) -> &'static str { match self { ErrorKind::TooSmallNumOfkeysError => "The total num of keys should be greater than one", ErrorKind::CurveParamNilError => "curve input param is nil", ErrorKind::NotExactTheSameCurveInputError => { "the curve is not same as curve of members" } ErrorKind::KeyParamNotMatchError => "key param not match", ErrorKind::ParseError => "failed to parse", ErrorKind::InvalidAddressError => "invalid address format", ErrorKind::InvalidPrivaiteKeyError => "invalid private key format", ErrorKind::CryptoError => "crypto error", // 原始熵的长度不在 [120, 248]以内或者+8后的长度不是32的倍数 ErrorKind::ErrInvalidRawEntropyLength => "Entropy length must within [120, 248] and after +8 be multiples of 32", // 熵的长度不在 [128, 256]以内或者长度不是32的倍数 ErrorKind::ErrInvalidEntropyLength => ("Entropy length must within [128, 256] and be multiples of 32"), // 助记词的强度暂未被支持 // Strength required for generating Mnemonic not supported yet. ErrorKind::ErrStrengthNotSupported => ("This strength has not been supported yet."), // 助记词的语言类型暂未被支持 // Language required for generating Mnemonic not supported yet. ErrorKind::ErrLanguageNotSupported => ("This language has not been supported yet."), // 助记词语句中包含的助记词的数量不合法,只能是12, 15, 18, 21, 24 ErrorKind::ErrMnemonicNumNotValid => ("The number of words in the Mnemonic sentence is not valid. It must be within [12, 15, 18, 21, 24]"), // 助记词语句中包含的校验位的格式不合法 ErrorKind::ErrMnemonicChecksumIncorrect => ("The checksum within the Mnemonic sentence incorrect"), ErrorKind::ErrCryptographyNotSupported => "unsupported cryptography system", ErrorKind::LimbUnspecifiedError => "call limb error", ErrorKind::InvalidBigNumError => "can not parsed as bignum", ErrorKind::Unknown => "unknown error", } } } impl From<ErrorKind> for Error { #[inline] fn from(kind: ErrorKind) -> Error { Error { repr: Repr::Simple(kind), } } } impl From<u32> for Error { #[inline] fn from(kind: u32) -> Error { let err_kind = match kind { 0x0000_0001 => ErrorKind::TooSmallNumOfkeysError, 0x0000_0002 => ErrorKind::CurveParamNilError, 0x0000_0003 => ErrorKind::NotExactTheSameCurveInputError, 0x0000_0004 => ErrorKind::KeyParamNotMatchError, 0x0000_0005 => ErrorKind::ParseError, 0x0000_0006 => ErrorKind::InvalidAddressError, 0x0000_0007 => ErrorKind::InvalidPrivaiteKeyError, 0x0000_0008 => ErrorKind::CryptoError, 0x0000_0009 => ErrorKind::ErrInvalidRawEntropyLength, 0x0000_0010 => ErrorKind::ErrInvalidEntropyLength, 0x0000_0011 => ErrorKind::ErrStrengthNotSupported, 0x0000_0012 => ErrorKind::ErrLanguageNotSupported, 0x0000_0013 => ErrorKind::ErrMnemonicNumNotValid, 0x0000_0014 => ErrorKind::ErrMnemonicChecksumIncorrect, 0x0000_0015 => ErrorKind::ErrCryptographyNotSupported, 0x0000_0016 => ErrorKind::LimbUnspecifiedError, 0x0000_0017 => ErrorKind::InvalidBigNumError, _ => ErrorKind::Unknown, }; Error { repr: Repr::Simple(err_kind), } } } impl From<serde_json::Error> for Error { #[inline] fn from(err: serde_json::Error) -> Error { Error::new(ErrorKind::ParseError, err) } } impl From<std::io::Error> for Error { #[inline] fn from(err: std::io::Error) -> Error { Error::new(ErrorKind::ParseError, err) } } impl Into<u32> for Error { #[inline] fn into(self) -> u32 { match self.kind() { ErrorKind::TooSmallNumOfkeysError => 0x0000_0001, ErrorKind::CurveParamNilError => 0x0000_0002, ErrorKind::NotExactTheSameCurveInputError => 0x0000_0003, ErrorKind::KeyParamNotMatchError => 0x0000_0004, ErrorKind::ParseError => 0x0000_0005, ErrorKind::InvalidAddressError => 0x0000_0006, ErrorKind::InvalidPrivaiteKeyError => 0x0000_0007, ErrorKind::CryptoError => 0x0000_0008, ErrorKind::ErrInvalidRawEntropyLength => 0x0000_0009, ErrorKind::ErrInvalidEntropyLength => 0x0000_0010, ErrorKind::ErrStrengthNotSupported => 0x0000_0011, ErrorKind::ErrLanguageNotSupported => 0x0000_0012, ErrorKind::ErrMnemonicNumNotValid => 0x0000_0013, ErrorKind::ErrMnemonicChecksumIncorrect => 0x0000_0014, ErrorKind::ErrCryptographyNotSupported => 0x0000_0015, ErrorKind::LimbUnspecifiedError => 0x0000_0016, ErrorKind::InvalidBigNumError => 0x0000_0017, ErrorKind::Unknown => 0xffff_ffff, } } } impl Error { pub fn new<E>(kind: ErrorKind, error: E) -> Error where E: Into<Box<dyn std::error::Error + Send + Sync>>, { Self::_new(kind, error.into()) } fn _new(kind: ErrorKind, error: Box<dyn std::error::Error + Send + Sync>) -> Error { Error { repr: Repr::Custom(Box::new(Custom { kind, error })), } } pub fn get_ref(&self) -> Option<&(dyn std::error::Error + Send + Sync + 'static)> { match self.repr { Repr::Simple(..) => None, Repr::Custom(ref c) => Some(&*c.error), } } pub fn get_mut(&mut self) -> Option<&mut (dyn std::error::Error + Send + Sync + 'static)> { match self.repr { Repr::Simple(..) => None, Repr::Custom(ref mut c) => Some(&mut *c.error), } } pub fn into_inner(self) -> Option<Box<dyn std::error::Error + Send + Sync>> { match self.repr { Repr::Simple(..) => None, Repr::Custom(c) => Some(c.error), } } pub fn into_simple_error(self) -> Error { match self.repr { Repr::Simple(_) => self, Repr::Custom(c) => Error::from(c.kind), } } pub fn kind(&self) -> ErrorKind { match self.repr { Repr::Custom(ref c) => c.kind, Repr::Simple(kind) => kind, } } pub fn unknown() -> Error { Error::from(ErrorKind::Unknown) } } impl fmt::Debug for Repr { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { Repr::Custom(ref c) => fmt::Debug::fmt(&c, fmt), Repr::Simple(kind) => fmt.debug_tuple("Kind").field(&kind).finish(), } } } impl fmt::Display for Error { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { match self.repr { Repr::Custom(ref c) => c.error.fmt(fmt), Repr::Simple(kind) => write!(fmt, "{}", kind.as_str()), } } } impl std::error::Error for Error { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { match self.repr { Repr::Simple(..) => None, Repr::Custom(ref c) => c.error.source(), } } }
//! Serial numbers. //! //! This module define a type [`Serial`] that wraps a `u32` to provide //! serial number arithmetics. //! //! [`Serial`]: struct.Serial.html use std::{cmp, fmt, hash, str}; //------------ Serial -------------------------------------------------------- /// A serial number. /// /// Serial numbers are regular integers with a special notion for comparison /// in order to be able to deal with roll-over. /// /// Specifically, addition and comparison are defined in [RFC 1982]. /// Addition, however, is only defined for values up to `2^31 - 1`, so we /// decided to not implement the `Add` trait but rather have a dedicated /// method `add` so as to not cause surprise panics. /// /// Serial numbers only implement a partial ordering. That is, there are /// pairs of values that are not equal but there still isn’t one value larger /// than the other. Since this is neatly implemented by the `PartialOrd` /// trait, the type implements that. /// /// [RFC 1982]: https://tools.ietf.org/html/rfc1982 #[derive(Clone, Copy, Debug)] pub struct Serial(pub u32); impl Serial { pub fn from_be(value: u32) -> Self { Serial(u32::from_be(value)) } pub fn to_be(self) -> u32 { self.0.to_be() } /// Add `other` to `self`. /// /// Serial numbers only allow values of up to `2^31 - 1` to be added to /// them. Therefore, this method requires `other` to be a `u32` instead /// of a `Serial` to indicate that you cannot simply add two serials /// together. This is also why we don’t implement the `Add` trait. /// /// # Panics /// /// This method panics if `other` is greater than `2^31 - 1`. #[allow(should_implement_trait)] pub fn add(self, other: u32) -> Self { assert!(other <= 0x7FFF_FFFF); Serial(self.0.wrapping_add(other)) } } //--- From and FromStr impl From<u32> for Serial { fn from(value: u32) -> Serial { Serial(value) } } impl From<Serial> for u32 { fn from(serial: Serial) -> u32 { serial.0 } } impl str::FromStr for Serial { type Err = <u32 as str::FromStr>::Err; fn from_str(s: &str) -> Result<Self, Self::Err> { <u32 as str::FromStr>::from_str(s).map(Into::into) } } //--- Display impl fmt::Display for Serial { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.0) } } //--- PartialEq and Eq impl PartialEq for Serial { fn eq(&self, other: &Self) -> bool { self.0 == other.0 } } impl PartialEq<u32> for Serial { fn eq(&self, other: &u32) -> bool { self.0.eq(other) } } impl Eq for Serial { } //--- PartialOrd impl cmp::PartialOrd for Serial { fn partial_cmp(&self, other: &Serial) -> Option<cmp::Ordering> { if self.0 == other.0 { Some(cmp::Ordering::Equal) } else if self.0 < other.0 { let sub = other.0 - self.0; if sub < 0x8000_0000 { Some(cmp::Ordering::Less) } else if sub > 0x8000_0000 { Some(cmp::Ordering::Greater) } else { None } } else { let sub = self.0 - other.0; if sub < 0x8000_0000 { Some(cmp::Ordering::Greater) } else if sub > 0x8000_0000 { Some(cmp::Ordering::Less) } else { None } } } } //--- Hash impl hash::Hash for Serial { fn hash<H: hash::Hasher>(&self, state: &mut H) { self.0.hash(state) } } //============ Testing ======================================================= #[cfg(test)] mod test { use super::*; #[test] fn good_addition() { assert_eq!(Serial(0).add(4), Serial(4)); assert_eq!(Serial(0xFF00_0000).add(0x0F00_0000), Serial(((0xFF00_0000u64 + 0x0F00_0000u64) % 0x1_0000_0000) as u32)); } #[test] #[should_panic] fn bad_addition() { let _ = Serial(0).add(0x8000_0000); } #[test] fn comparison() { use std::cmp::Ordering::*; assert_eq!(Serial(12), Serial(12)); assert_ne!(Serial(12), Serial(112)); assert_eq!(Serial(12).partial_cmp(&Serial(12)), Some(Equal)); // s1 is said to be less than s2 if [...] // (i1 < i2 and i2 - i1 < 2^(SERIAL_BITS - 1)) assert_eq!(Serial(12).partial_cmp(&Serial(13)), Some(Less)); assert_ne!(Serial(12).partial_cmp(&Serial(3_000_000_012)), Some(Less)); // or (i1 > i2 and i1 - i2 > 2^(SERIAL_BITS - 1)) assert_eq!(Serial(3_000_000_012).partial_cmp(&Serial(12)), Some(Less)); assert_ne!(Serial(13).partial_cmp(&Serial(12)), Some(Less)); // s1 is said to be greater than s2 if [...] // (i1 < i2 and i2 - i1 > 2^(SERIAL_BITS - 1)) assert_eq!(Serial(12).partial_cmp(&Serial(3_000_000_012)), Some(Greater)); assert_ne!(Serial(12).partial_cmp(&Serial(13)), Some(Greater)); // (i1 > i2 and i1 - i2 < 2^(SERIAL_BITS - 1)) assert_eq!(Serial(13).partial_cmp(&Serial(12)), Some(Greater)); assert_ne!(Serial(3_000_000_012).partial_cmp(&Serial(12)), Some(Greater)); // Er, I think that’s what’s left. assert_eq!(Serial(1).partial_cmp(&Serial(0x8000_0001)), None); assert_eq!(Serial(0x8000_0001).partial_cmp(&Serial(1)), None); } }
use sdl2::rect::Rect; use sdl2::render::Texture; pub struct Player<'a> { pos: Rect, texture: Texture<'a>, } impl<'a> Player<'a> { //Create a new instance of player struct pub fn create(pos: Rect, texture: Texture<'a>) -> Player { Player { pos, texture } } pub fn x(&self) -> i32 { self.pos.x() } pub fn y(&self) -> i32 { self.pos.y() } pub fn width(&self) -> u32 { self.pos.width() } pub fn height(&self) -> u32 { self.pos.height() } pub fn _set_x(&mut self, x_cor: i32) { self.pos.set_x(x_cor); } pub fn _set_y(&mut self, y_cor: i32) { self.pos.set_y(y_cor); } pub fn _update_pos(&mut self, vel: (i32, i32), x_bounds: (i32, i32), y_bounds: (i32, i32)) { self .pos .set_x((self.pos.x() + vel.0).clamp(x_bounds.0, x_bounds.1)); self .pos .set_y((self.pos.y() + vel.1).clamp(y_bounds.0, y_bounds.1)); } pub fn texture(&self) -> &Texture { &self.texture } }
use bigdecimal::BigDecimal; use num_bigint::BigInt; use num_rational::BigRational; use num_traits::Pow; use core::ops::{Add, Div, Mul, Sub}; #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(untagged)] pub enum MmNumber { BigDecimal(BigDecimal), BigRational(BigRational), } impl std::fmt::Display for MmNumber { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { MmNumber::BigDecimal(d) => write!(f, "{}", d), MmNumber::BigRational(r) => write!(f, "{}", r), } } } impl From<BigDecimal> for MmNumber { fn from(n: BigDecimal) -> MmNumber { MmNumber::BigDecimal(n) } } impl From<BigRational> for MmNumber { fn from(r: BigRational) -> MmNumber { MmNumber::BigRational(r) } } impl From<MmNumber> for BigDecimal { fn from(n: MmNumber) -> BigDecimal { match n { MmNumber::BigDecimal(d) => d, MmNumber::BigRational(r) => from_ratio_to_dec(&r), } } } impl From<MmNumber> for BigRational { fn from(n: MmNumber) -> BigRational { match n { MmNumber::BigDecimal(d) => from_dec_to_ratio(d), MmNumber::BigRational(r) => r, } } } impl From<u64> for MmNumber { fn from(n: u64) -> MmNumber { BigRational::from_integer(n.into()).into() } } pub fn from_ratio_to_dec(r: &BigRational) -> BigDecimal { BigDecimal::from(r.numer().clone()) / BigDecimal::from(r.denom().clone()) } pub fn from_dec_to_ratio(d: BigDecimal) -> BigRational { let (num, scale) = d.as_bigint_and_exponent(); let ten = BigInt::from(10); if scale >= 0 { BigRational::new(num, ten.pow(scale as u64)) } else { BigRational::new(num * ten.pow((-scale) as u64), 1.into()) } } impl Mul for MmNumber { type Output = MmNumber; fn mul(self, rhs: Self) -> Self::Output { let lhs: BigRational = self.into(); let rhs: BigRational = rhs.into(); MmNumber::from(lhs * rhs) } } impl Mul for &MmNumber { type Output = MmNumber; fn mul(self, rhs: Self) -> Self::Output { let lhs: BigRational = self.clone().into(); let rhs: BigRational = rhs.clone().into(); MmNumber::from(lhs * rhs) } } impl Add for MmNumber { type Output = MmNumber; fn add(self, rhs: Self) -> Self::Output { let lhs: BigRational = self.into(); let rhs: BigRational = rhs.into(); (lhs + rhs).into() } } impl Sub for MmNumber { type Output = MmNumber; fn sub(self, rhs: Self) -> Self::Output { let lhs: BigRational = self.into(); let rhs: BigRational = rhs.into(); (lhs - rhs).into() } } impl Add for &MmNumber { type Output = MmNumber; fn add(self, rhs: Self) -> Self::Output { let lhs: BigRational = self.clone().into(); let rhs: BigRational = rhs.clone().into(); (lhs + rhs).into() } } impl PartialOrd<BigDecimal> for MmNumber { fn partial_cmp(&self, other: &BigDecimal) -> Option<std::cmp::Ordering> { match self { MmNumber::BigDecimal(d) => Some(d.cmp(other)), MmNumber::BigRational(r) => Some(from_ratio_to_dec(&r).cmp(other)), } } } impl PartialOrd<MmNumber> for MmNumber { fn partial_cmp(&self, other: &MmNumber) -> Option<std::cmp::Ordering> { match self { MmNumber::BigDecimal(lhs) => match other { MmNumber::BigDecimal(rhs) => Some(lhs.cmp(rhs)), MmNumber::BigRational(rhs) => Some(lhs.cmp(&from_ratio_to_dec(rhs))), } MmNumber::BigRational(lhs) => match other { MmNumber::BigDecimal(rhs) => Some(from_ratio_to_dec(lhs).cmp(rhs)), MmNumber::BigRational(rhs) => Some(lhs.cmp(rhs)), }, } } } impl PartialEq<BigDecimal> for MmNumber { fn eq(&self, rhs: &BigDecimal) -> bool { match self { MmNumber::BigDecimal(d) => d == rhs, MmNumber::BigRational(r) => { let dec = from_ratio_to_dec(&r); &dec == rhs }, } } } impl Default for MmNumber { fn default() -> MmNumber { BigRational::from_integer(0.into()).into() } } impl Div for MmNumber { type Output = MmNumber; fn div(self, rhs: MmNumber) -> MmNumber { let lhs: BigRational = self.into(); let rhs: BigRational = rhs.into(); (lhs / rhs).into() } } impl Div for &MmNumber { type Output = MmNumber; fn div(self, rhs: &MmNumber) -> MmNumber { let lhs: BigRational = self.clone().into(); let rhs: BigRational = rhs.clone().into(); (lhs / rhs).into() } } impl PartialEq for MmNumber { fn eq(&self, rhs: &MmNumber) -> bool { match self { MmNumber::BigDecimal(lhs) => match rhs { MmNumber::BigDecimal(rhs) => lhs == rhs, MmNumber::BigRational(rhs) => lhs == &from_ratio_to_dec(rhs), }, MmNumber::BigRational(lhs) => match rhs { MmNumber::BigDecimal(rhs) => &from_ratio_to_dec(lhs) == rhs, MmNumber::BigRational(rhs) => lhs == rhs, } } } } #[test] fn test_from_dec_to_ratio() { let number: BigDecimal = "11.00000000000000000000000000000000000000".parse().unwrap(); let rational = from_dec_to_ratio(number); assert_eq!(*rational.numer(), 11.into()); assert_eq!(*rational.denom(), 1.into()); let number: BigDecimal = "0.00000001".parse().unwrap(); let rational = from_dec_to_ratio(number); assert_eq!(*rational.numer(), 1.into()); assert_eq!(*rational.denom(), 100000000.into()); let number: BigDecimal = 1.into(); let rational = from_dec_to_ratio(number); assert_eq!(*rational.numer(), 1.into()); assert_eq!(*rational.denom(), 1.into()); }