text
stringlengths
8
4.13M
// Copyright 2018 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. use rustc::hir; use rustc::mir::*; use rustc::ty; use rustc_data_structures::indexed_vec::Idx; use rustc_errors::DiagnosticBuilder; use syntax_pos::Span; use borrow_check::MirBorrowckCtxt; use dataflow::move_paths::{IllegalMoveOrigin, IllegalMoveOriginKind}; use dataflow::move_paths::{LookupResult, MoveError, MovePathIndex}; use util::borrowck_errors::{BorrowckErrors, Origin}; // Often when desugaring a pattern match we may have many individual moves in // MIR that are all part of one operation from the user's point-of-view. For // example: // // let (x, y) = foo() // // would move x from the 0 field of some temporary, and y from the 1 field. We // group such errors together for cleaner error reporting. // // Errors are kept separate if they are from places with different parent move // paths. For example, this generates two errors: // // let (&x, &y) = (&String::new(), &String::new()); #[derive(Debug)] enum GroupedMoveError<'tcx> { // Match place can't be moved from // e.g. match x[0] { s => (), } where x: &[String] MovesFromMatchPlace { span: Span, move_from: Place<'tcx>, kind: IllegalMoveOriginKind<'tcx>, binds_to: Vec<Local>, }, // Part of a pattern can't be moved from, // e.g. match &String::new() { &x => (), } MovesFromPattern { span: Span, move_from: MovePathIndex, kind: IllegalMoveOriginKind<'tcx>, binds_to: Vec<Local>, }, // Everything that isn't from pattern matching. OtherIllegalMove { span: Span, kind: IllegalMoveOriginKind<'tcx>, }, } impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { pub(crate) fn report_move_errors(&mut self, move_errors: Vec<MoveError<'tcx>>) { let grouped_errors = self.group_move_errors(move_errors); for error in grouped_errors { self.report(error); } } fn group_move_errors(&self, errors: Vec<MoveError<'tcx>>) -> Vec<GroupedMoveError<'tcx>> { let mut grouped_errors = Vec::new(); for error in errors { self.append_to_grouped_errors(&mut grouped_errors, error); } grouped_errors } fn append_to_grouped_errors( &self, grouped_errors: &mut Vec<GroupedMoveError<'tcx>>, error: MoveError<'tcx>, ) { match error { MoveError::UnionMove { .. } => { unimplemented!("don't know how to report union move errors yet.") } MoveError::IllegalMove { cannot_move_out_of: IllegalMoveOrigin { location, kind }, } => { let stmt_source_info = self.mir.source_info(location); // Note: that the only time we assign a place isn't a temporary // to a user variable is when initializing it. // If that ever stops being the case, then the ever initialized // flow could be used. if let Some(StatementKind::Assign( Place::Local(local), Rvalue::Use(Operand::Move(move_from)), )) = self.mir.basic_blocks()[location.block] .statements .get(location.statement_index) .map(|stmt| &stmt.kind) { let local_decl = &self.mir.local_decls[*local]; // opt_match_place is the // match_span is the span of the expression being matched on // match *x.y { ... } match_place is Some(*x.y) // ^^^^ match_span is the span of *x.y // // opt_match_place is None for let [mut] x = ... statements, // whether or not the right-hand side is a place expression if let Some(ClearCrossCrate::Set(BindingForm::Var(VarBindingForm { opt_match_place: Some((ref opt_match_place, match_span)), binding_mode: _, opt_ty_info: _, }))) = local_decl.is_user_variable { self.append_binding_error( grouped_errors, kind, move_from, *local, opt_match_place, match_span, stmt_source_info.span, ); return; } } grouped_errors.push(GroupedMoveError::OtherIllegalMove { span: stmt_source_info.span, kind, }); } } } fn append_binding_error( &self, grouped_errors: &mut Vec<GroupedMoveError<'tcx>>, kind: IllegalMoveOriginKind<'tcx>, move_from: &Place<'tcx>, bind_to: Local, match_place: &Option<Place<'tcx>>, match_span: Span, statement_span: Span, ) { debug!( "append_to_grouped_errors(match_place={:?}, match_span={:?})", match_place, match_span ); let from_simple_let = match_place.is_none(); let match_place = match_place.as_ref().unwrap_or(move_from); match self.move_data.rev_lookup.find(match_place) { // Error with the match place LookupResult::Parent(_) => { for ge in &mut *grouped_errors { if let GroupedMoveError::MovesFromMatchPlace { span, binds_to, .. } = ge { if match_span == *span { debug!("appending local({:?}) to list", bind_to); if !binds_to.is_empty() { binds_to.push(bind_to); } return; } } } debug!("found a new move error location"); // Don't need to point to x in let x = ... . let (binds_to, span) = if from_simple_let { (vec![], statement_span) } else { (vec![bind_to], match_span) }; grouped_errors.push(GroupedMoveError::MovesFromMatchPlace { span, move_from: match_place.clone(), kind, binds_to, }); } // Error with the pattern LookupResult::Exact(_) => { let mpi = match self.move_data.rev_lookup.find(move_from) { LookupResult::Parent(Some(mpi)) => mpi, // move_from should be a projection from match_place. _ => unreachable!("Probably not unreachable..."), }; for ge in &mut *grouped_errors { if let GroupedMoveError::MovesFromPattern { span, move_from: other_mpi, binds_to, .. } = ge { if match_span == *span && mpi == *other_mpi { debug!("appending local({:?}) to list", bind_to); binds_to.push(bind_to); return; } } } debug!("found a new move error location"); grouped_errors.push(GroupedMoveError::MovesFromPattern { span: match_span, move_from: mpi, kind, binds_to: vec![bind_to], }); } }; } fn report(&mut self, error: GroupedMoveError<'tcx>) { let (mut err, err_span) = { let (span, kind): (Span, &IllegalMoveOriginKind) = match error { GroupedMoveError::MovesFromMatchPlace { span, ref kind, .. } | GroupedMoveError::MovesFromPattern { span, ref kind, .. } | GroupedMoveError::OtherIllegalMove { span, ref kind } => (span, kind), }; let origin = Origin::Mir; ( match kind { IllegalMoveOriginKind::Static => { self.tcx.cannot_move_out_of(span, "static item", origin) } IllegalMoveOriginKind::BorrowedContent { target_place: place } => { // Inspect the type of the content behind the // borrow to provide feedback about why this // was a move rather than a copy. let ty = place.ty(self.mir, self.tcx).to_ty(self.tcx); match ty.sty { ty::TyArray(..) | ty::TySlice(..) => self .tcx .cannot_move_out_of_interior_noncopy(span, ty, None, origin), ty::TyClosure(def_id, closure_substs) if !self.mir.upvar_decls.is_empty() && { match place { Place::Projection(ref proj) => { proj.base == Place::Local(Local::new(1)) } Place::Promoted(_) | Place::Local(_) | Place::Static(_) => unreachable!(), } } => { let closure_kind_ty = closure_substs.closure_kind_ty(def_id, self.tcx); let closure_kind = closure_kind_ty.to_opt_closure_kind(); let place_description = match closure_kind { Some(ty::ClosureKind::Fn) => { "captured variable in an `Fn` closure" } Some(ty::ClosureKind::FnMut) => { "captured variable in an `FnMut` closure" } Some(ty::ClosureKind::FnOnce) => { bug!("closure kind does not match first argument type") } None => bug!("closure kind not inferred by borrowck"), }; self.tcx.cannot_move_out_of(span, place_description, origin) } _ => self .tcx .cannot_move_out_of(span, "borrowed content", origin), } } IllegalMoveOriginKind::InteriorOfTypeWithDestructor { container_ty: ty } => { self.tcx .cannot_move_out_of_interior_of_drop(span, ty, origin) } IllegalMoveOriginKind::InteriorOfSliceOrArray { ty, is_index } => self .tcx .cannot_move_out_of_interior_noncopy(span, ty, Some(*is_index), origin), }, span, ) }; self.add_move_hints(error, &mut err, err_span); err.buffer(&mut self.errors_buffer); } fn add_move_hints( &self, error: GroupedMoveError<'tcx>, err: &mut DiagnosticBuilder<'a>, span: Span, ) { match error { GroupedMoveError::MovesFromMatchPlace { mut binds_to, move_from, .. } => { // Ok to suggest a borrow, since the target can't be moved from // anyway. if let Ok(snippet) = self.tcx.sess.codemap().span_to_snippet(span) { match move_from { Place::Projection(ref proj) if self.suitable_to_remove_deref(proj, &snippet) => { err.span_suggestion( span, "consider removing this dereference operator", (&snippet[1..]).to_owned(), ); } _ => { err.span_suggestion( span, "consider using a reference instead", format!("&{}", snippet), ); } } binds_to.sort(); binds_to.dedup(); for local in binds_to { let bind_to = &self.mir.local_decls[local]; let binding_span = bind_to.source_info.span; err.span_label( binding_span, format!( "move occurs because {} has type `{}`, \ which does not implement the `Copy` trait", bind_to.name.unwrap(), bind_to.ty ), ); } } } GroupedMoveError::MovesFromPattern { mut binds_to, .. } => { // Suggest ref, since there might be a move in // another match arm binds_to.sort(); binds_to.dedup(); let mut multipart_suggestion = Vec::with_capacity(binds_to.len()); for (j, local) in binds_to.into_iter().enumerate() { let bind_to = &self.mir.local_decls[local]; let binding_span = bind_to.source_info.span; // Suggest ref mut when the user has already written mut. let ref_kind = match bind_to.mutability { Mutability::Not => "ref", Mutability::Mut => "ref mut", }; if j == 0 { err.span_label(binding_span, format!("data moved here")); } else { err.span_label(binding_span, format!("... and here")); } match bind_to.name { Some(name) => { multipart_suggestion.push((binding_span, format!("{} {}", ref_kind, name))); } None => { err.span_label( span, format!("Local {:?} is not suitable for ref", bind_to), ); } } } err.multipart_suggestion("to prevent move, use ref or ref mut", multipart_suggestion); } // Nothing to suggest. GroupedMoveError::OtherIllegalMove { .. } => (), } } fn suitable_to_remove_deref(&self, proj: &PlaceProjection<'tcx>, snippet: &str) -> bool { let is_shared_ref = |ty: ty::Ty| match ty.sty { ty::TypeVariants::TyRef(.., hir::Mutability::MutImmutable) => true, _ => false, }; proj.elem == ProjectionElem::Deref && snippet.starts_with('*') && match proj.base { Place::Local(local) => { let local_decl = &self.mir.local_decls[local]; // If this is a temporary, then this could be from an // overloaded * operator. local_decl.is_user_variable.is_some() && is_shared_ref(local_decl.ty) } Place::Promoted(_) => true, Place::Static(ref st) => is_shared_ref(st.ty), Place::Projection(ref proj) => match proj.elem { ProjectionElem::Field(_, ty) => is_shared_ref(ty), _ => false, }, } } }
use std::hash::Hash; use db_dump::crates; use serde::{Deserialize, Serialize}; use crate::config::Category; #[derive(Debug, Clone)] pub struct CategoryData { pub category: Category, /// UNIQUE /// and taken from [`categories::Row`]. pub slug: String, pub crates: Vec<CrateData>, } #[derive(Debug, Clone, Serialize, Deserialize)] /// Should be unique by name! pub struct CrateData { pub name: String, #[serde(default)] pub downloads: u64, #[serde(default)] pub description: String, #[serde(default)] pub homepage: Option<String>, #[serde(default)] pub documentation: Option<String>, #[serde(default)] pub readme: Option<String>, #[serde(default)] pub repository: Option<String>, } impl Hash for CrateData { fn hash<H: std::hash::Hasher>(&self, state: &mut H) { self.name.hash(state); } } impl PartialEq for CrateData { fn eq(&self, other: &Self) -> bool { self.name == other.name } } impl Eq for CrateData {} #[derive(Serialize, Deserialize, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)] #[serde(transparent)] #[repr(transparent)] pub struct CrateId(pub u32); impl From<db_dump::crates::CrateId> for CrateId { fn from(crate_id: db_dump::crates::CrateId) -> Self { Self(crate_id.0) } } impl From<&crates::Row> for CrateData { fn from(row: &crates::Row) -> Self { Self { name: row.name.clone(), downloads: row.downloads, description: row.description.clone(), homepage: row.homepage.clone(), documentation: row.documentation.clone(), readme: row.documentation.clone(), repository: row.repository.clone(), } } }
use std::env; pub struct Options { pub is_short: bool, pub level: u32, } pub fn options() -> Options { let args = env::args(); parse_args(args) } fn parse_args(args: env::Args) -> Options { let mut is_short = false; let mut level_placeholder = ""; let argv: Vec<String> = args.collect(); let args = argv.iter(); for (i, arg) in args.enumerate() { match arg.as_str() { "-s" | "--short" => { is_short = true; } "-l" | "--level" => { level_placeholder = match argv.get(i + 1) { Some(n) => n, None => "", }; } _ => (), } } let level: u32 = if level_placeholder == "" { 0 } else { if let Ok(n) = level_placeholder.parse() { n } else { 0 } }; Options { is_short: is_short, level: level, } }
use std::cmp::{max, min}; use std::collections::{HashMap, HashSet}; use itertools::Itertools; use whiteread::parse_line; fn main() { let n: usize = parse_line().unwrap(); let mut paths: Vec<Vec<usize>> = vec![vec![]; n + 1]; for _ in 0..n - 1 { let (a, b): (usize, usize) = parse_line().unwrap(); paths[a].push(b); paths[b].push(a); } let mut stack = vec![(1, 0)]; let mut already = vec![false; n + 1]; already[1] = true; let mut maxmachi = 1; let mut maxdis = 0; while !stack.is_empty() { let (machi, dis) = stack.pop().unwrap(); for p in &paths[machi] { if already[*p] { continue; } stack.push((*p, dis + 1)); if maxdis < dis + 1 { maxmachi = *p; maxdis = dis + 1; } already[*p] = true; } } let mut stack = vec![(maxmachi, 0)]; let mut already = vec![false; n + 1]; already[maxmachi] = true; let mut maxdis = 0; while !stack.is_empty() { let (machi, dis) = stack.pop().unwrap(); for p in &paths[machi] { if already[*p] { continue; } stack.push((*p, dis + 1)); if maxdis < dis + 1 { maxdis = dis + 1; } already[*p] = true; } } println!("{}", maxdis + 1); }
use super::*; use alloc::boxed::Box; use core::marker::PhantomData; ///Specified which type of dfs order we want. In order/pre order/post order. trait DfsOrder: Clone { fn split_mut<T>(nodes: &mut [T]) -> (&mut T, &mut [T], &mut [T]); fn split<T>(nodes: &[T]) -> (&T, &[T], &[T]); } ///Pass this to the tree for In order layout #[derive(Copy, Clone, Debug)] pub struct InOrder; impl DfsOrder for InOrder { fn split_mut<T>(nodes: &mut [T]) -> (&mut T, &mut [T], &mut [T]) { let mid = nodes.len() / 2; let (left, rest) = nodes.split_at_mut(mid); let (middle, right) = rest.split_first_mut().unwrap(); (middle, left, right) } fn split<T>(nodes: &[T]) -> (&T, &[T], &[T]) { let mid = nodes.len() / 2; let (left, rest) = nodes.split_at(mid); let (middle, right) = rest.split_first().unwrap(); (middle, left, right) } } ///Pass this to the tree for pre order layout #[derive(Copy, Clone, Debug)] pub struct PreOrder; impl DfsOrder for PreOrder { fn split_mut<T>(nodes: &mut [T]) -> (&mut T, &mut [T], &mut [T]) { let (middle, rest) = nodes.split_first_mut().unwrap(); let mm = rest.len() / 2; let (left, right) = rest.split_at_mut(mm); (middle, left, right) } fn split<T>(nodes: &[T]) -> (&T, &[T], &[T]) { let (middle, rest) = nodes.split_first().unwrap(); let mm = rest.len() / 2; let (left, right) = rest.split_at(mm); (middle, left, right) } } ///Pass this to the tree for post order layout #[derive(Copy, Clone, Debug)] pub struct PostOrder; impl DfsOrder for PostOrder { fn split_mut<T>(nodes: &mut [T]) -> (&mut T, &mut [T], &mut [T]) { let (middle, rest) = nodes.split_last_mut().unwrap(); let mm = rest.len() / 2; let (left, right) = rest.split_at_mut(mm); (middle, left, right) } fn split<T>(nodes: &[T]) -> (&T, &[T], &[T]) { let (middle, rest) = nodes.split_last().unwrap(); let mm = rest.len() / 2; let (left, right) = rest.split_at(mm); (middle, left, right) } } ///Container for a dfs order tree. Internally uses a Vec. Derefs to a CompleteTree. #[repr(transparent)] #[derive(Clone)] pub struct CompleteTreeContainer<T, D> { _p: PhantomData<D>, nodes: Box<[T]>, } impl<T> CompleteTreeContainer<T, PreOrder> { #[inline] pub fn from_preorder( vec: Vec<T>, ) -> Result<CompleteTreeContainer<T, PreOrder>, NotCompleteTreeSizeErr> { CompleteTreeContainer::from_vec_inner(vec, PreOrder) } } impl<T> CompleteTreeContainer<T, InOrder> { #[inline] pub fn from_inorder( vec: Vec<T>, ) -> Result<CompleteTreeContainer<T, InOrder>, NotCompleteTreeSizeErr> { CompleteTreeContainer::from_vec_inner(vec, InOrder) } } impl<T> CompleteTreeContainer<T, PostOrder> { #[inline] pub fn from_postorder( vec: Vec<T>, ) -> Result<CompleteTreeContainer<T, PostOrder>, NotCompleteTreeSizeErr> { CompleteTreeContainer::from_vec_inner(vec, PostOrder) } } impl<T, D> CompleteTreeContainer<T, D> { #[inline] ///Returns the underlying elements as they are, in BFS order. pub fn into_nodes(self) -> Box<[T]> { self.nodes } pub fn as_tree(&self) -> CompleteTree<T, D> { CompleteTree { _p: PhantomData, nodes: &self.nodes, } } pub fn as_tree_mut(&mut self) -> CompleteTreeMut<T, D> { CompleteTreeMut { _p: PhantomData, nodes: &mut self.nodes, } } #[inline] fn from_vec_inner( vec: Vec<T>, _order: D, ) -> Result<CompleteTreeContainer<T, D>, NotCompleteTreeSizeErr> { valid_node_num(vec.len())?; Ok(CompleteTreeContainer { _p: PhantomData, nodes: vec.into_boxed_slice(), }) } } ///Complete binary tree stored in DFS inorder order. ///Height is atleast 1. #[repr(transparent)] pub struct CompleteTree<'a, T, D> { _p: PhantomData<D>, nodes: &'a [T], } impl<'a, T> CompleteTree<'a, T, PreOrder> { #[inline] pub fn from_preorder( arr: &'a [T], ) -> Result<CompleteTree<'a, T, PreOrder>, NotCompleteTreeSizeErr> { CompleteTree::from_slice_inner(arr, PreOrder) } } impl<'a, T> CompleteTree<'a, T, InOrder> { #[inline] pub fn from_inorder( arr: &'a [T], ) -> Result<CompleteTree<'a, T, InOrder>, NotCompleteTreeSizeErr> { CompleteTree::from_slice_inner(arr, InOrder) } } impl<'a, T> CompleteTree<'a, T, PostOrder> { #[inline] pub fn from_postorder( arr: &'a [T], ) -> Result<CompleteTree<'a, T, PostOrder>, NotCompleteTreeSizeErr> { CompleteTree::from_slice_inner(arr, PostOrder) } } pub struct CompleteTreeMut<'a, T, D> { _p: PhantomData<D>, nodes: &'a mut [T], } impl<'a, T> CompleteTreeMut<'a, T, PreOrder> { #[inline] pub fn from_preorder_mut( arr: &'a mut [T], ) -> Result<CompleteTreeMut<'a, T, PreOrder>, NotCompleteTreeSizeErr> { CompleteTreeMut::from_slice_inner_mut(arr, PreOrder) } } impl<'a, T> CompleteTreeMut<'a, T, InOrder> { #[inline] pub fn from_inorder_mut( arr: &'a mut [T], ) -> Result<CompleteTreeMut<'a, T, InOrder>, NotCompleteTreeSizeErr> { CompleteTreeMut::from_slice_inner_mut(arr, InOrder) } } impl<'a, T> CompleteTreeMut<'a, T, PostOrder> { #[inline] pub fn from_post_mut( arr: &'a mut [T], ) -> Result<CompleteTreeMut<'a, T, PostOrder>, NotCompleteTreeSizeErr> { CompleteTreeMut::from_slice_inner_mut(arr, PostOrder) } } impl<'a, T, D> From<CompleteTreeMut<'a, T, D>> for CompleteTree<'a, T, D> { fn from(a: CompleteTreeMut<'a, T, D>) -> CompleteTree<'a, T, D> { CompleteTree { _p: PhantomData, nodes: a.nodes, } } } impl<'a, T, D> CompleteTreeMut<'a, T, D> { pub fn as_tree(&self) -> CompleteTree<T, D> { CompleteTree { _p: PhantomData, nodes: self.nodes, } } pub fn borrow_mut(&mut self)->CompleteTreeMut<T,D>{ CompleteTreeMut{ _p:PhantomData, nodes:self.nodes } } #[inline] fn from_slice_inner_mut( arr: &'a mut [T], _order: D, ) -> Result<CompleteTreeMut<'a, T, D>, NotCompleteTreeSizeErr> { valid_node_num(arr.len())?; Ok(CompleteTreeMut { _p: PhantomData, nodes: arr, }) } #[inline] pub fn get_nodes_mut( self) -> &'a mut [T] { self.nodes } #[inline] pub fn vistr_mut(self) -> VistrMut<'a,T, D> { VistrMut { _p: PhantomData, remaining: self.nodes, } } } impl<'a, T, D> CompleteTree<'a, T, D> { #[inline] fn from_slice_inner( arr: &'a [T], _order: D, ) -> Result<CompleteTree<'a, T, D>, NotCompleteTreeSizeErr> { valid_node_num(arr.len())?; Ok(CompleteTree { _p: PhantomData, nodes: arr, }) } pub fn borrow(&self)->CompleteTree<T,D>{ CompleteTree{ _p:PhantomData, nodes:self.nodes } } #[inline] pub fn get_height(self) -> usize { compute_height(self.nodes.len()) } #[inline] pub fn get_nodes(self) -> &'a [T] { self.nodes } #[inline] pub fn vistr(self) -> Vistr<'a,T, D> { Vistr { _p: PhantomData, remaining: self.nodes, } } } ///Tree visitor that returns a reference to each element in the tree. #[repr(transparent)] pub struct Vistr<'a, T: 'a, D> { _p: PhantomData<D>, remaining: &'a [T], } impl<'a, T: 'a, D> Clone for Vistr<'a, T, D> { fn clone(&self) -> Vistr<'a, T, D> { Vistr { _p: PhantomData, remaining: self.remaining, } } } impl<'a, T: 'a, D> Vistr<'a, T, D> { #[inline] pub fn borrow(&self) -> Vistr<T, D> { Vistr { _p: PhantomData, remaining: self.remaining, } } #[inline] pub fn into_slice(self) -> &'a [T] { self.remaining } } impl<'a, T: 'a> Visitor for Vistr<'a, T, PreOrder> { type Item = &'a T; #[inline] fn next(self) -> (Self::Item, Option<[Self; 2]>) { vistr_next::<_, PreOrder>(self) } #[inline] fn level_remaining_hint(&self) -> (usize, Option<usize>) { vistr_dfs_level_remaining_hint(self) } ///Calls the closure in dfs preorder (root,left,right). ///Takes advantage of the callstack to do dfs. #[inline] fn dfs_preorder(self, mut func: impl FnMut(Self::Item)) { for a in self.remaining.iter() { func(a); } } } impl<'a, T: 'a> Visitor for Vistr<'a, T, InOrder> { type Item = &'a T; #[inline] fn next(self) -> (Self::Item, Option<[Self; 2]>) { vistr_next::<_, InOrder>(self) } #[inline] fn level_remaining_hint(&self) -> (usize, Option<usize>) { vistr_dfs_level_remaining_hint(self) } ///Calls the closure in dfs preorder (root,left,right). ///Takes advantage of the callstack to do dfs. #[inline] fn dfs_inorder(self, mut func: impl FnMut(Self::Item)) { for a in self.remaining.iter() { func(a); } } } impl<'a, T: 'a> Visitor for Vistr<'a, T, PostOrder> { type Item = &'a T; #[inline] fn next(self) -> (Self::Item, Option<[Self; 2]>) { vistr_next::<_, PostOrder>(self) } #[inline] fn level_remaining_hint(&self) -> (usize, Option<usize>) { vistr_dfs_level_remaining_hint(self) } ///Calls the closure in dfs preorder (root,left,right). ///Takes advantage of the callstack to do dfs. #[inline] fn dfs_postorder(self, mut func: impl FnMut(Self::Item)) { for a in self.remaining.iter() { func(a); } } } //TODO put this somewhere else fn log_2(x: usize) -> usize { const fn num_bits<T>() -> usize { core::mem::size_of::<T>() * 8 } assert!(x > 0); (num_bits::<usize>() as u32 - x.leading_zeros() - 1) as usize } fn vistr_dfs_level_remaining_hint<T, D: DfsOrder>(vistr: &Vistr<T, D>) -> (usize, Option<usize>) { let left = log_2(vistr.remaining.len() + 1); //let left = ((vistr.remaining.len() + 1) as f64).log2() as usize; (left, Some(left)) } fn vistr_next<T, D: DfsOrder>(vistr: Vistr<T, D>) -> (&T, Option<[Vistr<T, D>; 2]>) { let remaining = vistr.remaining; if remaining.len() == 1 { (&remaining[0], None) } else { let (middle, left, right) = D::split(remaining); ( middle, Some([ Vistr { _p: PhantomData, remaining: left, }, Vistr { _p: PhantomData, remaining: right, }, ]), ) } } impl<'a, T: 'a> FixedDepthVisitor for Vistr<'a, T, PreOrder> {} impl<'a, T: 'a> FixedDepthVisitor for Vistr<'a, T, InOrder> {} impl<'a, T: 'a> FixedDepthVisitor for Vistr<'a, T, PostOrder> {} impl<'a, T: 'a, D> From<VistrMut<'a, T, D>> for Vistr<'a, T, D> { #[inline] fn from(a: VistrMut<'a, T, D>) -> Vistr<'a, T, D> { Vistr { _p: PhantomData, remaining: a.remaining, } } } ///Tree visitor that returns a mutable reference to each element in the tree. #[repr(transparent)] pub struct VistrMut<'a, T: 'a, D> { _p: PhantomData<D>, remaining: &'a mut [T], } impl<'a, T: 'a, D> VistrMut<'a, T, D> { #[inline] pub fn borrow(&self) -> Vistr<T, D> { Vistr { _p: PhantomData, remaining: self.remaining, } } #[inline] pub fn borrow_mut(&mut self) -> VistrMut<T, D> { VistrMut { _p: PhantomData, remaining: self.remaining, } } #[inline] pub fn into_slice(self) -> &'a mut [T] { self.remaining } } fn vistr_mut_dfs_level_remaining_hint<T, D: DfsOrder>( vistr: &VistrMut<T, D>, ) -> (usize, Option<usize>) { let left = log_2(vistr.remaining.len() + 1); //let left = ((vistr.remaining.len() + 1) as f64).log2() as usize; (left, Some(left)) } fn vistr_mut_next<T, D: DfsOrder>(vistr: VistrMut<T, D>) -> (&mut T, Option<[VistrMut<T, D>; 2]>) { let remaining = vistr.remaining; if remaining.len() == 1 { (&mut remaining[0], None) } else { let (middle, left, right) = D::split_mut(remaining); ( middle, Some([ VistrMut { _p: PhantomData, remaining: left, }, VistrMut { _p: PhantomData, remaining: right, }, ]), ) } } impl<'a, T: 'a> Visitor for VistrMut<'a, T, PreOrder> { type Item = &'a mut T; #[inline] fn next(self) -> (Self::Item, Option<[Self; 2]>) { vistr_mut_next::<_, PreOrder>(self) } #[inline] fn level_remaining_hint(&self) -> (usize, Option<usize>) { vistr_mut_dfs_level_remaining_hint(self) } ///Calls the closure in dfs preorder (root,left,right). ///Takes advantage of the callstack to do dfs. #[inline] fn dfs_preorder(self, mut func: impl FnMut(Self::Item)) { for a in self.remaining.iter_mut() { func(a); } } } impl<'a, T: 'a> Visitor for VistrMut<'a, T, InOrder> { type Item = &'a mut T; #[inline] fn next(self) -> (Self::Item, Option<[Self; 2]>) { vistr_mut_next::<_, InOrder>(self) } #[inline] fn level_remaining_hint(&self) -> (usize, Option<usize>) { vistr_mut_dfs_level_remaining_hint(self) } ///Calls the closure in dfs preorder (root,left,right). ///Takes advantage of the callstack to do dfs. #[inline] fn dfs_inorder(self, mut func: impl FnMut(Self::Item)) { for a in self.remaining.iter_mut() { func(a); } } } impl<'a, T: 'a> Visitor for VistrMut<'a, T, PostOrder> { type Item = &'a mut T; #[inline] fn next(self) -> (Self::Item, Option<[Self; 2]>) { vistr_mut_next::<_, PostOrder>(self) } #[inline] fn level_remaining_hint(&self) -> (usize, Option<usize>) { vistr_mut_dfs_level_remaining_hint(self) } ///Calls the closure in dfs preorder (root,left,right). ///Takes advantage of the callstack to do dfs. #[inline] fn dfs_postorder(self, mut func: impl FnMut(Self::Item)) { for a in self.remaining.iter_mut() { func(a); } } } impl<'a, T: 'a> FixedDepthVisitor for VistrMut<'a, T, PreOrder> {} impl<'a, T: 'a> FixedDepthVisitor for VistrMut<'a, T, InOrder> {} impl<'a, T: 'a> FixedDepthVisitor for VistrMut<'a, T, PostOrder> {}
use super::*; pub(crate) fn string(i: &[u8]) -> Result<Cow<str>> { is_not::<_, _, ParserError<'_>>("\x00")(i) .map(|(i2, s)| (&i2[1..], String::from_utf8_lossy(s))) .map_err(|_| Err::Error(ParserError(i, ParserErrorKind::StringOverflow))) } use nom::error::ParseError; pub(crate) fn be_usize<'a, E: ParseError<&'a [u8]>>(i: &'a [u8]) -> IResult<&'a [u8], usize, E> { map(be_u32, |x| x as usize)(i) } use std::slice::SliceIndex; pub(crate) fn slice_input<S>(i: &[u8], s: S) -> core::result::Result<&[u8], Err<ParserError<'_>>> where S: SliceIndex<[u8], Output = [u8]>, { i.get(s) .ok_or(Err::Failure(ParserError(i, ParserErrorKind::InvalidOffset))) } pub(crate) fn slice<'a, S, F, O, E>(f: F, s: S) -> impl FnOnce(&'a [u8]) -> Result<O> where S: SliceIndex<[u8], Output = [u8]>, F: Fn(&'a [u8]) -> IResult<&'a [u8], O, E>, ParserError<'a>: From<E>, { move |i: &'a [u8]| f(slice_input(i, s)?).map_err(Err::convert) } pub(crate) type Result<'a, O> = IResult<&'a [u8], O, ParserError<'a>>;
// SPDX-License-Identifier: (MIT OR Apache-2.0) use std::collections::HashMap; use std::ffi::OsStr; use std::fs::File; use std::io::{Read, Seek, SeekFrom}; use fuser::{ReplyAttr, ReplyData, ReplyDirectory, ReplyEmpty, ReplyEntry, ReplyOpen, Request}; use libc::{EISDIR, ENOTDIR}; use std::time::Duration; use iso9660::{DirectoryEntry, ISODirectory, ISOFileReader, ISO9660}; fn entry_to_filetype(entry: &DirectoryEntry<File>) -> fuser::FileType { match entry { DirectoryEntry::File(_) => fuser::FileType::RegularFile, DirectoryEntry::Directory(_) => fuser::FileType::Directory, } } fn get_fileattr(ino: u64, entry: &DirectoryEntry<File>) -> fuser::FileAttr { let blocks = (entry.header().extent_length + 2048 - 1) / 2048; // ceil(len / 2048 let time = entry.header().time.into(); fuser::FileAttr { ino, size: entry.header().extent_length as u64, blocks: blocks as u64, atime: time, mtime: time, ctime: time, crtime: time, kind: entry_to_filetype(&entry), perm: 0444, nlink: 1, uid: 0, gid: 0, rdev: 0, flags: 0, blksize: 512, } } struct ISOFuse { _iso9660: ISO9660<File>, inodes: HashMap<u64, DirectoryEntry<File>>, inode_number: u64, directory_number: u64, file_number: u64, open_directories: HashMap<u64, ISODirectory<File>>, open_files: HashMap<u64, ISOFileReader<File>>, } impl ISOFuse { fn new(path: String) -> Self { let file = File::open(path).unwrap(); let iso9660 = ISO9660::new(file).unwrap(); let mut inodes = HashMap::new(); inodes.insert( fuser::FUSE_ROOT_ID, DirectoryEntry::Directory(iso9660.root.clone()), ); Self { _iso9660: iso9660, inodes, inode_number: fuser::FUSE_ROOT_ID + 1, file_number: 0, directory_number: 0, open_files: HashMap::new(), open_directories: HashMap::new(), } } } impl fuser::Filesystem for ISOFuse { fn lookup(&mut self, _req: &Request, parent: u64, name: &OsStr, reply: ReplyEntry) { let entry = self.inodes.get(&parent).unwrap(); if let DirectoryEntry::Directory(directory) = entry { match directory.find(name.to_str().unwrap()) { Ok(Some(entry)) => { let fileattr = get_fileattr(self.inode_number, &entry); self.inodes.insert(self.inode_number, entry); self.inode_number += 1; reply.entry(&Duration::from_secs(0), &fileattr, 0); } Ok(None) => {} Err(_) => {} } } else { reply.error(ENOTDIR); } } fn forget(&mut self, _req: &Request, ino: u64, _nlookup: u64) { self.inodes.remove(&ino); } fn getattr(&mut self, _req: &Request, ino: u64, reply: ReplyAttr) { let entry = self.inodes.get(&ino).unwrap(); let fileattr = get_fileattr(ino, entry); reply.attr(&Duration::from_secs(0), &fileattr); } fn open(&mut self, _req: &Request, ino: u64, _flags: i32, reply: ReplyOpen) { let entry = self.inodes.get(&ino).unwrap(); if let DirectoryEntry::File(file) = entry { self.open_files.insert(self.file_number, file.read()); reply.opened(self.file_number, 0); self.file_number += 1; } else { reply.error(EISDIR) } } fn read( &mut self, _req: &Request, _ino: u64, fh: u64, offset: i64, size: u32, _flags: i32, _lock_owner: Option<u64>, reply: ReplyData, ) { let file = self.open_files.get_mut(&fh).unwrap(); file.seek(SeekFrom::Start(offset as u64)).unwrap(); let mut buf = Vec::with_capacity(size as usize); let count = file.read(&mut buf).unwrap(); reply.data(&buf[..count]); } fn release( &mut self, _req: &Request, _ino: u64, fh: u64, _flags: i32, _lock_owner: Option<u64>, _flush: bool, reply: ReplyEmpty, ) { self.open_files.remove(&fh); reply.ok(); } fn opendir(&mut self, _req: &Request, ino: u64, _flags: i32, reply: ReplyOpen) { let entry = self.inodes.get(&ino).unwrap(); if let DirectoryEntry::Directory(directory) = entry { self.open_directories .insert(self.directory_number, directory.clone()); reply.opened(self.directory_number, 0); self.directory_number += 1; } else { reply.error(ENOTDIR) } } fn readdir( &mut self, _req: &Request, _ino: u64, fh: u64, offset: i64, mut reply: ReplyDirectory, ) { let dir = self.open_directories.get(&fh).unwrap(); if offset == -1 { reply.ok(); return; } let mut block = [0; 2048]; let mut block_num = None; let mut offset = offset as u64; loop { let (entry, next_offset) = dir .read_entry_at(&mut block, &mut block_num, offset) .unwrap(); let kind = entry_to_filetype(&entry); if reply.add( self.inode_number, next_offset.map(|x| x as i64).unwrap_or(-1), kind, entry.identifier(), ) { break; } self.inodes.insert(self.inode_number, entry); self.inode_number += 1; if let Some(next_offset) = next_offset { offset = next_offset; } else { break; } } reply.ok(); } fn releasedir(&mut self, _req: &Request, _ino: u64, fh: u64, _flags: i32, reply: ReplyEmpty) { self.open_directories.remove(&fh); reply.ok(); } } fn main() { let mut args = std::env::args().skip(1); let path = args.next().unwrap(); let mount_path = args.next().unwrap(); fuser::mount2(ISOFuse::new(path), &mount_path, &[]).unwrap(); }
extern crate specs; use specs::prelude::*; use crate::{CanMelee, CombatStats, GameLog, Name, SuffersDamage, TakesTurn, WantsToMelee}; pub struct MeleeCombatSystem; impl<'a> System<'a> for MeleeCombatSystem { type SystemData = ( WriteExpect<'a, GameLog>, WriteStorage<'a, WantsToMelee>, ReadStorage<'a, Name>, ReadStorage<'a, CombatStats>, WriteStorage<'a, SuffersDamage>, WriteStorage<'a, TakesTurn>, ReadStorage<'a, CanMelee>, ); fn run(&mut self, data: Self::SystemData) { let ( mut game_log, mut wants_melee, names, combat_stats, mut suffers_damage, mut takes_turn, can_melee, ) = data; for (wants_melee, name, stats, mut takes_turn, can_melee) in (&wants_melee, &names, &combat_stats, &mut takes_turn, &can_melee).join() { takes_turn.time_score += can_melee.time_cost; if stats.hp <= 0 { continue; } let target_stats = combat_stats.get(wants_melee.target).unwrap(); if target_stats.hp <= 0 { continue; } let target_name = names.get(wants_melee.target).unwrap(); let damage = i32::max(0, stats.power - target_stats.defense); if damage == 0 { game_log.add(format!( "{} is unable to hurt {}.", &name.name, &target_name.name)); } else { game_log.add(format!( "{} hits {} for {} hp.", &name.name, &target_name.name, damage)); suffers_damage .insert(wants_melee.target, SuffersDamage { amount: damage }) .expect("Unable to do damage"); } } wants_melee.clear(); } }
use crate::errors::*; pub fn read_dec_1(i: u8) -> Result<u8> { if !(0x30..=0x39).contains(&i) { Err(Error::UnexpectedByteInDecNum(i)) } else { Ok(0x0F & i) } } pub fn read_dec_4(i: &[u8]) -> Result<usize> { if i.len() < 4 { return Err(Error::UnexpectedEofInDecNum); } let mut result = 0usize; for (x, byte) in i.iter().enumerate().take(4) { result += 10_usize.pow(3 - x as u32) * read_dec_1(*byte)? as usize; } Ok(result) } pub fn read_dec_5(i: &[u8]) -> Result<usize> { if i.len() < 5 { return Err(Error::UnexpectedEofInDecNum); } let mut result = 0usize; for (x, byte) in i.iter().enumerate().take(5) { result += 10_usize.pow(4 - x as u32) * read_dec_1(*byte)? as usize; } Ok(result) }
use std::path::Path; use parity_wasm::{ deserialize_file, elements::{ExportEntry, ExportSection, External, ImportSection, Internal, Module}, serialize_to_file, }; pub fn rename_file_imported_functions<P, FR>(file_name: P, mut func_renamer: FR) where P: AsRef<Path> + std::fmt::Debug, FR: Fn(&[&str]) -> Vec<String>, { patch_wasm_file(file_name, rename_module_imported_functions, func_renamer); } pub fn rename_file_exported_functions<P, FR>(file_name: P, mut func_renamer: FR) where P: AsRef<Path> + std::fmt::Debug, FR: Fn(&[&str]) -> Vec<String>, { patch_wasm_file(file_name, rename_module_exported_functions, func_renamer); } fn rename_module_exported_functions<FR>(module: &mut Module, mut func_renamer: FR) where FR: Fn(&[&str]) -> Vec<String>, { let export = module.export_section_mut(); if export.is_none() { return; } let export: &mut ExportSection = export.unwrap(); for entry in export.entries_mut() { if let Internal::Function(_) = entry.internal() { let func_name = entry.field_mut(); let mut res = func_renamer(&[func_name]); let new_func_name = res.pop().unwrap(); std::mem::replace(func_name, new_func_name); } } } fn rename_module_imported_functions<FR>(module: &mut Module, mut func_renamer: FR) where FR: Fn(&[&str]) -> Vec<String>, { let import = module.import_section_mut(); if import.is_none() { return; } let import: &mut ImportSection = import.unwrap(); for entry in import.entries_mut() { if let External::Function(_) = entry.external() { let module = entry.module(); let func = entry.field(); let res = func_renamer(&[module, func]); // let new_module = res } } } fn patch_wasm_file<P, FR, MP>(file_name: P, module_patcher: MP, func_renamer: FR) where P: AsRef<Path> + std::fmt::Debug, FR: Fn(&[&str]) -> Vec<String>, MP: FnOnce(&mut Module, FR), { let mut module = deserialize_file(&file_name).unwrap(); module_patcher(&mut module, func_renamer); serialize_to_file(file_name, module); }
#[derive(PartialEq)] pub enum Class { IN, CH, HS, None, Wildcard, Unassigned(u16), Private(u16), Reserved(u16), } impl std::fmt::Display for Class { fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { match self { Class::IN => write!(fmt, "IN"), Class::CH => write!(fmt, "CH"), Class::HS => write!(fmt, "HS"), Class::None => write!(fmt, "None"), Class::Wildcard => write!(fmt, "Wildcard"), Class::Unassigned(n) => write!(fmt, "Unassigned({})", n), Class::Private(n) => write!(fmt, "Private({})", n), Class::Reserved(n) => write!(fmt, "eserved({})", n), } } } impl Default for Class { fn default() -> Class { Class::IN } } pub fn unpack(value: u16) -> Class { return match value { 0x0000 => Class::Reserved(0x0000), 0x0001 => Class::IN, 0x0003 => Class::CH, 0x0004 => Class::HS, 0x00FE => Class::None, 0x00FF => Class::Wildcard, 0xFFFF => Class::Reserved(0xFFFF), n => { if n < 0xFF00 { Class::Unassigned(n) } else { Class::Private(n) } } }; }
use efflux::prelude::*; /// The struct which implements the `Reducer` trait for PageRank. /// Should only be called once. pub struct AggregateReducer; /// A PageRank combiner. /// Emits the initial PageRank data for each out-link received. /// Also emits the list of out-links. impl Reducer for AggregateReducer { fn reduce(&mut self, key: &[u8], values: &[&[u8]], ctx: &mut Context) { let out = values .iter() .map(|value| std::str::from_utf8(value).unwrap()) .collect::<Vec<&str>>() .join(","); ctx.write(key, out.as_bytes()); } }
#[doc = "Reader of register FCMISC"] pub type R = crate::R<u32, super::FCMISC>; #[doc = "Writer for register FCMISC"] pub type W = crate::W<u32, super::FCMISC>; #[doc = "Register FCMISC `reset()`'s with value 0"] impl crate::ResetValue for super::FCMISC { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `AMISC`"] pub type AMISC_R = crate::R<bool, bool>; #[doc = "Write proxy for field `AMISC`"] pub struct AMISC_W<'a> { w: &'a mut W, } impl<'a> AMISC_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 `PMISC`"] pub type PMISC_R = crate::R<bool, bool>; #[doc = "Write proxy for field `PMISC`"] pub struct PMISC_W<'a> { w: &'a mut W, } impl<'a> PMISC_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 `EMISC`"] pub type EMISC_R = crate::R<bool, bool>; #[doc = "Write proxy for field `EMISC`"] pub struct EMISC_W<'a> { w: &'a mut W, } impl<'a> EMISC_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 `VOLTMISC`"] pub type VOLTMISC_R = crate::R<bool, bool>; #[doc = "Write proxy for field `VOLTMISC`"] pub struct VOLTMISC_W<'a> { w: &'a mut W, } impl<'a> VOLTMISC_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9); self.w } } #[doc = "Reader of field `INVDMISC`"] pub type INVDMISC_R = crate::R<bool, bool>; #[doc = "Write proxy for field `INVDMISC`"] pub struct INVDMISC_W<'a> { w: &'a mut W, } impl<'a> INVDMISC_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10); self.w } } #[doc = "Reader of field `ERMISC`"] pub type ERMISC_R = crate::R<bool, bool>; #[doc = "Write proxy for field `ERMISC`"] pub struct ERMISC_W<'a> { w: &'a mut W, } impl<'a> ERMISC_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11); self.w } } #[doc = "Reader of field `PROGMISC`"] pub type PROGMISC_R = crate::R<bool, bool>; #[doc = "Write proxy for field `PROGMISC`"] pub struct PROGMISC_W<'a> { w: &'a mut W, } impl<'a> PROGMISC_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 13)) | (((value as u32) & 0x01) << 13); self.w } } impl R { #[doc = "Bit 0 - Access Masked Interrupt Status and Clear"] #[inline(always)] pub fn amisc(&self) -> AMISC_R { AMISC_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - Programming Masked Interrupt Status and Clear"] #[inline(always)] pub fn pmisc(&self) -> PMISC_R { PMISC_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 2 - EEPROM Masked Interrupt Status and Clear"] #[inline(always)] pub fn emisc(&self) -> EMISC_R { EMISC_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 9 - VOLT Masked Interrupt Status and Clear"] #[inline(always)] pub fn voltmisc(&self) -> VOLTMISC_R { VOLTMISC_R::new(((self.bits >> 9) & 0x01) != 0) } #[doc = "Bit 10 - Invalid Data Masked Interrupt Status and Clear"] #[inline(always)] pub fn invdmisc(&self) -> INVDMISC_R { INVDMISC_R::new(((self.bits >> 10) & 0x01) != 0) } #[doc = "Bit 11 - ERVER Masked Interrupt Status and Clear"] #[inline(always)] pub fn ermisc(&self) -> ERMISC_R { ERMISC_R::new(((self.bits >> 11) & 0x01) != 0) } #[doc = "Bit 13 - PROGVER Masked Interrupt Status and Clear"] #[inline(always)] pub fn progmisc(&self) -> PROGMISC_R { PROGMISC_R::new(((self.bits >> 13) & 0x01) != 0) } } impl W { #[doc = "Bit 0 - Access Masked Interrupt Status and Clear"] #[inline(always)] pub fn amisc(&mut self) -> AMISC_W { AMISC_W { w: self } } #[doc = "Bit 1 - Programming Masked Interrupt Status and Clear"] #[inline(always)] pub fn pmisc(&mut self) -> PMISC_W { PMISC_W { w: self } } #[doc = "Bit 2 - EEPROM Masked Interrupt Status and Clear"] #[inline(always)] pub fn emisc(&mut self) -> EMISC_W { EMISC_W { w: self } } #[doc = "Bit 9 - VOLT Masked Interrupt Status and Clear"] #[inline(always)] pub fn voltmisc(&mut self) -> VOLTMISC_W { VOLTMISC_W { w: self } } #[doc = "Bit 10 - Invalid Data Masked Interrupt Status and Clear"] #[inline(always)] pub fn invdmisc(&mut self) -> INVDMISC_W { INVDMISC_W { w: self } } #[doc = "Bit 11 - ERVER Masked Interrupt Status and Clear"] #[inline(always)] pub fn ermisc(&mut self) -> ERMISC_W { ERMISC_W { w: self } } #[doc = "Bit 13 - PROGVER Masked Interrupt Status and Clear"] #[inline(always)] pub fn progmisc(&mut self) -> PROGMISC_W { PROGMISC_W { w: self } } }
//! Configuration of git-global. //! //! Exports the `Config` struct, which defines the base path for finding git //! repos on the machine, path patterns to ignore when scanning for repos, the //! location of a cache file, and other config options for running git-global. use std::fs::{remove_file, File}; use std::io::{BufRead, BufReader, Write}; use std::path::PathBuf; use app_dirs::{app_dir, get_app_dir, AppDataType, AppInfo}; use dirs::home_dir; use git2; use walkdir::{DirEntry, WalkDir}; use repo::Repo; const APP: AppInfo = AppInfo { name: "git-global", author: "peap", }; const CACHE_FILE: &'static str = "repos.txt"; const DEFAULT_CMD: &'static str = "status"; const DEFAULT_FOLLOW_SYMLINKS: bool = true; const DEFAULT_SAME_FILESYSTEM: bool = cfg!(any(unix, windows)); const DEFAULT_SHOW_UNTRACKED: bool = true; const SETTING_BASEDIR: &'static str = "global.basedir"; const SETTING_FOLLOW_SYMLINKS: &'static str = "global.follow-symlinks"; const SETTING_SAME_FILESYSTEM: &'static str = "global.same-filesystem"; const SETTING_IGNORE: &'static str = "global.ignore"; const SETTING_DEFAULT_CMD: &'static str = "global.default-cmd"; const SETTING_SHOW_UNTRACKED: &'static str = "global.show-untracked"; /// A container for git-global configuration options. pub struct Config { /// The base directory to walk when searching for git repositories. /// /// Default: $HOME. pub basedir: PathBuf, /// Whether to follow symbolic links when searching for git repos. /// /// Default: true pub follow_symlinks: bool, /// Whether to stay on the same filesystem (as `basedir`) when searching /// for git repos on Unix or Windows. /// /// Default: true [on supported platforms] pub same_filesystem: bool, /// Path patterns to ignore when searching for git repositories. /// /// Default: none pub ignored_patterns: Vec<String>, /// The git-global subcommand to run when unspecified. /// /// Default: `status` pub default_cmd: String, /// Whether to show untracked files in output. /// /// Default: true pub show_untracked: bool, /// Path a cache file for git-global's usage. /// /// Default: `repos.txt` in the user's XDG cache directory. pub cache_file: PathBuf, } impl Config { /// Create a new `Config` with the default behavior, first checking global /// git config options in ~/.gitconfig, then using defaults: pub fn new() -> Config { // Find the user's home directory. let homedir = home_dir().expect("Could not determine home directory."); // Set the options that aren't user-configurable. let cache_file = match get_app_dir(AppDataType::UserCache, &APP, "cache") { Ok(mut dir) => { dir.push(CACHE_FILE); dir } Err(_) => panic!("TODO: work without XDG"), }; // Try to read user's Git configuration and return a Config object. match git2::Config::open_default() { Ok(cfg) => Config { basedir: cfg.get_path(SETTING_BASEDIR).unwrap_or(homedir), follow_symlinks: cfg .get_bool(SETTING_FOLLOW_SYMLINKS) .unwrap_or(DEFAULT_FOLLOW_SYMLINKS), same_filesystem: cfg .get_bool(SETTING_SAME_FILESYSTEM) .unwrap_or(DEFAULT_SAME_FILESYSTEM), ignored_patterns: cfg .get_string(SETTING_IGNORE) .unwrap_or(String::new()) .split(",") .map(|p| p.trim().to_string()) .collect(), default_cmd: cfg .get_string(SETTING_DEFAULT_CMD) .unwrap_or(String::from(DEFAULT_CMD)), show_untracked: cfg .get_bool(SETTING_SHOW_UNTRACKED) .unwrap_or(DEFAULT_SHOW_UNTRACKED), cache_file: cache_file, }, Err(_) => { // Build the default configuration. Config { basedir: homedir, follow_symlinks: DEFAULT_FOLLOW_SYMLINKS, same_filesystem: DEFAULT_SAME_FILESYSTEM, ignored_patterns: vec![], default_cmd: String::from(DEFAULT_CMD), show_untracked: DEFAULT_SHOW_UNTRACKED, cache_file: cache_file, } } } } /// Returns all known git repos, populating the cache first, if necessary. pub fn get_repos(&mut self) -> Vec<Repo> { if !self.has_cache() { let repos = self.find_repos(); self.cache_repos(&repos); } self.get_cached_repos() } /// Clears the cache of known git repos, forcing a re-scan on the next /// `get_repos()` call. pub fn clear_cache(&mut self) { if self.has_cache() { remove_file(&self.cache_file) .expect("Failed to delete cache file."); } } /// Returns `true` if this directory entry should be included in scans. fn filter(&self, entry: &DirEntry) -> bool { if let Some(entry_path) = entry.path().to_str() { self.ignored_patterns .iter() .filter(|p| p != &"") .fold(true, |acc, pattern| acc && !entry_path.contains(pattern)) } else { // Skip invalid file name false } } /// Walks the configured base directory, looking for git repos. fn find_repos(&self) -> Vec<Repo> { let mut repos = Vec::new(); println!( "Scanning for git repos under {}; this may take a while...", self.basedir.display() ); let walker = WalkDir::new(&self.basedir) .follow_links(self.follow_symlinks) .same_file_system(self.same_filesystem); for entry in walker.into_iter().filter_entry(|e| self.filter(e)) { match entry { Ok(entry) => { if entry.file_type().is_dir() && entry.file_name() == ".git" { let parent_path = entry .path() .parent() .expect("Could not determine parent."); match parent_path.to_str() { Some(path) => { repos.push(Repo::new(path.to_string())); } None => (), } } } Err(_) => (), } } repos.sort_by(|a, b| a.path().cmp(&b.path())); repos } /// Returns boolean indicating if the cache file exists. fn has_cache(&self) -> bool { self.cache_file.exists() } /// Writes the given repo paths to the cache file. fn cache_repos(&self, repos: &Vec<Repo>) { if !self.cache_file.as_path().exists() { // Try to create the cache directory if the cache *file* doesn't // exist; app_dir() handles an existing directory just fine. match app_dir(AppDataType::UserCache, &APP, "cache") { Ok(_) => (), Err(e) => panic!("Could not create cache directory: {}", e), } } let mut f = File::create(&self.cache_file) .expect("Could not create cache file."); for repo in repos.iter() { match writeln!(f, "{}", repo.path()) { Ok(_) => (), Err(e) => panic!("Problem writing cache file: {}", e), } } } /// Returns the list of repos found in the cache file. fn get_cached_repos(&self) -> Vec<Repo> { let mut repos = Vec::new(); if self.cache_file.exists() { let f = File::open(&self.cache_file) .expect("Could not open cache file."); let reader = BufReader::new(f); for line in reader.lines() { match line { Ok(repo_path) => repos.push(Repo::new(repo_path)), Err(_) => (), // TODO: handle errors } } } repos } }
/* * Module: twofish * Autor: Piotr Pszczółkowski (piotr@beesoft.pl) * Date: 5/05/2019 * * Copyright (c) 2019, Piotr Pszczółkowski * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #![allow(dead_code)] const MDS_POLYNOMIAL: u32 = 0x169; // x^8 + x^6 + x^5 + x^3 + 1, see [TWOFISH] 4.2 const RS_POLYNOMIAL: u32 = 0x14d; // x^8 + x^6 + x^3 + x^2 + 1, see [TWOFISH] 4.3 /// Stores 'x' as bytes in 'data' in little-endian form. fn store32(data: &mut [u8], x: u32) { data[0] = x as u8; data[1] = x.wrapping_shr(8) as u8; data[2] = x.wrapping_shr(16) as u8; data[3] = x.wrapping_shr(24) as u8; } /// Reads a little-endian u32 from bytes in 'data'. fn load32(data: &[u8]) -> u32 { let x0 = data[0] as u32; let x1 = (data[1] as u32).wrapping_shl(8); let x2 = (data[2] as u32).wrapping_shl(16); let x3 = (data[3] as u32).wrapping_shl(24); x0|x1|x2|x3 } /// Returns 'x' after a left circular rotation of 'n' bits. fn rol(x: u32, n: u32) -> u32 { let x0 = x.wrapping_shl(n & 31); let x1 = x.wrapping_shr(32 - (n & 31)); x0|x1 } /// Returns 'x' after a right circular rotation of 'n' bits. fn ror(x: u32, n: u32) -> u32 { let x0 = x.wrapping_shr(n & 32); let x1 = x.wrapping_shl(32 - (n & 31)); x0|x1 } /// gf_mult returns a·b in GF(2^8)/p fn gf_mult(mut a: u8, b: u8, p: u32) -> u8 { let mut b32 = [0u32, b as u32]; let p32 = [0u32, p]; let mut retv = 0u32; for _i in 0..7 { retv ^= b32[(a & 1) as usize]; a = a.wrapping_shr(1); b32[1] = p32[b32[1].wrapping_shr(7) as usize] ^ b32[1].wrapping_shl(1); } retv as u8 } // mds_column_mult calculates y{col} where [y0 y1 y2 y3] = MDS · [x0] #[allow(non_snake_case)] fn mds_column_mult(i: u8, col: usize) -> u32 { let mul01 = i; let mul5B = gf_mult(i, 0x5B, MDS_POLYNOMIAL); let mulEF = gf_mult(i, 0xEF, MDS_POLYNOMIAL); match col { 0 => { let x0 = mul01 as u32; let x1 = (mul5B as u32).wrapping_shl(8); let x2 = (mulEF as u32).wrapping_shl(16); let x3 = (mulEF as u32).wrapping_shl(24); x0|x1|x2|x3 } 1 => { let x0 = mulEF as u32; let x1 = (mulEF as u32).wrapping_shl(8); let x2 = (mul5B as u32).wrapping_shl(16); let x3 = (mul01 as u32).wrapping_shl(24); x0|x1|x2|x3 } 2 => { let x0 = mul5B as u32; let x1 = (mulEF as u32).wrapping_shl(8); let x2 = (mul01 as u32).wrapping_shl(16); let x3 = (mulEF as u32).wrapping_shl(24); x0|x1|x2|x3 } 3 => { let x0 = mul5B as u32; let x1 = (mul01 as u32).wrapping_shl(8); let x2 = (mulEF as u32).wrapping_shl(16); let x3 = (mul5B as u32).wrapping_shl(24); x0|x1|x2|x3 } _ => { panic!("unreachable"); } } } // h implements the S-box generation function. See [TWOFISH] 4.3.5 fn h(i: &[u8], key: &[u8], offset: usize) -> u32 { let mut y = [i[0], i[1], i[2], i[3]]; let mut n = key.len(); if n == 4 { y[0] = SBOX[1][y[0] as usize] ^ key[4 * (6 + offset) + 0]; y[1] = SBOX[0][y[1] as usize] ^ key[4 * (6 + offset) + 1]; y[2] = SBOX[0][y[2] as usize] ^ key[4 * (6 + offset) + 2]; y[3] = SBOX[1][y[3] as usize] ^ key[4 * (6 + offset) + 3]; n -= 1; } if n == 3 { y[0] = SBOX[1][y[0] as usize] ^ key[4 * (4 + offset) +0]; y[1] = SBOX[1][y[1] as usize] ^ key[4 * (4 + offset) +1]; y[2] = SBOX[0][y[2] as usize] ^ key[4 * (4 + offset) +2]; y[3] = SBOX[0][y[3] as usize] ^ key[4 * (4 + offset) +3]; n -= 1; } if n == 2 { { let sv = SBOX[0][SBOX[0][y[0] as usize] as usize]; let k0 = key[4 * (2 + offset) + 0]; let k1 = key[4 * (0 + offset) + 0]; y[0] = SBOX[1][(sv ^ k0 ^ k1) as usize]; } { let sv = SBOX[0][SBOX[1][y[1] as usize] as usize]; let k0 = key[4 * (2 + offset) + 1]; let k1 = key[4 * (0 + offset) + 1]; y[1] = SBOX[0][(sv ^ k0 ^ k1) as usize]; } { let sv = SBOX[1][SBOX[0][y[2] as usize] as usize]; let k0 = key[4 * (2 + offset) + 2]; let k1 = key[4 * (0 + offset) + 2]; y[2] = SBOX[1][(sv ^ k0 ^ k1) as usize]; } { let sv = SBOX[1][SBOX[1][y[3] as usize] as usize]; let k0 = key[4 * (2 + offset) + 3]; let k1 = key[4 * (0 + offset) + 3]; y[3] = SBOX[0][(sv ^ k0 ^ k1) as usize]; } } let mut retv = 0u32; for i in 0..4 { retv ^= mds_column_mult(y[i], i); } retv } const RS: [[u8; 8]; 4] = [ [0x01, 0xA4, 0x55, 0x87, 0x5A, 0x58, 0xDB, 0x9E], [0xA4, 0x56, 0x82, 0xF3, 0x1E, 0xC6, 0x68, 0xE5], [0x02, 0xA1, 0xFC, 0xC1, 0x47, 0xAE, 0x3D, 0x19], [0xA4, 0x55, 0x87, 0x5A, 0x58, 0xDB, 0x9E, 0x03], ]; const SBOX: [[u8; 256]; 2] = [ [ 0xa9, 0x67, 0xb3, 0xe8, 0x04, 0xfd, 0xa3, 0x76, 0x9a, 0x92, 0x80, 0x78, 0xe4, 0xdd, 0xd1, 0x38, 0x0d, 0xc6, 0x35, 0x98, 0x18, 0xf7, 0xec, 0x6c, 0x43, 0x75, 0x37, 0x26, 0xfa, 0x13, 0x94, 0x48, 0xf2, 0xd0, 0x8b, 0x30, 0x84, 0x54, 0xdf, 0x23, 0x19, 0x5b, 0x3d, 0x59, 0xf3, 0xae, 0xa2, 0x82, 0x63, 0x01, 0x83, 0x2e, 0xd9, 0x51, 0x9b, 0x7c, 0xa6, 0xeb, 0xa5, 0xbe, 0x16, 0x0c, 0xe3, 0x61, 0xc0, 0x8c, 0x3a, 0xf5, 0x73, 0x2c, 0x25, 0x0b, 0xbb, 0x4e, 0x89, 0x6b, 0x53, 0x6a, 0xb4, 0xf1, 0xe1, 0xe6, 0xbd, 0x45, 0xe2, 0xf4, 0xb6, 0x66, 0xcc, 0x95, 0x03, 0x56, 0xd4, 0x1c, 0x1e, 0xd7, 0xfb, 0xc3, 0x8e, 0xb5, 0xe9, 0xcf, 0xbf, 0xba, 0xea, 0x77, 0x39, 0xaf, 0x33, 0xc9, 0x62, 0x71, 0x81, 0x79, 0x09, 0xad, 0x24, 0xcd, 0xf9, 0xd8, 0xe5, 0xc5, 0xb9, 0x4d, 0x44, 0x08, 0x86, 0xe7, 0xa1, 0x1d, 0xaa, 0xed, 0x06, 0x70, 0xb2, 0xd2, 0x41, 0x7b, 0xa0, 0x11, 0x31, 0xc2, 0x27, 0x90, 0x20, 0xf6, 0x60, 0xff, 0x96, 0x5c, 0xb1, 0xab, 0x9e, 0x9c, 0x52, 0x1b, 0x5f, 0x93, 0x0a, 0xef, 0x91, 0x85, 0x49, 0xee, 0x2d, 0x4f, 0x8f, 0x3b, 0x47, 0x87, 0x6d, 0x46, 0xd6, 0x3e, 0x69, 0x64, 0x2a, 0xce, 0xcb, 0x2f, 0xfc, 0x97, 0x05, 0x7a, 0xac, 0x7f, 0xd5, 0x1a, 0x4b, 0x0e, 0xa7, 0x5a, 0x28, 0x14, 0x3f, 0x29, 0x88, 0x3c, 0x4c, 0x02, 0xb8, 0xda, 0xb0, 0x17, 0x55, 0x1f, 0x8a, 0x7d, 0x57, 0xc7, 0x8d, 0x74, 0xb7, 0xc4, 0x9f, 0x72, 0x7e, 0x15, 0x22, 0x12, 0x58, 0x07, 0x99, 0x34, 0x6e, 0x50, 0xde, 0x68, 0x65, 0xbc, 0xdb, 0xf8, 0xc8, 0xa8, 0x2b, 0x40, 0xdc, 0xfe, 0x32, 0xa4, 0xca, 0x10, 0x21, 0xf0, 0xd3, 0x5d, 0x0f, 0x00, 0x6f, 0x9d, 0x36, 0x42, 0x4a, 0x5e, 0xc1, 0xe0, ], [ 0x75, 0xf3, 0xc6, 0xf4, 0xdb, 0x7b, 0xfb, 0xc8, 0x4a, 0xd3, 0xe6, 0x6b, 0x45, 0x7d, 0xe8, 0x4b, 0xd6, 0x32, 0xd8, 0xfd, 0x37, 0x71, 0xf1, 0xe1, 0x30, 0x0f, 0xf8, 0x1b, 0x87, 0xfa, 0x06, 0x3f, 0x5e, 0xba, 0xae, 0x5b, 0x8a, 0x00, 0xbc, 0x9d, 0x6d, 0xc1, 0xb1, 0x0e, 0x80, 0x5d, 0xd2, 0xd5, 0xa0, 0x84, 0x07, 0x14, 0xb5, 0x90, 0x2c, 0xa3, 0xb2, 0x73, 0x4c, 0x54, 0x92, 0x74, 0x36, 0x51, 0x38, 0xb0, 0xbd, 0x5a, 0xfc, 0x60, 0x62, 0x96, 0x6c, 0x42, 0xf7, 0x10, 0x7c, 0x28, 0x27, 0x8c, 0x13, 0x95, 0x9c, 0xc7, 0x24, 0x46, 0x3b, 0x70, 0xca, 0xe3, 0x85, 0xcb, 0x11, 0xd0, 0x93, 0xb8, 0xa6, 0x83, 0x20, 0xff, 0x9f, 0x77, 0xc3, 0xcc, 0x03, 0x6f, 0x08, 0xbf, 0x40, 0xe7, 0x2b, 0xe2, 0x79, 0x0c, 0xaa, 0x82, 0x41, 0x3a, 0xea, 0xb9, 0xe4, 0x9a, 0xa4, 0x97, 0x7e, 0xda, 0x7a, 0x17, 0x66, 0x94, 0xa1, 0x1d, 0x3d, 0xf0, 0xde, 0xb3, 0x0b, 0x72, 0xa7, 0x1c, 0xef, 0xd1, 0x53, 0x3e, 0x8f, 0x33, 0x26, 0x5f, 0xec, 0x76, 0x2a, 0x49, 0x81, 0x88, 0xee, 0x21, 0xc4, 0x1a, 0xeb, 0xd9, 0xc5, 0x39, 0x99, 0xcd, 0xad, 0x31, 0x8b, 0x01, 0x18, 0x23, 0xdd, 0x1f, 0x4e, 0x2d, 0xf9, 0x48, 0x4f, 0xf2, 0x65, 0x8e, 0x78, 0x5c, 0x58, 0x19, 0x8d, 0xe5, 0x98, 0x57, 0x67, 0x7f, 0x05, 0x64, 0xaf, 0x63, 0xb6, 0xfe, 0xf5, 0xb7, 0x3c, 0xa5, 0xce, 0xe9, 0x68, 0x44, 0xe0, 0x4d, 0x43, 0x69, 0x29, 0x2e, 0xac, 0x15, 0x59, 0xa8, 0x0a, 0x9e, 0x6e, 0x47, 0xdf, 0x34, 0x35, 0x6a, 0xcf, 0xdc, 0x22, 0xc9, 0xc0, 0x9b, 0x89, 0xd4, 0xed, 0xab, 0x12, 0xa2, 0x0d, 0x52, 0xbb, 0x02, 0x2f, 0xa9, 0xd7, 0x61, 0x1e, 0xb4, 0x50, 0x04, 0xf6, 0xc2, 0x16, 0x25, 0x86, 0x56, 0x55, 0x09, 0xbe, 0x91, ], ];
fn split_volume_sample( a: f32, c: f32, // opacity and colour of original sample zf: f32, zb: f32, // front and back of original sample z: f32, // position of split ) -> ((f32, f32), (f32, f32)) { // Given a volume sample whose front and back are at depths zf and zb // respectively, split the sample at depth z. Return the opacities // and colors of the two parts that result from the split. // // The code below is written to avoid excessive rounding errors when // the opacity of the original sample is very small: // // The straightforward computation of the opacity of either part // requires evaluating an expression of the form // // 1.0 - (1.0 - a).pow(x) // // However, if a is very small, then 1-a evaluates to 1.0 exactly, // and the entire expression evaluates to 0.0. // // We can avoid this by rewriting the expression as // // 1.0 - (x * (1.0 - a).log()).exp() // // and replacing the call to log() with a call to the method ln_1p(), // which computes the logarithm of 1+x without attempting to evaluate // the expression 1+x when x is very small. // // Now we have // // 1.0 - (x * (-a).ln_1p()).exp() // // However, if a is very small then the call to exp() returns 1.0, and // the overall expression still evaluates to 0.0. We can avoid that // by replacing the call to exp() with a call to expm1(): // // -(x * (-a).ln_1p()).exp_m1() // // x.exp_m1() computes exp(x) - 1 in such a way that the result is accurate // even if x is very small. // assert!(zb > zf && z >= zf && z <= zb); let a = a.clamp(0.0, 1.0); if a == 1.0f32 { ((1.0f32, c), (1.0f32, c)) } else { let xf = (z - zf) / (zb - zf); let xb = (zb - z) / (zb - zf); if a > f32::MIN_POSITIVE { //let af = -expm1 (xf * log1p (-a)); let af = -((-a).ln_1p() * xf).exp_m1(); let cf = (af / a) * c; //ab = -expm1 (xb * log1p (-a)); let ab = -((-a).ln_1p() * xb).exp_m1(); let cb = (ab / a) * c; ((af, cf), (ab, cb)) } else { ((a * xf, c * xf), (a * xb, c * xb)) } } } fn main() { let a = 0.5f32; let c = 1.0f32; let zf = 0.0f32; let zb = 1.0f32; assert_eq!( split_volume_sample(a, c, zf, zb, 0.5), ((0.29289323, 0.58578646), (0.29289323, 0.58578646)) ); assert_eq!( split_volume_sample(a, c, zf, zb, 1.0e-7), ( (0.000000069314716, 0.00000013862943), (0.49999997, 0.99999994) ) ); }
use std::mem::size_of; struct EmptyStruct; fn main() { println!("{}", size_of::<EmptyStruct>()); // 0 assert_eq!(size_of::<EmptyStruct>(), 0); }
#![allow(non_snake_case)] #![cfg(test)] use std::collections::HashMap; #[test] fn Creating_map_of_char_u32() { let counts = "ABCDE" .chars() .map(|c| (c, 0_i32)) .collect::<HashMap<_, _>>(); } #[test] fn Creating_map_of_u32_str_1() { let vec = vec![("One", 1u32), ("Two", 2u32), ("Three", 3u32)]; let map = vec .iter() .cloned() .collect::<HashMap<_, _>>(); let len = vec.len(); } #[test] fn Creating_map_of_u32_str_2() { let vec = vec![("One", 1u32), ("Two", 2u32), ("Three", 3u32)]; let map = vec .into_iter() .collect::<HashMap<_, _>>(); //Error: used of moved value //let len = vec.len(); } #[test] fn Collecting_values_of_map_of_u32_str() { let vec = vec![("One", 1u32), ("Two", 2u32), ("Three", 3u32)]; let map: HashMap<&str, u32> = vec .iter() .cloned() .collect::<HashMap<_, _>>(); let vals = map .values() ; let valsVec = vals .map(|x| x.clone()) .collect::<Vec<u32>>(); } #[test] fn Collecting_values_of_map_of_u32_MyRecord_1() { struct MyRecord { id: u32 } let vec = vec![("One", MyRecord { id: 1 }), ("Two", MyRecord { id: 2 }), ("Three", MyRecord { id: 3 })]; { let map: HashMap<&str, &MyRecord> = vec .iter() .map(|x| (x.0, &(x.1))) .collect(); let vals = map .values(); let valsVec: Vec<&&MyRecord> = vals .collect(); } } #[test] fn Collecting_values_of_map_of_u32_MyRecord_2() { struct MyRecord { id: u32 } let vec = vec![("One", MyRecord { id: 1 }), ("Two", MyRecord { id: 2 }), ("Three", MyRecord { id: 3 })]; let map: HashMap<&str, MyRecord> = vec .into_iter() .map(|x| (x.0, x.1)) .collect(); let vals = map.into_iter().map(|x| x.1); let valsVec: Vec<MyRecord> = vals .collect(); }
use crate::matrices::MatrixProperties::*; use crate::vectors::Vector3::*; use std::ops; #[derive(Debug, Copy, Clone, PartialEq)] pub struct Matrix33 { pub m00: f64, pub m01: f64, pub m02: f64, pub m10: f64, pub m11: f64, pub m12: f64, pub m20: f64, pub m21: f64, pub m22: f64 } impl Default for Matrix33 { fn default() -> Matrix33 { Matrix33 { m00: 1., m01: 0., m02: 0., m10: 0., m11: 1., m12: 0., m20: 0., m21: 0., m22: 1. } } } impl MatrixProperties for Matrix33 { type Vector = Vector3; fn add(m1: &Matrix33, m2: &Matrix33) -> Matrix33 { let m00: f64 = m1.m00 + m2.m00; let m01: f64 = m1.m01 + m2.m01; let m02: f64 = m1.m02 + m2.m02; let m10: f64 = m1.m10 + m2.m10; let m11: f64 = m1.m11 + m2.m11; let m12: f64 = m1.m12 + m2.m12; let m20: f64 = m1.m20 + m2.m20; let m21: f64 = m1.m21 + m2.m21; let m22: f64 = m1.m22 + m2.m22; Matrix33 { m00, m01, m02, m10, m11, m12, m20, m21, m22 } } fn sub(m1: &Matrix33, m2: &Matrix33) -> Matrix33 { let m00: f64 = m1.m00 - m2.m00; let m01: f64 = m1.m01 - m2.m01; let m02: f64 = m1.m02 - m2.m02; let m10: f64 = m1.m10 - m2.m10; let m11: f64 = m1.m11 - m2.m11; let m12: f64 = m1.m12 - m2.m12; let m20: f64 = m1.m20 - m2.m20; let m21: f64 = m1.m21 - m2.m21; let m22: f64 = m1.m22 - m2.m22; Matrix33 { m00, m01, m02, m10, m11, m12, m20, m21, m22 } } fn mul(m1: &Matrix33, m2: &Matrix33) -> Matrix33 { let m00: f64 = m1.m00 * m2.m00 + m1.m10 * m2.m01 + m1.m20 * m2.m02; let m01: f64 = m1.m01 * m2.m00 + m1.m11 * m2.m01 + m1.m21 * m2.m02; let m02: f64 = m1.m02 * m2.m00 + m1.m12 * m2.m01 + m1.m22 * m2.m02; let m10: f64 = m1.m00 * m2.m10 + m1.m10 * m2.m11 + m1.m20 * m2.m12; let m11: f64 = m1.m01 * m2.m10 + m1.m11 * m2.m11 + m1.m21 * m2.m12; let m12: f64 = m1.m02 * m2.m10 + m1.m12 * m2.m11 + m1.m22 * m2.m12; let m20: f64 = m1.m00 * m2.m20 + m1.m10 * m2.m21 + m1.m20 * m2.m22; let m21: f64 = m1.m01 * m2.m20 + m1.m11 * m2.m21 + m1.m21 * m2.m22; let m22: f64 = m1.m02 * m2.m20 + m1.m12 * m2.m21 + m1.m22 * m2.m22; Matrix33 { m00, m01, m02, m10, m11, m12, m20, m21, m22 } } fn trans(m: &Matrix33, v: &Vector3) -> Vector3 { let x: f64 = m.m00 * v.x + m.m10 * v.y + m.m20 * v.z; let y: f64 = m.m01 * v.x + m.m11 * v.y + m.m21 * v.z; let z: f64 = m.m02 * v.x + m.m12 * v.y + m.m22 * v.z; Vector3 { x, y, z } } fn setIdentity(&mut self) { self.m00 = 1.; self.m01 = 0.; self.m02 = 0.; self.m10 = 0.; self.m11 = 1.; self.m12 = 0.; self.m20 = 0.; self.m21 = 0.; self.m22 = 1.; } fn setZero(&mut self) { self.m00 = 0.; self.m01 = 0.; self.m02 = 0.; self.m10 = 0.; self.m11 = 0.; self.m12 = 0.; self.m20 = 0.; self.m21 = 0.; self.m22 = 0.; } fn transpose(&mut self) { let m01: f64 = self.m10; let m02: f64 = self.m20; let m10: f64 = self.m01; let m12: f64 = self.m12; let m20: f64 = self.m02; let m21: f64 = self.m12; self.m01 = m01; self.m02 = m02; self.m10 = m10; self.m12 = m12; self.m20 = m20; self.m21 = m21; } fn invert(&mut self) { let determinant: f64 = self.det(); if determinant != 0. { let determinantInv: f64 = 1.0/determinant; let t00: f64 = self.m11 * self.m22 - self.m12* self.m21; let t01: f64 = - self.m10 * self.m22 + self.m12 * self.m20; let t02: f64 = self.m10 * self.m21 - self.m11 * self.m20; let t10: f64 = - self.m01 * self.m22 + self.m02 * self.m21; let t11: f64 = self.m00 * self.m22 - self.m02 * self.m20; let t12: f64 = - self.m00 * self.m21 + self.m01 * self.m20; let t20: f64 = self.m01 * self.m12 - self.m02 * self.m11; let t21: f64 = -self.m00 * self.m12 + self.m02 * self.m10; let t22: f64 = self.m00 * self.m11 - self.m01 * self.m10; self.m00 = t00 * determinantInv; self.m01 = t01 * determinantInv; self.m02 = t02 * determinantInv; self.m10 = t10 * determinantInv; self.m11 = t11 * determinantInv; self.m12 = t12 * determinantInv; self.m20 = t20 * determinantInv; self.m21 = t21 * determinantInv; self.m22 = t22 * determinantInv; } } fn negate(&mut self) { self.m00 = -self.m00; self.m01 = -self.m01; self.m02 = -self.m02; self.m10 = -self.m10; self.m11 = -self.m11; self.m12 = -self.m12; self.m20 = -self.m20; self.m21 = -self.m21; self.m22 = -self.m22; } fn det(&self) -> f64 { return self.m00 * (self.m11 * self.m22 - self.m12 * self.m21) + self.m01 * (self.m12 * self.m20 - self.m10 * self.m22) + self.m02 * (self.m10 * self.m21 - self.m11 * self.m20); } fn print(&self) { println!("{} {} {}", self.m00, self.m01, self.m02); println!("{} {} {}", self.m10, self.m11, self.m12); println!("{} {} {}", self.m20, self.m21, self.m22); } } // Operator overloading impl ops::Add<Matrix33> for Matrix33 { type Output = Matrix33; fn add(self, rhs: Matrix33) -> Matrix33 { <Matrix33 as MatrixProperties>::add(&self, &rhs) } } impl ops::AddAssign<Matrix33> for Matrix33 { fn add_assign(&mut self, rhs: Matrix33) { *self = Matrix33::add(&self, &rhs); } } impl ops::Sub<Matrix33> for Matrix33 { type Output = Matrix33; fn sub(self, rhs: Matrix33) -> Matrix33 { <Matrix33 as MatrixProperties>::sub(&self, &rhs) } } impl ops::SubAssign<Matrix33> for Matrix33 { fn sub_assign(&mut self, rhs: Matrix33) { *self = Matrix33::sub(&self, &rhs) } } impl ops::Mul<Matrix33> for Matrix33 { type Output = Matrix33; fn mul(self, rhs: Matrix33) -> Matrix33 { <Matrix33 as MatrixProperties>::mul(&self, &rhs) } } impl ops::Mul<Vector3> for Matrix33 { type Output = Vector3; fn mul(self, rhs: Vector3) -> Vector3 { <Matrix33 as MatrixProperties>::trans(&self, &rhs) } } impl ops::MulAssign<Matrix33> for Matrix33 { fn mul_assign(&mut self, rhs: Matrix33) { *self = Matrix33::mul(&self, &rhs) } }
use futures::Future; use SpawnError; /// A value that executes futures. /// /// The [`spawn`] function is used to submit a future to an executor. Once /// submitted, the executor takes ownership of the future and becomes /// responsible for driving the future to completion. /// /// The strategy employed by the executor to handle the future is less defined /// and is left up to the `Executor` implementation. The `Executor` instance is /// expected to call [`poll`] on the future once it has been notified, however /// the "when" and "how" can vary greatly. /// /// For example, the executor might be a thread pool, in which case a set of /// threads have already been spawned up and the future is inserted into a /// queue. A thread will acquire the future and poll it. /// /// The `Executor` trait is only for futures that **are** `Send`. These are most /// common. There currently is no trait that describes executors that operate /// entirely on the current thread (i.e., are able to spawn futures that are not /// `Send`). Note that single threaded executors can still implement `Executor`, /// but only futures that are `Send` can be spawned via the trait. /// /// This trait is primarily intended to implemented by executors and used to /// back `tokio::spawn`. Libraries and applications **may** use this trait to /// bound generics, but doing so will limit usage to futures that implement /// `Send`. Instead, libraries and applications are recommended to use /// [`TypedExecutor`] as a bound. /// /// # Errors /// /// The [`spawn`] function returns `Result` with an error type of `SpawnError`. /// This error type represents the reason that the executor was unable to spawn /// the future. The two current represented scenarios are: /// /// * An executor being at capacity or full. As such, the executor is not able /// to accept a new future. This error state is expected to be transient. /// * An executor has been shutdown and can no longer accept new futures. This /// error state is expected to be permanent. /// /// If a caller encounters an at capacity error, the caller should try to shed /// load. This can be as simple as dropping the future that was spawned. /// /// If the caller encounters a shutdown error, the caller should attempt to /// gracefully shutdown. /// /// # Examples /// /// ```rust /// # extern crate futures; /// # extern crate tokio_executor; /// # use tokio_executor::Executor; /// # fn docs(my_executor: &mut Executor) { /// use futures::future::lazy; /// my_executor.spawn(Box::new(lazy(|| { /// println!("running on the executor"); /// Ok(()) /// }))).unwrap(); /// # } /// # fn main() {} /// ``` /// /// [`spawn`]: #tymethod.spawn /// [`poll`]: https://docs.rs/futures/0.1/futures/future/trait.Future.html#tymethod.poll /// [`TypedExecutor`]: ../trait.TypedExecutor.html pub trait Executor { /// Spawns a future object to run on this executor. /// /// `future` is passed to the executor, which will begin running it. The /// future may run on the current thread or another thread at the discretion /// of the `Executor` implementation. /// /// # Panics /// /// Implementations are encouraged to avoid panics. However, panics are /// permitted and the caller should check the implementation specific /// documentation for more details on possible panics. /// /// # Examples /// /// ```rust /// # extern crate futures; /// # extern crate tokio_executor; /// # use tokio_executor::Executor; /// # fn docs(my_executor: &mut Executor) { /// use futures::future::lazy; /// my_executor.spawn(Box::new(lazy(|| { /// println!("running on the executor"); /// Ok(()) /// }))).unwrap(); /// # } /// # fn main() {} /// ``` fn spawn( &mut self, future: Box<Future<Item = (), Error = ()> + Send>, ) -> Result<(), SpawnError>; /// Provides a best effort **hint** to whether or not `spawn` will succeed. /// /// This function may return both false positives **and** false negatives. /// If `status` returns `Ok`, then a call to `spawn` will *probably* /// succeed, but may fail. If `status` returns `Err`, a call to `spawn` will /// *probably* fail, but may succeed. /// /// This allows a caller to avoid creating the task if the call to `spawn` /// has a high likelihood of failing. /// /// # Panics /// /// This function must not panic. Implementers must ensure that panics do /// not happen. /// /// # Examples /// /// ```rust /// # extern crate futures; /// # extern crate tokio_executor; /// # use tokio_executor::Executor; /// # fn docs(my_executor: &mut Executor) { /// use futures::future::lazy; /// /// if my_executor.status().is_ok() { /// my_executor.spawn(Box::new(lazy(|| { /// println!("running on the executor"); /// Ok(()) /// }))).unwrap(); /// } else { /// println!("the executor is not in a good state"); /// } /// # } /// # fn main() {} /// ``` fn status(&self) -> Result<(), SpawnError> { Ok(()) } } impl<E: Executor + ?Sized> Executor for Box<E> { fn spawn( &mut self, future: Box<Future<Item = (), Error = ()> + Send>, ) -> Result<(), SpawnError> { (**self).spawn(future) } fn status(&self) -> Result<(), SpawnError> { (**self).status() } }
use std::io; use anyhow::Result; use nexers::db; #[cfg(feature = "jemallocator")] #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; fn main() -> Result<()> { let conn = rusqlite::Connection::open("maven.db")?; conn.execute_batch(db::SCHEMA)?; db::ingest(io::stdin().lock(), conn)?; Ok(()) }
#[cfg(feature = "sources-http")] mod http; #[cfg(feature = "sources-socket")] mod tcp; #[cfg(all(unix, feature = "sources-socket"))] mod unix; #[cfg(feature = "sources-http")] pub use self::http::{ErrorMessage, HttpSource}; #[cfg(feature = "sources-socket")] pub use tcp::{SocketListenAddr, TcpSource}; #[cfg(all(unix, feature = "sources-socket"))] pub use unix::build_unix_source;
pub mod ctype; pub mod stdio; pub mod errno; pub mod string; pub mod time;
//= { //= "output": { //= "2": [ //= "", //= true //= ], //= "1": [ //= "", //= true //= ] //= }, //= "children": [ //= { //= "output": { //= "2": [ //= "", //= true //= ], //= "1": [ //= "", //= true //= ] //= }, //= "children": [], //= "exit": "Success" //= }, //= { //= "output": { //= "2": [ //= "", //= true //= ], //= "1": [ //= "", //= true //= ] //= }, //= "children": [], //= "exit": "Success" //= } //= ], //= "exit": "Success" //= } #![deny(warnings, deprecated)] extern crate constellation; #[macro_use] extern crate serde_closure; use constellation::*; fn main() { init(Resources { mem: 20 * 1024 * 1024, ..Resources::default() }); for _ in 0..2 { let pid = spawn( Resources { mem: 20 * 1024 * 1024, ..Resources::default() }, FnOnce!(|parent| { let _sender = Sender::<String>::new(parent); }), ) .expect("SPAWN FAILED"); let _receiver = Receiver::<String>::new(pid); } }
//! A wrapper around AWS S3 client library `rust_s3` to be used a relish storage. use std::path::Path; use anyhow::Context; use s3::{bucket::Bucket, creds::Credentials, region::Region}; use crate::{relish_storage::strip_workspace_prefix, S3Config}; use super::RelishStorage; const S3_FILE_SEPARATOR: char = '/'; #[derive(Debug)] pub struct S3ObjectKey(String); impl S3ObjectKey { fn key(&self) -> &str { &self.0 } } /// AWS S3 relish storage. pub struct RustS3 { bucket: Bucket, } impl RustS3 { /// Creates the relish storage, errors if incorrect AWS S3 configuration provided. pub fn new(aws_config: &S3Config) -> anyhow::Result<Self> { let region = aws_config .bucket_region .parse::<Region>() .context("Failed to parse the s3 region from config")?; let credentials = Credentials::new( aws_config.access_key_id.as_deref(), aws_config.secret_access_key.as_deref(), None, None, None, ) .context("Failed to create the s3 credentials")?; Ok(Self { bucket: Bucket::new_with_path_style( aws_config.bucket_name.as_str(), region, credentials, ) .context("Failed to create the s3 bucket")?, }) } } #[async_trait::async_trait] impl RelishStorage for RustS3 { type RelishStoragePath = S3ObjectKey; fn derive_destination( page_server_workdir: &Path, relish_local_path: &Path, ) -> anyhow::Result<Self::RelishStoragePath> { let relative_path = strip_workspace_prefix(page_server_workdir, relish_local_path)?; let mut key = String::new(); for segment in relative_path { key.push(S3_FILE_SEPARATOR); key.push_str(&segment.to_string_lossy()); } Ok(S3ObjectKey(key)) } async fn list_relishes(&self) -> anyhow::Result<Vec<Self::RelishStoragePath>> { let list_response = self .bucket .list(String::new(), None) .await .context("Failed to list s3 objects")?; Ok(list_response .into_iter() .flat_map(|response| response.contents) .map(|s3_object| S3ObjectKey(s3_object.key)) .collect()) } async fn download_relish( &self, from: &Self::RelishStoragePath, to: &Path, ) -> anyhow::Result<()> { let mut target_file = std::fs::OpenOptions::new() .write(true) .open(to) .with_context(|| format!("Failed to open target s3 destination at {}", to.display()))?; let code = self .bucket .get_object_stream(from.key(), &mut target_file) .await .with_context(|| format!("Failed to download s3 object with key {}", from.key()))?; if code != 200 { Err(anyhow::format_err!( "Received non-200 exit code during downloading object from directory, code: {}", code )) } else { Ok(()) } } async fn delete_relish(&self, path: &Self::RelishStoragePath) -> anyhow::Result<()> { let (_, code) = self .bucket .delete_object(path.key()) .await .with_context(|| format!("Failed to delete s3 object with key {}", path.key()))?; if code != 200 { Err(anyhow::format_err!( "Received non-200 exit code during deleting object with key '{}', code: {}", path.key(), code )) } else { Ok(()) } } async fn upload_relish(&self, from: &Path, to: &Self::RelishStoragePath) -> anyhow::Result<()> { let mut local_file = tokio::fs::OpenOptions::new().read(true).open(from).await?; let code = self .bucket .put_object_stream(&mut local_file, to.key()) .await .with_context(|| format!("Failed to create s3 object with key {}", to.key()))?; if code != 200 { Err(anyhow::format_err!( "Received non-200 exit code during creating object with key '{}', code: {}", to.key(), code )) } else { Ok(()) } } }
/* Gordon Adam 1107425 Struct that represents the data field of a resource. Depending on the resource type, different types of data are stored within this struct */ use std::default; use std::io::BufReader; #[deriving(Default,Clone,Show)] pub struct Data { pub label: Vec<Vec<u8>>, // This is hold seperate strings of data ["www", "google", "com"] pub length: Vec<u8>, // This is the vector of lengths of the labels eg. ["3", "6", "3"] } impl Data { // Creates an instance of the struct with default values pub fn new() -> Data { return Data {..default::Default::default()}; } // This function reads a name from the reader that may be compressed pub fn read_hostname(&mut self, reader: &mut BufReader, msg_copy: &mut Vec<u8>) { let mut byte_buffer = reader.read_u8().unwrap(); let mut length: uint; while byte_buffer != 0 { if (byte_buffer & 0xc0) == 0xc0 { length = ((byte_buffer - 0xc0) as uint) << 8; byte_buffer = reader.read_u8().unwrap(); length = length + byte_buffer.to_uint().unwrap(); self.dereference_pointer(msg_copy, length); break; } else { let mut label: Vec<u8> = vec![]; length = byte_buffer.to_uint().unwrap(); let mut i: uint = 0; while i < length { let temp_byte_buffer = reader.read_u8().unwrap(); label.push(temp_byte_buffer); i = i + 1; } self.label.push(label.clone()); self.length.push(label.len() as u8); } byte_buffer = reader.read_u8().unwrap(); } } // Reads in the data section of an SOA record, this consists of a hostname, the email address of the responsible person // The serial number of the record, the refresh, retry, expire and minimum times of the record. pub fn read_soa(&mut self, reader: &mut BufReader, msg_copy: &mut Vec<u8>) { self.read_hostname(reader, msg_copy); self.length.push(0u8); self.label.push(vec![]); self.read_hostname(reader, msg_copy); self.length.push(0u8); self.label.push(vec![]); let mut byte_buffer: u8; for i in range(0u, 5) { let mut temp_label: Vec<u8> = vec![]; for j in range(0u,4) { byte_buffer = reader.read_u8().unwrap(); temp_label.push(byte_buffer); } self.label.push(temp_label); } } // This takes a copy of the message recieved and an index of that message and adds the name contained at that index to the data fn dereference_pointer(&mut self, msg_copy: &mut Vec<u8>, index: uint) { let mut idx = index; let mut length: uint; while msg_copy[idx] != 0 { if(msg_copy[idx] & 0xc0) == 0xc0 { idx = msg_copy[idx+1].to_uint().unwrap(); self.dereference_pointer(msg_copy, idx); return; } self.length.push(msg_copy[idx]); length = msg_copy[idx].to_uint().unwrap(); idx = idx + 1; let mut label: Vec<u8> = vec![]; for i in range(0, length) { label.push(msg_copy[idx + i]); } self.label.push(label.clone()); idx = idx + length; } } // Reads in an ipv4 address pub fn read_ipv4_addr(&mut self, reader: &mut BufReader) { let mut i: uint = 0; while i < 4u { let mut label: Vec<u8> = vec![]; label.push(reader.read_u8().unwrap()); self.label.push(label); self.length.push(1); i = i + 1; } } // Reads in an ipv6 address pub fn read_ipv6_addr(&mut self, reader: &mut BufReader) { let mut i: uint = 0; while i < 8u { let mut label: Vec<u8> = vec![]; let mut j: uint = 0; while j < 2u { label.push(reader.read_u8().unwrap()); j = j + 1; } self.label.push(label); self.length.push(2); i = i + 1; } } // Returns an ipv4 address pub fn get_ipv4_addr(&mut self) -> Vec<u8> { let mut addr: Vec<u8> = vec![]; for i in range(0u, 4) { addr.push(self.label[i][0]); } return addr; } #[allow(dead_code)] pub fn get_ipv6_addr(&mut self) -> Vec<u8> { let mut addr: Vec<u8> = vec![]; for i in range(0u, 8) { for j in range(0u, 2) { addr.push(self.label[i][j]); } } return addr; } // Returns the data as vector of u8 characters pub fn write(&mut self) -> Vec<u8> { let mut data_buffer: Vec<u8> = vec![]; for i in range(0u, self.label.len()) { if i < self.length.len() { data_buffer.push(self.length[i]); } for j in range(0u, self.label[i].len()) { data_buffer.push(self.label[i][j]); } } data_buffer.push(0u8); return data_buffer; } // Returns cname data as a vector of u8 characters pub fn write_cname(&mut self) -> Vec<u8> { let mut data_buffer: Vec<u8> = vec![]; for i in range(0u, self.label.len()) { data_buffer.push(self.length[i]); for j in range(0u, self.label[i].len()) { data_buffer.push(self.label[i][j]); } } data_buffer.push(0u8); return data_buffer; } pub fn write_ip_addr(&mut self) -> Vec<u8> { let mut data_buffer: Vec<u8> = vec![]; for i in range(0u, self.label.len()) { for j in range(0u, self.label[i].len()) { data_buffer.push(self.label[i][j]); } } return data_buffer; } // function that will print a label out in the format "www.google.com" pub fn print_as_query(&mut self) { print!("\tName: "); for i in range(0, self.label.len()) { print!("{}", String::from_utf8(self.label[i].clone()).unwrap()); if i<(self.label.len()-1) { print!("."); } else { println!(""); } } let mut count = 0; for i in range(0, self.length.len()) { count = count + self.length[i]; } println!("\t[Name Length: {}]", count); println!("\t[Label Count: {}]", self.label.len()); } pub fn print_as_hostname(&mut self) { print!("Name: "); for i in range(0, self.label.len()) { print!("{}", String::from_utf8(self.label[i].clone()).unwrap()); if i<(self.label.len()-1) { print!("."); } else { println!(""); } } } pub fn print_as_soa(&mut self) { let mut idx = 0; print!("\n\tMName: "); while(self.length[idx] != 0u8) { print!("{}", String::from_utf8(self.label[idx].clone()).unwrap()); idx = idx + 1; if self.length[idx] != 0u8 { print!(".") } } println!(""); idx = idx + 1; print!("\tRName: "); while(self.length[idx] != 0u8) { print!("{}", String::from_utf8(self.label[idx].clone()).unwrap()); idx = idx + 1; if self.length[idx] != 0u8 { print!(".") } } println!(""); idx = idx + 1; let mut serial: u32 = self.u8_to_u32(idx); idx = idx + 1; let mut refresh: u32 = self.u8_to_u32(idx); idx = idx + 1; let mut retry: u32 = self.u8_to_u32(idx); idx = idx + 1; let mut expire: u32 = self.u8_to_u32(idx); idx = idx + 1; let mut minimum: u32 = self.u8_to_u32(idx); println!("\tSerial: {}", serial); println!("\tRefresh: {}", refresh); println!("\tRetry: {}", retry); println!("\tExpire: {}", expire); println!("\tMinimum: {}", minimum); } fn u8_to_u32(&mut self, idx: uint) -> u32 { let mut data: u32 = 0; data = data + (self.label[idx][0] as u32); data = data << 8; data = data + (self.label[idx][1] as u32); data = data << 8; data = data + (self.label[idx][2] as u32); data = data << 8; data = data + (self.label[idx][3] as u32); return data; } pub fn print_as_ipv4(&mut self) { print!("Address: "); for i in range(0, self.label.len()) { print!("{}", self.label[i][0]); if i<(self.label.len()-1) { print!("."); } else { println!(""); } } } pub fn print_as_ipv6(&mut self) { print!("Address: "); for i in range(0, self.label.len()) { let mut hex: u16 = 0; for j in range(0, self.label[i].len()) { if j == 0 { hex = (self.label[i][j] as u16) << 8; } else { hex = hex + (self.label[i][j] as u16); } } print!("{:X}", hex); if i<(self.label.len()-1) { print!(":"); } else { println!(""); } } } pub fn tld(&mut self) -> Option<Data> { if self.label.len() > 1 { let mut tld: Data = Data::new(); tld.label.push(self.label[self.label.len()-1].clone()); tld.length.push(self.length[self.label.len()-1].clone()); return Some(tld); } else { return None; } } pub fn equals(&mut self, data: Data) -> bool { if self.label.len() != data.label.len() { return false; } for i in range(0u, self.label.len()) { if self.label[i].len() != data.label[i].len() { return false; } for j in range(0u, self.label[i].len()) { if data.label[i][j] != self.label[i][j] { return false; } } } return true; } }
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "Devices_Adc_Provider")] pub mod Provider; #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AdcChannel(pub ::windows::core::IInspectable); impl AdcChannel { pub fn Controller(&self) -> ::windows::core::Result<AdcController> { 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::<AdcController>(result__) } } pub fn ReadValue(&self) -> ::windows::core::Result<i32> { let this = self; unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) } } pub fn ReadRatio(&self) -> ::windows::core::Result<f64> { let this = self; unsafe { let mut result__: f64 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<f64>(result__) } } #[cfg(feature = "Foundation")] pub fn Close(&self) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::super::Foundation::IClosable>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this)).ok() } } } unsafe impl ::windows::core::RuntimeType for AdcChannel { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Adc.AdcChannel;{040bf414-2588-4a56-abef-73a260acc60a})"); } unsafe impl ::windows::core::Interface for AdcChannel { type Vtable = IAdcChannel_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x040bf414_2588_4a56_abef_73a260acc60a); } impl ::windows::core::RuntimeName for AdcChannel { const NAME: &'static str = "Windows.Devices.Adc.AdcChannel"; } impl ::core::convert::From<AdcChannel> for ::windows::core::IUnknown { fn from(value: AdcChannel) -> Self { value.0 .0 } } impl ::core::convert::From<&AdcChannel> for ::windows::core::IUnknown { fn from(value: &AdcChannel) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AdcChannel { 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 AdcChannel { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<AdcChannel> for ::windows::core::IInspectable { fn from(value: AdcChannel) -> Self { value.0 } } impl ::core::convert::From<&AdcChannel> for ::windows::core::IInspectable { fn from(value: &AdcChannel) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AdcChannel { 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 AdcChannel { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Foundation")] impl ::core::convert::TryFrom<AdcChannel> for super::super::Foundation::IClosable { type Error = ::windows::core::Error; fn try_from(value: AdcChannel) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } #[cfg(feature = "Foundation")] impl ::core::convert::TryFrom<&AdcChannel> for super::super::Foundation::IClosable { type Error = ::windows::core::Error; fn try_from(value: &AdcChannel) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } #[cfg(feature = "Foundation")] impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::IClosable> for AdcChannel { fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::IClosable> { ::windows::core::IntoParam::into_param(&self) } } #[cfg(feature = "Foundation")] impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::IClosable> for &AdcChannel { fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::IClosable> { ::core::convert::TryInto::<super::super::Foundation::IClosable>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for AdcChannel {} unsafe impl ::core::marker::Sync for AdcChannel {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct AdcChannelMode(pub i32); impl AdcChannelMode { pub const SingleEnded: AdcChannelMode = AdcChannelMode(0i32); pub const Differential: AdcChannelMode = AdcChannelMode(1i32); } impl ::core::convert::From<i32> for AdcChannelMode { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for AdcChannelMode { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for AdcChannelMode { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Devices.Adc.AdcChannelMode;i4)"); } impl ::windows::core::DefaultType for AdcChannelMode { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AdcController(pub ::windows::core::IInspectable); impl AdcController { pub fn ChannelCount(&self) -> ::windows::core::Result<i32> { let this = self; unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) } } pub fn ResolutionInBits(&self) -> ::windows::core::Result<i32> { let this = self; unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) } } pub fn MinValue(&self) -> ::windows::core::Result<i32> { let this = self; unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) } } pub fn MaxValue(&self) -> ::windows::core::Result<i32> { let this = self; unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) } } pub fn ChannelMode(&self) -> ::windows::core::Result<AdcChannelMode> { let this = self; unsafe { let mut result__: AdcChannelMode = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<AdcChannelMode>(result__) } } pub fn SetChannelMode(&self, value: AdcChannelMode) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value).ok() } } pub fn IsChannelModeSupported(&self, channelmode: AdcChannelMode) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), channelmode, &mut result__).from_abi::<bool>(result__) } } pub fn OpenChannel(&self, channelnumber: i32) -> ::windows::core::Result<AdcChannel> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), channelnumber, &mut result__).from_abi::<AdcChannel>(result__) } } #[cfg(all(feature = "Devices_Adc_Provider", feature = "Foundation", feature = "Foundation_Collections"))] pub fn GetControllersAsync<'a, Param0: ::windows::core::IntoParam<'a, Provider::IAdcProvider>>(provider: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<super::super::Foundation::Collections::IVectorView<AdcController>>> { Self::IAdcControllerStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), provider.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<super::super::Foundation::Collections::IVectorView<AdcController>>>(result__) }) } #[cfg(feature = "Foundation")] pub fn GetDefaultAsync() -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<AdcController>> { Self::IAdcControllerStatics2(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<AdcController>>(result__) }) } pub fn IAdcControllerStatics<R, F: FnOnce(&IAdcControllerStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<AdcController, IAdcControllerStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn IAdcControllerStatics2<R, F: FnOnce(&IAdcControllerStatics2) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<AdcController, IAdcControllerStatics2> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for AdcController { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Adc.AdcController;{2a76e4b0-a896-4219-86b6-ea8cdce98f56})"); } unsafe impl ::windows::core::Interface for AdcController { type Vtable = IAdcController_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2a76e4b0_a896_4219_86b6_ea8cdce98f56); } impl ::windows::core::RuntimeName for AdcController { const NAME: &'static str = "Windows.Devices.Adc.AdcController"; } impl ::core::convert::From<AdcController> for ::windows::core::IUnknown { fn from(value: AdcController) -> Self { value.0 .0 } } impl ::core::convert::From<&AdcController> for ::windows::core::IUnknown { fn from(value: &AdcController) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AdcController { 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 AdcController { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<AdcController> for ::windows::core::IInspectable { fn from(value: AdcController) -> Self { value.0 } } impl ::core::convert::From<&AdcController> for ::windows::core::IInspectable { fn from(value: &AdcController) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AdcController { 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 AdcController { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for AdcController {} unsafe impl ::core::marker::Sync for AdcController {} #[repr(transparent)] #[doc(hidden)] pub struct IAdcChannel(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAdcChannel { type Vtable = IAdcChannel_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x040bf414_2588_4a56_abef_73a260acc60a); } #[repr(C)] #[doc(hidden)] pub struct IAdcChannel_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut f64) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IAdcController(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAdcController { type Vtable = IAdcController_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2a76e4b0_a896_4219_86b6_ea8cdce98f56); } #[repr(C)] #[doc(hidden)] pub struct IAdcController_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 i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut AdcChannelMode) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: AdcChannelMode) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, channelmode: AdcChannelMode, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, channelnumber: i32, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IAdcControllerStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAdcControllerStatics { type Vtable = IAdcControllerStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcce98e0c_01f8_4891_bc3b_be53ef279ca4); } #[repr(C)] #[doc(hidden)] pub struct IAdcControllerStatics_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(all(feature = "Devices_Adc_Provider", feature = "Foundation", feature = "Foundation_Collections"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, provider: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Devices_Adc_Provider", feature = "Foundation", feature = "Foundation_Collections")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IAdcControllerStatics2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAdcControllerStatics2 { type Vtable = IAdcControllerStatics2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa2b93b1d_977b_4f5a_a5fe_a6abaffe6484); } #[repr(C)] #[doc(hidden)] pub struct IAdcControllerStatics2_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, );
#[doc = r"Value read from the register"] pub struct R { bits: u32, } #[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::GPCFG { #[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() -> u32 { 0 } #[doc = r"Writes the reset value to the register"] #[inline(always)] pub fn reset(&self) { self.register.set(Self::reset_value()) } } #[doc = "Possible values of the field `EPI_GPCFG_DSIZE`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum EPI_GPCFG_DSIZER { #[doc = "8 Bits Wide (EPI0S0 to EPI0S7)"] EPI_GPCFG_DSIZE_4BIT, #[doc = "16 Bits Wide (EPI0S0 to EPI0S15)"] EPI_GPCFG_DSIZE_16BIT, #[doc = "24 Bits Wide (EPI0S0 to EPI0S23)"] EPI_GPCFG_DSIZE_24BIT, #[doc = "32 Bits Wide (EPI0S0 to EPI0S31)"] EPI_GPCFG_DSIZE_32BIT, } impl EPI_GPCFG_DSIZER { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bits(&self) -> u8 { match *self { EPI_GPCFG_DSIZER::EPI_GPCFG_DSIZE_4BIT => 0, EPI_GPCFG_DSIZER::EPI_GPCFG_DSIZE_16BIT => 1, EPI_GPCFG_DSIZER::EPI_GPCFG_DSIZE_24BIT => 2, EPI_GPCFG_DSIZER::EPI_GPCFG_DSIZE_32BIT => 3, } } #[allow(missing_docs)] #[doc(hidden)] #[inline(always)] pub fn _from(value: u8) -> EPI_GPCFG_DSIZER { match value { 0 => EPI_GPCFG_DSIZER::EPI_GPCFG_DSIZE_4BIT, 1 => EPI_GPCFG_DSIZER::EPI_GPCFG_DSIZE_16BIT, 2 => EPI_GPCFG_DSIZER::EPI_GPCFG_DSIZE_24BIT, 3 => EPI_GPCFG_DSIZER::EPI_GPCFG_DSIZE_32BIT, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `EPI_GPCFG_DSIZE_4BIT`"] #[inline(always)] pub fn is_epi_gpcfg_dsize_4bit(&self) -> bool { *self == EPI_GPCFG_DSIZER::EPI_GPCFG_DSIZE_4BIT } #[doc = "Checks if the value of the field is `EPI_GPCFG_DSIZE_16BIT`"] #[inline(always)] pub fn is_epi_gpcfg_dsize_16bit(&self) -> bool { *self == EPI_GPCFG_DSIZER::EPI_GPCFG_DSIZE_16BIT } #[doc = "Checks if the value of the field is `EPI_GPCFG_DSIZE_24BIT`"] #[inline(always)] pub fn is_epi_gpcfg_dsize_24bit(&self) -> bool { *self == EPI_GPCFG_DSIZER::EPI_GPCFG_DSIZE_24BIT } #[doc = "Checks if the value of the field is `EPI_GPCFG_DSIZE_32BIT`"] #[inline(always)] pub fn is_epi_gpcfg_dsize_32bit(&self) -> bool { *self == EPI_GPCFG_DSIZER::EPI_GPCFG_DSIZE_32BIT } } #[doc = "Values that can be written to the field `EPI_GPCFG_DSIZE`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum EPI_GPCFG_DSIZEW { #[doc = "8 Bits Wide (EPI0S0 to EPI0S7)"] EPI_GPCFG_DSIZE_4BIT, #[doc = "16 Bits Wide (EPI0S0 to EPI0S15)"] EPI_GPCFG_DSIZE_16BIT, #[doc = "24 Bits Wide (EPI0S0 to EPI0S23)"] EPI_GPCFG_DSIZE_24BIT, #[doc = "32 Bits Wide (EPI0S0 to EPI0S31)"] EPI_GPCFG_DSIZE_32BIT, } impl EPI_GPCFG_DSIZEW { #[allow(missing_docs)] #[doc(hidden)] #[inline(always)] pub fn _bits(&self) -> u8 { match *self { EPI_GPCFG_DSIZEW::EPI_GPCFG_DSIZE_4BIT => 0, EPI_GPCFG_DSIZEW::EPI_GPCFG_DSIZE_16BIT => 1, EPI_GPCFG_DSIZEW::EPI_GPCFG_DSIZE_24BIT => 2, EPI_GPCFG_DSIZEW::EPI_GPCFG_DSIZE_32BIT => 3, } } } #[doc = r"Proxy"] pub struct _EPI_GPCFG_DSIZEW<'a> { w: &'a mut W, } impl<'a> _EPI_GPCFG_DSIZEW<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: EPI_GPCFG_DSIZEW) -> &'a mut W { { self.bits(variant._bits()) } } #[doc = "8 Bits Wide (EPI0S0 to EPI0S7)"] #[inline(always)] pub fn epi_gpcfg_dsize_4bit(self) -> &'a mut W { self.variant(EPI_GPCFG_DSIZEW::EPI_GPCFG_DSIZE_4BIT) } #[doc = "16 Bits Wide (EPI0S0 to EPI0S15)"] #[inline(always)] pub fn epi_gpcfg_dsize_16bit(self) -> &'a mut W { self.variant(EPI_GPCFG_DSIZEW::EPI_GPCFG_DSIZE_16BIT) } #[doc = "24 Bits Wide (EPI0S0 to EPI0S23)"] #[inline(always)] pub fn epi_gpcfg_dsize_24bit(self) -> &'a mut W { self.variant(EPI_GPCFG_DSIZEW::EPI_GPCFG_DSIZE_24BIT) } #[doc = "32 Bits Wide (EPI0S0 to EPI0S31)"] #[inline(always)] pub fn epi_gpcfg_dsize_32bit(self) -> &'a mut W { self.variant(EPI_GPCFG_DSIZEW::EPI_GPCFG_DSIZE_32BIT) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits &= !(3 << 0); self.w.bits |= ((value as u32) & 3) << 0; self.w } } #[doc = "Possible values of the field `EPI_GPCFG_ASIZE`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum EPI_GPCFG_ASIZER { #[doc = "No address"] EPI_GPCFG_ASIZE_NONE, #[doc = "Up to 4 bits wide"] EPI_GPCFG_ASIZE_4BIT, #[doc = "Up to 12 bits wide. This size cannot be used with 24-bit data"] EPI_GPCFG_ASIZE_12BIT, #[doc = "Up to 20 bits wide. This size cannot be used with data sizes other than 8"] EPI_GPCFG_ASIZE_20BIT, } impl EPI_GPCFG_ASIZER { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bits(&self) -> u8 { match *self { EPI_GPCFG_ASIZER::EPI_GPCFG_ASIZE_NONE => 0, EPI_GPCFG_ASIZER::EPI_GPCFG_ASIZE_4BIT => 1, EPI_GPCFG_ASIZER::EPI_GPCFG_ASIZE_12BIT => 2, EPI_GPCFG_ASIZER::EPI_GPCFG_ASIZE_20BIT => 3, } } #[allow(missing_docs)] #[doc(hidden)] #[inline(always)] pub fn _from(value: u8) -> EPI_GPCFG_ASIZER { match value { 0 => EPI_GPCFG_ASIZER::EPI_GPCFG_ASIZE_NONE, 1 => EPI_GPCFG_ASIZER::EPI_GPCFG_ASIZE_4BIT, 2 => EPI_GPCFG_ASIZER::EPI_GPCFG_ASIZE_12BIT, 3 => EPI_GPCFG_ASIZER::EPI_GPCFG_ASIZE_20BIT, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `EPI_GPCFG_ASIZE_NONE`"] #[inline(always)] pub fn is_epi_gpcfg_asize_none(&self) -> bool { *self == EPI_GPCFG_ASIZER::EPI_GPCFG_ASIZE_NONE } #[doc = "Checks if the value of the field is `EPI_GPCFG_ASIZE_4BIT`"] #[inline(always)] pub fn is_epi_gpcfg_asize_4bit(&self) -> bool { *self == EPI_GPCFG_ASIZER::EPI_GPCFG_ASIZE_4BIT } #[doc = "Checks if the value of the field is `EPI_GPCFG_ASIZE_12BIT`"] #[inline(always)] pub fn is_epi_gpcfg_asize_12bit(&self) -> bool { *self == EPI_GPCFG_ASIZER::EPI_GPCFG_ASIZE_12BIT } #[doc = "Checks if the value of the field is `EPI_GPCFG_ASIZE_20BIT`"] #[inline(always)] pub fn is_epi_gpcfg_asize_20bit(&self) -> bool { *self == EPI_GPCFG_ASIZER::EPI_GPCFG_ASIZE_20BIT } } #[doc = "Values that can be written to the field `EPI_GPCFG_ASIZE`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum EPI_GPCFG_ASIZEW { #[doc = "No address"] EPI_GPCFG_ASIZE_NONE, #[doc = "Up to 4 bits wide"] EPI_GPCFG_ASIZE_4BIT, #[doc = "Up to 12 bits wide. This size cannot be used with 24-bit data"] EPI_GPCFG_ASIZE_12BIT, #[doc = "Up to 20 bits wide. This size cannot be used with data sizes other than 8"] EPI_GPCFG_ASIZE_20BIT, } impl EPI_GPCFG_ASIZEW { #[allow(missing_docs)] #[doc(hidden)] #[inline(always)] pub fn _bits(&self) -> u8 { match *self { EPI_GPCFG_ASIZEW::EPI_GPCFG_ASIZE_NONE => 0, EPI_GPCFG_ASIZEW::EPI_GPCFG_ASIZE_4BIT => 1, EPI_GPCFG_ASIZEW::EPI_GPCFG_ASIZE_12BIT => 2, EPI_GPCFG_ASIZEW::EPI_GPCFG_ASIZE_20BIT => 3, } } } #[doc = r"Proxy"] pub struct _EPI_GPCFG_ASIZEW<'a> { w: &'a mut W, } impl<'a> _EPI_GPCFG_ASIZEW<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: EPI_GPCFG_ASIZEW) -> &'a mut W { { self.bits(variant._bits()) } } #[doc = "No address"] #[inline(always)] pub fn epi_gpcfg_asize_none(self) -> &'a mut W { self.variant(EPI_GPCFG_ASIZEW::EPI_GPCFG_ASIZE_NONE) } #[doc = "Up to 4 bits wide"] #[inline(always)] pub fn epi_gpcfg_asize_4bit(self) -> &'a mut W { self.variant(EPI_GPCFG_ASIZEW::EPI_GPCFG_ASIZE_4BIT) } #[doc = "Up to 12 bits wide. This size cannot be used with 24-bit data"] #[inline(always)] pub fn epi_gpcfg_asize_12bit(self) -> &'a mut W { self.variant(EPI_GPCFG_ASIZEW::EPI_GPCFG_ASIZE_12BIT) } #[doc = "Up to 20 bits wide. This size cannot be used with data sizes other than 8"] #[inline(always)] pub fn epi_gpcfg_asize_20bit(self) -> &'a mut W { self.variant(EPI_GPCFG_ASIZEW::EPI_GPCFG_ASIZE_20BIT) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits &= !(3 << 4); self.w.bits |= ((value as u32) & 3) << 4; self.w } } #[doc = r"Value of the field"] pub struct EPI_GPCFG_WR2CYCR { bits: bool, } impl EPI_GPCFG_WR2CYCR { #[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 _EPI_GPCFG_WR2CYCW<'a> { w: &'a mut W, } impl<'a> _EPI_GPCFG_WR2CYCW<'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 << 19); self.w.bits |= ((value as u32) & 1) << 19; self.w } } #[doc = r"Value of the field"] pub struct EPI_GPCFG_FRMCNTR { bits: u8, } impl EPI_GPCFG_FRMCNTR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bits(&self) -> u8 { self.bits } } #[doc = r"Proxy"] pub struct _EPI_GPCFG_FRMCNTW<'a> { w: &'a mut W, } impl<'a> _EPI_GPCFG_FRMCNTW<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits &= !(15 << 22); self.w.bits |= ((value as u32) & 15) << 22; self.w } } #[doc = r"Value of the field"] pub struct EPI_GPCFG_FRM50R { bits: bool, } impl EPI_GPCFG_FRM50R { #[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 _EPI_GPCFG_FRM50W<'a> { w: &'a mut W, } impl<'a> _EPI_GPCFG_FRM50W<'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 << 26); self.w.bits |= ((value as u32) & 1) << 26; self.w } } #[doc = r"Value of the field"] pub struct EPI_GPCFG_CLKGATER { bits: bool, } impl EPI_GPCFG_CLKGATER { #[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 _EPI_GPCFG_CLKGATEW<'a> { w: &'a mut W, } impl<'a> _EPI_GPCFG_CLKGATEW<'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 << 30); self.w.bits |= ((value as u32) & 1) << 30; self.w } } #[doc = r"Value of the field"] pub struct EPI_GPCFG_CLKPINR { bits: bool, } impl EPI_GPCFG_CLKPINR { #[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 _EPI_GPCFG_CLKPINW<'a> { w: &'a mut W, } impl<'a> _EPI_GPCFG_CLKPINW<'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 << 31); self.w.bits |= ((value as u32) & 1) << 31; self.w } } impl R { #[doc = r"Value of the register as raw bits"] #[inline(always)] pub fn bits(&self) -> u32 { self.bits } #[doc = "Bits 0:1 - Size of Data Bus"] #[inline(always)] pub fn epi_gpcfg_dsize(&self) -> EPI_GPCFG_DSIZER { EPI_GPCFG_DSIZER::_from(((self.bits >> 0) & 3) as u8) } #[doc = "Bits 4:5 - Address Bus Size"] #[inline(always)] pub fn epi_gpcfg_asize(&self) -> EPI_GPCFG_ASIZER { EPI_GPCFG_ASIZER::_from(((self.bits >> 4) & 3) as u8) } #[doc = "Bit 19 - 2-Cycle Writes"] #[inline(always)] pub fn epi_gpcfg_wr2cyc(&self) -> EPI_GPCFG_WR2CYCR { let bits = ((self.bits >> 19) & 1) != 0; EPI_GPCFG_WR2CYCR { bits } } #[doc = "Bits 22:25 - Frame Count"] #[inline(always)] pub fn epi_gpcfg_frmcnt(&self) -> EPI_GPCFG_FRMCNTR { let bits = ((self.bits >> 22) & 15) as u8; EPI_GPCFG_FRMCNTR { bits } } #[doc = "Bit 26 - 50/50 Frame"] #[inline(always)] pub fn epi_gpcfg_frm50(&self) -> EPI_GPCFG_FRM50R { let bits = ((self.bits >> 26) & 1) != 0; EPI_GPCFG_FRM50R { bits } } #[doc = "Bit 30 - Clock Gated"] #[inline(always)] pub fn epi_gpcfg_clkgate(&self) -> EPI_GPCFG_CLKGATER { let bits = ((self.bits >> 30) & 1) != 0; EPI_GPCFG_CLKGATER { bits } } #[doc = "Bit 31 - Clock Pin"] #[inline(always)] pub fn epi_gpcfg_clkpin(&self) -> EPI_GPCFG_CLKPINR { let bits = ((self.bits >> 31) & 1) != 0; EPI_GPCFG_CLKPINR { bits } } } impl W { #[doc = r"Writes raw bits to the register"] #[inline(always)] pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { self.bits = bits; self } #[doc = "Bits 0:1 - Size of Data Bus"] #[inline(always)] pub fn epi_gpcfg_dsize(&mut self) -> _EPI_GPCFG_DSIZEW { _EPI_GPCFG_DSIZEW { w: self } } #[doc = "Bits 4:5 - Address Bus Size"] #[inline(always)] pub fn epi_gpcfg_asize(&mut self) -> _EPI_GPCFG_ASIZEW { _EPI_GPCFG_ASIZEW { w: self } } #[doc = "Bit 19 - 2-Cycle Writes"] #[inline(always)] pub fn epi_gpcfg_wr2cyc(&mut self) -> _EPI_GPCFG_WR2CYCW { _EPI_GPCFG_WR2CYCW { w: self } } #[doc = "Bits 22:25 - Frame Count"] #[inline(always)] pub fn epi_gpcfg_frmcnt(&mut self) -> _EPI_GPCFG_FRMCNTW { _EPI_GPCFG_FRMCNTW { w: self } } #[doc = "Bit 26 - 50/50 Frame"] #[inline(always)] pub fn epi_gpcfg_frm50(&mut self) -> _EPI_GPCFG_FRM50W { _EPI_GPCFG_FRM50W { w: self } } #[doc = "Bit 30 - Clock Gated"] #[inline(always)] pub fn epi_gpcfg_clkgate(&mut self) -> _EPI_GPCFG_CLKGATEW { _EPI_GPCFG_CLKGATEW { w: self } } #[doc = "Bit 31 - Clock Pin"] #[inline(always)] pub fn epi_gpcfg_clkpin(&mut self) -> _EPI_GPCFG_CLKPINW { _EPI_GPCFG_CLKPINW { w: self } } }
pub mod currency_token; pub mod guards; pub mod types;
pub struct Camera { pub view: [[f32; 4]; 4], pub perspective: [[f32; 4]; 4], } impl Camera { pub fn new(position: &[f32; 3], direction: &[f32; 3]) -> Camera{ return Camera { view: view_matrix(position, direction, &[0.0, 1.0, 0.0]), perspective: { let aspect_ratio: f32 = 0.75; let fov: f32 = 3.141592/3.0; let zfar = 1024.0; let znear = 0.1; let f = 1.0/(fov/2.0).tan(); [ [f * aspect_ratio , 0.0, 0.0 , 0.0], [ 0.0 , f , 0.0 , 0.0], [ 0.0 , 0.0, (zfar+znear)/(zfar-znear) , 1.0], [ 0.0 , 0.0, -(2.0*zfar*znear)/(zfar-znear), 0.0], ] } } } } fn view_matrix(position: &[f32; 3], direction: &[f32; 3], up: &[f32; 3]) -> [[f32; 4]; 4] { // 首先求方向向量的单位向量 let f = { let f = direction; let len = f[0]*f[0] + f[1]*f[1] + f[2]*f[2]; let len = len.sqrt(); [f[0]/len, f[1]/len, f[2]/len] }; // 计算左向量 let s = [ up[1]*f[2] - up[2]*f[1], up[2]*f[0] - up[0]*f[2], up[0]*f[1] - up[1]*f[0], ]; let s_norm = { let len = s[0]*s[0] + s[1]*s[1] + s[2]*s[2]; let len = len.sqrt(); [s[0]/len, s[1]/len, s[2]/len] }; // 计算方向向量与左向量的叉乘, 即上向量 let u = [ f[1]*s_norm[2] - f[2]*s_norm[1], f[2]*s_norm[0] - f[0]*s_norm[2], f[0]*s_norm[1] - f[1]*s_norm[0], ]; let p = [ -position[0] * s_norm[0] - position[1] * s_norm[1] - position[2] * s_norm[2], -position[0] * u[0] - position[1] * u[1] - position[2] * u[2], -position[0] * f[0] - position[1] * f[1] - position[2] * f[2] ]; return [ [s_norm[0], u[0], f[0], 0.0], [s_norm[1], u[1], f[1], 0.0], [s_norm[2], u[2], f[2], 0.0], [p[0], p[1], p[2], 1.0], ] }
// Copyright 2023 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. use std::collections::HashMap; use std::sync::Arc; use std::sync::Mutex; pub type ProfSpanSetRef<K = u32> = Arc<Mutex<ProfSpanSet<K>>>; #[derive(Default)] pub struct ProfSpan { /// The time spent to process in nanoseconds pub process_time: u64, } impl ProfSpan { pub fn add(&mut self, other: &Self) { self.process_time += other.process_time; } } #[derive(Default)] pub struct ProfSpanSet<K = u32> { spans: HashMap<K, ProfSpan>, } impl<K> ProfSpanSet<K> where K: std::hash::Hash + Eq { pub fn update(&mut self, key: K, span: ProfSpan) { let entry = self.spans.entry(key).or_insert_with(ProfSpan::default); entry.add(&span); } pub fn iter(&self) -> impl Iterator<Item = (&K, &ProfSpan)> { self.spans.iter() } pub fn get(&self, k: &K) -> Option<&ProfSpan> { self.spans.get(k) } } #[derive(Clone, Default)] pub struct ProfSpanBuilder { process_time: u64, } impl ProfSpanBuilder { pub fn accumulate_process_time(&mut self, nanos: u64) { self.process_time += nanos; } pub fn finish(self) -> ProfSpan { ProfSpan { process_time: self.process_time, } } }
#[cfg(feature = "image")] pub mod image;
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] pub const ALLOC_LOG_CONF: u32 = 2u32; pub const BASIC_LOG_CONF: u32 = 0u32; pub const BOOT_LOG_CONF: u32 = 3u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct BUSNUMBER_DES { pub BUSD_Count: u32, pub BUSD_Type: u32, pub BUSD_Flags: u32, pub BUSD_Alloc_Base: u32, pub BUSD_Alloc_End: u32, } impl BUSNUMBER_DES {} impl ::core::default::Default for BUSNUMBER_DES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for BUSNUMBER_DES { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for BUSNUMBER_DES {} unsafe impl ::windows::core::Abi for BUSNUMBER_DES { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct BUSNUMBER_RANGE { pub BUSR_Min: u32, pub BUSR_Max: u32, pub BUSR_nBusNumbers: u32, pub BUSR_Flags: u32, } impl BUSNUMBER_RANGE {} impl ::core::default::Default for BUSNUMBER_RANGE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for BUSNUMBER_RANGE { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for BUSNUMBER_RANGE {} unsafe impl ::windows::core::Abi for BUSNUMBER_RANGE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct BUSNUMBER_RESOURCE { pub BusNumber_Header: BUSNUMBER_DES, pub BusNumber_Data: [BUSNUMBER_RANGE; 1], } impl BUSNUMBER_RESOURCE {} impl ::core::default::Default for BUSNUMBER_RESOURCE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for BUSNUMBER_RESOURCE { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for BUSNUMBER_RESOURCE {} unsafe impl ::windows::core::Abi for BUSNUMBER_RESOURCE { 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 CABINET_INFO_A { pub CabinetPath: super::super::Foundation::PSTR, pub CabinetFile: super::super::Foundation::PSTR, pub DiskName: super::super::Foundation::PSTR, pub SetId: u16, pub CabinetNumber: u16, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl CABINET_INFO_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for CABINET_INFO_A { 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 CABINET_INFO_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("CABINET_INFO_A").field("CabinetPath", &self.CabinetPath).field("CabinetFile", &self.CabinetFile).field("DiskName", &self.DiskName).field("SetId", &self.SetId).field("CabinetNumber", &self.CabinetNumber).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for CABINET_INFO_A { fn eq(&self, other: &Self) -> bool { self.CabinetPath == other.CabinetPath && self.CabinetFile == other.CabinetFile && self.DiskName == other.DiskName && self.SetId == other.SetId && self.CabinetNumber == other.CabinetNumber } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for CABINET_INFO_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for CABINET_INFO_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct CABINET_INFO_A { pub CabinetPath: super::super::Foundation::PSTR, pub CabinetFile: super::super::Foundation::PSTR, pub DiskName: super::super::Foundation::PSTR, pub SetId: u16, pub CabinetNumber: u16, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl CABINET_INFO_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for CABINET_INFO_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for CABINET_INFO_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for CABINET_INFO_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for CABINET_INFO_A { 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 CABINET_INFO_W { pub CabinetPath: super::super::Foundation::PWSTR, pub CabinetFile: super::super::Foundation::PWSTR, pub DiskName: super::super::Foundation::PWSTR, pub SetId: u16, pub CabinetNumber: u16, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl CABINET_INFO_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for CABINET_INFO_W { 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 CABINET_INFO_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("CABINET_INFO_W").field("CabinetPath", &self.CabinetPath).field("CabinetFile", &self.CabinetFile).field("DiskName", &self.DiskName).field("SetId", &self.SetId).field("CabinetNumber", &self.CabinetNumber).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for CABINET_INFO_W { fn eq(&self, other: &Self) -> bool { self.CabinetPath == other.CabinetPath && self.CabinetFile == other.CabinetFile && self.DiskName == other.DiskName && self.SetId == other.SetId && self.CabinetNumber == other.CabinetNumber } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for CABINET_INFO_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for CABINET_INFO_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct CABINET_INFO_W { pub CabinetPath: super::super::Foundation::PWSTR, pub CabinetFile: super::super::Foundation::PWSTR, pub DiskName: super::super::Foundation::PWSTR, pub SetId: u16, pub CabinetNumber: u16, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl CABINET_INFO_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for CABINET_INFO_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for CABINET_INFO_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for CABINET_INFO_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for CABINET_INFO_W { type Abi = Self; } #[inline] pub unsafe fn CMP_WaitNoPendingInstallEvents(dwtimeout: u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CMP_WaitNoPendingInstallEvents(dwtimeout: u32) -> u32; } ::core::mem::transmute(CMP_WaitNoPendingInstallEvents(::core::mem::transmute(dwtimeout))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const CM_ADD_ID_BITS: u32 = 1u32; pub const CM_ADD_ID_COMPATIBLE: u32 = 1u32; pub const CM_ADD_ID_HARDWARE: u32 = 0u32; pub const CM_ADD_RANGE_ADDIFCONFLICT: u32 = 0u32; pub const CM_ADD_RANGE_BITS: u32 = 1u32; pub const CM_ADD_RANGE_DONOTADDIFCONFLICT: u32 = 1u32; #[cfg(feature = "Win32_Data_HtmlHelp")] #[inline] pub unsafe fn CM_Add_Empty_Log_Conf(plclogconf: *mut usize, dndevinst: u32, priority: super::super::Data::HtmlHelp::PRIORITY, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Add_Empty_Log_Conf(plclogconf: *mut usize, dndevinst: u32, priority: super::super::Data::HtmlHelp::PRIORITY, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Add_Empty_Log_Conf(::core::mem::transmute(plclogconf), ::core::mem::transmute(dndevinst), ::core::mem::transmute(priority), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Data_HtmlHelp")] #[inline] pub unsafe fn CM_Add_Empty_Log_Conf_Ex(plclogconf: *mut usize, dndevinst: u32, priority: super::super::Data::HtmlHelp::PRIORITY, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Add_Empty_Log_Conf_Ex(plclogconf: *mut usize, dndevinst: u32, priority: super::super::Data::HtmlHelp::PRIORITY, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Add_Empty_Log_Conf_Ex(::core::mem::transmute(plclogconf), ::core::mem::transmute(dndevinst), ::core::mem::transmute(priority), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Add_IDA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(dndevinst: u32, pszid: Param1, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Add_IDA(dndevinst: u32, pszid: super::super::Foundation::PSTR, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Add_IDA(::core::mem::transmute(dndevinst), pszid.into_param().abi(), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Add_IDW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(dndevinst: u32, pszid: Param1, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Add_IDW(dndevinst: u32, pszid: super::super::Foundation::PWSTR, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Add_IDW(::core::mem::transmute(dndevinst), pszid.into_param().abi(), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Add_ID_ExA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(dndevinst: u32, pszid: Param1, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Add_ID_ExA(dndevinst: u32, pszid: super::super::Foundation::PSTR, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Add_ID_ExA(::core::mem::transmute(dndevinst), pszid.into_param().abi(), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Add_ID_ExW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(dndevinst: u32, pszid: Param1, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Add_ID_ExW(dndevinst: u32, pszid: super::super::Foundation::PWSTR, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Add_ID_ExW(::core::mem::transmute(dndevinst), pszid.into_param().abi(), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Add_Range(ullstartvalue: u64, ullendvalue: u64, rlh: usize, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Add_Range(ullstartvalue: u64, ullendvalue: u64, rlh: usize, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Add_Range(::core::mem::transmute(ullstartvalue), ::core::mem::transmute(ullendvalue), ::core::mem::transmute(rlh), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Add_Res_Des(prdresdes: *mut usize, lclogconf: usize, resourceid: u32, resourcedata: *const ::core::ffi::c_void, resourcelen: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Add_Res_Des(prdresdes: *mut usize, lclogconf: usize, resourceid: u32, resourcedata: *const ::core::ffi::c_void, resourcelen: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Add_Res_Des(::core::mem::transmute(prdresdes), ::core::mem::transmute(lclogconf), ::core::mem::transmute(resourceid), ::core::mem::transmute(resourcedata), ::core::mem::transmute(resourcelen), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Add_Res_Des_Ex(prdresdes: *mut usize, lclogconf: usize, resourceid: u32, resourcedata: *const ::core::ffi::c_void, resourcelen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Add_Res_Des_Ex(prdresdes: *mut usize, lclogconf: usize, resourceid: u32, resourcedata: *const ::core::ffi::c_void, resourcelen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Add_Res_Des_Ex(::core::mem::transmute(prdresdes), ::core::mem::transmute(lclogconf), ::core::mem::transmute(resourceid), ::core::mem::transmute(resourcedata), ::core::mem::transmute(resourcelen), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const CM_CDFLAGS_DRIVER: u32 = 1u32; pub const CM_CDFLAGS_RESERVED: u32 = 4u32; pub const CM_CDFLAGS_ROOT_OWNED: u32 = 2u32; pub const CM_CDMASK_DESCRIPTION: u32 = 8u32; pub const CM_CDMASK_DEVINST: u32 = 1u32; pub const CM_CDMASK_FLAGS: u32 = 4u32; pub const CM_CDMASK_RESDES: u32 = 2u32; pub const CM_CDMASK_VALID: u32 = 15u32; pub const CM_CLASS_PROPERTY_BITS: u32 = 1u32; pub const CM_CLASS_PROPERTY_INSTALLER: u32 = 0u32; pub const CM_CLASS_PROPERTY_INTERFACE: u32 = 1u32; pub const CM_CREATE_DEVINST_BITS: u32 = 15u32; pub const CM_CREATE_DEVINST_DO_NOT_INSTALL: u32 = 8u32; pub const CM_CREATE_DEVINST_GENERATE_ID: u32 = 4u32; pub const CM_CREATE_DEVINST_NORMAL: u32 = 0u32; pub const CM_CREATE_DEVINST_NO_WAIT_INSTALL: u32 = 1u32; pub const CM_CREATE_DEVINST_PHANTOM: u32 = 2u32; pub const CM_CREATE_DEVNODE_BITS: u32 = 15u32; pub const CM_CREATE_DEVNODE_DO_NOT_INSTALL: u32 = 8u32; pub const CM_CREATE_DEVNODE_GENERATE_ID: u32 = 4u32; pub const CM_CREATE_DEVNODE_NORMAL: u32 = 0u32; pub const CM_CREATE_DEVNODE_NO_WAIT_INSTALL: u32 = 1u32; pub const CM_CREATE_DEVNODE_PHANTOM: u32 = 2u32; pub const CM_CRP_CHARACTERISTICS: u32 = 28u32; pub const CM_CRP_DEVTYPE: u32 = 26u32; pub const CM_CRP_EXCLUSIVE: u32 = 27u32; pub const CM_CRP_LOWERFILTERS: u32 = 19u32; pub const CM_CRP_MAX: u32 = 37u32; pub const CM_CRP_MIN: u32 = 1u32; pub const CM_CRP_SECURITY: u32 = 24u32; pub const CM_CRP_SECURITY_SDS: u32 = 25u32; pub const CM_CRP_UPPERFILTERS: u32 = 18u32; pub const CM_CUSTOMDEVPROP_BITS: u32 = 1u32; pub const CM_CUSTOMDEVPROP_MERGE_MULTISZ: u32 = 1u32; #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Connect_MachineA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(uncservername: Param0, phmachine: *mut isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Connect_MachineA(uncservername: super::super::Foundation::PSTR, phmachine: *mut isize) -> CONFIGRET; } ::core::mem::transmute(CM_Connect_MachineA(uncservername.into_param().abi(), ::core::mem::transmute(phmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Connect_MachineW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(uncservername: Param0, phmachine: *mut isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Connect_MachineW(uncservername: super::super::Foundation::PWSTR, phmachine: *mut isize) -> CONFIGRET; } ::core::mem::transmute(CM_Connect_MachineW(uncservername.into_param().abi(), ::core::mem::transmute(phmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Create_DevNodeA(pdndevinst: *mut u32, pdeviceid: *const i8, dnparent: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Create_DevNodeA(pdndevinst: *mut u32, pdeviceid: *const i8, dnparent: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Create_DevNodeA(::core::mem::transmute(pdndevinst), ::core::mem::transmute(pdeviceid), ::core::mem::transmute(dnparent), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Create_DevNodeW(pdndevinst: *mut u32, pdeviceid: *const u16, dnparent: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Create_DevNodeW(pdndevinst: *mut u32, pdeviceid: *const u16, dnparent: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Create_DevNodeW(::core::mem::transmute(pdndevinst), ::core::mem::transmute(pdeviceid), ::core::mem::transmute(dnparent), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Create_DevNode_ExA(pdndevinst: *mut u32, pdeviceid: *const i8, dnparent: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Create_DevNode_ExA(pdndevinst: *mut u32, pdeviceid: *const i8, dnparent: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Create_DevNode_ExA(::core::mem::transmute(pdndevinst), ::core::mem::transmute(pdeviceid), ::core::mem::transmute(dnparent), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Create_DevNode_ExW(pdndevinst: *mut u32, pdeviceid: *const u16, dnparent: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Create_DevNode_ExW(pdndevinst: *mut u32, pdeviceid: *const u16, dnparent: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Create_DevNode_ExW(::core::mem::transmute(pdndevinst), ::core::mem::transmute(pdeviceid), ::core::mem::transmute(dnparent), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Create_Range_List(prlh: *mut usize, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Create_Range_List(prlh: *mut usize, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Create_Range_List(::core::mem::transmute(prlh), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const CM_DELETE_CLASS_BITS: u32 = 3u32; pub const CM_DELETE_CLASS_INTERFACE: u32 = 2u32; pub const CM_DELETE_CLASS_ONLY: u32 = 0u32; pub const CM_DELETE_CLASS_SUBKEYS: u32 = 1u32; pub const CM_DETECT_BITS: u32 = 2147483655u32; pub const CM_DETECT_CRASHED: u32 = 2u32; pub const CM_DETECT_HWPROF_FIRST_BOOT: u32 = 4u32; pub const CM_DETECT_NEW_PROFILE: u32 = 1u32; pub const CM_DETECT_RUN: u32 = 2147483648u32; pub const CM_DEVCAP_DOCKDEVICE: u32 = 8u32; pub const CM_DEVCAP_EJECTSUPPORTED: u32 = 2u32; pub const CM_DEVCAP_HARDWAREDISABLED: u32 = 256u32; pub const CM_DEVCAP_LOCKSUPPORTED: u32 = 1u32; pub const CM_DEVCAP_NONDYNAMIC: u32 = 512u32; pub const CM_DEVCAP_RAWDEVICEOK: u32 = 64u32; pub const CM_DEVCAP_REMOVABLE: u32 = 4u32; pub const CM_DEVCAP_SECUREDEVICE: u32 = 1024u32; pub const CM_DEVCAP_SILENTINSTALL: u32 = 32u32; pub const CM_DEVCAP_SURPRISEREMOVALOK: u32 = 128u32; pub const CM_DEVCAP_UNIQUEID: u32 = 16u32; pub const CM_DEVICE_PANEL_EDGE_BOTTOM: u32 = 2u32; pub const CM_DEVICE_PANEL_EDGE_LEFT: u32 = 3u32; pub const CM_DEVICE_PANEL_EDGE_RIGHT: u32 = 4u32; pub const CM_DEVICE_PANEL_EDGE_TOP: u32 = 1u32; pub const CM_DEVICE_PANEL_EDGE_UNKNOWN: u32 = 0u32; pub const CM_DEVICE_PANEL_JOINT_TYPE_HINGE: u32 = 2u32; pub const CM_DEVICE_PANEL_JOINT_TYPE_PIVOT: u32 = 3u32; pub const CM_DEVICE_PANEL_JOINT_TYPE_PLANAR: u32 = 1u32; pub const CM_DEVICE_PANEL_JOINT_TYPE_SWIVEL: u32 = 4u32; pub const CM_DEVICE_PANEL_JOINT_TYPE_UNKNOWN: u32 = 0u32; pub const CM_DEVICE_PANEL_ORIENTATION_HORIZONTAL: u32 = 0u32; pub const CM_DEVICE_PANEL_ORIENTATION_VERTICAL: u32 = 1u32; pub const CM_DEVICE_PANEL_SHAPE_OVAL: u32 = 2u32; pub const CM_DEVICE_PANEL_SHAPE_RECTANGLE: u32 = 1u32; pub const CM_DEVICE_PANEL_SHAPE_UNKNOWN: u32 = 0u32; pub const CM_DEVICE_PANEL_SIDE_BACK: u32 = 6u32; pub const CM_DEVICE_PANEL_SIDE_BOTTOM: u32 = 2u32; pub const CM_DEVICE_PANEL_SIDE_FRONT: u32 = 5u32; pub const CM_DEVICE_PANEL_SIDE_LEFT: u32 = 3u32; pub const CM_DEVICE_PANEL_SIDE_RIGHT: u32 = 4u32; pub const CM_DEVICE_PANEL_SIDE_TOP: u32 = 1u32; pub const CM_DEVICE_PANEL_SIDE_UNKNOWN: u32 = 0u32; pub const CM_DISABLE_ABSOLUTE: u32 = 1u32; pub const CM_DISABLE_BITS: u32 = 15u32; pub const CM_DISABLE_HARDWARE: u32 = 2u32; pub const CM_DISABLE_PERSIST: u32 = 8u32; pub const CM_DISABLE_POLITE: u32 = 0u32; pub const CM_DISABLE_UI_NOT_OK: u32 = 4u32; pub const CM_DRP_ADDRESS: u32 = 29u32; pub const CM_DRP_BASE_CONTAINERID: u32 = 37u32; pub const CM_DRP_BUSNUMBER: u32 = 22u32; pub const CM_DRP_BUSTYPEGUID: u32 = 20u32; pub const CM_DRP_CAPABILITIES: u32 = 16u32; pub const CM_DRP_CHARACTERISTICS: u32 = 28u32; pub const CM_DRP_CLASS: u32 = 8u32; pub const CM_DRP_CLASSGUID: u32 = 9u32; pub const CM_DRP_COMPATIBLEIDS: u32 = 3u32; pub const CM_DRP_CONFIGFLAGS: u32 = 11u32; pub const CM_DRP_DEVICEDESC: u32 = 1u32; pub const CM_DRP_DEVICE_POWER_DATA: u32 = 31u32; pub const CM_DRP_DEVTYPE: u32 = 26u32; pub const CM_DRP_DRIVER: u32 = 10u32; pub const CM_DRP_ENUMERATOR_NAME: u32 = 23u32; pub const CM_DRP_EXCLUSIVE: u32 = 27u32; pub const CM_DRP_FRIENDLYNAME: u32 = 13u32; pub const CM_DRP_HARDWAREID: u32 = 2u32; pub const CM_DRP_INSTALL_STATE: u32 = 35u32; pub const CM_DRP_LEGACYBUSTYPE: u32 = 21u32; pub const CM_DRP_LOCATION_INFORMATION: u32 = 14u32; pub const CM_DRP_LOCATION_PATHS: u32 = 36u32; pub const CM_DRP_LOWERFILTERS: u32 = 19u32; pub const CM_DRP_MAX: u32 = 37u32; pub const CM_DRP_MFG: u32 = 12u32; pub const CM_DRP_MIN: u32 = 1u32; pub const CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME: u32 = 15u32; pub const CM_DRP_REMOVAL_POLICY: u32 = 32u32; pub const CM_DRP_REMOVAL_POLICY_HW_DEFAULT: u32 = 33u32; pub const CM_DRP_REMOVAL_POLICY_OVERRIDE: u32 = 34u32; pub const CM_DRP_SECURITY: u32 = 24u32; pub const CM_DRP_SECURITY_SDS: u32 = 25u32; pub const CM_DRP_SERVICE: u32 = 5u32; pub const CM_DRP_UI_NUMBER: u32 = 17u32; pub const CM_DRP_UI_NUMBER_DESC_FORMAT: u32 = 30u32; pub const CM_DRP_UNUSED0: u32 = 4u32; pub const CM_DRP_UNUSED1: u32 = 6u32; pub const CM_DRP_UNUSED2: u32 = 7u32; pub const CM_DRP_UPPERFILTERS: u32 = 18u32; #[inline] pub unsafe fn CM_Delete_Class_Key(classguid: *const ::windows::core::GUID, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Delete_Class_Key(classguid: *const ::windows::core::GUID, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Delete_Class_Key(::core::mem::transmute(classguid), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Delete_Class_Key_Ex(classguid: *const ::windows::core::GUID, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Delete_Class_Key_Ex(classguid: *const ::windows::core::GUID, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Delete_Class_Key_Ex(::core::mem::transmute(classguid), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Delete_DevNode_Key(dndevnode: u32, ulhardwareprofile: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Delete_DevNode_Key(dndevnode: u32, ulhardwareprofile: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Delete_DevNode_Key(::core::mem::transmute(dndevnode), ::core::mem::transmute(ulhardwareprofile), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Delete_DevNode_Key_Ex(dndevnode: u32, ulhardwareprofile: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Delete_DevNode_Key_Ex(dndevnode: u32, ulhardwareprofile: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Delete_DevNode_Key_Ex(::core::mem::transmute(dndevnode), ::core::mem::transmute(ulhardwareprofile), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Delete_Device_Interface_KeyA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pszdeviceinterface: Param0, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Delete_Device_Interface_KeyA(pszdeviceinterface: super::super::Foundation::PSTR, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Delete_Device_Interface_KeyA(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Delete_Device_Interface_KeyW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszdeviceinterface: Param0, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Delete_Device_Interface_KeyW(pszdeviceinterface: super::super::Foundation::PWSTR, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Delete_Device_Interface_KeyW(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Delete_Device_Interface_Key_ExA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pszdeviceinterface: Param0, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Delete_Device_Interface_Key_ExA(pszdeviceinterface: super::super::Foundation::PSTR, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Delete_Device_Interface_Key_ExA(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Delete_Device_Interface_Key_ExW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszdeviceinterface: Param0, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Delete_Device_Interface_Key_ExW(pszdeviceinterface: super::super::Foundation::PWSTR, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Delete_Device_Interface_Key_ExW(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Delete_Range(ullstartvalue: u64, ullendvalue: u64, rlh: usize, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Delete_Range(ullstartvalue: u64, ullendvalue: u64, rlh: usize, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Delete_Range(::core::mem::transmute(ullstartvalue), ::core::mem::transmute(ullendvalue), ::core::mem::transmute(rlh), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Detect_Resource_Conflict(dndevinst: u32, resourceid: u32, resourcedata: *const ::core::ffi::c_void, resourcelen: u32, pbconflictdetected: *mut super::super::Foundation::BOOL, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Detect_Resource_Conflict(dndevinst: u32, resourceid: u32, resourcedata: *const ::core::ffi::c_void, resourcelen: u32, pbconflictdetected: *mut super::super::Foundation::BOOL, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Detect_Resource_Conflict(::core::mem::transmute(dndevinst), ::core::mem::transmute(resourceid), ::core::mem::transmute(resourcedata), ::core::mem::transmute(resourcelen), ::core::mem::transmute(pbconflictdetected), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Detect_Resource_Conflict_Ex(dndevinst: u32, resourceid: u32, resourcedata: *const ::core::ffi::c_void, resourcelen: u32, pbconflictdetected: *mut super::super::Foundation::BOOL, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Detect_Resource_Conflict_Ex(dndevinst: u32, resourceid: u32, resourcedata: *const ::core::ffi::c_void, resourcelen: u32, pbconflictdetected: *mut super::super::Foundation::BOOL, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Detect_Resource_Conflict_Ex(::core::mem::transmute(dndevinst), ::core::mem::transmute(resourceid), ::core::mem::transmute(resourcedata), ::core::mem::transmute(resourcelen), ::core::mem::transmute(pbconflictdetected), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Disable_DevNode(dndevinst: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Disable_DevNode(dndevinst: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Disable_DevNode(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Disable_DevNode_Ex(dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Disable_DevNode_Ex(dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Disable_DevNode_Ex(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Disconnect_Machine(hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Disconnect_Machine(hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Disconnect_Machine(::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Dup_Range_List(rlhold: usize, rlhnew: usize, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Dup_Range_List(rlhold: usize, rlhnew: usize, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Dup_Range_List(::core::mem::transmute(rlhold), ::core::mem::transmute(rlhnew), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const CM_ENUMERATE_CLASSES_BITS: u32 = 1u32; pub const CM_ENUMERATE_CLASSES_INSTALLER: u32 = 0u32; pub const CM_ENUMERATE_CLASSES_INTERFACE: u32 = 1u32; #[inline] pub unsafe fn CM_Enable_DevNode(dndevinst: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Enable_DevNode(dndevinst: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Enable_DevNode(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Enable_DevNode_Ex(dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Enable_DevNode_Ex(dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Enable_DevNode_Ex(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Enumerate_Classes(ulclassindex: u32, classguid: *mut ::windows::core::GUID, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Enumerate_Classes(ulclassindex: u32, classguid: *mut ::windows::core::GUID, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Enumerate_Classes(::core::mem::transmute(ulclassindex), ::core::mem::transmute(classguid), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Enumerate_Classes_Ex(ulclassindex: u32, classguid: *mut ::windows::core::GUID, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Enumerate_Classes_Ex(ulclassindex: u32, classguid: *mut ::windows::core::GUID, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Enumerate_Classes_Ex(::core::mem::transmute(ulclassindex), ::core::mem::transmute(classguid), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Enumerate_EnumeratorsA(ulenumindex: u32, buffer: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Enumerate_EnumeratorsA(ulenumindex: u32, buffer: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Enumerate_EnumeratorsA(::core::mem::transmute(ulenumindex), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Enumerate_EnumeratorsW(ulenumindex: u32, buffer: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Enumerate_EnumeratorsW(ulenumindex: u32, buffer: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Enumerate_EnumeratorsW(::core::mem::transmute(ulenumindex), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Enumerate_Enumerators_ExA(ulenumindex: u32, buffer: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Enumerate_Enumerators_ExA(ulenumindex: u32, buffer: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Enumerate_Enumerators_ExA(::core::mem::transmute(ulenumindex), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Enumerate_Enumerators_ExW(ulenumindex: u32, buffer: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Enumerate_Enumerators_ExW(ulenumindex: u32, buffer: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Enumerate_Enumerators_ExW(::core::mem::transmute(ulenumindex), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Find_Range(pullstart: *mut u64, ullstart: u64, ullength: u32, ullalignment: u64, ullend: u64, rlh: usize, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Find_Range(pullstart: *mut u64, ullstart: u64, ullength: u32, ullalignment: u64, ullend: u64, rlh: usize, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Find_Range(::core::mem::transmute(pullstart), ::core::mem::transmute(ullstart), ::core::mem::transmute(ullength), ::core::mem::transmute(ullalignment), ::core::mem::transmute(ullend), ::core::mem::transmute(rlh), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_First_Range(rlh: usize, pullstart: *mut u64, pullend: *mut u64, preelement: *mut usize, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_First_Range(rlh: usize, pullstart: *mut u64, pullend: *mut u64, preelement: *mut usize, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_First_Range(::core::mem::transmute(rlh), ::core::mem::transmute(pullstart), ::core::mem::transmute(pullend), ::core::mem::transmute(preelement), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Free_Log_Conf(lclogconftobefreed: usize, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Free_Log_Conf(lclogconftobefreed: usize, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Free_Log_Conf(::core::mem::transmute(lclogconftobefreed), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Free_Log_Conf_Ex(lclogconftobefreed: usize, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Free_Log_Conf_Ex(lclogconftobefreed: usize, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Free_Log_Conf_Ex(::core::mem::transmute(lclogconftobefreed), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Free_Log_Conf_Handle(lclogconf: usize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Free_Log_Conf_Handle(lclogconf: usize) -> CONFIGRET; } ::core::mem::transmute(CM_Free_Log_Conf_Handle(::core::mem::transmute(lclogconf))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Free_Range_List(rlh: usize, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Free_Range_List(rlh: usize, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Free_Range_List(::core::mem::transmute(rlh), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Free_Res_Des(prdresdes: *mut usize, rdresdes: usize, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Free_Res_Des(prdresdes: *mut usize, rdresdes: usize, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Free_Res_Des(::core::mem::transmute(prdresdes), ::core::mem::transmute(rdresdes), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Free_Res_Des_Ex(prdresdes: *mut usize, rdresdes: usize, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Free_Res_Des_Ex(prdresdes: *mut usize, rdresdes: usize, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Free_Res_Des_Ex(::core::mem::transmute(prdresdes), ::core::mem::transmute(rdresdes), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Free_Res_Des_Handle(rdresdes: usize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Free_Res_Des_Handle(rdresdes: usize) -> CONFIGRET; } ::core::mem::transmute(CM_Free_Res_Des_Handle(::core::mem::transmute(rdresdes))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Free_Resource_Conflict_Handle(clconflictlist: usize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Free_Resource_Conflict_Handle(clconflictlist: usize) -> CONFIGRET; } ::core::mem::transmute(CM_Free_Resource_Conflict_Handle(::core::mem::transmute(clconflictlist))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const CM_GETIDLIST_DONOTGENERATE: u32 = 268435520u32; pub const CM_GETIDLIST_FILTER_BITS: u32 = 268435583u32; pub const CM_GETIDLIST_FILTER_BUSRELATIONS: u32 = 32u32; pub const CM_GETIDLIST_FILTER_CLASS: u32 = 512u32; pub const CM_GETIDLIST_FILTER_EJECTRELATIONS: u32 = 4u32; pub const CM_GETIDLIST_FILTER_ENUMERATOR: u32 = 1u32; pub const CM_GETIDLIST_FILTER_NONE: u32 = 0u32; pub const CM_GETIDLIST_FILTER_POWERRELATIONS: u32 = 16u32; pub const CM_GETIDLIST_FILTER_PRESENT: u32 = 256u32; pub const CM_GETIDLIST_FILTER_REMOVALRELATIONS: u32 = 8u32; pub const CM_GETIDLIST_FILTER_SERVICE: u32 = 2u32; pub const CM_GETIDLIST_FILTER_TRANSPORTRELATIONS: u32 = 128u32; pub const CM_GET_DEVICE_INTERFACE_LIST_ALL_DEVICES: u32 = 1u32; pub const CM_GET_DEVICE_INTERFACE_LIST_BITS: u32 = 1u32; pub const CM_GET_DEVICE_INTERFACE_LIST_PRESENT: u32 = 0u32; pub const CM_GLOBAL_STATE_CAN_DO_UI: u32 = 1u32; pub const CM_GLOBAL_STATE_DETECTION_PENDING: u32 = 16u32; pub const CM_GLOBAL_STATE_ON_BIG_STACK: u32 = 2u32; pub const CM_GLOBAL_STATE_REBOOT_REQUIRED: u32 = 32u32; pub const CM_GLOBAL_STATE_SERVICES_AVAILABLE: u32 = 4u32; pub const CM_GLOBAL_STATE_SHUTTING_DOWN: u32 = 8u32; #[inline] pub unsafe fn CM_Get_Child(pdndevinst: *mut u32, dndevinst: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Child(pdndevinst: *mut u32, dndevinst: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Child(::core::mem::transmute(pdndevinst), ::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Child_Ex(pdndevinst: *mut u32, dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Child_Ex(pdndevinst: *mut u32, dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Child_Ex(::core::mem::transmute(pdndevinst), ::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Class_Key_NameA(classguid: *const ::windows::core::GUID, pszkeyname: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Class_Key_NameA(classguid: *const ::windows::core::GUID, pszkeyname: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Class_Key_NameA(::core::mem::transmute(classguid), ::core::mem::transmute(pszkeyname), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Class_Key_NameW(classguid: *const ::windows::core::GUID, pszkeyname: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Class_Key_NameW(classguid: *const ::windows::core::GUID, pszkeyname: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Class_Key_NameW(::core::mem::transmute(classguid), ::core::mem::transmute(pszkeyname), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Class_Key_Name_ExA(classguid: *const ::windows::core::GUID, pszkeyname: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Class_Key_Name_ExA(classguid: *const ::windows::core::GUID, pszkeyname: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Class_Key_Name_ExA(::core::mem::transmute(classguid), ::core::mem::transmute(pszkeyname), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Class_Key_Name_ExW(classguid: *const ::windows::core::GUID, pszkeyname: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Class_Key_Name_ExW(classguid: *const ::windows::core::GUID, pszkeyname: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Class_Key_Name_ExW(::core::mem::transmute(classguid), ::core::mem::transmute(pszkeyname), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Class_NameA(classguid: *const ::windows::core::GUID, buffer: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Class_NameA(classguid: *const ::windows::core::GUID, buffer: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Class_NameA(::core::mem::transmute(classguid), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Class_NameW(classguid: *const ::windows::core::GUID, buffer: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Class_NameW(classguid: *const ::windows::core::GUID, buffer: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Class_NameW(::core::mem::transmute(classguid), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Class_Name_ExA(classguid: *const ::windows::core::GUID, buffer: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Class_Name_ExA(classguid: *const ::windows::core::GUID, buffer: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Class_Name_ExA(::core::mem::transmute(classguid), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Class_Name_ExW(classguid: *const ::windows::core::GUID, buffer: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Class_Name_ExW(classguid: *const ::windows::core::GUID, buffer: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Class_Name_ExW(::core::mem::transmute(classguid), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Devices_Properties")] #[inline] pub unsafe fn CM_Get_Class_PropertyW(classguid: *const ::windows::core::GUID, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Class_PropertyW(classguid: *const ::windows::core::GUID, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Class_PropertyW(::core::mem::transmute(classguid), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Devices_Properties")] #[inline] pub unsafe fn CM_Get_Class_Property_ExW(classguid: *const ::windows::core::GUID, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Class_Property_ExW(classguid: *const ::windows::core::GUID, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Class_Property_ExW(::core::mem::transmute(classguid), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Devices_Properties")] #[inline] pub unsafe fn CM_Get_Class_Property_Keys(classguid: *const ::windows::core::GUID, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Class_Property_Keys(classguid: *const ::windows::core::GUID, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Class_Property_Keys(::core::mem::transmute(classguid), ::core::mem::transmute(propertykeyarray), ::core::mem::transmute(propertykeycount), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Devices_Properties")] #[inline] pub unsafe fn CM_Get_Class_Property_Keys_Ex(classguid: *const ::windows::core::GUID, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Class_Property_Keys_Ex(classguid: *const ::windows::core::GUID, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Class_Property_Keys_Ex(::core::mem::transmute(classguid), ::core::mem::transmute(propertykeyarray), ::core::mem::transmute(propertykeycount), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Class_Registry_PropertyA(classguid: *const ::windows::core::GUID, ulproperty: u32, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Class_Registry_PropertyA(classguid: *const ::windows::core::GUID, ulproperty: u32, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Class_Registry_PropertyA(::core::mem::transmute(classguid), ::core::mem::transmute(ulproperty), ::core::mem::transmute(pulregdatatype), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Class_Registry_PropertyW(classguid: *const ::windows::core::GUID, ulproperty: u32, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Class_Registry_PropertyW(classguid: *const ::windows::core::GUID, ulproperty: u32, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Class_Registry_PropertyW(::core::mem::transmute(classguid), ::core::mem::transmute(ulproperty), ::core::mem::transmute(pulregdatatype), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Depth(puldepth: *mut u32, dndevinst: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Depth(puldepth: *mut u32, dndevinst: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Depth(::core::mem::transmute(puldepth), ::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Depth_Ex(puldepth: *mut u32, dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Depth_Ex(puldepth: *mut u32, dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Depth_Ex(::core::mem::transmute(puldepth), ::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_DevNode_Custom_PropertyA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(dndevinst: u32, pszcustompropertyname: Param1, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_DevNode_Custom_PropertyA(dndevinst: u32, pszcustompropertyname: super::super::Foundation::PSTR, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_DevNode_Custom_PropertyA(::core::mem::transmute(dndevinst), pszcustompropertyname.into_param().abi(), ::core::mem::transmute(pulregdatatype), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_DevNode_Custom_PropertyW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(dndevinst: u32, pszcustompropertyname: Param1, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_DevNode_Custom_PropertyW(dndevinst: u32, pszcustompropertyname: super::super::Foundation::PWSTR, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_DevNode_Custom_PropertyW(::core::mem::transmute(dndevinst), pszcustompropertyname.into_param().abi(), ::core::mem::transmute(pulregdatatype), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_DevNode_Custom_Property_ExA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(dndevinst: u32, pszcustompropertyname: Param1, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_DevNode_Custom_Property_ExA(dndevinst: u32, pszcustompropertyname: super::super::Foundation::PSTR, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_DevNode_Custom_Property_ExA(::core::mem::transmute(dndevinst), pszcustompropertyname.into_param().abi(), ::core::mem::transmute(pulregdatatype), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_DevNode_Custom_Property_ExW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(dndevinst: u32, pszcustompropertyname: Param1, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_DevNode_Custom_Property_ExW(dndevinst: u32, pszcustompropertyname: super::super::Foundation::PWSTR, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_DevNode_Custom_Property_ExW(::core::mem::transmute(dndevinst), pszcustompropertyname.into_param().abi(), ::core::mem::transmute(pulregdatatype), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Devices_Properties")] #[inline] pub unsafe fn CM_Get_DevNode_PropertyW(dndevinst: u32, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_DevNode_PropertyW(dndevinst: u32, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_DevNode_PropertyW(::core::mem::transmute(dndevinst), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Devices_Properties")] #[inline] pub unsafe fn CM_Get_DevNode_Property_ExW(dndevinst: u32, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_DevNode_Property_ExW(dndevinst: u32, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_DevNode_Property_ExW(::core::mem::transmute(dndevinst), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Devices_Properties")] #[inline] pub unsafe fn CM_Get_DevNode_Property_Keys(dndevinst: u32, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_DevNode_Property_Keys(dndevinst: u32, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_DevNode_Property_Keys(::core::mem::transmute(dndevinst), ::core::mem::transmute(propertykeyarray), ::core::mem::transmute(propertykeycount), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Devices_Properties")] #[inline] pub unsafe fn CM_Get_DevNode_Property_Keys_Ex(dndevinst: u32, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_DevNode_Property_Keys_Ex(dndevinst: u32, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_DevNode_Property_Keys_Ex(::core::mem::transmute(dndevinst), ::core::mem::transmute(propertykeyarray), ::core::mem::transmute(propertykeycount), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_DevNode_Registry_PropertyA(dndevinst: u32, ulproperty: u32, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_DevNode_Registry_PropertyA(dndevinst: u32, ulproperty: u32, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_DevNode_Registry_PropertyA(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulproperty), ::core::mem::transmute(pulregdatatype), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_DevNode_Registry_PropertyW(dndevinst: u32, ulproperty: u32, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_DevNode_Registry_PropertyW(dndevinst: u32, ulproperty: u32, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_DevNode_Registry_PropertyW(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulproperty), ::core::mem::transmute(pulregdatatype), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_DevNode_Registry_Property_ExA(dndevinst: u32, ulproperty: u32, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_DevNode_Registry_Property_ExA(dndevinst: u32, ulproperty: u32, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_DevNode_Registry_Property_ExA(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulproperty), ::core::mem::transmute(pulregdatatype), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_DevNode_Registry_Property_ExW(dndevinst: u32, ulproperty: u32, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_DevNode_Registry_Property_ExW(dndevinst: u32, ulproperty: u32, pulregdatatype: *mut u32, buffer: *mut ::core::ffi::c_void, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_DevNode_Registry_Property_ExW(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulproperty), ::core::mem::transmute(pulregdatatype), ::core::mem::transmute(buffer), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_DevNode_Status(pulstatus: *mut u32, pulproblemnumber: *mut u32, dndevinst: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_DevNode_Status(pulstatus: *mut u32, pulproblemnumber: *mut u32, dndevinst: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_DevNode_Status(::core::mem::transmute(pulstatus), ::core::mem::transmute(pulproblemnumber), ::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_DevNode_Status_Ex(pulstatus: *mut u32, pulproblemnumber: *mut u32, dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_DevNode_Status_Ex(pulstatus: *mut u32, pulproblemnumber: *mut u32, dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_DevNode_Status_Ex(::core::mem::transmute(pulstatus), ::core::mem::transmute(pulproblemnumber), ::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_IDA(dndevinst: u32, buffer: super::super::Foundation::PSTR, bufferlen: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_IDA(dndevinst: u32, buffer: super::super::Foundation::PSTR, bufferlen: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_IDA(::core::mem::transmute(dndevinst), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlen), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_IDW(dndevinst: u32, buffer: super::super::Foundation::PWSTR, bufferlen: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_IDW(dndevinst: u32, buffer: super::super::Foundation::PWSTR, bufferlen: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_IDW(::core::mem::transmute(dndevinst), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlen), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_ID_ExA(dndevinst: u32, buffer: super::super::Foundation::PSTR, bufferlen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_ID_ExA(dndevinst: u32, buffer: super::super::Foundation::PSTR, bufferlen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_ID_ExA(::core::mem::transmute(dndevinst), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlen), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_ID_ExW(dndevinst: u32, buffer: super::super::Foundation::PWSTR, bufferlen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_ID_ExW(dndevinst: u32, buffer: super::super::Foundation::PWSTR, bufferlen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_ID_ExW(::core::mem::transmute(dndevinst), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlen), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_ID_ListA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pszfilter: Param0, buffer: super::super::Foundation::PSTR, bufferlen: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_ID_ListA(pszfilter: super::super::Foundation::PSTR, buffer: super::super::Foundation::PSTR, bufferlen: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_ID_ListA(pszfilter.into_param().abi(), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlen), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_ID_ListW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszfilter: Param0, buffer: super::super::Foundation::PWSTR, bufferlen: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_ID_ListW(pszfilter: super::super::Foundation::PWSTR, buffer: super::super::Foundation::PWSTR, bufferlen: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_ID_ListW(pszfilter.into_param().abi(), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlen), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_ID_List_ExA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pszfilter: Param0, buffer: super::super::Foundation::PSTR, bufferlen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_ID_List_ExA(pszfilter: super::super::Foundation::PSTR, buffer: super::super::Foundation::PSTR, bufferlen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_ID_List_ExA(pszfilter.into_param().abi(), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlen), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_ID_List_ExW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszfilter: Param0, buffer: super::super::Foundation::PWSTR, bufferlen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_ID_List_ExW(pszfilter: super::super::Foundation::PWSTR, buffer: super::super::Foundation::PWSTR, bufferlen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_ID_List_ExW(pszfilter.into_param().abi(), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlen), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_ID_List_SizeA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pullen: *mut u32, pszfilter: Param1, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_ID_List_SizeA(pullen: *mut u32, pszfilter: super::super::Foundation::PSTR, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_ID_List_SizeA(::core::mem::transmute(pullen), pszfilter.into_param().abi(), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_ID_List_SizeW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pullen: *mut u32, pszfilter: Param1, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_ID_List_SizeW(pullen: *mut u32, pszfilter: super::super::Foundation::PWSTR, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_ID_List_SizeW(::core::mem::transmute(pullen), pszfilter.into_param().abi(), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_ID_List_Size_ExA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pullen: *mut u32, pszfilter: Param1, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_ID_List_Size_ExA(pullen: *mut u32, pszfilter: super::super::Foundation::PSTR, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_ID_List_Size_ExA(::core::mem::transmute(pullen), pszfilter.into_param().abi(), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_ID_List_Size_ExW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pullen: *mut u32, pszfilter: Param1, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_ID_List_Size_ExW(pullen: *mut u32, pszfilter: super::super::Foundation::PWSTR, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_ID_List_Size_ExW(::core::mem::transmute(pullen), pszfilter.into_param().abi(), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Device_ID_Size(pullen: *mut u32, dndevinst: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_ID_Size(pullen: *mut u32, dndevinst: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_ID_Size(::core::mem::transmute(pullen), ::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Device_ID_Size_Ex(pullen: *mut u32, dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_ID_Size_Ex(pullen: *mut u32, dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_ID_Size_Ex(::core::mem::transmute(pullen), ::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_Interface_AliasA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pszdeviceinterface: Param0, aliasinterfaceguid: *const ::windows::core::GUID, pszaliasdeviceinterface: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_Interface_AliasA(pszdeviceinterface: super::super::Foundation::PSTR, aliasinterfaceguid: *const ::windows::core::GUID, pszaliasdeviceinterface: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_Interface_AliasA(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(aliasinterfaceguid), ::core::mem::transmute(pszaliasdeviceinterface), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_Interface_AliasW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszdeviceinterface: Param0, aliasinterfaceguid: *const ::windows::core::GUID, pszaliasdeviceinterface: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_Interface_AliasW(pszdeviceinterface: super::super::Foundation::PWSTR, aliasinterfaceguid: *const ::windows::core::GUID, pszaliasdeviceinterface: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_Interface_AliasW(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(aliasinterfaceguid), ::core::mem::transmute(pszaliasdeviceinterface), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_Interface_Alias_ExA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pszdeviceinterface: Param0, aliasinterfaceguid: *const ::windows::core::GUID, pszaliasdeviceinterface: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_Interface_Alias_ExA(pszdeviceinterface: super::super::Foundation::PSTR, aliasinterfaceguid: *const ::windows::core::GUID, pszaliasdeviceinterface: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_Interface_Alias_ExA(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(aliasinterfaceguid), ::core::mem::transmute(pszaliasdeviceinterface), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_Interface_Alias_ExW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszdeviceinterface: Param0, aliasinterfaceguid: *const ::windows::core::GUID, pszaliasdeviceinterface: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_Interface_Alias_ExW(pszdeviceinterface: super::super::Foundation::PWSTR, aliasinterfaceguid: *const ::windows::core::GUID, pszaliasdeviceinterface: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_Interface_Alias_ExW(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(aliasinterfaceguid), ::core::mem::transmute(pszaliasdeviceinterface), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_Interface_ListA(interfaceclassguid: *const ::windows::core::GUID, pdeviceid: *const i8, buffer: super::super::Foundation::PSTR, bufferlen: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_Interface_ListA(interfaceclassguid: *const ::windows::core::GUID, pdeviceid: *const i8, buffer: super::super::Foundation::PSTR, bufferlen: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_Interface_ListA(::core::mem::transmute(interfaceclassguid), ::core::mem::transmute(pdeviceid), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlen), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_Interface_ListW(interfaceclassguid: *const ::windows::core::GUID, pdeviceid: *const u16, buffer: super::super::Foundation::PWSTR, bufferlen: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_Interface_ListW(interfaceclassguid: *const ::windows::core::GUID, pdeviceid: *const u16, buffer: super::super::Foundation::PWSTR, bufferlen: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_Interface_ListW(::core::mem::transmute(interfaceclassguid), ::core::mem::transmute(pdeviceid), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlen), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_Interface_List_ExA(interfaceclassguid: *const ::windows::core::GUID, pdeviceid: *const i8, buffer: super::super::Foundation::PSTR, bufferlen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_Interface_List_ExA(interfaceclassguid: *const ::windows::core::GUID, pdeviceid: *const i8, buffer: super::super::Foundation::PSTR, bufferlen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_Interface_List_ExA(::core::mem::transmute(interfaceclassguid), ::core::mem::transmute(pdeviceid), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlen), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Device_Interface_List_ExW(interfaceclassguid: *const ::windows::core::GUID, pdeviceid: *const u16, buffer: super::super::Foundation::PWSTR, bufferlen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_Interface_List_ExW(interfaceclassguid: *const ::windows::core::GUID, pdeviceid: *const u16, buffer: super::super::Foundation::PWSTR, bufferlen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_Interface_List_ExW(::core::mem::transmute(interfaceclassguid), ::core::mem::transmute(pdeviceid), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlen), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Device_Interface_List_SizeA(pullen: *mut u32, interfaceclassguid: *const ::windows::core::GUID, pdeviceid: *const i8, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_Interface_List_SizeA(pullen: *mut u32, interfaceclassguid: *const ::windows::core::GUID, pdeviceid: *const i8, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_Interface_List_SizeA(::core::mem::transmute(pullen), ::core::mem::transmute(interfaceclassguid), ::core::mem::transmute(pdeviceid), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Device_Interface_List_SizeW(pullen: *mut u32, interfaceclassguid: *const ::windows::core::GUID, pdeviceid: *const u16, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_Interface_List_SizeW(pullen: *mut u32, interfaceclassguid: *const ::windows::core::GUID, pdeviceid: *const u16, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_Interface_List_SizeW(::core::mem::transmute(pullen), ::core::mem::transmute(interfaceclassguid), ::core::mem::transmute(pdeviceid), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Device_Interface_List_Size_ExA(pullen: *mut u32, interfaceclassguid: *const ::windows::core::GUID, pdeviceid: *const i8, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_Interface_List_Size_ExA(pullen: *mut u32, interfaceclassguid: *const ::windows::core::GUID, pdeviceid: *const i8, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_Interface_List_Size_ExA(::core::mem::transmute(pullen), ::core::mem::transmute(interfaceclassguid), ::core::mem::transmute(pdeviceid), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Device_Interface_List_Size_ExW(pullen: *mut u32, interfaceclassguid: *const ::windows::core::GUID, pdeviceid: *const u16, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_Interface_List_Size_ExW(pullen: *mut u32, interfaceclassguid: *const ::windows::core::GUID, pdeviceid: *const u16, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_Interface_List_Size_ExW(::core::mem::transmute(pullen), ::core::mem::transmute(interfaceclassguid), ::core::mem::transmute(pdeviceid), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn CM_Get_Device_Interface_PropertyW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszdeviceinterface: Param0, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_Interface_PropertyW(pszdeviceinterface: super::super::Foundation::PWSTR, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_Interface_PropertyW(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn CM_Get_Device_Interface_Property_ExW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszdeviceinterface: Param0, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_Interface_Property_ExW(pszdeviceinterface: super::super::Foundation::PWSTR, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_Interface_Property_ExW( pszdeviceinterface.into_param().abi(), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn CM_Get_Device_Interface_Property_KeysW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszdeviceinterface: Param0, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_Interface_Property_KeysW(pszdeviceinterface: super::super::Foundation::PWSTR, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_Interface_Property_KeysW(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(propertykeyarray), ::core::mem::transmute(propertykeycount), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn CM_Get_Device_Interface_Property_Keys_ExW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszdeviceinterface: Param0, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Device_Interface_Property_Keys_ExW(pszdeviceinterface: super::super::Foundation::PWSTR, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Device_Interface_Property_Keys_ExW(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(propertykeyarray), ::core::mem::transmute(propertykeycount), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_First_Log_Conf(plclogconf: *mut usize, dndevinst: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_First_Log_Conf(plclogconf: *mut usize, dndevinst: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_First_Log_Conf(::core::mem::transmute(plclogconf), ::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_First_Log_Conf_Ex(plclogconf: *mut usize, dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_First_Log_Conf_Ex(plclogconf: *mut usize, dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_First_Log_Conf_Ex(::core::mem::transmute(plclogconf), ::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Global_State(pulstate: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Global_State(pulstate: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Global_State(::core::mem::transmute(pulstate), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Global_State_Ex(pulstate: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Global_State_Ex(pulstate: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Global_State_Ex(::core::mem::transmute(pulstate), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_HW_Prof_FlagsA(pdeviceid: *const i8, ulhardwareprofile: u32, pulvalue: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_HW_Prof_FlagsA(pdeviceid: *const i8, ulhardwareprofile: u32, pulvalue: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_HW_Prof_FlagsA(::core::mem::transmute(pdeviceid), ::core::mem::transmute(ulhardwareprofile), ::core::mem::transmute(pulvalue), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_HW_Prof_FlagsW(pdeviceid: *const u16, ulhardwareprofile: u32, pulvalue: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_HW_Prof_FlagsW(pdeviceid: *const u16, ulhardwareprofile: u32, pulvalue: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_HW_Prof_FlagsW(::core::mem::transmute(pdeviceid), ::core::mem::transmute(ulhardwareprofile), ::core::mem::transmute(pulvalue), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_HW_Prof_Flags_ExA(pdeviceid: *const i8, ulhardwareprofile: u32, pulvalue: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_HW_Prof_Flags_ExA(pdeviceid: *const i8, ulhardwareprofile: u32, pulvalue: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_HW_Prof_Flags_ExA(::core::mem::transmute(pdeviceid), ::core::mem::transmute(ulhardwareprofile), ::core::mem::transmute(pulvalue), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_HW_Prof_Flags_ExW(pdeviceid: *const u16, ulhardwareprofile: u32, pulvalue: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_HW_Prof_Flags_ExW(pdeviceid: *const u16, ulhardwareprofile: u32, pulvalue: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_HW_Prof_Flags_ExW(::core::mem::transmute(pdeviceid), ::core::mem::transmute(ulhardwareprofile), ::core::mem::transmute(pulvalue), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Hardware_Profile_InfoA(ulindex: u32, phwprofileinfo: *mut HWProfileInfo_sA, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Hardware_Profile_InfoA(ulindex: u32, phwprofileinfo: *mut HWProfileInfo_sA, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Hardware_Profile_InfoA(::core::mem::transmute(ulindex), ::core::mem::transmute(phwprofileinfo), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Hardware_Profile_InfoW(ulindex: u32, phwprofileinfo: *mut HWProfileInfo_sW, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Hardware_Profile_InfoW(ulindex: u32, phwprofileinfo: *mut HWProfileInfo_sW, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Hardware_Profile_InfoW(::core::mem::transmute(ulindex), ::core::mem::transmute(phwprofileinfo), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Hardware_Profile_Info_ExA(ulindex: u32, phwprofileinfo: *mut HWProfileInfo_sA, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Hardware_Profile_Info_ExA(ulindex: u32, phwprofileinfo: *mut HWProfileInfo_sA, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Hardware_Profile_Info_ExA(::core::mem::transmute(ulindex), ::core::mem::transmute(phwprofileinfo), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Hardware_Profile_Info_ExW(ulindex: u32, phwprofileinfo: *mut HWProfileInfo_sW, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Hardware_Profile_Info_ExW(ulindex: u32, phwprofileinfo: *mut HWProfileInfo_sW, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Hardware_Profile_Info_ExW(::core::mem::transmute(ulindex), ::core::mem::transmute(phwprofileinfo), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Log_Conf_Priority(lclogconf: usize, ppriority: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Log_Conf_Priority(lclogconf: usize, ppriority: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Log_Conf_Priority(::core::mem::transmute(lclogconf), ::core::mem::transmute(ppriority), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Log_Conf_Priority_Ex(lclogconf: usize, ppriority: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Log_Conf_Priority_Ex(lclogconf: usize, ppriority: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Log_Conf_Priority_Ex(::core::mem::transmute(lclogconf), ::core::mem::transmute(ppriority), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Next_Log_Conf(plclogconf: *mut usize, lclogconf: usize, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Next_Log_Conf(plclogconf: *mut usize, lclogconf: usize, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Next_Log_Conf(::core::mem::transmute(plclogconf), ::core::mem::transmute(lclogconf), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Next_Log_Conf_Ex(plclogconf: *mut usize, lclogconf: usize, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Next_Log_Conf_Ex(plclogconf: *mut usize, lclogconf: usize, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Next_Log_Conf_Ex(::core::mem::transmute(plclogconf), ::core::mem::transmute(lclogconf), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Next_Res_Des(prdresdes: *mut usize, rdresdes: usize, forresource: u32, presourceid: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Next_Res_Des(prdresdes: *mut usize, rdresdes: usize, forresource: u32, presourceid: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Next_Res_Des(::core::mem::transmute(prdresdes), ::core::mem::transmute(rdresdes), ::core::mem::transmute(forresource), ::core::mem::transmute(presourceid), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Next_Res_Des_Ex(prdresdes: *mut usize, rdresdes: usize, forresource: u32, presourceid: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Next_Res_Des_Ex(prdresdes: *mut usize, rdresdes: usize, forresource: u32, presourceid: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Next_Res_Des_Ex(::core::mem::transmute(prdresdes), ::core::mem::transmute(rdresdes), ::core::mem::transmute(forresource), ::core::mem::transmute(presourceid), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Parent(pdndevinst: *mut u32, dndevinst: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Parent(pdndevinst: *mut u32, dndevinst: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Parent(::core::mem::transmute(pdndevinst), ::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Parent_Ex(pdndevinst: *mut u32, dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Parent_Ex(pdndevinst: *mut u32, dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Parent_Ex(::core::mem::transmute(pdndevinst), ::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Res_Des_Data(rdresdes: usize, buffer: *mut ::core::ffi::c_void, bufferlen: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Res_Des_Data(rdresdes: usize, buffer: *mut ::core::ffi::c_void, bufferlen: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Res_Des_Data(::core::mem::transmute(rdresdes), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlen), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Res_Des_Data_Ex(rdresdes: usize, buffer: *mut ::core::ffi::c_void, bufferlen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Res_Des_Data_Ex(rdresdes: usize, buffer: *mut ::core::ffi::c_void, bufferlen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Res_Des_Data_Ex(::core::mem::transmute(rdresdes), ::core::mem::transmute(buffer), ::core::mem::transmute(bufferlen), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Res_Des_Data_Size(pulsize: *mut u32, rdresdes: usize, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Res_Des_Data_Size(pulsize: *mut u32, rdresdes: usize, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Res_Des_Data_Size(::core::mem::transmute(pulsize), ::core::mem::transmute(rdresdes), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Res_Des_Data_Size_Ex(pulsize: *mut u32, rdresdes: usize, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Res_Des_Data_Size_Ex(pulsize: *mut u32, rdresdes: usize, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Res_Des_Data_Size_Ex(::core::mem::transmute(pulsize), ::core::mem::transmute(rdresdes), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Resource_Conflict_Count(clconflictlist: usize, pulcount: *mut u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Resource_Conflict_Count(clconflictlist: usize, pulcount: *mut u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Resource_Conflict_Count(::core::mem::transmute(clconflictlist), ::core::mem::transmute(pulcount))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Get_Resource_Conflict_DetailsA(clconflictlist: usize, ulindex: u32, pconflictdetails: *mut CONFLICT_DETAILS_A) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Resource_Conflict_DetailsA(clconflictlist: usize, ulindex: u32, pconflictdetails: *mut CONFLICT_DETAILS_A) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Resource_Conflict_DetailsA(::core::mem::transmute(clconflictlist), ::core::mem::transmute(ulindex), ::core::mem::transmute(pconflictdetails))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Resource_Conflict_DetailsW(clconflictlist: usize, ulindex: u32, pconflictdetails: *mut CONFLICT_DETAILS_W) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Resource_Conflict_DetailsW(clconflictlist: usize, ulindex: u32, pconflictdetails: *mut CONFLICT_DETAILS_W) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Resource_Conflict_DetailsW(::core::mem::transmute(clconflictlist), ::core::mem::transmute(ulindex), ::core::mem::transmute(pconflictdetails))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Sibling(pdndevinst: *mut u32, dndevinst: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Sibling(pdndevinst: *mut u32, dndevinst: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Sibling(::core::mem::transmute(pdndevinst), ::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Sibling_Ex(pdndevinst: *mut u32, dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Sibling_Ex(pdndevinst: *mut u32, dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Get_Sibling_Ex(::core::mem::transmute(pdndevinst), ::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Version() -> u16 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Version() -> u16; } ::core::mem::transmute(CM_Get_Version()) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Get_Version_Ex(hmachine: isize) -> u16 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Get_Version_Ex(hmachine: isize) -> u16; } ::core::mem::transmute(CM_Get_Version_Ex(::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const CM_HWPI_DOCKED: u32 = 2u32; pub const CM_HWPI_NOT_DOCKABLE: u32 = 0u32; pub const CM_HWPI_UNDOCKED: u32 = 1u32; pub const CM_INSTALL_STATE_FAILED_INSTALL: u32 = 2u32; pub const CM_INSTALL_STATE_FINISH_INSTALL: u32 = 3u32; pub const CM_INSTALL_STATE_INSTALLED: u32 = 0u32; pub const CM_INSTALL_STATE_NEEDS_REINSTALL: u32 = 1u32; #[inline] pub unsafe fn CM_Intersect_Range_List(rlhold1: usize, rlhold2: usize, rlhnew: usize, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Intersect_Range_List(rlhold1: usize, rlhold2: usize, rlhnew: usize, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Intersect_Range_List(::core::mem::transmute(rlhold1), ::core::mem::transmute(rlhold2), ::core::mem::transmute(rlhnew), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Invert_Range_List(rlhold: usize, rlhnew: usize, ullmaxvalue: u64, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Invert_Range_List(rlhold: usize, rlhnew: usize, ullmaxvalue: u64, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Invert_Range_List(::core::mem::transmute(rlhold), ::core::mem::transmute(rlhnew), ::core::mem::transmute(ullmaxvalue), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Is_Dock_Station_Present(pbpresent: *mut super::super::Foundation::BOOL) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Is_Dock_Station_Present(pbpresent: *mut super::super::Foundation::BOOL) -> CONFIGRET; } ::core::mem::transmute(CM_Is_Dock_Station_Present(::core::mem::transmute(pbpresent))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Is_Dock_Station_Present_Ex(pbpresent: *mut super::super::Foundation::BOOL, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Is_Dock_Station_Present_Ex(pbpresent: *mut super::super::Foundation::BOOL, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Is_Dock_Station_Present_Ex(::core::mem::transmute(pbpresent), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Is_Version_Available(wversion: u16) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Is_Version_Available(wversion: u16) -> super::super::Foundation::BOOL; } ::core::mem::transmute(CM_Is_Version_Available(::core::mem::transmute(wversion))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Is_Version_Available_Ex(wversion: u16, hmachine: isize) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Is_Version_Available_Ex(wversion: u16, hmachine: isize) -> super::super::Foundation::BOOL; } ::core::mem::transmute(CM_Is_Version_Available_Ex(::core::mem::transmute(wversion), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const CM_LOCATE_DEVINST_BITS: u32 = 7u32; pub const CM_LOCATE_DEVINST_CANCELREMOVE: u32 = 2u32; pub const CM_LOCATE_DEVINST_NORMAL: u32 = 0u32; pub const CM_LOCATE_DEVINST_NOVALIDATION: u32 = 4u32; pub const CM_LOCATE_DEVINST_PHANTOM: u32 = 1u32; pub const CM_LOCATE_DEVNODE_BITS: u32 = 7u32; pub const CM_LOCATE_DEVNODE_CANCELREMOVE: u32 = 2u32; pub const CM_LOCATE_DEVNODE_NORMAL: u32 = 0u32; pub const CM_LOCATE_DEVNODE_NOVALIDATION: u32 = 4u32; pub const CM_LOCATE_DEVNODE_PHANTOM: u32 = 1u32; #[inline] pub unsafe fn CM_Locate_DevNodeA(pdndevinst: *mut u32, pdeviceid: *const i8, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Locate_DevNodeA(pdndevinst: *mut u32, pdeviceid: *const i8, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Locate_DevNodeA(::core::mem::transmute(pdndevinst), ::core::mem::transmute(pdeviceid), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Locate_DevNodeW(pdndevinst: *mut u32, pdeviceid: *const u16, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Locate_DevNodeW(pdndevinst: *mut u32, pdeviceid: *const u16, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Locate_DevNodeW(::core::mem::transmute(pdndevinst), ::core::mem::transmute(pdeviceid), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Locate_DevNode_ExA(pdndevinst: *mut u32, pdeviceid: *const i8, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Locate_DevNode_ExA(pdndevinst: *mut u32, pdeviceid: *const i8, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Locate_DevNode_ExA(::core::mem::transmute(pdndevinst), ::core::mem::transmute(pdeviceid), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Locate_DevNode_ExW(pdndevinst: *mut u32, pdeviceid: *const u16, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Locate_DevNode_ExW(pdndevinst: *mut u32, pdeviceid: *const u16, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Locate_DevNode_ExW(::core::mem::transmute(pdndevinst), ::core::mem::transmute(pdeviceid), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_MapCrToWin32Err(cmreturncode: CONFIGRET, defaulterr: u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_MapCrToWin32Err(cmreturncode: CONFIGRET, defaulterr: u32) -> u32; } ::core::mem::transmute(CM_MapCrToWin32Err(::core::mem::transmute(cmreturncode), ::core::mem::transmute(defaulterr))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Merge_Range_List(rlhold1: usize, rlhold2: usize, rlhnew: usize, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Merge_Range_List(rlhold1: usize, rlhold2: usize, rlhnew: usize, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Merge_Range_List(::core::mem::transmute(rlhold1), ::core::mem::transmute(rlhold2), ::core::mem::transmute(rlhnew), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Modify_Res_Des(prdresdes: *mut usize, rdresdes: usize, resourceid: u32, resourcedata: *const ::core::ffi::c_void, resourcelen: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Modify_Res_Des(prdresdes: *mut usize, rdresdes: usize, resourceid: u32, resourcedata: *const ::core::ffi::c_void, resourcelen: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Modify_Res_Des(::core::mem::transmute(prdresdes), ::core::mem::transmute(rdresdes), ::core::mem::transmute(resourceid), ::core::mem::transmute(resourcedata), ::core::mem::transmute(resourcelen), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Modify_Res_Des_Ex(prdresdes: *mut usize, rdresdes: usize, resourceid: u32, resourcedata: *const ::core::ffi::c_void, resourcelen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Modify_Res_Des_Ex(prdresdes: *mut usize, rdresdes: usize, resourceid: u32, resourcedata: *const ::core::ffi::c_void, resourcelen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Modify_Res_Des_Ex(::core::mem::transmute(prdresdes), ::core::mem::transmute(rdresdes), ::core::mem::transmute(resourceid), ::core::mem::transmute(resourcedata), ::core::mem::transmute(resourcelen), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Move_DevNode(dnfromdevinst: u32, dntodevinst: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Move_DevNode(dnfromdevinst: u32, dntodevinst: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Move_DevNode(::core::mem::transmute(dnfromdevinst), ::core::mem::transmute(dntodevinst), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Move_DevNode_Ex(dnfromdevinst: u32, dntodevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Move_DevNode_Ex(dnfromdevinst: u32, dntodevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Move_DevNode_Ex(::core::mem::transmute(dnfromdevinst), ::core::mem::transmute(dntodevinst), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const CM_NAME_ATTRIBUTE_NAME_RETRIEVED_FROM_DEVICE: u32 = 1u32; pub const CM_NAME_ATTRIBUTE_USER_ASSIGNED_NAME: u32 = 2u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct CM_NOTIFY_ACTION(pub i32); pub const CM_NOTIFY_ACTION_DEVICEINTERFACEARRIVAL: CM_NOTIFY_ACTION = CM_NOTIFY_ACTION(0i32); pub const CM_NOTIFY_ACTION_DEVICEINTERFACEREMOVAL: CM_NOTIFY_ACTION = CM_NOTIFY_ACTION(1i32); pub const CM_NOTIFY_ACTION_DEVICEQUERYREMOVE: CM_NOTIFY_ACTION = CM_NOTIFY_ACTION(2i32); pub const CM_NOTIFY_ACTION_DEVICEQUERYREMOVEFAILED: CM_NOTIFY_ACTION = CM_NOTIFY_ACTION(3i32); pub const CM_NOTIFY_ACTION_DEVICEREMOVEPENDING: CM_NOTIFY_ACTION = CM_NOTIFY_ACTION(4i32); pub const CM_NOTIFY_ACTION_DEVICEREMOVECOMPLETE: CM_NOTIFY_ACTION = CM_NOTIFY_ACTION(5i32); pub const CM_NOTIFY_ACTION_DEVICECUSTOMEVENT: CM_NOTIFY_ACTION = CM_NOTIFY_ACTION(6i32); pub const CM_NOTIFY_ACTION_DEVICEINSTANCEENUMERATED: CM_NOTIFY_ACTION = CM_NOTIFY_ACTION(7i32); pub const CM_NOTIFY_ACTION_DEVICEINSTANCESTARTED: CM_NOTIFY_ACTION = CM_NOTIFY_ACTION(8i32); pub const CM_NOTIFY_ACTION_DEVICEINSTANCEREMOVED: CM_NOTIFY_ACTION = CM_NOTIFY_ACTION(9i32); pub const CM_NOTIFY_ACTION_MAX: CM_NOTIFY_ACTION = CM_NOTIFY_ACTION(10i32); impl ::core::convert::From<i32> for CM_NOTIFY_ACTION { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for CM_NOTIFY_ACTION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct CM_NOTIFY_EVENT_DATA { pub FilterType: CM_NOTIFY_FILTER_TYPE, pub Reserved: u32, pub u: CM_NOTIFY_EVENT_DATA_0, } impl CM_NOTIFY_EVENT_DATA {} impl ::core::default::Default for CM_NOTIFY_EVENT_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for CM_NOTIFY_EVENT_DATA { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for CM_NOTIFY_EVENT_DATA {} unsafe impl ::windows::core::Abi for CM_NOTIFY_EVENT_DATA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub union CM_NOTIFY_EVENT_DATA_0 { pub DeviceInterface: CM_NOTIFY_EVENT_DATA_0_2, pub DeviceHandle: CM_NOTIFY_EVENT_DATA_0_0, pub DeviceInstance: CM_NOTIFY_EVENT_DATA_0_1, } impl CM_NOTIFY_EVENT_DATA_0 {} impl ::core::default::Default for CM_NOTIFY_EVENT_DATA_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for CM_NOTIFY_EVENT_DATA_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for CM_NOTIFY_EVENT_DATA_0 {} unsafe impl ::windows::core::Abi for CM_NOTIFY_EVENT_DATA_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct CM_NOTIFY_EVENT_DATA_0_0 { pub EventGuid: ::windows::core::GUID, pub NameOffset: i32, pub DataSize: u32, pub Data: [u8; 1], } impl CM_NOTIFY_EVENT_DATA_0_0 {} impl ::core::default::Default for CM_NOTIFY_EVENT_DATA_0_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for CM_NOTIFY_EVENT_DATA_0_0 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("_DeviceHandle_e__Struct").field("EventGuid", &self.EventGuid).field("NameOffset", &self.NameOffset).field("DataSize", &self.DataSize).field("Data", &self.Data).finish() } } impl ::core::cmp::PartialEq for CM_NOTIFY_EVENT_DATA_0_0 { fn eq(&self, other: &Self) -> bool { self.EventGuid == other.EventGuid && self.NameOffset == other.NameOffset && self.DataSize == other.DataSize && self.Data == other.Data } } impl ::core::cmp::Eq for CM_NOTIFY_EVENT_DATA_0_0 {} unsafe impl ::windows::core::Abi for CM_NOTIFY_EVENT_DATA_0_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct CM_NOTIFY_EVENT_DATA_0_1 { pub InstanceId: [u16; 1], } impl CM_NOTIFY_EVENT_DATA_0_1 {} impl ::core::default::Default for CM_NOTIFY_EVENT_DATA_0_1 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for CM_NOTIFY_EVENT_DATA_0_1 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("_DeviceInstance_e__Struct").field("InstanceId", &self.InstanceId).finish() } } impl ::core::cmp::PartialEq for CM_NOTIFY_EVENT_DATA_0_1 { fn eq(&self, other: &Self) -> bool { self.InstanceId == other.InstanceId } } impl ::core::cmp::Eq for CM_NOTIFY_EVENT_DATA_0_1 {} unsafe impl ::windows::core::Abi for CM_NOTIFY_EVENT_DATA_0_1 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct CM_NOTIFY_EVENT_DATA_0_2 { pub ClassGuid: ::windows::core::GUID, pub SymbolicLink: [u16; 1], } impl CM_NOTIFY_EVENT_DATA_0_2 {} impl ::core::default::Default for CM_NOTIFY_EVENT_DATA_0_2 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for CM_NOTIFY_EVENT_DATA_0_2 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("_DeviceInterface_e__Struct").field("ClassGuid", &self.ClassGuid).field("SymbolicLink", &self.SymbolicLink).finish() } } impl ::core::cmp::PartialEq for CM_NOTIFY_EVENT_DATA_0_2 { fn eq(&self, other: &Self) -> bool { self.ClassGuid == other.ClassGuid && self.SymbolicLink == other.SymbolicLink } } impl ::core::cmp::Eq for CM_NOTIFY_EVENT_DATA_0_2 {} unsafe impl ::windows::core::Abi for CM_NOTIFY_EVENT_DATA_0_2 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct CM_NOTIFY_FILTER { pub cbSize: u32, pub Flags: u32, pub FilterType: CM_NOTIFY_FILTER_TYPE, pub Reserved: u32, pub u: CM_NOTIFY_FILTER_0, } #[cfg(feature = "Win32_Foundation")] impl CM_NOTIFY_FILTER {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for CM_NOTIFY_FILTER { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for CM_NOTIFY_FILTER { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for CM_NOTIFY_FILTER {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for CM_NOTIFY_FILTER { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub union CM_NOTIFY_FILTER_0 { pub DeviceInterface: CM_NOTIFY_FILTER_0_2, pub DeviceHandle: CM_NOTIFY_FILTER_0_0, pub DeviceInstance: CM_NOTIFY_FILTER_0_1, } #[cfg(feature = "Win32_Foundation")] impl CM_NOTIFY_FILTER_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for CM_NOTIFY_FILTER_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for CM_NOTIFY_FILTER_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for CM_NOTIFY_FILTER_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for CM_NOTIFY_FILTER_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct CM_NOTIFY_FILTER_0_0 { pub hTarget: super::super::Foundation::HANDLE, } #[cfg(feature = "Win32_Foundation")] impl CM_NOTIFY_FILTER_0_0 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for CM_NOTIFY_FILTER_0_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for CM_NOTIFY_FILTER_0_0 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("_DeviceHandle_e__Struct").field("hTarget", &self.hTarget).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for CM_NOTIFY_FILTER_0_0 { fn eq(&self, other: &Self) -> bool { self.hTarget == other.hTarget } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for CM_NOTIFY_FILTER_0_0 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for CM_NOTIFY_FILTER_0_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct CM_NOTIFY_FILTER_0_1 { pub InstanceId: [u16; 200], } #[cfg(feature = "Win32_Foundation")] impl CM_NOTIFY_FILTER_0_1 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for CM_NOTIFY_FILTER_0_1 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for CM_NOTIFY_FILTER_0_1 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("_DeviceInstance_e__Struct").field("InstanceId", &self.InstanceId).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for CM_NOTIFY_FILTER_0_1 { fn eq(&self, other: &Self) -> bool { self.InstanceId == other.InstanceId } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for CM_NOTIFY_FILTER_0_1 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for CM_NOTIFY_FILTER_0_1 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct CM_NOTIFY_FILTER_0_2 { pub ClassGuid: ::windows::core::GUID, } #[cfg(feature = "Win32_Foundation")] impl CM_NOTIFY_FILTER_0_2 {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for CM_NOTIFY_FILTER_0_2 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for CM_NOTIFY_FILTER_0_2 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("_DeviceInterface_e__Struct").field("ClassGuid", &self.ClassGuid).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for CM_NOTIFY_FILTER_0_2 { fn eq(&self, other: &Self) -> bool { self.ClassGuid == other.ClassGuid } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for CM_NOTIFY_FILTER_0_2 {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for CM_NOTIFY_FILTER_0_2 { type Abi = Self; } pub const CM_NOTIFY_FILTER_FLAG_ALL_DEVICE_INSTANCES: u32 = 2u32; pub const CM_NOTIFY_FILTER_FLAG_ALL_INTERFACE_CLASSES: 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 CM_NOTIFY_FILTER_TYPE(pub i32); pub const CM_NOTIFY_FILTER_TYPE_DEVICEINTERFACE: CM_NOTIFY_FILTER_TYPE = CM_NOTIFY_FILTER_TYPE(0i32); pub const CM_NOTIFY_FILTER_TYPE_DEVICEHANDLE: CM_NOTIFY_FILTER_TYPE = CM_NOTIFY_FILTER_TYPE(1i32); pub const CM_NOTIFY_FILTER_TYPE_DEVICEINSTANCE: CM_NOTIFY_FILTER_TYPE = CM_NOTIFY_FILTER_TYPE(2i32); pub const CM_NOTIFY_FILTER_TYPE_MAX: CM_NOTIFY_FILTER_TYPE = CM_NOTIFY_FILTER_TYPE(3i32); impl ::core::convert::From<i32> for CM_NOTIFY_FILTER_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for CM_NOTIFY_FILTER_TYPE { type Abi = Self; } #[inline] pub unsafe fn CM_Next_Range(preelement: *mut usize, pullstart: *mut u64, pullend: *mut u64, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Next_Range(preelement: *mut usize, pullstart: *mut u64, pullend: *mut u64, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Next_Range(::core::mem::transmute(preelement), ::core::mem::transmute(pullstart), ::core::mem::transmute(pullend), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const CM_OPEN_CLASS_KEY_BITS: u32 = 1u32; pub const CM_OPEN_CLASS_KEY_INSTALLER: u32 = 0u32; pub const CM_OPEN_CLASS_KEY_INTERFACE: u32 = 1u32; #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Registry"))] #[inline] pub unsafe fn CM_Open_Class_KeyA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(classguid: *const ::windows::core::GUID, pszclassname: Param1, samdesired: u32, disposition: u32, phkclass: *mut super::super::System::Registry::HKEY, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Open_Class_KeyA(classguid: *const ::windows::core::GUID, pszclassname: super::super::Foundation::PSTR, samdesired: u32, disposition: u32, phkclass: *mut super::super::System::Registry::HKEY, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Open_Class_KeyA(::core::mem::transmute(classguid), pszclassname.into_param().abi(), ::core::mem::transmute(samdesired), ::core::mem::transmute(disposition), ::core::mem::transmute(phkclass), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Registry"))] #[inline] pub unsafe fn CM_Open_Class_KeyW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(classguid: *const ::windows::core::GUID, pszclassname: Param1, samdesired: u32, disposition: u32, phkclass: *mut super::super::System::Registry::HKEY, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Open_Class_KeyW(classguid: *const ::windows::core::GUID, pszclassname: super::super::Foundation::PWSTR, samdesired: u32, disposition: u32, phkclass: *mut super::super::System::Registry::HKEY, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Open_Class_KeyW(::core::mem::transmute(classguid), pszclassname.into_param().abi(), ::core::mem::transmute(samdesired), ::core::mem::transmute(disposition), ::core::mem::transmute(phkclass), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Registry"))] #[inline] pub unsafe fn CM_Open_Class_Key_ExA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(classguid: *const ::windows::core::GUID, pszclassname: Param1, samdesired: u32, disposition: u32, phkclass: *mut super::super::System::Registry::HKEY, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Open_Class_Key_ExA(classguid: *const ::windows::core::GUID, pszclassname: super::super::Foundation::PSTR, samdesired: u32, disposition: u32, phkclass: *mut super::super::System::Registry::HKEY, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Open_Class_Key_ExA(::core::mem::transmute(classguid), pszclassname.into_param().abi(), ::core::mem::transmute(samdesired), ::core::mem::transmute(disposition), ::core::mem::transmute(phkclass), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Registry"))] #[inline] pub unsafe fn CM_Open_Class_Key_ExW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(classguid: *const ::windows::core::GUID, pszclassname: Param1, samdesired: u32, disposition: u32, phkclass: *mut super::super::System::Registry::HKEY, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Open_Class_Key_ExW(classguid: *const ::windows::core::GUID, pszclassname: super::super::Foundation::PWSTR, samdesired: u32, disposition: u32, phkclass: *mut super::super::System::Registry::HKEY, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Open_Class_Key_ExW(::core::mem::transmute(classguid), pszclassname.into_param().abi(), ::core::mem::transmute(samdesired), ::core::mem::transmute(disposition), ::core::mem::transmute(phkclass), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_System_Registry")] #[inline] pub unsafe fn CM_Open_DevNode_Key(dndevnode: u32, samdesired: u32, ulhardwareprofile: u32, disposition: u32, phkdevice: *mut super::super::System::Registry::HKEY, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Open_DevNode_Key(dndevnode: u32, samdesired: u32, ulhardwareprofile: u32, disposition: u32, phkdevice: *mut super::super::System::Registry::HKEY, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Open_DevNode_Key(::core::mem::transmute(dndevnode), ::core::mem::transmute(samdesired), ::core::mem::transmute(ulhardwareprofile), ::core::mem::transmute(disposition), ::core::mem::transmute(phkdevice), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_System_Registry")] #[inline] pub unsafe fn CM_Open_DevNode_Key_Ex(dndevnode: u32, samdesired: u32, ulhardwareprofile: u32, disposition: u32, phkdevice: *mut super::super::System::Registry::HKEY, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Open_DevNode_Key_Ex(dndevnode: u32, samdesired: u32, ulhardwareprofile: u32, disposition: u32, phkdevice: *mut super::super::System::Registry::HKEY, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Open_DevNode_Key_Ex(::core::mem::transmute(dndevnode), ::core::mem::transmute(samdesired), ::core::mem::transmute(ulhardwareprofile), ::core::mem::transmute(disposition), ::core::mem::transmute(phkdevice), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Registry"))] #[inline] pub unsafe fn CM_Open_Device_Interface_KeyA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pszdeviceinterface: Param0, samdesired: u32, disposition: u32, phkdeviceinterface: *mut super::super::System::Registry::HKEY, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Open_Device_Interface_KeyA(pszdeviceinterface: super::super::Foundation::PSTR, samdesired: u32, disposition: u32, phkdeviceinterface: *mut super::super::System::Registry::HKEY, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Open_Device_Interface_KeyA(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(samdesired), ::core::mem::transmute(disposition), ::core::mem::transmute(phkdeviceinterface), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Registry"))] #[inline] pub unsafe fn CM_Open_Device_Interface_KeyW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszdeviceinterface: Param0, samdesired: u32, disposition: u32, phkdeviceinterface: *mut super::super::System::Registry::HKEY, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Open_Device_Interface_KeyW(pszdeviceinterface: super::super::Foundation::PWSTR, samdesired: u32, disposition: u32, phkdeviceinterface: *mut super::super::System::Registry::HKEY, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Open_Device_Interface_KeyW(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(samdesired), ::core::mem::transmute(disposition), ::core::mem::transmute(phkdeviceinterface), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Registry"))] #[inline] pub unsafe fn CM_Open_Device_Interface_Key_ExA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pszdeviceinterface: Param0, samdesired: u32, disposition: u32, phkdeviceinterface: *mut super::super::System::Registry::HKEY, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Open_Device_Interface_Key_ExA(pszdeviceinterface: super::super::Foundation::PSTR, samdesired: u32, disposition: u32, phkdeviceinterface: *mut super::super::System::Registry::HKEY, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Open_Device_Interface_Key_ExA(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(samdesired), ::core::mem::transmute(disposition), ::core::mem::transmute(phkdeviceinterface), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Registry"))] #[inline] pub unsafe fn CM_Open_Device_Interface_Key_ExW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszdeviceinterface: Param0, samdesired: u32, disposition: u32, phkdeviceinterface: *mut super::super::System::Registry::HKEY, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Open_Device_Interface_Key_ExW(pszdeviceinterface: super::super::Foundation::PWSTR, samdesired: u32, disposition: u32, phkdeviceinterface: *mut super::super::System::Registry::HKEY, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Open_Device_Interface_Key_ExW(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(samdesired), ::core::mem::transmute(disposition), ::core::mem::transmute(phkdeviceinterface), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const CM_PROB_BIOS_TABLE: u32 = 35u32; pub const CM_PROB_BOOT_CONFIG_CONFLICT: u32 = 6u32; pub const CM_PROB_CANT_SHARE_IRQ: u32 = 30u32; pub const CM_PROB_CONSOLE_LOCKED: u32 = 55u32; pub const CM_PROB_DEVICE_NOT_THERE: u32 = 24u32; pub const CM_PROB_DEVICE_RESET: u32 = 54u32; pub const CM_PROB_DEVLOADER_FAILED: u32 = 2u32; pub const CM_PROB_DEVLOADER_NOT_FOUND: u32 = 8u32; pub const CM_PROB_DEVLOADER_NOT_READY: u32 = 23u32; pub const CM_PROB_DISABLED: u32 = 22u32; pub const CM_PROB_DISABLED_SERVICE: u32 = 32u32; pub const CM_PROB_DRIVER_BLOCKED: u32 = 48u32; pub const CM_PROB_DRIVER_FAILED_LOAD: u32 = 39u32; pub const CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD: u32 = 38u32; pub const CM_PROB_DRIVER_SERVICE_KEY_INVALID: u32 = 40u32; pub const CM_PROB_DUPLICATE_DEVICE: u32 = 42u32; pub const CM_PROB_ENTRY_IS_WRONG_TYPE: u32 = 4u32; pub const CM_PROB_FAILED_ADD: u32 = 31u32; pub const CM_PROB_FAILED_DRIVER_ENTRY: u32 = 37u32; pub const CM_PROB_FAILED_FILTER: u32 = 7u32; pub const CM_PROB_FAILED_INSTALL: u32 = 28u32; pub const CM_PROB_FAILED_POST_START: u32 = 43u32; pub const CM_PROB_FAILED_START: u32 = 10u32; pub const CM_PROB_GUEST_ASSIGNMENT_FAILED: u32 = 57u32; pub const CM_PROB_HALTED: u32 = 44u32; pub const CM_PROB_HARDWARE_DISABLED: u32 = 29u32; pub const CM_PROB_HELD_FOR_EJECT: u32 = 47u32; pub const CM_PROB_INVALID_DATA: u32 = 9u32; pub const CM_PROB_IRQ_TRANSLATION_FAILED: u32 = 36u32; pub const CM_PROB_LACKED_ARBITRATOR: u32 = 5u32; pub const CM_PROB_LEGACY_SERVICE_NO_DEVICES: u32 = 41u32; pub const CM_PROB_LIAR: u32 = 11u32; pub const CM_PROB_MOVED: u32 = 25u32; pub const CM_PROB_NEED_CLASS_CONFIG: u32 = 56u32; pub const CM_PROB_NEED_RESTART: u32 = 14u32; pub const CM_PROB_NORMAL_CONFLICT: u32 = 12u32; pub const CM_PROB_NOT_CONFIGURED: u32 = 1u32; pub const CM_PROB_NOT_VERIFIED: u32 = 13u32; pub const CM_PROB_NO_SOFTCONFIG: u32 = 34u32; pub const CM_PROB_NO_VALID_LOG_CONF: u32 = 27u32; pub const CM_PROB_OUT_OF_MEMORY: u32 = 3u32; pub const CM_PROB_PARTIAL_LOG_CONF: u32 = 16u32; pub const CM_PROB_PHANTOM: u32 = 45u32; pub const CM_PROB_REENUMERATION: u32 = 15u32; pub const CM_PROB_REGISTRY: u32 = 19u32; pub const CM_PROB_REGISTRY_TOO_LARGE: u32 = 49u32; pub const CM_PROB_REINSTALL: u32 = 18u32; pub const CM_PROB_SETPROPERTIES_FAILED: u32 = 50u32; pub const CM_PROB_SYSTEM_SHUTDOWN: u32 = 46u32; pub const CM_PROB_TOO_EARLY: u32 = 26u32; pub const CM_PROB_TRANSLATION_FAILED: u32 = 33u32; pub const CM_PROB_UNKNOWN_RESOURCE: u32 = 17u32; pub const CM_PROB_UNSIGNED_DRIVER: u32 = 52u32; pub const CM_PROB_USED_BY_DEBUGGER: u32 = 53u32; pub const CM_PROB_VXDLDR: u32 = 20u32; pub const CM_PROB_WAITING_ON_DEPENDENCY: u32 = 51u32; pub const CM_PROB_WILL_BE_REMOVED: u32 = 21u32; pub const CM_QUERY_ARBITRATOR_BITS: u32 = 1u32; pub const CM_QUERY_ARBITRATOR_RAW: u32 = 0u32; pub const CM_QUERY_ARBITRATOR_TRANSLATED: u32 = 1u32; pub const CM_QUERY_REMOVE_UI_NOT_OK: u32 = 1u32; pub const CM_QUERY_REMOVE_UI_OK: u32 = 0u32; #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Query_And_Remove_SubTreeA(dnancestor: u32, pvetotype: *mut PNP_VETO_TYPE, pszvetoname: super::super::Foundation::PSTR, ulnamelength: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Query_And_Remove_SubTreeA(dnancestor: u32, pvetotype: *mut PNP_VETO_TYPE, pszvetoname: super::super::Foundation::PSTR, ulnamelength: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Query_And_Remove_SubTreeA(::core::mem::transmute(dnancestor), ::core::mem::transmute(pvetotype), ::core::mem::transmute(pszvetoname), ::core::mem::transmute(ulnamelength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Query_And_Remove_SubTreeW(dnancestor: u32, pvetotype: *mut PNP_VETO_TYPE, pszvetoname: super::super::Foundation::PWSTR, ulnamelength: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Query_And_Remove_SubTreeW(dnancestor: u32, pvetotype: *mut PNP_VETO_TYPE, pszvetoname: super::super::Foundation::PWSTR, ulnamelength: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Query_And_Remove_SubTreeW(::core::mem::transmute(dnancestor), ::core::mem::transmute(pvetotype), ::core::mem::transmute(pszvetoname), ::core::mem::transmute(ulnamelength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Query_And_Remove_SubTree_ExA(dnancestor: u32, pvetotype: *mut PNP_VETO_TYPE, pszvetoname: super::super::Foundation::PSTR, ulnamelength: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Query_And_Remove_SubTree_ExA(dnancestor: u32, pvetotype: *mut PNP_VETO_TYPE, pszvetoname: super::super::Foundation::PSTR, ulnamelength: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Query_And_Remove_SubTree_ExA(::core::mem::transmute(dnancestor), ::core::mem::transmute(pvetotype), ::core::mem::transmute(pszvetoname), ::core::mem::transmute(ulnamelength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Query_And_Remove_SubTree_ExW(dnancestor: u32, pvetotype: *mut PNP_VETO_TYPE, pszvetoname: super::super::Foundation::PWSTR, ulnamelength: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Query_And_Remove_SubTree_ExW(dnancestor: u32, pvetotype: *mut PNP_VETO_TYPE, pszvetoname: super::super::Foundation::PWSTR, ulnamelength: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Query_And_Remove_SubTree_ExW(::core::mem::transmute(dnancestor), ::core::mem::transmute(pvetotype), ::core::mem::transmute(pszvetoname), ::core::mem::transmute(ulnamelength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Query_Arbitrator_Free_Data(pdata: *mut ::core::ffi::c_void, datalen: u32, dndevinst: u32, resourceid: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Query_Arbitrator_Free_Data(pdata: *mut ::core::ffi::c_void, datalen: u32, dndevinst: u32, resourceid: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Query_Arbitrator_Free_Data(::core::mem::transmute(pdata), ::core::mem::transmute(datalen), ::core::mem::transmute(dndevinst), ::core::mem::transmute(resourceid), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Query_Arbitrator_Free_Data_Ex(pdata: *mut ::core::ffi::c_void, datalen: u32, dndevinst: u32, resourceid: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Query_Arbitrator_Free_Data_Ex(pdata: *mut ::core::ffi::c_void, datalen: u32, dndevinst: u32, resourceid: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Query_Arbitrator_Free_Data_Ex(::core::mem::transmute(pdata), ::core::mem::transmute(datalen), ::core::mem::transmute(dndevinst), ::core::mem::transmute(resourceid), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Query_Arbitrator_Free_Size(pulsize: *mut u32, dndevinst: u32, resourceid: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Query_Arbitrator_Free_Size(pulsize: *mut u32, dndevinst: u32, resourceid: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Query_Arbitrator_Free_Size(::core::mem::transmute(pulsize), ::core::mem::transmute(dndevinst), ::core::mem::transmute(resourceid), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Query_Arbitrator_Free_Size_Ex(pulsize: *mut u32, dndevinst: u32, resourceid: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Query_Arbitrator_Free_Size_Ex(pulsize: *mut u32, dndevinst: u32, resourceid: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Query_Arbitrator_Free_Size_Ex(::core::mem::transmute(pulsize), ::core::mem::transmute(dndevinst), ::core::mem::transmute(resourceid), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Query_Remove_SubTree(dnancestor: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Query_Remove_SubTree(dnancestor: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Query_Remove_SubTree(::core::mem::transmute(dnancestor), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Query_Remove_SubTree_Ex(dnancestor: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Query_Remove_SubTree_Ex(dnancestor: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Query_Remove_SubTree_Ex(::core::mem::transmute(dnancestor), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Query_Resource_Conflict_List(pclconflictlist: *mut usize, dndevinst: u32, resourceid: u32, resourcedata: *const ::core::ffi::c_void, resourcelen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Query_Resource_Conflict_List(pclconflictlist: *mut usize, dndevinst: u32, resourceid: u32, resourcedata: *const ::core::ffi::c_void, resourcelen: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Query_Resource_Conflict_List(::core::mem::transmute(pclconflictlist), ::core::mem::transmute(dndevinst), ::core::mem::transmute(resourceid), ::core::mem::transmute(resourcedata), ::core::mem::transmute(resourcelen), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const CM_REENUMERATE_ASYNCHRONOUS: u32 = 4u32; pub const CM_REENUMERATE_BITS: u32 = 7u32; pub const CM_REENUMERATE_NORMAL: u32 = 0u32; pub const CM_REENUMERATE_RETRY_INSTALLATION: u32 = 2u32; pub const CM_REENUMERATE_SYNCHRONOUS: u32 = 1u32; pub const CM_REGISTER_DEVICE_DRIVER_BITS: u32 = 3u32; pub const CM_REGISTER_DEVICE_DRIVER_DISABLEABLE: u32 = 1u32; pub const CM_REGISTER_DEVICE_DRIVER_REMOVABLE: u32 = 2u32; pub const CM_REGISTER_DEVICE_DRIVER_STATIC: u32 = 0u32; pub const CM_REGISTRY_BITS: u32 = 769u32; pub const CM_REGISTRY_CONFIG: u32 = 512u32; pub const CM_REGISTRY_HARDWARE: u32 = 0u32; pub const CM_REGISTRY_SOFTWARE: u32 = 1u32; pub const CM_REGISTRY_USER: u32 = 256u32; pub const CM_REMOVAL_POLICY_EXPECT_NO_REMOVAL: u32 = 1u32; pub const CM_REMOVAL_POLICY_EXPECT_ORDERLY_REMOVAL: u32 = 2u32; pub const CM_REMOVAL_POLICY_EXPECT_SURPRISE_REMOVAL: u32 = 3u32; pub const CM_REMOVE_BITS: u32 = 7u32; pub const CM_REMOVE_DISABLE: u32 = 4u32; pub const CM_REMOVE_NO_RESTART: u32 = 2u32; pub const CM_REMOVE_UI_NOT_OK: u32 = 1u32; pub const CM_REMOVE_UI_OK: u32 = 0u32; pub const CM_RESDES_WIDTH_32: u32 = 1u32; pub const CM_RESDES_WIDTH_64: u32 = 2u32; pub const CM_RESDES_WIDTH_BITS: u32 = 3u32; pub const CM_RESDES_WIDTH_DEFAULT: u32 = 0u32; #[inline] pub unsafe fn CM_Reenumerate_DevNode(dndevinst: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Reenumerate_DevNode(dndevinst: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Reenumerate_DevNode(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Reenumerate_DevNode_Ex(dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Reenumerate_DevNode_Ex(dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Reenumerate_DevNode_Ex(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Register_Device_Driver(dndevinst: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Register_Device_Driver(dndevinst: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Register_Device_Driver(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Register_Device_Driver_Ex(dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Register_Device_Driver_Ex(dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Register_Device_Driver_Ex(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Register_Device_InterfaceA<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(dndevinst: u32, interfaceclassguid: *const ::windows::core::GUID, pszreference: Param2, pszdeviceinterface: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Register_Device_InterfaceA(dndevinst: u32, interfaceclassguid: *const ::windows::core::GUID, pszreference: super::super::Foundation::PSTR, pszdeviceinterface: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Register_Device_InterfaceA(::core::mem::transmute(dndevinst), ::core::mem::transmute(interfaceclassguid), pszreference.into_param().abi(), ::core::mem::transmute(pszdeviceinterface), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Register_Device_InterfaceW<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(dndevinst: u32, interfaceclassguid: *const ::windows::core::GUID, pszreference: Param2, pszdeviceinterface: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Register_Device_InterfaceW(dndevinst: u32, interfaceclassguid: *const ::windows::core::GUID, pszreference: super::super::Foundation::PWSTR, pszdeviceinterface: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Register_Device_InterfaceW(::core::mem::transmute(dndevinst), ::core::mem::transmute(interfaceclassguid), pszreference.into_param().abi(), ::core::mem::transmute(pszdeviceinterface), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Register_Device_Interface_ExA<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(dndevinst: u32, interfaceclassguid: *const ::windows::core::GUID, pszreference: Param2, pszdeviceinterface: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Register_Device_Interface_ExA(dndevinst: u32, interfaceclassguid: *const ::windows::core::GUID, pszreference: super::super::Foundation::PSTR, pszdeviceinterface: super::super::Foundation::PSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Register_Device_Interface_ExA(::core::mem::transmute(dndevinst), ::core::mem::transmute(interfaceclassguid), pszreference.into_param().abi(), ::core::mem::transmute(pszdeviceinterface), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Register_Device_Interface_ExW<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(dndevinst: u32, interfaceclassguid: *const ::windows::core::GUID, pszreference: Param2, pszdeviceinterface: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Register_Device_Interface_ExW(dndevinst: u32, interfaceclassguid: *const ::windows::core::GUID, pszreference: super::super::Foundation::PWSTR, pszdeviceinterface: super::super::Foundation::PWSTR, pullength: *mut u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Register_Device_Interface_ExW(::core::mem::transmute(dndevinst), ::core::mem::transmute(interfaceclassguid), pszreference.into_param().abi(), ::core::mem::transmute(pszdeviceinterface), ::core::mem::transmute(pullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Register_Notification(pfilter: *const CM_NOTIFY_FILTER, pcontext: *const ::core::ffi::c_void, pcallback: ::core::option::Option<PCM_NOTIFY_CALLBACK>, pnotifycontext: *mut isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Register_Notification(pfilter: *const CM_NOTIFY_FILTER, pcontext: *const ::core::ffi::c_void, pcallback: ::windows::core::RawPtr, pnotifycontext: *mut isize) -> CONFIGRET; } ::core::mem::transmute(CM_Register_Notification(::core::mem::transmute(pfilter), ::core::mem::transmute(pcontext), ::core::mem::transmute(pcallback), ::core::mem::transmute(pnotifycontext))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Remove_SubTree(dnancestor: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Remove_SubTree(dnancestor: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Remove_SubTree(::core::mem::transmute(dnancestor), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Remove_SubTree_Ex(dnancestor: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Remove_SubTree_Ex(dnancestor: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Remove_SubTree_Ex(::core::mem::transmute(dnancestor), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Request_Device_EjectA(dndevinst: u32, pvetotype: *mut PNP_VETO_TYPE, pszvetoname: super::super::Foundation::PSTR, ulnamelength: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Request_Device_EjectA(dndevinst: u32, pvetotype: *mut PNP_VETO_TYPE, pszvetoname: super::super::Foundation::PSTR, ulnamelength: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Request_Device_EjectA(::core::mem::transmute(dndevinst), ::core::mem::transmute(pvetotype), ::core::mem::transmute(pszvetoname), ::core::mem::transmute(ulnamelength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Request_Device_EjectW(dndevinst: u32, pvetotype: *mut PNP_VETO_TYPE, pszvetoname: super::super::Foundation::PWSTR, ulnamelength: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Request_Device_EjectW(dndevinst: u32, pvetotype: *mut PNP_VETO_TYPE, pszvetoname: super::super::Foundation::PWSTR, ulnamelength: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Request_Device_EjectW(::core::mem::transmute(dndevinst), ::core::mem::transmute(pvetotype), ::core::mem::transmute(pszvetoname), ::core::mem::transmute(ulnamelength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Request_Device_Eject_ExA(dndevinst: u32, pvetotype: *mut PNP_VETO_TYPE, pszvetoname: super::super::Foundation::PSTR, ulnamelength: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Request_Device_Eject_ExA(dndevinst: u32, pvetotype: *mut PNP_VETO_TYPE, pszvetoname: super::super::Foundation::PSTR, ulnamelength: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Request_Device_Eject_ExA(::core::mem::transmute(dndevinst), ::core::mem::transmute(pvetotype), ::core::mem::transmute(pszvetoname), ::core::mem::transmute(ulnamelength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Request_Device_Eject_ExW(dndevinst: u32, pvetotype: *mut PNP_VETO_TYPE, pszvetoname: super::super::Foundation::PWSTR, ulnamelength: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Request_Device_Eject_ExW(dndevinst: u32, pvetotype: *mut PNP_VETO_TYPE, pszvetoname: super::super::Foundation::PWSTR, ulnamelength: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Request_Device_Eject_ExW(::core::mem::transmute(dndevinst), ::core::mem::transmute(pvetotype), ::core::mem::transmute(pszvetoname), ::core::mem::transmute(ulnamelength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Request_Eject_PC() -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Request_Eject_PC() -> CONFIGRET; } ::core::mem::transmute(CM_Request_Eject_PC()) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Request_Eject_PC_Ex(hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Request_Eject_PC_Ex(hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Request_Eject_PC_Ex(::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Run_Detection(ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Run_Detection(ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Run_Detection(::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Run_Detection_Ex(ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Run_Detection_Ex(ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Run_Detection_Ex(::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const CM_SETUP_BITS: u32 = 15u32; pub const CM_SETUP_DEVINST_CONFIG: u32 = 5u32; pub const CM_SETUP_DEVINST_CONFIG_CLASS: u32 = 6u32; pub const CM_SETUP_DEVINST_CONFIG_EXTENSIONS: u32 = 7u32; pub const CM_SETUP_DEVINST_CONFIG_RESET: u32 = 8u32; pub const CM_SETUP_DEVINST_READY: u32 = 0u32; pub const CM_SETUP_DEVINST_RESET: u32 = 4u32; pub const CM_SETUP_DEVNODE_CONFIG: u32 = 5u32; pub const CM_SETUP_DEVNODE_CONFIG_CLASS: u32 = 6u32; pub const CM_SETUP_DEVNODE_CONFIG_EXTENSIONS: u32 = 7u32; pub const CM_SETUP_DEVNODE_CONFIG_RESET: u32 = 8u32; pub const CM_SETUP_DEVNODE_READY: u32 = 0u32; pub const CM_SETUP_DEVNODE_RESET: u32 = 4u32; pub const CM_SETUP_DOWNLOAD: u32 = 1u32; pub const CM_SETUP_PROP_CHANGE: u32 = 3u32; pub const CM_SETUP_WRITE_LOG_CONFS: u32 = 2u32; pub const CM_SET_DEVINST_PROBLEM_BITS: u32 = 1u32; pub const CM_SET_DEVINST_PROBLEM_NORMAL: u32 = 0u32; pub const CM_SET_DEVINST_PROBLEM_OVERRIDE: u32 = 1u32; pub const CM_SET_DEVNODE_PROBLEM_BITS: u32 = 1u32; pub const CM_SET_DEVNODE_PROBLEM_NORMAL: u32 = 0u32; pub const CM_SET_DEVNODE_PROBLEM_OVERRIDE: u32 = 1u32; pub const CM_SET_HW_PROF_FLAGS_BITS: u32 = 1u32; pub const CM_SET_HW_PROF_FLAGS_UI_NOT_OK: u32 = 1u32; #[cfg(feature = "Win32_Devices_Properties")] #[inline] pub unsafe fn CM_Set_Class_PropertyW(classguid: *const ::windows::core::GUID, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_Class_PropertyW(classguid: *const ::windows::core::GUID, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Set_Class_PropertyW(::core::mem::transmute(classguid), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Devices_Properties")] #[inline] pub unsafe fn CM_Set_Class_Property_ExW(classguid: *const ::windows::core::GUID, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_Class_Property_ExW(classguid: *const ::windows::core::GUID, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Set_Class_Property_ExW(::core::mem::transmute(classguid), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Set_Class_Registry_PropertyA(classguid: *const ::windows::core::GUID, ulproperty: u32, buffer: *const ::core::ffi::c_void, ullength: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_Class_Registry_PropertyA(classguid: *const ::windows::core::GUID, ulproperty: u32, buffer: *const ::core::ffi::c_void, ullength: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Set_Class_Registry_PropertyA(::core::mem::transmute(classguid), ::core::mem::transmute(ulproperty), ::core::mem::transmute(buffer), ::core::mem::transmute(ullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Set_Class_Registry_PropertyW(classguid: *const ::windows::core::GUID, ulproperty: u32, buffer: *const ::core::ffi::c_void, ullength: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_Class_Registry_PropertyW(classguid: *const ::windows::core::GUID, ulproperty: u32, buffer: *const ::core::ffi::c_void, ullength: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Set_Class_Registry_PropertyW(::core::mem::transmute(classguid), ::core::mem::transmute(ulproperty), ::core::mem::transmute(buffer), ::core::mem::transmute(ullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Set_DevNode_Problem(dndevinst: u32, ulproblem: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_DevNode_Problem(dndevinst: u32, ulproblem: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Set_DevNode_Problem(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulproblem), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Set_DevNode_Problem_Ex(dndevinst: u32, ulproblem: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_DevNode_Problem_Ex(dndevinst: u32, ulproblem: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Set_DevNode_Problem_Ex(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulproblem), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Devices_Properties")] #[inline] pub unsafe fn CM_Set_DevNode_PropertyW(dndevinst: u32, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_DevNode_PropertyW(dndevinst: u32, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Set_DevNode_PropertyW(::core::mem::transmute(dndevinst), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Devices_Properties")] #[inline] pub unsafe fn CM_Set_DevNode_Property_ExW(dndevinst: u32, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_DevNode_Property_ExW(dndevinst: u32, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Set_DevNode_Property_ExW(::core::mem::transmute(dndevinst), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Set_DevNode_Registry_PropertyA(dndevinst: u32, ulproperty: u32, buffer: *const ::core::ffi::c_void, ullength: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_DevNode_Registry_PropertyA(dndevinst: u32, ulproperty: u32, buffer: *const ::core::ffi::c_void, ullength: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Set_DevNode_Registry_PropertyA(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulproperty), ::core::mem::transmute(buffer), ::core::mem::transmute(ullength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Set_DevNode_Registry_PropertyW(dndevinst: u32, ulproperty: u32, buffer: *const ::core::ffi::c_void, ullength: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_DevNode_Registry_PropertyW(dndevinst: u32, ulproperty: u32, buffer: *const ::core::ffi::c_void, ullength: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Set_DevNode_Registry_PropertyW(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulproperty), ::core::mem::transmute(buffer), ::core::mem::transmute(ullength), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Set_DevNode_Registry_Property_ExA(dndevinst: u32, ulproperty: u32, buffer: *const ::core::ffi::c_void, ullength: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_DevNode_Registry_Property_ExA(dndevinst: u32, ulproperty: u32, buffer: *const ::core::ffi::c_void, ullength: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Set_DevNode_Registry_Property_ExA(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulproperty), ::core::mem::transmute(buffer), ::core::mem::transmute(ullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Set_DevNode_Registry_Property_ExW(dndevinst: u32, ulproperty: u32, buffer: *const ::core::ffi::c_void, ullength: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_DevNode_Registry_Property_ExW(dndevinst: u32, ulproperty: u32, buffer: *const ::core::ffi::c_void, ullength: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Set_DevNode_Registry_Property_ExW(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulproperty), ::core::mem::transmute(buffer), ::core::mem::transmute(ullength), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn CM_Set_Device_Interface_PropertyW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszdeviceinterface: Param0, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_Device_Interface_PropertyW(pszdeviceinterface: super::super::Foundation::PWSTR, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Set_Device_Interface_PropertyW(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn CM_Set_Device_Interface_Property_ExW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszdeviceinterface: Param0, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_Device_Interface_Property_ExW(pszdeviceinterface: super::super::Foundation::PWSTR, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Set_Device_Interface_Property_ExW( pszdeviceinterface.into_param().abi(), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Set_HW_Prof(ulhardwareprofile: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_HW_Prof(ulhardwareprofile: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Set_HW_Prof(::core::mem::transmute(ulhardwareprofile), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Set_HW_Prof_Ex(ulhardwareprofile: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_HW_Prof_Ex(ulhardwareprofile: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Set_HW_Prof_Ex(::core::mem::transmute(ulhardwareprofile), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Set_HW_Prof_FlagsA(pdeviceid: *const i8, ulconfig: u32, ulvalue: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_HW_Prof_FlagsA(pdeviceid: *const i8, ulconfig: u32, ulvalue: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Set_HW_Prof_FlagsA(::core::mem::transmute(pdeviceid), ::core::mem::transmute(ulconfig), ::core::mem::transmute(ulvalue), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Set_HW_Prof_FlagsW(pdeviceid: *const u16, ulconfig: u32, ulvalue: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_HW_Prof_FlagsW(pdeviceid: *const u16, ulconfig: u32, ulvalue: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Set_HW_Prof_FlagsW(::core::mem::transmute(pdeviceid), ::core::mem::transmute(ulconfig), ::core::mem::transmute(ulvalue), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Set_HW_Prof_Flags_ExA(pdeviceid: *const i8, ulconfig: u32, ulvalue: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_HW_Prof_Flags_ExA(pdeviceid: *const i8, ulconfig: u32, ulvalue: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Set_HW_Prof_Flags_ExA(::core::mem::transmute(pdeviceid), ::core::mem::transmute(ulconfig), ::core::mem::transmute(ulvalue), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Set_HW_Prof_Flags_ExW(pdeviceid: *const u16, ulconfig: u32, ulvalue: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Set_HW_Prof_Flags_ExW(pdeviceid: *const u16, ulconfig: u32, ulvalue: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Set_HW_Prof_Flags_ExW(::core::mem::transmute(pdeviceid), ::core::mem::transmute(ulconfig), ::core::mem::transmute(ulvalue), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Setup_DevNode(dndevinst: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Setup_DevNode(dndevinst: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Setup_DevNode(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Setup_DevNode_Ex(dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Setup_DevNode_Ex(dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Setup_DevNode_Ex(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Test_Range_Available(ullstartvalue: u64, ullendvalue: u64, rlh: usize, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Test_Range_Available(ullstartvalue: u64, ullendvalue: u64, rlh: usize, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Test_Range_Available(::core::mem::transmute(ullstartvalue), ::core::mem::transmute(ullendvalue), ::core::mem::transmute(rlh), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Uninstall_DevNode(dndevinst: u32, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Uninstall_DevNode(dndevinst: u32, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Uninstall_DevNode(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Uninstall_DevNode_Ex(dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Uninstall_DevNode_Ex(dndevinst: u32, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Uninstall_DevNode_Ex(::core::mem::transmute(dndevinst), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Unregister_Device_InterfaceA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pszdeviceinterface: Param0, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Unregister_Device_InterfaceA(pszdeviceinterface: super::super::Foundation::PSTR, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Unregister_Device_InterfaceA(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Unregister_Device_InterfaceW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszdeviceinterface: Param0, ulflags: u32) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Unregister_Device_InterfaceW(pszdeviceinterface: super::super::Foundation::PWSTR, ulflags: u32) -> CONFIGRET; } ::core::mem::transmute(CM_Unregister_Device_InterfaceW(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(ulflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Unregister_Device_Interface_ExA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(pszdeviceinterface: Param0, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Unregister_Device_Interface_ExA(pszdeviceinterface: super::super::Foundation::PSTR, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Unregister_Device_Interface_ExA(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn CM_Unregister_Device_Interface_ExW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(pszdeviceinterface: Param0, ulflags: u32, hmachine: isize) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Unregister_Device_Interface_ExW(pszdeviceinterface: super::super::Foundation::PWSTR, ulflags: u32, hmachine: isize) -> CONFIGRET; } ::core::mem::transmute(CM_Unregister_Device_Interface_ExW(pszdeviceinterface.into_param().abi(), ::core::mem::transmute(ulflags), ::core::mem::transmute(hmachine))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn CM_Unregister_Notification<'a, Param0: ::windows::core::IntoParam<'a, HCMNOTIFICATION>>(notifycontext: Param0) -> CONFIGRET { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn CM_Unregister_Notification(notifycontext: HCMNOTIFICATION) -> CONFIGRET; } ::core::mem::transmute(CM_Unregister_Notification(notifycontext.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] pub struct COINSTALLER_CONTEXT_DATA { pub PostProcessing: super::super::Foundation::BOOL, pub InstallResult: u32, pub PrivateData: *mut ::core::ffi::c_void, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl COINSTALLER_CONTEXT_DATA {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for COINSTALLER_CONTEXT_DATA { 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 COINSTALLER_CONTEXT_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("COINSTALLER_CONTEXT_DATA").field("PostProcessing", &self.PostProcessing).field("InstallResult", &self.InstallResult).field("PrivateData", &self.PrivateData).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for COINSTALLER_CONTEXT_DATA { fn eq(&self, other: &Self) -> bool { self.PostProcessing == other.PostProcessing && self.InstallResult == other.InstallResult && self.PrivateData == other.PrivateData } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for COINSTALLER_CONTEXT_DATA {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for COINSTALLER_CONTEXT_DATA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct COINSTALLER_CONTEXT_DATA { pub PostProcessing: super::super::Foundation::BOOL, pub InstallResult: u32, pub PrivateData: *mut ::core::ffi::c_void, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl COINSTALLER_CONTEXT_DATA {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for COINSTALLER_CONTEXT_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for COINSTALLER_CONTEXT_DATA { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for COINSTALLER_CONTEXT_DATA {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for COINSTALLER_CONTEXT_DATA { type Abi = Self; } pub const CONFIGMG_VERSION: u32 = 1024u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct CONFIGRET(pub u32); pub const CR_SUCCESS: CONFIGRET = CONFIGRET(0u32); pub const CR_DEFAULT: CONFIGRET = CONFIGRET(1u32); pub const CR_OUT_OF_MEMORY: CONFIGRET = CONFIGRET(2u32); pub const CR_INVALID_POINTER: CONFIGRET = CONFIGRET(3u32); pub const CR_INVALID_FLAG: CONFIGRET = CONFIGRET(4u32); pub const CR_INVALID_DEVNODE: CONFIGRET = CONFIGRET(5u32); pub const CR_INVALID_DEVINST: CONFIGRET = CONFIGRET(5u32); pub const CR_INVALID_RES_DES: CONFIGRET = CONFIGRET(6u32); pub const CR_INVALID_LOG_CONF: CONFIGRET = CONFIGRET(7u32); pub const CR_INVALID_ARBITRATOR: CONFIGRET = CONFIGRET(8u32); pub const CR_INVALID_NODELIST: CONFIGRET = CONFIGRET(9u32); pub const CR_DEVNODE_HAS_REQS: CONFIGRET = CONFIGRET(10u32); pub const CR_DEVINST_HAS_REQS: CONFIGRET = CONFIGRET(10u32); pub const CR_INVALID_RESOURCEID: CONFIGRET = CONFIGRET(11u32); pub const CR_DLVXD_NOT_FOUND: CONFIGRET = CONFIGRET(12u32); pub const CR_NO_SUCH_DEVNODE: CONFIGRET = CONFIGRET(13u32); pub const CR_NO_SUCH_DEVINST: CONFIGRET = CONFIGRET(13u32); pub const CR_NO_MORE_LOG_CONF: CONFIGRET = CONFIGRET(14u32); pub const CR_NO_MORE_RES_DES: CONFIGRET = CONFIGRET(15u32); pub const CR_ALREADY_SUCH_DEVNODE: CONFIGRET = CONFIGRET(16u32); pub const CR_ALREADY_SUCH_DEVINST: CONFIGRET = CONFIGRET(16u32); pub const CR_INVALID_RANGE_LIST: CONFIGRET = CONFIGRET(17u32); pub const CR_INVALID_RANGE: CONFIGRET = CONFIGRET(18u32); pub const CR_FAILURE: CONFIGRET = CONFIGRET(19u32); pub const CR_NO_SUCH_LOGICAL_DEV: CONFIGRET = CONFIGRET(20u32); pub const CR_CREATE_BLOCKED: CONFIGRET = CONFIGRET(21u32); pub const CR_NOT_SYSTEM_VM: CONFIGRET = CONFIGRET(22u32); pub const CR_REMOVE_VETOED: CONFIGRET = CONFIGRET(23u32); pub const CR_APM_VETOED: CONFIGRET = CONFIGRET(24u32); pub const CR_INVALID_LOAD_TYPE: CONFIGRET = CONFIGRET(25u32); pub const CR_BUFFER_SMALL: CONFIGRET = CONFIGRET(26u32); pub const CR_NO_ARBITRATOR: CONFIGRET = CONFIGRET(27u32); pub const CR_NO_REGISTRY_HANDLE: CONFIGRET = CONFIGRET(28u32); pub const CR_REGISTRY_ERROR: CONFIGRET = CONFIGRET(29u32); pub const CR_INVALID_DEVICE_ID: CONFIGRET = CONFIGRET(30u32); pub const CR_INVALID_DATA: CONFIGRET = CONFIGRET(31u32); pub const CR_INVALID_API: CONFIGRET = CONFIGRET(32u32); pub const CR_DEVLOADER_NOT_READY: CONFIGRET = CONFIGRET(33u32); pub const CR_NEED_RESTART: CONFIGRET = CONFIGRET(34u32); pub const CR_NO_MORE_HW_PROFILES: CONFIGRET = CONFIGRET(35u32); pub const CR_DEVICE_NOT_THERE: CONFIGRET = CONFIGRET(36u32); pub const CR_NO_SUCH_VALUE: CONFIGRET = CONFIGRET(37u32); pub const CR_WRONG_TYPE: CONFIGRET = CONFIGRET(38u32); pub const CR_INVALID_PRIORITY: CONFIGRET = CONFIGRET(39u32); pub const CR_NOT_DISABLEABLE: CONFIGRET = CONFIGRET(40u32); pub const CR_FREE_RESOURCES: CONFIGRET = CONFIGRET(41u32); pub const CR_QUERY_VETOED: CONFIGRET = CONFIGRET(42u32); pub const CR_CANT_SHARE_IRQ: CONFIGRET = CONFIGRET(43u32); pub const CR_NO_DEPENDENT: CONFIGRET = CONFIGRET(44u32); pub const CR_SAME_RESOURCES: CONFIGRET = CONFIGRET(45u32); pub const CR_NO_SUCH_REGISTRY_KEY: CONFIGRET = CONFIGRET(46u32); pub const CR_INVALID_MACHINENAME: CONFIGRET = CONFIGRET(47u32); pub const CR_REMOTE_COMM_FAILURE: CONFIGRET = CONFIGRET(48u32); pub const CR_MACHINE_UNAVAILABLE: CONFIGRET = CONFIGRET(49u32); pub const CR_NO_CM_SERVICES: CONFIGRET = CONFIGRET(50u32); pub const CR_ACCESS_DENIED: CONFIGRET = CONFIGRET(51u32); pub const CR_CALL_NOT_IMPLEMENTED: CONFIGRET = CONFIGRET(52u32); pub const CR_INVALID_PROPERTY: CONFIGRET = CONFIGRET(53u32); pub const CR_DEVICE_INTERFACE_ACTIVE: CONFIGRET = CONFIGRET(54u32); pub const CR_NO_SUCH_DEVICE_INTERFACE: CONFIGRET = CONFIGRET(55u32); pub const CR_INVALID_REFERENCE_STRING: CONFIGRET = CONFIGRET(56u32); pub const CR_INVALID_CONFLICT_LIST: CONFIGRET = CONFIGRET(57u32); pub const CR_INVALID_INDEX: CONFIGRET = CONFIGRET(58u32); pub const CR_INVALID_STRUCTURE_SIZE: CONFIGRET = CONFIGRET(59u32); pub const NUM_CR_RESULTS: CONFIGRET = CONFIGRET(60u32); impl ::core::convert::From<u32> for CONFIGRET { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for CONFIGRET { type Abi = Self; } impl ::core::ops::BitOr for CONFIGRET { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for CONFIGRET { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for CONFIGRET { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for CONFIGRET { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for CONFIGRET { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct CONFLICT_DETAILS_A { pub CD_ulSize: u32, pub CD_ulMask: u32, pub CD_dnDevInst: u32, pub CD_rdResDes: usize, pub CD_ulFlags: u32, pub CD_szDescription: [super::super::Foundation::CHAR; 260], } #[cfg(feature = "Win32_Foundation")] impl CONFLICT_DETAILS_A {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for CONFLICT_DETAILS_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for CONFLICT_DETAILS_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("CONFLICT_DETAILS_A").field("CD_ulSize", &self.CD_ulSize).field("CD_ulMask", &self.CD_ulMask).field("CD_dnDevInst", &self.CD_dnDevInst).field("CD_rdResDes", &self.CD_rdResDes).field("CD_ulFlags", &self.CD_ulFlags).field("CD_szDescription", &self.CD_szDescription).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for CONFLICT_DETAILS_A { fn eq(&self, other: &Self) -> bool { self.CD_ulSize == other.CD_ulSize && self.CD_ulMask == other.CD_ulMask && self.CD_dnDevInst == other.CD_dnDevInst && self.CD_rdResDes == other.CD_rdResDes && self.CD_ulFlags == other.CD_ulFlags && self.CD_szDescription == other.CD_szDescription } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for CONFLICT_DETAILS_A {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for CONFLICT_DETAILS_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct CONFLICT_DETAILS_W { pub CD_ulSize: u32, pub CD_ulMask: u32, pub CD_dnDevInst: u32, pub CD_rdResDes: usize, pub CD_ulFlags: u32, pub CD_szDescription: [u16; 260], } impl CONFLICT_DETAILS_W {} impl ::core::default::Default for CONFLICT_DETAILS_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for CONFLICT_DETAILS_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("CONFLICT_DETAILS_W").field("CD_ulSize", &self.CD_ulSize).field("CD_ulMask", &self.CD_ulMask).field("CD_dnDevInst", &self.CD_dnDevInst).field("CD_rdResDes", &self.CD_rdResDes).field("CD_ulFlags", &self.CD_ulFlags).field("CD_szDescription", &self.CD_szDescription).finish() } } impl ::core::cmp::PartialEq for CONFLICT_DETAILS_W { fn eq(&self, other: &Self) -> bool { self.CD_ulSize == other.CD_ulSize && self.CD_ulMask == other.CD_ulMask && self.CD_dnDevInst == other.CD_dnDevInst && self.CD_rdResDes == other.CD_rdResDes && self.CD_ulFlags == other.CD_ulFlags && self.CD_szDescription == other.CD_szDescription } } impl ::core::cmp::Eq for CONFLICT_DETAILS_W {} unsafe impl ::windows::core::Abi for CONFLICT_DETAILS_W { type Abi = Self; } pub const COPYFLG_FORCE_FILE_IN_USE: u32 = 8u32; pub const COPYFLG_IN_USE_TRY_RENAME: u32 = 16384u32; pub const COPYFLG_NODECOMP: u32 = 2048u32; pub const COPYFLG_NOPRUNE: u32 = 8192u32; pub const COPYFLG_NOSKIP: u32 = 2u32; pub const COPYFLG_NOVERSIONCHECK: u32 = 4u32; pub const COPYFLG_NO_OVERWRITE: u32 = 16u32; pub const COPYFLG_NO_VERSION_DIALOG: u32 = 32u32; pub const COPYFLG_OVERWRITE_OLDER_ONLY: u32 = 64u32; pub const COPYFLG_PROTECTED_WINDOWS_DRIVER_FILE: u32 = 256u32; pub const COPYFLG_REPLACEONLY: u32 = 1024u32; pub const COPYFLG_REPLACE_BOOT_FILE: u32 = 4096u32; pub const COPYFLG_WARN_IF_SKIP: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct CS_DES { pub CSD_SignatureLength: u32, pub CSD_LegacyDataOffset: u32, pub CSD_LegacyDataSize: u32, pub CSD_Flags: u32, pub CSD_ClassGuid: ::windows::core::GUID, pub CSD_Signature: [u8; 1], } impl CS_DES {} impl ::core::default::Default for CS_DES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for CS_DES { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for CS_DES {} unsafe impl ::windows::core::Abi for CS_DES { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct CS_RESOURCE { pub CS_Header: CS_DES, } impl CS_RESOURCE {} impl ::core::default::Default for CS_RESOURCE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for CS_RESOURCE { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for CS_RESOURCE {} unsafe impl ::windows::core::Abi for CS_RESOURCE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct Connection_Des_s { pub COND_Type: u32, pub COND_Flags: u32, pub COND_Class: u8, pub COND_ClassType: u8, pub COND_Reserved1: u8, pub COND_Reserved2: u8, pub COND_Id: i64, } impl Connection_Des_s {} impl ::core::default::Default for Connection_Des_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for Connection_Des_s { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for Connection_Des_s {} unsafe impl ::windows::core::Abi for Connection_Des_s { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct Connection_Resource_s { pub Connection_Header: Connection_Des_s, } impl Connection_Resource_s {} impl ::core::default::Default for Connection_Resource_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for Connection_Resource_s { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for Connection_Resource_s {} unsafe impl ::windows::core::Abi for Connection_Resource_s { type Abi = Self; } pub const DELFLG_IN_USE: u32 = 1u32; pub const DELFLG_IN_USE1: u32 = 65536u32; pub const DIBCI_NODISPLAYCLASS: u32 = 2u32; pub const DIBCI_NOINSTALLCLASS: u32 = 1u32; pub const DICD_GENERATE_ID: u32 = 1u32; pub const DICD_INHERIT_CLASSDRVS: u32 = 2u32; pub const DICLASSPROP_INSTALLER: u32 = 1u32; pub const DICLASSPROP_INTERFACE: u32 = 2u32; pub const DICS_DISABLE: u32 = 2u32; pub const DICS_ENABLE: u32 = 1u32; pub const DICS_FLAG_CONFIGGENERAL: u32 = 4u32; pub const DICS_FLAG_CONFIGSPECIFIC: u32 = 2u32; pub const DICS_FLAG_GLOBAL: u32 = 1u32; pub const DICS_PROPCHANGE: u32 = 3u32; pub const DICS_START: u32 = 4u32; pub const DICS_STOP: u32 = 5u32; pub const DICUSTOMDEVPROP_MERGE_MULTISZ: u32 = 1u32; pub const DIF_ADDPROPERTYPAGE_ADVANCED: u32 = 35u32; pub const DIF_ADDPROPERTYPAGE_BASIC: u32 = 36u32; pub const DIF_ADDREMOTEPROPERTYPAGE_ADVANCED: u32 = 40u32; pub const DIF_ALLOW_INSTALL: u32 = 24u32; pub const DIF_ASSIGNRESOURCES: u32 = 3u32; pub const DIF_CALCDISKSPACE: u32 = 11u32; pub const DIF_DESTROYPRIVATEDATA: u32 = 12u32; pub const DIF_DESTROYWIZARDDATA: u32 = 17u32; pub const DIF_DETECT: u32 = 15u32; pub const DIF_DETECTCANCEL: u32 = 33u32; pub const DIF_DETECTVERIFY: u32 = 20u32; pub const DIF_ENABLECLASS: u32 = 19u32; pub const DIF_FINISHINSTALL_ACTION: u32 = 42u32; pub const DIF_FIRSTTIMESETUP: u32 = 6u32; pub const DIF_FOUNDDEVICE: u32 = 7u32; pub const DIF_INSTALLCLASSDRIVERS: u32 = 10u32; pub const DIF_INSTALLDEVICE: u32 = 2u32; pub const DIF_INSTALLDEVICEFILES: u32 = 21u32; pub const DIF_INSTALLINTERFACES: u32 = 32u32; pub const DIF_INSTALLWIZARD: u32 = 16u32; pub const DIF_MOVEDEVICE: u32 = 14u32; pub const DIF_NEWDEVICEWIZARD_FINISHINSTALL: u32 = 30u32; pub const DIF_NEWDEVICEWIZARD_POSTANALYZE: u32 = 29u32; pub const DIF_NEWDEVICEWIZARD_PREANALYZE: u32 = 28u32; pub const DIF_NEWDEVICEWIZARD_PRESELECT: u32 = 26u32; pub const DIF_NEWDEVICEWIZARD_SELECT: u32 = 27u32; pub const DIF_POWERMESSAGEWAKE: u32 = 39u32; pub const DIF_PROPERTIES: u32 = 4u32; pub const DIF_PROPERTYCHANGE: u32 = 18u32; pub const DIF_REGISTERDEVICE: u32 = 25u32; pub const DIF_REGISTER_COINSTALLERS: u32 = 34u32; pub const DIF_REMOVE: u32 = 5u32; pub const DIF_RESERVED1: u32 = 37u32; pub const DIF_RESERVED2: u32 = 48u32; pub const DIF_SELECTBESTCOMPATDRV: u32 = 23u32; pub const DIF_SELECTCLASSDRIVERS: u32 = 8u32; pub const DIF_SELECTDEVICE: u32 = 1u32; pub const DIF_TROUBLESHOOTER: u32 = 38u32; pub const DIF_UNREMOVE: u32 = 22u32; pub const DIF_UNUSED1: u32 = 31u32; pub const DIF_UPDATEDRIVER_UI: u32 = 41u32; pub const DIF_VALIDATECLASSDRIVERS: u32 = 9u32; pub const DIF_VALIDATEDRIVER: u32 = 13u32; pub const DIGCDP_FLAG_ADVANCED: u32 = 2u32; pub const DIGCDP_FLAG_BASIC: u32 = 1u32; pub const DIGCDP_FLAG_REMOTE_ADVANCED: u32 = 4u32; pub const DIGCDP_FLAG_REMOTE_BASIC: u32 = 3u32; pub const DIGCF_ALLCLASSES: u32 = 4u32; pub const DIGCF_DEFAULT: u32 = 1u32; pub const DIGCF_DEVICEINTERFACE: u32 = 16u32; pub const DIGCF_INTERFACEDEVICE: u32 = 16u32; pub const DIGCF_PRESENT: u32 = 2u32; pub const DIGCF_PROFILE: u32 = 8u32; pub const DIIDFLAG_BITS: u32 = 15u32; pub const DIIDFLAG_INSTALLCOPYINFDRIVERS: u32 = 8u32; pub const DIIDFLAG_INSTALLNULLDRIVER: u32 = 4u32; pub const DIIDFLAG_NOFINISHINSTALLUI: u32 = 2u32; pub const DIIDFLAG_SHOWSEARCHUI: u32 = 1u32; pub const DIIRFLAG_FORCE_INF: u32 = 2u32; pub const DIIRFLAG_HOTPATCH: u32 = 8u32; pub const DIIRFLAG_HW_USING_THE_INF: u32 = 4u32; pub const DIIRFLAG_INF_ALREADY_COPIED: u32 = 1u32; pub const DIIRFLAG_INSTALL_AS_SET: u32 = 64u32; pub const DIIRFLAG_NOBACKUP: u32 = 16u32; pub const DIIRFLAG_PRE_CONFIGURE_INF: u32 = 32u32; pub const DIOCR_INSTALLER: u32 = 1u32; pub const DIOCR_INTERFACE: u32 = 2u32; pub const DIODI_NO_ADD: u32 = 1u32; pub const DIOD_CANCEL_REMOVE: u32 = 4u32; pub const DIOD_INHERIT_CLASSDRVS: u32 = 2u32; pub const DIREG_BOTH: u32 = 4u32; pub const DIREG_DEV: u32 = 1u32; pub const DIREG_DRV: u32 = 2u32; pub const DIRID_ABSOLUTE: i32 = -1i32; pub const DIRID_ABSOLUTE_16BIT: u32 = 65535u32; pub const DIRID_APPS: u32 = 24u32; pub const DIRID_BOOT: u32 = 30u32; pub const DIRID_COLOR: u32 = 23u32; pub const DIRID_COMMON_APPDATA: u32 = 16419u32; pub const DIRID_COMMON_DESKTOPDIRECTORY: u32 = 16409u32; pub const DIRID_COMMON_DOCUMENTS: u32 = 16430u32; pub const DIRID_COMMON_FAVORITES: u32 = 16415u32; pub const DIRID_COMMON_PROGRAMS: u32 = 16407u32; pub const DIRID_COMMON_STARTMENU: u32 = 16406u32; pub const DIRID_COMMON_STARTUP: u32 = 16408u32; pub const DIRID_COMMON_TEMPLATES: u32 = 16429u32; pub const DIRID_DEFAULT: u32 = 11u32; pub const DIRID_DRIVERS: u32 = 12u32; pub const DIRID_DRIVER_STORE: u32 = 13u32; pub const DIRID_FONTS: u32 = 20u32; pub const DIRID_HELP: u32 = 18u32; pub const DIRID_INF: u32 = 17u32; pub const DIRID_IOSUBSYS: u32 = 12u32; pub const DIRID_LOADER: u32 = 54u32; pub const DIRID_NULL: u32 = 0u32; pub const DIRID_PRINTPROCESSOR: u32 = 55u32; pub const DIRID_PROGRAM_FILES: u32 = 16422u32; pub const DIRID_PROGRAM_FILES_COMMON: u32 = 16427u32; pub const DIRID_PROGRAM_FILES_COMMONX86: u32 = 16428u32; pub const DIRID_PROGRAM_FILES_X86: u32 = 16426u32; pub const DIRID_SHARED: u32 = 25u32; pub const DIRID_SPOOL: u32 = 51u32; pub const DIRID_SPOOLDRIVERS: u32 = 52u32; pub const DIRID_SRCPATH: u32 = 1u32; pub const DIRID_SYSTEM: u32 = 11u32; pub const DIRID_SYSTEM16: u32 = 50u32; pub const DIRID_SYSTEM_X86: u32 = 16425u32; pub const DIRID_USER: u32 = 32768u32; pub const DIRID_USERPROFILE: u32 = 53u32; pub const DIRID_VIEWERS: u32 = 21u32; pub const DIRID_WINDOWS: u32 = 10u32; pub const DIURFLAG_NO_REMOVE_INF: u32 = 1u32; pub const DIURFLAG_RESERVED: u32 = 2u32; pub const DI_AUTOASSIGNRES: i32 = 64i32; pub const DI_CLASSINSTALLPARAMS: i32 = 1048576i32; pub const DI_COMPAT_FROM_CLASS: i32 = 524288i32; pub const DI_DIDCLASS: i32 = 32i32; pub const DI_DIDCOMPAT: i32 = 16i32; pub const DI_DISABLED: i32 = 2048i32; pub const DI_DONOTCALLCONFIGMG: i32 = 131072i32; pub const DI_DRIVERPAGE_ADDED: i32 = 67108864i32; pub const DI_ENUMSINGLEINF: i32 = 65536i32; pub const DI_FLAGSEX_ALLOWEXCLUDEDDRVS: i32 = 2048i32; pub const DI_FLAGSEX_ALTPLATFORM_DRVSEARCH: i32 = 268435456i32; pub const DI_FLAGSEX_ALWAYSWRITEIDS: i32 = 512i32; pub const DI_FLAGSEX_APPENDDRIVERLIST: i32 = 262144i32; pub const DI_FLAGSEX_BACKUPONREPLACE: i32 = 1048576i32; pub const DI_FLAGSEX_CI_FAILED: i32 = 4i32; pub const DI_FLAGSEX_DEVICECHANGE: i32 = 256i32; pub const DI_FLAGSEX_DIDCOMPATINFO: i32 = 32i32; pub const DI_FLAGSEX_DIDINFOLIST: i32 = 16i32; pub const DI_FLAGSEX_DRIVERLIST_FROM_URL: i32 = 2097152i32; pub const DI_FLAGSEX_EXCLUDE_OLD_INET_DRIVERS: i32 = 8388608i32; pub const DI_FLAGSEX_FILTERCLASSES: i32 = 64i32; pub const DI_FLAGSEX_FILTERSIMILARDRIVERS: i32 = 33554432i32; pub const DI_FLAGSEX_FINISHINSTALL_ACTION: i32 = 8i32; pub const DI_FLAGSEX_INET_DRIVER: i32 = 131072i32; pub const DI_FLAGSEX_INSTALLEDDRIVER: i32 = 67108864i32; pub const DI_FLAGSEX_IN_SYSTEM_SETUP: i32 = 65536i32; pub const DI_FLAGSEX_NOUIONQUERYREMOVE: i32 = 4096i32; pub const DI_FLAGSEX_NO_CLASSLIST_NODE_MERGE: i32 = 134217728i32; pub const DI_FLAGSEX_NO_DRVREG_MODIFY: i32 = 32768i32; pub const DI_FLAGSEX_POWERPAGE_ADDED: i32 = 16777216i32; pub const DI_FLAGSEX_PREINSTALLBACKUP: i32 = 524288i32; pub const DI_FLAGSEX_PROPCHANGE_PENDING: i32 = 1024i32; pub const DI_FLAGSEX_RECURSIVESEARCH: i32 = 1073741824i32; pub const DI_FLAGSEX_RESERVED1: i32 = 4194304i32; pub const DI_FLAGSEX_RESERVED2: i32 = 1i32; pub const DI_FLAGSEX_RESERVED3: i32 = 2i32; pub const DI_FLAGSEX_RESERVED4: i32 = 16384i32; pub const DI_FLAGSEX_RESTART_DEVICE_ONLY: i32 = 536870912i32; pub const DI_FLAGSEX_SEARCH_PUBLISHED_INFS: i32 = -2147483648i32; pub const DI_FLAGSEX_SETFAILEDINSTALL: i32 = 128i32; pub const DI_FLAGSEX_USECLASSFORCOMPAT: i32 = 8192i32; pub const DI_FORCECOPY: i32 = 33554432i32; pub const DI_GENERALPAGE_ADDED: i32 = 4096i32; pub const DI_INF_IS_SORTED: i32 = 32768i32; pub const DI_INSTALLDISABLED: i32 = 262144i32; pub const DI_MULTMFGS: i32 = 1024i32; pub const DI_NEEDREBOOT: i32 = 256i32; pub const DI_NEEDRESTART: i32 = 128i32; pub const DI_NOBROWSE: i32 = 512i32; pub const DI_NODI_DEFAULTACTION: i32 = 2097152i32; pub const DI_NOFILECOPY: i32 = 16777216i32; pub const DI_NOSELECTICONS: i32 = 1073741824i32; pub const DI_NOVCP: i32 = 8i32; pub const DI_NOWRITE_IDS: i32 = -2147483648i32; pub const DI_OVERRIDE_INFFLAGS: i32 = 268435456i32; pub const DI_PROPERTIES_CHANGE: i32 = 16384i32; pub const DI_PROPS_NOCHANGEUSAGE: i32 = 536870912i32; pub const DI_QUIETINSTALL: i32 = 8388608i32; pub const DI_REMOVEDEVICE_CONFIGSPECIFIC: u32 = 2u32; pub const DI_REMOVEDEVICE_GLOBAL: u32 = 1u32; pub const DI_RESOURCEPAGE_ADDED: i32 = 8192i32; pub const DI_SHOWALL: i32 = 7i32; pub const DI_SHOWCLASS: i32 = 4i32; pub const DI_SHOWCOMPAT: i32 = 2i32; pub const DI_SHOWOEM: i32 = 1i32; pub const DI_UNREMOVEDEVICE_CONFIGSPECIFIC: u32 = 2u32; pub const DI_USECI_SELECTSTRINGS: i32 = 134217728i32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct DMA_DES { pub DD_Count: u32, pub DD_Type: u32, pub DD_Flags: u32, pub DD_Alloc_Chan: u32, } impl DMA_DES {} impl ::core::default::Default for DMA_DES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for DMA_DES { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for DMA_DES {} unsafe impl ::windows::core::Abi for DMA_DES { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct DMA_RANGE { pub DR_Min: u32, pub DR_Max: u32, pub DR_Flags: u32, } impl DMA_RANGE {} impl ::core::default::Default for DMA_RANGE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for DMA_RANGE { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for DMA_RANGE {} unsafe impl ::windows::core::Abi for DMA_RANGE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DMA_RESOURCE { pub DMA_Header: DMA_DES, pub DMA_Data: [DMA_RANGE; 1], } impl DMA_RESOURCE {} impl ::core::default::Default for DMA_RESOURCE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for DMA_RESOURCE { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for DMA_RESOURCE {} unsafe impl ::windows::core::Abi for DMA_RESOURCE { type Abi = Self; } pub const DMI_BKCOLOR: u32 = 2u32; pub const DMI_MASK: u32 = 1u32; pub const DMI_USERECT: u32 = 4u32; pub const DNF_ALWAYSEXCLUDEFROMLIST: u32 = 524288u32; pub const DNF_AUTHENTICODE_SIGNED: u32 = 131072u32; pub const DNF_BAD_DRIVER: u32 = 2048u32; pub const DNF_BASIC_DRIVER: u32 = 65536u32; pub const DNF_CLASS_DRIVER: u32 = 32u32; pub const DNF_COMPATIBLE_DRIVER: u32 = 64u32; pub const DNF_DUPDESC: u32 = 1u32; pub const DNF_DUPDRIVERVER: u32 = 32768u32; pub const DNF_DUPPROVIDER: u32 = 4096u32; pub const DNF_EXCLUDEFROMLIST: u32 = 4u32; pub const DNF_INBOX_DRIVER: u32 = 1048576u32; pub const DNF_INET_DRIVER: u32 = 128u32; pub const DNF_INF_IS_SIGNED: u32 = 8192u32; pub const DNF_INSTALLEDDRIVER: u32 = 262144u32; pub const DNF_LEGACYINF: u32 = 16u32; pub const DNF_NODRIVER: u32 = 8u32; pub const DNF_OEM_F6_INF: u32 = 16384u32; pub const DNF_OLDDRIVER: u32 = 2u32; pub const DNF_OLD_INET_DRIVER: u32 = 1024u32; pub const DNF_REQUESTADDITIONALSOFTWARE: u32 = 2097152u32; pub const DNF_UNUSED1: u32 = 256u32; pub const DNF_UNUSED2: u32 = 512u32; pub const DNF_UNUSED_22: u32 = 4194304u32; pub const DNF_UNUSED_23: u32 = 8388608u32; pub const DNF_UNUSED_24: u32 = 16777216u32; pub const DNF_UNUSED_25: u32 = 33554432u32; pub const DNF_UNUSED_26: u32 = 67108864u32; pub const DNF_UNUSED_27: u32 = 134217728u32; pub const DNF_UNUSED_28: u32 = 268435456u32; pub const DNF_UNUSED_29: u32 = 536870912u32; pub const DNF_UNUSED_30: u32 = 1073741824u32; pub const DNF_UNUSED_31: u32 = 2147483648u32; pub const DN_APM_DRIVER: u32 = 268435456u32; pub const DN_APM_ENUMERATOR: u32 = 134217728u32; pub const DN_ARM_WAKEUP: u32 = 67108864u32; pub const DN_BAD_PARTIAL: u32 = 4194304u32; pub const DN_BOOT_LOG_PROB: u32 = 2147483648u32; pub const DN_CHILD_WITH_INVALID_ID: u32 = 512u32; pub const DN_DEVICE_DISCONNECTED: u32 = 33554432u32; pub const DN_DISABLEABLE: u32 = 8192u32; pub const DN_DRIVER_BLOCKED: u32 = 64u32; pub const DN_DRIVER_LOADED: u32 = 2u32; pub const DN_ENUM_LOADED: u32 = 4u32; pub const DN_FILTERED: u32 = 2048u32; pub const DN_HARDWARE_ENUM: u32 = 128u32; pub const DN_HAS_MARK: u32 = 512u32; pub const DN_HAS_PROBLEM: u32 = 1024u32; pub const DN_LEGACY_DRIVER: u32 = 4096u32; pub const DN_LIAR: u32 = 256u32; pub const DN_MANUAL: u32 = 16u32; pub const DN_MF_CHILD: u32 = 131072u32; pub const DN_MF_PARENT: u32 = 65536u32; pub const DN_MOVED: u32 = 4096u32; pub const DN_NEEDS_LOCKING: u32 = 33554432u32; pub const DN_NEED_RESTART: u32 = 256u32; pub const DN_NEED_TO_ENUM: u32 = 32u32; pub const DN_NOT_FIRST_TIME: u32 = 64u32; pub const DN_NOT_FIRST_TIMEE: u32 = 524288u32; pub const DN_NO_SHOW_IN_DM: u32 = 1073741824u32; pub const DN_NT_DRIVER: u32 = 16777216u32; pub const DN_NT_ENUMERATOR: u32 = 8388608u32; pub const DN_PRIVATE_PROBLEM: u32 = 32768u32; pub const DN_QUERY_REMOVE_ACTIVE: u32 = 131072u32; pub const DN_QUERY_REMOVE_PENDING: u32 = 65536u32; pub const DN_REBAL_CANDIDATE: u32 = 2097152u32; pub const DN_REMOVABLE: u32 = 16384u32; pub const DN_ROOT_ENUMERATED: u32 = 1u32; pub const DN_SILENT_INSTALL: u32 = 536870912u32; pub const DN_STARTED: u32 = 8u32; pub const DN_STOP_FREE_RES: u32 = 1048576u32; pub const DN_WILL_BE_REMOVED: u32 = 262144u32; pub const DPROMPT_BUFFERTOOSMALL: u32 = 3u32; pub const DPROMPT_CANCEL: u32 = 1u32; pub const DPROMPT_OUTOFMEMORY: u32 = 4u32; pub const DPROMPT_SKIPFILE: u32 = 2u32; pub const DPROMPT_SUCCESS: u32 = 0u32; pub const DRIVER_COMPATID_RANK: u32 = 16383u32; pub const DRIVER_HARDWAREID_MASK: u32 = 2147487743u32; pub const DRIVER_HARDWAREID_RANK: u32 = 4095u32; pub const DRIVER_UNTRUSTED_COMPATID_RANK: u32 = 49151u32; pub const DRIVER_UNTRUSTED_HARDWAREID_RANK: u32 = 36863u32; pub const DRIVER_UNTRUSTED_RANK: u32 = 2147483648u32; pub const DRIVER_W9X_SUSPECT_COMPATID_RANK: u32 = 65535u32; pub const DRIVER_W9X_SUSPECT_HARDWAREID_RANK: u32 = 53247u32; pub const DRIVER_W9X_SUSPECT_RANK: u32 = 3221225472u32; pub const DWORD_MAX: u32 = 4294967295u32; pub const DYNAWIZ_FLAG_ANALYZE_HANDLECONFLICT: u32 = 8u32; pub const DYNAWIZ_FLAG_INSTALLDET_NEXT: u32 = 2u32; pub const DYNAWIZ_FLAG_INSTALLDET_PREV: u32 = 4u32; pub const DYNAWIZ_FLAG_PAGESADDED: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct DevPrivate_Des_s { pub PD_Count: u32, pub PD_Type: u32, pub PD_Data1: u32, pub PD_Data2: u32, pub PD_Data3: u32, pub PD_Flags: u32, } impl DevPrivate_Des_s {} impl ::core::default::Default for DevPrivate_Des_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for DevPrivate_Des_s { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for DevPrivate_Des_s {} unsafe impl ::windows::core::Abi for DevPrivate_Des_s { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct DevPrivate_Range_s { pub PR_Data1: u32, pub PR_Data2: u32, pub PR_Data3: u32, } impl DevPrivate_Range_s {} impl ::core::default::Default for DevPrivate_Range_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for DevPrivate_Range_s { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for DevPrivate_Range_s {} unsafe impl ::windows::core::Abi for DevPrivate_Range_s { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct DevPrivate_Resource_s { pub PRV_Header: DevPrivate_Des_s, pub PRV_Data: [DevPrivate_Range_s; 1], } impl DevPrivate_Resource_s {} impl ::core::default::Default for DevPrivate_Resource_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for DevPrivate_Resource_s { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for DevPrivate_Resource_s {} unsafe impl ::windows::core::Abi for DevPrivate_Resource_s { type Abi = Self; } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DiInstallDevice<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(hwndparent: Param0, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *const SP_DRVINFO_DATA_V2_A, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DiInstallDevice(hwndparent: super::super::Foundation::HWND, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *const SP_DRVINFO_DATA_V2_A, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL; } ::core::mem::transmute(DiInstallDevice(hwndparent.into_param().abi(), ::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(driverinfodata), ::core::mem::transmute(flags), ::core::mem::transmute(needreboot))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DiInstallDriverA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(hwndparent: Param0, infpath: Param1, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DiInstallDriverA(hwndparent: super::super::Foundation::HWND, infpath: super::super::Foundation::PSTR, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL; } ::core::mem::transmute(DiInstallDriverA(hwndparent.into_param().abi(), infpath.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(needreboot))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DiInstallDriverW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hwndparent: Param0, infpath: Param1, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DiInstallDriverW(hwndparent: super::super::Foundation::HWND, infpath: super::super::Foundation::PWSTR, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL; } ::core::mem::transmute(DiInstallDriverW(hwndparent.into_param().abi(), infpath.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(needreboot))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DiRollbackDriver<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, hwndparent: Param2, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DiRollbackDriver(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, hwndparent: super::super::Foundation::HWND, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL; } ::core::mem::transmute(DiRollbackDriver(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), hwndparent.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(needreboot))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DiShowUpdateDevice<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(hwndparent: Param0, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DiShowUpdateDevice(hwndparent: super::super::Foundation::HWND, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL; } ::core::mem::transmute(DiShowUpdateDevice(hwndparent.into_param().abi(), ::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(flags), ::core::mem::transmute(needreboot))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DiShowUpdateDriver<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hwndparent: Param0, filepath: Param1, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DiShowUpdateDriver(hwndparent: super::super::Foundation::HWND, filepath: super::super::Foundation::PWSTR, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL; } ::core::mem::transmute(DiShowUpdateDriver(hwndparent.into_param().abi(), filepath.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(needreboot))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DiUninstallDevice<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(hwndparent: Param0, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DiUninstallDevice(hwndparent: super::super::Foundation::HWND, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL; } ::core::mem::transmute(DiUninstallDevice(hwndparent.into_param().abi(), ::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(flags), ::core::mem::transmute(needreboot))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DiUninstallDriverA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(hwndparent: Param0, infpath: Param1, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DiUninstallDriverA(hwndparent: super::super::Foundation::HWND, infpath: super::super::Foundation::PSTR, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL; } ::core::mem::transmute(DiUninstallDriverA(hwndparent.into_param().abi(), infpath.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(needreboot))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn DiUninstallDriverW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hwndparent: Param0, infpath: Param1, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn DiUninstallDriverW(hwndparent: super::super::Foundation::HWND, infpath: super::super::Foundation::PWSTR, flags: u32, needreboot: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL; } ::core::mem::transmute(DiUninstallDriverW(hwndparent.into_param().abi(), infpath.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(needreboot))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const ENABLECLASS_FAILURE: u32 = 2u32; pub const ENABLECLASS_QUERY: u32 = 0u32; pub const ENABLECLASS_SUCCESS: u32 = 1u32; pub const FILEOP_ABORT: u32 = 0u32; pub const FILEOP_BACKUP: u32 = 3u32; pub const FILEOP_DOIT: u32 = 1u32; pub const FILEOP_NEWPATH: u32 = 4u32; pub const FILEOP_RENAME: u32 = 1u32; pub const FILEOP_RETRY: u32 = 1u32; pub const FILEOP_SKIP: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] pub struct FILEPATHS_A { pub Target: super::super::Foundation::PSTR, pub Source: super::super::Foundation::PSTR, pub Win32Error: u32, pub Flags: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl FILEPATHS_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for FILEPATHS_A { 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 FILEPATHS_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("FILEPATHS_A").field("Target", &self.Target).field("Source", &self.Source).field("Win32Error", &self.Win32Error).field("Flags", &self.Flags).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for FILEPATHS_A { fn eq(&self, other: &Self) -> bool { self.Target == other.Target && self.Source == other.Source && self.Win32Error == other.Win32Error && self.Flags == other.Flags } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for FILEPATHS_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for FILEPATHS_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct FILEPATHS_A { pub Target: super::super::Foundation::PSTR, pub Source: super::super::Foundation::PSTR, pub Win32Error: u32, pub Flags: u32, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl FILEPATHS_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for FILEPATHS_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for FILEPATHS_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for FILEPATHS_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for FILEPATHS_A { 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 FILEPATHS_SIGNERINFO_A { pub Target: super::super::Foundation::PSTR, pub Source: super::super::Foundation::PSTR, pub Win32Error: u32, pub Flags: u32, pub DigitalSigner: super::super::Foundation::PSTR, pub Version: super::super::Foundation::PSTR, pub CatalogFile: super::super::Foundation::PSTR, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl FILEPATHS_SIGNERINFO_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for FILEPATHS_SIGNERINFO_A { 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 FILEPATHS_SIGNERINFO_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("FILEPATHS_SIGNERINFO_A").field("Target", &self.Target).field("Source", &self.Source).field("Win32Error", &self.Win32Error).field("Flags", &self.Flags).field("DigitalSigner", &self.DigitalSigner).field("Version", &self.Version).field("CatalogFile", &self.CatalogFile).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for FILEPATHS_SIGNERINFO_A { fn eq(&self, other: &Self) -> bool { self.Target == other.Target && self.Source == other.Source && self.Win32Error == other.Win32Error && self.Flags == other.Flags && self.DigitalSigner == other.DigitalSigner && self.Version == other.Version && self.CatalogFile == other.CatalogFile } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for FILEPATHS_SIGNERINFO_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for FILEPATHS_SIGNERINFO_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct FILEPATHS_SIGNERINFO_A { pub Target: super::super::Foundation::PSTR, pub Source: super::super::Foundation::PSTR, pub Win32Error: u32, pub Flags: u32, pub DigitalSigner: super::super::Foundation::PSTR, pub Version: super::super::Foundation::PSTR, pub CatalogFile: super::super::Foundation::PSTR, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl FILEPATHS_SIGNERINFO_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for FILEPATHS_SIGNERINFO_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for FILEPATHS_SIGNERINFO_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for FILEPATHS_SIGNERINFO_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for FILEPATHS_SIGNERINFO_A { 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 FILEPATHS_SIGNERINFO_W { pub Target: super::super::Foundation::PWSTR, pub Source: super::super::Foundation::PWSTR, pub Win32Error: u32, pub Flags: u32, pub DigitalSigner: super::super::Foundation::PWSTR, pub Version: super::super::Foundation::PWSTR, pub CatalogFile: super::super::Foundation::PWSTR, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl FILEPATHS_SIGNERINFO_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for FILEPATHS_SIGNERINFO_W { 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 FILEPATHS_SIGNERINFO_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("FILEPATHS_SIGNERINFO_W").field("Target", &self.Target).field("Source", &self.Source).field("Win32Error", &self.Win32Error).field("Flags", &self.Flags).field("DigitalSigner", &self.DigitalSigner).field("Version", &self.Version).field("CatalogFile", &self.CatalogFile).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for FILEPATHS_SIGNERINFO_W { fn eq(&self, other: &Self) -> bool { self.Target == other.Target && self.Source == other.Source && self.Win32Error == other.Win32Error && self.Flags == other.Flags && self.DigitalSigner == other.DigitalSigner && self.Version == other.Version && self.CatalogFile == other.CatalogFile } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for FILEPATHS_SIGNERINFO_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for FILEPATHS_SIGNERINFO_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct FILEPATHS_SIGNERINFO_W { pub Target: super::super::Foundation::PWSTR, pub Source: super::super::Foundation::PWSTR, pub Win32Error: u32, pub Flags: u32, pub DigitalSigner: super::super::Foundation::PWSTR, pub Version: super::super::Foundation::PWSTR, pub CatalogFile: super::super::Foundation::PWSTR, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl FILEPATHS_SIGNERINFO_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for FILEPATHS_SIGNERINFO_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for FILEPATHS_SIGNERINFO_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for FILEPATHS_SIGNERINFO_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for FILEPATHS_SIGNERINFO_W { 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 FILEPATHS_W { pub Target: super::super::Foundation::PWSTR, pub Source: super::super::Foundation::PWSTR, pub Win32Error: u32, pub Flags: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl FILEPATHS_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for FILEPATHS_W { 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 FILEPATHS_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("FILEPATHS_W").field("Target", &self.Target).field("Source", &self.Source).field("Win32Error", &self.Win32Error).field("Flags", &self.Flags).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for FILEPATHS_W { fn eq(&self, other: &Self) -> bool { self.Target == other.Target && self.Source == other.Source && self.Win32Error == other.Win32Error && self.Flags == other.Flags } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for FILEPATHS_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for FILEPATHS_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct FILEPATHS_W { pub Target: super::super::Foundation::PWSTR, pub Source: super::super::Foundation::PWSTR, pub Win32Error: u32, pub Flags: u32, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl FILEPATHS_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for FILEPATHS_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for FILEPATHS_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for FILEPATHS_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for FILEPATHS_W { type Abi = Self; } pub const FILE_COMPRESSION_MSZIP: u32 = 2u32; pub const FILE_COMPRESSION_NONE: u32 = 0u32; pub const FILE_COMPRESSION_NTCAB: u32 = 3u32; pub const FILE_COMPRESSION_WINLZA: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] pub struct FILE_IN_CABINET_INFO_A { pub NameInCabinet: super::super::Foundation::PSTR, pub FileSize: u32, pub Win32Error: u32, pub DosDate: u16, pub DosTime: u16, pub DosAttribs: u16, pub FullTargetName: [super::super::Foundation::CHAR; 260], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl FILE_IN_CABINET_INFO_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for FILE_IN_CABINET_INFO_A { 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 FILE_IN_CABINET_INFO_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("FILE_IN_CABINET_INFO_A") .field("NameInCabinet", &self.NameInCabinet) .field("FileSize", &self.FileSize) .field("Win32Error", &self.Win32Error) .field("DosDate", &self.DosDate) .field("DosTime", &self.DosTime) .field("DosAttribs", &self.DosAttribs) .field("FullTargetName", &self.FullTargetName) .finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for FILE_IN_CABINET_INFO_A { fn eq(&self, other: &Self) -> bool { self.NameInCabinet == other.NameInCabinet && self.FileSize == other.FileSize && self.Win32Error == other.Win32Error && self.DosDate == other.DosDate && self.DosTime == other.DosTime && self.DosAttribs == other.DosAttribs && self.FullTargetName == other.FullTargetName } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for FILE_IN_CABINET_INFO_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for FILE_IN_CABINET_INFO_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct FILE_IN_CABINET_INFO_A { pub NameInCabinet: super::super::Foundation::PSTR, pub FileSize: u32, pub Win32Error: u32, pub DosDate: u16, pub DosTime: u16, pub DosAttribs: u16, pub FullTargetName: [super::super::Foundation::CHAR; 260], } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl FILE_IN_CABINET_INFO_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for FILE_IN_CABINET_INFO_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for FILE_IN_CABINET_INFO_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for FILE_IN_CABINET_INFO_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for FILE_IN_CABINET_INFO_A { 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 FILE_IN_CABINET_INFO_W { pub NameInCabinet: super::super::Foundation::PWSTR, pub FileSize: u32, pub Win32Error: u32, pub DosDate: u16, pub DosTime: u16, pub DosAttribs: u16, pub FullTargetName: [u16; 260], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl FILE_IN_CABINET_INFO_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for FILE_IN_CABINET_INFO_W { 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 FILE_IN_CABINET_INFO_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("FILE_IN_CABINET_INFO_W") .field("NameInCabinet", &self.NameInCabinet) .field("FileSize", &self.FileSize) .field("Win32Error", &self.Win32Error) .field("DosDate", &self.DosDate) .field("DosTime", &self.DosTime) .field("DosAttribs", &self.DosAttribs) .field("FullTargetName", &self.FullTargetName) .finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for FILE_IN_CABINET_INFO_W { fn eq(&self, other: &Self) -> bool { self.NameInCabinet == other.NameInCabinet && self.FileSize == other.FileSize && self.Win32Error == other.Win32Error && self.DosDate == other.DosDate && self.DosTime == other.DosTime && self.DosAttribs == other.DosAttribs && self.FullTargetName == other.FullTargetName } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for FILE_IN_CABINET_INFO_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for FILE_IN_CABINET_INFO_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct FILE_IN_CABINET_INFO_W { pub NameInCabinet: super::super::Foundation::PWSTR, pub FileSize: u32, pub Win32Error: u32, pub DosDate: u16, pub DosTime: u16, pub DosAttribs: u16, pub FullTargetName: [u16; 260], } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl FILE_IN_CABINET_INFO_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for FILE_IN_CABINET_INFO_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for FILE_IN_CABINET_INFO_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for FILE_IN_CABINET_INFO_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for FILE_IN_CABINET_INFO_W { type Abi = Self; } pub const FILTERED_LOG_CONF: u32 = 1u32; pub const FLG_ADDPROPERTY_AND: u32 = 16u32; pub const FLG_ADDPROPERTY_APPEND: u32 = 4u32; pub const FLG_ADDPROPERTY_NOCLOBBER: u32 = 1u32; pub const FLG_ADDPROPERTY_OR: u32 = 8u32; pub const FLG_ADDPROPERTY_OVERWRITEONLY: u32 = 2u32; pub const FLG_ADDREG_32BITKEY: u32 = 16384u32; pub const FLG_ADDREG_64BITKEY: u32 = 4096u32; pub const FLG_ADDREG_APPEND: u32 = 8u32; pub const FLG_ADDREG_BINVALUETYPE: u32 = 1u32; pub const FLG_ADDREG_DELREG_BIT: u32 = 32768u32; pub const FLG_ADDREG_DELVAL: u32 = 4u32; pub const FLG_ADDREG_KEYONLY: u32 = 16u32; pub const FLG_ADDREG_KEYONLY_COMMON: u32 = 8192u32; pub const FLG_ADDREG_NOCLOBBER: u32 = 2u32; pub const FLG_ADDREG_OVERWRITEONLY: u32 = 32u32; pub const FLG_ADDREG_TYPE_EXPAND_SZ: u32 = 131072u32; pub const FLG_ADDREG_TYPE_MULTI_SZ: u32 = 65536u32; pub const FLG_ADDREG_TYPE_SZ: u32 = 0u32; pub const FLG_BITREG_32BITKEY: u32 = 16384u32; pub const FLG_BITREG_64BITKEY: u32 = 4096u32; pub const FLG_BITREG_CLEARBITS: u32 = 0u32; pub const FLG_BITREG_SETBITS: u32 = 1u32; pub const FLG_DELPROPERTY_MULTI_SZ_DELSTRING: u32 = 1u32; pub const FLG_DELREG_32BITKEY: u32 = 16384u32; pub const FLG_DELREG_64BITKEY: u32 = 4096u32; pub const FLG_DELREG_KEYONLY_COMMON: u32 = 8192u32; pub const FLG_DELREG_OPERATION_MASK: u32 = 254u32; pub const FLG_DELREG_TYPE_EXPAND_SZ: u32 = 131072u32; pub const FLG_DELREG_TYPE_MULTI_SZ: u32 = 65536u32; pub const FLG_DELREG_TYPE_SZ: u32 = 0u32; pub const FLG_DELREG_VALUE: u32 = 0u32; pub const FLG_INI2REG_32BITKEY: u32 = 16384u32; pub const FLG_INI2REG_64BITKEY: u32 = 4096u32; pub const FLG_PROFITEM_CSIDL: u32 = 8u32; pub const FLG_PROFITEM_CURRENTUSER: u32 = 1u32; pub const FLG_PROFITEM_DELETE: u32 = 2u32; pub const FLG_PROFITEM_GROUP: u32 = 4u32; pub const FLG_REGSVR_DLLINSTALL: u32 = 2u32; pub const FLG_REGSVR_DLLREGISTER: u32 = 1u32; pub const FORCED_LOG_CONF: u32 = 4u32; pub const GUID_ACPI_CMOS_INTERFACE_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3a8d0384_6505_40ca_bc39_56c15f8c5fed); pub const GUID_ACPI_INTERFACE_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb091a08a_ba97_11d0_bd14_00aa00b7b32a); pub const GUID_ACPI_INTERFACE_STANDARD2: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe8695f63_1831_4870_a8cf_9c2f03f9dcb5); pub const GUID_ACPI_PORT_RANGES_INTERFACE_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf14f609b_cbbd_4957_a674_bc00213f1c97); pub const GUID_ACPI_REGS_INTERFACE_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x06141966_7245_6369_462e_4e656c736f6e); pub const GUID_AGP_TARGET_BUS_INTERFACE_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb15cfce8_06d1_4d37_9d4c_bedde0c2a6ff); pub const GUID_ARBITER_INTERFACE_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe644f185_8c0e_11d0_becf_08002be2092f); pub const GUID_BUS_INTERFACE_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x496b8280_6f25_11d0_beaf_08002be2092f); pub const GUID_BUS_RESOURCE_UPDATE_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x27d0102d_bfb2_4164_81dd_dbb82f968b48); pub const GUID_BUS_TYPE_1394: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf74e73eb_9ac5_45eb_be4d_772cc71ddfb3); pub const GUID_BUS_TYPE_ACPI: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd7b46895_001a_4942_891f_a7d46610a843); pub const GUID_BUS_TYPE_AVC: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc06ff265_ae09_48f0_812c_16753d7cba83); pub const GUID_BUS_TYPE_DOT4PRT: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x441ee001_4342_11d5_a184_00c04f60524d); pub const GUID_BUS_TYPE_EISA: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xddc35509_f3fc_11d0_a537_0000f8753ed1); pub const GUID_BUS_TYPE_HID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xeeaf37d0_1963_47c4_aa48_72476db7cf49); pub const GUID_BUS_TYPE_INTERNAL: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1530ea73_086b_11d1_a09f_00c04fc340b1); pub const GUID_BUS_TYPE_IRDA: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7ae17dc1_c944_44d6_881f_4c2e61053bc1); pub const GUID_BUS_TYPE_ISAPNP: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe676f854_d87d_11d0_92b2_00a0c9055fc5); pub const GUID_BUS_TYPE_LPTENUM: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc4ca1000_2ddc_11d5_a17a_00c04f60524d); pub const GUID_BUS_TYPE_MCA: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1c75997a_dc33_11d0_92b2_00a0c9055fc5); pub const GUID_BUS_TYPE_PCI: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc8ebdfb0_b510_11d0_80e5_00a0c92542e3); pub const GUID_BUS_TYPE_PCMCIA: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x09343630_af9f_11d0_92e9_0000f81e1b30); pub const GUID_BUS_TYPE_SCM: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x375a5912_804c_45aa_bdc2_fdd25a1d9512); pub const GUID_BUS_TYPE_SD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe700cc04_4036_4e89_9579_89ebf45f00cd); pub const GUID_BUS_TYPE_SERENUM: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x77114a87_8944_11d1_bd90_00a0c906be2d); pub const GUID_BUS_TYPE_SW_DEVICE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x06d10322_7de0_4cef_8e25_197d0e7442e2); pub const GUID_BUS_TYPE_USB: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9d7debbc_c85d_11d1_9eb4_006008c3a19a); pub const GUID_BUS_TYPE_USBPRINT: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x441ee000_4342_11d5_a184_00c04f60524d); pub const GUID_D3COLD_AUX_POWER_AND_TIMING_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0044d8aa_f664_4588_9ffc_2afeaf5950b9); pub const GUID_D3COLD_SUPPORT_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb38290e5_3cd0_4f9d_9937_f5fe2b44d47a); pub const GUID_DEVCLASS_1394: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6bdd1fc1_810f_11d0_bec7_08002be2092f); pub const GUID_DEVCLASS_1394DEBUG: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x66f250d6_7801_4a64_b139_eea80a450b24); pub const GUID_DEVCLASS_61883: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7ebefbc0_3200_11d2_b4c2_00a0c9697d07); pub const GUID_DEVCLASS_ADAPTER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e964_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_APMSUPPORT: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd45b1c18_c8fa_11d1_9f77_0000f805f530); pub const GUID_DEVCLASS_AVC: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc06ff265_ae09_48f0_812c_16753d7cba83); pub const GUID_DEVCLASS_BATTERY: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x72631e54_78a4_11d0_bcf7_00aa00b7b32a); pub const GUID_DEVCLASS_BIOMETRIC: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x53d29ef7_377c_4d14_864b_eb3a85769359); pub const GUID_DEVCLASS_BLUETOOTH: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe0cbf06c_cd8b_4647_bb8a_263b43f0f974); pub const GUID_DEVCLASS_CAMERA: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xca3e7ab9_b4c3_4ae6_8251_579ef933890f); pub const GUID_DEVCLASS_CDROM: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e965_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_COMPUTEACCELERATOR: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf01a9d53_3ff6_48d2_9f97_c8a7004be10c); pub const GUID_DEVCLASS_COMPUTER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e966_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_DECODER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6bdd1fc2_810f_11d0_bec7_08002be2092f); pub const GUID_DEVCLASS_DISKDRIVE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e967_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_DISPLAY: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e968_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_DOT4: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x48721b56_6795_11d2_b1a8_0080c72e74a2); pub const GUID_DEVCLASS_DOT4PRINT: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x49ce6ac8_6f86_11d2_b1e5_0080c72e74a2); pub const GUID_DEVCLASS_EHSTORAGESILO: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9da2b80f_f89f_4a49_a5c2_511b085b9e8a); pub const GUID_DEVCLASS_ENUM1394: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc459df55_db08_11d1_b009_00a0c9081ff6); pub const GUID_DEVCLASS_EXTENSION: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe2f84ce7_8efa_411c_aa69_97454ca4cb57); pub const GUID_DEVCLASS_FDC: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e969_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_FIRMWARE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf2e7dd72_6468_4e36_b6f1_6488f42c1b52); pub const GUID_DEVCLASS_FLOPPYDISK: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e980_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_FSFILTER_ACTIVITYMONITOR: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb86dff51_a31e_4bac_b3cf_e8cfe75c9fc2); pub const GUID_DEVCLASS_FSFILTER_ANTIVIRUS: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb1d1a169_c54f_4379_81db_bee7d88d7454); pub const GUID_DEVCLASS_FSFILTER_BOTTOM: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x37765ea0_5958_4fc9_b04b_2fdfef97e59e); pub const GUID_DEVCLASS_FSFILTER_CFSMETADATASERVER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcdcf0939_b75b_4630_bf76_80f7ba655884); pub const GUID_DEVCLASS_FSFILTER_COMPRESSION: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf3586baf_b5aa_49b5_8d6c_0569284c639f); pub const GUID_DEVCLASS_FSFILTER_CONTENTSCREENER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3e3f0674_c83c_4558_bb26_9820e1eba5c5); pub const GUID_DEVCLASS_FSFILTER_CONTINUOUSBACKUP: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x71aa14f8_6fad_4622_ad77_92bb9d7e6947); pub const GUID_DEVCLASS_FSFILTER_COPYPROTECTION: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x89786ff1_9c12_402f_9c9e_17753c7f4375); pub const GUID_DEVCLASS_FSFILTER_ENCRYPTION: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa0a701c0_a511_42ff_aa6c_06dc0395576f); pub const GUID_DEVCLASS_FSFILTER_HSM: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd546500a_2aeb_45f6_9482_f4b1799c3177); pub const GUID_DEVCLASS_FSFILTER_INFRASTRUCTURE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe55fa6f9_128c_4d04_abab_630c74b1453a); pub const GUID_DEVCLASS_FSFILTER_OPENFILEBACKUP: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf8ecafa6_66d1_41a5_899b_66585d7216b7); pub const GUID_DEVCLASS_FSFILTER_PHYSICALQUOTAMANAGEMENT: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6a0a8e78_bba6_4fc4_a709_1e33cd09d67e); pub const GUID_DEVCLASS_FSFILTER_QUOTAMANAGEMENT: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8503c911_a6c7_4919_8f79_5028f5866b0c); pub const GUID_DEVCLASS_FSFILTER_REPLICATION: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x48d3ebc4_4cf8_48ff_b869_9c68ad42eb9f); pub const GUID_DEVCLASS_FSFILTER_SECURITYENHANCER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd02bc3da_0c8e_4945_9bd5_f1883c226c8c); pub const GUID_DEVCLASS_FSFILTER_SYSTEM: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5d1b9aaa_01e2_46af_849f_272b3f324c46); pub const GUID_DEVCLASS_FSFILTER_SYSTEMRECOVERY: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2db15374_706e_4131_a0c7_d7c78eb0289a); pub const GUID_DEVCLASS_FSFILTER_TOP: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb369baf4_5568_4e82_a87e_a93eb16bca87); pub const GUID_DEVCLASS_FSFILTER_UNDELETE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfe8f1572_c67a_48c0_bbac_0b5c6d66cafb); pub const GUID_DEVCLASS_FSFILTER_VIRTUALIZATION: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf75a86c0_10d8_4c3a_b233_ed60e4cdfaac); pub const GUID_DEVCLASS_GPS: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6bdd1fc3_810f_11d0_bec7_08002be2092f); pub const GUID_DEVCLASS_HDC: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e96a_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_HIDCLASS: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x745a17a0_74d3_11d0_b6fe_00a0c90f57da); pub const GUID_DEVCLASS_HOLOGRAPHIC: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd612553d_06b1_49ca_8938_e39ef80eb16f); pub const GUID_DEVCLASS_IMAGE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6bdd1fc6_810f_11d0_bec7_08002be2092f); pub const GUID_DEVCLASS_INFINIBAND: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x30ef7132_d858_4a0c_ac24_b9028a5cca3f); pub const GUID_DEVCLASS_INFRARED: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6bdd1fc5_810f_11d0_bec7_08002be2092f); pub const GUID_DEVCLASS_KEYBOARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e96b_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_LEGACYDRIVER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8ecc055d_047f_11d1_a537_0000f8753ed1); pub const GUID_DEVCLASS_MEDIA: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e96c_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_MEDIUM_CHANGER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xce5939ae_ebde_11d0_b181_0000f8753ec4); pub const GUID_DEVCLASS_MEMORY: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5099944a_f6b9_4057_a056_8c550228544c); pub const GUID_DEVCLASS_MODEM: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e96d_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_MONITOR: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e96e_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_MOUSE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e96f_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_MTD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e970_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_MULTIFUNCTION: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e971_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_MULTIPORTSERIAL: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x50906cb8_ba12_11d1_bf5d_0000f805f530); pub const GUID_DEVCLASS_NET: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e972_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_NETCLIENT: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e973_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_NETDRIVER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x87ef9ad1_8f70_49ee_b215_ab1fcadcbe3c); pub const GUID_DEVCLASS_NETSERVICE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e974_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_NETTRANS: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e975_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_NETUIO: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x78912bc1_cb8e_4b28_a329_f322ebadbe0f); pub const GUID_DEVCLASS_NODRIVER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e976_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_PCMCIA: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e977_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_PNPPRINTERS: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4658ee7e_f050_11d1_b6bd_00c04fa372a7); pub const GUID_DEVCLASS_PORTS: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e978_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_PRINTER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e979_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_PRINTERUPGRADE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e97a_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_PRINTQUEUE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1ed2bbf9_11f0_4084_b21f_ad83a8e6dcdc); pub const GUID_DEVCLASS_PROCESSOR: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x50127dc3_0f36_415e_a6cc_4cb3be910b65); pub const GUID_DEVCLASS_SBP2: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd48179be_ec20_11d1_b6b8_00c04fa372a7); pub const GUID_DEVCLASS_SCMDISK: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x53966cb1_4d46_4166_bf23_c522403cd495); pub const GUID_DEVCLASS_SCMVOLUME: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x53ccb149_e543_4c84_b6e0_bce4f6b7e806); pub const GUID_DEVCLASS_SCSIADAPTER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e97b_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_SECURITYACCELERATOR: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x268c95a1_edfe_11d3_95c3_0010dc4050a5); pub const GUID_DEVCLASS_SENSOR: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5175d334_c371_4806_b3ba_71fd53c9258d); pub const GUID_DEVCLASS_SIDESHOW: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x997b5d8d_c442_4f2e_baf3_9c8e671e9e21); pub const GUID_DEVCLASS_SMARTCARDREADER: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x50dd5230_ba8a_11d1_bf5d_0000f805f530); pub const GUID_DEVCLASS_SMRDISK: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x53487c23_680f_4585_acc3_1f10d6777e82); pub const GUID_DEVCLASS_SMRVOLUME: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x53b3cf03_8f5a_4788_91b6_d19ed9fcccbf); pub const GUID_DEVCLASS_SOFTWARECOMPONENT: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5c4c3332_344d_483c_8739_259e934c9cc8); pub const GUID_DEVCLASS_SOUND: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e97c_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_SYSTEM: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e97d_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_TAPEDRIVE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6d807884_7d21_11cf_801c_08002be10318); pub const GUID_DEVCLASS_UCM: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe6f1aa1c_7f3b_4473_b2e8_c97d8ac71d53); pub const GUID_DEVCLASS_UNKNOWN: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d36e97e_e325_11ce_bfc1_08002be10318); pub const GUID_DEVCLASS_USB: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x36fc9e60_c465_11cf_8056_444553540000); pub const GUID_DEVCLASS_VOLUME: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x71a27cdd_812a_11d0_bec7_08002be2092f); pub const GUID_DEVCLASS_VOLUMESNAPSHOT: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x533c5b84_ec70_11d2_9505_00c04f79deaf); pub const GUID_DEVCLASS_WCEUSBS: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x25dbce51_6c8f_4a72_8a6d_b54c2b4fc835); pub const GUID_DEVCLASS_WPD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xeec5ad98_8080_425f_922a_dabf3de3f69a); pub const GUID_DEVICE_INTERFACE_ARRIVAL: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcb3a4004_46f0_11d0_b08f_00609713053f); pub const GUID_DEVICE_INTERFACE_REMOVAL: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcb3a4005_46f0_11d0_b08f_00609713053f); pub const GUID_DEVICE_RESET_INTERFACE_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x649fdf26_3bc0_4813_ad24_7e0c1eda3fa3); pub const GUID_DMA_CACHE_COHERENCY_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb520f7fa_8a5a_4e40_a3f6_6be1e162d935); pub const GUID_HWPROFILE_CHANGE_CANCELLED: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcb3a4002_46f0_11d0_b08f_00609713053f); pub const GUID_HWPROFILE_CHANGE_COMPLETE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcb3a4003_46f0_11d0_b08f_00609713053f); pub const GUID_HWPROFILE_QUERY_CHANGE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcb3a4001_46f0_11d0_b08f_00609713053f); pub const GUID_INT_ROUTE_INTERFACE_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x70941bf4_0073_11d1_a09e_00c04fc340b1); pub const GUID_IOMMU_BUS_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1efee0b2_d278_4ae4_bddc_1b34dd648043); pub const GUID_KERNEL_SOFT_RESTART_CANCEL: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x31d737e7_8c0b_468a_956e_9f433ec358fb); pub const GUID_KERNEL_SOFT_RESTART_FINALIZE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x20e91abd_350a_4d4f_8577_99c81507473a); pub const GUID_KERNEL_SOFT_RESTART_PREPARE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xde373def_a85c_4f76_8cbf_f96bea8bd10f); pub const GUID_LEGACY_DEVICE_DETECTION_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x50feb0de_596a_11d2_a5b8_0000f81a4619); pub const GUID_MF_ENUMERATION_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xaeb895f0_5586_11d1_8d84_00a0c906b244); pub const GUID_MSIX_TABLE_CONFIG_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1a6a460b_194f_455d_b34b_b84c5b05712b); pub const GUID_NPEM_CONTROL_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d95573d_b774_488a_b120_4f284a9eff51); pub const GUID_PARTITION_UNIT_INTERFACE_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x52363f5b_d891_429b_8195_aec5fef6853c); pub const GUID_PCC_INTERFACE_INTERNAL: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7cce62ce_c189_4814_a6a7_12112089e938); pub const GUID_PCC_INTERFACE_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3ee8ba63_0f59_4a24_8a45_35808bdd1249); pub const GUID_PCI_ATS_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x010a7fe8_96f5_4943_bedf_95e651b93412); pub const GUID_PCI_BUS_INTERFACE_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x496b8281_6f25_11d0_beaf_08002be2092f); pub const GUID_PCI_BUS_INTERFACE_STANDARD2: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xde94e966_fdff_4c9c_9998_6747b150e74c); pub const GUID_PCI_DEVICE_PRESENT_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd1b82c26_bf49_45ef_b216_71cbd7889b57); pub const GUID_PCI_EXPRESS_LINK_QUIESCENT_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x146cd41c_dae3_4437_8aff_2af3f038099b); pub const GUID_PCI_EXPRESS_ROOT_PORT_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x83a7734a_84c7_4161_9a98_6000ed0c4a33); pub const GUID_PCI_FPGA_CONTROL_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2df3f7a8_b9b3_4063_9215_b5d14a0b266e); pub const GUID_PCI_PTM_CONTROL_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x348a5ebb_ba24_44b7_9916_285687735117); pub const GUID_PCI_SECURITY_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6e7f1451_199e_4acc_ba2d_762b4edf4674); pub const GUID_PCI_VIRTUALIZATION_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x64897b47_3a4a_4d75_bc74_89dd6c078293); pub const GUID_PCMCIA_BUS_INTERFACE_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x76173af0_c504_11d1_947f_00c04fb960ee); pub const GUID_PNP_CUSTOM_NOTIFICATION: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xaca73f8e_8d23_11d1_ac7d_0000f87571d0); pub const GUID_PNP_EXTENDED_ADDRESS_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb8e992ec_a797_4dc4_8846_84d041707446); pub const GUID_PNP_LOCATION_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x70211b0e_0afb_47db_afc1_410bf842497a); pub const GUID_PNP_POWER_NOTIFICATION: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc2cf0660_eb7a_11d1_bd7f_0000f87571d0); pub const GUID_PNP_POWER_SETTING_CHANGE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x29c69b3e_c79a_43bf_bbde_a932fa1bea7e); pub const GUID_POWER_DEVICE_ENABLE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x827c0a6f_feb0_11d0_bd26_00aa00b7b32a); pub const GUID_POWER_DEVICE_TIMEOUTS: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa45da735_feb0_11d0_bd26_00aa00b7b32a); pub const GUID_POWER_DEVICE_WAKE_ENABLE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa9546a82_feb0_11d0_bd26_00aa00b7b32a); pub const GUID_PROCESSOR_PCC_INTERFACE_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x37b17e9a_c21c_4296_972d_11c4b32b28f0); pub const GUID_QUERY_CRASHDUMP_FUNCTIONS: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9cc6b8ff_32e2_4834_b1de_b32ef8880a4b); pub const GUID_RECOVERY_NVMED_PREPARE_SHUTDOWN: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4b9770ea_bde7_400b_a9b9_4f684f54cc2a); pub const GUID_RECOVERY_PCI_PREPARE_SHUTDOWN: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x90d889de_8704_44cf_8115_ed8528d2b2da); pub const GUID_REENUMERATE_SELF_INTERFACE_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2aeb0243_6a6e_486b_82fc_d815f6b97006); pub const GUID_SCM_BUS_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x25944783_ce79_4232_815e_4a30014e8eb4); pub const GUID_SCM_BUS_LD_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9b89307d_d76b_4f48_b186_54041ae92e8d); pub const GUID_SCM_BUS_NVD_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8de064ff_b630_42e4_88ea_6f24c8641175); pub const GUID_SCM_PHYSICAL_NVDIMM_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0079c21b_917e_405e_a9ce_0732b5bbcebd); pub const GUID_SDEV_IDENTIFIER_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x49d67af8_916c_4ee8_9df1_889f17d21e91); pub const GUID_SECURE_DRIVER_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x370f67e1_4ff5_4a94_9a35_06c5d9cc30e2); pub const GUID_TARGET_DEVICE_QUERY_REMOVE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcb3a4006_46f0_11d0_b08f_00609713053f); pub const GUID_TARGET_DEVICE_REMOVE_CANCELLED: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcb3a4007_46f0_11d0_b08f_00609713053f); pub const GUID_TARGET_DEVICE_REMOVE_COMPLETE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcb3a4008_46f0_11d0_b08f_00609713053f); pub const GUID_TARGET_DEVICE_TRANSPORT_RELATIONS_CHANGED: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfcf528f6_a82f_47b1_ad3a_8050594cad28); pub const GUID_THERMAL_COOLING_INTERFACE: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xecbe47a8_c498_4bb9_bd70_e867e0940d22); pub const GUID_TRANSLATOR_INTERFACE_STANDARD: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6c154a92_aacf_11d0_8d2a_00a0c906b244); pub const GUID_WUDF_DEVICE_HOST_PROBLEM: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc43d25bd_9346_40ee_a2d2_d70c15f8b75b); #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy, :: core :: fmt :: Debug, :: core :: cmp :: PartialEq, :: core :: cmp :: Eq)] #[repr(transparent)] pub struct HCMNOTIFICATION(pub isize); impl ::core::default::Default for HCMNOTIFICATION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } unsafe impl ::windows::core::Handle for HCMNOTIFICATION {} unsafe impl ::windows::core::Abi for HCMNOTIFICATION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(feature = "Win32_Foundation")] pub struct HWProfileInfo_sA { pub HWPI_ulHWProfile: u32, pub HWPI_szFriendlyName: [super::super::Foundation::CHAR; 80], pub HWPI_dwFlags: u32, } #[cfg(feature = "Win32_Foundation")] impl HWProfileInfo_sA {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for HWProfileInfo_sA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for HWProfileInfo_sA { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for HWProfileInfo_sA {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for HWProfileInfo_sA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct HWProfileInfo_sW { pub HWPI_ulHWProfile: u32, pub HWPI_szFriendlyName: [u16; 80], pub HWPI_dwFlags: u32, } impl HWProfileInfo_sW {} impl ::core::default::Default for HWProfileInfo_sW { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for HWProfileInfo_sW { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for HWProfileInfo_sW {} unsafe impl ::windows::core::Abi for HWProfileInfo_sW { type Abi = Self; } pub const IDD_DYNAWIZ_ANALYZEDEV_PAGE: u32 = 10010u32; pub const IDD_DYNAWIZ_ANALYZE_NEXTPAGE: u32 = 10004u32; pub const IDD_DYNAWIZ_ANALYZE_PREVPAGE: u32 = 10003u32; pub const IDD_DYNAWIZ_FIRSTPAGE: u32 = 10000u32; pub const IDD_DYNAWIZ_INSTALLDETECTEDDEVS_PAGE: u32 = 10011u32; pub const IDD_DYNAWIZ_INSTALLDETECTED_NEXTPAGE: u32 = 10007u32; pub const IDD_DYNAWIZ_INSTALLDETECTED_NODEVS: u32 = 10008u32; pub const IDD_DYNAWIZ_INSTALLDETECTED_PREVPAGE: u32 = 10006u32; pub const IDD_DYNAWIZ_SELECTCLASS_PAGE: u32 = 10012u32; pub const IDD_DYNAWIZ_SELECTDEV_PAGE: u32 = 10009u32; pub const IDD_DYNAWIZ_SELECT_NEXTPAGE: u32 = 10002u32; pub const IDD_DYNAWIZ_SELECT_PREVPAGE: u32 = 10001u32; pub const IDF_CHECKFIRST: u32 = 256u32; pub const IDF_NOBEEP: u32 = 512u32; pub const IDF_NOBROWSE: u32 = 1u32; pub const IDF_NOCOMPRESSED: u32 = 8u32; pub const IDF_NODETAILS: u32 = 4u32; pub const IDF_NOFOREGROUND: u32 = 1024u32; pub const IDF_NOREMOVABLEMEDIAPROMPT: u32 = 4096u32; pub const IDF_NOSKIP: u32 = 2u32; pub const IDF_OEMDISK: u32 = 2147483648u32; pub const IDF_USEDISKNAMEASPROMPT: u32 = 8192u32; pub const IDF_WARNIFSKIP: u32 = 2048u32; pub const IDI_CLASSICON_OVERLAYFIRST: u32 = 500u32; pub const IDI_CLASSICON_OVERLAYLAST: u32 = 502u32; pub const IDI_CONFLICT: u32 = 161u32; pub const IDI_DISABLED_OVL: u32 = 501u32; pub const IDI_FORCED_OVL: u32 = 502u32; pub const IDI_PROBLEM_OVL: u32 = 500u32; pub const IDI_RESOURCE: u32 = 159u32; pub const IDI_RESOURCEFIRST: u32 = 159u32; pub const IDI_RESOURCELAST: u32 = 161u32; pub const IDI_RESOURCEOVERLAYFIRST: u32 = 161u32; pub const IDI_RESOURCEOVERLAYLAST: u32 = 161u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct INFCONTEXT { pub Inf: *mut ::core::ffi::c_void, pub CurrentInf: *mut ::core::ffi::c_void, pub Section: u32, pub Line: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl INFCONTEXT {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for INFCONTEXT { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for INFCONTEXT { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("INFCONTEXT").field("Inf", &self.Inf).field("CurrentInf", &self.CurrentInf).field("Section", &self.Section).field("Line", &self.Line).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for INFCONTEXT { fn eq(&self, other: &Self) -> bool { self.Inf == other.Inf && self.CurrentInf == other.CurrentInf && self.Section == other.Section && self.Line == other.Line } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for INFCONTEXT {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for INFCONTEXT { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct INFCONTEXT { pub Inf: *mut ::core::ffi::c_void, pub CurrentInf: *mut ::core::ffi::c_void, pub Section: u32, pub Line: u32, } #[cfg(any(target_arch = "x86",))] impl INFCONTEXT {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for INFCONTEXT { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for INFCONTEXT { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for INFCONTEXT {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for INFCONTEXT { type Abi = Self; } pub const INFINFO_DEFAULT_SEARCH: u32 = 3u32; pub const INFINFO_INF_NAME_IS_ABSOLUTE: u32 = 2u32; pub const INFINFO_INF_PATH_LIST_SEARCH: u32 = 5u32; pub const INFINFO_INF_SPEC_IS_HINF: u32 = 1u32; pub const INFINFO_REVERSE_DEFAULT_SEARCH: u32 = 4u32; pub const INF_STYLE_CACHE_DISABLE: u32 = 32u32; pub const INF_STYLE_CACHE_ENABLE: u32 = 16u32; pub const INF_STYLE_CACHE_IGNORE: u32 = 64u32; pub const INSTALLFLAG_BITS: u32 = 7u32; pub const INSTALLFLAG_FORCE: u32 = 1u32; pub const INSTALLFLAG_NONINTERACTIVE: u32 = 4u32; pub const INSTALLFLAG_READONLY: u32 = 2u32; pub const IOA_Local: u32 = 255u32; pub const IO_ALIAS_10_BIT_DECODE: u32 = 4u32; pub const IO_ALIAS_12_BIT_DECODE: u32 = 16u32; pub const IO_ALIAS_16_BIT_DECODE: u32 = 0u32; pub const IO_ALIAS_POSITIVE_DECODE: u32 = 255u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct IO_DES { pub IOD_Count: u32, pub IOD_Type: u32, pub IOD_Alloc_Base: u64, pub IOD_Alloc_End: u64, pub IOD_DesFlags: u32, } impl IO_DES {} impl ::core::default::Default for IO_DES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for IO_DES { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for IO_DES {} unsafe impl ::windows::core::Abi for IO_DES { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct IO_RANGE { pub IOR_Align: u64, pub IOR_nPorts: u32, pub IOR_Min: u64, pub IOR_Max: u64, pub IOR_RangeFlags: u32, pub IOR_Alias: u64, } impl IO_RANGE {} impl ::core::default::Default for IO_RANGE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for IO_RANGE { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for IO_RANGE {} unsafe impl ::windows::core::Abi for IO_RANGE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct IO_RESOURCE { pub IO_Header: IO_DES, pub IO_Data: [IO_RANGE; 1], } impl IO_RESOURCE {} impl ::core::default::Default for IO_RESOURCE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for IO_RESOURCE { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for IO_RESOURCE {} unsafe impl ::windows::core::Abi for IO_RESOURCE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct IRQ_DES_32 { pub IRQD_Count: u32, pub IRQD_Type: u32, pub IRQD_Flags: u32, pub IRQD_Alloc_Num: u32, pub IRQD_Affinity: u32, } impl IRQ_DES_32 {} impl ::core::default::Default for IRQ_DES_32 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for IRQ_DES_32 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for IRQ_DES_32 {} unsafe impl ::windows::core::Abi for IRQ_DES_32 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct IRQ_DES_64 { pub IRQD_Count: u32, pub IRQD_Type: u32, pub IRQD_Flags: u32, pub IRQD_Alloc_Num: u32, pub IRQD_Affinity: u64, } impl IRQ_DES_64 {} impl ::core::default::Default for IRQ_DES_64 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for IRQ_DES_64 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for IRQ_DES_64 {} unsafe impl ::windows::core::Abi for IRQ_DES_64 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct IRQ_RANGE { pub IRQR_Min: u32, pub IRQR_Max: u32, pub IRQR_Flags: u32, } impl IRQ_RANGE {} impl ::core::default::Default for IRQ_RANGE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for IRQ_RANGE { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for IRQ_RANGE {} unsafe impl ::windows::core::Abi for IRQ_RANGE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct IRQ_RESOURCE_32 { pub IRQ_Header: IRQ_DES_32, pub IRQ_Data: [IRQ_RANGE; 1], } impl IRQ_RESOURCE_32 {} impl ::core::default::Default for IRQ_RESOURCE_32 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for IRQ_RESOURCE_32 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for IRQ_RESOURCE_32 {} unsafe impl ::windows::core::Abi for IRQ_RESOURCE_32 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct IRQ_RESOURCE_64 { pub IRQ_Header: IRQ_DES_64, pub IRQ_Data: [IRQ_RANGE; 1], } impl IRQ_RESOURCE_64 {} impl ::core::default::Default for IRQ_RESOURCE_64 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for IRQ_RESOURCE_64 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for IRQ_RESOURCE_64 {} unsafe impl ::windows::core::Abi for IRQ_RESOURCE_64 { type Abi = Self; } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn InstallHinfSectionA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HINSTANCE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(window: Param0, modulehandle: Param1, commandline: Param2, showcommand: i32) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn InstallHinfSectionA(window: super::super::Foundation::HWND, modulehandle: super::super::Foundation::HINSTANCE, commandline: super::super::Foundation::PSTR, showcommand: i32); } ::core::mem::transmute(InstallHinfSectionA(window.into_param().abi(), modulehandle.into_param().abi(), commandline.into_param().abi(), ::core::mem::transmute(showcommand))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn InstallHinfSectionW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HINSTANCE>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(window: Param0, modulehandle: Param1, commandline: Param2, showcommand: i32) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn InstallHinfSectionW(window: super::super::Foundation::HWND, modulehandle: super::super::Foundation::HINSTANCE, commandline: super::super::Foundation::PWSTR, showcommand: i32); } ::core::mem::transmute(InstallHinfSectionW(window.into_param().abi(), modulehandle.into_param().abi(), commandline.into_param().abi(), ::core::mem::transmute(showcommand))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } pub const LCPRI_BOOTCONFIG: u32 = 1u32; pub const LCPRI_DESIRED: u32 = 8192u32; pub const LCPRI_DISABLED: u32 = 65535u32; pub const LCPRI_FORCECONFIG: u32 = 0u32; pub const LCPRI_HARDRECONFIG: u32 = 49152u32; pub const LCPRI_HARDWIRED: u32 = 57344u32; pub const LCPRI_IMPOSSIBLE: u32 = 61440u32; pub const LCPRI_LASTBESTCONFIG: u32 = 16383u32; pub const LCPRI_LASTSOFTCONFIG: u32 = 32767u32; pub const LCPRI_NORMAL: u32 = 12288u32; pub const LCPRI_POWEROFF: u32 = 40960u32; pub const LCPRI_REBOOT: u32 = 36864u32; pub const LCPRI_RESTART: u32 = 32768u32; pub const LCPRI_SUBOPTIMAL: u32 = 20480u32; pub const LINE_LEN: u32 = 256u32; pub const LOG_CONF_BITS: u32 = 7u32; pub const LogSevError: u32 = 2u32; pub const LogSevFatalError: u32 = 3u32; pub const LogSevInformation: u32 = 0u32; pub const LogSevMaximum: u32 = 4u32; pub const LogSevWarning: u32 = 1u32; pub const MAX_CLASS_NAME_LEN: u32 = 32u32; pub const MAX_CONFIG_VALUE: u32 = 9999u32; pub const MAX_DEVICE_ID_LEN: u32 = 200u32; pub const MAX_DEVNODE_ID_LEN: u32 = 200u32; pub const MAX_DMA_CHANNELS: u32 = 7u32; pub const MAX_GUID_STRING_LEN: u32 = 39u32; pub const MAX_IDD_DYNAWIZ_RESOURCE_ID: u32 = 11000u32; pub const MAX_INFSTR_STRKEY_LEN: u32 = 32u32; pub const MAX_INF_FLAG: u32 = 20u32; pub const MAX_INF_SECTION_NAME_LENGTH: u32 = 255u32; pub const MAX_INF_STRING_LENGTH: u32 = 4096u32; pub const MAX_INSTALLWIZARD_DYNAPAGES: u32 = 20u32; pub const MAX_INSTANCE_VALUE: u32 = 9999u32; pub const MAX_INSTRUCTION_LEN: u32 = 256u32; pub const MAX_IO_PORTS: u32 = 20u32; pub const MAX_IRQS: u32 = 7u32; pub const MAX_KEY_LEN: u32 = 100u32; pub const MAX_LABEL_LEN: u32 = 30u32; pub const MAX_LCPRI: u32 = 65535u32; pub const MAX_MEM_REGISTERS: u32 = 9u32; pub const MAX_PRIORITYSTR_LEN: u32 = 16u32; pub const MAX_PROFILE_LEN: u32 = 80u32; pub const MAX_SERVICE_NAME_LEN: u32 = 256u32; pub const MAX_SUBTITLE_LEN: u32 = 256u32; pub const MAX_TITLE_LEN: u32 = 60u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct MEM_DES { pub MD_Count: u32, pub MD_Type: u32, pub MD_Alloc_Base: u64, pub MD_Alloc_End: u64, pub MD_Flags: u32, pub MD_Reserved: u32, } impl MEM_DES {} impl ::core::default::Default for MEM_DES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for MEM_DES { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for MEM_DES {} unsafe impl ::windows::core::Abi for MEM_DES { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct MEM_RANGE { pub MR_Align: u64, pub MR_nBytes: u32, pub MR_Min: u64, pub MR_Max: u64, pub MR_Flags: u32, pub MR_Reserved: u32, } impl MEM_RANGE {} impl ::core::default::Default for MEM_RANGE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for MEM_RANGE { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for MEM_RANGE {} unsafe impl ::windows::core::Abi for MEM_RANGE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct MEM_RESOURCE { pub MEM_Header: MEM_DES, pub MEM_Data: [MEM_RANGE; 1], } impl MEM_RESOURCE {} impl ::core::default::Default for MEM_RESOURCE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for MEM_RESOURCE { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for MEM_RESOURCE {} unsafe impl ::windows::core::Abi for MEM_RESOURCE { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct MFCARD_DES { pub PMF_Count: u32, pub PMF_Type: u32, pub PMF_Flags: u32, pub PMF_ConfigOptions: u8, pub PMF_IoResourceIndex: u8, pub PMF_Reserved: [u8; 2], pub PMF_ConfigRegisterBase: u32, } impl MFCARD_DES {} impl ::core::default::Default for MFCARD_DES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for MFCARD_DES { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for MFCARD_DES {} unsafe impl ::windows::core::Abi for MFCARD_DES { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct MFCARD_RESOURCE { pub MfCard_Header: MFCARD_DES, } impl MFCARD_RESOURCE {} impl ::core::default::Default for MFCARD_RESOURCE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for MFCARD_RESOURCE { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for MFCARD_RESOURCE {} unsafe impl ::windows::core::Abi for MFCARD_RESOURCE { type Abi = Self; } pub const MIN_IDD_DYNAWIZ_RESOURCE_ID: u32 = 10000u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct Mem_Large_Des_s { pub MLD_Count: u32, pub MLD_Type: u32, pub MLD_Alloc_Base: u64, pub MLD_Alloc_End: u64, pub MLD_Flags: u32, pub MLD_Reserved: u32, } impl Mem_Large_Des_s {} impl ::core::default::Default for Mem_Large_Des_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for Mem_Large_Des_s { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for Mem_Large_Des_s {} unsafe impl ::windows::core::Abi for Mem_Large_Des_s { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct Mem_Large_Range_s { pub MLR_Align: u64, pub MLR_nBytes: u64, pub MLR_Min: u64, pub MLR_Max: u64, pub MLR_Flags: u32, pub MLR_Reserved: u32, } impl Mem_Large_Range_s {} impl ::core::default::Default for Mem_Large_Range_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for Mem_Large_Range_s { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for Mem_Large_Range_s {} unsafe impl ::windows::core::Abi for Mem_Large_Range_s { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct Mem_Large_Resource_s { pub MEM_LARGE_Header: Mem_Large_Des_s, pub MEM_LARGE_Data: [Mem_Large_Range_s; 1], } impl Mem_Large_Resource_s {} impl ::core::default::Default for Mem_Large_Resource_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for Mem_Large_Resource_s { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for Mem_Large_Resource_s {} unsafe impl ::windows::core::Abi for Mem_Large_Resource_s { type Abi = Self; } pub const NDW_INSTALLFLAG_CI_PICKED_OEM: u32 = 32768u32; pub const NDW_INSTALLFLAG_DIDFACTDEFS: u32 = 1u32; pub const NDW_INSTALLFLAG_EXPRESSINTRO: u32 = 1024u32; pub const NDW_INSTALLFLAG_HARDWAREALLREADYIN: u32 = 2u32; pub const NDW_INSTALLFLAG_INSTALLSPECIFIC: u32 = 8192u32; pub const NDW_INSTALLFLAG_KNOWNCLASS: u32 = 524288u32; pub const NDW_INSTALLFLAG_NEEDREBOOT: i32 = 256i32; pub const NDW_INSTALLFLAG_NEEDRESTART: i32 = 128i32; pub const NDW_INSTALLFLAG_NEEDSHUTDOWN: u32 = 512u32; pub const NDW_INSTALLFLAG_NODETECTEDDEVS: u32 = 4096u32; pub const NDW_INSTALLFLAG_PCMCIADEVICE: u32 = 131072u32; pub const NDW_INSTALLFLAG_PCMCIAMODE: u32 = 65536u32; pub const NDW_INSTALLFLAG_SKIPCLASSLIST: u32 = 16384u32; pub const NDW_INSTALLFLAG_SKIPISDEVINSTALLED: u32 = 2048u32; pub const NDW_INSTALLFLAG_USERCANCEL: u32 = 262144u32; pub const NUM_CM_PROB: u32 = 58u32; pub const NUM_CM_PROB_V1: u32 = 37u32; pub const NUM_CM_PROB_V2: u32 = 50u32; pub const NUM_CM_PROB_V3: u32 = 51u32; pub const NUM_CM_PROB_V4: u32 = 52u32; pub const NUM_CM_PROB_V5: u32 = 53u32; pub const NUM_CM_PROB_V6: u32 = 54u32; pub const NUM_CM_PROB_V7: u32 = 55u32; pub const NUM_CM_PROB_V8: u32 = 57u32; pub const NUM_CM_PROB_V9: u32 = 58u32; pub const NUM_LOG_CONF: u32 = 6u32; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct OEM_SOURCE_MEDIA_TYPE(pub u32); pub const SPOST_NONE: OEM_SOURCE_MEDIA_TYPE = OEM_SOURCE_MEDIA_TYPE(0u32); pub const SPOST_PATH: OEM_SOURCE_MEDIA_TYPE = OEM_SOURCE_MEDIA_TYPE(1u32); pub const SPOST_URL: OEM_SOURCE_MEDIA_TYPE = OEM_SOURCE_MEDIA_TYPE(2u32); impl ::core::convert::From<u32> for OEM_SOURCE_MEDIA_TYPE { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for OEM_SOURCE_MEDIA_TYPE { type Abi = Self; } impl ::core::ops::BitOr for OEM_SOURCE_MEDIA_TYPE { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for OEM_SOURCE_MEDIA_TYPE { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for OEM_SOURCE_MEDIA_TYPE { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for OEM_SOURCE_MEDIA_TYPE { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for OEM_SOURCE_MEDIA_TYPE { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } pub const OVERRIDE_LOG_CONF: u32 = 5u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] pub struct PCCARD_DES { pub PCD_Count: u32, pub PCD_Type: u32, pub PCD_Flags: u32, pub PCD_ConfigIndex: u8, pub PCD_Reserved: [u8; 3], pub PCD_MemoryCardBase1: u32, pub PCD_MemoryCardBase2: u32, pub PCD_MemoryCardBase: [u32; 2], pub PCD_MemoryFlags: [u16; 2], pub PCD_IoFlags: [u8; 2], } impl PCCARD_DES {} impl ::core::default::Default for PCCARD_DES { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for PCCARD_DES { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for PCCARD_DES {} unsafe impl ::windows::core::Abi for PCCARD_DES { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct PCCARD_RESOURCE { pub PcCard_Header: PCCARD_DES, } impl PCCARD_RESOURCE {} impl ::core::default::Default for PCCARD_RESOURCE { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::cmp::PartialEq for PCCARD_RESOURCE { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } impl ::core::cmp::Eq for PCCARD_RESOURCE {} unsafe impl ::windows::core::Abi for PCCARD_RESOURCE { type Abi = Self; } pub const PCD_MAX_IO: u32 = 2u32; pub const PCD_MAX_MEMORY: u32 = 2u32; pub type PCM_NOTIFY_CALLBACK = unsafe extern "system" fn(hnotify: HCMNOTIFICATION, context: *const ::core::ffi::c_void, action: CM_NOTIFY_ACTION, eventdata: *const CM_NOTIFY_EVENT_DATA, eventdatasize: u32) -> u32; #[cfg(feature = "Win32_Foundation")] pub type PDETECT_PROGRESS_NOTIFY = unsafe extern "system" fn(progressnotifyparam: *const ::core::ffi::c_void, detectcomplete: u32) -> super::super::Foundation::BOOL; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct PNP_VETO_TYPE(pub i32); pub const PNP_VetoTypeUnknown: PNP_VETO_TYPE = PNP_VETO_TYPE(0i32); pub const PNP_VetoLegacyDevice: PNP_VETO_TYPE = PNP_VETO_TYPE(1i32); pub const PNP_VetoPendingClose: PNP_VETO_TYPE = PNP_VETO_TYPE(2i32); pub const PNP_VetoWindowsApp: PNP_VETO_TYPE = PNP_VETO_TYPE(3i32); pub const PNP_VetoWindowsService: PNP_VETO_TYPE = PNP_VETO_TYPE(4i32); pub const PNP_VetoOutstandingOpen: PNP_VETO_TYPE = PNP_VETO_TYPE(5i32); pub const PNP_VetoDevice: PNP_VETO_TYPE = PNP_VETO_TYPE(6i32); pub const PNP_VetoDriver: PNP_VETO_TYPE = PNP_VETO_TYPE(7i32); pub const PNP_VetoIllegalDeviceRequest: PNP_VETO_TYPE = PNP_VETO_TYPE(8i32); pub const PNP_VetoInsufficientPower: PNP_VETO_TYPE = PNP_VETO_TYPE(9i32); pub const PNP_VetoNonDisableable: PNP_VETO_TYPE = PNP_VETO_TYPE(10i32); pub const PNP_VetoLegacyDriver: PNP_VETO_TYPE = PNP_VETO_TYPE(11i32); pub const PNP_VetoInsufficientRights: PNP_VETO_TYPE = PNP_VETO_TYPE(12i32); pub const PNP_VetoAlreadyRemoved: PNP_VETO_TYPE = PNP_VETO_TYPE(13i32); impl ::core::convert::From<i32> for PNP_VETO_TYPE { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for PNP_VETO_TYPE { type Abi = Self; } pub const PRIORITY_BIT: u32 = 8u32; pub const PRIORITY_EQUAL_FIRST: u32 = 8u32; pub const PRIORITY_EQUAL_LAST: u32 = 0u32; pub type PSP_DETSIG_CMPPROC = unsafe extern "system" fn(deviceinfoset: *const ::core::ffi::c_void, newdevicedata: *const SP_DEVINFO_DATA, existingdevicedata: *const SP_DEVINFO_DATA, comparecontext: *const ::core::ffi::c_void) -> u32; pub type PSP_FILE_CALLBACK_A = unsafe extern "system" fn(context: *const ::core::ffi::c_void, notification: u32, param1: usize, param2: usize) -> u32; pub type PSP_FILE_CALLBACK_W = unsafe extern "system" fn(context: *const ::core::ffi::c_void, notification: u32, param1: usize, param2: usize) -> u32; pub const ROLLBACK_BITS: u32 = 1u32; pub const ROLLBACK_FLAG_NO_UI: u32 = 1u32; pub const RegDisposition_Bits: u32 = 1u32; pub const RegDisposition_OpenAlways: u32 = 0u32; pub const RegDisposition_OpenExisting: u32 = 1u32; pub const ResType_All: u32 = 0u32; pub const ResType_BusNumber: u32 = 6u32; pub const ResType_ClassSpecific: u32 = 65535u32; pub const ResType_Connection: u32 = 32772u32; pub const ResType_DMA: u32 = 3u32; pub const ResType_DevicePrivate: u32 = 32769u32; pub const ResType_DoNotUse: u32 = 5u32; pub const ResType_IO: u32 = 2u32; pub const ResType_IRQ: u32 = 4u32; pub const ResType_Ignored_Bit: u32 = 32768u32; pub const ResType_MAX: u32 = 7u32; pub const ResType_Mem: u32 = 1u32; pub const ResType_MemLarge: u32 = 7u32; pub const ResType_MfCardConfig: u32 = 32771u32; pub const ResType_None: u32 = 0u32; pub const ResType_PcCardConfig: u32 = 32770u32; pub const ResType_Reserved: u32 = 32768u32; pub const SCWMI_CLOBBER_SECURITY: u32 = 1u32; pub const SETDIRID_NOT_FULL_PATH: 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 SETUP_DI_BUILD_DRIVER_DRIVER_TYPE(pub u32); pub const SPDIT_CLASSDRIVER: SETUP_DI_BUILD_DRIVER_DRIVER_TYPE = SETUP_DI_BUILD_DRIVER_DRIVER_TYPE(1u32); pub const SPDIT_COMPATDRIVER: SETUP_DI_BUILD_DRIVER_DRIVER_TYPE = SETUP_DI_BUILD_DRIVER_DRIVER_TYPE(2u32); impl ::core::convert::From<u32> for SETUP_DI_BUILD_DRIVER_DRIVER_TYPE { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SETUP_DI_BUILD_DRIVER_DRIVER_TYPE { type Abi = Self; } impl ::core::ops::BitOr for SETUP_DI_BUILD_DRIVER_DRIVER_TYPE { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for SETUP_DI_BUILD_DRIVER_DRIVER_TYPE { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for SETUP_DI_BUILD_DRIVER_DRIVER_TYPE { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for SETUP_DI_BUILD_DRIVER_DRIVER_TYPE { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for SETUP_DI_BUILD_DRIVER_DRIVER_TYPE { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct SETUP_FILE_OPERATION(pub u32); pub const FILEOP_DELETE: SETUP_FILE_OPERATION = SETUP_FILE_OPERATION(2u32); pub const FILEOP_COPY: SETUP_FILE_OPERATION = SETUP_FILE_OPERATION(0u32); impl ::core::convert::From<u32> for SETUP_FILE_OPERATION { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SETUP_FILE_OPERATION { type Abi = Self; } impl ::core::ops::BitOr for SETUP_FILE_OPERATION { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for SETUP_FILE_OPERATION { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for SETUP_FILE_OPERATION { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for SETUP_FILE_OPERATION { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for SETUP_FILE_OPERATION { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } pub const SIGNERSCORE_AUTHENTICODE: u32 = 251658240u32; pub const SIGNERSCORE_INBOX: u32 = 218103811u32; pub const SIGNERSCORE_LOGO_PREMIUM: u32 = 218103809u32; pub const SIGNERSCORE_LOGO_STANDARD: u32 = 218103810u32; pub const SIGNERSCORE_MASK: u32 = 4278190080u32; pub const SIGNERSCORE_SIGNED_MASK: u32 = 4026531840u32; pub const SIGNERSCORE_UNCLASSIFIED: u32 = 218103812u32; pub const SIGNERSCORE_UNKNOWN: u32 = 4278190080u32; pub const SIGNERSCORE_UNSIGNED: u32 = 2147483648u32; pub const SIGNERSCORE_W9X_SUSPECT: u32 = 3221225472u32; pub const SIGNERSCORE_WHQL: u32 = 218103813u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] pub struct SOURCE_MEDIA_A { pub Reserved: super::super::Foundation::PSTR, pub Tagfile: super::super::Foundation::PSTR, pub Description: super::super::Foundation::PSTR, pub SourcePath: super::super::Foundation::PSTR, pub SourceFile: super::super::Foundation::PSTR, pub Flags: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SOURCE_MEDIA_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SOURCE_MEDIA_A { 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 SOURCE_MEDIA_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SOURCE_MEDIA_A").field("Reserved", &self.Reserved).field("Tagfile", &self.Tagfile).field("Description", &self.Description).field("SourcePath", &self.SourcePath).field("SourceFile", &self.SourceFile).field("Flags", &self.Flags).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SOURCE_MEDIA_A { fn eq(&self, other: &Self) -> bool { self.Reserved == other.Reserved && self.Tagfile == other.Tagfile && self.Description == other.Description && self.SourcePath == other.SourcePath && self.SourceFile == other.SourceFile && self.Flags == other.Flags } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SOURCE_MEDIA_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SOURCE_MEDIA_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SOURCE_MEDIA_A { pub Reserved: super::super::Foundation::PSTR, pub Tagfile: super::super::Foundation::PSTR, pub Description: super::super::Foundation::PSTR, pub SourcePath: super::super::Foundation::PSTR, pub SourceFile: super::super::Foundation::PSTR, pub Flags: u32, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SOURCE_MEDIA_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SOURCE_MEDIA_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SOURCE_MEDIA_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SOURCE_MEDIA_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SOURCE_MEDIA_A { 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 SOURCE_MEDIA_W { pub Reserved: super::super::Foundation::PWSTR, pub Tagfile: super::super::Foundation::PWSTR, pub Description: super::super::Foundation::PWSTR, pub SourcePath: super::super::Foundation::PWSTR, pub SourceFile: super::super::Foundation::PWSTR, pub Flags: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SOURCE_MEDIA_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SOURCE_MEDIA_W { 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 SOURCE_MEDIA_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SOURCE_MEDIA_W").field("Reserved", &self.Reserved).field("Tagfile", &self.Tagfile).field("Description", &self.Description).field("SourcePath", &self.SourcePath).field("SourceFile", &self.SourceFile).field("Flags", &self.Flags).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SOURCE_MEDIA_W { fn eq(&self, other: &Self) -> bool { self.Reserved == other.Reserved && self.Tagfile == other.Tagfile && self.Description == other.Description && self.SourcePath == other.SourcePath && self.SourceFile == other.SourceFile && self.Flags == other.Flags } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SOURCE_MEDIA_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SOURCE_MEDIA_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SOURCE_MEDIA_W { pub Reserved: super::super::Foundation::PWSTR, pub Tagfile: super::super::Foundation::PWSTR, pub Description: super::super::Foundation::PWSTR, pub SourcePath: super::super::Foundation::PWSTR, pub SourceFile: super::super::Foundation::PWSTR, pub Flags: u32, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SOURCE_MEDIA_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SOURCE_MEDIA_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SOURCE_MEDIA_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SOURCE_MEDIA_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SOURCE_MEDIA_W { type Abi = Self; } pub const SPCRP_CHARACTERISTICS: u32 = 27u32; pub const SPCRP_DEVTYPE: u32 = 25u32; pub const SPCRP_EXCLUSIVE: u32 = 26u32; pub const SPCRP_LOWERFILTERS: u32 = 18u32; pub const SPCRP_MAXIMUM_PROPERTY: u32 = 28u32; pub const SPCRP_SECURITY: u32 = 23u32; pub const SPCRP_SECURITY_SDS: u32 = 24u32; pub const SPCRP_UPPERFILTERS: u32 = 17u32; pub const SPDIT_NODRIVER: u32 = 0u32; pub const SPDRP_ADDRESS: u32 = 28u32; pub const SPDRP_BASE_CONTAINERID: u32 = 36u32; pub const SPDRP_BUSNUMBER: u32 = 21u32; pub const SPDRP_BUSTYPEGUID: u32 = 19u32; pub const SPDRP_CAPABILITIES: u32 = 15u32; pub const SPDRP_CHARACTERISTICS: u32 = 27u32; pub const SPDRP_CLASS: u32 = 7u32; pub const SPDRP_CLASSGUID: u32 = 8u32; pub const SPDRP_COMPATIBLEIDS: u32 = 2u32; pub const SPDRP_CONFIGFLAGS: u32 = 10u32; pub const SPDRP_DEVICEDESC: u32 = 0u32; pub const SPDRP_DEVICE_POWER_DATA: u32 = 30u32; pub const SPDRP_DEVTYPE: u32 = 25u32; pub const SPDRP_DRIVER: u32 = 9u32; pub const SPDRP_ENUMERATOR_NAME: u32 = 22u32; pub const SPDRP_EXCLUSIVE: u32 = 26u32; pub const SPDRP_FRIENDLYNAME: u32 = 12u32; pub const SPDRP_HARDWAREID: u32 = 1u32; pub const SPDRP_INSTALL_STATE: u32 = 34u32; pub const SPDRP_LEGACYBUSTYPE: u32 = 20u32; pub const SPDRP_LOCATION_INFORMATION: u32 = 13u32; pub const SPDRP_LOCATION_PATHS: u32 = 35u32; pub const SPDRP_LOWERFILTERS: u32 = 18u32; pub const SPDRP_MAXIMUM_PROPERTY: u32 = 37u32; pub const SPDRP_MFG: u32 = 11u32; pub const SPDRP_PHYSICAL_DEVICE_OBJECT_NAME: u32 = 14u32; pub const SPDRP_REMOVAL_POLICY: u32 = 31u32; pub const SPDRP_REMOVAL_POLICY_HW_DEFAULT: u32 = 32u32; pub const SPDRP_REMOVAL_POLICY_OVERRIDE: u32 = 33u32; pub const SPDRP_SECURITY: u32 = 23u32; pub const SPDRP_SECURITY_SDS: u32 = 24u32; pub const SPDRP_SERVICE: u32 = 4u32; pub const SPDRP_UI_NUMBER: u32 = 16u32; pub const SPDRP_UI_NUMBER_DESC_FORMAT: u32 = 29u32; pub const SPDRP_UNUSED0: u32 = 3u32; pub const SPDRP_UNUSED1: u32 = 5u32; pub const SPDRP_UNUSED2: u32 = 6u32; pub const SPDRP_UPPERFILTERS: u32 = 17u32; pub const SPDSL_DISALLOW_NEGATIVE_ADJUST: u32 = 2u32; pub const SPDSL_IGNORE_DISK: u32 = 1u32; pub const SPFILELOG_FORCENEW: u32 = 2u32; pub const SPFILELOG_OEMFILE: u32 = 1u32; pub const SPFILELOG_QUERYONLY: u32 = 4u32; pub const SPFILELOG_SYSTEMLOG: u32 = 1u32; pub const SPFILENOTIFY_BACKUPERROR: u32 = 22u32; pub const SPFILENOTIFY_CABINETINFO: u32 = 16u32; pub const SPFILENOTIFY_COPYERROR: u32 = 13u32; pub const SPFILENOTIFY_DELETEERROR: u32 = 7u32; pub const SPFILENOTIFY_ENDBACKUP: u32 = 23u32; pub const SPFILENOTIFY_ENDCOPY: u32 = 12u32; pub const SPFILENOTIFY_ENDDELETE: u32 = 6u32; pub const SPFILENOTIFY_ENDQUEUE: u32 = 2u32; pub const SPFILENOTIFY_ENDREGISTRATION: u32 = 32u32; pub const SPFILENOTIFY_ENDRENAME: u32 = 9u32; pub const SPFILENOTIFY_ENDSUBQUEUE: u32 = 4u32; pub const SPFILENOTIFY_FILEEXTRACTED: u32 = 19u32; pub const SPFILENOTIFY_FILEINCABINET: u32 = 17u32; pub const SPFILENOTIFY_FILEOPDELAYED: u32 = 20u32; pub const SPFILENOTIFY_LANGMISMATCH: u32 = 65536u32; pub const SPFILENOTIFY_NEEDMEDIA: u32 = 14u32; pub const SPFILENOTIFY_NEEDNEWCABINET: u32 = 18u32; pub const SPFILENOTIFY_QUEUESCAN: u32 = 15u32; pub const SPFILENOTIFY_QUEUESCAN_EX: u32 = 24u32; pub const SPFILENOTIFY_QUEUESCAN_SIGNERINFO: u32 = 64u32; pub const SPFILENOTIFY_RENAMEERROR: u32 = 10u32; pub const SPFILENOTIFY_STARTBACKUP: u32 = 21u32; pub const SPFILENOTIFY_STARTCOPY: u32 = 11u32; pub const SPFILENOTIFY_STARTDELETE: u32 = 5u32; pub const SPFILENOTIFY_STARTQUEUE: u32 = 1u32; pub const SPFILENOTIFY_STARTREGISTRATION: u32 = 25u32; pub const SPFILENOTIFY_STARTRENAME: u32 = 8u32; pub const SPFILENOTIFY_STARTSUBQUEUE: u32 = 3u32; pub const SPFILENOTIFY_TARGETEXISTS: u32 = 131072u32; pub const SPFILENOTIFY_TARGETNEWER: u32 = 262144u32; pub const SPFILEQ_FILE_IN_USE: u32 = 1u32; pub const SPFILEQ_REBOOT_IN_PROGRESS: u32 = 4u32; pub const SPFILEQ_REBOOT_RECOMMENDED: u32 = 2u32; pub const SPID_ACTIVE: u32 = 1u32; pub const SPID_DEFAULT: u32 = 2u32; pub const SPID_REMOVED: u32 = 4u32; pub const SPINST_ALL: u32 = 2047u32; pub const SPINST_BITREG: u32 = 32u32; pub const SPINST_COPYINF: u32 = 512u32; pub const SPINST_DEVICEINSTALL: u32 = 1048576u32; pub const SPINST_FILES: u32 = 16u32; pub const SPINST_INI2REG: u32 = 8u32; pub const SPINST_INIFILES: u32 = 2u32; pub const SPINST_LOGCONFIG: u32 = 1u32; pub const SPINST_LOGCONFIGS_ARE_OVERRIDES: u32 = 262144u32; pub const SPINST_LOGCONFIG_IS_FORCED: u32 = 131072u32; pub const SPINST_PROFILEITEMS: u32 = 256u32; pub const SPINST_PROPERTIES: u32 = 1024u32; pub const SPINST_REGISTERCALLBACKAWARE: u32 = 524288u32; pub const SPINST_REGISTRY: u32 = 4u32; pub const SPINST_REGSVR: u32 = 64u32; pub const SPINST_SINGLESECTION: u32 = 65536u32; pub const SPINST_UNREGSVR: u32 = 128u32; pub const SPINT_ACTIVE: u32 = 1u32; pub const SPINT_DEFAULT: u32 = 2u32; pub const SPINT_REMOVED: u32 = 4u32; pub const SPOST_MAX: u32 = 3u32; pub const SPPSR_ENUM_ADV_DEVICE_PROPERTIES: u32 = 3u32; pub const SPPSR_ENUM_BASIC_DEVICE_PROPERTIES: u32 = 2u32; pub const SPPSR_SELECT_DEVICE_RESOURCES: u32 = 1u32; pub const SPQ_DELAYED_COPY: u32 = 1u32; pub const SPQ_FLAG_ABORT_IF_UNSIGNED: u32 = 2u32; pub const SPQ_FLAG_BACKUP_AWARE: u32 = 1u32; pub const SPQ_FLAG_DO_SHUFFLEMOVE: u32 = 8u32; pub const SPQ_FLAG_FILES_MODIFIED: u32 = 4u32; pub const SPQ_FLAG_VALID: u32 = 15u32; pub const SPQ_SCAN_ACTIVATE_DRP: u32 = 1024u32; pub const SPQ_SCAN_FILE_COMPARISON: u32 = 512u32; pub const SPQ_SCAN_FILE_PRESENCE: u32 = 1u32; pub const SPQ_SCAN_FILE_PRESENCE_WITHOUT_SOURCE: u32 = 256u32; pub const SPQ_SCAN_FILE_VALIDITY: u32 = 2u32; pub const SPQ_SCAN_INFORM_USER: u32 = 16u32; pub const SPQ_SCAN_PRUNE_COPY_QUEUE: u32 = 32u32; pub const SPQ_SCAN_PRUNE_DELREN: u32 = 128u32; pub const SPQ_SCAN_USE_CALLBACK: u32 = 4u32; pub const SPQ_SCAN_USE_CALLBACKEX: u32 = 8u32; pub const SPQ_SCAN_USE_CALLBACK_SIGNERINFO: u32 = 64u32; pub const SPRDI_FIND_DUPS: u32 = 1u32; pub const SPREG_DLLINSTALL: u32 = 4u32; pub const SPREG_GETPROCADDR: u32 = 2u32; pub const SPREG_LOADLIBRARY: u32 = 1u32; pub const SPREG_REGSVR: u32 = 3u32; pub const SPREG_SUCCESS: u32 = 0u32; pub const SPREG_TIMEOUT: u32 = 5u32; pub const SPREG_UNKNOWN: u32 = 4294967295u32; pub const SPSVCINST_ASSOCSERVICE: u32 = 2u32; pub const SPSVCINST_CLOBBER_SECURITY: u32 = 1024u32; pub const SPSVCINST_DELETEEVENTLOGENTRY: u32 = 4u32; pub const SPSVCINST_NOCLOBBER_DELAYEDAUTOSTART: u32 = 32768u32; pub const SPSVCINST_NOCLOBBER_DEPENDENCIES: u32 = 128u32; pub const SPSVCINST_NOCLOBBER_DESCRIPTION: u32 = 256u32; pub const SPSVCINST_NOCLOBBER_DISPLAYNAME: u32 = 8u32; pub const SPSVCINST_NOCLOBBER_ERRORCONTROL: u32 = 32u32; pub const SPSVCINST_NOCLOBBER_LOADORDERGROUP: u32 = 64u32; pub const SPSVCINST_NOCLOBBER_REQUIREDPRIVILEGES: u32 = 4096u32; pub const SPSVCINST_NOCLOBBER_SERVICESIDTYPE: u32 = 16384u32; pub const SPSVCINST_NOCLOBBER_STARTTYPE: u32 = 16u32; pub const SPSVCINST_NOCLOBBER_TRIGGERS: u32 = 8192u32; pub const SPSVCINST_STARTSERVICE: u32 = 2048u32; pub const SPSVCINST_STOPSERVICE: u32 = 512u32; pub const SPSVCINST_TAGTOFRONT: u32 = 1u32; pub const SPSVCINST_UNIQUE_NAME: u32 = 65536u32; pub const SPWPT_SELECTDEVICE: u32 = 1u32; pub const SPWP_USE_DEVINFO_DATA: u32 = 1u32; pub const SP_ALTPLATFORM_FLAGS_SUITE_MASK: u32 = 2u32; pub const SP_ALTPLATFORM_FLAGS_VERSION_RANGE: u32 = 1u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] pub struct SP_ALTPLATFORM_INFO_V1 { pub cbSize: u32, pub Platform: super::super::System::Diagnostics::Debug::VER_PLATFORM, pub MajorVersion: u32, pub MinorVersion: u32, pub ProcessorArchitecture: u16, pub Reserved: u16, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl SP_ALTPLATFORM_INFO_V1 {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::default::Default for SP_ALTPLATFORM_INFO_V1 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::fmt::Debug for SP_ALTPLATFORM_INFO_V1 { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_ALTPLATFORM_INFO_V1").field("cbSize", &self.cbSize).field("Platform", &self.Platform).field("MajorVersion", &self.MajorVersion).field("MinorVersion", &self.MinorVersion).field("ProcessorArchitecture", &self.ProcessorArchitecture).field("Reserved", &self.Reserved).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::cmp::PartialEq for SP_ALTPLATFORM_INFO_V1 { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.Platform == other.Platform && self.MajorVersion == other.MajorVersion && self.MinorVersion == other.MinorVersion && self.ProcessorArchitecture == other.ProcessorArchitecture && self.Reserved == other.Reserved } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::cmp::Eq for SP_ALTPLATFORM_INFO_V1 {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] unsafe impl ::windows::core::Abi for SP_ALTPLATFORM_INFO_V1 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] pub struct SP_ALTPLATFORM_INFO_V1 { pub cbSize: u32, pub Platform: super::super::System::Diagnostics::Debug::VER_PLATFORM, pub MajorVersion: u32, pub MinorVersion: u32, pub ProcessorArchitecture: u16, pub Reserved: u16, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl SP_ALTPLATFORM_INFO_V1 {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::default::Default for SP_ALTPLATFORM_INFO_V1 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::cmp::PartialEq for SP_ALTPLATFORM_INFO_V1 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::cmp::Eq for SP_ALTPLATFORM_INFO_V1 {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] unsafe impl ::windows::core::Abi for SP_ALTPLATFORM_INFO_V1 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] pub struct SP_ALTPLATFORM_INFO_V2 { pub cbSize: u32, pub Platform: super::super::System::Diagnostics::Debug::VER_PLATFORM, pub MajorVersion: u32, pub MinorVersion: u32, pub ProcessorArchitecture: u16, pub Anonymous: SP_ALTPLATFORM_INFO_V2_0, pub FirstValidatedMajorVersion: u32, pub FirstValidatedMinorVersion: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl SP_ALTPLATFORM_INFO_V2 {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::default::Default for SP_ALTPLATFORM_INFO_V2 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::cmp::PartialEq for SP_ALTPLATFORM_INFO_V2 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::cmp::Eq for SP_ALTPLATFORM_INFO_V2 {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] unsafe impl ::windows::core::Abi for SP_ALTPLATFORM_INFO_V2 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] pub union SP_ALTPLATFORM_INFO_V2_0 { pub Reserved: u16, pub Flags: u16, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl SP_ALTPLATFORM_INFO_V2_0 {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::default::Default for SP_ALTPLATFORM_INFO_V2_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::cmp::PartialEq for SP_ALTPLATFORM_INFO_V2_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::cmp::Eq for SP_ALTPLATFORM_INFO_V2_0 {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] unsafe impl ::windows::core::Abi for SP_ALTPLATFORM_INFO_V2_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] pub struct SP_ALTPLATFORM_INFO_V2 { pub cbSize: u32, pub Platform: super::super::System::Diagnostics::Debug::VER_PLATFORM, pub MajorVersion: u32, pub MinorVersion: u32, pub ProcessorArchitecture: u16, pub Anonymous: SP_ALTPLATFORM_INFO_V2_0, pub FirstValidatedMajorVersion: u32, pub FirstValidatedMinorVersion: u32, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl SP_ALTPLATFORM_INFO_V2 {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::default::Default for SP_ALTPLATFORM_INFO_V2 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::cmp::PartialEq for SP_ALTPLATFORM_INFO_V2 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::cmp::Eq for SP_ALTPLATFORM_INFO_V2 {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] unsafe impl ::windows::core::Abi for SP_ALTPLATFORM_INFO_V2 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] pub union SP_ALTPLATFORM_INFO_V2_0 { pub Reserved: u16, pub Flags: u16, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl SP_ALTPLATFORM_INFO_V2_0 {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::default::Default for SP_ALTPLATFORM_INFO_V2_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::cmp::PartialEq for SP_ALTPLATFORM_INFO_V2_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] impl ::core::cmp::Eq for SP_ALTPLATFORM_INFO_V2_0 {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_System_Diagnostics_Debug")] unsafe impl ::windows::core::Abi for SP_ALTPLATFORM_INFO_V2_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_ALTPLATFORM_INFO_V3 { pub cbSize: u32, pub Platform: u32, pub MajorVersion: u32, pub MinorVersion: u32, pub ProcessorArchitecture: u16, pub Anonymous: SP_ALTPLATFORM_INFO_V3_0, pub FirstValidatedMajorVersion: u32, pub FirstValidatedMinorVersion: u32, pub ProductType: u8, pub SuiteMask: u16, pub BuildNumber: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_ALTPLATFORM_INFO_V3 {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_ALTPLATFORM_INFO_V3 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_ALTPLATFORM_INFO_V3 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_ALTPLATFORM_INFO_V3 {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_ALTPLATFORM_INFO_V3 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub union SP_ALTPLATFORM_INFO_V3_0 { pub Reserved: u16, pub Flags: u16, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_ALTPLATFORM_INFO_V3_0 {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_ALTPLATFORM_INFO_V3_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_ALTPLATFORM_INFO_V3_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_ALTPLATFORM_INFO_V3_0 {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_ALTPLATFORM_INFO_V3_0 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_ALTPLATFORM_INFO_V3 { pub cbSize: u32, pub Platform: u32, pub MajorVersion: u32, pub MinorVersion: u32, pub ProcessorArchitecture: u16, pub Anonymous: SP_ALTPLATFORM_INFO_V3_0, pub FirstValidatedMajorVersion: u32, pub FirstValidatedMinorVersion: u32, pub ProductType: u8, pub SuiteMask: u16, pub BuildNumber: u32, } #[cfg(any(target_arch = "x86",))] impl SP_ALTPLATFORM_INFO_V3 {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_ALTPLATFORM_INFO_V3 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_ALTPLATFORM_INFO_V3 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_ALTPLATFORM_INFO_V3 {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_ALTPLATFORM_INFO_V3 { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub union SP_ALTPLATFORM_INFO_V3_0 { pub Reserved: u16, pub Flags: u16, } #[cfg(any(target_arch = "x86",))] impl SP_ALTPLATFORM_INFO_V3_0 {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_ALTPLATFORM_INFO_V3_0 { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_ALTPLATFORM_INFO_V3_0 { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_ALTPLATFORM_INFO_V3_0 {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_ALTPLATFORM_INFO_V3_0 { type Abi = Self; } pub const SP_BACKUP_BACKUPPASS: u32 = 1u32; pub const SP_BACKUP_BOOTFILE: u32 = 8u32; pub const SP_BACKUP_DEMANDPASS: u32 = 2u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_BACKUP_QUEUE_PARAMS_V1_A { pub cbSize: u32, pub FullInfPath: [super::super::Foundation::CHAR; 260], pub FilenameOffset: i32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_BACKUP_QUEUE_PARAMS_V1_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_BACKUP_QUEUE_PARAMS_V1_A { 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 SP_BACKUP_QUEUE_PARAMS_V1_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_BACKUP_QUEUE_PARAMS_V1_A").field("cbSize", &self.cbSize).field("FullInfPath", &self.FullInfPath).field("FilenameOffset", &self.FilenameOffset).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_BACKUP_QUEUE_PARAMS_V1_A { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.FullInfPath == other.FullInfPath && self.FilenameOffset == other.FilenameOffset } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_BACKUP_QUEUE_PARAMS_V1_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_BACKUP_QUEUE_PARAMS_V1_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_BACKUP_QUEUE_PARAMS_V1_A { pub cbSize: u32, pub FullInfPath: [super::super::Foundation::CHAR; 260], pub FilenameOffset: i32, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_BACKUP_QUEUE_PARAMS_V1_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_BACKUP_QUEUE_PARAMS_V1_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_BACKUP_QUEUE_PARAMS_V1_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_BACKUP_QUEUE_PARAMS_V1_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_BACKUP_QUEUE_PARAMS_V1_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_BACKUP_QUEUE_PARAMS_V1_W { pub cbSize: u32, pub FullInfPath: [u16; 260], pub FilenameOffset: i32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_BACKUP_QUEUE_PARAMS_V1_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_BACKUP_QUEUE_PARAMS_V1_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_BACKUP_QUEUE_PARAMS_V1_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_BACKUP_QUEUE_PARAMS_V1_W").field("cbSize", &self.cbSize).field("FullInfPath", &self.FullInfPath).field("FilenameOffset", &self.FilenameOffset).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_BACKUP_QUEUE_PARAMS_V1_W { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.FullInfPath == other.FullInfPath && self.FilenameOffset == other.FilenameOffset } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_BACKUP_QUEUE_PARAMS_V1_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_BACKUP_QUEUE_PARAMS_V1_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_BACKUP_QUEUE_PARAMS_V1_W { pub cbSize: u32, pub FullInfPath: [u16; 260], pub FilenameOffset: i32, } #[cfg(any(target_arch = "x86",))] impl SP_BACKUP_QUEUE_PARAMS_V1_W {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_BACKUP_QUEUE_PARAMS_V1_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_BACKUP_QUEUE_PARAMS_V1_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_BACKUP_QUEUE_PARAMS_V1_W {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_BACKUP_QUEUE_PARAMS_V1_W { 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 SP_BACKUP_QUEUE_PARAMS_V2_A { pub cbSize: u32, pub FullInfPath: [super::super::Foundation::CHAR; 260], pub FilenameOffset: i32, pub ReinstallInstance: [super::super::Foundation::CHAR; 260], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_BACKUP_QUEUE_PARAMS_V2_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_BACKUP_QUEUE_PARAMS_V2_A { 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 SP_BACKUP_QUEUE_PARAMS_V2_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_BACKUP_QUEUE_PARAMS_V2_A").field("cbSize", &self.cbSize).field("FullInfPath", &self.FullInfPath).field("FilenameOffset", &self.FilenameOffset).field("ReinstallInstance", &self.ReinstallInstance).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_BACKUP_QUEUE_PARAMS_V2_A { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.FullInfPath == other.FullInfPath && self.FilenameOffset == other.FilenameOffset && self.ReinstallInstance == other.ReinstallInstance } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_BACKUP_QUEUE_PARAMS_V2_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_BACKUP_QUEUE_PARAMS_V2_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_BACKUP_QUEUE_PARAMS_V2_A { pub cbSize: u32, pub FullInfPath: [super::super::Foundation::CHAR; 260], pub FilenameOffset: i32, pub ReinstallInstance: [super::super::Foundation::CHAR; 260], } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_BACKUP_QUEUE_PARAMS_V2_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_BACKUP_QUEUE_PARAMS_V2_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_BACKUP_QUEUE_PARAMS_V2_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_BACKUP_QUEUE_PARAMS_V2_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_BACKUP_QUEUE_PARAMS_V2_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_BACKUP_QUEUE_PARAMS_V2_W { pub cbSize: u32, pub FullInfPath: [u16; 260], pub FilenameOffset: i32, pub ReinstallInstance: [u16; 260], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_BACKUP_QUEUE_PARAMS_V2_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_BACKUP_QUEUE_PARAMS_V2_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_BACKUP_QUEUE_PARAMS_V2_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_BACKUP_QUEUE_PARAMS_V2_W").field("cbSize", &self.cbSize).field("FullInfPath", &self.FullInfPath).field("FilenameOffset", &self.FilenameOffset).field("ReinstallInstance", &self.ReinstallInstance).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_BACKUP_QUEUE_PARAMS_V2_W { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.FullInfPath == other.FullInfPath && self.FilenameOffset == other.FilenameOffset && self.ReinstallInstance == other.ReinstallInstance } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_BACKUP_QUEUE_PARAMS_V2_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_BACKUP_QUEUE_PARAMS_V2_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_BACKUP_QUEUE_PARAMS_V2_W { pub cbSize: u32, pub FullInfPath: [u16; 260], pub FilenameOffset: i32, pub ReinstallInstance: [u16; 260], } #[cfg(any(target_arch = "x86",))] impl SP_BACKUP_QUEUE_PARAMS_V2_W {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_BACKUP_QUEUE_PARAMS_V2_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_BACKUP_QUEUE_PARAMS_V2_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_BACKUP_QUEUE_PARAMS_V2_W {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_BACKUP_QUEUE_PARAMS_V2_W { type Abi = Self; } pub const SP_BACKUP_SPECIAL: u32 = 4u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_UI_Controls")] pub struct SP_CLASSIMAGELIST_DATA { pub cbSize: u32, pub ImageList: super::super::UI::Controls::HIMAGELIST, pub Reserved: usize, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_UI_Controls")] impl SP_CLASSIMAGELIST_DATA {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_UI_Controls")] impl ::core::default::Default for SP_CLASSIMAGELIST_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_UI_Controls")] impl ::core::fmt::Debug for SP_CLASSIMAGELIST_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_CLASSIMAGELIST_DATA").field("cbSize", &self.cbSize).field("ImageList", &self.ImageList).field("Reserved", &self.Reserved).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_UI_Controls")] impl ::core::cmp::PartialEq for SP_CLASSIMAGELIST_DATA { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.ImageList == other.ImageList && self.Reserved == other.Reserved } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_UI_Controls")] impl ::core::cmp::Eq for SP_CLASSIMAGELIST_DATA {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_UI_Controls")] unsafe impl ::windows::core::Abi for SP_CLASSIMAGELIST_DATA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_UI_Controls")] pub struct SP_CLASSIMAGELIST_DATA { pub cbSize: u32, pub ImageList: super::super::UI::Controls::HIMAGELIST, pub Reserved: usize, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_UI_Controls")] impl SP_CLASSIMAGELIST_DATA {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_UI_Controls")] impl ::core::default::Default for SP_CLASSIMAGELIST_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_UI_Controls")] impl ::core::cmp::PartialEq for SP_CLASSIMAGELIST_DATA { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_UI_Controls")] impl ::core::cmp::Eq for SP_CLASSIMAGELIST_DATA {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_UI_Controls")] unsafe impl ::windows::core::Abi for SP_CLASSIMAGELIST_DATA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_CLASSINSTALL_HEADER { pub cbSize: u32, pub InstallFunction: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_CLASSINSTALL_HEADER {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_CLASSINSTALL_HEADER { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_CLASSINSTALL_HEADER { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_CLASSINSTALL_HEADER").field("cbSize", &self.cbSize).field("InstallFunction", &self.InstallFunction).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_CLASSINSTALL_HEADER { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.InstallFunction == other.InstallFunction } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_CLASSINSTALL_HEADER {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_CLASSINSTALL_HEADER { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_CLASSINSTALL_HEADER { pub cbSize: u32, pub InstallFunction: u32, } #[cfg(any(target_arch = "x86",))] impl SP_CLASSINSTALL_HEADER {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_CLASSINSTALL_HEADER { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_CLASSINSTALL_HEADER { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_CLASSINSTALL_HEADER {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_CLASSINSTALL_HEADER { type Abi = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct SP_COPY_STYLE(pub u32); pub const SP_COPY_DELETESOURCE: SP_COPY_STYLE = SP_COPY_STYLE(1u32); pub const SP_COPY_REPLACEONLY: SP_COPY_STYLE = SP_COPY_STYLE(2u32); pub const SP_COPY_NEWER_OR_SAME: SP_COPY_STYLE = SP_COPY_STYLE(4u32); pub const SP_COPY_NEWER_ONLY: SP_COPY_STYLE = SP_COPY_STYLE(65536u32); pub const SP_COPY_NOOVERWRITE: SP_COPY_STYLE = SP_COPY_STYLE(8u32); pub const SP_COPY_NODECOMP: SP_COPY_STYLE = SP_COPY_STYLE(16u32); pub const SP_COPY_LANGUAGEAWARE: SP_COPY_STYLE = SP_COPY_STYLE(32u32); pub const SP_COPY_SOURCE_ABSOLUTE: SP_COPY_STYLE = SP_COPY_STYLE(64u32); pub const SP_COPY_SOURCEPATH_ABSOLUTE: SP_COPY_STYLE = SP_COPY_STYLE(128u32); pub const SP_COPY_FORCE_IN_USE: SP_COPY_STYLE = SP_COPY_STYLE(512u32); pub const SP_COPY_IN_USE_NEEDS_REBOOT: SP_COPY_STYLE = SP_COPY_STYLE(256u32); pub const SP_COPY_NOSKIP: SP_COPY_STYLE = SP_COPY_STYLE(1024u32); pub const SP_COPY_FORCE_NOOVERWRITE: SP_COPY_STYLE = SP_COPY_STYLE(4096u32); pub const SP_COPY_FORCE_NEWER: SP_COPY_STYLE = SP_COPY_STYLE(8192u32); pub const SP_COPY_WARNIFSKIP: SP_COPY_STYLE = SP_COPY_STYLE(16384u32); pub const SP_COPY_NOBROWSE: SP_COPY_STYLE = SP_COPY_STYLE(32768u32); pub const SP_COPY_NEWER: SP_COPY_STYLE = SP_COPY_STYLE(4u32); pub const SP_COPY_RESERVED: SP_COPY_STYLE = SP_COPY_STYLE(131072u32); pub const SP_COPY_OEMINF_CATALOG_ONLY: SP_COPY_STYLE = SP_COPY_STYLE(262144u32); pub const SP_COPY_REPLACE_BOOT_FILE: SP_COPY_STYLE = SP_COPY_STYLE(524288u32); pub const SP_COPY_NOPRUNE: SP_COPY_STYLE = SP_COPY_STYLE(1048576u32); pub const SP_COPY_OEM_F6_INF: SP_COPY_STYLE = SP_COPY_STYLE(2097152u32); pub const SP_COPY_ALREADYDECOMP: SP_COPY_STYLE = SP_COPY_STYLE(4194304u32); pub const SP_COPY_WINDOWS_SIGNED: SP_COPY_STYLE = SP_COPY_STYLE(16777216u32); pub const SP_COPY_PNPLOCKED: SP_COPY_STYLE = SP_COPY_STYLE(33554432u32); pub const SP_COPY_IN_USE_TRY_RENAME: SP_COPY_STYLE = SP_COPY_STYLE(67108864u32); pub const SP_COPY_INBOX_INF: SP_COPY_STYLE = SP_COPY_STYLE(134217728u32); pub const SP_COPY_HARDLINK: SP_COPY_STYLE = SP_COPY_STYLE(268435456u32); impl ::core::convert::From<u32> for SP_COPY_STYLE { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SP_COPY_STYLE { type Abi = Self; } impl ::core::ops::BitOr for SP_COPY_STYLE { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for SP_COPY_STYLE { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for SP_COPY_STYLE { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for SP_COPY_STYLE { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for SP_COPY_STYLE { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: clone :: Clone)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_DETECTDEVICE_PARAMS { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub DetectProgressNotify: ::core::option::Option<PDETECT_PROGRESS_NOTIFY>, pub ProgressNotifyParam: *mut ::core::ffi::c_void, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_DETECTDEVICE_PARAMS {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DETECTDEVICE_PARAMS { 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 SP_DETECTDEVICE_PARAMS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_DETECTDEVICE_PARAMS").field("ClassInstallHeader", &self.ClassInstallHeader).field("ProgressNotifyParam", &self.ProgressNotifyParam).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DETECTDEVICE_PARAMS { fn eq(&self, other: &Self) -> bool { self.ClassInstallHeader == other.ClassInstallHeader && self.DetectProgressNotify.map(|f| f as usize) == other.DetectProgressNotify.map(|f| f as usize) && self.ProgressNotifyParam == other.ProgressNotifyParam } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DETECTDEVICE_PARAMS {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DETECTDEVICE_PARAMS { type Abi = ::core::mem::ManuallyDrop<Self>; } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::clone::Clone for SP_DETECTDEVICE_PARAMS { fn clone(&self) -> Self { unimplemented!() } } #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_DETECTDEVICE_PARAMS { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub DetectProgressNotify: ::core::option::Option<PDETECT_PROGRESS_NOTIFY>, pub ProgressNotifyParam: *mut ::core::ffi::c_void, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_DETECTDEVICE_PARAMS {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DETECTDEVICE_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DETECTDEVICE_PARAMS { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DETECTDEVICE_PARAMS {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DETECTDEVICE_PARAMS { type Abi = ::core::mem::ManuallyDrop<Self>; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_DEVICE_INTERFACE_DATA { pub cbSize: u32, pub InterfaceClassGuid: ::windows::core::GUID, pub Flags: u32, pub Reserved: usize, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_DEVICE_INTERFACE_DATA {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_DEVICE_INTERFACE_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_DEVICE_INTERFACE_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_DEVICE_INTERFACE_DATA").field("cbSize", &self.cbSize).field("InterfaceClassGuid", &self.InterfaceClassGuid).field("Flags", &self.Flags).field("Reserved", &self.Reserved).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_DEVICE_INTERFACE_DATA { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.InterfaceClassGuid == other.InterfaceClassGuid && self.Flags == other.Flags && self.Reserved == other.Reserved } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_DEVICE_INTERFACE_DATA {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_DEVICE_INTERFACE_DATA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_DEVICE_INTERFACE_DATA { pub cbSize: u32, pub InterfaceClassGuid: ::windows::core::GUID, pub Flags: u32, pub Reserved: usize, } #[cfg(any(target_arch = "x86",))] impl SP_DEVICE_INTERFACE_DATA {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_DEVICE_INTERFACE_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_DEVICE_INTERFACE_DATA { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_DEVICE_INTERFACE_DATA {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_DEVICE_INTERFACE_DATA { 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 SP_DEVICE_INTERFACE_DETAIL_DATA_A { pub cbSize: u32, pub DevicePath: [super::super::Foundation::CHAR; 1], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_DEVICE_INTERFACE_DETAIL_DATA_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DEVICE_INTERFACE_DETAIL_DATA_A { 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 SP_DEVICE_INTERFACE_DETAIL_DATA_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_DEVICE_INTERFACE_DETAIL_DATA_A").field("cbSize", &self.cbSize).field("DevicePath", &self.DevicePath).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DEVICE_INTERFACE_DETAIL_DATA_A { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.DevicePath == other.DevicePath } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DEVICE_INTERFACE_DETAIL_DATA_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DEVICE_INTERFACE_DETAIL_DATA_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_DEVICE_INTERFACE_DETAIL_DATA_A { pub cbSize: u32, pub DevicePath: [super::super::Foundation::CHAR; 1], } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_DEVICE_INTERFACE_DETAIL_DATA_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DEVICE_INTERFACE_DETAIL_DATA_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DEVICE_INTERFACE_DETAIL_DATA_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DEVICE_INTERFACE_DETAIL_DATA_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DEVICE_INTERFACE_DETAIL_DATA_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_DEVICE_INTERFACE_DETAIL_DATA_W { pub cbSize: u32, pub DevicePath: [u16; 1], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_DEVICE_INTERFACE_DETAIL_DATA_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_DEVICE_INTERFACE_DETAIL_DATA_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_DEVICE_INTERFACE_DETAIL_DATA_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_DEVICE_INTERFACE_DETAIL_DATA_W").field("cbSize", &self.cbSize).field("DevicePath", &self.DevicePath).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_DEVICE_INTERFACE_DETAIL_DATA_W { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.DevicePath == other.DevicePath } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_DEVICE_INTERFACE_DETAIL_DATA_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_DEVICE_INTERFACE_DETAIL_DATA_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_DEVICE_INTERFACE_DETAIL_DATA_W { pub cbSize: u32, pub DevicePath: [u16; 1], } #[cfg(any(target_arch = "x86",))] impl SP_DEVICE_INTERFACE_DETAIL_DATA_W {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_DEVICE_INTERFACE_DETAIL_DATA_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_DEVICE_INTERFACE_DETAIL_DATA_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_DEVICE_INTERFACE_DETAIL_DATA_W {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_DEVICE_INTERFACE_DETAIL_DATA_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_DEVINFO_DATA { pub cbSize: u32, pub ClassGuid: ::windows::core::GUID, pub DevInst: u32, pub Reserved: usize, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_DEVINFO_DATA {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_DEVINFO_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_DEVINFO_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_DEVINFO_DATA").field("cbSize", &self.cbSize).field("ClassGuid", &self.ClassGuid).field("DevInst", &self.DevInst).field("Reserved", &self.Reserved).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_DEVINFO_DATA { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.ClassGuid == other.ClassGuid && self.DevInst == other.DevInst && self.Reserved == other.Reserved } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_DEVINFO_DATA {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_DEVINFO_DATA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_DEVINFO_DATA { pub cbSize: u32, pub ClassGuid: ::windows::core::GUID, pub DevInst: u32, pub Reserved: usize, } #[cfg(any(target_arch = "x86",))] impl SP_DEVINFO_DATA {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_DEVINFO_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_DEVINFO_DATA { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_DEVINFO_DATA {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_DEVINFO_DATA { 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 SP_DEVINFO_LIST_DETAIL_DATA_A { pub cbSize: u32, pub ClassGuid: ::windows::core::GUID, pub RemoteMachineHandle: super::super::Foundation::HANDLE, pub RemoteMachineName: [super::super::Foundation::CHAR; 263], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_DEVINFO_LIST_DETAIL_DATA_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DEVINFO_LIST_DETAIL_DATA_A { 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 SP_DEVINFO_LIST_DETAIL_DATA_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_DEVINFO_LIST_DETAIL_DATA_A").field("cbSize", &self.cbSize).field("ClassGuid", &self.ClassGuid).field("RemoteMachineHandle", &self.RemoteMachineHandle).field("RemoteMachineName", &self.RemoteMachineName).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DEVINFO_LIST_DETAIL_DATA_A { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.ClassGuid == other.ClassGuid && self.RemoteMachineHandle == other.RemoteMachineHandle && self.RemoteMachineName == other.RemoteMachineName } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DEVINFO_LIST_DETAIL_DATA_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DEVINFO_LIST_DETAIL_DATA_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_DEVINFO_LIST_DETAIL_DATA_A { pub cbSize: u32, pub ClassGuid: ::windows::core::GUID, pub RemoteMachineHandle: super::super::Foundation::HANDLE, pub RemoteMachineName: [super::super::Foundation::CHAR; 263], } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_DEVINFO_LIST_DETAIL_DATA_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DEVINFO_LIST_DETAIL_DATA_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DEVINFO_LIST_DETAIL_DATA_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DEVINFO_LIST_DETAIL_DATA_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DEVINFO_LIST_DETAIL_DATA_A { 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 SP_DEVINFO_LIST_DETAIL_DATA_W { pub cbSize: u32, pub ClassGuid: ::windows::core::GUID, pub RemoteMachineHandle: super::super::Foundation::HANDLE, pub RemoteMachineName: [u16; 263], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_DEVINFO_LIST_DETAIL_DATA_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DEVINFO_LIST_DETAIL_DATA_W { 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 SP_DEVINFO_LIST_DETAIL_DATA_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_DEVINFO_LIST_DETAIL_DATA_W").field("cbSize", &self.cbSize).field("ClassGuid", &self.ClassGuid).field("RemoteMachineHandle", &self.RemoteMachineHandle).field("RemoteMachineName", &self.RemoteMachineName).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DEVINFO_LIST_DETAIL_DATA_W { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.ClassGuid == other.ClassGuid && self.RemoteMachineHandle == other.RemoteMachineHandle && self.RemoteMachineName == other.RemoteMachineName } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DEVINFO_LIST_DETAIL_DATA_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DEVINFO_LIST_DETAIL_DATA_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_DEVINFO_LIST_DETAIL_DATA_W { pub cbSize: u32, pub ClassGuid: ::windows::core::GUID, pub RemoteMachineHandle: super::super::Foundation::HANDLE, pub RemoteMachineName: [u16; 263], } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_DEVINFO_LIST_DETAIL_DATA_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DEVINFO_LIST_DETAIL_DATA_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DEVINFO_LIST_DETAIL_DATA_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DEVINFO_LIST_DETAIL_DATA_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DEVINFO_LIST_DETAIL_DATA_W { type Abi = Self; } #[derive(:: core :: clone :: Clone)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_DEVINSTALL_PARAMS_A { pub cbSize: u32, pub Flags: u32, pub FlagsEx: u32, pub hwndParent: super::super::Foundation::HWND, pub InstallMsgHandler: ::core::option::Option<PSP_FILE_CALLBACK_A>, pub InstallMsgHandlerContext: *mut ::core::ffi::c_void, pub FileQueue: *mut ::core::ffi::c_void, pub ClassInstallReserved: usize, pub Reserved: u32, pub DriverPath: [super::super::Foundation::CHAR; 260], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_DEVINSTALL_PARAMS_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DEVINSTALL_PARAMS_A { 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 SP_DEVINSTALL_PARAMS_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_DEVINSTALL_PARAMS_A") .field("cbSize", &self.cbSize) .field("Flags", &self.Flags) .field("FlagsEx", &self.FlagsEx) .field("hwndParent", &self.hwndParent) .field("InstallMsgHandlerContext", &self.InstallMsgHandlerContext) .field("FileQueue", &self.FileQueue) .field("ClassInstallReserved", &self.ClassInstallReserved) .field("Reserved", &self.Reserved) .field("DriverPath", &self.DriverPath) .finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DEVINSTALL_PARAMS_A { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.Flags == other.Flags && self.FlagsEx == other.FlagsEx && self.hwndParent == other.hwndParent && self.InstallMsgHandler.map(|f| f as usize) == other.InstallMsgHandler.map(|f| f as usize) && self.InstallMsgHandlerContext == other.InstallMsgHandlerContext && self.FileQueue == other.FileQueue && self.ClassInstallReserved == other.ClassInstallReserved && self.Reserved == other.Reserved && self.DriverPath == other.DriverPath } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DEVINSTALL_PARAMS_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DEVINSTALL_PARAMS_A { type Abi = ::core::mem::ManuallyDrop<Self>; } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::clone::Clone for SP_DEVINSTALL_PARAMS_A { fn clone(&self) -> Self { unimplemented!() } } #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_DEVINSTALL_PARAMS_A { pub cbSize: u32, pub Flags: u32, pub FlagsEx: u32, pub hwndParent: super::super::Foundation::HWND, pub InstallMsgHandler: ::core::option::Option<PSP_FILE_CALLBACK_A>, pub InstallMsgHandlerContext: *mut ::core::ffi::c_void, pub FileQueue: *mut ::core::ffi::c_void, pub ClassInstallReserved: usize, pub Reserved: u32, pub DriverPath: [super::super::Foundation::CHAR; 260], } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_DEVINSTALL_PARAMS_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DEVINSTALL_PARAMS_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DEVINSTALL_PARAMS_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DEVINSTALL_PARAMS_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DEVINSTALL_PARAMS_A { type Abi = ::core::mem::ManuallyDrop<Self>; } #[derive(:: core :: clone :: Clone)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_DEVINSTALL_PARAMS_W { pub cbSize: u32, pub Flags: u32, pub FlagsEx: u32, pub hwndParent: super::super::Foundation::HWND, pub InstallMsgHandler: ::core::option::Option<PSP_FILE_CALLBACK_A>, pub InstallMsgHandlerContext: *mut ::core::ffi::c_void, pub FileQueue: *mut ::core::ffi::c_void, pub ClassInstallReserved: usize, pub Reserved: u32, pub DriverPath: [u16; 260], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_DEVINSTALL_PARAMS_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DEVINSTALL_PARAMS_W { 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 SP_DEVINSTALL_PARAMS_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_DEVINSTALL_PARAMS_W") .field("cbSize", &self.cbSize) .field("Flags", &self.Flags) .field("FlagsEx", &self.FlagsEx) .field("hwndParent", &self.hwndParent) .field("InstallMsgHandlerContext", &self.InstallMsgHandlerContext) .field("FileQueue", &self.FileQueue) .field("ClassInstallReserved", &self.ClassInstallReserved) .field("Reserved", &self.Reserved) .field("DriverPath", &self.DriverPath) .finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DEVINSTALL_PARAMS_W { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.Flags == other.Flags && self.FlagsEx == other.FlagsEx && self.hwndParent == other.hwndParent && self.InstallMsgHandler.map(|f| f as usize) == other.InstallMsgHandler.map(|f| f as usize) && self.InstallMsgHandlerContext == other.InstallMsgHandlerContext && self.FileQueue == other.FileQueue && self.ClassInstallReserved == other.ClassInstallReserved && self.Reserved == other.Reserved && self.DriverPath == other.DriverPath } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DEVINSTALL_PARAMS_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DEVINSTALL_PARAMS_W { type Abi = ::core::mem::ManuallyDrop<Self>; } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::clone::Clone for SP_DEVINSTALL_PARAMS_W { fn clone(&self) -> Self { unimplemented!() } } #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_DEVINSTALL_PARAMS_W { pub cbSize: u32, pub Flags: u32, pub FlagsEx: u32, pub hwndParent: super::super::Foundation::HWND, pub InstallMsgHandler: ::core::option::Option<PSP_FILE_CALLBACK_A>, pub InstallMsgHandlerContext: *mut ::core::ffi::c_void, pub FileQueue: *mut ::core::ffi::c_void, pub ClassInstallReserved: usize, pub Reserved: u32, pub DriverPath: [u16; 260], } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_DEVINSTALL_PARAMS_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DEVINSTALL_PARAMS_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DEVINSTALL_PARAMS_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DEVINSTALL_PARAMS_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DEVINSTALL_PARAMS_W { type Abi = ::core::mem::ManuallyDrop<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 SP_DRVINFO_DATA_V1_A { pub cbSize: u32, pub DriverType: u32, pub Reserved: usize, pub Description: [super::super::Foundation::CHAR; 256], pub MfgName: [super::super::Foundation::CHAR; 256], pub ProviderName: [super::super::Foundation::CHAR; 256], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_DRVINFO_DATA_V1_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DRVINFO_DATA_V1_A { 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 SP_DRVINFO_DATA_V1_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_DRVINFO_DATA_V1_A").field("cbSize", &self.cbSize).field("DriverType", &self.DriverType).field("Reserved", &self.Reserved).field("Description", &self.Description).field("MfgName", &self.MfgName).field("ProviderName", &self.ProviderName).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DRVINFO_DATA_V1_A { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.DriverType == other.DriverType && self.Reserved == other.Reserved && self.Description == other.Description && self.MfgName == other.MfgName && self.ProviderName == other.ProviderName } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DRVINFO_DATA_V1_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DRVINFO_DATA_V1_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_DRVINFO_DATA_V1_A { pub cbSize: u32, pub DriverType: u32, pub Reserved: usize, pub Description: [super::super::Foundation::CHAR; 256], pub MfgName: [super::super::Foundation::CHAR; 256], pub ProviderName: [super::super::Foundation::CHAR; 256], } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_DRVINFO_DATA_V1_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DRVINFO_DATA_V1_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DRVINFO_DATA_V1_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DRVINFO_DATA_V1_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DRVINFO_DATA_V1_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_DRVINFO_DATA_V1_W { pub cbSize: u32, pub DriverType: u32, pub Reserved: usize, pub Description: [u16; 256], pub MfgName: [u16; 256], pub ProviderName: [u16; 256], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_DRVINFO_DATA_V1_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_DRVINFO_DATA_V1_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_DRVINFO_DATA_V1_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_DRVINFO_DATA_V1_W").field("cbSize", &self.cbSize).field("DriverType", &self.DriverType).field("Reserved", &self.Reserved).field("Description", &self.Description).field("MfgName", &self.MfgName).field("ProviderName", &self.ProviderName).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_DRVINFO_DATA_V1_W { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.DriverType == other.DriverType && self.Reserved == other.Reserved && self.Description == other.Description && self.MfgName == other.MfgName && self.ProviderName == other.ProviderName } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_DRVINFO_DATA_V1_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_DRVINFO_DATA_V1_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_DRVINFO_DATA_V1_W { pub cbSize: u32, pub DriverType: u32, pub Reserved: usize, pub Description: [u16; 256], pub MfgName: [u16; 256], pub ProviderName: [u16; 256], } #[cfg(any(target_arch = "x86",))] impl SP_DRVINFO_DATA_V1_W {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_DRVINFO_DATA_V1_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_DRVINFO_DATA_V1_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_DRVINFO_DATA_V1_W {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_DRVINFO_DATA_V1_W { 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 SP_DRVINFO_DATA_V2_A { pub cbSize: u32, pub DriverType: u32, pub Reserved: usize, pub Description: [super::super::Foundation::CHAR; 256], pub MfgName: [super::super::Foundation::CHAR; 256], pub ProviderName: [super::super::Foundation::CHAR; 256], pub DriverDate: super::super::Foundation::FILETIME, pub DriverVersion: u64, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_DRVINFO_DATA_V2_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DRVINFO_DATA_V2_A { 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 SP_DRVINFO_DATA_V2_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_DRVINFO_DATA_V2_A") .field("cbSize", &self.cbSize) .field("DriverType", &self.DriverType) .field("Reserved", &self.Reserved) .field("Description", &self.Description) .field("MfgName", &self.MfgName) .field("ProviderName", &self.ProviderName) .field("DriverDate", &self.DriverDate) .field("DriverVersion", &self.DriverVersion) .finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DRVINFO_DATA_V2_A { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.DriverType == other.DriverType && self.Reserved == other.Reserved && self.Description == other.Description && self.MfgName == other.MfgName && self.ProviderName == other.ProviderName && self.DriverDate == other.DriverDate && self.DriverVersion == other.DriverVersion } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DRVINFO_DATA_V2_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DRVINFO_DATA_V2_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_DRVINFO_DATA_V2_A { pub cbSize: u32, pub DriverType: u32, pub Reserved: usize, pub Description: [super::super::Foundation::CHAR; 256], pub MfgName: [super::super::Foundation::CHAR; 256], pub ProviderName: [super::super::Foundation::CHAR; 256], pub DriverDate: super::super::Foundation::FILETIME, pub DriverVersion: u64, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_DRVINFO_DATA_V2_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DRVINFO_DATA_V2_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DRVINFO_DATA_V2_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DRVINFO_DATA_V2_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DRVINFO_DATA_V2_A { 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 SP_DRVINFO_DATA_V2_W { pub cbSize: u32, pub DriverType: u32, pub Reserved: usize, pub Description: [u16; 256], pub MfgName: [u16; 256], pub ProviderName: [u16; 256], pub DriverDate: super::super::Foundation::FILETIME, pub DriverVersion: u64, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_DRVINFO_DATA_V2_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DRVINFO_DATA_V2_W { 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 SP_DRVINFO_DATA_V2_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_DRVINFO_DATA_V2_W") .field("cbSize", &self.cbSize) .field("DriverType", &self.DriverType) .field("Reserved", &self.Reserved) .field("Description", &self.Description) .field("MfgName", &self.MfgName) .field("ProviderName", &self.ProviderName) .field("DriverDate", &self.DriverDate) .field("DriverVersion", &self.DriverVersion) .finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DRVINFO_DATA_V2_W { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.DriverType == other.DriverType && self.Reserved == other.Reserved && self.Description == other.Description && self.MfgName == other.MfgName && self.ProviderName == other.ProviderName && self.DriverDate == other.DriverDate && self.DriverVersion == other.DriverVersion } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DRVINFO_DATA_V2_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DRVINFO_DATA_V2_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_DRVINFO_DATA_V2_W { pub cbSize: u32, pub DriverType: u32, pub Reserved: usize, pub Description: [u16; 256], pub MfgName: [u16; 256], pub ProviderName: [u16; 256], pub DriverDate: super::super::Foundation::FILETIME, pub DriverVersion: u64, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_DRVINFO_DATA_V2_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DRVINFO_DATA_V2_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DRVINFO_DATA_V2_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DRVINFO_DATA_V2_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DRVINFO_DATA_V2_W { 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 SP_DRVINFO_DETAIL_DATA_A { pub cbSize: u32, pub InfDate: super::super::Foundation::FILETIME, pub CompatIDsOffset: u32, pub CompatIDsLength: u32, pub Reserved: usize, pub SectionName: [super::super::Foundation::CHAR; 256], pub InfFileName: [super::super::Foundation::CHAR; 260], pub DrvDescription: [super::super::Foundation::CHAR; 256], pub HardwareID: [super::super::Foundation::CHAR; 1], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_DRVINFO_DETAIL_DATA_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DRVINFO_DETAIL_DATA_A { 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 SP_DRVINFO_DETAIL_DATA_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_DRVINFO_DETAIL_DATA_A") .field("cbSize", &self.cbSize) .field("InfDate", &self.InfDate) .field("CompatIDsOffset", &self.CompatIDsOffset) .field("CompatIDsLength", &self.CompatIDsLength) .field("Reserved", &self.Reserved) .field("SectionName", &self.SectionName) .field("InfFileName", &self.InfFileName) .field("DrvDescription", &self.DrvDescription) .field("HardwareID", &self.HardwareID) .finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DRVINFO_DETAIL_DATA_A { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.InfDate == other.InfDate && self.CompatIDsOffset == other.CompatIDsOffset && self.CompatIDsLength == other.CompatIDsLength && self.Reserved == other.Reserved && self.SectionName == other.SectionName && self.InfFileName == other.InfFileName && self.DrvDescription == other.DrvDescription && self.HardwareID == other.HardwareID } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DRVINFO_DETAIL_DATA_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DRVINFO_DETAIL_DATA_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_DRVINFO_DETAIL_DATA_A { pub cbSize: u32, pub InfDate: super::super::Foundation::FILETIME, pub CompatIDsOffset: u32, pub CompatIDsLength: u32, pub Reserved: usize, pub SectionName: [super::super::Foundation::CHAR; 256], pub InfFileName: [super::super::Foundation::CHAR; 260], pub DrvDescription: [super::super::Foundation::CHAR; 256], pub HardwareID: [super::super::Foundation::CHAR; 1], } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_DRVINFO_DETAIL_DATA_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DRVINFO_DETAIL_DATA_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DRVINFO_DETAIL_DATA_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DRVINFO_DETAIL_DATA_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DRVINFO_DETAIL_DATA_A { 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 SP_DRVINFO_DETAIL_DATA_W { pub cbSize: u32, pub InfDate: super::super::Foundation::FILETIME, pub CompatIDsOffset: u32, pub CompatIDsLength: u32, pub Reserved: usize, pub SectionName: [u16; 256], pub InfFileName: [u16; 260], pub DrvDescription: [u16; 256], pub HardwareID: [u16; 1], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_DRVINFO_DETAIL_DATA_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DRVINFO_DETAIL_DATA_W { 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 SP_DRVINFO_DETAIL_DATA_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_DRVINFO_DETAIL_DATA_W") .field("cbSize", &self.cbSize) .field("InfDate", &self.InfDate) .field("CompatIDsOffset", &self.CompatIDsOffset) .field("CompatIDsLength", &self.CompatIDsLength) .field("Reserved", &self.Reserved) .field("SectionName", &self.SectionName) .field("InfFileName", &self.InfFileName) .field("DrvDescription", &self.DrvDescription) .field("HardwareID", &self.HardwareID) .finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DRVINFO_DETAIL_DATA_W { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.InfDate == other.InfDate && self.CompatIDsOffset == other.CompatIDsOffset && self.CompatIDsLength == other.CompatIDsLength && self.Reserved == other.Reserved && self.SectionName == other.SectionName && self.InfFileName == other.InfFileName && self.DrvDescription == other.DrvDescription && self.HardwareID == other.HardwareID } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DRVINFO_DETAIL_DATA_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DRVINFO_DETAIL_DATA_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_DRVINFO_DETAIL_DATA_W { pub cbSize: u32, pub InfDate: super::super::Foundation::FILETIME, pub CompatIDsOffset: u32, pub CompatIDsLength: u32, pub Reserved: usize, pub SectionName: [u16; 256], pub InfFileName: [u16; 260], pub DrvDescription: [u16; 256], pub HardwareID: [u16; 1], } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_DRVINFO_DETAIL_DATA_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_DRVINFO_DETAIL_DATA_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_DRVINFO_DETAIL_DATA_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_DRVINFO_DETAIL_DATA_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_DRVINFO_DETAIL_DATA_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_DRVINSTALL_PARAMS { pub cbSize: u32, pub Rank: u32, pub Flags: u32, pub PrivateData: usize, pub Reserved: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_DRVINSTALL_PARAMS {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_DRVINSTALL_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_DRVINSTALL_PARAMS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_DRVINSTALL_PARAMS").field("cbSize", &self.cbSize).field("Rank", &self.Rank).field("Flags", &self.Flags).field("PrivateData", &self.PrivateData).field("Reserved", &self.Reserved).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_DRVINSTALL_PARAMS { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.Rank == other.Rank && self.Flags == other.Flags && self.PrivateData == other.PrivateData && self.Reserved == other.Reserved } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_DRVINSTALL_PARAMS {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_DRVINSTALL_PARAMS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_DRVINSTALL_PARAMS { pub cbSize: u32, pub Rank: u32, pub Flags: u32, pub PrivateData: usize, pub Reserved: u32, } #[cfg(any(target_arch = "x86",))] impl SP_DRVINSTALL_PARAMS {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_DRVINSTALL_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_DRVINSTALL_PARAMS { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_DRVINSTALL_PARAMS {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_DRVINSTALL_PARAMS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_ENABLECLASS_PARAMS { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub ClassGuid: ::windows::core::GUID, pub EnableMessage: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_ENABLECLASS_PARAMS {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_ENABLECLASS_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_ENABLECLASS_PARAMS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_ENABLECLASS_PARAMS").field("ClassInstallHeader", &self.ClassInstallHeader).field("ClassGuid", &self.ClassGuid).field("EnableMessage", &self.EnableMessage).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_ENABLECLASS_PARAMS { fn eq(&self, other: &Self) -> bool { self.ClassInstallHeader == other.ClassInstallHeader && self.ClassGuid == other.ClassGuid && self.EnableMessage == other.EnableMessage } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_ENABLECLASS_PARAMS {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_ENABLECLASS_PARAMS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_ENABLECLASS_PARAMS { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub ClassGuid: ::windows::core::GUID, pub EnableMessage: u32, } #[cfg(any(target_arch = "x86",))] impl SP_ENABLECLASS_PARAMS {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_ENABLECLASS_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_ENABLECLASS_PARAMS { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_ENABLECLASS_PARAMS {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_ENABLECLASS_PARAMS { 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 SP_FILE_COPY_PARAMS_A { pub cbSize: u32, pub QueueHandle: *mut ::core::ffi::c_void, pub SourceRootPath: super::super::Foundation::PSTR, pub SourcePath: super::super::Foundation::PSTR, pub SourceFilename: super::super::Foundation::PSTR, pub SourceDescription: super::super::Foundation::PSTR, pub SourceTagfile: super::super::Foundation::PSTR, pub TargetDirectory: super::super::Foundation::PSTR, pub TargetFilename: super::super::Foundation::PSTR, pub CopyStyle: u32, pub LayoutInf: *mut ::core::ffi::c_void, pub SecurityDescriptor: super::super::Foundation::PSTR, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_FILE_COPY_PARAMS_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_FILE_COPY_PARAMS_A { 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 SP_FILE_COPY_PARAMS_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_FILE_COPY_PARAMS_A") .field("cbSize", &self.cbSize) .field("QueueHandle", &self.QueueHandle) .field("SourceRootPath", &self.SourceRootPath) .field("SourcePath", &self.SourcePath) .field("SourceFilename", &self.SourceFilename) .field("SourceDescription", &self.SourceDescription) .field("SourceTagfile", &self.SourceTagfile) .field("TargetDirectory", &self.TargetDirectory) .field("TargetFilename", &self.TargetFilename) .field("CopyStyle", &self.CopyStyle) .field("LayoutInf", &self.LayoutInf) .field("SecurityDescriptor", &self.SecurityDescriptor) .finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_FILE_COPY_PARAMS_A { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.QueueHandle == other.QueueHandle && self.SourceRootPath == other.SourceRootPath && self.SourcePath == other.SourcePath && self.SourceFilename == other.SourceFilename && self.SourceDescription == other.SourceDescription && self.SourceTagfile == other.SourceTagfile && self.TargetDirectory == other.TargetDirectory && self.TargetFilename == other.TargetFilename && self.CopyStyle == other.CopyStyle && self.LayoutInf == other.LayoutInf && self.SecurityDescriptor == other.SecurityDescriptor } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_FILE_COPY_PARAMS_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_FILE_COPY_PARAMS_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_FILE_COPY_PARAMS_A { pub cbSize: u32, pub QueueHandle: *mut ::core::ffi::c_void, pub SourceRootPath: super::super::Foundation::PSTR, pub SourcePath: super::super::Foundation::PSTR, pub SourceFilename: super::super::Foundation::PSTR, pub SourceDescription: super::super::Foundation::PSTR, pub SourceTagfile: super::super::Foundation::PSTR, pub TargetDirectory: super::super::Foundation::PSTR, pub TargetFilename: super::super::Foundation::PSTR, pub CopyStyle: u32, pub LayoutInf: *mut ::core::ffi::c_void, pub SecurityDescriptor: super::super::Foundation::PSTR, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_FILE_COPY_PARAMS_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_FILE_COPY_PARAMS_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_FILE_COPY_PARAMS_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_FILE_COPY_PARAMS_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_FILE_COPY_PARAMS_A { 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 SP_FILE_COPY_PARAMS_W { pub cbSize: u32, pub QueueHandle: *mut ::core::ffi::c_void, pub SourceRootPath: super::super::Foundation::PWSTR, pub SourcePath: super::super::Foundation::PWSTR, pub SourceFilename: super::super::Foundation::PWSTR, pub SourceDescription: super::super::Foundation::PWSTR, pub SourceTagfile: super::super::Foundation::PWSTR, pub TargetDirectory: super::super::Foundation::PWSTR, pub TargetFilename: super::super::Foundation::PWSTR, pub CopyStyle: u32, pub LayoutInf: *mut ::core::ffi::c_void, pub SecurityDescriptor: super::super::Foundation::PWSTR, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_FILE_COPY_PARAMS_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_FILE_COPY_PARAMS_W { 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 SP_FILE_COPY_PARAMS_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_FILE_COPY_PARAMS_W") .field("cbSize", &self.cbSize) .field("QueueHandle", &self.QueueHandle) .field("SourceRootPath", &self.SourceRootPath) .field("SourcePath", &self.SourcePath) .field("SourceFilename", &self.SourceFilename) .field("SourceDescription", &self.SourceDescription) .field("SourceTagfile", &self.SourceTagfile) .field("TargetDirectory", &self.TargetDirectory) .field("TargetFilename", &self.TargetFilename) .field("CopyStyle", &self.CopyStyle) .field("LayoutInf", &self.LayoutInf) .field("SecurityDescriptor", &self.SecurityDescriptor) .finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_FILE_COPY_PARAMS_W { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.QueueHandle == other.QueueHandle && self.SourceRootPath == other.SourceRootPath && self.SourcePath == other.SourcePath && self.SourceFilename == other.SourceFilename && self.SourceDescription == other.SourceDescription && self.SourceTagfile == other.SourceTagfile && self.TargetDirectory == other.TargetDirectory && self.TargetFilename == other.TargetFilename && self.CopyStyle == other.CopyStyle && self.LayoutInf == other.LayoutInf && self.SecurityDescriptor == other.SecurityDescriptor } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_FILE_COPY_PARAMS_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_FILE_COPY_PARAMS_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_FILE_COPY_PARAMS_W { pub cbSize: u32, pub QueueHandle: *mut ::core::ffi::c_void, pub SourceRootPath: super::super::Foundation::PWSTR, pub SourcePath: super::super::Foundation::PWSTR, pub SourceFilename: super::super::Foundation::PWSTR, pub SourceDescription: super::super::Foundation::PWSTR, pub SourceTagfile: super::super::Foundation::PWSTR, pub TargetDirectory: super::super::Foundation::PWSTR, pub TargetFilename: super::super::Foundation::PWSTR, pub CopyStyle: u32, pub LayoutInf: *mut ::core::ffi::c_void, pub SecurityDescriptor: super::super::Foundation::PWSTR, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_FILE_COPY_PARAMS_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_FILE_COPY_PARAMS_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_FILE_COPY_PARAMS_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_FILE_COPY_PARAMS_W {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_FILE_COPY_PARAMS_W { type Abi = Self; } pub const SP_FLAG_CABINETCONTINUATION: u32 = 2048u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_INF_INFORMATION { pub InfStyle: SP_INF_STYLE, pub InfCount: u32, pub VersionData: [u8; 1], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_INF_INFORMATION {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_INF_INFORMATION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_INF_INFORMATION { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_INF_INFORMATION").field("InfStyle", &self.InfStyle).field("InfCount", &self.InfCount).field("VersionData", &self.VersionData).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_INF_INFORMATION { fn eq(&self, other: &Self) -> bool { self.InfStyle == other.InfStyle && self.InfCount == other.InfCount && self.VersionData == other.VersionData } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_INF_INFORMATION {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_INF_INFORMATION { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_INF_INFORMATION { pub InfStyle: SP_INF_STYLE, pub InfCount: u32, pub VersionData: [u8; 1], } #[cfg(any(target_arch = "x86",))] impl SP_INF_INFORMATION {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_INF_INFORMATION { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_INF_INFORMATION { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_INF_INFORMATION {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_INF_INFORMATION { 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 SP_INF_SIGNER_INFO_V1_A { pub cbSize: u32, pub CatalogFile: [super::super::Foundation::CHAR; 260], pub DigitalSigner: [super::super::Foundation::CHAR; 260], pub DigitalSignerVersion: [super::super::Foundation::CHAR; 260], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_INF_SIGNER_INFO_V1_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_INF_SIGNER_INFO_V1_A { 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 SP_INF_SIGNER_INFO_V1_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_INF_SIGNER_INFO_V1_A").field("cbSize", &self.cbSize).field("CatalogFile", &self.CatalogFile).field("DigitalSigner", &self.DigitalSigner).field("DigitalSignerVersion", &self.DigitalSignerVersion).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_INF_SIGNER_INFO_V1_A { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.CatalogFile == other.CatalogFile && self.DigitalSigner == other.DigitalSigner && self.DigitalSignerVersion == other.DigitalSignerVersion } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_INF_SIGNER_INFO_V1_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_INF_SIGNER_INFO_V1_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_INF_SIGNER_INFO_V1_A { pub cbSize: u32, pub CatalogFile: [super::super::Foundation::CHAR; 260], pub DigitalSigner: [super::super::Foundation::CHAR; 260], pub DigitalSignerVersion: [super::super::Foundation::CHAR; 260], } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_INF_SIGNER_INFO_V1_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_INF_SIGNER_INFO_V1_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_INF_SIGNER_INFO_V1_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_INF_SIGNER_INFO_V1_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_INF_SIGNER_INFO_V1_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_INF_SIGNER_INFO_V1_W { pub cbSize: u32, pub CatalogFile: [u16; 260], pub DigitalSigner: [u16; 260], pub DigitalSignerVersion: [u16; 260], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_INF_SIGNER_INFO_V1_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_INF_SIGNER_INFO_V1_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_INF_SIGNER_INFO_V1_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_INF_SIGNER_INFO_V1_W").field("cbSize", &self.cbSize).field("CatalogFile", &self.CatalogFile).field("DigitalSigner", &self.DigitalSigner).field("DigitalSignerVersion", &self.DigitalSignerVersion).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_INF_SIGNER_INFO_V1_W { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.CatalogFile == other.CatalogFile && self.DigitalSigner == other.DigitalSigner && self.DigitalSignerVersion == other.DigitalSignerVersion } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_INF_SIGNER_INFO_V1_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_INF_SIGNER_INFO_V1_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_INF_SIGNER_INFO_V1_W { pub cbSize: u32, pub CatalogFile: [u16; 260], pub DigitalSigner: [u16; 260], pub DigitalSignerVersion: [u16; 260], } #[cfg(any(target_arch = "x86",))] impl SP_INF_SIGNER_INFO_V1_W {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_INF_SIGNER_INFO_V1_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_INF_SIGNER_INFO_V1_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_INF_SIGNER_INFO_V1_W {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_INF_SIGNER_INFO_V1_W { 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 SP_INF_SIGNER_INFO_V2_A { pub cbSize: u32, pub CatalogFile: [super::super::Foundation::CHAR; 260], pub DigitalSigner: [super::super::Foundation::CHAR; 260], pub DigitalSignerVersion: [super::super::Foundation::CHAR; 260], pub SignerScore: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_INF_SIGNER_INFO_V2_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_INF_SIGNER_INFO_V2_A { 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 SP_INF_SIGNER_INFO_V2_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_INF_SIGNER_INFO_V2_A").field("cbSize", &self.cbSize).field("CatalogFile", &self.CatalogFile).field("DigitalSigner", &self.DigitalSigner).field("DigitalSignerVersion", &self.DigitalSignerVersion).field("SignerScore", &self.SignerScore).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_INF_SIGNER_INFO_V2_A { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.CatalogFile == other.CatalogFile && self.DigitalSigner == other.DigitalSigner && self.DigitalSignerVersion == other.DigitalSignerVersion && self.SignerScore == other.SignerScore } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_INF_SIGNER_INFO_V2_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_INF_SIGNER_INFO_V2_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_INF_SIGNER_INFO_V2_A { pub cbSize: u32, pub CatalogFile: [super::super::Foundation::CHAR; 260], pub DigitalSigner: [super::super::Foundation::CHAR; 260], pub DigitalSignerVersion: [super::super::Foundation::CHAR; 260], pub SignerScore: u32, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_INF_SIGNER_INFO_V2_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_INF_SIGNER_INFO_V2_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_INF_SIGNER_INFO_V2_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_INF_SIGNER_INFO_V2_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_INF_SIGNER_INFO_V2_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_INF_SIGNER_INFO_V2_W { pub cbSize: u32, pub CatalogFile: [u16; 260], pub DigitalSigner: [u16; 260], pub DigitalSignerVersion: [u16; 260], pub SignerScore: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_INF_SIGNER_INFO_V2_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_INF_SIGNER_INFO_V2_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_INF_SIGNER_INFO_V2_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_INF_SIGNER_INFO_V2_W").field("cbSize", &self.cbSize).field("CatalogFile", &self.CatalogFile).field("DigitalSigner", &self.DigitalSigner).field("DigitalSignerVersion", &self.DigitalSignerVersion).field("SignerScore", &self.SignerScore).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_INF_SIGNER_INFO_V2_W { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.CatalogFile == other.CatalogFile && self.DigitalSigner == other.DigitalSigner && self.DigitalSignerVersion == other.DigitalSignerVersion && self.SignerScore == other.SignerScore } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_INF_SIGNER_INFO_V2_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_INF_SIGNER_INFO_V2_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_INF_SIGNER_INFO_V2_W { pub cbSize: u32, pub CatalogFile: [u16; 260], pub DigitalSigner: [u16; 260], pub DigitalSignerVersion: [u16; 260], pub SignerScore: u32, } #[cfg(any(target_arch = "x86",))] impl SP_INF_SIGNER_INFO_V2_W {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_INF_SIGNER_INFO_V2_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_INF_SIGNER_INFO_V2_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_INF_SIGNER_INFO_V2_W {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_INF_SIGNER_INFO_V2_W { 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 SP_INF_STYLE(pub u32); pub const INF_STYLE_NONE: SP_INF_STYLE = SP_INF_STYLE(0u32); pub const INF_STYLE_OLDNT: SP_INF_STYLE = SP_INF_STYLE(1u32); pub const INF_STYLE_WIN4: SP_INF_STYLE = SP_INF_STYLE(2u32); impl ::core::convert::From<u32> for SP_INF_STYLE { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SP_INF_STYLE { type Abi = Self; } impl ::core::ops::BitOr for SP_INF_STYLE { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for SP_INF_STYLE { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for SP_INF_STYLE { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for SP_INF_STYLE { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for SP_INF_STYLE { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] pub struct SP_INSTALLWIZARD_DATA { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub Flags: u32, pub DynamicPages: [super::super::UI::Controls::HPROPSHEETPAGE; 20], pub NumDynamicPages: u32, pub DynamicPageFlags: u32, pub PrivateFlags: u32, pub PrivateData: super::super::Foundation::LPARAM, pub hwndWizardDlg: super::super::Foundation::HWND, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl SP_INSTALLWIZARD_DATA {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl ::core::default::Default for SP_INSTALLWIZARD_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl ::core::fmt::Debug for SP_INSTALLWIZARD_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_INSTALLWIZARD_DATA") .field("ClassInstallHeader", &self.ClassInstallHeader) .field("Flags", &self.Flags) .field("DynamicPages", &self.DynamicPages) .field("NumDynamicPages", &self.NumDynamicPages) .field("DynamicPageFlags", &self.DynamicPageFlags) .field("PrivateFlags", &self.PrivateFlags) .field("PrivateData", &self.PrivateData) .field("hwndWizardDlg", &self.hwndWizardDlg) .finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl ::core::cmp::PartialEq for SP_INSTALLWIZARD_DATA { fn eq(&self, other: &Self) -> bool { self.ClassInstallHeader == other.ClassInstallHeader && self.Flags == other.Flags && self.DynamicPages == other.DynamicPages && self.NumDynamicPages == other.NumDynamicPages && self.DynamicPageFlags == other.DynamicPageFlags && self.PrivateFlags == other.PrivateFlags && self.PrivateData == other.PrivateData && self.hwndWizardDlg == other.hwndWizardDlg } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl ::core::cmp::Eq for SP_INSTALLWIZARD_DATA {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] unsafe impl ::windows::core::Abi for SP_INSTALLWIZARD_DATA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] pub struct SP_INSTALLWIZARD_DATA { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub Flags: u32, pub DynamicPages: [super::super::UI::Controls::HPROPSHEETPAGE; 20], pub NumDynamicPages: u32, pub DynamicPageFlags: u32, pub PrivateFlags: u32, pub PrivateData: super::super::Foundation::LPARAM, pub hwndWizardDlg: super::super::Foundation::HWND, } #[cfg(any(target_arch = "x86",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl SP_INSTALLWIZARD_DATA {} #[cfg(any(target_arch = "x86",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl ::core::default::Default for SP_INSTALLWIZARD_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl ::core::cmp::PartialEq for SP_INSTALLWIZARD_DATA { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl ::core::cmp::Eq for SP_INSTALLWIZARD_DATA {} #[cfg(any(target_arch = "x86",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] unsafe impl ::windows::core::Abi for SP_INSTALLWIZARD_DATA { type Abi = Self; } pub const SP_MAX_MACHINENAME_LENGTH: u32 = 263u32; #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] pub struct SP_NEWDEVICEWIZARD_DATA { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub Flags: u32, pub DynamicPages: [super::super::UI::Controls::HPROPSHEETPAGE; 20], pub NumDynamicPages: u32, pub hwndWizardDlg: super::super::Foundation::HWND, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl SP_NEWDEVICEWIZARD_DATA {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl ::core::default::Default for SP_NEWDEVICEWIZARD_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl ::core::fmt::Debug for SP_NEWDEVICEWIZARD_DATA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_NEWDEVICEWIZARD_DATA").field("ClassInstallHeader", &self.ClassInstallHeader).field("Flags", &self.Flags).field("DynamicPages", &self.DynamicPages).field("NumDynamicPages", &self.NumDynamicPages).field("hwndWizardDlg", &self.hwndWizardDlg).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl ::core::cmp::PartialEq for SP_NEWDEVICEWIZARD_DATA { fn eq(&self, other: &Self) -> bool { self.ClassInstallHeader == other.ClassInstallHeader && self.Flags == other.Flags && self.DynamicPages == other.DynamicPages && self.NumDynamicPages == other.NumDynamicPages && self.hwndWizardDlg == other.hwndWizardDlg } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl ::core::cmp::Eq for SP_NEWDEVICEWIZARD_DATA {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] unsafe impl ::windows::core::Abi for SP_NEWDEVICEWIZARD_DATA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] pub struct SP_NEWDEVICEWIZARD_DATA { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub Flags: u32, pub DynamicPages: [super::super::UI::Controls::HPROPSHEETPAGE; 20], pub NumDynamicPages: u32, pub hwndWizardDlg: super::super::Foundation::HWND, } #[cfg(any(target_arch = "x86",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl SP_NEWDEVICEWIZARD_DATA {} #[cfg(any(target_arch = "x86",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl ::core::default::Default for SP_NEWDEVICEWIZARD_DATA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl ::core::cmp::PartialEq for SP_NEWDEVICEWIZARD_DATA { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] impl ::core::cmp::Eq for SP_NEWDEVICEWIZARD_DATA {} #[cfg(any(target_arch = "x86",))] #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] unsafe impl ::windows::core::Abi for SP_NEWDEVICEWIZARD_DATA { 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 SP_ORIGINAL_FILE_INFO_A { pub cbSize: u32, pub OriginalInfName: [super::super::Foundation::CHAR; 260], pub OriginalCatalogName: [super::super::Foundation::CHAR; 260], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_ORIGINAL_FILE_INFO_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_ORIGINAL_FILE_INFO_A { 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 SP_ORIGINAL_FILE_INFO_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_ORIGINAL_FILE_INFO_A").field("cbSize", &self.cbSize).field("OriginalInfName", &self.OriginalInfName).field("OriginalCatalogName", &self.OriginalCatalogName).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_ORIGINAL_FILE_INFO_A { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.OriginalInfName == other.OriginalInfName && self.OriginalCatalogName == other.OriginalCatalogName } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_ORIGINAL_FILE_INFO_A {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_ORIGINAL_FILE_INFO_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_ORIGINAL_FILE_INFO_A { pub cbSize: u32, pub OriginalInfName: [super::super::Foundation::CHAR; 260], pub OriginalCatalogName: [super::super::Foundation::CHAR; 260], } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_ORIGINAL_FILE_INFO_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_ORIGINAL_FILE_INFO_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_ORIGINAL_FILE_INFO_A { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_ORIGINAL_FILE_INFO_A {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_ORIGINAL_FILE_INFO_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_ORIGINAL_FILE_INFO_W { pub cbSize: u32, pub OriginalInfName: [u16; 260], pub OriginalCatalogName: [u16; 260], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_ORIGINAL_FILE_INFO_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_ORIGINAL_FILE_INFO_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_ORIGINAL_FILE_INFO_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_ORIGINAL_FILE_INFO_W").field("cbSize", &self.cbSize).field("OriginalInfName", &self.OriginalInfName).field("OriginalCatalogName", &self.OriginalCatalogName).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_ORIGINAL_FILE_INFO_W { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.OriginalInfName == other.OriginalInfName && self.OriginalCatalogName == other.OriginalCatalogName } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_ORIGINAL_FILE_INFO_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_ORIGINAL_FILE_INFO_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_ORIGINAL_FILE_INFO_W { pub cbSize: u32, pub OriginalInfName: [u16; 260], pub OriginalCatalogName: [u16; 260], } #[cfg(any(target_arch = "x86",))] impl SP_ORIGINAL_FILE_INFO_W {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_ORIGINAL_FILE_INFO_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_ORIGINAL_FILE_INFO_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_ORIGINAL_FILE_INFO_W {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_ORIGINAL_FILE_INFO_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct SP_POWERMESSAGEWAKE_PARAMS_A { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub PowerMessageWake: [super::super::Foundation::CHAR; 512], } #[cfg(feature = "Win32_Foundation")] impl SP_POWERMESSAGEWAKE_PARAMS_A {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_POWERMESSAGEWAKE_PARAMS_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for SP_POWERMESSAGEWAKE_PARAMS_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_POWERMESSAGEWAKE_PARAMS_A").field("ClassInstallHeader", &self.ClassInstallHeader).field("PowerMessageWake", &self.PowerMessageWake).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_POWERMESSAGEWAKE_PARAMS_A { fn eq(&self, other: &Self) -> bool { self.ClassInstallHeader == other.ClassInstallHeader && self.PowerMessageWake == other.PowerMessageWake } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_POWERMESSAGEWAKE_PARAMS_A {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_POWERMESSAGEWAKE_PARAMS_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_POWERMESSAGEWAKE_PARAMS_W { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub PowerMessageWake: [u16; 512], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_POWERMESSAGEWAKE_PARAMS_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_POWERMESSAGEWAKE_PARAMS_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_POWERMESSAGEWAKE_PARAMS_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_POWERMESSAGEWAKE_PARAMS_W").field("ClassInstallHeader", &self.ClassInstallHeader).field("PowerMessageWake", &self.PowerMessageWake).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_POWERMESSAGEWAKE_PARAMS_W { fn eq(&self, other: &Self) -> bool { self.ClassInstallHeader == other.ClassInstallHeader && self.PowerMessageWake == other.PowerMessageWake } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_POWERMESSAGEWAKE_PARAMS_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_POWERMESSAGEWAKE_PARAMS_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_POWERMESSAGEWAKE_PARAMS_W { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub PowerMessageWake: [u16; 512], } #[cfg(any(target_arch = "x86",))] impl SP_POWERMESSAGEWAKE_PARAMS_W {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_POWERMESSAGEWAKE_PARAMS_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_POWERMESSAGEWAKE_PARAMS_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_POWERMESSAGEWAKE_PARAMS_W {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_POWERMESSAGEWAKE_PARAMS_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_PROPCHANGE_PARAMS { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub StateChange: u32, pub Scope: u32, pub HwProfile: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_PROPCHANGE_PARAMS {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_PROPCHANGE_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_PROPCHANGE_PARAMS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_PROPCHANGE_PARAMS").field("ClassInstallHeader", &self.ClassInstallHeader).field("StateChange", &self.StateChange).field("Scope", &self.Scope).field("HwProfile", &self.HwProfile).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_PROPCHANGE_PARAMS { fn eq(&self, other: &Self) -> bool { self.ClassInstallHeader == other.ClassInstallHeader && self.StateChange == other.StateChange && self.Scope == other.Scope && self.HwProfile == other.HwProfile } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_PROPCHANGE_PARAMS {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_PROPCHANGE_PARAMS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_PROPCHANGE_PARAMS { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub StateChange: u32, pub Scope: u32, pub HwProfile: u32, } #[cfg(any(target_arch = "x86",))] impl SP_PROPCHANGE_PARAMS {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_PROPCHANGE_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_PROPCHANGE_PARAMS { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_PROPCHANGE_PARAMS {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_PROPCHANGE_PARAMS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_PROPSHEETPAGE_REQUEST { pub cbSize: u32, pub PageRequested: u32, pub DeviceInfoSet: *mut ::core::ffi::c_void, pub DeviceInfoData: *mut SP_DEVINFO_DATA, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_PROPSHEETPAGE_REQUEST {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_PROPSHEETPAGE_REQUEST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_PROPSHEETPAGE_REQUEST { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_PROPSHEETPAGE_REQUEST").field("cbSize", &self.cbSize).field("PageRequested", &self.PageRequested).field("DeviceInfoSet", &self.DeviceInfoSet).field("DeviceInfoData", &self.DeviceInfoData).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_PROPSHEETPAGE_REQUEST { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.PageRequested == other.PageRequested && self.DeviceInfoSet == other.DeviceInfoSet && self.DeviceInfoData == other.DeviceInfoData } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_PROPSHEETPAGE_REQUEST {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_PROPSHEETPAGE_REQUEST { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_PROPSHEETPAGE_REQUEST { pub cbSize: u32, pub PageRequested: u32, pub DeviceInfoSet: *mut ::core::ffi::c_void, pub DeviceInfoData: *mut SP_DEVINFO_DATA, } #[cfg(any(target_arch = "x86",))] impl SP_PROPSHEETPAGE_REQUEST {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_PROPSHEETPAGE_REQUEST { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_PROPSHEETPAGE_REQUEST { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_PROPSHEETPAGE_REQUEST {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_PROPSHEETPAGE_REQUEST { 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 SP_REGISTER_CONTROL_STATUSA { pub cbSize: u32, pub FileName: super::super::Foundation::PSTR, pub Win32Error: u32, pub FailureCode: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_REGISTER_CONTROL_STATUSA {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_REGISTER_CONTROL_STATUSA { 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 SP_REGISTER_CONTROL_STATUSA { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_REGISTER_CONTROL_STATUSA").field("cbSize", &self.cbSize).field("FileName", &self.FileName).field("Win32Error", &self.Win32Error).field("FailureCode", &self.FailureCode).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_REGISTER_CONTROL_STATUSA { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.FileName == other.FileName && self.Win32Error == other.Win32Error && self.FailureCode == other.FailureCode } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_REGISTER_CONTROL_STATUSA {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_REGISTER_CONTROL_STATUSA { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_REGISTER_CONTROL_STATUSA { pub cbSize: u32, pub FileName: super::super::Foundation::PSTR, pub Win32Error: u32, pub FailureCode: u32, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_REGISTER_CONTROL_STATUSA {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_REGISTER_CONTROL_STATUSA { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_REGISTER_CONTROL_STATUSA { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_REGISTER_CONTROL_STATUSA {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_REGISTER_CONTROL_STATUSA { 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 SP_REGISTER_CONTROL_STATUSW { pub cbSize: u32, pub FileName: super::super::Foundation::PWSTR, pub Win32Error: u32, pub FailureCode: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl SP_REGISTER_CONTROL_STATUSW {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_REGISTER_CONTROL_STATUSW { 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 SP_REGISTER_CONTROL_STATUSW { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_REGISTER_CONTROL_STATUSW").field("cbSize", &self.cbSize).field("FileName", &self.FileName).field("Win32Error", &self.Win32Error).field("FailureCode", &self.FailureCode).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_REGISTER_CONTROL_STATUSW { fn eq(&self, other: &Self) -> bool { self.cbSize == other.cbSize && self.FileName == other.FileName && self.Win32Error == other.Win32Error && self.FailureCode == other.FailureCode } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_REGISTER_CONTROL_STATUSW {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_REGISTER_CONTROL_STATUSW { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] pub struct SP_REGISTER_CONTROL_STATUSW { pub cbSize: u32, pub FileName: super::super::Foundation::PWSTR, pub Win32Error: u32, pub FailureCode: u32, } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl SP_REGISTER_CONTROL_STATUSW {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_REGISTER_CONTROL_STATUSW { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_REGISTER_CONTROL_STATUSW { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_REGISTER_CONTROL_STATUSW {} #[cfg(any(target_arch = "x86",))] #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_REGISTER_CONTROL_STATUSW { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_REMOVEDEVICE_PARAMS { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub Scope: u32, pub HwProfile: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_REMOVEDEVICE_PARAMS {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_REMOVEDEVICE_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_REMOVEDEVICE_PARAMS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_REMOVEDEVICE_PARAMS").field("ClassInstallHeader", &self.ClassInstallHeader).field("Scope", &self.Scope).field("HwProfile", &self.HwProfile).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_REMOVEDEVICE_PARAMS { fn eq(&self, other: &Self) -> bool { self.ClassInstallHeader == other.ClassInstallHeader && self.Scope == other.Scope && self.HwProfile == other.HwProfile } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_REMOVEDEVICE_PARAMS {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_REMOVEDEVICE_PARAMS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_REMOVEDEVICE_PARAMS { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub Scope: u32, pub HwProfile: u32, } #[cfg(any(target_arch = "x86",))] impl SP_REMOVEDEVICE_PARAMS {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_REMOVEDEVICE_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_REMOVEDEVICE_PARAMS { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_REMOVEDEVICE_PARAMS {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_REMOVEDEVICE_PARAMS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct SP_SELECTDEVICE_PARAMS_A { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub Title: [super::super::Foundation::CHAR; 60], pub Instructions: [super::super::Foundation::CHAR; 256], pub ListLabel: [super::super::Foundation::CHAR; 30], pub SubTitle: [super::super::Foundation::CHAR; 256], pub Reserved: [u8; 2], } #[cfg(feature = "Win32_Foundation")] impl SP_SELECTDEVICE_PARAMS_A {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_SELECTDEVICE_PARAMS_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for SP_SELECTDEVICE_PARAMS_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_SELECTDEVICE_PARAMS_A").field("ClassInstallHeader", &self.ClassInstallHeader).field("Title", &self.Title).field("Instructions", &self.Instructions).field("ListLabel", &self.ListLabel).field("SubTitle", &self.SubTitle).field("Reserved", &self.Reserved).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_SELECTDEVICE_PARAMS_A { fn eq(&self, other: &Self) -> bool { self.ClassInstallHeader == other.ClassInstallHeader && self.Title == other.Title && self.Instructions == other.Instructions && self.ListLabel == other.ListLabel && self.SubTitle == other.SubTitle && self.Reserved == other.Reserved } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_SELECTDEVICE_PARAMS_A {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_SELECTDEVICE_PARAMS_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_SELECTDEVICE_PARAMS_W { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub Title: [u16; 60], pub Instructions: [u16; 256], pub ListLabel: [u16; 30], pub SubTitle: [u16; 256], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_SELECTDEVICE_PARAMS_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_SELECTDEVICE_PARAMS_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_SELECTDEVICE_PARAMS_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_SELECTDEVICE_PARAMS_W").field("ClassInstallHeader", &self.ClassInstallHeader).field("Title", &self.Title).field("Instructions", &self.Instructions).field("ListLabel", &self.ListLabel).field("SubTitle", &self.SubTitle).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_SELECTDEVICE_PARAMS_W { fn eq(&self, other: &Self) -> bool { self.ClassInstallHeader == other.ClassInstallHeader && self.Title == other.Title && self.Instructions == other.Instructions && self.ListLabel == other.ListLabel && self.SubTitle == other.SubTitle } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_SELECTDEVICE_PARAMS_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_SELECTDEVICE_PARAMS_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_SELECTDEVICE_PARAMS_W { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub Title: [u16; 60], pub Instructions: [u16; 256], pub ListLabel: [u16; 30], pub SubTitle: [u16; 256], } #[cfg(any(target_arch = "x86",))] impl SP_SELECTDEVICE_PARAMS_W {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_SELECTDEVICE_PARAMS_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_SELECTDEVICE_PARAMS_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_SELECTDEVICE_PARAMS_W {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_SELECTDEVICE_PARAMS_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct SP_TROUBLESHOOTER_PARAMS_A { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub ChmFile: [super::super::Foundation::CHAR; 260], pub HtmlTroubleShooter: [super::super::Foundation::CHAR; 260], } #[cfg(feature = "Win32_Foundation")] impl SP_TROUBLESHOOTER_PARAMS_A {} #[cfg(feature = "Win32_Foundation")] impl ::core::default::Default for SP_TROUBLESHOOTER_PARAMS_A { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Win32_Foundation")] impl ::core::fmt::Debug for SP_TROUBLESHOOTER_PARAMS_A { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_TROUBLESHOOTER_PARAMS_A").field("ClassInstallHeader", &self.ClassInstallHeader).field("ChmFile", &self.ChmFile).field("HtmlTroubleShooter", &self.HtmlTroubleShooter).finish() } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::PartialEq for SP_TROUBLESHOOTER_PARAMS_A { fn eq(&self, other: &Self) -> bool { self.ClassInstallHeader == other.ClassInstallHeader && self.ChmFile == other.ChmFile && self.HtmlTroubleShooter == other.HtmlTroubleShooter } } #[cfg(feature = "Win32_Foundation")] impl ::core::cmp::Eq for SP_TROUBLESHOOTER_PARAMS_A {} #[cfg(feature = "Win32_Foundation")] unsafe impl ::windows::core::Abi for SP_TROUBLESHOOTER_PARAMS_A { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_TROUBLESHOOTER_PARAMS_W { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub ChmFile: [u16; 260], pub HtmlTroubleShooter: [u16; 260], } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_TROUBLESHOOTER_PARAMS_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_TROUBLESHOOTER_PARAMS_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_TROUBLESHOOTER_PARAMS_W { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_TROUBLESHOOTER_PARAMS_W").field("ClassInstallHeader", &self.ClassInstallHeader).field("ChmFile", &self.ChmFile).field("HtmlTroubleShooter", &self.HtmlTroubleShooter).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_TROUBLESHOOTER_PARAMS_W { fn eq(&self, other: &Self) -> bool { self.ClassInstallHeader == other.ClassInstallHeader && self.ChmFile == other.ChmFile && self.HtmlTroubleShooter == other.HtmlTroubleShooter } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_TROUBLESHOOTER_PARAMS_W {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_TROUBLESHOOTER_PARAMS_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_TROUBLESHOOTER_PARAMS_W { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub ChmFile: [u16; 260], pub HtmlTroubleShooter: [u16; 260], } #[cfg(any(target_arch = "x86",))] impl SP_TROUBLESHOOTER_PARAMS_W {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_TROUBLESHOOTER_PARAMS_W { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_TROUBLESHOOTER_PARAMS_W { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_TROUBLESHOOTER_PARAMS_W {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_TROUBLESHOOTER_PARAMS_W { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] pub struct SP_UNREMOVEDEVICE_PARAMS { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub Scope: u32, pub HwProfile: u32, } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl SP_UNREMOVEDEVICE_PARAMS {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::default::Default for SP_UNREMOVEDEVICE_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::fmt::Debug for SP_UNREMOVEDEVICE_PARAMS { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("SP_UNREMOVEDEVICE_PARAMS").field("ClassInstallHeader", &self.ClassInstallHeader).field("Scope", &self.Scope).field("HwProfile", &self.HwProfile).finish() } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::PartialEq for SP_UNREMOVEDEVICE_PARAMS { fn eq(&self, other: &Self) -> bool { self.ClassInstallHeader == other.ClassInstallHeader && self.Scope == other.Scope && self.HwProfile == other.HwProfile } } #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] impl ::core::cmp::Eq for SP_UNREMOVEDEVICE_PARAMS {} #[cfg(any(target_arch = "x86_64", target_arch = "aarch64",))] unsafe impl ::windows::core::Abi for SP_UNREMOVEDEVICE_PARAMS { type Abi = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C, packed(1))] #[cfg(any(target_arch = "x86",))] pub struct SP_UNREMOVEDEVICE_PARAMS { pub ClassInstallHeader: SP_CLASSINSTALL_HEADER, pub Scope: u32, pub HwProfile: u32, } #[cfg(any(target_arch = "x86",))] impl SP_UNREMOVEDEVICE_PARAMS {} #[cfg(any(target_arch = "x86",))] impl ::core::default::Default for SP_UNREMOVEDEVICE_PARAMS { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::PartialEq for SP_UNREMOVEDEVICE_PARAMS { fn eq(&self, _other: &Self) -> bool { unimplemented!() } } #[cfg(any(target_arch = "x86",))] impl ::core::cmp::Eq for SP_UNREMOVEDEVICE_PARAMS {} #[cfg(any(target_arch = "x86",))] unsafe impl ::windows::core::Abi for SP_UNREMOVEDEVICE_PARAMS { type Abi = Self; } pub const SRCINFO_DESCRIPTION: u32 = 3u32; pub const SRCINFO_FLAGS: u32 = 4u32; pub const SRCINFO_PATH: u32 = 1u32; pub const SRCINFO_TAGFILE: u32 = 2u32; pub const SRCINFO_TAGFILE2: u32 = 5u32; pub const SRCLIST_APPEND: u32 = 512u32; pub const SRCLIST_NOBROWSE: u32 = 2u32; pub const SRCLIST_NOSTRIPPLATFORM: u32 = 1024u32; pub const SRCLIST_SUBDIRS: u32 = 256u32; pub const SRCLIST_SYSIFADMIN: u32 = 64u32; pub const SRCLIST_SYSTEM: u32 = 16u32; pub const SRCLIST_TEMPORARY: u32 = 1u32; pub const SRCLIST_USER: u32 = 32u32; pub const SRC_FLAGS_CABFILE: u32 = 16u32; pub const SUOI_FORCEDELETE: u32 = 1u32; pub const SUOI_INTERNAL1: u32 = 2u32; #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupAddInstallSectionToDiskSpaceListA<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(diskspace: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, layoutinfhandle: *const ::core::ffi::c_void, sectionname: Param3, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupAddInstallSectionToDiskSpaceListA(diskspace: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, layoutinfhandle: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PSTR, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupAddInstallSectionToDiskSpaceListA(::core::mem::transmute(diskspace), ::core::mem::transmute(infhandle), ::core::mem::transmute(layoutinfhandle), sectionname.into_param().abi(), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupAddInstallSectionToDiskSpaceListW<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(diskspace: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, layoutinfhandle: *const ::core::ffi::c_void, sectionname: Param3, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupAddInstallSectionToDiskSpaceListW(diskspace: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, layoutinfhandle: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PWSTR, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupAddInstallSectionToDiskSpaceListW(::core::mem::transmute(diskspace), ::core::mem::transmute(infhandle), ::core::mem::transmute(layoutinfhandle), sectionname.into_param().abi(), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupAddSectionToDiskSpaceListA<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(diskspace: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, sectionname: Param3, operation: SETUP_FILE_OPERATION, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupAddSectionToDiskSpaceListA(diskspace: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PSTR, operation: SETUP_FILE_OPERATION, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupAddSectionToDiskSpaceListA(::core::mem::transmute(diskspace), ::core::mem::transmute(infhandle), ::core::mem::transmute(listinfhandle), sectionname.into_param().abi(), ::core::mem::transmute(operation), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupAddSectionToDiskSpaceListW<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(diskspace: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, sectionname: Param3, operation: SETUP_FILE_OPERATION, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupAddSectionToDiskSpaceListW(diskspace: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PWSTR, operation: SETUP_FILE_OPERATION, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupAddSectionToDiskSpaceListW(::core::mem::transmute(diskspace), ::core::mem::transmute(infhandle), ::core::mem::transmute(listinfhandle), sectionname.into_param().abi(), ::core::mem::transmute(operation), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupAddToDiskSpaceListA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(diskspace: *const ::core::ffi::c_void, targetfilespec: Param1, filesize: i64, operation: SETUP_FILE_OPERATION, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupAddToDiskSpaceListA(diskspace: *const ::core::ffi::c_void, targetfilespec: super::super::Foundation::PSTR, filesize: i64, operation: SETUP_FILE_OPERATION, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupAddToDiskSpaceListA(::core::mem::transmute(diskspace), targetfilespec.into_param().abi(), ::core::mem::transmute(filesize), ::core::mem::transmute(operation), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupAddToDiskSpaceListW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(diskspace: *const ::core::ffi::c_void, targetfilespec: Param1, filesize: i64, operation: SETUP_FILE_OPERATION, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupAddToDiskSpaceListW(diskspace: *const ::core::ffi::c_void, targetfilespec: super::super::Foundation::PWSTR, filesize: i64, operation: SETUP_FILE_OPERATION, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupAddToDiskSpaceListW(::core::mem::transmute(diskspace), targetfilespec.into_param().abi(), ::core::mem::transmute(filesize), ::core::mem::transmute(operation), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupAddToSourceListA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(flags: u32, source: Param1) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupAddToSourceListA(flags: u32, source: super::super::Foundation::PSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupAddToSourceListA(::core::mem::transmute(flags), source.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupAddToSourceListW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(flags: u32, source: Param1) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupAddToSourceListW(flags: u32, source: super::super::Foundation::PWSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupAddToSourceListW(::core::mem::transmute(flags), source.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupAdjustDiskSpaceListA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(diskspace: *const ::core::ffi::c_void, driveroot: Param1, amount: i64, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupAdjustDiskSpaceListA(diskspace: *const ::core::ffi::c_void, driveroot: super::super::Foundation::PSTR, amount: i64, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupAdjustDiskSpaceListA(::core::mem::transmute(diskspace), driveroot.into_param().abi(), ::core::mem::transmute(amount), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupAdjustDiskSpaceListW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(diskspace: *const ::core::ffi::c_void, driveroot: Param1, amount: i64, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupAdjustDiskSpaceListW(diskspace: *const ::core::ffi::c_void, driveroot: super::super::Foundation::PWSTR, amount: i64, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupAdjustDiskSpaceListW(::core::mem::transmute(diskspace), driveroot.into_param().abi(), ::core::mem::transmute(amount), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupBackupErrorA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(hwndparent: Param0, dialogtitle: Param1, sourcefile: Param2, targetfile: Param3, win32errorcode: u32, style: u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupBackupErrorA(hwndparent: super::super::Foundation::HWND, dialogtitle: super::super::Foundation::PSTR, sourcefile: super::super::Foundation::PSTR, targetfile: super::super::Foundation::PSTR, win32errorcode: u32, style: u32) -> u32; } ::core::mem::transmute(SetupBackupErrorA(hwndparent.into_param().abi(), dialogtitle.into_param().abi(), sourcefile.into_param().abi(), targetfile.into_param().abi(), ::core::mem::transmute(win32errorcode), ::core::mem::transmute(style))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupBackupErrorW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, 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>>(hwndparent: Param0, dialogtitle: Param1, sourcefile: Param2, targetfile: Param3, win32errorcode: u32, style: u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupBackupErrorW(hwndparent: super::super::Foundation::HWND, dialogtitle: super::super::Foundation::PWSTR, sourcefile: super::super::Foundation::PWSTR, targetfile: super::super::Foundation::PWSTR, win32errorcode: u32, style: u32) -> u32; } ::core::mem::transmute(SetupBackupErrorW(hwndparent.into_param().abi(), dialogtitle.into_param().abi(), sourcefile.into_param().abi(), targetfile.into_param().abi(), ::core::mem::transmute(win32errorcode), ::core::mem::transmute(style))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupCancelTemporarySourceList() -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupCancelTemporarySourceList() -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupCancelTemporarySourceList()) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupCloseFileQueue(queuehandle: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupCloseFileQueue(queuehandle: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupCloseFileQueue(::core::mem::transmute(queuehandle))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn SetupCloseInfFile(infhandle: *const ::core::ffi::c_void) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupCloseInfFile(infhandle: *const ::core::ffi::c_void); } ::core::mem::transmute(SetupCloseInfFile(::core::mem::transmute(infhandle))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn SetupCloseLog() { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupCloseLog(); } ::core::mem::transmute(SetupCloseLog()) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupCommitFileQueueA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(owner: Param0, queuehandle: *const ::core::ffi::c_void, msghandler: ::core::option::Option<PSP_FILE_CALLBACK_A>, context: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupCommitFileQueueA(owner: super::super::Foundation::HWND, queuehandle: *const ::core::ffi::c_void, msghandler: ::windows::core::RawPtr, context: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupCommitFileQueueA(owner.into_param().abi(), ::core::mem::transmute(queuehandle), ::core::mem::transmute(msghandler), ::core::mem::transmute(context))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupCommitFileQueueW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(owner: Param0, queuehandle: *const ::core::ffi::c_void, msghandler: ::core::option::Option<PSP_FILE_CALLBACK_W>, context: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupCommitFileQueueW(owner: super::super::Foundation::HWND, queuehandle: *const ::core::ffi::c_void, msghandler: ::windows::core::RawPtr, context: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupCommitFileQueueW(owner.into_param().abi(), ::core::mem::transmute(queuehandle), ::core::mem::transmute(msghandler), ::core::mem::transmute(context))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupConfigureWmiFromInfSectionA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infhandle: *const ::core::ffi::c_void, sectionname: Param1, flags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupConfigureWmiFromInfSectionA(infhandle: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PSTR, flags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupConfigureWmiFromInfSectionA(::core::mem::transmute(infhandle), sectionname.into_param().abi(), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupConfigureWmiFromInfSectionW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infhandle: *const ::core::ffi::c_void, sectionname: Param1, flags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupConfigureWmiFromInfSectionW(infhandle: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PWSTR, flags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupConfigureWmiFromInfSectionW(::core::mem::transmute(infhandle), sectionname.into_param().abi(), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupCopyErrorA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>( hwndparent: Param0, dialogtitle: Param1, diskname: Param2, pathtosource: Param3, sourcefile: Param4, targetpathfile: Param5, win32errorcode: u32, style: u32, pathbuffer: super::super::Foundation::PSTR, pathbuffersize: u32, pathrequiredsize: *mut u32, ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupCopyErrorA(hwndparent: super::super::Foundation::HWND, dialogtitle: super::super::Foundation::PSTR, diskname: super::super::Foundation::PSTR, pathtosource: super::super::Foundation::PSTR, sourcefile: super::super::Foundation::PSTR, targetpathfile: super::super::Foundation::PSTR, win32errorcode: u32, style: u32, pathbuffer: super::super::Foundation::PSTR, pathbuffersize: u32, pathrequiredsize: *mut u32) -> u32; } ::core::mem::transmute(SetupCopyErrorA( hwndparent.into_param().abi(), dialogtitle.into_param().abi(), diskname.into_param().abi(), pathtosource.into_param().abi(), sourcefile.into_param().abi(), targetpathfile.into_param().abi(), ::core::mem::transmute(win32errorcode), ::core::mem::transmute(style), ::core::mem::transmute(pathbuffer), ::core::mem::transmute(pathbuffersize), ::core::mem::transmute(pathrequiredsize), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupCopyErrorW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, 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>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>( hwndparent: Param0, dialogtitle: Param1, diskname: Param2, pathtosource: Param3, sourcefile: Param4, targetpathfile: Param5, win32errorcode: u32, style: u32, pathbuffer: super::super::Foundation::PWSTR, pathbuffersize: u32, pathrequiredsize: *mut u32, ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupCopyErrorW(hwndparent: super::super::Foundation::HWND, dialogtitle: super::super::Foundation::PWSTR, diskname: super::super::Foundation::PWSTR, pathtosource: super::super::Foundation::PWSTR, sourcefile: super::super::Foundation::PWSTR, targetpathfile: super::super::Foundation::PWSTR, win32errorcode: u32, style: u32, pathbuffer: super::super::Foundation::PWSTR, pathbuffersize: u32, pathrequiredsize: *mut u32) -> u32; } ::core::mem::transmute(SetupCopyErrorW( hwndparent.into_param().abi(), dialogtitle.into_param().abi(), diskname.into_param().abi(), pathtosource.into_param().abi(), sourcefile.into_param().abi(), targetpathfile.into_param().abi(), ::core::mem::transmute(win32errorcode), ::core::mem::transmute(style), ::core::mem::transmute(pathbuffer), ::core::mem::transmute(pathbuffersize), ::core::mem::transmute(pathrequiredsize), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupCopyOEMInfA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>( sourceinffilename: Param0, oemsourcemedialocation: Param1, oemsourcemediatype: OEM_SOURCE_MEDIA_TYPE, copystyle: u32, destinationinffilename: super::super::Foundation::PSTR, destinationinffilenamesize: u32, requiredsize: *mut u32, destinationinffilenamecomponent: *mut super::super::Foundation::PSTR, ) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupCopyOEMInfA(sourceinffilename: super::super::Foundation::PSTR, oemsourcemedialocation: super::super::Foundation::PSTR, oemsourcemediatype: OEM_SOURCE_MEDIA_TYPE, copystyle: u32, destinationinffilename: super::super::Foundation::PSTR, destinationinffilenamesize: u32, requiredsize: *mut u32, destinationinffilenamecomponent: *mut super::super::Foundation::PSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupCopyOEMInfA( sourceinffilename.into_param().abi(), oemsourcemedialocation.into_param().abi(), ::core::mem::transmute(oemsourcemediatype), ::core::mem::transmute(copystyle), ::core::mem::transmute(destinationinffilename), ::core::mem::transmute(destinationinffilenamesize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(destinationinffilenamecomponent), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupCopyOEMInfW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>( sourceinffilename: Param0, oemsourcemedialocation: Param1, oemsourcemediatype: OEM_SOURCE_MEDIA_TYPE, copystyle: u32, destinationinffilename: super::super::Foundation::PWSTR, destinationinffilenamesize: u32, requiredsize: *mut u32, destinationinffilenamecomponent: *mut super::super::Foundation::PWSTR, ) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupCopyOEMInfW(sourceinffilename: super::super::Foundation::PWSTR, oemsourcemedialocation: super::super::Foundation::PWSTR, oemsourcemediatype: OEM_SOURCE_MEDIA_TYPE, copystyle: u32, destinationinffilename: super::super::Foundation::PWSTR, destinationinffilenamesize: u32, requiredsize: *mut u32, destinationinffilenamecomponent: *mut super::super::Foundation::PWSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupCopyOEMInfW( sourceinffilename.into_param().abi(), oemsourcemedialocation.into_param().abi(), ::core::mem::transmute(oemsourcemediatype), ::core::mem::transmute(copystyle), ::core::mem::transmute(destinationinffilename), ::core::mem::transmute(destinationinffilenamesize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(destinationinffilenamecomponent), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn SetupCreateDiskSpaceListA(reserved1: *mut ::core::ffi::c_void, reserved2: u32, flags: u32) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupCreateDiskSpaceListA(reserved1: *mut ::core::ffi::c_void, reserved2: u32, flags: u32) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupCreateDiskSpaceListA(::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn SetupCreateDiskSpaceListW(reserved1: *mut ::core::ffi::c_void, reserved2: u32, flags: u32) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupCreateDiskSpaceListW(reserved1: *mut ::core::ffi::c_void, reserved2: u32, flags: u32) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupCreateDiskSpaceListW(::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDecompressOrCopyFileA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(sourcefilename: Param0, targetfilename: Param1, compressiontype: *const u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDecompressOrCopyFileA(sourcefilename: super::super::Foundation::PSTR, targetfilename: super::super::Foundation::PSTR, compressiontype: *const u32) -> u32; } ::core::mem::transmute(SetupDecompressOrCopyFileA(sourcefilename.into_param().abi(), targetfilename.into_param().abi(), ::core::mem::transmute(compressiontype))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDecompressOrCopyFileW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(sourcefilename: Param0, targetfilename: Param1, compressiontype: *const u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDecompressOrCopyFileW(sourcefilename: super::super::Foundation::PWSTR, targetfilename: super::super::Foundation::PWSTR, compressiontype: *const u32) -> u32; } ::core::mem::transmute(SetupDecompressOrCopyFileW(sourcefilename.into_param().abi(), targetfilename.into_param().abi(), ::core::mem::transmute(compressiontype))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn SetupDefaultQueueCallbackA(context: *const ::core::ffi::c_void, notification: u32, param1: usize, param2: usize) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDefaultQueueCallbackA(context: *const ::core::ffi::c_void, notification: u32, param1: usize, param2: usize) -> u32; } ::core::mem::transmute(SetupDefaultQueueCallbackA(::core::mem::transmute(context), ::core::mem::transmute(notification), ::core::mem::transmute(param1), ::core::mem::transmute(param2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn SetupDefaultQueueCallbackW(context: *const ::core::ffi::c_void, notification: u32, param1: usize, param2: usize) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDefaultQueueCallbackW(context: *const ::core::ffi::c_void, notification: u32, param1: usize, param2: usize) -> u32; } ::core::mem::transmute(SetupDefaultQueueCallbackW(::core::mem::transmute(context), ::core::mem::transmute(notification), ::core::mem::transmute(param1), ::core::mem::transmute(param2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDeleteErrorA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(hwndparent: Param0, dialogtitle: Param1, file: Param2, win32errorcode: u32, style: u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDeleteErrorA(hwndparent: super::super::Foundation::HWND, dialogtitle: super::super::Foundation::PSTR, file: super::super::Foundation::PSTR, win32errorcode: u32, style: u32) -> u32; } ::core::mem::transmute(SetupDeleteErrorA(hwndparent.into_param().abi(), dialogtitle.into_param().abi(), file.into_param().abi(), ::core::mem::transmute(win32errorcode), ::core::mem::transmute(style))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDeleteErrorW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hwndparent: Param0, dialogtitle: Param1, file: Param2, win32errorcode: u32, style: u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDeleteErrorW(hwndparent: super::super::Foundation::HWND, dialogtitle: super::super::Foundation::PWSTR, file: super::super::Foundation::PWSTR, win32errorcode: u32, style: u32) -> u32; } ::core::mem::transmute(SetupDeleteErrorW(hwndparent.into_param().abi(), dialogtitle.into_param().abi(), file.into_param().abi(), ::core::mem::transmute(win32errorcode), ::core::mem::transmute(style))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDestroyDiskSpaceList(diskspace: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDestroyDiskSpaceList(diskspace: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDestroyDiskSpaceList(::core::mem::transmute(diskspace))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiAskForOEMDisk(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiAskForOEMDisk(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiAskForOEMDisk(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiBuildClassInfoList(flags: u32, classguidlist: *mut ::windows::core::GUID, classguidlistsize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiBuildClassInfoList(flags: u32, classguidlist: *mut ::windows::core::GUID, classguidlistsize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiBuildClassInfoList(::core::mem::transmute(flags), ::core::mem::transmute(classguidlist), ::core::mem::transmute(classguidlistsize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiBuildClassInfoListExA<'a, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(flags: u32, classguidlist: *mut ::windows::core::GUID, classguidlistsize: u32, requiredsize: *mut u32, machinename: Param4, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiBuildClassInfoListExA(flags: u32, classguidlist: *mut ::windows::core::GUID, classguidlistsize: u32, requiredsize: *mut u32, machinename: super::super::Foundation::PSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiBuildClassInfoListExA(::core::mem::transmute(flags), ::core::mem::transmute(classguidlist), ::core::mem::transmute(classguidlistsize), ::core::mem::transmute(requiredsize), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiBuildClassInfoListExW<'a, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(flags: u32, classguidlist: *mut ::windows::core::GUID, classguidlistsize: u32, requiredsize: *mut u32, machinename: Param4, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiBuildClassInfoListExW(flags: u32, classguidlist: *mut ::windows::core::GUID, classguidlistsize: u32, requiredsize: *mut u32, machinename: super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiBuildClassInfoListExW(::core::mem::transmute(flags), ::core::mem::transmute(classguidlist), ::core::mem::transmute(classguidlistsize), ::core::mem::transmute(requiredsize), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiBuildDriverInfoList(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA, drivertype: SETUP_DI_BUILD_DRIVER_DRIVER_TYPE) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiBuildDriverInfoList(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA, drivertype: SETUP_DI_BUILD_DRIVER_DRIVER_TYPE) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiBuildDriverInfoList(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(drivertype))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiCallClassInstaller(installfunction: u32, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiCallClassInstaller(installfunction: u32, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiCallClassInstaller(::core::mem::transmute(installfunction), ::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiCancelDriverInfoSearch(deviceinfoset: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiCancelDriverInfoSearch(deviceinfoset: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiCancelDriverInfoSearch(::core::mem::transmute(deviceinfoset))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiChangeState(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiChangeState(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiChangeState(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiClassGuidsFromNameA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(classname: Param0, classguidlist: *mut ::windows::core::GUID, classguidlistsize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiClassGuidsFromNameA(classname: super::super::Foundation::PSTR, classguidlist: *mut ::windows::core::GUID, classguidlistsize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiClassGuidsFromNameA(classname.into_param().abi(), ::core::mem::transmute(classguidlist), ::core::mem::transmute(classguidlistsize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiClassGuidsFromNameExA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(classname: Param0, classguidlist: *mut ::windows::core::GUID, classguidlistsize: u32, requiredsize: *mut u32, machinename: Param4, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiClassGuidsFromNameExA(classname: super::super::Foundation::PSTR, classguidlist: *mut ::windows::core::GUID, classguidlistsize: u32, requiredsize: *mut u32, machinename: super::super::Foundation::PSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiClassGuidsFromNameExA(classname.into_param().abi(), ::core::mem::transmute(classguidlist), ::core::mem::transmute(classguidlistsize), ::core::mem::transmute(requiredsize), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiClassGuidsFromNameExW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(classname: Param0, classguidlist: *mut ::windows::core::GUID, classguidlistsize: u32, requiredsize: *mut u32, machinename: Param4, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiClassGuidsFromNameExW(classname: super::super::Foundation::PWSTR, classguidlist: *mut ::windows::core::GUID, classguidlistsize: u32, requiredsize: *mut u32, machinename: super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiClassGuidsFromNameExW(classname.into_param().abi(), ::core::mem::transmute(classguidlist), ::core::mem::transmute(classguidlistsize), ::core::mem::transmute(requiredsize), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiClassGuidsFromNameW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(classname: Param0, classguidlist: *mut ::windows::core::GUID, classguidlistsize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiClassGuidsFromNameW(classname: super::super::Foundation::PWSTR, classguidlist: *mut ::windows::core::GUID, classguidlistsize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiClassGuidsFromNameW(classname.into_param().abi(), ::core::mem::transmute(classguidlist), ::core::mem::transmute(classguidlistsize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiClassNameFromGuidA(classguid: *const ::windows::core::GUID, classname: super::super::Foundation::PSTR, classnamesize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiClassNameFromGuidA(classguid: *const ::windows::core::GUID, classname: super::super::Foundation::PSTR, classnamesize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiClassNameFromGuidA(::core::mem::transmute(classguid), ::core::mem::transmute(classname), ::core::mem::transmute(classnamesize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiClassNameFromGuidExA<'a, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(classguid: *const ::windows::core::GUID, classname: super::super::Foundation::PSTR, classnamesize: u32, requiredsize: *mut u32, machinename: Param4, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiClassNameFromGuidExA(classguid: *const ::windows::core::GUID, classname: super::super::Foundation::PSTR, classnamesize: u32, requiredsize: *mut u32, machinename: super::super::Foundation::PSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiClassNameFromGuidExA(::core::mem::transmute(classguid), ::core::mem::transmute(classname), ::core::mem::transmute(classnamesize), ::core::mem::transmute(requiredsize), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiClassNameFromGuidExW<'a, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(classguid: *const ::windows::core::GUID, classname: super::super::Foundation::PWSTR, classnamesize: u32, requiredsize: *mut u32, machinename: Param4, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiClassNameFromGuidExW(classguid: *const ::windows::core::GUID, classname: super::super::Foundation::PWSTR, classnamesize: u32, requiredsize: *mut u32, machinename: super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiClassNameFromGuidExW(::core::mem::transmute(classguid), ::core::mem::transmute(classname), ::core::mem::transmute(classnamesize), ::core::mem::transmute(requiredsize), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiClassNameFromGuidW(classguid: *const ::windows::core::GUID, classname: super::super::Foundation::PWSTR, classnamesize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiClassNameFromGuidW(classguid: *const ::windows::core::GUID, classname: super::super::Foundation::PWSTR, classnamesize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiClassNameFromGuidW(::core::mem::transmute(classguid), ::core::mem::transmute(classname), ::core::mem::transmute(classnamesize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Registry"))] #[inline] pub unsafe fn SetupDiCreateDevRegKeyA<'a, Param6: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, scope: u32, hwprofile: u32, keytype: u32, infhandle: *const ::core::ffi::c_void, infsectionname: Param6) -> super::super::System::Registry::HKEY { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiCreateDevRegKeyA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, scope: u32, hwprofile: u32, keytype: u32, infhandle: *const ::core::ffi::c_void, infsectionname: super::super::Foundation::PSTR) -> super::super::System::Registry::HKEY; } ::core::mem::transmute(SetupDiCreateDevRegKeyA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(scope), ::core::mem::transmute(hwprofile), ::core::mem::transmute(keytype), ::core::mem::transmute(infhandle), infsectionname.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Registry"))] #[inline] pub unsafe fn SetupDiCreateDevRegKeyW<'a, Param6: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, scope: u32, hwprofile: u32, keytype: u32, infhandle: *const ::core::ffi::c_void, infsectionname: Param6) -> super::super::System::Registry::HKEY { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiCreateDevRegKeyW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, scope: u32, hwprofile: u32, keytype: u32, infhandle: *const ::core::ffi::c_void, infsectionname: super::super::Foundation::PWSTR) -> super::super::System::Registry::HKEY; } ::core::mem::transmute(SetupDiCreateDevRegKeyW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(scope), ::core::mem::transmute(hwprofile), ::core::mem::transmute(keytype), ::core::mem::transmute(infhandle), infsectionname.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiCreateDeviceInfoA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>( deviceinfoset: *const ::core::ffi::c_void, devicename: Param1, classguid: *const ::windows::core::GUID, devicedescription: Param3, hwndparent: Param4, creationflags: u32, deviceinfodata: *mut SP_DEVINFO_DATA, ) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiCreateDeviceInfoA(deviceinfoset: *const ::core::ffi::c_void, devicename: super::super::Foundation::PSTR, classguid: *const ::windows::core::GUID, devicedescription: super::super::Foundation::PSTR, hwndparent: super::super::Foundation::HWND, creationflags: u32, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiCreateDeviceInfoA(::core::mem::transmute(deviceinfoset), devicename.into_param().abi(), ::core::mem::transmute(classguid), devicedescription.into_param().abi(), hwndparent.into_param().abi(), ::core::mem::transmute(creationflags), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiCreateDeviceInfoList<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(classguid: *const ::windows::core::GUID, hwndparent: Param1) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiCreateDeviceInfoList(classguid: *const ::windows::core::GUID, hwndparent: super::super::Foundation::HWND) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupDiCreateDeviceInfoList(::core::mem::transmute(classguid), hwndparent.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiCreateDeviceInfoListExA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(classguid: *const ::windows::core::GUID, hwndparent: Param1, machinename: Param2, reserved: *mut ::core::ffi::c_void) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiCreateDeviceInfoListExA(classguid: *const ::windows::core::GUID, hwndparent: super::super::Foundation::HWND, machinename: super::super::Foundation::PSTR, reserved: *mut ::core::ffi::c_void) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupDiCreateDeviceInfoListExA(::core::mem::transmute(classguid), hwndparent.into_param().abi(), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiCreateDeviceInfoListExW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(classguid: *const ::windows::core::GUID, hwndparent: Param1, machinename: Param2, reserved: *mut ::core::ffi::c_void) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiCreateDeviceInfoListExW(classguid: *const ::windows::core::GUID, hwndparent: super::super::Foundation::HWND, machinename: super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupDiCreateDeviceInfoListExW(::core::mem::transmute(classguid), hwndparent.into_param().abi(), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiCreateDeviceInfoW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>( deviceinfoset: *const ::core::ffi::c_void, devicename: Param1, classguid: *const ::windows::core::GUID, devicedescription: Param3, hwndparent: Param4, creationflags: u32, deviceinfodata: *mut SP_DEVINFO_DATA, ) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiCreateDeviceInfoW(deviceinfoset: *const ::core::ffi::c_void, devicename: super::super::Foundation::PWSTR, classguid: *const ::windows::core::GUID, devicedescription: super::super::Foundation::PWSTR, hwndparent: super::super::Foundation::HWND, creationflags: u32, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiCreateDeviceInfoW(::core::mem::transmute(deviceinfoset), devicename.into_param().abi(), ::core::mem::transmute(classguid), devicedescription.into_param().abi(), hwndparent.into_param().abi(), ::core::mem::transmute(creationflags), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiCreateDeviceInterfaceA<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, interfaceclassguid: *const ::windows::core::GUID, referencestring: Param3, creationflags: u32, deviceinterfacedata: *mut SP_DEVICE_INTERFACE_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiCreateDeviceInterfaceA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, interfaceclassguid: *const ::windows::core::GUID, referencestring: super::super::Foundation::PSTR, creationflags: u32, deviceinterfacedata: *mut SP_DEVICE_INTERFACE_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiCreateDeviceInterfaceA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(interfaceclassguid), referencestring.into_param().abi(), ::core::mem::transmute(creationflags), ::core::mem::transmute(deviceinterfacedata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Registry"))] #[inline] pub unsafe fn SetupDiCreateDeviceInterfaceRegKeyA<'a, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, reserved: u32, samdesired: u32, infhandle: *const ::core::ffi::c_void, infsectionname: Param5) -> super::super::System::Registry::HKEY { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiCreateDeviceInterfaceRegKeyA(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, reserved: u32, samdesired: u32, infhandle: *const ::core::ffi::c_void, infsectionname: super::super::Foundation::PSTR) -> super::super::System::Registry::HKEY; } ::core::mem::transmute(SetupDiCreateDeviceInterfaceRegKeyA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinterfacedata), ::core::mem::transmute(reserved), ::core::mem::transmute(samdesired), ::core::mem::transmute(infhandle), infsectionname.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Registry"))] #[inline] pub unsafe fn SetupDiCreateDeviceInterfaceRegKeyW<'a, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, reserved: u32, samdesired: u32, infhandle: *const ::core::ffi::c_void, infsectionname: Param5) -> super::super::System::Registry::HKEY { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiCreateDeviceInterfaceRegKeyW(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, reserved: u32, samdesired: u32, infhandle: *const ::core::ffi::c_void, infsectionname: super::super::Foundation::PWSTR) -> super::super::System::Registry::HKEY; } ::core::mem::transmute(SetupDiCreateDeviceInterfaceRegKeyW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinterfacedata), ::core::mem::transmute(reserved), ::core::mem::transmute(samdesired), ::core::mem::transmute(infhandle), infsectionname.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiCreateDeviceInterfaceW<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, interfaceclassguid: *const ::windows::core::GUID, referencestring: Param3, creationflags: u32, deviceinterfacedata: *mut SP_DEVICE_INTERFACE_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiCreateDeviceInterfaceW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, interfaceclassguid: *const ::windows::core::GUID, referencestring: super::super::Foundation::PWSTR, creationflags: u32, deviceinterfacedata: *mut SP_DEVICE_INTERFACE_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiCreateDeviceInterfaceW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(interfaceclassguid), referencestring.into_param().abi(), ::core::mem::transmute(creationflags), ::core::mem::transmute(deviceinterfacedata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiDeleteDevRegKey(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, scope: u32, hwprofile: u32, keytype: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiDeleteDevRegKey(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, scope: u32, hwprofile: u32, keytype: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiDeleteDevRegKey(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(scope), ::core::mem::transmute(hwprofile), ::core::mem::transmute(keytype))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiDeleteDeviceInfo(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiDeleteDeviceInfo(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiDeleteDeviceInfo(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiDeleteDeviceInterfaceData(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiDeleteDeviceInterfaceData(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiDeleteDeviceInterfaceData(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinterfacedata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiDeleteDeviceInterfaceRegKey(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, reserved: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiDeleteDeviceInterfaceRegKey(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, reserved: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiDeleteDeviceInterfaceRegKey(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinterfacedata), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] #[inline] pub unsafe fn SetupDiDestroyClassImageList(classimagelistdata: *const SP_CLASSIMAGELIST_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiDestroyClassImageList(classimagelistdata: *const SP_CLASSIMAGELIST_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiDestroyClassImageList(::core::mem::transmute(classimagelistdata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiDestroyDeviceInfoList(deviceinfoset: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiDestroyDeviceInfoList(deviceinfoset: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiDestroyDeviceInfoList(::core::mem::transmute(deviceinfoset))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiDestroyDriverInfoList(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, drivertype: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiDestroyDriverInfoList(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, drivertype: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiDestroyDriverInfoList(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(drivertype))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Graphics_Gdi"))] #[inline] pub unsafe fn SetupDiDrawMiniIcon<'a, Param0: ::windows::core::IntoParam<'a, super::super::Graphics::Gdi::HDC>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::RECT>>(hdc: Param0, rc: Param1, miniiconindex: i32, flags: u32) -> i32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiDrawMiniIcon(hdc: super::super::Graphics::Gdi::HDC, rc: super::super::Foundation::RECT, miniiconindex: i32, flags: u32) -> i32; } ::core::mem::transmute(SetupDiDrawMiniIcon(hdc.into_param().abi(), rc.into_param().abi(), ::core::mem::transmute(miniiconindex), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiEnumDeviceInfo(deviceinfoset: *const ::core::ffi::c_void, memberindex: u32, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiEnumDeviceInfo(deviceinfoset: *const ::core::ffi::c_void, memberindex: u32, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiEnumDeviceInfo(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(memberindex), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiEnumDeviceInterfaces(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, interfaceclassguid: *const ::windows::core::GUID, memberindex: u32, deviceinterfacedata: *mut SP_DEVICE_INTERFACE_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiEnumDeviceInterfaces(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, interfaceclassguid: *const ::windows::core::GUID, memberindex: u32, deviceinterfacedata: *mut SP_DEVICE_INTERFACE_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiEnumDeviceInterfaces(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(interfaceclassguid), ::core::mem::transmute(memberindex), ::core::mem::transmute(deviceinterfacedata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiEnumDriverInfoA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, drivertype: u32, memberindex: u32, driverinfodata: *mut SP_DRVINFO_DATA_V2_A) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiEnumDriverInfoA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, drivertype: u32, memberindex: u32, driverinfodata: *mut SP_DRVINFO_DATA_V2_A) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiEnumDriverInfoA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(drivertype), ::core::mem::transmute(memberindex), ::core::mem::transmute(driverinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiEnumDriverInfoW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, drivertype: u32, memberindex: u32, driverinfodata: *mut SP_DRVINFO_DATA_V2_W) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiEnumDriverInfoW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, drivertype: u32, memberindex: u32, driverinfodata: *mut SP_DRVINFO_DATA_V2_W) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiEnumDriverInfoW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(drivertype), ::core::mem::transmute(memberindex), ::core::mem::transmute(driverinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Diagnostics_Debug"))] #[inline] pub unsafe fn SetupDiGetActualModelsSectionA(context: *const INFCONTEXT, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, infsectionwithext: super::super::Foundation::PSTR, infsectionwithextsize: u32, requiredsize: *mut u32, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetActualModelsSectionA(context: *const INFCONTEXT, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, infsectionwithext: super::super::Foundation::PSTR, infsectionwithextsize: u32, requiredsize: *mut u32, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetActualModelsSectionA(::core::mem::transmute(context), ::core::mem::transmute(alternateplatforminfo), ::core::mem::transmute(infsectionwithext), ::core::mem::transmute(infsectionwithextsize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Diagnostics_Debug"))] #[inline] pub unsafe fn SetupDiGetActualModelsSectionW(context: *const INFCONTEXT, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, infsectionwithext: super::super::Foundation::PWSTR, infsectionwithextsize: u32, requiredsize: *mut u32, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetActualModelsSectionW(context: *const INFCONTEXT, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, infsectionwithext: super::super::Foundation::PWSTR, infsectionwithextsize: u32, requiredsize: *mut u32, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetActualModelsSectionW(::core::mem::transmute(context), ::core::mem::transmute(alternateplatforminfo), ::core::mem::transmute(infsectionwithext), ::core::mem::transmute(infsectionwithextsize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetActualSectionToInstallA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infhandle: *const ::core::ffi::c_void, infsectionname: Param1, infsectionwithext: super::super::Foundation::PSTR, infsectionwithextsize: u32, requiredsize: *mut u32, extension: *mut super::super::Foundation::PSTR) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetActualSectionToInstallA(infhandle: *const ::core::ffi::c_void, infsectionname: super::super::Foundation::PSTR, infsectionwithext: super::super::Foundation::PSTR, infsectionwithextsize: u32, requiredsize: *mut u32, extension: *mut super::super::Foundation::PSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetActualSectionToInstallA(::core::mem::transmute(infhandle), infsectionname.into_param().abi(), ::core::mem::transmute(infsectionwithext), ::core::mem::transmute(infsectionwithextsize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(extension))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Diagnostics_Debug"))] #[inline] pub unsafe fn SetupDiGetActualSectionToInstallExA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infhandle: *const ::core::ffi::c_void, infsectionname: Param1, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, infsectionwithext: super::super::Foundation::PSTR, infsectionwithextsize: u32, requiredsize: *mut u32, extension: *mut super::super::Foundation::PSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetActualSectionToInstallExA(infhandle: *const ::core::ffi::c_void, infsectionname: super::super::Foundation::PSTR, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, infsectionwithext: super::super::Foundation::PSTR, infsectionwithextsize: u32, requiredsize: *mut u32, extension: *mut super::super::Foundation::PSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetActualSectionToInstallExA( ::core::mem::transmute(infhandle), infsectionname.into_param().abi(), ::core::mem::transmute(alternateplatforminfo), ::core::mem::transmute(infsectionwithext), ::core::mem::transmute(infsectionwithextsize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(extension), ::core::mem::transmute(reserved), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Diagnostics_Debug"))] #[inline] pub unsafe fn SetupDiGetActualSectionToInstallExW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infhandle: *const ::core::ffi::c_void, infsectionname: Param1, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, infsectionwithext: super::super::Foundation::PWSTR, infsectionwithextsize: u32, requiredsize: *mut u32, extension: *mut super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetActualSectionToInstallExW(infhandle: *const ::core::ffi::c_void, infsectionname: super::super::Foundation::PWSTR, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, infsectionwithext: super::super::Foundation::PWSTR, infsectionwithextsize: u32, requiredsize: *mut u32, extension: *mut super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetActualSectionToInstallExW( ::core::mem::transmute(infhandle), infsectionname.into_param().abi(), ::core::mem::transmute(alternateplatforminfo), ::core::mem::transmute(infsectionwithext), ::core::mem::transmute(infsectionwithextsize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(extension), ::core::mem::transmute(reserved), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetActualSectionToInstallW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infhandle: *const ::core::ffi::c_void, infsectionname: Param1, infsectionwithext: super::super::Foundation::PWSTR, infsectionwithextsize: u32, requiredsize: *mut u32, extension: *mut super::super::Foundation::PWSTR) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetActualSectionToInstallW(infhandle: *const ::core::ffi::c_void, infsectionname: super::super::Foundation::PWSTR, infsectionwithext: super::super::Foundation::PWSTR, infsectionwithextsize: u32, requiredsize: *mut u32, extension: *mut super::super::Foundation::PWSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetActualSectionToInstallW(::core::mem::transmute(infhandle), infsectionname.into_param().abi(), ::core::mem::transmute(infsectionwithext), ::core::mem::transmute(infsectionwithextsize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(extension))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetClassBitmapIndex(classguid: *const ::windows::core::GUID, miniiconindex: *mut i32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassBitmapIndex(classguid: *const ::windows::core::GUID, miniiconindex: *mut i32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassBitmapIndex(::core::mem::transmute(classguid), ::core::mem::transmute(miniiconindex))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetClassDescriptionA(classguid: *const ::windows::core::GUID, classdescription: super::super::Foundation::PSTR, classdescriptionsize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassDescriptionA(classguid: *const ::windows::core::GUID, classdescription: super::super::Foundation::PSTR, classdescriptionsize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassDescriptionA(::core::mem::transmute(classguid), ::core::mem::transmute(classdescription), ::core::mem::transmute(classdescriptionsize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetClassDescriptionExA<'a, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(classguid: *const ::windows::core::GUID, classdescription: super::super::Foundation::PSTR, classdescriptionsize: u32, requiredsize: *mut u32, machinename: Param4, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassDescriptionExA(classguid: *const ::windows::core::GUID, classdescription: super::super::Foundation::PSTR, classdescriptionsize: u32, requiredsize: *mut u32, machinename: super::super::Foundation::PSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassDescriptionExA(::core::mem::transmute(classguid), ::core::mem::transmute(classdescription), ::core::mem::transmute(classdescriptionsize), ::core::mem::transmute(requiredsize), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetClassDescriptionExW<'a, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(classguid: *const ::windows::core::GUID, classdescription: super::super::Foundation::PWSTR, classdescriptionsize: u32, requiredsize: *mut u32, machinename: Param4, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassDescriptionExW(classguid: *const ::windows::core::GUID, classdescription: super::super::Foundation::PWSTR, classdescriptionsize: u32, requiredsize: *mut u32, machinename: super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassDescriptionExW(::core::mem::transmute(classguid), ::core::mem::transmute(classdescription), ::core::mem::transmute(classdescriptionsize), ::core::mem::transmute(requiredsize), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetClassDescriptionW(classguid: *const ::windows::core::GUID, classdescription: super::super::Foundation::PWSTR, classdescriptionsize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassDescriptionW(classguid: *const ::windows::core::GUID, classdescription: super::super::Foundation::PWSTR, classdescriptionsize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassDescriptionW(::core::mem::transmute(classguid), ::core::mem::transmute(classdescription), ::core::mem::transmute(classdescriptionsize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Graphics_Gdi", feature = "Win32_UI_Controls", feature = "Win32_UI_WindowsAndMessaging"))] #[inline] pub unsafe fn SetupDiGetClassDevPropertySheetsA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, propertysheetheader: *const super::super::UI::Controls::PROPSHEETHEADERA_V2, propertysheetheaderpagelistsize: u32, requiredsize: *mut u32, propertysheettype: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassDevPropertySheetsA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, propertysheetheader: *const ::core::mem::ManuallyDrop<super::super::UI::Controls::PROPSHEETHEADERA_V2>, propertysheetheaderpagelistsize: u32, requiredsize: *mut u32, propertysheettype: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassDevPropertySheetsA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(propertysheetheader), ::core::mem::transmute(propertysheetheaderpagelistsize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(propertysheettype))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_Graphics_Gdi", feature = "Win32_UI_Controls", feature = "Win32_UI_WindowsAndMessaging"))] #[inline] pub unsafe fn SetupDiGetClassDevPropertySheetsW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, propertysheetheader: *const super::super::UI::Controls::PROPSHEETHEADERW_V2, propertysheetheaderpagelistsize: u32, requiredsize: *mut u32, propertysheettype: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassDevPropertySheetsW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, propertysheetheader: *const ::core::mem::ManuallyDrop<super::super::UI::Controls::PROPSHEETHEADERW_V2>, propertysheetheaderpagelistsize: u32, requiredsize: *mut u32, propertysheettype: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassDevPropertySheetsW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(propertysheetheader), ::core::mem::transmute(propertysheetheaderpagelistsize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(propertysheettype))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetClassDevsA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(classguid: *const ::windows::core::GUID, enumerator: Param1, hwndparent: Param2, flags: u32) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassDevsA(classguid: *const ::windows::core::GUID, enumerator: super::super::Foundation::PSTR, hwndparent: super::super::Foundation::HWND, flags: u32) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupDiGetClassDevsA(::core::mem::transmute(classguid), enumerator.into_param().abi(), hwndparent.into_param().abi(), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetClassDevsExA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(classguid: *const ::windows::core::GUID, enumerator: Param1, hwndparent: Param2, flags: u32, deviceinfoset: *const ::core::ffi::c_void, machinename: Param5, reserved: *mut ::core::ffi::c_void) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassDevsExA(classguid: *const ::windows::core::GUID, enumerator: super::super::Foundation::PSTR, hwndparent: super::super::Foundation::HWND, flags: u32, deviceinfoset: *const ::core::ffi::c_void, machinename: super::super::Foundation::PSTR, reserved: *mut ::core::ffi::c_void) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupDiGetClassDevsExA(::core::mem::transmute(classguid), enumerator.into_param().abi(), hwndparent.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(deviceinfoset), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetClassDevsExW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(classguid: *const ::windows::core::GUID, enumerator: Param1, hwndparent: Param2, flags: u32, deviceinfoset: *const ::core::ffi::c_void, machinename: Param5, reserved: *mut ::core::ffi::c_void) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassDevsExW(classguid: *const ::windows::core::GUID, enumerator: super::super::Foundation::PWSTR, hwndparent: super::super::Foundation::HWND, flags: u32, deviceinfoset: *const ::core::ffi::c_void, machinename: super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupDiGetClassDevsExW(::core::mem::transmute(classguid), enumerator.into_param().abi(), hwndparent.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(deviceinfoset), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetClassDevsW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(classguid: *const ::windows::core::GUID, enumerator: Param1, hwndparent: Param2, flags: u32) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassDevsW(classguid: *const ::windows::core::GUID, enumerator: super::super::Foundation::PWSTR, hwndparent: super::super::Foundation::HWND, flags: u32) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupDiGetClassDevsW(::core::mem::transmute(classguid), enumerator.into_param().abi(), hwndparent.into_param().abi(), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] #[inline] pub unsafe fn SetupDiGetClassImageIndex(classimagelistdata: *const SP_CLASSIMAGELIST_DATA, classguid: *const ::windows::core::GUID, imageindex: *mut i32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassImageIndex(classimagelistdata: *const SP_CLASSIMAGELIST_DATA, classguid: *const ::windows::core::GUID, imageindex: *mut i32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassImageIndex(::core::mem::transmute(classimagelistdata), ::core::mem::transmute(classguid), ::core::mem::transmute(imageindex))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] #[inline] pub unsafe fn SetupDiGetClassImageList(classimagelistdata: *mut SP_CLASSIMAGELIST_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassImageList(classimagelistdata: *mut SP_CLASSIMAGELIST_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassImageList(::core::mem::transmute(classimagelistdata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] #[inline] pub unsafe fn SetupDiGetClassImageListExA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(classimagelistdata: *mut SP_CLASSIMAGELIST_DATA, machinename: Param1, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassImageListExA(classimagelistdata: *mut SP_CLASSIMAGELIST_DATA, machinename: super::super::Foundation::PSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassImageListExA(::core::mem::transmute(classimagelistdata), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] #[inline] pub unsafe fn SetupDiGetClassImageListExW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(classimagelistdata: *mut SP_CLASSIMAGELIST_DATA, machinename: Param1, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassImageListExW(classimagelistdata: *mut SP_CLASSIMAGELIST_DATA, machinename: super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassImageListExW(::core::mem::transmute(classimagelistdata), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetClassInstallParamsA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, classinstallparams: *mut SP_CLASSINSTALL_HEADER, classinstallparamssize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassInstallParamsA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, classinstallparams: *mut SP_CLASSINSTALL_HEADER, classinstallparamssize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassInstallParamsA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(classinstallparams), ::core::mem::transmute(classinstallparamssize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetClassInstallParamsW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, classinstallparams: *mut SP_CLASSINSTALL_HEADER, classinstallparamssize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassInstallParamsW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, classinstallparams: *mut SP_CLASSINSTALL_HEADER, classinstallparamssize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassInstallParamsW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(classinstallparams), ::core::mem::transmute(classinstallparamssize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn SetupDiGetClassPropertyExW<'a, Param7: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(classguid: *const ::windows::core::GUID, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32, flags: u32, machinename: Param7, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassPropertyExW(classguid: *const ::windows::core::GUID, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32, flags: u32, machinename: super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassPropertyExW( ::core::mem::transmute(classguid), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(flags), machinename.into_param().abi(), ::core::mem::transmute(reserved), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn SetupDiGetClassPropertyKeys(classguid: *const ::windows::core::GUID, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: u32, requiredpropertykeycount: *mut u32, flags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassPropertyKeys(classguid: *const ::windows::core::GUID, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: u32, requiredpropertykeycount: *mut u32, flags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassPropertyKeys(::core::mem::transmute(classguid), ::core::mem::transmute(propertykeyarray), ::core::mem::transmute(propertykeycount), ::core::mem::transmute(requiredpropertykeycount), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn SetupDiGetClassPropertyKeysExW<'a, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(classguid: *const ::windows::core::GUID, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: u32, requiredpropertykeycount: *mut u32, flags: u32, machinename: Param5, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassPropertyKeysExW(classguid: *const ::windows::core::GUID, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: u32, requiredpropertykeycount: *mut u32, flags: u32, machinename: super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassPropertyKeysExW(::core::mem::transmute(classguid), ::core::mem::transmute(propertykeyarray), ::core::mem::transmute(propertykeycount), ::core::mem::transmute(requiredpropertykeycount), ::core::mem::transmute(flags), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn SetupDiGetClassPropertyW(classguid: *const ::windows::core::GUID, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32, flags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassPropertyW(classguid: *const ::windows::core::GUID, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32, flags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassPropertyW(::core::mem::transmute(classguid), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetClassRegistryPropertyA<'a, Param6: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(classguid: *const ::windows::core::GUID, property: u32, propertyregdatatype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32, machinename: Param6, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassRegistryPropertyA(classguid: *const ::windows::core::GUID, property: u32, propertyregdatatype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32, machinename: super::super::Foundation::PSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassRegistryPropertyA( ::core::mem::transmute(classguid), ::core::mem::transmute(property), ::core::mem::transmute(propertyregdatatype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(requiredsize), machinename.into_param().abi(), ::core::mem::transmute(reserved), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetClassRegistryPropertyW<'a, Param6: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(classguid: *const ::windows::core::GUID, property: u32, propertyregdatatype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32, machinename: Param6, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetClassRegistryPropertyW(classguid: *const ::windows::core::GUID, property: u32, propertyregdatatype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32, machinename: super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetClassRegistryPropertyW( ::core::mem::transmute(classguid), ::core::mem::transmute(property), ::core::mem::transmute(propertyregdatatype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(requiredsize), machinename.into_param().abi(), ::core::mem::transmute(reserved), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetCustomDevicePropertyA<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, custompropertyname: Param2, flags: u32, propertyregdatatype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetCustomDevicePropertyA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, custompropertyname: super::super::Foundation::PSTR, flags: u32, propertyregdatatype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetCustomDevicePropertyA( ::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), custompropertyname.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(propertyregdatatype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(requiredsize), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetCustomDevicePropertyW<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, custompropertyname: Param2, flags: u32, propertyregdatatype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetCustomDevicePropertyW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, custompropertyname: super::super::Foundation::PWSTR, flags: u32, propertyregdatatype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetCustomDevicePropertyW( ::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), custompropertyname.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(propertyregdatatype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(requiredsize), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetDeviceInfoListClass(deviceinfoset: *const ::core::ffi::c_void, classguid: *mut ::windows::core::GUID) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDeviceInfoListClass(deviceinfoset: *const ::core::ffi::c_void, classguid: *mut ::windows::core::GUID) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDeviceInfoListClass(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(classguid))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetDeviceInfoListDetailA(deviceinfoset: *const ::core::ffi::c_void, deviceinfosetdetaildata: *mut SP_DEVINFO_LIST_DETAIL_DATA_A) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDeviceInfoListDetailA(deviceinfoset: *const ::core::ffi::c_void, deviceinfosetdetaildata: *mut SP_DEVINFO_LIST_DETAIL_DATA_A) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDeviceInfoListDetailA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfosetdetaildata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetDeviceInfoListDetailW(deviceinfoset: *const ::core::ffi::c_void, deviceinfosetdetaildata: *mut SP_DEVINFO_LIST_DETAIL_DATA_W) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDeviceInfoListDetailW(deviceinfoset: *const ::core::ffi::c_void, deviceinfosetdetaildata: *mut SP_DEVINFO_LIST_DETAIL_DATA_W) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDeviceInfoListDetailW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfosetdetaildata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetDeviceInstallParamsA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, deviceinstallparams: *mut SP_DEVINSTALL_PARAMS_A) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDeviceInstallParamsA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, deviceinstallparams: *mut ::core::mem::ManuallyDrop<SP_DEVINSTALL_PARAMS_A>) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDeviceInstallParamsA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(deviceinstallparams))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetDeviceInstallParamsW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, deviceinstallparams: *mut SP_DEVINSTALL_PARAMS_W) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDeviceInstallParamsW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, deviceinstallparams: *mut ::core::mem::ManuallyDrop<SP_DEVINSTALL_PARAMS_W>) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDeviceInstallParamsW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(deviceinstallparams))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetDeviceInstanceIdA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, deviceinstanceid: super::super::Foundation::PSTR, deviceinstanceidsize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDeviceInstanceIdA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, deviceinstanceid: super::super::Foundation::PSTR, deviceinstanceidsize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDeviceInstanceIdA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(deviceinstanceid), ::core::mem::transmute(deviceinstanceidsize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetDeviceInstanceIdW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, deviceinstanceid: super::super::Foundation::PWSTR, deviceinstanceidsize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDeviceInstanceIdW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, deviceinstanceid: super::super::Foundation::PWSTR, deviceinstanceidsize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDeviceInstanceIdW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(deviceinstanceid), ::core::mem::transmute(deviceinstanceidsize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetDeviceInterfaceAlias(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, aliasinterfaceclassguid: *const ::windows::core::GUID, aliasdeviceinterfacedata: *mut SP_DEVICE_INTERFACE_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDeviceInterfaceAlias(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, aliasinterfaceclassguid: *const ::windows::core::GUID, aliasdeviceinterfacedata: *mut SP_DEVICE_INTERFACE_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDeviceInterfaceAlias(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinterfacedata), ::core::mem::transmute(aliasinterfaceclassguid), ::core::mem::transmute(aliasdeviceinterfacedata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetDeviceInterfaceDetailA(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, deviceinterfacedetaildata: *mut SP_DEVICE_INTERFACE_DETAIL_DATA_A, deviceinterfacedetaildatasize: u32, requiredsize: *mut u32, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDeviceInterfaceDetailA(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, deviceinterfacedetaildata: *mut SP_DEVICE_INTERFACE_DETAIL_DATA_A, deviceinterfacedetaildatasize: u32, requiredsize: *mut u32, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDeviceInterfaceDetailA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinterfacedata), ::core::mem::transmute(deviceinterfacedetaildata), ::core::mem::transmute(deviceinterfacedetaildatasize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetDeviceInterfaceDetailW(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, deviceinterfacedetaildata: *mut SP_DEVICE_INTERFACE_DETAIL_DATA_W, deviceinterfacedetaildatasize: u32, requiredsize: *mut u32, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDeviceInterfaceDetailW(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, deviceinterfacedetaildata: *mut SP_DEVICE_INTERFACE_DETAIL_DATA_W, deviceinterfacedetaildatasize: u32, requiredsize: *mut u32, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDeviceInterfaceDetailW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinterfacedata), ::core::mem::transmute(deviceinterfacedetaildata), ::core::mem::transmute(deviceinterfacedetaildatasize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn SetupDiGetDeviceInterfacePropertyKeys(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: u32, requiredpropertykeycount: *mut u32, flags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDeviceInterfacePropertyKeys(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: u32, requiredpropertykeycount: *mut u32, flags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDeviceInterfacePropertyKeys(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinterfacedata), ::core::mem::transmute(propertykeyarray), ::core::mem::transmute(propertykeycount), ::core::mem::transmute(requiredpropertykeycount), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn SetupDiGetDeviceInterfacePropertyW(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32, flags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDeviceInterfacePropertyW(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32, flags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDeviceInterfacePropertyW( ::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinterfacedata), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(flags), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn SetupDiGetDevicePropertyKeys(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: u32, requiredpropertykeycount: *mut u32, flags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDevicePropertyKeys(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, propertykeyarray: *mut super::Properties::DEVPROPKEY, propertykeycount: u32, requiredpropertykeycount: *mut u32, flags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDevicePropertyKeys(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(propertykeyarray), ::core::mem::transmute(propertykeycount), ::core::mem::transmute(requiredpropertykeycount), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn SetupDiGetDevicePropertyW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32, flags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDevicePropertyW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, propertykey: *const super::Properties::DEVPROPKEY, propertytype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32, flags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDevicePropertyW( ::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(flags), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetDeviceRegistryPropertyA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, property: u32, propertyregdatatype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDeviceRegistryPropertyA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, property: u32, propertyregdatatype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDeviceRegistryPropertyA( ::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(property), ::core::mem::transmute(propertyregdatatype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(requiredsize), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetDeviceRegistryPropertyW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, property: u32, propertyregdatatype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDeviceRegistryPropertyW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, property: u32, propertyregdatatype: *mut u32, propertybuffer: *mut u8, propertybuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDeviceRegistryPropertyW( ::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(property), ::core::mem::transmute(propertyregdatatype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(requiredsize), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetDriverInfoDetailA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *const SP_DRVINFO_DATA_V2_A, driverinfodetaildata: *mut SP_DRVINFO_DETAIL_DATA_A, driverinfodetaildatasize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDriverInfoDetailA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *const SP_DRVINFO_DATA_V2_A, driverinfodetaildata: *mut SP_DRVINFO_DETAIL_DATA_A, driverinfodetaildatasize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDriverInfoDetailA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(driverinfodata), ::core::mem::transmute(driverinfodetaildata), ::core::mem::transmute(driverinfodetaildatasize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetDriverInfoDetailW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *const SP_DRVINFO_DATA_V2_W, driverinfodetaildata: *mut SP_DRVINFO_DETAIL_DATA_W, driverinfodetaildatasize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDriverInfoDetailW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *const SP_DRVINFO_DATA_V2_W, driverinfodetaildata: *mut SP_DRVINFO_DETAIL_DATA_W, driverinfodetaildatasize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDriverInfoDetailW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(driverinfodata), ::core::mem::transmute(driverinfodetaildata), ::core::mem::transmute(driverinfodetaildatasize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetDriverInstallParamsA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *const SP_DRVINFO_DATA_V2_A, driverinstallparams: *mut SP_DRVINSTALL_PARAMS) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDriverInstallParamsA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *const SP_DRVINFO_DATA_V2_A, driverinstallparams: *mut SP_DRVINSTALL_PARAMS) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDriverInstallParamsA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(driverinfodata), ::core::mem::transmute(driverinstallparams))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetDriverInstallParamsW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *const SP_DRVINFO_DATA_V2_W, driverinstallparams: *mut SP_DRVINSTALL_PARAMS) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetDriverInstallParamsW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *const SP_DRVINFO_DATA_V2_W, driverinstallparams: *mut SP_DRVINSTALL_PARAMS) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetDriverInstallParamsW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(driverinfodata), ::core::mem::transmute(driverinstallparams))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetHwProfileFriendlyNameA(hwprofile: u32, friendlyname: super::super::Foundation::PSTR, friendlynamesize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetHwProfileFriendlyNameA(hwprofile: u32, friendlyname: super::super::Foundation::PSTR, friendlynamesize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetHwProfileFriendlyNameA(::core::mem::transmute(hwprofile), ::core::mem::transmute(friendlyname), ::core::mem::transmute(friendlynamesize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetHwProfileFriendlyNameExA<'a, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(hwprofile: u32, friendlyname: super::super::Foundation::PSTR, friendlynamesize: u32, requiredsize: *mut u32, machinename: Param4, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetHwProfileFriendlyNameExA(hwprofile: u32, friendlyname: super::super::Foundation::PSTR, friendlynamesize: u32, requiredsize: *mut u32, machinename: super::super::Foundation::PSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetHwProfileFriendlyNameExA(::core::mem::transmute(hwprofile), ::core::mem::transmute(friendlyname), ::core::mem::transmute(friendlynamesize), ::core::mem::transmute(requiredsize), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetHwProfileFriendlyNameExW<'a, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hwprofile: u32, friendlyname: super::super::Foundation::PWSTR, friendlynamesize: u32, requiredsize: *mut u32, machinename: Param4, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetHwProfileFriendlyNameExW(hwprofile: u32, friendlyname: super::super::Foundation::PWSTR, friendlynamesize: u32, requiredsize: *mut u32, machinename: super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetHwProfileFriendlyNameExW(::core::mem::transmute(hwprofile), ::core::mem::transmute(friendlyname), ::core::mem::transmute(friendlynamesize), ::core::mem::transmute(requiredsize), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetHwProfileFriendlyNameW(hwprofile: u32, friendlyname: super::super::Foundation::PWSTR, friendlynamesize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetHwProfileFriendlyNameW(hwprofile: u32, friendlyname: super::super::Foundation::PWSTR, friendlynamesize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetHwProfileFriendlyNameW(::core::mem::transmute(hwprofile), ::core::mem::transmute(friendlyname), ::core::mem::transmute(friendlynamesize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetHwProfileList(hwprofilelist: *mut u32, hwprofilelistsize: u32, requiredsize: *mut u32, currentlyactiveindex: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetHwProfileList(hwprofilelist: *mut u32, hwprofilelistsize: u32, requiredsize: *mut u32, currentlyactiveindex: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetHwProfileList(::core::mem::transmute(hwprofilelist), ::core::mem::transmute(hwprofilelistsize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(currentlyactiveindex))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetHwProfileListExA<'a, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(hwprofilelist: *mut u32, hwprofilelistsize: u32, requiredsize: *mut u32, currentlyactiveindex: *mut u32, machinename: Param4, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetHwProfileListExA(hwprofilelist: *mut u32, hwprofilelistsize: u32, requiredsize: *mut u32, currentlyactiveindex: *mut u32, machinename: super::super::Foundation::PSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetHwProfileListExA(::core::mem::transmute(hwprofilelist), ::core::mem::transmute(hwprofilelistsize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(currentlyactiveindex), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetHwProfileListExW<'a, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hwprofilelist: *mut u32, hwprofilelistsize: u32, requiredsize: *mut u32, currentlyactiveindex: *mut u32, machinename: Param4, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetHwProfileListExW(hwprofilelist: *mut u32, hwprofilelistsize: u32, requiredsize: *mut u32, currentlyactiveindex: *mut u32, machinename: super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetHwProfileListExW(::core::mem::transmute(hwprofilelist), ::core::mem::transmute(hwprofilelistsize), ::core::mem::transmute(requiredsize), ::core::mem::transmute(currentlyactiveindex), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetINFClassA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infname: Param0, classguid: *mut ::windows::core::GUID, classname: super::super::Foundation::PSTR, classnamesize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetINFClassA(infname: super::super::Foundation::PSTR, classguid: *mut ::windows::core::GUID, classname: super::super::Foundation::PSTR, classnamesize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetINFClassA(infname.into_param().abi(), ::core::mem::transmute(classguid), ::core::mem::transmute(classname), ::core::mem::transmute(classnamesize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetINFClassW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infname: Param0, classguid: *mut ::windows::core::GUID, classname: super::super::Foundation::PWSTR, classnamesize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetINFClassW(infname: super::super::Foundation::PWSTR, classguid: *mut ::windows::core::GUID, classname: super::super::Foundation::PWSTR, classnamesize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetINFClassW(infname.into_param().abi(), ::core::mem::transmute(classguid), ::core::mem::transmute(classname), ::core::mem::transmute(classnamesize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetSelectedDevice(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetSelectedDevice(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetSelectedDevice(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetSelectedDriverA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *mut SP_DRVINFO_DATA_V2_A) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetSelectedDriverA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *mut SP_DRVINFO_DATA_V2_A) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetSelectedDriverA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(driverinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiGetSelectedDriverW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *mut SP_DRVINFO_DATA_V2_W) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetSelectedDriverW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *mut SP_DRVINFO_DATA_V2_W) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiGetSelectedDriverW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(driverinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_Controls"))] #[inline] pub unsafe fn SetupDiGetWizardPage(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, installwizarddata: *const SP_INSTALLWIZARD_DATA, pagetype: u32, flags: u32) -> super::super::UI::Controls::HPROPSHEETPAGE { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiGetWizardPage(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, installwizarddata: *const SP_INSTALLWIZARD_DATA, pagetype: u32, flags: u32) -> super::super::UI::Controls::HPROPSHEETPAGE; } ::core::mem::transmute(SetupDiGetWizardPage(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(installwizarddata), ::core::mem::transmute(pagetype), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiInstallClassA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(hwndparent: Param0, inffilename: Param1, flags: u32, filequeue: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiInstallClassA(hwndparent: super::super::Foundation::HWND, inffilename: super::super::Foundation::PSTR, flags: u32, filequeue: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiInstallClassA(hwndparent.into_param().abi(), inffilename.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(filequeue))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiInstallClassExA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(hwndparent: Param0, inffilename: Param1, flags: u32, filequeue: *const ::core::ffi::c_void, interfaceclassguid: *const ::windows::core::GUID, reserved1: *mut ::core::ffi::c_void, reserved2: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiInstallClassExA(hwndparent: super::super::Foundation::HWND, inffilename: super::super::Foundation::PSTR, flags: u32, filequeue: *const ::core::ffi::c_void, interfaceclassguid: *const ::windows::core::GUID, reserved1: *mut ::core::ffi::c_void, reserved2: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiInstallClassExA(hwndparent.into_param().abi(), inffilename.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(filequeue), ::core::mem::transmute(interfaceclassguid), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiInstallClassExW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hwndparent: Param0, inffilename: Param1, flags: u32, filequeue: *const ::core::ffi::c_void, interfaceclassguid: *const ::windows::core::GUID, reserved1: *mut ::core::ffi::c_void, reserved2: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiInstallClassExW(hwndparent: super::super::Foundation::HWND, inffilename: super::super::Foundation::PWSTR, flags: u32, filequeue: *const ::core::ffi::c_void, interfaceclassguid: *const ::windows::core::GUID, reserved1: *mut ::core::ffi::c_void, reserved2: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiInstallClassExW(hwndparent.into_param().abi(), inffilename.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(filequeue), ::core::mem::transmute(interfaceclassguid), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiInstallClassW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hwndparent: Param0, inffilename: Param1, flags: u32, filequeue: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiInstallClassW(hwndparent: super::super::Foundation::HWND, inffilename: super::super::Foundation::PWSTR, flags: u32, filequeue: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiInstallClassW(hwndparent.into_param().abi(), inffilename.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(filequeue))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiInstallDevice(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiInstallDevice(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiInstallDevice(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiInstallDeviceInterfaces(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiInstallDeviceInterfaces(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiInstallDeviceInterfaces(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiInstallDriverFiles(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiInstallDriverFiles(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiInstallDriverFiles(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_WindowsAndMessaging"))] #[inline] pub unsafe fn SetupDiLoadClassIcon(classguid: *const ::windows::core::GUID, largeicon: *mut super::super::UI::WindowsAndMessaging::HICON, miniiconindex: *mut i32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiLoadClassIcon(classguid: *const ::windows::core::GUID, largeicon: *mut super::super::UI::WindowsAndMessaging::HICON, miniiconindex: *mut i32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiLoadClassIcon(::core::mem::transmute(classguid), ::core::mem::transmute(largeicon), ::core::mem::transmute(miniiconindex))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_UI_WindowsAndMessaging"))] #[inline] pub unsafe fn SetupDiLoadDeviceIcon(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, cxicon: u32, cyicon: u32, flags: u32, hicon: *mut super::super::UI::WindowsAndMessaging::HICON) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiLoadDeviceIcon(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, cxicon: u32, cyicon: u32, flags: u32, hicon: *mut super::super::UI::WindowsAndMessaging::HICON) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiLoadDeviceIcon(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(cxicon), ::core::mem::transmute(cyicon), ::core::mem::transmute(flags), ::core::mem::transmute(hicon))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_System_Registry")] #[inline] pub unsafe fn SetupDiOpenClassRegKey(classguid: *const ::windows::core::GUID, samdesired: u32) -> super::super::System::Registry::HKEY { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiOpenClassRegKey(classguid: *const ::windows::core::GUID, samdesired: u32) -> super::super::System::Registry::HKEY; } ::core::mem::transmute(SetupDiOpenClassRegKey(::core::mem::transmute(classguid), ::core::mem::transmute(samdesired))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Registry"))] #[inline] pub unsafe fn SetupDiOpenClassRegKeyExA<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(classguid: *const ::windows::core::GUID, samdesired: u32, flags: u32, machinename: Param3, reserved: *mut ::core::ffi::c_void) -> super::super::System::Registry::HKEY { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiOpenClassRegKeyExA(classguid: *const ::windows::core::GUID, samdesired: u32, flags: u32, machinename: super::super::Foundation::PSTR, reserved: *mut ::core::ffi::c_void) -> super::super::System::Registry::HKEY; } ::core::mem::transmute(SetupDiOpenClassRegKeyExA(::core::mem::transmute(classguid), ::core::mem::transmute(samdesired), ::core::mem::transmute(flags), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Registry"))] #[inline] pub unsafe fn SetupDiOpenClassRegKeyExW<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(classguid: *const ::windows::core::GUID, samdesired: u32, flags: u32, machinename: Param3, reserved: *mut ::core::ffi::c_void) -> super::super::System::Registry::HKEY { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiOpenClassRegKeyExW(classguid: *const ::windows::core::GUID, samdesired: u32, flags: u32, machinename: super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> super::super::System::Registry::HKEY; } ::core::mem::transmute(SetupDiOpenClassRegKeyExW(::core::mem::transmute(classguid), ::core::mem::transmute(samdesired), ::core::mem::transmute(flags), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_System_Registry")] #[inline] pub unsafe fn SetupDiOpenDevRegKey(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, scope: u32, hwprofile: u32, keytype: u32, samdesired: u32) -> super::super::System::Registry::HKEY { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiOpenDevRegKey(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, scope: u32, hwprofile: u32, keytype: u32, samdesired: u32) -> super::super::System::Registry::HKEY; } ::core::mem::transmute(SetupDiOpenDevRegKey(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(scope), ::core::mem::transmute(hwprofile), ::core::mem::transmute(keytype), ::core::mem::transmute(samdesired))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiOpenDeviceInfoA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(deviceinfoset: *const ::core::ffi::c_void, deviceinstanceid: Param1, hwndparent: Param2, openflags: u32, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiOpenDeviceInfoA(deviceinfoset: *const ::core::ffi::c_void, deviceinstanceid: super::super::Foundation::PSTR, hwndparent: super::super::Foundation::HWND, openflags: u32, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiOpenDeviceInfoA(::core::mem::transmute(deviceinfoset), deviceinstanceid.into_param().abi(), hwndparent.into_param().abi(), ::core::mem::transmute(openflags), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiOpenDeviceInfoW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(deviceinfoset: *const ::core::ffi::c_void, deviceinstanceid: Param1, hwndparent: Param2, openflags: u32, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiOpenDeviceInfoW(deviceinfoset: *const ::core::ffi::c_void, deviceinstanceid: super::super::Foundation::PWSTR, hwndparent: super::super::Foundation::HWND, openflags: u32, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiOpenDeviceInfoW(::core::mem::transmute(deviceinfoset), deviceinstanceid.into_param().abi(), hwndparent.into_param().abi(), ::core::mem::transmute(openflags), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiOpenDeviceInterfaceA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(deviceinfoset: *const ::core::ffi::c_void, devicepath: Param1, openflags: u32, deviceinterfacedata: *mut SP_DEVICE_INTERFACE_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiOpenDeviceInterfaceA(deviceinfoset: *const ::core::ffi::c_void, devicepath: super::super::Foundation::PSTR, openflags: u32, deviceinterfacedata: *mut SP_DEVICE_INTERFACE_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiOpenDeviceInterfaceA(::core::mem::transmute(deviceinfoset), devicepath.into_param().abi(), ::core::mem::transmute(openflags), ::core::mem::transmute(deviceinterfacedata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_System_Registry")] #[inline] pub unsafe fn SetupDiOpenDeviceInterfaceRegKey(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, reserved: u32, samdesired: u32) -> super::super::System::Registry::HKEY { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiOpenDeviceInterfaceRegKey(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, reserved: u32, samdesired: u32) -> super::super::System::Registry::HKEY; } ::core::mem::transmute(SetupDiOpenDeviceInterfaceRegKey(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinterfacedata), ::core::mem::transmute(reserved), ::core::mem::transmute(samdesired))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiOpenDeviceInterfaceW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(deviceinfoset: *const ::core::ffi::c_void, devicepath: Param1, openflags: u32, deviceinterfacedata: *mut SP_DEVICE_INTERFACE_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiOpenDeviceInterfaceW(deviceinfoset: *const ::core::ffi::c_void, devicepath: super::super::Foundation::PWSTR, openflags: u32, deviceinterfacedata: *mut SP_DEVICE_INTERFACE_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiOpenDeviceInterfaceW(::core::mem::transmute(deviceinfoset), devicepath.into_param().abi(), ::core::mem::transmute(openflags), ::core::mem::transmute(deviceinterfacedata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiRegisterCoDeviceInstallers(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiRegisterCoDeviceInstallers(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiRegisterCoDeviceInstallers(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiRegisterDeviceInfo(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA, flags: u32, compareproc: ::core::option::Option<PSP_DETSIG_CMPPROC>, comparecontext: *const ::core::ffi::c_void, dupdeviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiRegisterDeviceInfo(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA, flags: u32, compareproc: ::windows::core::RawPtr, comparecontext: *const ::core::ffi::c_void, dupdeviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiRegisterDeviceInfo(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(flags), ::core::mem::transmute(compareproc), ::core::mem::transmute(comparecontext), ::core::mem::transmute(dupdeviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiRemoveDevice(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiRemoveDevice(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiRemoveDevice(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiRemoveDeviceInterface(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *mut SP_DEVICE_INTERFACE_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiRemoveDeviceInterface(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *mut SP_DEVICE_INTERFACE_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiRemoveDeviceInterface(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinterfacedata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiRestartDevices(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiRestartDevices(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiRestartDevices(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSelectBestCompatDrv(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSelectBestCompatDrv(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSelectBestCompatDrv(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSelectDevice(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSelectDevice(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSelectDevice(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSelectOEMDrv<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(hwndparent: Param0, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSelectOEMDrv(hwndparent: super::super::Foundation::HWND, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSelectOEMDrv(hwndparent.into_param().abi(), ::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSetClassInstallParamsA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, classinstallparams: *const SP_CLASSINSTALL_HEADER, classinstallparamssize: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetClassInstallParamsA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, classinstallparams: *const SP_CLASSINSTALL_HEADER, classinstallparamssize: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetClassInstallParamsA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(classinstallparams), ::core::mem::transmute(classinstallparamssize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSetClassInstallParamsW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, classinstallparams: *const SP_CLASSINSTALL_HEADER, classinstallparamssize: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetClassInstallParamsW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, classinstallparams: *const SP_CLASSINSTALL_HEADER, classinstallparamssize: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetClassInstallParamsW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(classinstallparams), ::core::mem::transmute(classinstallparamssize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn SetupDiSetClassPropertyExW<'a, Param6: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(classguid: *const ::windows::core::GUID, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, flags: u32, machinename: Param6, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetClassPropertyExW(classguid: *const ::windows::core::GUID, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, flags: u32, machinename: super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetClassPropertyExW( ::core::mem::transmute(classguid), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(flags), machinename.into_param().abi(), ::core::mem::transmute(reserved), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn SetupDiSetClassPropertyW(classguid: *const ::windows::core::GUID, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, flags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetClassPropertyW(classguid: *const ::windows::core::GUID, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, flags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetClassPropertyW(::core::mem::transmute(classguid), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSetClassRegistryPropertyA<'a, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(classguid: *const ::windows::core::GUID, property: u32, propertybuffer: *const u8, propertybuffersize: u32, machinename: Param4, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetClassRegistryPropertyA(classguid: *const ::windows::core::GUID, property: u32, propertybuffer: *const u8, propertybuffersize: u32, machinename: super::super::Foundation::PSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetClassRegistryPropertyA(::core::mem::transmute(classguid), ::core::mem::transmute(property), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSetClassRegistryPropertyW<'a, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(classguid: *const ::windows::core::GUID, property: u32, propertybuffer: *const u8, propertybuffersize: u32, machinename: Param4, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetClassRegistryPropertyW(classguid: *const ::windows::core::GUID, property: u32, propertybuffer: *const u8, propertybuffersize: u32, machinename: super::super::Foundation::PWSTR, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetClassRegistryPropertyW(::core::mem::transmute(classguid), ::core::mem::transmute(property), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), machinename.into_param().abi(), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSetDeviceInstallParamsA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, deviceinstallparams: *const SP_DEVINSTALL_PARAMS_A) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetDeviceInstallParamsA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, deviceinstallparams: *const ::core::mem::ManuallyDrop<SP_DEVINSTALL_PARAMS_A>) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetDeviceInstallParamsA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(deviceinstallparams))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSetDeviceInstallParamsW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, deviceinstallparams: *const SP_DEVINSTALL_PARAMS_W) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetDeviceInstallParamsW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, deviceinstallparams: *const ::core::mem::ManuallyDrop<SP_DEVINSTALL_PARAMS_W>) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetDeviceInstallParamsW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(deviceinstallparams))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSetDeviceInterfaceDefault(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *mut SP_DEVICE_INTERFACE_DATA, flags: u32, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetDeviceInterfaceDefault(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *mut SP_DEVICE_INTERFACE_DATA, flags: u32, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetDeviceInterfaceDefault(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinterfacedata), ::core::mem::transmute(flags), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn SetupDiSetDeviceInterfacePropertyW(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, flags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetDeviceInterfacePropertyW(deviceinfoset: *const ::core::ffi::c_void, deviceinterfacedata: *const SP_DEVICE_INTERFACE_DATA, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, flags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetDeviceInterfacePropertyW( ::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinterfacedata), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(flags), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Devices_Properties", feature = "Win32_Foundation"))] #[inline] pub unsafe fn SetupDiSetDevicePropertyW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, flags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetDevicePropertyW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, propertykey: *const super::Properties::DEVPROPKEY, propertytype: u32, propertybuffer: *const u8, propertybuffersize: u32, flags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetDevicePropertyW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(propertykey), ::core::mem::transmute(propertytype), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSetDeviceRegistryPropertyA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA, property: u32, propertybuffer: *const u8, propertybuffersize: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetDeviceRegistryPropertyA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA, property: u32, propertybuffer: *const u8, propertybuffersize: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetDeviceRegistryPropertyA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(property), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSetDeviceRegistryPropertyW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA, property: u32, propertybuffer: *const u8, propertybuffersize: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetDeviceRegistryPropertyW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA, property: u32, propertybuffer: *const u8, propertybuffersize: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetDeviceRegistryPropertyW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(property), ::core::mem::transmute(propertybuffer), ::core::mem::transmute(propertybuffersize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSetDriverInstallParamsA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *const SP_DRVINFO_DATA_V2_A, driverinstallparams: *const SP_DRVINSTALL_PARAMS) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetDriverInstallParamsA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *const SP_DRVINFO_DATA_V2_A, driverinstallparams: *const SP_DRVINSTALL_PARAMS) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetDriverInstallParamsA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(driverinfodata), ::core::mem::transmute(driverinstallparams))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSetDriverInstallParamsW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *const SP_DRVINFO_DATA_V2_W, driverinstallparams: *const SP_DRVINSTALL_PARAMS) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetDriverInstallParamsW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, driverinfodata: *const SP_DRVINFO_DATA_V2_W, driverinstallparams: *const SP_DRVINSTALL_PARAMS) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetDriverInstallParamsW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(driverinfodata), ::core::mem::transmute(driverinstallparams))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSetSelectedDevice(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetSelectedDevice(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetSelectedDevice(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSetSelectedDriverA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA, driverinfodata: *mut SP_DRVINFO_DATA_V2_A) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetSelectedDriverA(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA, driverinfodata: *mut SP_DRVINFO_DATA_V2_A) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetSelectedDriverA(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(driverinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiSetSelectedDriverW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA, driverinfodata: *mut SP_DRVINFO_DATA_V2_W) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiSetSelectedDriverW(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA, driverinfodata: *mut SP_DRVINFO_DATA_V2_W) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiSetSelectedDriverW(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(driverinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupDiUnremoveDevice(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDiUnremoveDevice(deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *mut SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupDiUnremoveDevice(::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn SetupDuplicateDiskSpaceListA(diskspace: *const ::core::ffi::c_void, reserved1: *mut ::core::ffi::c_void, reserved2: u32, flags: u32) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDuplicateDiskSpaceListA(diskspace: *const ::core::ffi::c_void, reserved1: *mut ::core::ffi::c_void, reserved2: u32, flags: u32) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupDuplicateDiskSpaceListA(::core::mem::transmute(diskspace), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn SetupDuplicateDiskSpaceListW(diskspace: *const ::core::ffi::c_void, reserved1: *mut ::core::ffi::c_void, reserved2: u32, flags: u32) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupDuplicateDiskSpaceListW(diskspace: *const ::core::ffi::c_void, reserved1: *mut ::core::ffi::c_void, reserved2: u32, flags: u32) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupDuplicateDiskSpaceListW(::core::mem::transmute(diskspace), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupEnumInfSectionsA(infhandle: *const ::core::ffi::c_void, index: u32, buffer: super::super::Foundation::PSTR, size: u32, sizeneeded: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupEnumInfSectionsA(infhandle: *const ::core::ffi::c_void, index: u32, buffer: super::super::Foundation::PSTR, size: u32, sizeneeded: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupEnumInfSectionsA(::core::mem::transmute(infhandle), ::core::mem::transmute(index), ::core::mem::transmute(buffer), ::core::mem::transmute(size), ::core::mem::transmute(sizeneeded))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupEnumInfSectionsW(infhandle: *const ::core::ffi::c_void, index: u32, buffer: super::super::Foundation::PWSTR, size: u32, sizeneeded: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupEnumInfSectionsW(infhandle: *const ::core::ffi::c_void, index: u32, buffer: super::super::Foundation::PWSTR, size: u32, sizeneeded: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupEnumInfSectionsW(::core::mem::transmute(infhandle), ::core::mem::transmute(index), ::core::mem::transmute(buffer), ::core::mem::transmute(size), ::core::mem::transmute(sizeneeded))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct SetupFileLogInfo(pub i32); pub const SetupFileLogSourceFilename: SetupFileLogInfo = SetupFileLogInfo(0i32); pub const SetupFileLogChecksum: SetupFileLogInfo = SetupFileLogInfo(1i32); pub const SetupFileLogDiskTagfile: SetupFileLogInfo = SetupFileLogInfo(2i32); pub const SetupFileLogDiskDescription: SetupFileLogInfo = SetupFileLogInfo(3i32); pub const SetupFileLogOtherInfo: SetupFileLogInfo = SetupFileLogInfo(4i32); pub const SetupFileLogMax: SetupFileLogInfo = SetupFileLogInfo(5i32); impl ::core::convert::From<i32> for SetupFileLogInfo { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SetupFileLogInfo { type Abi = Self; } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupFindFirstLineA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infhandle: *const ::core::ffi::c_void, section: Param1, key: Param2, context: *mut INFCONTEXT) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupFindFirstLineA(infhandle: *const ::core::ffi::c_void, section: super::super::Foundation::PSTR, key: super::super::Foundation::PSTR, context: *mut INFCONTEXT) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupFindFirstLineA(::core::mem::transmute(infhandle), section.into_param().abi(), key.into_param().abi(), ::core::mem::transmute(context))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupFindFirstLineW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infhandle: *const ::core::ffi::c_void, section: Param1, key: Param2, context: *mut INFCONTEXT) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupFindFirstLineW(infhandle: *const ::core::ffi::c_void, section: super::super::Foundation::PWSTR, key: super::super::Foundation::PWSTR, context: *mut INFCONTEXT) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupFindFirstLineW(::core::mem::transmute(infhandle), section.into_param().abi(), key.into_param().abi(), ::core::mem::transmute(context))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupFindNextLine(contextin: *const INFCONTEXT, contextout: *mut INFCONTEXT) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupFindNextLine(contextin: *const INFCONTEXT, contextout: *mut INFCONTEXT) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupFindNextLine(::core::mem::transmute(contextin), ::core::mem::transmute(contextout))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupFindNextMatchLineA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(contextin: *const INFCONTEXT, key: Param1, contextout: *mut INFCONTEXT) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupFindNextMatchLineA(contextin: *const INFCONTEXT, key: super::super::Foundation::PSTR, contextout: *mut INFCONTEXT) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupFindNextMatchLineA(::core::mem::transmute(contextin), key.into_param().abi(), ::core::mem::transmute(contextout))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupFindNextMatchLineW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(contextin: *const INFCONTEXT, key: Param1, contextout: *mut INFCONTEXT) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupFindNextMatchLineW(contextin: *const INFCONTEXT, key: super::super::Foundation::PWSTR, contextout: *mut INFCONTEXT) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupFindNextMatchLineW(::core::mem::transmute(contextin), key.into_param().abi(), ::core::mem::transmute(contextout))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupFreeSourceListA(list: *mut *mut super::super::Foundation::PSTR, count: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupFreeSourceListA(list: *mut *mut super::super::Foundation::PSTR, count: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupFreeSourceListA(::core::mem::transmute(list), ::core::mem::transmute(count))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupFreeSourceListW(list: *mut *mut super::super::Foundation::PWSTR, count: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupFreeSourceListW(list: *mut *mut super::super::Foundation::PWSTR, count: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupFreeSourceListW(::core::mem::transmute(list), ::core::mem::transmute(count))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetBackupInformationA(queuehandle: *const ::core::ffi::c_void, backupparams: *mut SP_BACKUP_QUEUE_PARAMS_V2_A) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetBackupInformationA(queuehandle: *const ::core::ffi::c_void, backupparams: *mut SP_BACKUP_QUEUE_PARAMS_V2_A) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetBackupInformationA(::core::mem::transmute(queuehandle), ::core::mem::transmute(backupparams))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetBackupInformationW(queuehandle: *const ::core::ffi::c_void, backupparams: *mut SP_BACKUP_QUEUE_PARAMS_V2_W) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetBackupInformationW(queuehandle: *const ::core::ffi::c_void, backupparams: *mut SP_BACKUP_QUEUE_PARAMS_V2_W) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetBackupInformationW(::core::mem::transmute(queuehandle), ::core::mem::transmute(backupparams))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetBinaryField(context: *const INFCONTEXT, fieldindex: u32, returnbuffer: *mut u8, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetBinaryField(context: *const INFCONTEXT, fieldindex: u32, returnbuffer: *mut u8, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetBinaryField(::core::mem::transmute(context), ::core::mem::transmute(fieldindex), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn SetupGetFieldCount(context: *const INFCONTEXT) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetFieldCount(context: *const INFCONTEXT) -> u32; } ::core::mem::transmute(SetupGetFieldCount(::core::mem::transmute(context))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetFileCompressionInfoA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(sourcefilename: Param0, actualsourcefilename: *mut super::super::Foundation::PSTR, sourcefilesize: *mut u32, targetfilesize: *mut u32, compressiontype: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetFileCompressionInfoA(sourcefilename: super::super::Foundation::PSTR, actualsourcefilename: *mut super::super::Foundation::PSTR, sourcefilesize: *mut u32, targetfilesize: *mut u32, compressiontype: *mut u32) -> u32; } ::core::mem::transmute(SetupGetFileCompressionInfoA(sourcefilename.into_param().abi(), ::core::mem::transmute(actualsourcefilename), ::core::mem::transmute(sourcefilesize), ::core::mem::transmute(targetfilesize), ::core::mem::transmute(compressiontype))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetFileCompressionInfoExA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(sourcefilename: Param0, actualsourcefilenamebuffer: Param1, actualsourcefilenamebufferlen: u32, requiredbufferlen: *mut u32, sourcefilesize: *mut u32, targetfilesize: *mut u32, compressiontype: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetFileCompressionInfoExA(sourcefilename: super::super::Foundation::PSTR, actualsourcefilenamebuffer: super::super::Foundation::PSTR, actualsourcefilenamebufferlen: u32, requiredbufferlen: *mut u32, sourcefilesize: *mut u32, targetfilesize: *mut u32, compressiontype: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetFileCompressionInfoExA( sourcefilename.into_param().abi(), actualsourcefilenamebuffer.into_param().abi(), ::core::mem::transmute(actualsourcefilenamebufferlen), ::core::mem::transmute(requiredbufferlen), ::core::mem::transmute(sourcefilesize), ::core::mem::transmute(targetfilesize), ::core::mem::transmute(compressiontype), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetFileCompressionInfoExW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(sourcefilename: Param0, actualsourcefilenamebuffer: Param1, actualsourcefilenamebufferlen: u32, requiredbufferlen: *mut u32, sourcefilesize: *mut u32, targetfilesize: *mut u32, compressiontype: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetFileCompressionInfoExW(sourcefilename: super::super::Foundation::PWSTR, actualsourcefilenamebuffer: super::super::Foundation::PWSTR, actualsourcefilenamebufferlen: u32, requiredbufferlen: *mut u32, sourcefilesize: *mut u32, targetfilesize: *mut u32, compressiontype: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetFileCompressionInfoExW( sourcefilename.into_param().abi(), actualsourcefilenamebuffer.into_param().abi(), ::core::mem::transmute(actualsourcefilenamebufferlen), ::core::mem::transmute(requiredbufferlen), ::core::mem::transmute(sourcefilesize), ::core::mem::transmute(targetfilesize), ::core::mem::transmute(compressiontype), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetFileCompressionInfoW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(sourcefilename: Param0, actualsourcefilename: *mut super::super::Foundation::PWSTR, sourcefilesize: *mut u32, targetfilesize: *mut u32, compressiontype: *mut u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetFileCompressionInfoW(sourcefilename: super::super::Foundation::PWSTR, actualsourcefilename: *mut super::super::Foundation::PWSTR, sourcefilesize: *mut u32, targetfilesize: *mut u32, compressiontype: *mut u32) -> u32; } ::core::mem::transmute(SetupGetFileCompressionInfoW(sourcefilename.into_param().abi(), ::core::mem::transmute(actualsourcefilename), ::core::mem::transmute(sourcefilesize), ::core::mem::transmute(targetfilesize), ::core::mem::transmute(compressiontype))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetFileQueueCount(filequeue: *const ::core::ffi::c_void, subqueuefileop: u32, numoperations: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetFileQueueCount(filequeue: *const ::core::ffi::c_void, subqueuefileop: u32, numoperations: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetFileQueueCount(::core::mem::transmute(filequeue), ::core::mem::transmute(subqueuefileop), ::core::mem::transmute(numoperations))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetFileQueueFlags(filequeue: *const ::core::ffi::c_void, flags: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetFileQueueFlags(filequeue: *const ::core::ffi::c_void, flags: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetFileQueueFlags(::core::mem::transmute(filequeue), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Diagnostics_Debug"))] #[inline] pub unsafe fn SetupGetInfDriverStoreLocationA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(filename: Param0, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, localename: Param2, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetInfDriverStoreLocationA(filename: super::super::Foundation::PSTR, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, localename: super::super::Foundation::PSTR, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetInfDriverStoreLocationA(filename.into_param().abi(), ::core::mem::transmute(alternateplatforminfo), localename.into_param().abi(), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Diagnostics_Debug"))] #[inline] pub unsafe fn SetupGetInfDriverStoreLocationW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(filename: Param0, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, localename: Param2, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetInfDriverStoreLocationW(filename: super::super::Foundation::PWSTR, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, localename: super::super::Foundation::PWSTR, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetInfDriverStoreLocationW(filename.into_param().abi(), ::core::mem::transmute(alternateplatforminfo), localename.into_param().abi(), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetInfFileListA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(directorypath: Param0, infstyle: u32, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetInfFileListA(directorypath: super::super::Foundation::PSTR, infstyle: u32, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetInfFileListA(directorypath.into_param().abi(), ::core::mem::transmute(infstyle), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetInfFileListW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(directorypath: Param0, infstyle: u32, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetInfFileListW(directorypath: super::super::Foundation::PWSTR, infstyle: u32, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetInfFileListW(directorypath.into_param().abi(), ::core::mem::transmute(infstyle), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetInfInformationA(infspec: *const ::core::ffi::c_void, searchcontrol: u32, returnbuffer: *mut SP_INF_INFORMATION, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetInfInformationA(infspec: *const ::core::ffi::c_void, searchcontrol: u32, returnbuffer: *mut SP_INF_INFORMATION, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetInfInformationA(::core::mem::transmute(infspec), ::core::mem::transmute(searchcontrol), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetInfInformationW(infspec: *const ::core::ffi::c_void, searchcontrol: u32, returnbuffer: *mut SP_INF_INFORMATION, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetInfInformationW(infspec: *const ::core::ffi::c_void, searchcontrol: u32, returnbuffer: *mut SP_INF_INFORMATION, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetInfInformationW(::core::mem::transmute(infspec), ::core::mem::transmute(searchcontrol), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetInfPublishedNameA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(driverstorelocation: Param0, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetInfPublishedNameA(driverstorelocation: super::super::Foundation::PSTR, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetInfPublishedNameA(driverstorelocation.into_param().abi(), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetInfPublishedNameW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(driverstorelocation: Param0, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetInfPublishedNameW(driverstorelocation: super::super::Foundation::PWSTR, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetInfPublishedNameW(driverstorelocation.into_param().abi(), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetIntField(context: *const INFCONTEXT, fieldindex: u32, integervalue: *mut i32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetIntField(context: *const INFCONTEXT, fieldindex: u32, integervalue: *mut i32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetIntField(::core::mem::transmute(context), ::core::mem::transmute(fieldindex), ::core::mem::transmute(integervalue))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetLineByIndexA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infhandle: *const ::core::ffi::c_void, section: Param1, index: u32, context: *mut INFCONTEXT) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetLineByIndexA(infhandle: *const ::core::ffi::c_void, section: super::super::Foundation::PSTR, index: u32, context: *mut INFCONTEXT) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetLineByIndexA(::core::mem::transmute(infhandle), section.into_param().abi(), ::core::mem::transmute(index), ::core::mem::transmute(context))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetLineByIndexW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infhandle: *const ::core::ffi::c_void, section: Param1, index: u32, context: *mut INFCONTEXT) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetLineByIndexW(infhandle: *const ::core::ffi::c_void, section: super::super::Foundation::PWSTR, index: u32, context: *mut INFCONTEXT) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetLineByIndexW(::core::mem::transmute(infhandle), section.into_param().abi(), ::core::mem::transmute(index), ::core::mem::transmute(context))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetLineCountA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infhandle: *const ::core::ffi::c_void, section: Param1) -> i32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetLineCountA(infhandle: *const ::core::ffi::c_void, section: super::super::Foundation::PSTR) -> i32; } ::core::mem::transmute(SetupGetLineCountA(::core::mem::transmute(infhandle), section.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetLineCountW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infhandle: *const ::core::ffi::c_void, section: Param1) -> i32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetLineCountW(infhandle: *const ::core::ffi::c_void, section: super::super::Foundation::PWSTR) -> i32; } ::core::mem::transmute(SetupGetLineCountW(::core::mem::transmute(infhandle), section.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetLineTextA<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(context: *const INFCONTEXT, infhandle: *const ::core::ffi::c_void, section: Param2, key: Param3, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetLineTextA(context: *const INFCONTEXT, infhandle: *const ::core::ffi::c_void, section: super::super::Foundation::PSTR, key: super::super::Foundation::PSTR, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetLineTextA(::core::mem::transmute(context), ::core::mem::transmute(infhandle), section.into_param().abi(), key.into_param().abi(), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetLineTextW<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(context: *const INFCONTEXT, infhandle: *const ::core::ffi::c_void, section: Param2, key: Param3, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetLineTextW(context: *const INFCONTEXT, infhandle: *const ::core::ffi::c_void, section: super::super::Foundation::PWSTR, key: super::super::Foundation::PWSTR, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetLineTextW(::core::mem::transmute(context), ::core::mem::transmute(infhandle), section.into_param().abi(), key.into_param().abi(), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetMultiSzFieldA(context: *const INFCONTEXT, fieldindex: u32, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetMultiSzFieldA(context: *const INFCONTEXT, fieldindex: u32, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetMultiSzFieldA(::core::mem::transmute(context), ::core::mem::transmute(fieldindex), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetMultiSzFieldW(context: *const INFCONTEXT, fieldindex: u32, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetMultiSzFieldW(context: *const INFCONTEXT, fieldindex: u32, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetMultiSzFieldW(::core::mem::transmute(context), ::core::mem::transmute(fieldindex), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetNonInteractiveMode() -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetNonInteractiveMode() -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetNonInteractiveMode()) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetSourceFileLocationA<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, filename: Param2, sourceid: *mut u32, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetSourceFileLocationA(infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, filename: super::super::Foundation::PSTR, sourceid: *mut u32, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetSourceFileLocationA(::core::mem::transmute(infhandle), ::core::mem::transmute(infcontext), filename.into_param().abi(), ::core::mem::transmute(sourceid), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetSourceFileLocationW<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, filename: Param2, sourceid: *mut u32, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetSourceFileLocationW(infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, filename: super::super::Foundation::PWSTR, sourceid: *mut u32, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetSourceFileLocationW(::core::mem::transmute(infhandle), ::core::mem::transmute(infcontext), filename.into_param().abi(), ::core::mem::transmute(sourceid), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetSourceFileSizeA<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, filename: Param2, section: Param3, filesize: *mut u32, roundingfactor: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetSourceFileSizeA(infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, filename: super::super::Foundation::PSTR, section: super::super::Foundation::PSTR, filesize: *mut u32, roundingfactor: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetSourceFileSizeA(::core::mem::transmute(infhandle), ::core::mem::transmute(infcontext), filename.into_param().abi(), section.into_param().abi(), ::core::mem::transmute(filesize), ::core::mem::transmute(roundingfactor))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetSourceFileSizeW<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, filename: Param2, section: Param3, filesize: *mut u32, roundingfactor: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetSourceFileSizeW(infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, filename: super::super::Foundation::PWSTR, section: super::super::Foundation::PWSTR, filesize: *mut u32, roundingfactor: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetSourceFileSizeW(::core::mem::transmute(infhandle), ::core::mem::transmute(infcontext), filename.into_param().abi(), section.into_param().abi(), ::core::mem::transmute(filesize), ::core::mem::transmute(roundingfactor))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetSourceInfoA(infhandle: *const ::core::ffi::c_void, sourceid: u32, infodesired: u32, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetSourceInfoA(infhandle: *const ::core::ffi::c_void, sourceid: u32, infodesired: u32, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetSourceInfoA(::core::mem::transmute(infhandle), ::core::mem::transmute(sourceid), ::core::mem::transmute(infodesired), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetSourceInfoW(infhandle: *const ::core::ffi::c_void, sourceid: u32, infodesired: u32, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetSourceInfoW(infhandle: *const ::core::ffi::c_void, sourceid: u32, infodesired: u32, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetSourceInfoW(::core::mem::transmute(infhandle), ::core::mem::transmute(sourceid), ::core::mem::transmute(infodesired), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetStringFieldA(context: *const INFCONTEXT, fieldindex: u32, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetStringFieldA(context: *const INFCONTEXT, fieldindex: u32, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetStringFieldA(::core::mem::transmute(context), ::core::mem::transmute(fieldindex), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetStringFieldW(context: *const INFCONTEXT, fieldindex: u32, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetStringFieldW(context: *const INFCONTEXT, fieldindex: u32, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetStringFieldW(::core::mem::transmute(context), ::core::mem::transmute(fieldindex), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetTargetPathA<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, section: Param2, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetTargetPathA(infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, section: super::super::Foundation::PSTR, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetTargetPathA(::core::mem::transmute(infhandle), ::core::mem::transmute(infcontext), section.into_param().abi(), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupGetTargetPathW<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, section: Param2, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetTargetPathW(infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, section: super::super::Foundation::PWSTR, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupGetTargetPathW(::core::mem::transmute(infhandle), ::core::mem::transmute(infcontext), section.into_param().abi(), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn SetupGetThreadLogToken() -> u64 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupGetThreadLogToken() -> u64; } ::core::mem::transmute(SetupGetThreadLogToken()) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupInitDefaultQueueCallback<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(ownerwindow: Param0) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupInitDefaultQueueCallback(ownerwindow: super::super::Foundation::HWND) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupInitDefaultQueueCallback(ownerwindow.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupInitDefaultQueueCallbackEx<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(ownerwindow: Param0, alternateprogresswindow: Param1, progressmessage: u32, reserved1: u32, reserved2: *mut ::core::ffi::c_void) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupInitDefaultQueueCallbackEx(ownerwindow: super::super::Foundation::HWND, alternateprogresswindow: super::super::Foundation::HWND, progressmessage: u32, reserved1: u32, reserved2: *mut ::core::ffi::c_void) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupInitDefaultQueueCallbackEx(ownerwindow.into_param().abi(), alternateprogresswindow.into_param().abi(), ::core::mem::transmute(progressmessage), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupInitializeFileLogA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(logfilename: Param0, flags: u32) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupInitializeFileLogA(logfilename: super::super::Foundation::PSTR, flags: u32) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupInitializeFileLogA(logfilename.into_param().abi(), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupInitializeFileLogW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(logfilename: Param0, flags: u32) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupInitializeFileLogW(logfilename: super::super::Foundation::PWSTR, flags: u32) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupInitializeFileLogW(logfilename.into_param().abi(), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupInstallFileA<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>( infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, sourcefile: Param2, sourcepathroot: Param3, destinationname: Param4, copystyle: SP_COPY_STYLE, copymsghandler: ::core::option::Option<PSP_FILE_CALLBACK_A>, context: *const ::core::ffi::c_void, ) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupInstallFileA(infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, sourcefile: super::super::Foundation::PSTR, sourcepathroot: super::super::Foundation::PSTR, destinationname: super::super::Foundation::PSTR, copystyle: SP_COPY_STYLE, copymsghandler: ::windows::core::RawPtr, context: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupInstallFileA(::core::mem::transmute(infhandle), ::core::mem::transmute(infcontext), sourcefile.into_param().abi(), sourcepathroot.into_param().abi(), destinationname.into_param().abi(), ::core::mem::transmute(copystyle), ::core::mem::transmute(copymsghandler), ::core::mem::transmute(context))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupInstallFileExA<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>( infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, sourcefile: Param2, sourcepathroot: Param3, destinationname: Param4, copystyle: SP_COPY_STYLE, copymsghandler: ::core::option::Option<PSP_FILE_CALLBACK_A>, context: *const ::core::ffi::c_void, filewasinuse: *mut super::super::Foundation::BOOL, ) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupInstallFileExA(infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, sourcefile: super::super::Foundation::PSTR, sourcepathroot: super::super::Foundation::PSTR, destinationname: super::super::Foundation::PSTR, copystyle: SP_COPY_STYLE, copymsghandler: ::windows::core::RawPtr, context: *const ::core::ffi::c_void, filewasinuse: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupInstallFileExA( ::core::mem::transmute(infhandle), ::core::mem::transmute(infcontext), sourcefile.into_param().abi(), sourcepathroot.into_param().abi(), destinationname.into_param().abi(), ::core::mem::transmute(copystyle), ::core::mem::transmute(copymsghandler), ::core::mem::transmute(context), ::core::mem::transmute(filewasinuse), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupInstallFileExW<'a, Param2: ::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>>( infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, sourcefile: Param2, sourcepathroot: Param3, destinationname: Param4, copystyle: SP_COPY_STYLE, copymsghandler: ::core::option::Option<PSP_FILE_CALLBACK_W>, context: *const ::core::ffi::c_void, filewasinuse: *mut super::super::Foundation::BOOL, ) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupInstallFileExW(infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, sourcefile: super::super::Foundation::PWSTR, sourcepathroot: super::super::Foundation::PWSTR, destinationname: super::super::Foundation::PWSTR, copystyle: SP_COPY_STYLE, copymsghandler: ::windows::core::RawPtr, context: *const ::core::ffi::c_void, filewasinuse: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupInstallFileExW( ::core::mem::transmute(infhandle), ::core::mem::transmute(infcontext), sourcefile.into_param().abi(), sourcepathroot.into_param().abi(), destinationname.into_param().abi(), ::core::mem::transmute(copystyle), ::core::mem::transmute(copymsghandler), ::core::mem::transmute(context), ::core::mem::transmute(filewasinuse), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupInstallFileW<'a, Param2: ::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>>( infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, sourcefile: Param2, sourcepathroot: Param3, destinationname: Param4, copystyle: SP_COPY_STYLE, copymsghandler: ::core::option::Option<PSP_FILE_CALLBACK_W>, context: *const ::core::ffi::c_void, ) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupInstallFileW(infhandle: *const ::core::ffi::c_void, infcontext: *const INFCONTEXT, sourcefile: super::super::Foundation::PWSTR, sourcepathroot: super::super::Foundation::PWSTR, destinationname: super::super::Foundation::PWSTR, copystyle: SP_COPY_STYLE, copymsghandler: ::windows::core::RawPtr, context: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupInstallFileW(::core::mem::transmute(infhandle), ::core::mem::transmute(infcontext), sourcefile.into_param().abi(), sourcepathroot.into_param().abi(), destinationname.into_param().abi(), ::core::mem::transmute(copystyle), ::core::mem::transmute(copymsghandler), ::core::mem::transmute(context))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupInstallFilesFromInfSectionA<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infhandle: *const ::core::ffi::c_void, layoutinfhandle: *const ::core::ffi::c_void, filequeue: *const ::core::ffi::c_void, sectionname: Param3, sourcerootpath: Param4, copyflags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupInstallFilesFromInfSectionA(infhandle: *const ::core::ffi::c_void, layoutinfhandle: *const ::core::ffi::c_void, filequeue: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PSTR, sourcerootpath: super::super::Foundation::PSTR, copyflags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupInstallFilesFromInfSectionA(::core::mem::transmute(infhandle), ::core::mem::transmute(layoutinfhandle), ::core::mem::transmute(filequeue), sectionname.into_param().abi(), sourcerootpath.into_param().abi(), ::core::mem::transmute(copyflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupInstallFilesFromInfSectionW<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infhandle: *const ::core::ffi::c_void, layoutinfhandle: *const ::core::ffi::c_void, filequeue: *const ::core::ffi::c_void, sectionname: Param3, sourcerootpath: Param4, copyflags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupInstallFilesFromInfSectionW(infhandle: *const ::core::ffi::c_void, layoutinfhandle: *const ::core::ffi::c_void, filequeue: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PWSTR, sourcerootpath: super::super::Foundation::PWSTR, copyflags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupInstallFilesFromInfSectionW(::core::mem::transmute(infhandle), ::core::mem::transmute(layoutinfhandle), ::core::mem::transmute(filequeue), sectionname.into_param().abi(), sourcerootpath.into_param().abi(), ::core::mem::transmute(copyflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Registry"))] #[inline] pub unsafe fn SetupInstallFromInfSectionA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param4: ::windows::core::IntoParam<'a, super::super::System::Registry::HKEY>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>( owner: Param0, infhandle: *const ::core::ffi::c_void, sectionname: Param2, flags: u32, relativekeyroot: Param4, sourcerootpath: Param5, copyflags: u32, msghandler: ::core::option::Option<PSP_FILE_CALLBACK_A>, context: *const ::core::ffi::c_void, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, ) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupInstallFromInfSectionA(owner: super::super::Foundation::HWND, infhandle: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PSTR, flags: u32, relativekeyroot: super::super::System::Registry::HKEY, sourcerootpath: super::super::Foundation::PSTR, copyflags: u32, msghandler: ::windows::core::RawPtr, context: *const ::core::ffi::c_void, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupInstallFromInfSectionA( owner.into_param().abi(), ::core::mem::transmute(infhandle), sectionname.into_param().abi(), ::core::mem::transmute(flags), relativekeyroot.into_param().abi(), sourcerootpath.into_param().abi(), ::core::mem::transmute(copyflags), ::core::mem::transmute(msghandler), ::core::mem::transmute(context), ::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Registry"))] #[inline] pub unsafe fn SetupInstallFromInfSectionW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, super::super::System::Registry::HKEY>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>( owner: Param0, infhandle: *const ::core::ffi::c_void, sectionname: Param2, flags: u32, relativekeyroot: Param4, sourcerootpath: Param5, copyflags: u32, msghandler: ::core::option::Option<PSP_FILE_CALLBACK_W>, context: *const ::core::ffi::c_void, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, ) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupInstallFromInfSectionW(owner: super::super::Foundation::HWND, infhandle: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PWSTR, flags: u32, relativekeyroot: super::super::System::Registry::HKEY, sourcerootpath: super::super::Foundation::PWSTR, copyflags: u32, msghandler: ::windows::core::RawPtr, context: *const ::core::ffi::c_void, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupInstallFromInfSectionW( owner.into_param().abi(), ::core::mem::transmute(infhandle), sectionname.into_param().abi(), ::core::mem::transmute(flags), relativekeyroot.into_param().abi(), sourcerootpath.into_param().abi(), ::core::mem::transmute(copyflags), ::core::mem::transmute(msghandler), ::core::mem::transmute(context), ::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupInstallServicesFromInfSectionA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infhandle: *const ::core::ffi::c_void, sectionname: Param1, flags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupInstallServicesFromInfSectionA(infhandle: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PSTR, flags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupInstallServicesFromInfSectionA(::core::mem::transmute(infhandle), sectionname.into_param().abi(), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupInstallServicesFromInfSectionExA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infhandle: *const ::core::ffi::c_void, sectionname: Param1, flags: u32, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, reserved1: *mut ::core::ffi::c_void, reserved2: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupInstallServicesFromInfSectionExA(infhandle: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PSTR, flags: u32, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, reserved1: *mut ::core::ffi::c_void, reserved2: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupInstallServicesFromInfSectionExA(::core::mem::transmute(infhandle), sectionname.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupInstallServicesFromInfSectionExW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infhandle: *const ::core::ffi::c_void, sectionname: Param1, flags: u32, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, reserved1: *mut ::core::ffi::c_void, reserved2: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupInstallServicesFromInfSectionExW(infhandle: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PWSTR, flags: u32, deviceinfoset: *const ::core::ffi::c_void, deviceinfodata: *const SP_DEVINFO_DATA, reserved1: *mut ::core::ffi::c_void, reserved2: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupInstallServicesFromInfSectionExW(::core::mem::transmute(infhandle), sectionname.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(deviceinfoset), ::core::mem::transmute(deviceinfodata), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupInstallServicesFromInfSectionW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infhandle: *const ::core::ffi::c_void, sectionname: Param1, flags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupInstallServicesFromInfSectionW(infhandle: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PWSTR, flags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupInstallServicesFromInfSectionW(::core::mem::transmute(infhandle), sectionname.into_param().abi(), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupIterateCabinetA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(cabinetfile: Param0, reserved: u32, msghandler: ::core::option::Option<PSP_FILE_CALLBACK_A>, context: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupIterateCabinetA(cabinetfile: super::super::Foundation::PSTR, reserved: u32, msghandler: ::windows::core::RawPtr, context: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupIterateCabinetA(cabinetfile.into_param().abi(), ::core::mem::transmute(reserved), ::core::mem::transmute(msghandler), ::core::mem::transmute(context))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupIterateCabinetW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(cabinetfile: Param0, reserved: u32, msghandler: ::core::option::Option<PSP_FILE_CALLBACK_W>, context: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupIterateCabinetW(cabinetfile: super::super::Foundation::PWSTR, reserved: u32, msghandler: ::windows::core::RawPtr, context: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupIterateCabinetW(cabinetfile.into_param().abi(), ::core::mem::transmute(reserved), ::core::mem::transmute(msghandler), ::core::mem::transmute(context))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupLogErrorA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(messagestring: Param0, severity: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupLogErrorA(messagestring: super::super::Foundation::PSTR, severity: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupLogErrorA(messagestring.into_param().abi(), ::core::mem::transmute(severity))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupLogErrorW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(messagestring: Param0, severity: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupLogErrorW(messagestring: super::super::Foundation::PWSTR, severity: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupLogErrorW(messagestring.into_param().abi(), ::core::mem::transmute(severity))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupLogFileA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param6: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param7: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>( fileloghandle: *const ::core::ffi::c_void, logsectionname: Param1, sourcefilename: Param2, targetfilename: Param3, checksum: u32, disktagfile: Param5, diskdescription: Param6, otherinfo: Param7, flags: u32, ) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupLogFileA(fileloghandle: *const ::core::ffi::c_void, logsectionname: super::super::Foundation::PSTR, sourcefilename: super::super::Foundation::PSTR, targetfilename: super::super::Foundation::PSTR, checksum: u32, disktagfile: super::super::Foundation::PSTR, diskdescription: super::super::Foundation::PSTR, otherinfo: super::super::Foundation::PSTR, flags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupLogFileA( ::core::mem::transmute(fileloghandle), logsectionname.into_param().abi(), sourcefilename.into_param().abi(), targetfilename.into_param().abi(), ::core::mem::transmute(checksum), disktagfile.into_param().abi(), diskdescription.into_param().abi(), otherinfo.into_param().abi(), ::core::mem::transmute(flags), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupLogFileW<'a, 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>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param6: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param7: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>( fileloghandle: *const ::core::ffi::c_void, logsectionname: Param1, sourcefilename: Param2, targetfilename: Param3, checksum: u32, disktagfile: Param5, diskdescription: Param6, otherinfo: Param7, flags: u32, ) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupLogFileW(fileloghandle: *const ::core::ffi::c_void, logsectionname: super::super::Foundation::PWSTR, sourcefilename: super::super::Foundation::PWSTR, targetfilename: super::super::Foundation::PWSTR, checksum: u32, disktagfile: super::super::Foundation::PWSTR, diskdescription: super::super::Foundation::PWSTR, otherinfo: super::super::Foundation::PWSTR, flags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupLogFileW( ::core::mem::transmute(fileloghandle), logsectionname.into_param().abi(), sourcefilename.into_param().abi(), targetfilename.into_param().abi(), ::core::mem::transmute(checksum), disktagfile.into_param().abi(), diskdescription.into_param().abi(), otherinfo.into_param().abi(), ::core::mem::transmute(flags), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupOpenAppendInfFileA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(filename: Param0, infhandle: *const ::core::ffi::c_void, errorline: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupOpenAppendInfFileA(filename: super::super::Foundation::PSTR, infhandle: *const ::core::ffi::c_void, errorline: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupOpenAppendInfFileA(filename.into_param().abi(), ::core::mem::transmute(infhandle), ::core::mem::transmute(errorline))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupOpenAppendInfFileW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(filename: Param0, infhandle: *const ::core::ffi::c_void, errorline: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupOpenAppendInfFileW(filename: super::super::Foundation::PWSTR, infhandle: *const ::core::ffi::c_void, errorline: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupOpenAppendInfFileW(filename.into_param().abi(), ::core::mem::transmute(infhandle), ::core::mem::transmute(errorline))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn SetupOpenFileQueue() -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupOpenFileQueue() -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupOpenFileQueue()) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupOpenInfFileA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(filename: Param0, infclass: Param1, infstyle: u32, errorline: *mut u32) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupOpenInfFileA(filename: super::super::Foundation::PSTR, infclass: super::super::Foundation::PSTR, infstyle: u32, errorline: *mut u32) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupOpenInfFileA(filename.into_param().abi(), infclass.into_param().abi(), ::core::mem::transmute(infstyle), ::core::mem::transmute(errorline))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupOpenInfFileW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(filename: Param0, infclass: Param1, infstyle: u32, errorline: *mut u32) -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupOpenInfFileW(filename: super::super::Foundation::PWSTR, infclass: super::super::Foundation::PWSTR, infstyle: u32, errorline: *mut u32) -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupOpenInfFileW(filename.into_param().abi(), infclass.into_param().abi(), ::core::mem::transmute(infstyle), ::core::mem::transmute(errorline))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupOpenLog<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(erase: Param0) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupOpenLog(erase: super::super::Foundation::BOOL) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupOpenLog(erase.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn SetupOpenMasterInf() -> *mut ::core::ffi::c_void { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupOpenMasterInf() -> *mut ::core::ffi::c_void; } ::core::mem::transmute(SetupOpenMasterInf()) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupPrepareQueueForRestoreA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(queuehandle: *const ::core::ffi::c_void, backuppath: Param1, restoreflags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupPrepareQueueForRestoreA(queuehandle: *const ::core::ffi::c_void, backuppath: super::super::Foundation::PSTR, restoreflags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupPrepareQueueForRestoreA(::core::mem::transmute(queuehandle), backuppath.into_param().abi(), ::core::mem::transmute(restoreflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupPrepareQueueForRestoreW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(queuehandle: *const ::core::ffi::c_void, backuppath: Param1, restoreflags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupPrepareQueueForRestoreW(queuehandle: *const ::core::ffi::c_void, backuppath: super::super::Foundation::PWSTR, restoreflags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupPrepareQueueForRestoreW(::core::mem::transmute(queuehandle), backuppath.into_param().abi(), ::core::mem::transmute(restoreflags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupPromptForDiskA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>( hwndparent: Param0, dialogtitle: Param1, diskname: Param2, pathtosource: Param3, filesought: Param4, tagfile: Param5, diskpromptstyle: u32, pathbuffer: super::super::Foundation::PSTR, pathbuffersize: u32, pathrequiredsize: *mut u32, ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupPromptForDiskA(hwndparent: super::super::Foundation::HWND, dialogtitle: super::super::Foundation::PSTR, diskname: super::super::Foundation::PSTR, pathtosource: super::super::Foundation::PSTR, filesought: super::super::Foundation::PSTR, tagfile: super::super::Foundation::PSTR, diskpromptstyle: u32, pathbuffer: super::super::Foundation::PSTR, pathbuffersize: u32, pathrequiredsize: *mut u32) -> u32; } ::core::mem::transmute(SetupPromptForDiskA( hwndparent.into_param().abi(), dialogtitle.into_param().abi(), diskname.into_param().abi(), pathtosource.into_param().abi(), filesought.into_param().abi(), tagfile.into_param().abi(), ::core::mem::transmute(diskpromptstyle), ::core::mem::transmute(pathbuffer), ::core::mem::transmute(pathbuffersize), ::core::mem::transmute(pathrequiredsize), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupPromptForDiskW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, 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>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>( hwndparent: Param0, dialogtitle: Param1, diskname: Param2, pathtosource: Param3, filesought: Param4, tagfile: Param5, diskpromptstyle: u32, pathbuffer: super::super::Foundation::PWSTR, pathbuffersize: u32, pathrequiredsize: *mut u32, ) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupPromptForDiskW(hwndparent: super::super::Foundation::HWND, dialogtitle: super::super::Foundation::PWSTR, diskname: super::super::Foundation::PWSTR, pathtosource: super::super::Foundation::PWSTR, filesought: super::super::Foundation::PWSTR, tagfile: super::super::Foundation::PWSTR, diskpromptstyle: u32, pathbuffer: super::super::Foundation::PWSTR, pathbuffersize: u32, pathrequiredsize: *mut u32) -> u32; } ::core::mem::transmute(SetupPromptForDiskW( hwndparent.into_param().abi(), dialogtitle.into_param().abi(), diskname.into_param().abi(), pathtosource.into_param().abi(), filesought.into_param().abi(), tagfile.into_param().abi(), ::core::mem::transmute(diskpromptstyle), ::core::mem::transmute(pathbuffer), ::core::mem::transmute(pathbuffersize), ::core::mem::transmute(pathrequiredsize), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupPromptReboot<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(filequeue: *const ::core::ffi::c_void, owner: Param1, scanonly: Param2) -> i32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupPromptReboot(filequeue: *const ::core::ffi::c_void, owner: super::super::Foundation::HWND, scanonly: super::super::Foundation::BOOL) -> i32; } ::core::mem::transmute(SetupPromptReboot(::core::mem::transmute(filequeue), owner.into_param().abi(), scanonly.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueryDrivesInDiskSpaceListA(diskspace: *const ::core::ffi::c_void, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueryDrivesInDiskSpaceListA(diskspace: *const ::core::ffi::c_void, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueryDrivesInDiskSpaceListA(::core::mem::transmute(diskspace), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueryDrivesInDiskSpaceListW(diskspace: *const ::core::ffi::c_void, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueryDrivesInDiskSpaceListW(diskspace: *const ::core::ffi::c_void, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueryDrivesInDiskSpaceListW(::core::mem::transmute(diskspace), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueryFileLogA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(fileloghandle: *const ::core::ffi::c_void, logsectionname: Param1, targetfilename: Param2, desiredinfo: SetupFileLogInfo, dataout: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueryFileLogA(fileloghandle: *const ::core::ffi::c_void, logsectionname: super::super::Foundation::PSTR, targetfilename: super::super::Foundation::PSTR, desiredinfo: SetupFileLogInfo, dataout: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueryFileLogA(::core::mem::transmute(fileloghandle), logsectionname.into_param().abi(), targetfilename.into_param().abi(), ::core::mem::transmute(desiredinfo), ::core::mem::transmute(dataout), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueryFileLogW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(fileloghandle: *const ::core::ffi::c_void, logsectionname: Param1, targetfilename: Param2, desiredinfo: SetupFileLogInfo, dataout: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueryFileLogW(fileloghandle: *const ::core::ffi::c_void, logsectionname: super::super::Foundation::PWSTR, targetfilename: super::super::Foundation::PWSTR, desiredinfo: SetupFileLogInfo, dataout: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueryFileLogW(::core::mem::transmute(fileloghandle), logsectionname.into_param().abi(), targetfilename.into_param().abi(), ::core::mem::transmute(desiredinfo), ::core::mem::transmute(dataout), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueryInfFileInformationA(infinformation: *const SP_INF_INFORMATION, infindex: u32, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueryInfFileInformationA(infinformation: *const SP_INF_INFORMATION, infindex: u32, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueryInfFileInformationA(::core::mem::transmute(infinformation), ::core::mem::transmute(infindex), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueryInfFileInformationW(infinformation: *const SP_INF_INFORMATION, infindex: u32, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueryInfFileInformationW(infinformation: *const SP_INF_INFORMATION, infindex: u32, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueryInfFileInformationW(::core::mem::transmute(infinformation), ::core::mem::transmute(infindex), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Diagnostics_Debug"))] #[inline] pub unsafe fn SetupQueryInfOriginalFileInformationA(infinformation: *const SP_INF_INFORMATION, infindex: u32, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, originalfileinfo: *mut SP_ORIGINAL_FILE_INFO_A) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueryInfOriginalFileInformationA(infinformation: *const SP_INF_INFORMATION, infindex: u32, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, originalfileinfo: *mut SP_ORIGINAL_FILE_INFO_A) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueryInfOriginalFileInformationA(::core::mem::transmute(infinformation), ::core::mem::transmute(infindex), ::core::mem::transmute(alternateplatforminfo), ::core::mem::transmute(originalfileinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Diagnostics_Debug"))] #[inline] pub unsafe fn SetupQueryInfOriginalFileInformationW(infinformation: *const SP_INF_INFORMATION, infindex: u32, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, originalfileinfo: *mut SP_ORIGINAL_FILE_INFO_W) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueryInfOriginalFileInformationW(infinformation: *const SP_INF_INFORMATION, infindex: u32, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, originalfileinfo: *mut SP_ORIGINAL_FILE_INFO_W) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueryInfOriginalFileInformationW(::core::mem::transmute(infinformation), ::core::mem::transmute(infindex), ::core::mem::transmute(alternateplatforminfo), ::core::mem::transmute(originalfileinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueryInfVersionInformationA<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infinformation: *const SP_INF_INFORMATION, infindex: u32, key: Param2, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueryInfVersionInformationA(infinformation: *const SP_INF_INFORMATION, infindex: u32, key: super::super::Foundation::PSTR, returnbuffer: super::super::Foundation::PSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueryInfVersionInformationA(::core::mem::transmute(infinformation), ::core::mem::transmute(infindex), key.into_param().abi(), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueryInfVersionInformationW<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infinformation: *const SP_INF_INFORMATION, infindex: u32, key: Param2, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueryInfVersionInformationW(infinformation: *const SP_INF_INFORMATION, infindex: u32, key: super::super::Foundation::PWSTR, returnbuffer: super::super::Foundation::PWSTR, returnbuffersize: u32, requiredsize: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueryInfVersionInformationW(::core::mem::transmute(infinformation), ::core::mem::transmute(infindex), key.into_param().abi(), ::core::mem::transmute(returnbuffer), ::core::mem::transmute(returnbuffersize), ::core::mem::transmute(requiredsize))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQuerySourceListA(flags: u32, list: *mut *mut super::super::Foundation::PSTR, count: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQuerySourceListA(flags: u32, list: *mut *mut super::super::Foundation::PSTR, count: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQuerySourceListA(::core::mem::transmute(flags), ::core::mem::transmute(list), ::core::mem::transmute(count))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQuerySourceListW(flags: u32, list: *mut *mut super::super::Foundation::PWSTR, count: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQuerySourceListW(flags: u32, list: *mut *mut super::super::Foundation::PWSTR, count: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQuerySourceListW(::core::mem::transmute(flags), ::core::mem::transmute(list), ::core::mem::transmute(count))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQuerySpaceRequiredOnDriveA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(diskspace: *const ::core::ffi::c_void, drivespec: Param1, spacerequired: *mut i64, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQuerySpaceRequiredOnDriveA(diskspace: *const ::core::ffi::c_void, drivespec: super::super::Foundation::PSTR, spacerequired: *mut i64, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQuerySpaceRequiredOnDriveA(::core::mem::transmute(diskspace), drivespec.into_param().abi(), ::core::mem::transmute(spacerequired), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQuerySpaceRequiredOnDriveW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(diskspace: *const ::core::ffi::c_void, drivespec: Param1, spacerequired: *mut i64, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQuerySpaceRequiredOnDriveW(diskspace: *const ::core::ffi::c_void, drivespec: super::super::Foundation::PWSTR, spacerequired: *mut i64, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQuerySpaceRequiredOnDriveW(::core::mem::transmute(diskspace), drivespec.into_param().abi(), ::core::mem::transmute(spacerequired), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueueCopyA< 'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param6: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param7: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, >( queuehandle: *const ::core::ffi::c_void, sourcerootpath: Param1, sourcepath: Param2, sourcefilename: Param3, sourcedescription: Param4, sourcetagfile: Param5, targetdirectory: Param6, targetfilename: Param7, copystyle: u32, ) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueueCopyA(queuehandle: *const ::core::ffi::c_void, sourcerootpath: super::super::Foundation::PSTR, sourcepath: super::super::Foundation::PSTR, sourcefilename: super::super::Foundation::PSTR, sourcedescription: super::super::Foundation::PSTR, sourcetagfile: super::super::Foundation::PSTR, targetdirectory: super::super::Foundation::PSTR, targetfilename: super::super::Foundation::PSTR, copystyle: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueueCopyA( ::core::mem::transmute(queuehandle), sourcerootpath.into_param().abi(), sourcepath.into_param().abi(), sourcefilename.into_param().abi(), sourcedescription.into_param().abi(), sourcetagfile.into_param().abi(), targetdirectory.into_param().abi(), targetfilename.into_param().abi(), ::core::mem::transmute(copystyle), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueueCopyIndirectA(copyparams: *const SP_FILE_COPY_PARAMS_A) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueueCopyIndirectA(copyparams: *const SP_FILE_COPY_PARAMS_A) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueueCopyIndirectA(::core::mem::transmute(copyparams))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueueCopyIndirectW(copyparams: *const SP_FILE_COPY_PARAMS_W) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueueCopyIndirectW(copyparams: *const SP_FILE_COPY_PARAMS_W) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueueCopyIndirectW(::core::mem::transmute(copyparams))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueueCopySectionA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(queuehandle: *const ::core::ffi::c_void, sourcerootpath: Param1, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, section: Param4, copystyle: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueueCopySectionA(queuehandle: *const ::core::ffi::c_void, sourcerootpath: super::super::Foundation::PSTR, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, section: super::super::Foundation::PSTR, copystyle: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueueCopySectionA(::core::mem::transmute(queuehandle), sourcerootpath.into_param().abi(), ::core::mem::transmute(infhandle), ::core::mem::transmute(listinfhandle), section.into_param().abi(), ::core::mem::transmute(copystyle))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueueCopySectionW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(queuehandle: *const ::core::ffi::c_void, sourcerootpath: Param1, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, section: Param4, copystyle: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueueCopySectionW(queuehandle: *const ::core::ffi::c_void, sourcerootpath: super::super::Foundation::PWSTR, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, section: super::super::Foundation::PWSTR, copystyle: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueueCopySectionW(::core::mem::transmute(queuehandle), sourcerootpath.into_param().abi(), ::core::mem::transmute(infhandle), ::core::mem::transmute(listinfhandle), section.into_param().abi(), ::core::mem::transmute(copystyle))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueueCopyW< 'a, 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>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param5: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param6: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param7: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, >( queuehandle: *const ::core::ffi::c_void, sourcerootpath: Param1, sourcepath: Param2, sourcefilename: Param3, sourcedescription: Param4, sourcetagfile: Param5, targetdirectory: Param6, targetfilename: Param7, copystyle: u32, ) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueueCopyW(queuehandle: *const ::core::ffi::c_void, sourcerootpath: super::super::Foundation::PWSTR, sourcepath: super::super::Foundation::PWSTR, sourcefilename: super::super::Foundation::PWSTR, sourcedescription: super::super::Foundation::PWSTR, sourcetagfile: super::super::Foundation::PWSTR, targetdirectory: super::super::Foundation::PWSTR, targetfilename: super::super::Foundation::PWSTR, copystyle: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueueCopyW( ::core::mem::transmute(queuehandle), sourcerootpath.into_param().abi(), sourcepath.into_param().abi(), sourcefilename.into_param().abi(), sourcedescription.into_param().abi(), sourcetagfile.into_param().abi(), targetdirectory.into_param().abi(), targetfilename.into_param().abi(), ::core::mem::transmute(copystyle), )) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueueDefaultCopyA<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(queuehandle: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, sourcerootpath: Param2, sourcefilename: Param3, targetfilename: Param4, copystyle: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueueDefaultCopyA(queuehandle: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, sourcerootpath: super::super::Foundation::PSTR, sourcefilename: super::super::Foundation::PSTR, targetfilename: super::super::Foundation::PSTR, copystyle: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueueDefaultCopyA(::core::mem::transmute(queuehandle), ::core::mem::transmute(infhandle), sourcerootpath.into_param().abi(), sourcefilename.into_param().abi(), targetfilename.into_param().abi(), ::core::mem::transmute(copystyle))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueueDefaultCopyW<'a, Param2: ::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>>(queuehandle: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, sourcerootpath: Param2, sourcefilename: Param3, targetfilename: Param4, copystyle: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueueDefaultCopyW(queuehandle: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, sourcerootpath: super::super::Foundation::PWSTR, sourcefilename: super::super::Foundation::PWSTR, targetfilename: super::super::Foundation::PWSTR, copystyle: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueueDefaultCopyW(::core::mem::transmute(queuehandle), ::core::mem::transmute(infhandle), sourcerootpath.into_param().abi(), sourcefilename.into_param().abi(), targetfilename.into_param().abi(), ::core::mem::transmute(copystyle))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueueDeleteA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(queuehandle: *const ::core::ffi::c_void, pathpart1: Param1, pathpart2: Param2) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueueDeleteA(queuehandle: *const ::core::ffi::c_void, pathpart1: super::super::Foundation::PSTR, pathpart2: super::super::Foundation::PSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueueDeleteA(::core::mem::transmute(queuehandle), pathpart1.into_param().abi(), pathpart2.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueueDeleteSectionA<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(queuehandle: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, section: Param3) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueueDeleteSectionA(queuehandle: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, section: super::super::Foundation::PSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueueDeleteSectionA(::core::mem::transmute(queuehandle), ::core::mem::transmute(infhandle), ::core::mem::transmute(listinfhandle), section.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueueDeleteSectionW<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(queuehandle: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, section: Param3) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueueDeleteSectionW(queuehandle: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, section: super::super::Foundation::PWSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueueDeleteSectionW(::core::mem::transmute(queuehandle), ::core::mem::transmute(infhandle), ::core::mem::transmute(listinfhandle), section.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueueDeleteW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(queuehandle: *const ::core::ffi::c_void, pathpart1: Param1, pathpart2: Param2) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueueDeleteW(queuehandle: *const ::core::ffi::c_void, pathpart1: super::super::Foundation::PWSTR, pathpart2: super::super::Foundation::PWSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueueDeleteW(::core::mem::transmute(queuehandle), pathpart1.into_param().abi(), pathpart2.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueueRenameA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(queuehandle: *const ::core::ffi::c_void, sourcepath: Param1, sourcefilename: Param2, targetpath: Param3, targetfilename: Param4) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueueRenameA(queuehandle: *const ::core::ffi::c_void, sourcepath: super::super::Foundation::PSTR, sourcefilename: super::super::Foundation::PSTR, targetpath: super::super::Foundation::PSTR, targetfilename: super::super::Foundation::PSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueueRenameA(::core::mem::transmute(queuehandle), sourcepath.into_param().abi(), sourcefilename.into_param().abi(), targetpath.into_param().abi(), targetfilename.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueueRenameSectionA<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(queuehandle: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, section: Param3) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueueRenameSectionA(queuehandle: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, section: super::super::Foundation::PSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueueRenameSectionA(::core::mem::transmute(queuehandle), ::core::mem::transmute(infhandle), ::core::mem::transmute(listinfhandle), section.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueueRenameSectionW<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(queuehandle: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, section: Param3) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueueRenameSectionW(queuehandle: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, section: super::super::Foundation::PWSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueueRenameSectionW(::core::mem::transmute(queuehandle), ::core::mem::transmute(infhandle), ::core::mem::transmute(listinfhandle), section.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupQueueRenameW<'a, 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>, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(queuehandle: *const ::core::ffi::c_void, sourcepath: Param1, sourcefilename: Param2, targetpath: Param3, targetfilename: Param4) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupQueueRenameW(queuehandle: *const ::core::ffi::c_void, sourcepath: super::super::Foundation::PWSTR, sourcefilename: super::super::Foundation::PWSTR, targetpath: super::super::Foundation::PWSTR, targetfilename: super::super::Foundation::PWSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupQueueRenameW(::core::mem::transmute(queuehandle), sourcepath.into_param().abi(), sourcefilename.into_param().abi(), targetpath.into_param().abi(), targetfilename.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupRemoveFileLogEntryA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(fileloghandle: *const ::core::ffi::c_void, logsectionname: Param1, targetfilename: Param2) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupRemoveFileLogEntryA(fileloghandle: *const ::core::ffi::c_void, logsectionname: super::super::Foundation::PSTR, targetfilename: super::super::Foundation::PSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupRemoveFileLogEntryA(::core::mem::transmute(fileloghandle), logsectionname.into_param().abi(), targetfilename.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupRemoveFileLogEntryW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(fileloghandle: *const ::core::ffi::c_void, logsectionname: Param1, targetfilename: Param2) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupRemoveFileLogEntryW(fileloghandle: *const ::core::ffi::c_void, logsectionname: super::super::Foundation::PWSTR, targetfilename: super::super::Foundation::PWSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupRemoveFileLogEntryW(::core::mem::transmute(fileloghandle), logsectionname.into_param().abi(), targetfilename.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupRemoveFromDiskSpaceListA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(diskspace: *const ::core::ffi::c_void, targetfilespec: Param1, operation: SETUP_FILE_OPERATION, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupRemoveFromDiskSpaceListA(diskspace: *const ::core::ffi::c_void, targetfilespec: super::super::Foundation::PSTR, operation: SETUP_FILE_OPERATION, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupRemoveFromDiskSpaceListA(::core::mem::transmute(diskspace), targetfilespec.into_param().abi(), ::core::mem::transmute(operation), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupRemoveFromDiskSpaceListW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(diskspace: *const ::core::ffi::c_void, targetfilespec: Param1, operation: SETUP_FILE_OPERATION, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupRemoveFromDiskSpaceListW(diskspace: *const ::core::ffi::c_void, targetfilespec: super::super::Foundation::PWSTR, operation: SETUP_FILE_OPERATION, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupRemoveFromDiskSpaceListW(::core::mem::transmute(diskspace), targetfilespec.into_param().abi(), ::core::mem::transmute(operation), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupRemoveFromSourceListA<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(flags: u32, source: Param1) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupRemoveFromSourceListA(flags: u32, source: super::super::Foundation::PSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupRemoveFromSourceListA(::core::mem::transmute(flags), source.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupRemoveFromSourceListW<'a, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(flags: u32, source: Param1) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupRemoveFromSourceListW(flags: u32, source: super::super::Foundation::PWSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupRemoveFromSourceListW(::core::mem::transmute(flags), source.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupRemoveInstallSectionFromDiskSpaceListA<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(diskspace: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, layoutinfhandle: *const ::core::ffi::c_void, sectionname: Param3, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupRemoveInstallSectionFromDiskSpaceListA(diskspace: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, layoutinfhandle: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PSTR, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupRemoveInstallSectionFromDiskSpaceListA(::core::mem::transmute(diskspace), ::core::mem::transmute(infhandle), ::core::mem::transmute(layoutinfhandle), sectionname.into_param().abi(), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupRemoveInstallSectionFromDiskSpaceListW<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(diskspace: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, layoutinfhandle: *const ::core::ffi::c_void, sectionname: Param3, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupRemoveInstallSectionFromDiskSpaceListW(diskspace: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, layoutinfhandle: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PWSTR, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupRemoveInstallSectionFromDiskSpaceListW(::core::mem::transmute(diskspace), ::core::mem::transmute(infhandle), ::core::mem::transmute(layoutinfhandle), sectionname.into_param().abi(), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupRemoveSectionFromDiskSpaceListA<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(diskspace: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, sectionname: Param3, operation: SETUP_FILE_OPERATION, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupRemoveSectionFromDiskSpaceListA(diskspace: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PSTR, operation: SETUP_FILE_OPERATION, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupRemoveSectionFromDiskSpaceListA(::core::mem::transmute(diskspace), ::core::mem::transmute(infhandle), ::core::mem::transmute(listinfhandle), sectionname.into_param().abi(), ::core::mem::transmute(operation), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupRemoveSectionFromDiskSpaceListW<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(diskspace: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, sectionname: Param3, operation: SETUP_FILE_OPERATION, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupRemoveSectionFromDiskSpaceListW(diskspace: *const ::core::ffi::c_void, infhandle: *const ::core::ffi::c_void, listinfhandle: *const ::core::ffi::c_void, sectionname: super::super::Foundation::PWSTR, operation: SETUP_FILE_OPERATION, reserved1: *mut ::core::ffi::c_void, reserved2: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupRemoveSectionFromDiskSpaceListW(::core::mem::transmute(diskspace), ::core::mem::transmute(infhandle), ::core::mem::transmute(listinfhandle), sectionname.into_param().abi(), ::core::mem::transmute(operation), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupRenameErrorA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(hwndparent: Param0, dialogtitle: Param1, sourcefile: Param2, targetfile: Param3, win32errorcode: u32, style: u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupRenameErrorA(hwndparent: super::super::Foundation::HWND, dialogtitle: super::super::Foundation::PSTR, sourcefile: super::super::Foundation::PSTR, targetfile: super::super::Foundation::PSTR, win32errorcode: u32, style: u32) -> u32; } ::core::mem::transmute(SetupRenameErrorA(hwndparent.into_param().abi(), dialogtitle.into_param().abi(), sourcefile.into_param().abi(), targetfile.into_param().abi(), ::core::mem::transmute(win32errorcode), ::core::mem::transmute(style))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupRenameErrorW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, 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>>(hwndparent: Param0, dialogtitle: Param1, sourcefile: Param2, targetfile: Param3, win32errorcode: u32, style: u32) -> u32 { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupRenameErrorW(hwndparent: super::super::Foundation::HWND, dialogtitle: super::super::Foundation::PWSTR, sourcefile: super::super::Foundation::PWSTR, targetfile: super::super::Foundation::PWSTR, win32errorcode: u32, style: u32) -> u32; } ::core::mem::transmute(SetupRenameErrorW(hwndparent.into_param().abi(), dialogtitle.into_param().abi(), sourcefile.into_param().abi(), targetfile.into_param().abi(), ::core::mem::transmute(win32errorcode), ::core::mem::transmute(style))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupScanFileQueueA<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(filequeue: *const ::core::ffi::c_void, flags: u32, window: Param2, callbackroutine: ::core::option::Option<PSP_FILE_CALLBACK_A>, callbackcontext: *const ::core::ffi::c_void, result: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupScanFileQueueA(filequeue: *const ::core::ffi::c_void, flags: u32, window: super::super::Foundation::HWND, callbackroutine: ::windows::core::RawPtr, callbackcontext: *const ::core::ffi::c_void, result: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupScanFileQueueA(::core::mem::transmute(filequeue), ::core::mem::transmute(flags), window.into_param().abi(), ::core::mem::transmute(callbackroutine), ::core::mem::transmute(callbackcontext), ::core::mem::transmute(result))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupScanFileQueueW<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>>(filequeue: *const ::core::ffi::c_void, flags: u32, window: Param2, callbackroutine: ::core::option::Option<PSP_FILE_CALLBACK_W>, callbackcontext: *const ::core::ffi::c_void, result: *mut u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupScanFileQueueW(filequeue: *const ::core::ffi::c_void, flags: u32, window: super::super::Foundation::HWND, callbackroutine: ::windows::core::RawPtr, callbackcontext: *const ::core::ffi::c_void, result: *mut u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupScanFileQueueW(::core::mem::transmute(filequeue), ::core::mem::transmute(flags), window.into_param().abi(), ::core::mem::transmute(callbackroutine), ::core::mem::transmute(callbackcontext), ::core::mem::transmute(result))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupSetDirectoryIdA<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infhandle: *const ::core::ffi::c_void, id: u32, directory: Param2) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupSetDirectoryIdA(infhandle: *const ::core::ffi::c_void, id: u32, directory: super::super::Foundation::PSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupSetDirectoryIdA(::core::mem::transmute(infhandle), ::core::mem::transmute(id), directory.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupSetDirectoryIdExA<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infhandle: *const ::core::ffi::c_void, id: u32, directory: Param2, flags: u32, reserved1: u32, reserved2: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupSetDirectoryIdExA(infhandle: *const ::core::ffi::c_void, id: u32, directory: super::super::Foundation::PSTR, flags: u32, reserved1: u32, reserved2: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupSetDirectoryIdExA(::core::mem::transmute(infhandle), ::core::mem::transmute(id), directory.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupSetDirectoryIdExW<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infhandle: *const ::core::ffi::c_void, id: u32, directory: Param2, flags: u32, reserved1: u32, reserved2: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupSetDirectoryIdExW(infhandle: *const ::core::ffi::c_void, id: u32, directory: super::super::Foundation::PWSTR, flags: u32, reserved1: u32, reserved2: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupSetDirectoryIdExW(::core::mem::transmute(infhandle), ::core::mem::transmute(id), directory.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(reserved1), ::core::mem::transmute(reserved2))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupSetDirectoryIdW<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infhandle: *const ::core::ffi::c_void, id: u32, directory: Param2) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupSetDirectoryIdW(infhandle: *const ::core::ffi::c_void, id: u32, directory: super::super::Foundation::PWSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupSetDirectoryIdW(::core::mem::transmute(infhandle), ::core::mem::transmute(id), directory.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Diagnostics_Debug"))] #[inline] pub unsafe fn SetupSetFileQueueAlternatePlatformA<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(queuehandle: *const ::core::ffi::c_void, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, alternatedefaultcatalogfile: Param2) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupSetFileQueueAlternatePlatformA(queuehandle: *const ::core::ffi::c_void, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, alternatedefaultcatalogfile: super::super::Foundation::PSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupSetFileQueueAlternatePlatformA(::core::mem::transmute(queuehandle), ::core::mem::transmute(alternateplatforminfo), alternatedefaultcatalogfile.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Diagnostics_Debug"))] #[inline] pub unsafe fn SetupSetFileQueueAlternatePlatformW<'a, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(queuehandle: *const ::core::ffi::c_void, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, alternatedefaultcatalogfile: Param2) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupSetFileQueueAlternatePlatformW(queuehandle: *const ::core::ffi::c_void, alternateplatforminfo: *const SP_ALTPLATFORM_INFO_V2, alternatedefaultcatalogfile: super::super::Foundation::PWSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupSetFileQueueAlternatePlatformW(::core::mem::transmute(queuehandle), ::core::mem::transmute(alternateplatforminfo), alternatedefaultcatalogfile.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupSetFileQueueFlags(filequeue: *const ::core::ffi::c_void, flagmask: u32, flags: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupSetFileQueueFlags(filequeue: *const ::core::ffi::c_void, flagmask: u32, flags: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupSetFileQueueFlags(::core::mem::transmute(filequeue), ::core::mem::transmute(flagmask), ::core::mem::transmute(flags))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupSetNonInteractiveMode<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(noninteractiveflag: Param0) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupSetNonInteractiveMode(noninteractiveflag: super::super::Foundation::BOOL) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupSetNonInteractiveMode(noninteractiveflag.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupSetPlatformPathOverrideA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(r#override: Param0) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupSetPlatformPathOverrideA(r#override: super::super::Foundation::PSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupSetPlatformPathOverrideA(r#override.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupSetPlatformPathOverrideW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(r#override: Param0) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupSetPlatformPathOverrideW(r#override: super::super::Foundation::PWSTR) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupSetPlatformPathOverrideW(r#override.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupSetSourceListA(flags: u32, sourcelist: *const super::super::Foundation::PSTR, sourcecount: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupSetSourceListA(flags: u32, sourcelist: *const super::super::Foundation::PSTR, sourcecount: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupSetSourceListA(::core::mem::transmute(flags), ::core::mem::transmute(sourcelist), ::core::mem::transmute(sourcecount))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupSetSourceListW(flags: u32, sourcelist: *const super::super::Foundation::PWSTR, sourcecount: u32) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupSetSourceListW(flags: u32, sourcelist: *const super::super::Foundation::PWSTR, sourcecount: u32) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupSetSourceListW(::core::mem::transmute(flags), ::core::mem::transmute(sourcelist), ::core::mem::transmute(sourcecount))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn SetupSetThreadLogToken(logtoken: u64) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupSetThreadLogToken(logtoken: u64); } ::core::mem::transmute(SetupSetThreadLogToken(::core::mem::transmute(logtoken))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn SetupTermDefaultQueueCallback(context: *const ::core::ffi::c_void) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupTermDefaultQueueCallback(context: *const ::core::ffi::c_void); } ::core::mem::transmute(SetupTermDefaultQueueCallback(::core::mem::transmute(context))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupTerminateFileLog(fileloghandle: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupTerminateFileLog(fileloghandle: *const ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupTerminateFileLog(::core::mem::transmute(fileloghandle))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupUninstallNewlyCopiedInfs(filequeue: *const ::core::ffi::c_void, flags: u32, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupUninstallNewlyCopiedInfs(filequeue: *const ::core::ffi::c_void, flags: u32, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupUninstallNewlyCopiedInfs(::core::mem::transmute(filequeue), ::core::mem::transmute(flags), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupUninstallOEMInfA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(inffilename: Param0, flags: u32, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupUninstallOEMInfA(inffilename: super::super::Foundation::PSTR, flags: u32, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupUninstallOEMInfA(inffilename.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupUninstallOEMInfW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(inffilename: Param0, flags: u32, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupUninstallOEMInfW(inffilename: super::super::Foundation::PWSTR, flags: u32, reserved: *mut ::core::ffi::c_void) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupUninstallOEMInfW(inffilename.into_param().abi(), ::core::mem::transmute(flags), ::core::mem::transmute(reserved))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Diagnostics_Debug"))] #[inline] pub unsafe fn SetupVerifyInfFileA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(infname: Param0, altplatforminfo: *const SP_ALTPLATFORM_INFO_V2, infsignerinfo: *mut SP_INF_SIGNER_INFO_V2_A) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupVerifyInfFileA(infname: super::super::Foundation::PSTR, altplatforminfo: *const SP_ALTPLATFORM_INFO_V2, infsignerinfo: *mut SP_INF_SIGNER_INFO_V2_A) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupVerifyInfFileA(infname.into_param().abi(), ::core::mem::transmute(altplatforminfo), ::core::mem::transmute(infsignerinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Diagnostics_Debug"))] #[inline] pub unsafe fn SetupVerifyInfFileW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(infname: Param0, altplatforminfo: *const SP_ALTPLATFORM_INFO_V2, infsignerinfo: *mut SP_INF_SIGNER_INFO_V2_W) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupVerifyInfFileW(infname: super::super::Foundation::PWSTR, altplatforminfo: *const SP_ALTPLATFORM_INFO_V2, infsignerinfo: *mut SP_INF_SIGNER_INFO_V2_W) -> super::super::Foundation::BOOL; } ::core::mem::transmute(SetupVerifyInfFileW(infname.into_param().abi(), ::core::mem::transmute(altplatforminfo), ::core::mem::transmute(infsignerinfo))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupWriteTextLog<'a, Param3: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(logtoken: u64, category: u32, flags: u32, messagestr: Param3) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupWriteTextLog(logtoken: u64, category: u32, flags: u32, messagestr: super::super::Foundation::PSTR); } ::core::mem::transmute(SetupWriteTextLog(::core::mem::transmute(logtoken), ::core::mem::transmute(category), ::core::mem::transmute(flags), messagestr.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn SetupWriteTextLogError<'a, Param4: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(logtoken: u64, category: u32, logflags: u32, error: u32, messagestr: Param4) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupWriteTextLogError(logtoken: u64, category: u32, logflags: u32, error: u32, messagestr: super::super::Foundation::PSTR); } ::core::mem::transmute(SetupWriteTextLogError(::core::mem::transmute(logtoken), ::core::mem::transmute(category), ::core::mem::transmute(logflags), ::core::mem::transmute(error), messagestr.into_param().abi())) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[inline] pub unsafe fn SetupWriteTextLogInfLine(logtoken: u64, flags: u32, infhandle: *const ::core::ffi::c_void, context: *const INFCONTEXT) { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn SetupWriteTextLogInfLine(logtoken: u64, flags: u32, infhandle: *const ::core::ffi::c_void, context: *const INFCONTEXT); } ::core::mem::transmute(SetupWriteTextLogInfLine(::core::mem::transmute(logtoken), ::core::mem::transmute(flags), ::core::mem::transmute(infhandle), ::core::mem::transmute(context))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn UpdateDriverForPlugAndPlayDevicesA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(hwndparent: Param0, hardwareid: Param1, fullinfpath: Param2, installflags: u32, brebootrequired: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn UpdateDriverForPlugAndPlayDevicesA(hwndparent: super::super::Foundation::HWND, hardwareid: super::super::Foundation::PSTR, fullinfpath: super::super::Foundation::PSTR, installflags: u32, brebootrequired: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL; } ::core::mem::transmute(UpdateDriverForPlugAndPlayDevicesA(hwndparent.into_param().abi(), hardwareid.into_param().abi(), fullinfpath.into_param().abi(), ::core::mem::transmute(installflags), ::core::mem::transmute(brebootrequired))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); } #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn UpdateDriverForPlugAndPlayDevicesW<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HWND>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::PWSTR>>(hwndparent: Param0, hardwareid: Param1, fullinfpath: Param2, installflags: u32, brebootrequired: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL { #[cfg(windows)] { #[link(name = "windows")] extern "system" { fn UpdateDriverForPlugAndPlayDevicesW(hwndparent: super::super::Foundation::HWND, hardwareid: super::super::Foundation::PWSTR, fullinfpath: super::super::Foundation::PWSTR, installflags: u32, brebootrequired: *mut super::super::Foundation::BOOL) -> super::super::Foundation::BOOL; } ::core::mem::transmute(UpdateDriverForPlugAndPlayDevicesW(hwndparent.into_param().abi(), hardwareid.into_param().abi(), fullinfpath.into_param().abi(), ::core::mem::transmute(installflags), ::core::mem::transmute(brebootrequired))) } #[cfg(not(windows))] unimplemented!("Unsupported target OS"); }
extern crate futures; extern crate stream_combinators; extern crate tokio; extern crate tokio_stdin; use futures::stream::{once, Stream}; use stream_combinators::FilterFoldStream; use tokio_stdin::spawn_stdin_stream_unbounded; const NEWLINE: u8 = '\n' as u8; fn main() { // Print stdin line-by-line let prog = spawn_stdin_stream_unbounded() // Wrap stream values so we can give a sentinel for EOF .map(Some) .chain(once(Ok(None))) // Accumulate bytes into lines .filter_fold(vec![], |mut buf, val| match val { Some(NEWLINE) => { let s = String::from_utf8(buf).unwrap(); Ok((vec![], Some(s))) } Some(byte) => { buf.push(byte); Ok((buf, None)) } None => { if buf.len() > 0 { let s = String::from_utf8(buf).unwrap(); Ok((vec![], Some(s))) } else { Ok((buf, None)) } } }).for_each(|line| { println!("{}", line); Ok(()) }); tokio::run(prog) }
use crate::geom::hittable::Hittable; use crate::image::image::Image; use crate::raycasting::ray::Ray; use crate::renderer::camera::Camera; use crate::types::{normal3f_to_rgb8, vector3f_to_rgb8, rgb8_to_vector3f}; use crate::types::{Rgb8, Size2i, Vector2i, Vector3f, scale_rgb8, PointwiseSqrtExt }; use rand::Rng; use std::boxed::Box; use std::vec::Vec; pub struct RendererSettings { antialiasing_on: bool, antialiasing_samples: u32, max_depth: u32 } pub struct Renderer { settings: RendererSettings, } impl Renderer { pub fn new() -> Renderer { Renderer { settings: RendererSettings { antialiasing_on: true, antialiasing_samples: 50, max_depth: 50 }, } } fn eval_background_color(&self, r: &Ray) -> Vector3f { let unit_direction = r.direction.normalize(); let t = 0.5 * (unit_direction.y + 1.0); let color = (1.0 - t) * Vector3f::new(1.0, 1.0, 1.0) + t * Vector3f::new(0.5, 0.7, 1.0) ; color } fn eval_ray_color(&self, r: &Ray, hittables: &Vec<Box<dyn Hittable>>, remaining_depth: u32) -> Vector3f { let mut color = self.eval_background_color(r); if remaining_depth == 0 { color = Vector3f::zeros(); // color = (hitpoint.normal + Vector3f::new(1f32, 1f32, 1f32)) * 0.5f32 } else { for hittable in hittables { let sphere_hitpoint = hittable.ray_intersaction(r, 0.001, 10000.0); match sphere_hitpoint { Some(hitpoint) => { let material = hittable.material().as_ref().unwrap(); match material.scatter(r, &hitpoint) { Some((attenuation, scattered)) => { let next_color = self.eval_ray_color(&scattered, hittables, remaining_depth-1); color = attenuation.component_mul(&next_color); }, None => { color = Vector3f::zeros() } } }, None=> () } } } color } pub fn eval_pixel_color( &self, camera: &Camera, pixel_position: Vector2i, hittables: &Vec<Box<dyn Hittable>>, ) -> Rgb8 { let color_vector : Vector3f = if self.settings.antialiasing_on { let mut pixel_color_vector = Vector3f::zeros(); for _i in 0..self.settings.antialiasing_samples { let ray = camera.get_random_ray_from_image_xy(pixel_position); let sample_color = self.eval_ray_color(&ray, &hittables, self.settings.max_depth); pixel_color_vector += sample_color; } let color_vector : Vector3f = pixel_color_vector / self.settings.antialiasing_samples as f32; // apply gamma 2 correction let corrected_color_vector = color_vector.pointwise_sqrt(); // println!("{}", color_vector); corrected_color_vector } else { let ray = camera.get_ray_from_image_xy(pixel_position); let color_vector = self.eval_ray_color(&ray, &hittables, self.settings.max_depth); // println!("{}", color_vector); color_vector }; vector3f_to_rgb8(color_vector) } pub fn run(&self, camera: &Camera, hittables: &Vec<Box<dyn Hittable>>) -> Image { let image_size = Size2i::new( camera.viewport.image_height(), camera.viewport.image_width(), ); let mut image = Image::new(image_size); // render from upper left corner for image_y in 0..camera.viewport.image_height() { for image_x in 0..camera.viewport.image_width() { let pixel_position = Vector2i::new(image_x, image_y); let pixel_color = self.eval_pixel_color(camera, pixel_position, &hittables); image.set_pixel(pixel_position, pixel_color); } } image } }
#[macro_use] extern crate nom; use std::str; #[derive(Debug)] enum Method { GET, POST, } #[derive(Debug)] struct Request { method: Method, url: String, version: String, } named!(parse_method_v1, alt!(tag!("GET") | tag!("POST"))); named!(parse_method_v2<&[u8], &str>, alt!(map_res!(tag!("GET"), str::from_utf8) | map_res!(tag!("POST"), str::from_utf8))); named!(parse_method<&[u8], Method>, alt!(map!(tag!("GET"), |_| Method::GET) | map!(tag!("POST"), |_| Method::POST))); named!(parse_request<&[u8], Request>, ws!(do_parse!( method: parse_method >> url: map_res!(take_until!(" "), str::from_utf8) >> tag!("HTTP/") >> version: map_res!(take_until!("\r"), str::from_utf8) >> (Request { method: method, url: url.into(), version: version.into() }) ))); fn main() { println!("24 Days of Rust vol. 2 - nom, part 1"); let first_line = b"GET /home/ HTTP/1.1\r\n"; println!("{:?}", parse_method_v1(&first_line[..])); println!("{:?}", parse_method_v2(&first_line[..])); println!("{:?}", parse_method(&first_line[..])); println!("{:?}", parse_request(&first_line[..])); let bad_line = b"GT /home/ HTTP/1.1\r\n"; println!("{:?}", parse_request(&bad_line[..])); }
// This enum is only referenced in macros and macro definations. When macros // get resolved it will remove the references to the enum in the generated // code. This has the effect of making the enum unused from the compiler's // point of view. #[allow(dead_code)] pub enum Log { Cpu, GamePad, Ic, Vip, Vsu, } // When the logging features aren't used, these should effectively do nothing. // However, if we simply ignore the arguments passed to the macro, we'll get // a bunch of warnings about dead code, unused variables, etc. To get around // this, we can bind all of the arguments in a local scope. However, simply // binding the arguments will take ownership of them, which is not always // desired, so we bind references to them instead. These bindings should // be optimized away by the compiler. #[macro_export] macro_rules! log { (Log::Cpu, $($arg:expr),*) => ({ $(let _arg = &$arg;)* #[cfg(feature = "log-cpu")] print!($($arg),*); }); (Log::GamePad, $($arg:expr),*) => ({ $(let _arg = &$arg;)* #[cfg(feature = "log-gamepad")] print!($($arg),*); }); (Log::Ic, $($arg:expr),*) => ({ $(let _arg = &$arg;)* #[cfg(feature = "log-ic")] print!($($arg),*); }); (Log::Vip, $($arg:expr),*) => ({ $(let _arg = &$arg;)* #[cfg(feature = "log-vip")] print!($($arg),*); }); (Log::Vsu, $($arg:expr),*) => ({ $(let _arg = &$arg;)* #[cfg(feature = "log-vsu")] print!($($arg),*); }); ($($arg:expr),*) => ({ $(let _arg = &$arg;)* #[cfg(feature = "log-other")] print!($($arg),*); }); } #[macro_export] macro_rules! logln { (Log::Cpu, $($arg:expr),*) => ({ $(let _arg = &$arg;)* #[cfg(feature = "log-cpu")] println!($($arg),*); }); (Log::GamePad, $($arg:expr),*) => ({ $(let _arg = &$arg;)* #[cfg(feature = "log-gamepad")] println!($($arg),*); }); (Log::Ic, $($arg:expr),*) => ({ $(let _arg = &$arg;)* #[cfg(feature = "log-ic")] println!($($arg),*); }); (Log::Vip, $($arg:expr),*) => ({ $(let _arg = &$arg;)* #[cfg(feature = "log-vip")] println!($($arg),*); }); (Log::Vsu, $($arg:expr),*) => ({ $(let _arg = &$arg;)* #[cfg(feature = "log-vsu")] println!($($arg),*); }); ($($arg:expr),*) => ({ $(let _arg = &$arg;)* #[cfg(feature = "log-other")] println!($($arg),*); }); }
#[cfg(test)] mod test { use crate::data_structures::binary_search_tree::{BinarySearchTree}; #[test] fn basics() { } }
// Copyright 2018 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use failure::{format_err, Error, ResultExt}; use fidl_fuchsia_hardware_ethernet as zx_eth; use fidl_fuchsia_inspect_deprecated as inspect; use fidl_fuchsia_net as net; use fidl_fuchsia_net_ext as net_ext; use fidl_fuchsia_net_filter::{FilterMarker, FilterProxy}; use fidl_fuchsia_net_stack::{ self as netstack, InterfaceInfo, LogMarker, LogProxy, StackMarker, StackProxy, }; use fidl_fuchsia_net_stack_ext::{self as pretty, exec_fidl as stack_fidl, FidlReturn}; use fidl_fuchsia_netstack::{NetstackMarker, NetstackProxy}; use fuchsia_async as fasync; use fuchsia_component::client::connect_to_service; use fuchsia_zircon as zx; use glob::glob; use log::{info, Level, Log, Metadata, Record, SetLoggerError}; use netfilter::FidlReturn as FilterFidlReturn; use prettytable::{cell, format, row, Table}; use std::fs::File; use std::os::unix::io::AsRawFd; use std::str::FromStr; mod opts; use crate::opts::*; macro_rules! filter_fidl { ($method:expr, $context:expr) => { $method.await.transform_result().context($context) }; } /// Logger which prints levels at or below info to stdout and levels at or /// above warn to stderr. struct Logger; const LOG_LEVEL: Level = Level::Info; impl Log for Logger { fn enabled(&self, metadata: &Metadata) -> bool { metadata.level() <= LOG_LEVEL } fn log(&self, record: &Record) { if self.enabled(record.metadata()) { match record.metadata().level() { Level::Trace | Level::Debug | Level::Info => println!("{}", record.args()), Level::Warn | Level::Error => eprintln!("{}", record.args()), } } } fn flush(&self) {} } static LOGGER: Logger = Logger; fn logger_init() -> Result<(), SetLoggerError> { log::set_logger(&LOGGER).map(|()| log::set_max_level(LOG_LEVEL.to_level_filter())) } #[fasync::run_singlethreaded] async fn main() -> Result<(), Error> { let () = logger_init()?; let command: Command = argh::from_env(); let stack = connect_to_service::<StackMarker>().context("failed to connect to netstack")?; let netstack = connect_to_service::<NetstackMarker>().context("failed to connect to netstack")?; let filter = connect_to_service::<FilterMarker>().context("failed to connect to netfilter")?; let log = connect_to_service::<LogMarker>().context("failed to connect to netstack log")?; match command.cmd { CommandEnum::If(cmd) => do_if(cmd.if_cmd, &stack).await, CommandEnum::Fwd(cmd) => do_fwd(cmd.fwd_cmd, stack).await, CommandEnum::Route(cmd) => do_route(cmd.route_cmd, netstack).await, CommandEnum::Filter(cmd) => do_filter(cmd.filter_cmd, filter).await, CommandEnum::Log(cmd) => do_log(cmd.log_cmd, log).await, CommandEnum::Stat(cmd) => do_stat(cmd.stat_cmd).await, } } fn shortlist_interfaces(name_pattern: &str, interfaces: &mut Vec<InterfaceInfo>) { interfaces.retain(|i| i.properties.name.contains(name_pattern)) } async fn tabulate_interfaces_info(interfaces: Vec<InterfaceInfo>) -> Result<String, Error> { let mut t = Table::new(); t.set_format(format::FormatBuilder::new().padding(2, 2).build()); for (i, info) in interfaces.into_iter().enumerate() { if i > 0 { t.add_row(row![]); } let pretty::InterfaceInfo { id, properties: pretty::InterfaceProperties { name, topopath, filepath, mac, mtu, features, administrative_status, physical_status, addresses, }, } = info.into(); t.add_row(row!["nicid", id]); t.add_row(row!["name", name]); t.add_row(row!["topopath", topopath]); t.add_row(row!["filepath", filepath]); if let Some(mac) = mac { t.add_row(row!["mac", mac]); } else { t.add_row(row!["mac", "-"]); } t.add_row(row!["mtu", mtu]); t.add_row(row!["features", format!("{:?}", features)]); t.add_row(row!["status", format!("{} | {}", administrative_status, physical_status)]); for addr in addresses { t.add_row(row!["addr", addr]); } } Ok(t.to_string()) } async fn do_if(cmd: opts::IfEnum, stack: &StackProxy) -> Result<(), Error> { match cmd { IfEnum::List(IfList { name_pattern }) => { let mut response = stack.list_interfaces().await.context("error getting response")?; if let Some(name_pattern) = name_pattern { let () = shortlist_interfaces(&name_pattern, &mut response); } let result = tabulate_interfaces_info(response) .await .context("error tabulating interface info")?; println!("{}", result); } IfEnum::Add(IfAdd { path }) => { let dev = File::open(&path).context("failed to open device")?; let topological_path = fdio::device_get_topo_path(&dev).context("failed to get topological path")?; let fd = dev.as_raw_fd(); let mut client = 0; zx::Status::ok(unsafe { fdio::fdio_sys::fdio_get_service_handle(fd, &mut client) }) .context("failed to get fdio service handle")?; let dev = fidl::endpoints::ClientEnd::<zx_eth::DeviceMarker>::new( // Safe because we checked the return status above. zx::Channel::from(unsafe { zx::Handle::from_raw(client) }), ); let id = stack_fidl!( stack.add_ethernet_interface(&topological_path, dev), "error adding interface" )?; info!("Added interface {}", id); } IfEnum::Del(IfDel { id }) => { let () = stack_fidl!(stack.del_ethernet_interface(id), "error removing interface")?; info!("Deleted interface {}", id); } IfEnum::Get(IfGet { id }) => { let info = stack_fidl!(stack.get_interface_info(id), "error getting interface")?; println!("{}", pretty::InterfaceInfo::from(info)); } IfEnum::Enable(IfEnable { id }) => { let () = stack_fidl!(stack.enable_interface(id), "error enabling interface")?; info!("Interface {} enabled", id); } IfEnum::Disable(IfDisable { id }) => { let () = stack_fidl!(stack.disable_interface(id), "error disabling interface")?; info!("Interface {} disabled", id); } IfEnum::Addr(IfAddr { addr_cmd }) => match addr_cmd { IfAddrEnum::Add(IfAddrAdd { id, addr, prefix }) => { let parsed_addr = net_ext::IpAddress::from_str(&addr)?.into(); let mut fidl_addr = netstack::InterfaceAddress { ip_address: parsed_addr, prefix_len: prefix }; let () = stack_fidl!( stack.add_interface_address(id, &mut fidl_addr), "error adding interface address" )?; info!( "Address {} added to interface {}", pretty::InterfaceAddress::from(fidl_addr), id ); } IfAddrEnum::Del(IfAddrDel { id, addr, prefix }) => { let parsed_addr = net_ext::IpAddress::from_str(&addr)?.into(); let prefix_len = prefix.unwrap_or_else(|| match parsed_addr { net::IpAddress::Ipv4(_) => 32, net::IpAddress::Ipv6(_) => 128, }); let mut fidl_addr = netstack::InterfaceAddress { ip_address: parsed_addr, prefix_len }; let () = stack_fidl!( stack.del_interface_address(id, &mut fidl_addr), "error deleting interface address" )?; info!( "Address {} deleted from interface {}", pretty::InterfaceAddress::from(fidl_addr), id ); } }, } Ok(()) } async fn do_fwd(cmd: opts::FwdEnum, stack: StackProxy) -> Result<(), Error> { match cmd { FwdEnum::List(_) => { let response = stack.get_forwarding_table().await.context("error retrieving forwarding table")?; for entry in response { println!("{}", pretty::ForwardingEntry::from(entry)); } } FwdEnum::AddDevice(FwdAddDevice { id, addr, prefix }) => { let mut entry = netstack::ForwardingEntry { subnet: net::Subnet { addr: net_ext::IpAddress::from_str(&addr)?.into(), prefix_len: prefix, }, destination: netstack::ForwardingDestination::DeviceId(id), }; let () = stack_fidl!( stack.add_forwarding_entry(&mut entry), "error adding device forwarding entry" )?; info!("Added forwarding entry for {}/{} to device {}", addr, prefix, id); } FwdEnum::AddHop(FwdAddHop { next_hop, addr, prefix }) => { let mut entry = netstack::ForwardingEntry { subnet: net::Subnet { addr: net_ext::IpAddress::from_str(&addr)?.into(), prefix_len: prefix, }, destination: netstack::ForwardingDestination::NextHop( net_ext::IpAddress::from_str(&next_hop)?.into(), ), }; let () = stack_fidl!( stack.add_forwarding_entry(&mut entry), "error adding next-hop forwarding entry" )?; info!("Added forwarding entry for {}/{} to {}", addr, prefix, next_hop); } FwdEnum::Del(FwdDel { addr, prefix }) => { let mut entry = net::Subnet { addr: net_ext::IpAddress::from_str(&addr)?.into(), prefix_len: prefix, }; let () = stack_fidl!( stack.del_forwarding_entry(&mut entry), "error removing forwarding entry" )?; info!("Removed forwarding entry for {}/{}", addr, prefix); } } Ok(()) } async fn do_route(cmd: opts::RouteEnum, netstack: NetstackProxy) -> Result<(), Error> { match cmd { RouteEnum::List(_) => { let response = netstack.get_route_table2().await.context("error retrieving routing table")?; let mut t = Table::new(); t.set_format(format::FormatBuilder::new().padding(2, 2).build()); t.set_titles(row!["Destination", "Netmask", "Gateway", "NICID", "Metric"]); for entry in response { let route = fidl_fuchsia_netstack_ext::RouteTableEntry2::from(entry); let gateway_str = match route.gateway { None => "-".to_string(), Some(g) => format!("{}", g), }; t.add_row(row![ route.destination, route.netmask, gateway_str, route.nicid, route.metric ]); } t.printstd(); println!(); } } Ok(()) } async fn do_filter(cmd: opts::FilterEnum, filter: FilterProxy) -> Result<(), Error> { match cmd { FilterEnum::Enable(_) => { let () = filter_fidl!(filter.enable(true), "error enabling filter")?; info!("successfully enabled filter"); } FilterEnum::Disable(_) => { let () = filter_fidl!(filter.enable(false), "error disabling filter")?; info!("successfully disabled filter"); } FilterEnum::IsEnabled(_) => { let is_enabled = filter.is_enabled().await.context("FIDL error")?; println!("{:?}", is_enabled); } FilterEnum::GetRules(_) => { let (rules, generation) = filter_fidl!(filter.get_rules(), "error getting filter rules")?; println!("{:?} (generation {})", rules, generation); } FilterEnum::SetRules(FilterSetRules { rules }) => { let (_cur_rules, generation) = filter_fidl!(filter.get_rules(), "error getting filter rules")?; let mut rules = netfilter::parser::parse_str_to_rules(&rules)?; let () = filter_fidl!( filter.update_rules(&mut rules.iter_mut(), generation), "error setting filter rules" )?; info!("successfully set filter rules"); } FilterEnum::GetNatRules(_) => { let (rules, generation) = filter_fidl!(filter.get_nat_rules(), "error getting NAT rules")?; println!("{:?} (generation {})", rules, generation); } FilterEnum::SetNatRules(FilterSetNatRules { rules }) => { let (_cur_rules, generation) = filter_fidl!(filter.get_nat_rules(), "error getting NAT rules")?; let mut rules = netfilter::parser::parse_str_to_nat_rules(&rules)?; let () = filter_fidl!( filter.update_nat_rules(&mut rules.iter_mut(), generation), "error setting NAT rules" )?; info!("successfully set NAT rules"); } FilterEnum::GetRdrRules(_) => { let (rules, generation) = filter_fidl!(filter.get_rdr_rules(), "error getting RDR rules")?; println!("{:?} (generation {})", rules, generation); } FilterEnum::SetRdrRules(FilterSetRdrRules { rules }) => { let (_cur_rules, generation) = filter_fidl!(filter.get_rdr_rules(), "error getting RDR rules")?; let mut rules = netfilter::parser::parse_str_to_rdr_rules(&rules)?; let () = filter_fidl!( filter.update_rdr_rules(&mut rules.iter_mut(), generation), "error setting RDR rules" )?; info!("successfully set RDR rules"); } } Ok(()) } async fn do_log(cmd: opts::LogEnum, log: LogProxy) -> Result<(), Error> { match cmd { LogEnum::SetLevel(LogSetLevel { log_level }) => { let () = stack_fidl!(log.set_log_level(log_level.into()), "error setting log level")?; info!("log level set to {:?}", log_level); } } Ok(()) } async fn do_stat(cmd: opts::StatEnum) -> Result<(), Error> { match cmd { StatEnum::Show(_) => { let mut entries = Vec::new(); let globs = [ "/hub", // accessed in "sys" realm "/hub/r/sys/*", // accessed in "app" realm ] .iter() .map(|prefix| { format!( "{}/c/netstack.cmx/*/out/objects/counters/{}", prefix, <inspect::InspectMarker as fidl::endpoints::ServiceMarker>::NAME ) }) .collect::<Vec<_>>(); globs.iter().try_for_each(|pattern| { Ok::<_, glob::PatternError>(entries.extend(glob(pattern)?)) })?; if entries.is_empty() { let () = Err(format_err!("failed to find netstack counters in {:?}", globs))?; } let multiple = entries.len() > 1; for (i, entry) in entries.into_iter().enumerate() { let path = entry?; if multiple { if i > 0 { println!(); } // Show the stats path for distinction. println!("Stats from {}", path.display()); } let object = cs::inspect::generate_inspect_object_tree(&path, &vec![])?; let mut t = Table::new(); t.set_format(format::FormatBuilder::new().padding(2, 2).build()); t.set_titles(row!["Packet Count", "Classification"]); let () = visit_inspect_object(&mut t, "", &object); t.printstd(); } } } Ok(()) } fn visit_inspect_object(t: &mut Table, prefix: &str, inspect_object: &cs::inspect::InspectObject) { for metric in &inspect_object.inspect_object.metrics { t.add_row(row![ r->match metric.value { inspect::MetricValue::IntValue(v) => v.to_string(), inspect::MetricValue::UintValue(v) => v.to_string(), inspect::MetricValue::DoubleValue(v) => v.to_string(), }, format!("{}{}", prefix, metric.key), ]); } for child in &inspect_object.child_inspect_objects { let prefix = format!("{}{}/", prefix, child.inspect_object.name); visit_inspect_object(t, &prefix, child); } } #[cfg(test)] mod tests { use fidl_fuchsia_net as net; use fuchsia_async as fasync; use futures::prelude::*; use {super::*, fidl_fuchsia_net_stack::*}; fn get_fake_interface(id: u64, name: &str) -> InterfaceInfo { InterfaceInfo { id: id, properties: InterfaceProperties { name: name.to_string(), topopath: "loopback".to_string(), filepath: "[none]".to_string(), mac: None, mtu: 65536, features: 4, administrative_status: AdministrativeStatus::Enabled, physical_status: PhysicalStatus::Up, addresses: vec![], }, } } fn get_fake_interfaces() -> Vec<InterfaceInfo> { vec![ get_fake_interface(1, "lo"), get_fake_interface(10, "eth001"), get_fake_interface(20, "eth002"), get_fake_interface(30, "eth003"), get_fake_interface(100, "wlan001"), get_fake_interface(200, "wlan002"), get_fake_interface(300, "wlan003"), ] } fn shortlist_interfaces_by_nicid(name_pattern: &str) -> Vec<u64> { let mut interfaces = get_fake_interfaces(); let () = shortlist_interfaces(name_pattern, &mut interfaces); interfaces.into_iter().map(|i| i.id).collect() } #[test] fn test_shortlist_interfaces() { assert_eq!(vec![1, 10, 20, 30, 100, 200, 300], shortlist_interfaces_by_nicid("")); assert_eq!(vec![0_u64; 0], shortlist_interfaces_by_nicid("no such thing")); assert_eq!(vec![1], shortlist_interfaces_by_nicid("lo")); assert_eq!(vec![10, 20, 30], shortlist_interfaces_by_nicid("eth")); assert_eq!(vec![10, 20, 30], shortlist_interfaces_by_nicid("th")); assert_eq!(vec![100, 200, 300], shortlist_interfaces_by_nicid("wlan")); assert_eq!(vec![10, 100], shortlist_interfaces_by_nicid("001")); } #[fasync::run_singlethreaded(test)] async fn test_if_del_addr() { async fn next_request( requests: &mut StackRequestStream, ) -> (u64, InterfaceAddress, StackDelInterfaceAddressResponder) { requests .try_next() .await .expect("del interface address FIDL error") .expect("request stream should not have ended") .into_del_interface_address() .expect("request should be of type DelInterfaceAddress") } let (stack, mut requests) = fidl::endpoints::create_proxy_and_stream::<StackMarker>().unwrap(); fasync::spawn_local(async move { // Verify that the first request is as expected and return OK. let (id, addr, responder) = next_request(&mut requests).await; assert_eq!(id, 1); assert_eq!( addr, InterfaceAddress { ip_address: net::IpAddress::Ipv4(net::Ipv4Address { addr: [192, 168, 0, 1] }), prefix_len: 32 } ); responder.send(&mut Ok(())).unwrap(); // Verify that the second request is as expected and return a NotFound error. let (id, addr, responder) = next_request(&mut requests).await; assert_eq!(id, 2); assert_eq!( addr, InterfaceAddress { ip_address: net::IpAddress::Ipv6(net::Ipv6Address { addr: [0xfd, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] }), prefix_len: 128 } ); responder.send(&mut Err(fidl_fuchsia_net_stack::Error::NotFound)).unwrap(); }); // Make the first request. let () = do_if( IfEnum::Addr(IfAddr { addr_cmd: IfAddrEnum::Del(IfAddrDel { id: 1, addr: String::from("192.168.0.1"), prefix: None, // The prefix should be set to the default of 32 for IPv4. }), }), &stack, ) .await .expect("net-cli do_if del address should succeed"); // Make the second request. do_if( IfEnum::Addr(IfAddr { addr_cmd: IfAddrEnum::Del(IfAddrDel { id: 2, addr: String::from("fd00::1"), prefix: None, // The prefix should be set to the default of 128 for IPv6. }), }), &stack, ) .await .expect_err("net-cli do_if del address should have failed"); } }
use std::env; // scenes - these effectively act as separate games pub mod awaiting_opponent; pub mod pong; // pong game logic, ui, and rollback networking pub mod title_screen; // title screen buttons and scene switching logic // screen that polls the server waiting for an opponent to join // utility functions - these are more like libraries pub mod imui; pub mod scene; // scene API and scene struct/trait // immediate mode ui use scene::*; fn main() { let window_width = pong::GAME_CONFIG.arena_size.x as i32; let (mut rl, thread) = raylib::init() .size(window_width, pong::GAME_CONFIG.arena_size.y as i32) .title("Rust Pong") .build(); // easier development forcing the window to go to the right or the left let args: Vec<String> = env::args().collect(); if args.len() > 1 { if args[1] == "left" { rl.set_window_position(0, rl.get_window_position().y as i32); } else if args[1] == "right" { rl.set_window_position( rl.get_screen_width(), // - window_width, rl.get_window_position().y as i32, ); } else { println!("unknown argument {}", args[1]); } } rl.set_target_fps(60); let mut cur_scene: Box<dyn Scene> = Box::new(title_screen::TitleScreen::new()); let mut scene_api = SceneAPI { new_scene: None }; while !rl.window_should_close() { cur_scene.process(&mut scene_api, &mut rl); let mut d = rl.begin_drawing(&thread); cur_scene.draw(&mut scene_api, &mut d); if cur_scene.should_quit() { break; } if scene_api.new_scene.is_some() { cur_scene = scene_api.new_scene.unwrap(); scene_api.new_scene = None; } } }
#[macro_use] extern crate serde_derive; extern crate serde; use fxoanda_serdes::*; use chrono::prelude::*; use std::str::FromStr; #[derive(Debug, Serialize, Deserialize)] pub struct TradeClientExtensionsModifyRejectTransaction { /// The ID of the Trade who's client extensions are to be modified. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// The original Client ID of the Trade who's client extensions are to be /// modified. #[serde(default)] #[serde(rename = "clientTradeID", skip_serializing_if = "Option::is_none")] pub client_trade_id: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Reject Transaction was created #[serde(default)] #[serde(rename = "rejectReason", skip_serializing_if = "Option::is_none")] pub reject_reason: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensionsModify", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions_modify: Option<ClientExtensions>, /// The Type of the Transaction. Always set to /// "TRADE_CLIENT_EXTENSIONS_MODIFY_REJECT" for a /// TradeClientExtensionsModifyRejectTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl TradeClientExtensionsModifyRejectTransaction { pub fn new() -> TradeClientExtensionsModifyRejectTransaction { TradeClientExtensionsModifyRejectTransaction { trade_id: None, client_trade_id: None, user_id: None, batch_id: None, reject_reason: None, request_id: None, time: None, trade_client_extensions_modify: None, otype: None, id: None, account_id: None, } } /// The ID of the Trade who's client extensions are to be modified. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TradeClientExtensionsModifyRejectTransaction pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// The original Client ID of the Trade who's client extensions are to be /// modified. /// - param String /// - return TradeClientExtensionsModifyRejectTransaction pub fn with_client_trade_id(mut self, x: String) -> Self { self.client_trade_id = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return TradeClientExtensionsModifyRejectTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TradeClientExtensionsModifyRejectTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Reject Transaction was created /// - param String /// - return TradeClientExtensionsModifyRejectTransaction pub fn with_reject_reason(mut self, x: String) -> Self { self.reject_reason = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return TradeClientExtensionsModifyRejectTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TradeClientExtensionsModifyRejectTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return TradeClientExtensionsModifyRejectTransaction pub fn with_trade_client_extensions_modify(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions_modify = Some(x); self } /// The Type of the Transaction. Always set to /// "TRADE_CLIENT_EXTENSIONS_MODIFY_REJECT" for a /// TradeClientExtensionsModifyRejectTransaction. /// - param String /// - return TradeClientExtensionsModifyRejectTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TradeClientExtensionsModifyRejectTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return TradeClientExtensionsModifyRejectTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct MarketIfTouchedOrder { /// Date/time when the Order was filled (only provided when the Order's /// state is FILLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "filledTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub filled_time: Option<DateTime<Utc>>, /// The time-in-force requested for the MarketIfTouched Order. Restricted /// to "GTC", "GFD" and "GTD" for MarketIfTouched Orders. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The Market price at the time when the MarketIfTouched Order was /// created. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "initialMarketPrice", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub initial_market_price: Option<f32>, /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, /// The worst market price that may be used to fill this MarketIfTouched /// Order. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "priceBound", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price_bound: Option<f32>, /// The MarketIfTouched Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The current state of the Order. #[serde(default)] #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option<String>, /// The quantity requested to be filled by the MarketIfTouched Order. A /// posititive number of units results in a long Order, and a negative /// number of units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// The type of the Order. Always set to "MARKET_IF_TOUCHED" for Market If /// Touched Orders. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// The price threshold specified for the MarketIfTouched Order. The /// MarketIfTouched Order will only be filled by a market price that /// crosses this price from the direction of the market price at the time /// when the Order was created (the initialMarketPrice). Depending on the /// value of the Order's price and initialMarketPrice, the /// MarketIfTouchedOrder will behave like a Limit or a Stop Order. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// Trade ID of Trade opened when the Order was filled (only provided when /// the Order's state is FILLED and a Trade was opened as a result of the /// fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeOpenedID", skip_serializing_if = "Option::is_none")] pub trade_opened_id: Option<String>, /// Trade ID of Trade reduced when the Order was filled (only provided /// when the Order's state is FILLED and a Trade was reduced as a result /// of the fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeReducedID", skip_serializing_if = "Option::is_none")] pub trade_reduced_id: Option<String>, /// Date/time when the Order was cancelled (only provided when the state /// of the Order is CANCELLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "cancelledTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub cancelled_time: Option<DateTime<Utc>>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// ID of the Transaction that filled this Order (only provided when the /// Order's state is FILLED) /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "fillingTransactionID", skip_serializing_if = "Option::is_none" )] pub filling_transaction_id: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "createTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub create_time: Option<DateTime<Utc>>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Order that was replaced by this Order (only provided if /// this Order was created as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacesOrderID", skip_serializing_if = "Option::is_none")] pub replaces_order_id: Option<String>, /// Trade IDs of Trades closed when the Order was filled (only provided /// when the Order's state is FILLED and one or more Trades were closed as /// a result of the fill) #[serde(default)] #[serde(rename = "tradeClosedIDs", skip_serializing_if = "Option::is_none")] pub trade_closed_i_ds: Option<Vec<String>>, /// The ID of the Order that replaced this Order (only provided if this /// Order was cancelled as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacedByOrderID", skip_serializing_if = "Option::is_none")] pub replaced_by_order_id: Option<String>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// ID of the Transaction that cancelled the Order (only provided when the /// Order's state is CANCELLED) /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "cancellingTransactionID", skip_serializing_if = "Option::is_none" )] pub cancelling_transaction_id: Option<String>, /// The date/time when the MarketIfTouched Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, } impl MarketIfTouchedOrder { pub fn new() -> MarketIfTouchedOrder { MarketIfTouchedOrder { filled_time: None, time_in_force: None, initial_market_price: None, id: None, position_fill: None, price_bound: None, instrument: None, state: None, units: None, otype: None, stop_loss_on_fill: None, price: None, trade_opened_id: None, trade_reduced_id: None, cancelled_time: None, trailing_stop_loss_on_fill: None, filling_transaction_id: None, client_extensions: None, create_time: None, trigger_condition: None, replaces_order_id: None, trade_closed_i_ds: None, replaced_by_order_id: None, take_profit_on_fill: None, trade_client_extensions: None, cancelling_transaction_id: None, gtd_time: None, } } /// Date/time when the Order was filled (only provided when the Order's /// state is FILLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarketIfTouchedOrder pub fn with_filled_time(mut self, x: DateTime<Utc>) -> Self { self.filled_time = Some(x); self } /// The time-in-force requested for the MarketIfTouched Order. Restricted /// to "GTC", "GFD" and "GTD" for MarketIfTouched Orders. /// - param String /// - return MarketIfTouchedOrder pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The Market price at the time when the MarketIfTouched Order was /// created. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return MarketIfTouchedOrder pub fn with_initial_market_price(mut self, x: f32) -> Self { self.initial_market_price = Some(x); self } /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return MarketIfTouchedOrder pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return MarketIfTouchedOrder pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } /// The worst market price that may be used to fill this MarketIfTouched /// Order. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return MarketIfTouchedOrder pub fn with_price_bound(mut self, x: f32) -> Self { self.price_bound = Some(x); self } /// The MarketIfTouched Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return MarketIfTouchedOrder pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The current state of the Order. /// - param String /// - return MarketIfTouchedOrder pub fn with_state(mut self, x: String) -> Self { self.state = Some(x); self } /// The quantity requested to be filled by the MarketIfTouched Order. A /// posititive number of units results in a long Order, and a negative /// number of units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return MarketIfTouchedOrder pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// The type of the Order. Always set to "MARKET_IF_TOUCHED" for Market If /// Touched Orders. /// - param String /// - return MarketIfTouchedOrder pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return MarketIfTouchedOrder pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// The price threshold specified for the MarketIfTouched Order. The /// MarketIfTouched Order will only be filled by a market price that /// crosses this price from the direction of the market price at the time /// when the Order was created (the initialMarketPrice). Depending on the /// value of the Order's price and initialMarketPrice, the /// MarketIfTouchedOrder will behave like a Limit or a Stop Order. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return MarketIfTouchedOrder pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// Trade ID of Trade opened when the Order was filled (only provided when /// the Order's state is FILLED and a Trade was opened as a result of the /// fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return MarketIfTouchedOrder pub fn with_trade_opened_id(mut self, x: String) -> Self { self.trade_opened_id = Some(x); self } /// Trade ID of Trade reduced when the Order was filled (only provided /// when the Order's state is FILLED and a Trade was reduced as a result /// of the fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return MarketIfTouchedOrder pub fn with_trade_reduced_id(mut self, x: String) -> Self { self.trade_reduced_id = Some(x); self } /// Date/time when the Order was cancelled (only provided when the state /// of the Order is CANCELLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarketIfTouchedOrder pub fn with_cancelled_time(mut self, x: DateTime<Utc>) -> Self { self.cancelled_time = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return MarketIfTouchedOrder pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// ID of the Transaction that filled this Order (only provided when the /// Order's state is FILLED) /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarketIfTouchedOrder pub fn with_filling_transaction_id(mut self, x: String) -> Self { self.filling_transaction_id = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return MarketIfTouchedOrder pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarketIfTouchedOrder pub fn with_create_time(mut self, x: DateTime<Utc>) -> Self { self.create_time = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return MarketIfTouchedOrder pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Order that was replaced by this Order (only provided if /// this Order was created as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return MarketIfTouchedOrder pub fn with_replaces_order_id(mut self, x: String) -> Self { self.replaces_order_id = Some(x); self } /// Trade IDs of Trades closed when the Order was filled (only provided /// when the Order's state is FILLED and one or more Trades were closed as /// a result of the fill) /// - param Vec<String> /// - return MarketIfTouchedOrder pub fn with_trade_closed_i_ds(mut self, x: Vec<String>) -> Self { self.trade_closed_i_ds = Some(x); self } /// The ID of the Order that replaced this Order (only provided if this /// Order was cancelled as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return MarketIfTouchedOrder pub fn with_replaced_by_order_id(mut self, x: String) -> Self { self.replaced_by_order_id = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return MarketIfTouchedOrder pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return MarketIfTouchedOrder pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// ID of the Transaction that cancelled the Order (only provided when the /// Order's state is CANCELLED) /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarketIfTouchedOrder pub fn with_cancelling_transaction_id(mut self, x: String) -> Self { self.cancelling_transaction_id = Some(x); self } /// The date/time when the MarketIfTouched Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarketIfTouchedOrder pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct TradeClientExtensionsModifyTransaction { /// The ID of the Trade who's client extensions are to be modified. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// The original Client ID of the Trade who's client extensions are to be /// modified. #[serde(default)] #[serde(rename = "clientTradeID", skip_serializing_if = "Option::is_none")] pub client_trade_id: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensionsModify", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions_modify: Option<ClientExtensions>, /// The Type of the Transaction. Always set to /// "TRADE_CLIENT_EXTENSIONS_MODIFY" for a /// TradeClientExtensionsModifyTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl TradeClientExtensionsModifyTransaction { pub fn new() -> TradeClientExtensionsModifyTransaction { TradeClientExtensionsModifyTransaction { trade_id: None, client_trade_id: None, user_id: None, batch_id: None, request_id: None, time: None, trade_client_extensions_modify: None, otype: None, id: None, account_id: None, } } /// The ID of the Trade who's client extensions are to be modified. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TradeClientExtensionsModifyTransaction pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// The original Client ID of the Trade who's client extensions are to be /// modified. /// - param String /// - return TradeClientExtensionsModifyTransaction pub fn with_client_trade_id(mut self, x: String) -> Self { self.client_trade_id = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return TradeClientExtensionsModifyTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TradeClientExtensionsModifyTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return TradeClientExtensionsModifyTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TradeClientExtensionsModifyTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return TradeClientExtensionsModifyTransaction pub fn with_trade_client_extensions_modify(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions_modify = Some(x); self } /// The Type of the Transaction. Always set to /// "TRADE_CLIENT_EXTENSIONS_MODIFY" for a /// TradeClientExtensionsModifyTransaction. /// - param String /// - return TradeClientExtensionsModifyTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TradeClientExtensionsModifyTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return TradeClientExtensionsModifyTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct FixedPriceOrder { /// Date/time when the Order was filled (only provided when the Order's /// state is FILLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "filledTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub filled_time: Option<DateTime<Utc>>, /// The state that the trade resulting from the Fixed Price Order should /// be set to. #[serde(default)] #[serde(rename = "tradeState", skip_serializing_if = "Option::is_none")] pub trade_state: Option<String>, /// Trade ID of Trade reduced when the Order was filled (only provided /// when the Order's state is FILLED and a Trade was reduced as a result /// of the fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeReducedID", skip_serializing_if = "Option::is_none")] pub trade_reduced_id: Option<String>, /// ID of the Transaction that filled this Order (only provided when the /// Order's state is FILLED) /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "fillingTransactionID", skip_serializing_if = "Option::is_none" )] pub filling_transaction_id: Option<String>, /// Date/time when the Order was cancelled (only provided when the state /// of the Order is CANCELLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "cancelledTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub cancelled_time: Option<DateTime<Utc>>, /// The price specified for the Fixed Price Order. This price is the exact /// price that the Fixed Price Order will be filled at. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// Trade IDs of Trades closed when the Order was filled (only provided /// when the Order's state is FILLED and one or more Trades were closed as /// a result of the fill) #[serde(default)] #[serde(rename = "tradeClosedIDs", skip_serializing_if = "Option::is_none")] pub trade_closed_i_ds: Option<Vec<String>>, /// Trade ID of Trade opened when the Order was filled (only provided when /// the Order's state is FILLED and a Trade was opened as a result of the /// fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeOpenedID", skip_serializing_if = "Option::is_none")] pub trade_opened_id: Option<String>, /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "createTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub create_time: Option<DateTime<Utc>>, /// The Fixed Price Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The current state of the Order. #[serde(default)] #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// The quantity requested to be filled by the Fixed Price Order. A /// posititive number of units results in a long Order, and a negative /// number of units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// ID of the Transaction that cancelled the Order (only provided when the /// Order's state is CANCELLED) /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "cancellingTransactionID", skip_serializing_if = "Option::is_none" )] pub cancelling_transaction_id: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The type of the Order. Always set to "FIXED_PRICE" for Fixed Price /// Orders. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, } impl FixedPriceOrder { pub fn new() -> FixedPriceOrder { FixedPriceOrder { filled_time: None, trade_state: None, trade_reduced_id: None, filling_transaction_id: None, cancelled_time: None, price: None, stop_loss_on_fill: None, trade_closed_i_ds: None, trade_opened_id: None, create_time: None, instrument: None, state: None, position_fill: None, trade_client_extensions: None, trailing_stop_loss_on_fill: None, units: None, cancelling_transaction_id: None, client_extensions: None, otype: None, id: None, take_profit_on_fill: None, } } /// Date/time when the Order was filled (only provided when the Order's /// state is FILLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return FixedPriceOrder pub fn with_filled_time(mut self, x: DateTime<Utc>) -> Self { self.filled_time = Some(x); self } /// The state that the trade resulting from the Fixed Price Order should /// be set to. /// - param String /// - return FixedPriceOrder pub fn with_trade_state(mut self, x: String) -> Self { self.trade_state = Some(x); self } /// Trade ID of Trade reduced when the Order was filled (only provided /// when the Order's state is FILLED and a Trade was reduced as a result /// of the fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return FixedPriceOrder pub fn with_trade_reduced_id(mut self, x: String) -> Self { self.trade_reduced_id = Some(x); self } /// ID of the Transaction that filled this Order (only provided when the /// Order's state is FILLED) /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return FixedPriceOrder pub fn with_filling_transaction_id(mut self, x: String) -> Self { self.filling_transaction_id = Some(x); self } /// Date/time when the Order was cancelled (only provided when the state /// of the Order is CANCELLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return FixedPriceOrder pub fn with_cancelled_time(mut self, x: DateTime<Utc>) -> Self { self.cancelled_time = Some(x); self } /// The price specified for the Fixed Price Order. This price is the exact /// price that the Fixed Price Order will be filled at. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return FixedPriceOrder pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return FixedPriceOrder pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// Trade IDs of Trades closed when the Order was filled (only provided /// when the Order's state is FILLED and one or more Trades were closed as /// a result of the fill) /// - param Vec<String> /// - return FixedPriceOrder pub fn with_trade_closed_i_ds(mut self, x: Vec<String>) -> Self { self.trade_closed_i_ds = Some(x); self } /// Trade ID of Trade opened when the Order was filled (only provided when /// the Order's state is FILLED and a Trade was opened as a result of the /// fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return FixedPriceOrder pub fn with_trade_opened_id(mut self, x: String) -> Self { self.trade_opened_id = Some(x); self } /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return FixedPriceOrder pub fn with_create_time(mut self, x: DateTime<Utc>) -> Self { self.create_time = Some(x); self } /// The Fixed Price Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return FixedPriceOrder pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The current state of the Order. /// - param String /// - return FixedPriceOrder pub fn with_state(mut self, x: String) -> Self { self.state = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return FixedPriceOrder pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return FixedPriceOrder pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return FixedPriceOrder pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// The quantity requested to be filled by the Fixed Price Order. A /// posititive number of units results in a long Order, and a negative /// number of units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return FixedPriceOrder pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// ID of the Transaction that cancelled the Order (only provided when the /// Order's state is CANCELLED) /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return FixedPriceOrder pub fn with_cancelling_transaction_id(mut self, x: String) -> Self { self.cancelling_transaction_id = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return FixedPriceOrder pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The type of the Order. Always set to "FIXED_PRICE" for Fixed Price /// Orders. /// - param String /// - return FixedPriceOrder pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return FixedPriceOrder pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return FixedPriceOrder pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct DelayedTradeClosureTransaction { /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason for the delayed trade closure #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// List of Trade ID's identifying the open trades that will be closed /// when their respective instruments become tradeable /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeIDs", skip_serializing_if = "Option::is_none")] pub trade_i_ds: Option<String>, /// The Type of the Transaction. Always set to "DELAYED_TRADE_CLOSURE" for /// an DelayedTradeClosureTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl DelayedTradeClosureTransaction { pub fn new() -> DelayedTradeClosureTransaction { DelayedTradeClosureTransaction { user_id: None, batch_id: None, reason: None, request_id: None, time: None, trade_i_ds: None, otype: None, id: None, account_id: None, } } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return DelayedTradeClosureTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return DelayedTradeClosureTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason for the delayed trade closure /// - param String /// - return DelayedTradeClosureTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return DelayedTradeClosureTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return DelayedTradeClosureTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// List of Trade ID's identifying the open trades that will be closed /// when their respective instruments become tradeable /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return DelayedTradeClosureTransaction pub fn with_trade_i_ds(mut self, x: String) -> Self { self.trade_i_ds = Some(x); self } /// The Type of the Transaction. Always set to "DELAYED_TRADE_CLOSURE" for /// an DelayedTradeClosureTransaction. /// - param String /// - return DelayedTradeClosureTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return DelayedTradeClosureTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return DelayedTradeClosureTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct LimitOrderRejectTransaction { /// The time-in-force requested for the Limit Order. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The Limit Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The quantity requested to be filled by the Limit Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// The Type of the Transaction. Always set to "LIMIT_ORDER_REJECT" in a /// LimitOrderRejectTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, /// The price threshold specified for the Limit Order. The Limit Order /// will only be filled by a market price that is equal to or better than /// this price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Limit Order was initiated #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Order that this Order was intended to replace (only /// provided if this Order was intended to replace an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde( rename = "intendedReplacesOrderID", skip_serializing_if = "Option::is_none" )] pub intended_replaces_order_id: Option<String>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// The reason that the Reject Transaction was created #[serde(default)] #[serde(rename = "rejectReason", skip_serializing_if = "Option::is_none")] pub reject_reason: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The date/time when the Limit Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, } impl LimitOrderRejectTransaction { pub fn new() -> LimitOrderRejectTransaction { LimitOrderRejectTransaction { time_in_force: None, request_id: None, id: None, position_fill: None, user_id: None, instrument: None, units: None, otype: None, account_id: None, price: None, stop_loss_on_fill: None, batch_id: None, reason: None, trailing_stop_loss_on_fill: None, client_extensions: None, trigger_condition: None, intended_replaces_order_id: None, take_profit_on_fill: None, reject_reason: None, trade_client_extensions: None, time: None, gtd_time: None, } } /// The time-in-force requested for the Limit Order. /// - param String /// - return LimitOrderRejectTransaction pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return LimitOrderRejectTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return LimitOrderRejectTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return LimitOrderRejectTransaction pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return LimitOrderRejectTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The Limit Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return LimitOrderRejectTransaction pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The quantity requested to be filled by the Limit Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return LimitOrderRejectTransaction pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// The Type of the Transaction. Always set to "LIMIT_ORDER_REJECT" in a /// LimitOrderRejectTransaction. /// - param String /// - return LimitOrderRejectTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return LimitOrderRejectTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } /// The price threshold specified for the Limit Order. The Limit Order /// will only be filled by a market price that is equal to or better than /// this price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return LimitOrderRejectTransaction pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return LimitOrderRejectTransaction pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return LimitOrderRejectTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Limit Order was initiated /// - param String /// - return LimitOrderRejectTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return LimitOrderRejectTransaction pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return LimitOrderRejectTransaction pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return LimitOrderRejectTransaction pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Order that this Order was intended to replace (only /// provided if this Order was intended to replace an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return LimitOrderRejectTransaction pub fn with_intended_replaces_order_id(mut self, x: String) -> Self { self.intended_replaces_order_id = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return LimitOrderRejectTransaction pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// The reason that the Reject Transaction was created /// - param String /// - return LimitOrderRejectTransaction pub fn with_reject_reason(mut self, x: String) -> Self { self.reject_reason = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return LimitOrderRejectTransaction pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return LimitOrderRejectTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The date/time when the Limit Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return LimitOrderRejectTransaction pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } } /// In the context of an Order or a Trade, defines whether the units are /// positive or negative. #[derive(Debug, Serialize, Deserialize)] pub enum Direction { #[serde(rename = "LONG")] Long, #[serde(rename = "SHORT")] Short, } impl FromStr for Direction { type Err = (); fn from_str(s: &str) -> Result<Direction, ()> { match s { "LONG" => Ok(Direction::Long), "SHORT" => Ok(Direction::Short), _ => Err(()), } } } impl std::fmt::Display for Direction { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } /// The day of the week to use for candlestick granularities with weekly /// alignment. #[derive(Debug, Serialize, Deserialize)] pub enum WeeklyAlignment { #[serde(rename = "Monday")] Monday, #[serde(rename = "Tuesday")] Tuesday, #[serde(rename = "Wednesday")] Wednesday, #[serde(rename = "Thursday")] Thursday, #[serde(rename = "Friday")] Friday, #[serde(rename = "Saturday")] Saturday, #[serde(rename = "Sunday")] Sunday, } impl FromStr for WeeklyAlignment { type Err = (); fn from_str(s: &str) -> Result<WeeklyAlignment, ()> { match s { "Monday" => Ok(WeeklyAlignment::Monday), "Tuesday" => Ok(WeeklyAlignment::Tuesday), "Wednesday" => Ok(WeeklyAlignment::Wednesday), "Thursday" => Ok(WeeklyAlignment::Thursday), "Friday" => Ok(WeeklyAlignment::Friday), "Saturday" => Ok(WeeklyAlignment::Saturday), "Sunday" => Ok(WeeklyAlignment::Sunday), _ => Err(()), } } } impl std::fmt::Display for WeeklyAlignment { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct MarketOrderPositionCloseout { /// Indication of how much of the Position to close. Either "ALL", or a /// DecimalNumber reflection a partial close of the Trade. The /// DecimalNumber must always be positive, and represent a number that /// doesn't exceed the absolute size of the Position. #[serde(default)] #[serde(rename = "units", skip_serializing_if = "Option::is_none")] pub units: Option<String>, /// The instrument of the Position being closed out. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, } impl MarketOrderPositionCloseout { pub fn new() -> MarketOrderPositionCloseout { MarketOrderPositionCloseout { units: None, instrument: None, } } /// Indication of how much of the Position to close. Either "ALL", or a /// DecimalNumber reflection a partial close of the Trade. The /// DecimalNumber must always be positive, and represent a number that /// doesn't exceed the absolute size of the Position. /// - param String /// - return MarketOrderPositionCloseout pub fn with_units(mut self, x: String) -> Self { self.units = Some(x); self } /// The instrument of the Position being closed out. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return MarketOrderPositionCloseout pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct TradeSummary { /// ID of the Trade's Stop Loss Order, only provided if such an Order /// exists. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "stopLossOrderID", skip_serializing_if = "Option::is_none")] pub stop_loss_order_id: Option<String>, /// The financing paid/collected for this Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "financing", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub financing: Option<f32>, /// The date/time when the Trade was opened. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "openTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub open_time: Option<DateTime<Utc>>, /// Margin currently used by the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_used: Option<f32>, /// ID of the Trade's Trailing Stop Loss Order, only provided if such an /// Order exists. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde( rename = "trailingStopLossOrderID", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_order_id: Option<String>, /// The execution price of the Trade. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The unrealized profit/loss on the open portion of the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "unrealizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub unrealized_pl: Option<f32>, /// The total profit/loss realized on the closed portion of the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "realizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub realized_pl: Option<f32>, /// The date/time when the Trade was fully closed. Only provided for /// Trades whose state is CLOSED. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "closeTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub close_time: Option<DateTime<Utc>>, /// The Trade's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The current state of the Trade. #[serde(default)] #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option<String>, /// ID of the Trade's Take Profit Order, only provided if such an Order /// exists. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "takeProfitOrderID", skip_serializing_if = "Option::is_none")] pub take_profit_order_id: Option<String>, /// The margin required at the time the Trade was created. Note, this is /// the 'pure' margin required, it is not the 'effective' margin used that /// factors in the trade risk if a GSLO is attached to the trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "initialMarginRequired", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub initial_margin_required: Option<f32>, /// The initial size of the Trade. Negative values indicate a short Trade, /// and positive values indicate a long Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "initialUnits", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub initial_units: Option<f32>, /// The average closing price of the Trade. Only present if the Trade has /// been closed or reduced at least once. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "averageClosePrice", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub average_close_price: Option<f32>, /// The number of units currently open for the Trade. This value is /// reduced to 0.0 as the Trade is closed. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "currentUnits", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub current_units: Option<f32>, /// The IDs of the Transactions that have closed portions of this Trade. #[serde(default)] #[serde( rename = "closingTransactionIDs", skip_serializing_if = "Option::is_none" )] pub closing_transaction_i_ds: Option<Vec<String>>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The Trade's identifier, unique within the Trade's Account. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, } impl TradeSummary { pub fn new() -> TradeSummary { TradeSummary { stop_loss_order_id: None, financing: None, open_time: None, margin_used: None, trailing_stop_loss_order_id: None, price: None, unrealized_pl: None, realized_pl: None, close_time: None, instrument: None, state: None, take_profit_order_id: None, initial_margin_required: None, initial_units: None, average_close_price: None, current_units: None, closing_transaction_i_ds: None, client_extensions: None, id: None, } } /// ID of the Trade's Stop Loss Order, only provided if such an Order /// exists. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return TradeSummary pub fn with_stop_loss_order_id(mut self, x: String) -> Self { self.stop_loss_order_id = Some(x); self } /// The financing paid/collected for this Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return TradeSummary pub fn with_financing(mut self, x: f32) -> Self { self.financing = Some(x); self } /// The date/time when the Trade was opened. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TradeSummary pub fn with_open_time(mut self, x: DateTime<Utc>) -> Self { self.open_time = Some(x); self } /// Margin currently used by the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return TradeSummary pub fn with_margin_used(mut self, x: f32) -> Self { self.margin_used = Some(x); self } /// ID of the Trade's Trailing Stop Loss Order, only provided if such an /// Order exists. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return TradeSummary pub fn with_trailing_stop_loss_order_id(mut self, x: String) -> Self { self.trailing_stop_loss_order_id = Some(x); self } /// The execution price of the Trade. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return TradeSummary pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The unrealized profit/loss on the open portion of the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return TradeSummary pub fn with_unrealized_pl(mut self, x: f32) -> Self { self.unrealized_pl = Some(x); self } /// The total profit/loss realized on the closed portion of the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return TradeSummary pub fn with_realized_pl(mut self, x: f32) -> Self { self.realized_pl = Some(x); self } /// The date/time when the Trade was fully closed. Only provided for /// Trades whose state is CLOSED. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TradeSummary pub fn with_close_time(mut self, x: DateTime<Utc>) -> Self { self.close_time = Some(x); self } /// The Trade's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return TradeSummary pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The current state of the Trade. /// - param String /// - return TradeSummary pub fn with_state(mut self, x: String) -> Self { self.state = Some(x); self } /// ID of the Trade's Take Profit Order, only provided if such an Order /// exists. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return TradeSummary pub fn with_take_profit_order_id(mut self, x: String) -> Self { self.take_profit_order_id = Some(x); self } /// The margin required at the time the Trade was created. Note, this is /// the 'pure' margin required, it is not the 'effective' margin used that /// factors in the trade risk if a GSLO is attached to the trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return TradeSummary pub fn with_initial_margin_required(mut self, x: f32) -> Self { self.initial_margin_required = Some(x); self } /// The initial size of the Trade. Negative values indicate a short Trade, /// and positive values indicate a long Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return TradeSummary pub fn with_initial_units(mut self, x: f32) -> Self { self.initial_units = Some(x); self } /// The average closing price of the Trade. Only present if the Trade has /// been closed or reduced at least once. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return TradeSummary pub fn with_average_close_price(mut self, x: f32) -> Self { self.average_close_price = Some(x); self } /// The number of units currently open for the Trade. This value is /// reduced to 0.0 as the Trade is closed. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return TradeSummary pub fn with_current_units(mut self, x: f32) -> Self { self.current_units = Some(x); self } /// The IDs of the Transactions that have closed portions of this Trade. /// - param Vec<String> /// - return TradeSummary pub fn with_closing_transaction_i_ds(mut self, x: Vec<String>) -> Self { self.closing_transaction_i_ds = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return TradeSummary pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The Trade's identifier, unique within the Trade's Account. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TradeSummary pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct StopLossOrder { /// Date/time when the Order was filled (only provided when the Order's /// state is FILLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "filledTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub filled_time: Option<DateTime<Utc>>, /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// The premium that will be charged if the Stop Loss Order is guaranteed /// and the Order is filled at the guaranteed price. It is in price units /// and is charged for each unit of the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "guaranteedExecutionPremium", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub guaranteed_execution_premium: Option<f32>, /// The time-in-force requested for the StopLoss Order. Restricted to /// "GTC", "GFD" and "GTD" for StopLoss Orders. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// Flag indicating that the Stop Loss Order is guaranteed. The default /// value depends on the GuaranteedStopLossOrderMode of the account, if it /// is REQUIRED, the default will be true, for DISABLED or ENABLED the /// default is false. #[serde(default)] #[serde(rename = "guaranteed", skip_serializing_if = "Option::is_none")] pub guaranteed: Option<bool>, /// The current state of the Order. #[serde(default)] #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option<String>, /// The type of the Order. Always set to "STOP_LOSS" for Stop Loss Orders. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The price threshold specified for the Stop Loss Order. If the /// guaranteed flag is false, the associated Trade will be closed by a /// market price that is equal to or worse than this threshold. If the /// flag is true the associated Trade will be closed at this price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// Trade ID of Trade opened when the Order was filled (only provided when /// the Order's state is FILLED and a Trade was opened as a result of the /// fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeOpenedID", skip_serializing_if = "Option::is_none")] pub trade_opened_id: Option<String>, /// Trade ID of Trade reduced when the Order was filled (only provided /// when the Order's state is FILLED and a Trade was reduced as a result /// of the fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeReducedID", skip_serializing_if = "Option::is_none")] pub trade_reduced_id: Option<String>, /// Date/time when the Order was cancelled (only provided when the state /// of the Order is CANCELLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "cancelledTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub cancelled_time: Option<DateTime<Utc>>, /// ID of the Transaction that filled this Order (only provided when the /// Order's state is FILLED) /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "fillingTransactionID", skip_serializing_if = "Option::is_none" )] pub filling_transaction_id: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "createTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub create_time: Option<DateTime<Utc>>, /// Specifies the distance (in price units) from the Account's current /// price to use as the Stop Loss Order price. If the Trade is short the /// Instrument's bid price is used, and for long Trades the ask is used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "distance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub distance: Option<f32>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Order that was replaced by this Order (only provided if /// this Order was created as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacesOrderID", skip_serializing_if = "Option::is_none")] pub replaces_order_id: Option<String>, /// Trade IDs of Trades closed when the Order was filled (only provided /// when the Order's state is FILLED and one or more Trades were closed as /// a result of the fill) #[serde(default)] #[serde(rename = "tradeClosedIDs", skip_serializing_if = "Option::is_none")] pub trade_closed_i_ds: Option<Vec<String>>, /// The ID of the Order that replaced this Order (only provided if this /// Order was cancelled as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacedByOrderID", skip_serializing_if = "Option::is_none")] pub replaced_by_order_id: Option<String>, /// The client ID of the Trade to be closed when the price threshold is /// breached. #[serde(default)] #[serde(rename = "clientTradeID", skip_serializing_if = "Option::is_none")] pub client_trade_id: Option<String>, /// ID of the Transaction that cancelled the Order (only provided when the /// Order's state is CANCELLED) /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "cancellingTransactionID", skip_serializing_if = "Option::is_none" )] pub cancelling_transaction_id: Option<String>, /// The date/time when the StopLoss Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, } impl StopLossOrder { pub fn new() -> StopLossOrder { StopLossOrder { filled_time: None, trade_id: None, guaranteed_execution_premium: None, time_in_force: None, id: None, guaranteed: None, state: None, otype: None, price: None, trade_opened_id: None, trade_reduced_id: None, cancelled_time: None, filling_transaction_id: None, client_extensions: None, create_time: None, distance: None, trigger_condition: None, replaces_order_id: None, trade_closed_i_ds: None, replaced_by_order_id: None, client_trade_id: None, cancelling_transaction_id: None, gtd_time: None, } } /// Date/time when the Order was filled (only provided when the Order's /// state is FILLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopLossOrder pub fn with_filled_time(mut self, x: DateTime<Utc>) -> Self { self.filled_time = Some(x); self } /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return StopLossOrder pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// The premium that will be charged if the Stop Loss Order is guaranteed /// and the Order is filled at the guaranteed price. It is in price units /// and is charged for each unit of the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return StopLossOrder pub fn with_guaranteed_execution_premium(mut self, x: f32) -> Self { self.guaranteed_execution_premium = Some(x); self } /// The time-in-force requested for the StopLoss Order. Restricted to /// "GTC", "GFD" and "GTD" for StopLoss Orders. /// - param String /// - return StopLossOrder pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return StopLossOrder pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// Flag indicating that the Stop Loss Order is guaranteed. The default /// value depends on the GuaranteedStopLossOrderMode of the account, if it /// is REQUIRED, the default will be true, for DISABLED or ENABLED the /// default is false. /// - param bool /// - return StopLossOrder pub fn with_guaranteed(mut self, x: bool) -> Self { self.guaranteed = Some(x); self } /// The current state of the Order. /// - param String /// - return StopLossOrder pub fn with_state(mut self, x: String) -> Self { self.state = Some(x); self } /// The type of the Order. Always set to "STOP_LOSS" for Stop Loss Orders. /// - param String /// - return StopLossOrder pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The price threshold specified for the Stop Loss Order. If the /// guaranteed flag is false, the associated Trade will be closed by a /// market price that is equal to or worse than this threshold. If the /// flag is true the associated Trade will be closed at this price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return StopLossOrder pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// Trade ID of Trade opened when the Order was filled (only provided when /// the Order's state is FILLED and a Trade was opened as a result of the /// fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return StopLossOrder pub fn with_trade_opened_id(mut self, x: String) -> Self { self.trade_opened_id = Some(x); self } /// Trade ID of Trade reduced when the Order was filled (only provided /// when the Order's state is FILLED and a Trade was reduced as a result /// of the fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return StopLossOrder pub fn with_trade_reduced_id(mut self, x: String) -> Self { self.trade_reduced_id = Some(x); self } /// Date/time when the Order was cancelled (only provided when the state /// of the Order is CANCELLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopLossOrder pub fn with_cancelled_time(mut self, x: DateTime<Utc>) -> Self { self.cancelled_time = Some(x); self } /// ID of the Transaction that filled this Order (only provided when the /// Order's state is FILLED) /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return StopLossOrder pub fn with_filling_transaction_id(mut self, x: String) -> Self { self.filling_transaction_id = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return StopLossOrder pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopLossOrder pub fn with_create_time(mut self, x: DateTime<Utc>) -> Self { self.create_time = Some(x); self } /// Specifies the distance (in price units) from the Account's current /// price to use as the Stop Loss Order price. If the Trade is short the /// Instrument's bid price is used, and for long Trades the ask is used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return StopLossOrder pub fn with_distance(mut self, x: f32) -> Self { self.distance = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return StopLossOrder pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Order that was replaced by this Order (only provided if /// this Order was created as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return StopLossOrder pub fn with_replaces_order_id(mut self, x: String) -> Self { self.replaces_order_id = Some(x); self } /// Trade IDs of Trades closed when the Order was filled (only provided /// when the Order's state is FILLED and one or more Trades were closed as /// a result of the fill) /// - param Vec<String> /// - return StopLossOrder pub fn with_trade_closed_i_ds(mut self, x: Vec<String>) -> Self { self.trade_closed_i_ds = Some(x); self } /// The ID of the Order that replaced this Order (only provided if this /// Order was cancelled as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return StopLossOrder pub fn with_replaced_by_order_id(mut self, x: String) -> Self { self.replaced_by_order_id = Some(x); self } /// The client ID of the Trade to be closed when the price threshold is /// breached. /// - param String /// - return StopLossOrder pub fn with_client_trade_id(mut self, x: String) -> Self { self.client_trade_id = Some(x); self } /// ID of the Transaction that cancelled the Order (only provided when the /// Order's state is CANCELLED) /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return StopLossOrder pub fn with_cancelling_transaction_id(mut self, x: String) -> Self { self.cancelling_transaction_id = Some(x); self } /// The date/time when the StopLoss Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopLossOrder pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } } /// The financing mode of an Account #[derive(Debug, Serialize, Deserialize)] pub enum AccountFinancingMode { #[serde(rename = "NO_FINANCING")] NoFinancing, #[serde(rename = "SECOND_BY_SECOND")] SecondBySecond, #[serde(rename = "DAILY")] Daily, } impl FromStr for AccountFinancingMode { type Err = (); fn from_str(s: &str) -> Result<AccountFinancingMode, ()> { match s { "NO_FINANCING" => Ok(AccountFinancingMode::NoFinancing), "SECOND_BY_SECOND" => Ok(AccountFinancingMode::SecondBySecond), "DAILY" => Ok(AccountFinancingMode::Daily), _ => Err(()), } } } impl std::fmt::Display for AccountFinancingMode { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct AccountChangesState { /// The price-dependent state for each open Position in the Account. #[serde(default)] #[serde(rename = "positions", skip_serializing_if = "Option::is_none")] pub positions: Option<Vec<CalculatedPositionState>>, /// The price-dependent state for each open Trade in the Account. #[serde(default)] #[serde(rename = "trades", skip_serializing_if = "Option::is_none")] pub trades: Option<Vec<CalculatedTradeState>>, /// The Account's margin closeout NAV. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginCloseoutNAV", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_nav: Option<f32>, /// Margin currently used for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_used: Option<f32>, /// Margin available for Account currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginAvailable", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_available: Option<f32>, /// The current WithdrawalLimit for the account which will be zero or a /// positive value indicating how much can be withdrawn from the account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "withdrawalLimit", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub withdrawal_limit: Option<f32>, /// The total unrealized profit/loss for all Trades currently open in the /// Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "unrealizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub unrealized_pl: Option<f32>, /// The Account's margin closeout margin used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginCloseoutMarginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_margin_used: Option<f32>, /// The Account's margin call margin used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginCallMarginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_call_margin_used: Option<f32>, /// The Account's margin call percentage. When this value is 1.0 or above /// the Account is in a margin call situation. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginCallPercent", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_call_percent: Option<f32>, /// The Account's margin closeout percentage. When this value is 1.0 or /// above the Account is in a margin closeout situation. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginCloseoutPercent", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_percent: Option<f32>, /// The net asset value of the Account. Equal to Account balance + /// unrealizedPL. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "NAV", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub nav: Option<f32>, /// The Account's margin closeout unrealized PL. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginCloseoutUnrealizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_unrealized_pl: Option<f32>, /// The price-dependent state of each pending Order in the Account. #[serde(default)] #[serde(rename = "orders", skip_serializing_if = "Option::is_none")] pub orders: Option<Vec<DynamicOrderState>>, /// The value of the Account's open positions as used for margin closeout /// calculations represented in the Account's home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginCloseoutPositionValue", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_position_value: Option<f32>, /// The value of the Account's open positions represented in the Account's /// home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "positionValue", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub position_value: Option<f32>, } impl AccountChangesState { pub fn new() -> AccountChangesState { AccountChangesState { positions: None, trades: None, margin_closeout_nav: None, margin_used: None, margin_available: None, withdrawal_limit: None, unrealized_pl: None, margin_closeout_margin_used: None, margin_call_margin_used: None, margin_call_percent: None, margin_closeout_percent: None, nav: None, margin_closeout_unrealized_pl: None, orders: None, margin_closeout_position_value: None, position_value: None, } } /// The price-dependent state for each open Position in the Account. /// - param Vec<CalculatedPositionState> /// - return AccountChangesState pub fn with_positions(mut self, x: Vec<CalculatedPositionState>) -> Self { self.positions = Some(x); self } /// The price-dependent state for each open Trade in the Account. /// - param Vec<CalculatedTradeState> /// - return AccountChangesState pub fn with_trades(mut self, x: Vec<CalculatedTradeState>) -> Self { self.trades = Some(x); self } /// The Account's margin closeout NAV. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountChangesState pub fn with_margin_closeout_nav(mut self, x: f32) -> Self { self.margin_closeout_nav = Some(x); self } /// Margin currently used for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountChangesState pub fn with_margin_used(mut self, x: f32) -> Self { self.margin_used = Some(x); self } /// Margin available for Account currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountChangesState pub fn with_margin_available(mut self, x: f32) -> Self { self.margin_available = Some(x); self } /// The current WithdrawalLimit for the account which will be zero or a /// positive value indicating how much can be withdrawn from the account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountChangesState pub fn with_withdrawal_limit(mut self, x: f32) -> Self { self.withdrawal_limit = Some(x); self } /// The total unrealized profit/loss for all Trades currently open in the /// Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountChangesState pub fn with_unrealized_pl(mut self, x: f32) -> Self { self.unrealized_pl = Some(x); self } /// The Account's margin closeout margin used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountChangesState pub fn with_margin_closeout_margin_used(mut self, x: f32) -> Self { self.margin_closeout_margin_used = Some(x); self } /// The Account's margin call margin used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountChangesState pub fn with_margin_call_margin_used(mut self, x: f32) -> Self { self.margin_call_margin_used = Some(x); self } /// The Account's margin call percentage. When this value is 1.0 or above /// the Account is in a margin call situation. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return AccountChangesState pub fn with_margin_call_percent(mut self, x: f32) -> Self { self.margin_call_percent = Some(x); self } /// The Account's margin closeout percentage. When this value is 1.0 or /// above the Account is in a margin closeout situation. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return AccountChangesState pub fn with_margin_closeout_percent(mut self, x: f32) -> Self { self.margin_closeout_percent = Some(x); self } /// The net asset value of the Account. Equal to Account balance + /// unrealizedPL. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountChangesState pub fn with_nav(mut self, x: f32) -> Self { self.nav = Some(x); self } /// The Account's margin closeout unrealized PL. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountChangesState pub fn with_margin_closeout_unrealized_pl(mut self, x: f32) -> Self { self.margin_closeout_unrealized_pl = Some(x); self } /// The price-dependent state of each pending Order in the Account. /// - param Vec<DynamicOrderState> /// - return AccountChangesState pub fn with_orders(mut self, x: Vec<DynamicOrderState>) -> Self { self.orders = Some(x); self } /// The value of the Account's open positions as used for margin closeout /// calculations represented in the Account's home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return AccountChangesState pub fn with_margin_closeout_position_value(mut self, x: f32) -> Self { self.margin_closeout_position_value = Some(x); self } /// The value of the Account's open positions represented in the Account's /// home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountChangesState pub fn with_position_value(mut self, x: f32) -> Self { self.position_value = Some(x); self } } /// The reason that an Account is being funded. #[derive(Debug, Serialize, Deserialize)] pub enum FundingReason { #[serde(rename = "CLIENT_FUNDING")] ClientFunding, #[serde(rename = "ACCOUNT_TRANSFER")] AccountTransfer, #[serde(rename = "DIVISION_MIGRATION")] DivisionMigration, #[serde(rename = "SITE_MIGRATION")] SiteMigration, #[serde(rename = "ADJUSTMENT")] Adjustment, } impl FromStr for FundingReason { type Err = (); fn from_str(s: &str) -> Result<FundingReason, ()> { match s { "CLIENT_FUNDING" => Ok(FundingReason::ClientFunding), "ACCOUNT_TRANSFER" => Ok(FundingReason::AccountTransfer), "DIVISION_MIGRATION" => Ok(FundingReason::DivisionMigration), "SITE_MIGRATION" => Ok(FundingReason::SiteMigration), "ADJUSTMENT" => Ok(FundingReason::Adjustment), _ => Err(()), } } } impl std::fmt::Display for FundingReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct ClientConfigureTransaction { /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The margin rate override for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginRate", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_rate: Option<f32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The client-provided alias for the Account. #[serde(default)] #[serde(rename = "alias", skip_serializing_if = "Option::is_none")] pub alias: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "CLIENT_CONFIGURE" in a /// ClientConfigureTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl ClientConfigureTransaction { pub fn new() -> ClientConfigureTransaction { ClientConfigureTransaction { user_id: None, margin_rate: None, batch_id: None, alias: None, request_id: None, time: None, otype: None, id: None, account_id: None, } } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return ClientConfigureTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The margin rate override for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return ClientConfigureTransaction pub fn with_margin_rate(mut self, x: f32) -> Self { self.margin_rate = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return ClientConfigureTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The client-provided alias for the Account. /// - param String /// - return ClientConfigureTransaction pub fn with_alias(mut self, x: String) -> Self { self.alias = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return ClientConfigureTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return ClientConfigureTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The Type of the Transaction. Always set to "CLIENT_CONFIGURE" in a /// ClientConfigureTransaction. /// - param String /// - return ClientConfigureTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return ClientConfigureTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return ClientConfigureTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct Account { /// The details all Account Positions. #[serde(default)] #[serde(rename = "positions", skip_serializing_if = "Option::is_none")] pub positions: Option<Vec<Position>>, /// The details of the Trades currently open in the Account. #[serde(default)] #[serde(rename = "trades", skip_serializing_if = "Option::is_none")] pub trades: Option<Vec<TradeSummary>>, /// The date/time that the Account's resettablePL was last reset. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "resettablePLTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub resettable_pl_time: Option<DateTime<Utc>>, /// Margin currently used for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_used: Option<f32>, /// The value of the Account's open positions as used for margin closeout /// calculations represented in the Account's home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginCloseoutPositionValue", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_position_value: Option<f32>, /// The number of times that the Account's current margin call was /// extended. #[serde(default)] #[serde( rename = "marginCallExtensionCount", skip_serializing_if = "Option::is_none" )] pub margin_call_extension_count: Option<i32>, /// The home currency of the Account /// format: A string containing an ISO 4217 currency /// (http://en.wikipedia.org/wiki/ISO_4217) #[serde(default)] #[serde(rename = "currency", skip_serializing_if = "Option::is_none")] pub currency: Option<String>, /// The total realized profit/loss for the Account since it was last reset /// by the client. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "resettablePL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub resettable_pl: Option<f32>, /// The net asset value of the Account. Equal to Account balance + /// unrealizedPL. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "NAV", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub nav: Option<f32>, /// The date/time of the Account's last margin call extension. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "lastMarginCallExtensionTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub last_margin_call_extension_time: Option<DateTime<Utc>>, /// The Account's margin closeout margin used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginCloseoutMarginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_margin_used: Option<f32>, /// The number of Trades currently open in the Account. #[serde(default)] #[serde(rename = "openTradeCount", skip_serializing_if = "Option::is_none")] pub open_trade_count: Option<i32>, /// The Account's identifier /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The number of Positions currently open in the Account. #[serde(default)] #[serde(rename = "openPositionCount", skip_serializing_if = "Option::is_none")] pub open_position_count: Option<i32>, /// The Account's margin closeout NAV. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginCloseoutNAV", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_nav: Option<f32>, /// The Account's margin closeout percentage. When this value is 1.0 or /// above the Account is in a margin closeout situation. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginCloseoutPercent", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_percent: Option<f32>, /// The Account's margin call margin used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginCallMarginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_call_margin_used: Option<f32>, /// The total amount of commission paid over the lifetime of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "commission", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub commission: Option<f32>, /// Flag indicating that the Account has hedging enabled. #[serde(default)] #[serde(rename = "hedgingEnabled", skip_serializing_if = "Option::is_none")] pub hedging_enabled: Option<bool>, /// The value of the Account's open positions represented in the Account's /// home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "positionValue", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub position_value: Option<f32>, /// The total profit/loss realized over the lifetime of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "pl", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub pl: Option<f32>, /// The current guaranteed Stop Loss Order mode of the Account. #[serde(default)] #[serde( rename = "guaranteedStopLossOrderMode", skip_serializing_if = "Option::is_none" )] pub guaranteed_stop_loss_order_mode: Option<String>, /// The ID of the last Transaction created for the Account. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "lastTransactionID", skip_serializing_if = "Option::is_none")] pub last_transaction_id: Option<String>, /// Margin available for Account currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginAvailable", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_available: Option<f32>, /// Client-provided margin rate override for the Account. The effective /// margin rate of the Account is the lesser of this value and the OANDA /// margin rate for the Account's division. This value is only provided if /// a margin rate override exists for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginRate", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_rate: Option<f32>, /// The Account's margin call percentage. When this value is 1.0 or above /// the Account is in a margin call situation. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginCallPercent", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_call_percent: Option<f32>, /// The date/time when the Account entered a margin call state. Only /// provided if the Account is in a margin call. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "marginCallEnterTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub margin_call_enter_time: Option<DateTime<Utc>>, /// The total amount of fees charged over the lifetime of the Account for /// the execution of guaranteed Stop Loss Orders. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "guaranteedExecutionFees", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub guaranteed_execution_fees: Option<f32>, /// The total amount of financing paid/collected over the lifetime of the /// Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "financing", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub financing: Option<f32>, /// The current balance of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "balance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub balance: Option<f32>, /// The number of Orders currently pending in the Account. #[serde(default)] #[serde(rename = "pendingOrderCount", skip_serializing_if = "Option::is_none")] pub pending_order_count: Option<i32>, /// The current WithdrawalLimit for the account which will be zero or a /// positive value indicating how much can be withdrawn from the account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "withdrawalLimit", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub withdrawal_limit: Option<f32>, /// The total unrealized profit/loss for all Trades currently open in the /// Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "unrealizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub unrealized_pl: Option<f32>, /// Client-assigned alias for the Account. Only provided if the Account /// has an alias set #[serde(default)] #[serde(rename = "alias", skip_serializing_if = "Option::is_none")] pub alias: Option<String>, /// ID of the user that created the Account. #[serde(default)] #[serde(rename = "createdByUserID", skip_serializing_if = "Option::is_none")] pub created_by_user_id: Option<i32>, /// The Account's margin closeout unrealized PL. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginCloseoutUnrealizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_unrealized_pl: Option<f32>, /// The date/time when the Account was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "createdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub created_time: Option<DateTime<Utc>>, /// The date/time of the last order that was filled for this account. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "lastOrderFillTimestamp", skip_serializing_if = "Option::is_none", with = "serdates" )] pub last_order_fill_timestamp: Option<DateTime<Utc>>, /// The details of the Orders currently pending in the Account. #[serde(default)] #[serde(rename = "orders", skip_serializing_if = "Option::is_none")] pub orders: Option<Vec<Order>>, } impl Account { pub fn new() -> Account { Account { positions: None, trades: None, resettable_pl_time: None, margin_used: None, margin_closeout_position_value: None, margin_call_extension_count: None, currency: None, resettable_pl: None, nav: None, last_margin_call_extension_time: None, margin_closeout_margin_used: None, open_trade_count: None, id: None, open_position_count: None, margin_closeout_nav: None, margin_closeout_percent: None, margin_call_margin_used: None, commission: None, hedging_enabled: None, position_value: None, pl: None, guaranteed_stop_loss_order_mode: None, last_transaction_id: None, margin_available: None, margin_rate: None, margin_call_percent: None, margin_call_enter_time: None, guaranteed_execution_fees: None, financing: None, balance: None, pending_order_count: None, withdrawal_limit: None, unrealized_pl: None, alias: None, created_by_user_id: None, margin_closeout_unrealized_pl: None, created_time: None, last_order_fill_timestamp: None, orders: None, } } /// The details all Account Positions. /// - param Vec<Position> /// - return Account pub fn with_positions(mut self, x: Vec<Position>) -> Self { self.positions = Some(x); self } /// The details of the Trades currently open in the Account. /// - param Vec<TradeSummary> /// - return Account pub fn with_trades(mut self, x: Vec<TradeSummary>) -> Self { self.trades = Some(x); self } /// The date/time that the Account's resettablePL was last reset. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return Account pub fn with_resettable_pl_time(mut self, x: DateTime<Utc>) -> Self { self.resettable_pl_time = Some(x); self } /// Margin currently used for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Account pub fn with_margin_used(mut self, x: f32) -> Self { self.margin_used = Some(x); self } /// The value of the Account's open positions as used for margin closeout /// calculations represented in the Account's home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return Account pub fn with_margin_closeout_position_value(mut self, x: f32) -> Self { self.margin_closeout_position_value = Some(x); self } /// The number of times that the Account's current margin call was /// extended. /// - param i32 /// - return Account pub fn with_margin_call_extension_count(mut self, x: i32) -> Self { self.margin_call_extension_count = Some(x); self } /// The home currency of the Account /// format: A string containing an ISO 4217 currency /// (http://en.wikipedia.org/wiki/ISO_4217) /// - param String /// - return Account pub fn with_currency(mut self, x: String) -> Self { self.currency = Some(x); self } /// The total realized profit/loss for the Account since it was last reset /// by the client. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Account pub fn with_resettable_pl(mut self, x: f32) -> Self { self.resettable_pl = Some(x); self } /// The net asset value of the Account. Equal to Account balance + /// unrealizedPL. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Account pub fn with_nav(mut self, x: f32) -> Self { self.nav = Some(x); self } /// The date/time of the Account's last margin call extension. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return Account pub fn with_last_margin_call_extension_time(mut self, x: DateTime<Utc>) -> Self { self.last_margin_call_extension_time = Some(x); self } /// The Account's margin closeout margin used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Account pub fn with_margin_closeout_margin_used(mut self, x: f32) -> Self { self.margin_closeout_margin_used = Some(x); self } /// The number of Trades currently open in the Account. /// - param i32 /// - return Account pub fn with_open_trade_count(mut self, x: i32) -> Self { self.open_trade_count = Some(x); self } /// The Account's identifier /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return Account pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The number of Positions currently open in the Account. /// - param i32 /// - return Account pub fn with_open_position_count(mut self, x: i32) -> Self { self.open_position_count = Some(x); self } /// The Account's margin closeout NAV. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Account pub fn with_margin_closeout_nav(mut self, x: f32) -> Self { self.margin_closeout_nav = Some(x); self } /// The Account's margin closeout percentage. When this value is 1.0 or /// above the Account is in a margin closeout situation. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return Account pub fn with_margin_closeout_percent(mut self, x: f32) -> Self { self.margin_closeout_percent = Some(x); self } /// The Account's margin call margin used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Account pub fn with_margin_call_margin_used(mut self, x: f32) -> Self { self.margin_call_margin_used = Some(x); self } /// The total amount of commission paid over the lifetime of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Account pub fn with_commission(mut self, x: f32) -> Self { self.commission = Some(x); self } /// Flag indicating that the Account has hedging enabled. /// - param bool /// - return Account pub fn with_hedging_enabled(mut self, x: bool) -> Self { self.hedging_enabled = Some(x); self } /// The value of the Account's open positions represented in the Account's /// home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Account pub fn with_position_value(mut self, x: f32) -> Self { self.position_value = Some(x); self } /// The total profit/loss realized over the lifetime of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Account pub fn with_pl(mut self, x: f32) -> Self { self.pl = Some(x); self } /// The current guaranteed Stop Loss Order mode of the Account. /// - param String /// - return Account pub fn with_guaranteed_stop_loss_order_mode(mut self, x: String) -> Self { self.guaranteed_stop_loss_order_mode = Some(x); self } /// The ID of the last Transaction created for the Account. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return Account pub fn with_last_transaction_id(mut self, x: String) -> Self { self.last_transaction_id = Some(x); self } /// Margin available for Account currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Account pub fn with_margin_available(mut self, x: f32) -> Self { self.margin_available = Some(x); self } /// Client-provided margin rate override for the Account. The effective /// margin rate of the Account is the lesser of this value and the OANDA /// margin rate for the Account's division. This value is only provided if /// a margin rate override exists for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return Account pub fn with_margin_rate(mut self, x: f32) -> Self { self.margin_rate = Some(x); self } /// The Account's margin call percentage. When this value is 1.0 or above /// the Account is in a margin call situation. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return Account pub fn with_margin_call_percent(mut self, x: f32) -> Self { self.margin_call_percent = Some(x); self } /// The date/time when the Account entered a margin call state. Only /// provided if the Account is in a margin call. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return Account pub fn with_margin_call_enter_time(mut self, x: DateTime<Utc>) -> Self { self.margin_call_enter_time = Some(x); self } /// The total amount of fees charged over the lifetime of the Account for /// the execution of guaranteed Stop Loss Orders. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Account pub fn with_guaranteed_execution_fees(mut self, x: f32) -> Self { self.guaranteed_execution_fees = Some(x); self } /// The total amount of financing paid/collected over the lifetime of the /// Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Account pub fn with_financing(mut self, x: f32) -> Self { self.financing = Some(x); self } /// The current balance of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Account pub fn with_balance(mut self, x: f32) -> Self { self.balance = Some(x); self } /// The number of Orders currently pending in the Account. /// - param i32 /// - return Account pub fn with_pending_order_count(mut self, x: i32) -> Self { self.pending_order_count = Some(x); self } /// The current WithdrawalLimit for the account which will be zero or a /// positive value indicating how much can be withdrawn from the account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Account pub fn with_withdrawal_limit(mut self, x: f32) -> Self { self.withdrawal_limit = Some(x); self } /// The total unrealized profit/loss for all Trades currently open in the /// Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Account pub fn with_unrealized_pl(mut self, x: f32) -> Self { self.unrealized_pl = Some(x); self } /// Client-assigned alias for the Account. Only provided if the Account /// has an alias set /// - param String /// - return Account pub fn with_alias(mut self, x: String) -> Self { self.alias = Some(x); self } /// ID of the user that created the Account. /// - param i32 /// - return Account pub fn with_created_by_user_id(mut self, x: i32) -> Self { self.created_by_user_id = Some(x); self } /// The Account's margin closeout unrealized PL. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Account pub fn with_margin_closeout_unrealized_pl(mut self, x: f32) -> Self { self.margin_closeout_unrealized_pl = Some(x); self } /// The date/time when the Account was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return Account pub fn with_created_time(mut self, x: DateTime<Utc>) -> Self { self.created_time = Some(x); self } /// The date/time of the last order that was filled for this account. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return Account pub fn with_last_order_fill_timestamp(mut self, x: DateTime<Utc>) -> Self { self.last_order_fill_timestamp = Some(x); self } /// The details of the Orders currently pending in the Account. /// - param Vec<Order> /// - return Account pub fn with_orders(mut self, x: Vec<Order>) -> Self { self.orders = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct TradeOpen { /// The ID of the Trade that was opened /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// This is the fee charged for opening the trade if it has a guaranteed /// Stop Loss Order attached to it. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "guaranteedExecutionFee", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub guaranteed_execution_fee: Option<f32>, /// The average price that the units were opened at. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The margin required at the time the Trade was created. Note, this is /// the 'pure' margin required, it is not the 'effective' margin used that /// factors in the trade risk if a GSLO is attached to the trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "initialMarginRequired", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub initial_margin_required: Option<f32>, /// The number of units opened by the Trade /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The half spread cost for the trade open. This can be a positive or /// negative value and is represented in the home currency of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "halfSpreadCost", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub half_spread_cost: Option<f32>, } impl TradeOpen { pub fn new() -> TradeOpen { TradeOpen { trade_id: None, guaranteed_execution_fee: None, price: None, initial_margin_required: None, units: None, client_extensions: None, half_spread_cost: None, } } /// The ID of the Trade that was opened /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TradeOpen pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// This is the fee charged for opening the trade if it has a guaranteed /// Stop Loss Order attached to it. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return TradeOpen pub fn with_guaranteed_execution_fee(mut self, x: f32) -> Self { self.guaranteed_execution_fee = Some(x); self } /// The average price that the units were opened at. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return TradeOpen pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The margin required at the time the Trade was created. Note, this is /// the 'pure' margin required, it is not the 'effective' margin used that /// factors in the trade risk if a GSLO is attached to the trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return TradeOpen pub fn with_initial_margin_required(mut self, x: f32) -> Self { self.initial_margin_required = Some(x); self } /// The number of units opened by the Trade /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return TradeOpen pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return TradeOpen pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The half spread cost for the trade open. This can be a positive or /// negative value and is represented in the home currency of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return TradeOpen pub fn with_half_spread_cost(mut self, x: f32) -> Self { self.half_spread_cost = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct MT4TransactionHeartbeat { /// The string "HEARTBEAT" #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The date/time when the TransactionHeartbeat was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, } impl MT4TransactionHeartbeat { pub fn new() -> MT4TransactionHeartbeat { MT4TransactionHeartbeat { otype: None, time: None, } } /// The string "HEARTBEAT" /// - param String /// - return MT4TransactionHeartbeat pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The date/time when the TransactionHeartbeat was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MT4TransactionHeartbeat pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } } /// The reason that an Order was filled #[derive(Debug, Serialize, Deserialize)] pub enum OrderFillReason { #[serde(rename = "LIMIT_ORDER")] LimitOrder, #[serde(rename = "STOP_ORDER")] StopOrder, #[serde(rename = "MARKET_IF_TOUCHED_ORDER")] MarketIfTouchedOrder, #[serde(rename = "TAKE_PROFIT_ORDER")] TakeProfitOrder, #[serde(rename = "STOP_LOSS_ORDER")] StopLossOrder, #[serde(rename = "TRAILING_STOP_LOSS_ORDER")] TrailingStopLossOrder, #[serde(rename = "MARKET_ORDER")] MarketOrder, #[serde(rename = "MARKET_ORDER_TRADE_CLOSE")] MarketOrderTradeClose, #[serde(rename = "MARKET_ORDER_POSITION_CLOSEOUT")] MarketOrderPositionCloseout, #[serde(rename = "MARKET_ORDER_MARGIN_CLOSEOUT")] MarketOrderMarginCloseout, #[serde(rename = "MARKET_ORDER_DELAYED_TRADE_CLOSE")] MarketOrderDelayedTradeClose, } impl FromStr for OrderFillReason { type Err = (); fn from_str(s: &str) -> Result<OrderFillReason, ()> { match s { "LIMIT_ORDER" => Ok(OrderFillReason::LimitOrder), "STOP_ORDER" => Ok(OrderFillReason::StopOrder), "MARKET_IF_TOUCHED_ORDER" => Ok(OrderFillReason::MarketIfTouchedOrder), "TAKE_PROFIT_ORDER" => Ok(OrderFillReason::TakeProfitOrder), "STOP_LOSS_ORDER" => Ok(OrderFillReason::StopLossOrder), "TRAILING_STOP_LOSS_ORDER" => Ok(OrderFillReason::TrailingStopLossOrder), "MARKET_ORDER" => Ok(OrderFillReason::MarketOrder), "MARKET_ORDER_TRADE_CLOSE" => Ok(OrderFillReason::MarketOrderTradeClose), "MARKET_ORDER_POSITION_CLOSEOUT" => Ok(OrderFillReason::MarketOrderPositionCloseout), "MARKET_ORDER_MARGIN_CLOSEOUT" => Ok(OrderFillReason::MarketOrderMarginCloseout), "MARKET_ORDER_DELAYED_TRADE_CLOSE" => Ok(OrderFillReason::MarketOrderDelayedTradeClose), _ => Err(()), } } } impl std::fmt::Display for OrderFillReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct MarketOrderDelayedTradeClose { /// The Transaction ID of the DelayedTradeClosure transaction to which /// this Delayed Trade Close belongs to /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "sourceTransactionID", skip_serializing_if = "Option::is_none" )] pub source_transaction_id: Option<String>, /// The ID of the Trade being closed /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// The Client ID of the Trade being closed /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "clientTradeID", skip_serializing_if = "Option::is_none")] pub client_trade_id: Option<String>, } impl MarketOrderDelayedTradeClose { pub fn new() -> MarketOrderDelayedTradeClose { MarketOrderDelayedTradeClose { source_transaction_id: None, trade_id: None, client_trade_id: None, } } /// The Transaction ID of the DelayedTradeClosure transaction to which /// this Delayed Trade Close belongs to /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarketOrderDelayedTradeClose pub fn with_source_transaction_id(mut self, x: String) -> Self { self.source_transaction_id = Some(x); self } /// The ID of the Trade being closed /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return MarketOrderDelayedTradeClose pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// The Client ID of the Trade being closed /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return MarketOrderDelayedTradeClose pub fn with_client_trade_id(mut self, x: String) -> Self { self.client_trade_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct Candlestick { /// A flag indicating if the candlestick is complete. A complete /// candlestick is one whose ending time is not in the future. #[serde(default)] #[serde(rename = "complete", skip_serializing_if = "Option::is_none")] pub complete: Option<bool>, /// The price data (open, high, low, close) for the Candlestick /// representation. #[serde(default)] #[serde(rename = "bid", skip_serializing_if = "Option::is_none")] pub bid: Option<CandlestickData>, /// The price data (open, high, low, close) for the Candlestick /// representation. #[serde(default)] #[serde(rename = "mid", skip_serializing_if = "Option::is_none")] pub mid: Option<CandlestickData>, /// The number of prices created during the time-range represented by the /// candlestick. #[serde(default)] #[serde(rename = "volume", skip_serializing_if = "Option::is_none")] pub volume: Option<i32>, /// The start time of the candlestick /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The price data (open, high, low, close) for the Candlestick /// representation. #[serde(default)] #[serde(rename = "ask", skip_serializing_if = "Option::is_none")] pub ask: Option<CandlestickData>, } impl Candlestick { pub fn new() -> Candlestick { Candlestick { complete: None, bid: None, mid: None, volume: None, time: None, ask: None, } } /// A flag indicating if the candlestick is complete. A complete /// candlestick is one whose ending time is not in the future. /// - param bool /// - return Candlestick pub fn with_complete(mut self, x: bool) -> Self { self.complete = Some(x); self } /// The price data (open, high, low, close) for the Candlestick /// representation. /// - param CandlestickData /// - return Candlestick pub fn with_bid(mut self, x: CandlestickData) -> Self { self.bid = Some(x); self } /// The price data (open, high, low, close) for the Candlestick /// representation. /// - param CandlestickData /// - return Candlestick pub fn with_mid(mut self, x: CandlestickData) -> Self { self.mid = Some(x); self } /// The number of prices created during the time-range represented by the /// candlestick. /// - param i32 /// - return Candlestick pub fn with_volume(mut self, x: i32) -> Self { self.volume = Some(x); self } /// The start time of the candlestick /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return Candlestick pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The price data (open, high, low, close) for the Candlestick /// representation. /// - param CandlestickData /// - return Candlestick pub fn with_ask(mut self, x: CandlestickData) -> Self { self.ask = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct PositionSide { /// The total amount of financing paid/collected for this PositionSide /// over the lifetime of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "financing", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub financing: Option<f32>, /// The unrealized profit/loss of all open Trades that contribute to this /// PositionSide. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "unrealizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub unrealized_pl: Option<f32>, /// List of the open Trade IDs which contribute to the open Position. #[serde(default)] #[serde(rename = "tradeIDs", skip_serializing_if = "Option::is_none")] pub trade_i_ds: Option<Vec<String>>, /// Profit/loss realized by the PositionSide since the Account's /// resettablePL was last reset by the client. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "resettablePL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub resettable_pl: Option<f32>, /// The total amount of fees charged over the lifetime of the Account for /// the execution of guaranteed Stop Loss Orders attached to Trades for /// this PositionSide. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "guaranteedExecutionFees", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub guaranteed_execution_fees: Option<f32>, /// Number of units in the position (negative value indicates short /// position, positive indicates long position). /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// Volume-weighted average of the underlying Trade open prices for the /// Position. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "averagePrice", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub average_price: Option<f32>, /// Profit/loss realized by the PositionSide over the lifetime of the /// Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "pl", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub pl: Option<f32>, } impl PositionSide { pub fn new() -> PositionSide { PositionSide { financing: None, unrealized_pl: None, trade_i_ds: None, resettable_pl: None, guaranteed_execution_fees: None, units: None, average_price: None, pl: None, } } /// The total amount of financing paid/collected for this PositionSide /// over the lifetime of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return PositionSide pub fn with_financing(mut self, x: f32) -> Self { self.financing = Some(x); self } /// The unrealized profit/loss of all open Trades that contribute to this /// PositionSide. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return PositionSide pub fn with_unrealized_pl(mut self, x: f32) -> Self { self.unrealized_pl = Some(x); self } /// List of the open Trade IDs which contribute to the open Position. /// - param Vec<String> /// - return PositionSide pub fn with_trade_i_ds(mut self, x: Vec<String>) -> Self { self.trade_i_ds = Some(x); self } /// Profit/loss realized by the PositionSide since the Account's /// resettablePL was last reset by the client. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return PositionSide pub fn with_resettable_pl(mut self, x: f32) -> Self { self.resettable_pl = Some(x); self } /// The total amount of fees charged over the lifetime of the Account for /// the execution of guaranteed Stop Loss Orders attached to Trades for /// this PositionSide. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return PositionSide pub fn with_guaranteed_execution_fees(mut self, x: f32) -> Self { self.guaranteed_execution_fees = Some(x); self } /// Number of units in the position (negative value indicates short /// position, positive indicates long position). /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return PositionSide pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// Volume-weighted average of the underlying Trade open prices for the /// Position. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return PositionSide pub fn with_average_price(mut self, x: f32) -> Self { self.average_price = Some(x); self } /// Profit/loss realized by the PositionSide over the lifetime of the /// Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return PositionSide pub fn with_pl(mut self, x: f32) -> Self { self.pl = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct Position { /// The total amount of financing paid/collected for this instrument over /// the lifetime of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "financing", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub financing: Option<f32>, /// The representation of a Position for a single direction (long or /// short). #[serde(default)] #[serde(rename = "short", skip_serializing_if = "Option::is_none")] pub short: Option<PositionSide>, /// Margin currently used by the Position. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_used: Option<f32>, /// The unrealized profit/loss of all open Trades that contribute to this /// Position. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "unrealizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub unrealized_pl: Option<f32>, /// The total amount of commission paid for this instrument over the /// lifetime of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "commission", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub commission: Option<f32>, /// The representation of a Position for a single direction (long or /// short). #[serde(default)] #[serde(rename = "long", skip_serializing_if = "Option::is_none")] pub long: Option<PositionSide>, /// The Position's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// Profit/loss realized by the Position since the Account's resettablePL /// was last reset by the client. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "resettablePL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub resettable_pl: Option<f32>, /// The total amount of fees charged over the lifetime of the Account for /// the execution of guaranteed Stop Loss Orders for this instrument. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "guaranteedExecutionFees", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub guaranteed_execution_fees: Option<f32>, /// Profit/loss realized by the Position over the lifetime of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "pl", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub pl: Option<f32>, } impl Position { pub fn new() -> Position { Position { financing: None, short: None, margin_used: None, unrealized_pl: None, commission: None, long: None, instrument: None, resettable_pl: None, guaranteed_execution_fees: None, pl: None, } } /// The total amount of financing paid/collected for this instrument over /// the lifetime of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Position pub fn with_financing(mut self, x: f32) -> Self { self.financing = Some(x); self } /// The representation of a Position for a single direction (long or /// short). /// - param PositionSide /// - return Position pub fn with_short(mut self, x: PositionSide) -> Self { self.short = Some(x); self } /// Margin currently used by the Position. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Position pub fn with_margin_used(mut self, x: f32) -> Self { self.margin_used = Some(x); self } /// The unrealized profit/loss of all open Trades that contribute to this /// Position. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Position pub fn with_unrealized_pl(mut self, x: f32) -> Self { self.unrealized_pl = Some(x); self } /// The total amount of commission paid for this instrument over the /// lifetime of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Position pub fn with_commission(mut self, x: f32) -> Self { self.commission = Some(x); self } /// The representation of a Position for a single direction (long or /// short). /// - param PositionSide /// - return Position pub fn with_long(mut self, x: PositionSide) -> Self { self.long = Some(x); self } /// The Position's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return Position pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// Profit/loss realized by the Position since the Account's resettablePL /// was last reset by the client. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Position pub fn with_resettable_pl(mut self, x: f32) -> Self { self.resettable_pl = Some(x); self } /// The total amount of fees charged over the lifetime of the Account for /// the execution of guaranteed Stop Loss Orders for this instrument. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Position pub fn with_guaranteed_execution_fees(mut self, x: f32) -> Self { self.guaranteed_execution_fees = Some(x); self } /// Profit/loss realized by the Position over the lifetime of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Position pub fn with_pl(mut self, x: f32) -> Self { self.pl = Some(x); self } } /// A filter that can be used when fetching Transactions #[derive(Debug, Serialize, Deserialize)] pub enum TransactionFilter { #[serde(rename = "ORDER")] Order, #[serde(rename = "FUNDING")] Funding, #[serde(rename = "ADMIN")] Admin, #[serde(rename = "CREATE")] Create, #[serde(rename = "CLOSE")] Close, #[serde(rename = "REOPEN")] Reopen, #[serde(rename = "CLIENT_CONFIGURE")] ClientConfigure, #[serde(rename = "CLIENT_CONFIGURE_REJECT")] ClientConfigureReject, #[serde(rename = "TRANSFER_FUNDS")] TransferFunds, #[serde(rename = "TRANSFER_FUNDS_REJECT")] TransferFundsReject, #[serde(rename = "MARKET_ORDER")] MarketOrder, #[serde(rename = "MARKET_ORDER_REJECT")] MarketOrderReject, #[serde(rename = "LIMIT_ORDER")] LimitOrder, #[serde(rename = "LIMIT_ORDER_REJECT")] LimitOrderReject, #[serde(rename = "STOP_ORDER")] StopOrder, #[serde(rename = "STOP_ORDER_REJECT")] StopOrderReject, #[serde(rename = "MARKET_IF_TOUCHED_ORDER")] MarketIfTouchedOrder, #[serde(rename = "MARKET_IF_TOUCHED_ORDER_REJECT")] MarketIfTouchedOrderReject, #[serde(rename = "TAKE_PROFIT_ORDER")] TakeProfitOrder, #[serde(rename = "TAKE_PROFIT_ORDER_REJECT")] TakeProfitOrderReject, #[serde(rename = "STOP_LOSS_ORDER")] StopLossOrder, #[serde(rename = "STOP_LOSS_ORDER_REJECT")] StopLossOrderReject, #[serde(rename = "TRAILING_STOP_LOSS_ORDER")] TrailingStopLossOrder, #[serde(rename = "TRAILING_STOP_LOSS_ORDER_REJECT")] TrailingStopLossOrderReject, #[serde(rename = "ONE_CANCELS_ALL_ORDER")] OneCancelsAllOrder, #[serde(rename = "ONE_CANCELS_ALL_ORDER_REJECT")] OneCancelsAllOrderReject, #[serde(rename = "ONE_CANCELS_ALL_ORDER_TRIGGERED")] OneCancelsAllOrderTriggered, #[serde(rename = "ORDER_FILL")] OrderFill, #[serde(rename = "ORDER_CANCEL")] OrderCancel, #[serde(rename = "ORDER_CANCEL_REJECT")] OrderCancelReject, #[serde(rename = "ORDER_CLIENT_EXTENSIONS_MODIFY")] OrderClientExtensionsModify, #[serde(rename = "ORDER_CLIENT_EXTENSIONS_MODIFY_REJECT")] OrderClientExtensionsModifyReject, #[serde(rename = "TRADE_CLIENT_EXTENSIONS_MODIFY")] TradeClientExtensionsModify, #[serde(rename = "TRADE_CLIENT_EXTENSIONS_MODIFY_REJECT")] TradeClientExtensionsModifyReject, #[serde(rename = "MARGIN_CALL_ENTER")] MarginCallEnter, #[serde(rename = "MARGIN_CALL_EXTEND")] MarginCallExtend, #[serde(rename = "MARGIN_CALL_EXIT")] MarginCallExit, #[serde(rename = "DELAYED_TRADE_CLOSURE")] DelayedTradeClosure, #[serde(rename = "DAILY_FINANCING")] DailyFinancing, #[serde(rename = "RESET_RESETTABLE_PL")] ResetResettablePl, } impl FromStr for TransactionFilter { type Err = (); fn from_str(s: &str) -> Result<TransactionFilter, ()> { match s { "ORDER" => Ok(TransactionFilter::Order), "FUNDING" => Ok(TransactionFilter::Funding), "ADMIN" => Ok(TransactionFilter::Admin), "CREATE" => Ok(TransactionFilter::Create), "CLOSE" => Ok(TransactionFilter::Close), "REOPEN" => Ok(TransactionFilter::Reopen), "CLIENT_CONFIGURE" => Ok(TransactionFilter::ClientConfigure), "CLIENT_CONFIGURE_REJECT" => Ok(TransactionFilter::ClientConfigureReject), "TRANSFER_FUNDS" => Ok(TransactionFilter::TransferFunds), "TRANSFER_FUNDS_REJECT" => Ok(TransactionFilter::TransferFundsReject), "MARKET_ORDER" => Ok(TransactionFilter::MarketOrder), "MARKET_ORDER_REJECT" => Ok(TransactionFilter::MarketOrderReject), "LIMIT_ORDER" => Ok(TransactionFilter::LimitOrder), "LIMIT_ORDER_REJECT" => Ok(TransactionFilter::LimitOrderReject), "STOP_ORDER" => Ok(TransactionFilter::StopOrder), "STOP_ORDER_REJECT" => Ok(TransactionFilter::StopOrderReject), "MARKET_IF_TOUCHED_ORDER" => Ok(TransactionFilter::MarketIfTouchedOrder), "MARKET_IF_TOUCHED_ORDER_REJECT" => Ok(TransactionFilter::MarketIfTouchedOrderReject), "TAKE_PROFIT_ORDER" => Ok(TransactionFilter::TakeProfitOrder), "TAKE_PROFIT_ORDER_REJECT" => Ok(TransactionFilter::TakeProfitOrderReject), "STOP_LOSS_ORDER" => Ok(TransactionFilter::StopLossOrder), "STOP_LOSS_ORDER_REJECT" => Ok(TransactionFilter::StopLossOrderReject), "TRAILING_STOP_LOSS_ORDER" => Ok(TransactionFilter::TrailingStopLossOrder), "TRAILING_STOP_LOSS_ORDER_REJECT" => Ok(TransactionFilter::TrailingStopLossOrderReject), "ONE_CANCELS_ALL_ORDER" => Ok(TransactionFilter::OneCancelsAllOrder), "ONE_CANCELS_ALL_ORDER_REJECT" => Ok(TransactionFilter::OneCancelsAllOrderReject), "ONE_CANCELS_ALL_ORDER_TRIGGERED" => Ok(TransactionFilter::OneCancelsAllOrderTriggered), "ORDER_FILL" => Ok(TransactionFilter::OrderFill), "ORDER_CANCEL" => Ok(TransactionFilter::OrderCancel), "ORDER_CANCEL_REJECT" => Ok(TransactionFilter::OrderCancelReject), "ORDER_CLIENT_EXTENSIONS_MODIFY" => Ok(TransactionFilter::OrderClientExtensionsModify), "ORDER_CLIENT_EXTENSIONS_MODIFY_REJECT" => { Ok(TransactionFilter::OrderClientExtensionsModifyReject) } "TRADE_CLIENT_EXTENSIONS_MODIFY" => Ok(TransactionFilter::TradeClientExtensionsModify), "TRADE_CLIENT_EXTENSIONS_MODIFY_REJECT" => { Ok(TransactionFilter::TradeClientExtensionsModifyReject) } "MARGIN_CALL_ENTER" => Ok(TransactionFilter::MarginCallEnter), "MARGIN_CALL_EXTEND" => Ok(TransactionFilter::MarginCallExtend), "MARGIN_CALL_EXIT" => Ok(TransactionFilter::MarginCallExit), "DELAYED_TRADE_CLOSURE" => Ok(TransactionFilter::DelayedTradeClosure), "DAILY_FINANCING" => Ok(TransactionFilter::DailyFinancing), "RESET_RESETTABLE_PL" => Ok(TransactionFilter::ResetResettablePl), _ => Err(()), } } } impl std::fmt::Display for TransactionFilter { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } /// The status of the Price. #[derive(Debug, Serialize, Deserialize)] pub enum PriceStatus { #[serde(rename = "tradeable")] Tradeable, #[serde(rename = "nontradeable")] Nontradeable, #[serde(rename = "invalid")] Invalid, } impl FromStr for PriceStatus { type Err = (); fn from_str(s: &str) -> Result<PriceStatus, ()> { match s { "tradeable" => Ok(PriceStatus::Tradeable), "nontradeable" => Ok(PriceStatus::Nontradeable), "invalid" => Ok(PriceStatus::Invalid), _ => Err(()), } } } impl std::fmt::Display for PriceStatus { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct DynamicOrderState { /// The distance between the Trailing Stop Loss Order's trailingStopValue /// and the current Market Price. This represents the distance (in price /// units) of the Order from a triggering price. If the distance could not /// be determined, this value will not be set. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "triggerDistance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub trigger_distance: Option<f32>, /// True if an exact trigger distance could be calculated. If false, it /// means the provided trigger distance is a best estimate. If the /// distance could not be determined, this value will not be set. #[serde(default)] #[serde( rename = "isTriggerDistanceExact", skip_serializing_if = "Option::is_none" )] pub is_trigger_distance_exact: Option<bool>, /// The Order's ID. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The Order's calculated trailing stop value. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "trailingStopValue", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub trailing_stop_value: Option<f32>, } impl DynamicOrderState { pub fn new() -> DynamicOrderState { DynamicOrderState { trigger_distance: None, is_trigger_distance_exact: None, id: None, trailing_stop_value: None, } } /// The distance between the Trailing Stop Loss Order's trailingStopValue /// and the current Market Price. This represents the distance (in price /// units) of the Order from a triggering price. If the distance could not /// be determined, this value will not be set. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return DynamicOrderState pub fn with_trigger_distance(mut self, x: f32) -> Self { self.trigger_distance = Some(x); self } /// True if an exact trigger distance could be calculated. If false, it /// means the provided trigger distance is a best estimate. If the /// distance could not be determined, this value will not be set. /// - param bool /// - return DynamicOrderState pub fn with_is_trigger_distance_exact(mut self, x: bool) -> Self { self.is_trigger_distance_exact = Some(x); self } /// The Order's ID. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return DynamicOrderState pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The Order's calculated trailing stop value. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return DynamicOrderState pub fn with_trailing_stop_value(mut self, x: f32) -> Self { self.trailing_stop_value = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct ResetResettablePLTransaction { /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "RESET_RESETTABLE_PL" for a /// ResetResettablePLTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl ResetResettablePLTransaction { pub fn new() -> ResetResettablePLTransaction { ResetResettablePLTransaction { user_id: None, batch_id: None, request_id: None, time: None, otype: None, id: None, account_id: None, } } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return ResetResettablePLTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return ResetResettablePLTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return ResetResettablePLTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return ResetResettablePLTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The Type of the Transaction. Always set to "RESET_RESETTABLE_PL" for a /// ResetResettablePLTransaction. /// - param String /// - return ResetResettablePLTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return ResetResettablePLTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return ResetResettablePLTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct DailyFinancingTransaction { /// The amount of financing paid/collected for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "financing", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub financing: Option<f32>, /// The financing paid/collected for each Position in the Account. #[serde(default)] #[serde(rename = "positionFinancings", skip_serializing_if = "Option::is_none")] pub position_financings: Option<Vec<PositionFinancing>>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The Account's balance after daily financing. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "accountBalance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub account_balance: Option<f32>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The account financing mode at the time of the daily financing. #[serde(default)] #[serde( rename = "accountFinancingMode", skip_serializing_if = "Option::is_none" )] pub account_financing_mode: Option<String>, /// The Type of the Transaction. Always set to "DAILY_FINANCING" for a /// DailyFinancingTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl DailyFinancingTransaction { pub fn new() -> DailyFinancingTransaction { DailyFinancingTransaction { financing: None, position_financings: None, user_id: None, batch_id: None, account_balance: None, request_id: None, time: None, account_financing_mode: None, otype: None, id: None, account_id: None, } } /// The amount of financing paid/collected for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return DailyFinancingTransaction pub fn with_financing(mut self, x: f32) -> Self { self.financing = Some(x); self } /// The financing paid/collected for each Position in the Account. /// - param Vec<PositionFinancing> /// - return DailyFinancingTransaction pub fn with_position_financings(mut self, x: Vec<PositionFinancing>) -> Self { self.position_financings = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return DailyFinancingTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return DailyFinancingTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The Account's balance after daily financing. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return DailyFinancingTransaction pub fn with_account_balance(mut self, x: f32) -> Self { self.account_balance = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return DailyFinancingTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return DailyFinancingTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The account financing mode at the time of the daily financing. /// - param String /// - return DailyFinancingTransaction pub fn with_account_financing_mode(mut self, x: String) -> Self { self.account_financing_mode = Some(x); self } /// The Type of the Transaction. Always set to "DAILY_FINANCING" for a /// DailyFinancingTransaction. /// - param String /// - return DailyFinancingTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return DailyFinancingTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return DailyFinancingTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct GuaranteedStopLossOrderLevelRestriction { /// Applies to Trades with a guaranteed Stop Loss Order attached for the /// specified Instrument. This is the total allowed Trade volume that can /// exist within the priceRange based on the trigger prices of the /// guaranteed Stop Loss Orders. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "volume", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub volume: Option<f32>, /// The price range the volume applies to. This value is in price units. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "priceRange", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price_range: Option<f32>, } impl GuaranteedStopLossOrderLevelRestriction { pub fn new() -> GuaranteedStopLossOrderLevelRestriction { GuaranteedStopLossOrderLevelRestriction { volume: None, price_range: None, } } /// Applies to Trades with a guaranteed Stop Loss Order attached for the /// specified Instrument. This is the total allowed Trade volume that can /// exist within the priceRange based on the trigger prices of the /// guaranteed Stop Loss Orders. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return GuaranteedStopLossOrderLevelRestriction pub fn with_volume(mut self, x: f32) -> Self { self.volume = Some(x); self } /// The price range the volume applies to. This value is in price units. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return GuaranteedStopLossOrderLevelRestriction pub fn with_price_range(mut self, x: f32) -> Self { self.price_range = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct OrderClientExtensionsModifyRejectTransaction { /// The ID of the Order who's client extensions are to be modified. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "orderID", skip_serializing_if = "Option::is_none")] pub order_id: Option<String>, /// The original Client ID of the Order who's client extensions are to be /// modified. #[serde(default)] #[serde(rename = "clientOrderID", skip_serializing_if = "Option::is_none")] pub client_order_id: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Reject Transaction was created #[serde(default)] #[serde(rename = "rejectReason", skip_serializing_if = "Option::is_none")] pub reject_reason: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "clientExtensionsModify", skip_serializing_if = "Option::is_none" )] pub client_extensions_modify: Option<ClientExtensions>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensionsModify", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions_modify: Option<ClientExtensions>, /// The Type of the Transaction. Always set to /// "ORDER_CLIENT_EXTENSIONS_MODIFY_REJECT" for a /// OrderClientExtensionsModifyRejectTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl OrderClientExtensionsModifyRejectTransaction { pub fn new() -> OrderClientExtensionsModifyRejectTransaction { OrderClientExtensionsModifyRejectTransaction { order_id: None, client_order_id: None, user_id: None, batch_id: None, reject_reason: None, client_extensions_modify: None, request_id: None, time: None, trade_client_extensions_modify: None, otype: None, id: None, account_id: None, } } /// The ID of the Order who's client extensions are to be modified. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return OrderClientExtensionsModifyRejectTransaction pub fn with_order_id(mut self, x: String) -> Self { self.order_id = Some(x); self } /// The original Client ID of the Order who's client extensions are to be /// modified. /// - param String /// - return OrderClientExtensionsModifyRejectTransaction pub fn with_client_order_id(mut self, x: String) -> Self { self.client_order_id = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return OrderClientExtensionsModifyRejectTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return OrderClientExtensionsModifyRejectTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Reject Transaction was created /// - param String /// - return OrderClientExtensionsModifyRejectTransaction pub fn with_reject_reason(mut self, x: String) -> Self { self.reject_reason = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return OrderClientExtensionsModifyRejectTransaction pub fn with_client_extensions_modify(mut self, x: ClientExtensions) -> Self { self.client_extensions_modify = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return OrderClientExtensionsModifyRejectTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return OrderClientExtensionsModifyRejectTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return OrderClientExtensionsModifyRejectTransaction pub fn with_trade_client_extensions_modify(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions_modify = Some(x); self } /// The Type of the Transaction. Always set to /// "ORDER_CLIENT_EXTENSIONS_MODIFY_REJECT" for a /// OrderClientExtensionsModifyRejectTransaction. /// - param String /// - return OrderClientExtensionsModifyRejectTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return OrderClientExtensionsModifyRejectTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return OrderClientExtensionsModifyRejectTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct HomeConversions { /// The currency to be converted into the home currency. /// format: A string containing an ISO 4217 currency /// (http://en.wikipedia.org/wiki/ISO_4217) #[serde(default)] #[serde(rename = "currency", skip_serializing_if = "Option::is_none")] pub currency: Option<String>, /// The factor used to convert any gains for an Account in the specified /// currency into the Account's home currency. This would include positive /// realized P/L and positive financing amounts. Conversion is performed /// by multiplying the positive P/L by the conversion factor. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "accountGain", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub account_gain: Option<f32>, /// The factor used to convert a Position or Trade Value in the specified /// currency into the Account's home currency. Conversion is performed by /// multiplying the Position or Trade Value by the conversion factor. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "positionValue", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub position_value: Option<f32>, /// The string representation of a decimal number. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "accountLoss", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub account_loss: Option<f32>, } impl HomeConversions { pub fn new() -> HomeConversions { HomeConversions { currency: None, account_gain: None, position_value: None, account_loss: None, } } /// The currency to be converted into the home currency. /// format: A string containing an ISO 4217 currency /// (http://en.wikipedia.org/wiki/ISO_4217) /// - param String /// - return HomeConversions pub fn with_currency(mut self, x: String) -> Self { self.currency = Some(x); self } /// The factor used to convert any gains for an Account in the specified /// currency into the Account's home currency. This would include positive /// realized P/L and positive financing amounts. Conversion is performed /// by multiplying the positive P/L by the conversion factor. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return HomeConversions pub fn with_account_gain(mut self, x: f32) -> Self { self.account_gain = Some(x); self } /// The factor used to convert a Position or Trade Value in the specified /// currency into the Account's home currency. Conversion is performed by /// multiplying the Position or Trade Value by the conversion factor. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return HomeConversions pub fn with_position_value(mut self, x: f32) -> Self { self.position_value = Some(x); self } /// The string representation of a decimal number. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return HomeConversions pub fn with_account_loss(mut self, x: f32) -> Self { self.account_loss = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct MarketOrderMarginCloseout { /// The reason the Market Order was created to perform a margin closeout #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, } impl MarketOrderMarginCloseout { pub fn new() -> MarketOrderMarginCloseout { MarketOrderMarginCloseout { reason: None } } /// The reason the Market Order was created to perform a margin closeout /// - param String /// - return MarketOrderMarginCloseout pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct TakeProfitOrderTransaction { /// The time-in-force requested for the TakeProfit Order. Restricted to /// "GTC", "GFD" and "GTD" for TakeProfit Orders. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Order that this Order replaces (only provided if this /// Order replaces an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacesOrderID", skip_serializing_if = "Option::is_none")] pub replaces_order_id: Option<String>, /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// The price threshold specified for the TakeProfit Order. The associated /// Trade will be closed by a market price that is equal to or better than /// this threshold. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The client ID of the Trade to be closed when the price threshold is /// breached. #[serde(default)] #[serde(rename = "clientTradeID", skip_serializing_if = "Option::is_none")] pub client_trade_id: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Take Profit Order was initiated #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The ID of the OrderFill Transaction that caused this Order to be /// created (only provided if this Order was created automatically when /// another Order was filled). /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "orderFillTransactionID", skip_serializing_if = "Option::is_none" )] pub order_fill_transaction_id: Option<String>, /// The ID of the Transaction that cancels the replaced Order (only /// provided if this Order replaces an existing Order). /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "cancellingTransactionID", skip_serializing_if = "Option::is_none" )] pub cancelling_transaction_id: Option<String>, /// The date/time when the TakeProfit Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "TAKE_PROFIT_ORDER" in a /// TakeProfitOrderTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl TakeProfitOrderTransaction { pub fn new() -> TakeProfitOrderTransaction { TakeProfitOrderTransaction { time_in_force: None, trigger_condition: None, replaces_order_id: None, trade_id: None, price: None, client_trade_id: None, user_id: None, batch_id: None, reason: None, request_id: None, client_extensions: None, time: None, order_fill_transaction_id: None, cancelling_transaction_id: None, gtd_time: None, otype: None, id: None, account_id: None, } } /// The time-in-force requested for the TakeProfit Order. Restricted to /// "GTC", "GFD" and "GTD" for TakeProfit Orders. /// - param String /// - return TakeProfitOrderTransaction pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return TakeProfitOrderTransaction pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Order that this Order replaces (only provided if this /// Order replaces an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return TakeProfitOrderTransaction pub fn with_replaces_order_id(mut self, x: String) -> Self { self.replaces_order_id = Some(x); self } /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TakeProfitOrderTransaction pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// The price threshold specified for the TakeProfit Order. The associated /// Trade will be closed by a market price that is equal to or better than /// this threshold. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return TakeProfitOrderTransaction pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The client ID of the Trade to be closed when the price threshold is /// breached. /// - param String /// - return TakeProfitOrderTransaction pub fn with_client_trade_id(mut self, x: String) -> Self { self.client_trade_id = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return TakeProfitOrderTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TakeProfitOrderTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Take Profit Order was initiated /// - param String /// - return TakeProfitOrderTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return TakeProfitOrderTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return TakeProfitOrderTransaction pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TakeProfitOrderTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The ID of the OrderFill Transaction that caused this Order to be /// created (only provided if this Order was created automatically when /// another Order was filled). /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TakeProfitOrderTransaction pub fn with_order_fill_transaction_id(mut self, x: String) -> Self { self.order_fill_transaction_id = Some(x); self } /// The ID of the Transaction that cancels the replaced Order (only /// provided if this Order replaces an existing Order). /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TakeProfitOrderTransaction pub fn with_cancelling_transaction_id(mut self, x: String) -> Self { self.cancelling_transaction_id = Some(x); self } /// The date/time when the TakeProfit Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TakeProfitOrderTransaction pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } /// The Type of the Transaction. Always set to "TAKE_PROFIT_ORDER" in a /// TakeProfitOrderTransaction. /// - param String /// - return TakeProfitOrderTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TakeProfitOrderTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return TakeProfitOrderTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct OrderCancelTransaction { /// The ID of the Order cancelled /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "orderID", skip_serializing_if = "Option::is_none")] pub order_id: Option<String>, /// The client ID of the Order cancelled (only provided if the Order has a /// client Order ID). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "clientOrderID", skip_serializing_if = "Option::is_none")] pub client_order_id: Option<String>, /// The ID of the Order that replaced this Order (only provided if this /// Order was cancelled for replacement). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacedByOrderID", skip_serializing_if = "Option::is_none")] pub replaced_by_order_id: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Order was cancelled. #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "ORDER_CANCEL" for an /// OrderCancelTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl OrderCancelTransaction { pub fn new() -> OrderCancelTransaction { OrderCancelTransaction { order_id: None, client_order_id: None, replaced_by_order_id: None, user_id: None, batch_id: None, reason: None, request_id: None, time: None, otype: None, id: None, account_id: None, } } /// The ID of the Order cancelled /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return OrderCancelTransaction pub fn with_order_id(mut self, x: String) -> Self { self.order_id = Some(x); self } /// The client ID of the Order cancelled (only provided if the Order has a /// client Order ID). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return OrderCancelTransaction pub fn with_client_order_id(mut self, x: String) -> Self { self.client_order_id = Some(x); self } /// The ID of the Order that replaced this Order (only provided if this /// Order was cancelled for replacement). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return OrderCancelTransaction pub fn with_replaced_by_order_id(mut self, x: String) -> Self { self.replaced_by_order_id = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return OrderCancelTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return OrderCancelTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Order was cancelled. /// - param String /// - return OrderCancelTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return OrderCancelTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return OrderCancelTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The Type of the Transaction. Always set to "ORDER_CANCEL" for an /// OrderCancelTransaction. /// - param String /// - return OrderCancelTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return OrderCancelTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return OrderCancelTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct AccountSummary { /// The date/time that the Account's resettablePL was last reset. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "resettablePLTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub resettable_pl_time: Option<DateTime<Utc>>, /// Margin currently used for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_used: Option<f32>, /// The value of the Account's open positions as used for margin closeout /// calculations represented in the Account's home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginCloseoutPositionValue", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_position_value: Option<f32>, /// The number of times that the Account's current margin call was /// extended. #[serde(default)] #[serde( rename = "marginCallExtensionCount", skip_serializing_if = "Option::is_none" )] pub margin_call_extension_count: Option<i32>, /// The home currency of the Account /// format: A string containing an ISO 4217 currency /// (http://en.wikipedia.org/wiki/ISO_4217) #[serde(default)] #[serde(rename = "currency", skip_serializing_if = "Option::is_none")] pub currency: Option<String>, /// The total realized profit/loss for the Account since it was last reset /// by the client. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "resettablePL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub resettable_pl: Option<f32>, /// The net asset value of the Account. Equal to Account balance + /// unrealizedPL. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "NAV", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub nav: Option<f32>, /// The date/time of the Account's last margin call extension. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "lastMarginCallExtensionTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub last_margin_call_extension_time: Option<DateTime<Utc>>, /// The Account's margin closeout margin used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginCloseoutMarginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_margin_used: Option<f32>, /// The number of Trades currently open in the Account. #[serde(default)] #[serde(rename = "openTradeCount", skip_serializing_if = "Option::is_none")] pub open_trade_count: Option<i32>, /// The Account's identifier /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The number of Positions currently open in the Account. #[serde(default)] #[serde(rename = "openPositionCount", skip_serializing_if = "Option::is_none")] pub open_position_count: Option<i32>, /// The Account's margin closeout NAV. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginCloseoutNAV", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_nav: Option<f32>, /// The Account's margin closeout percentage. When this value is 1.0 or /// above the Account is in a margin closeout situation. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginCloseoutPercent", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_percent: Option<f32>, /// The Account's margin call margin used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginCallMarginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_call_margin_used: Option<f32>, /// The total amount of commission paid over the lifetime of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "commission", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub commission: Option<f32>, /// Flag indicating that the Account has hedging enabled. #[serde(default)] #[serde(rename = "hedgingEnabled", skip_serializing_if = "Option::is_none")] pub hedging_enabled: Option<bool>, /// The value of the Account's open positions represented in the Account's /// home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "positionValue", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub position_value: Option<f32>, /// The total profit/loss realized over the lifetime of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "pl", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub pl: Option<f32>, /// The current guaranteed Stop Loss Order mode of the Account. #[serde(default)] #[serde( rename = "guaranteedStopLossOrderMode", skip_serializing_if = "Option::is_none" )] pub guaranteed_stop_loss_order_mode: Option<String>, /// The ID of the last Transaction created for the Account. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "lastTransactionID", skip_serializing_if = "Option::is_none")] pub last_transaction_id: Option<String>, /// Margin available for Account currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginAvailable", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_available: Option<f32>, /// Client-provided margin rate override for the Account. The effective /// margin rate of the Account is the lesser of this value and the OANDA /// margin rate for the Account's division. This value is only provided if /// a margin rate override exists for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginRate", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_rate: Option<f32>, /// The Account's margin call percentage. When this value is 1.0 or above /// the Account is in a margin call situation. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginCallPercent", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_call_percent: Option<f32>, /// The date/time when the Account entered a margin call state. Only /// provided if the Account is in a margin call. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "marginCallEnterTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub margin_call_enter_time: Option<DateTime<Utc>>, /// The total amount of fees charged over the lifetime of the Account for /// the execution of guaranteed Stop Loss Orders. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "guaranteedExecutionFees", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub guaranteed_execution_fees: Option<f32>, /// The total amount of financing paid/collected over the lifetime of the /// Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "financing", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub financing: Option<f32>, /// The current balance of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "balance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub balance: Option<f32>, /// The number of Orders currently pending in the Account. #[serde(default)] #[serde(rename = "pendingOrderCount", skip_serializing_if = "Option::is_none")] pub pending_order_count: Option<i32>, /// The current WithdrawalLimit for the account which will be zero or a /// positive value indicating how much can be withdrawn from the account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "withdrawalLimit", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub withdrawal_limit: Option<f32>, /// The total unrealized profit/loss for all Trades currently open in the /// Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "unrealizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub unrealized_pl: Option<f32>, /// Client-assigned alias for the Account. Only provided if the Account /// has an alias set #[serde(default)] #[serde(rename = "alias", skip_serializing_if = "Option::is_none")] pub alias: Option<String>, /// ID of the user that created the Account. #[serde(default)] #[serde(rename = "createdByUserID", skip_serializing_if = "Option::is_none")] pub created_by_user_id: Option<i32>, /// The Account's margin closeout unrealized PL. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginCloseoutUnrealizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_unrealized_pl: Option<f32>, /// The date/time when the Account was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "createdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub created_time: Option<DateTime<Utc>>, /// The date/time of the last order that was filled for this account. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "lastOrderFillTimestamp", skip_serializing_if = "Option::is_none", with = "serdates" )] pub last_order_fill_timestamp: Option<DateTime<Utc>>, } impl AccountSummary { pub fn new() -> AccountSummary { AccountSummary { resettable_pl_time: None, margin_used: None, margin_closeout_position_value: None, margin_call_extension_count: None, currency: None, resettable_pl: None, nav: None, last_margin_call_extension_time: None, margin_closeout_margin_used: None, open_trade_count: None, id: None, open_position_count: None, margin_closeout_nav: None, margin_closeout_percent: None, margin_call_margin_used: None, commission: None, hedging_enabled: None, position_value: None, pl: None, guaranteed_stop_loss_order_mode: None, last_transaction_id: None, margin_available: None, margin_rate: None, margin_call_percent: None, margin_call_enter_time: None, guaranteed_execution_fees: None, financing: None, balance: None, pending_order_count: None, withdrawal_limit: None, unrealized_pl: None, alias: None, created_by_user_id: None, margin_closeout_unrealized_pl: None, created_time: None, last_order_fill_timestamp: None, } } /// The date/time that the Account's resettablePL was last reset. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return AccountSummary pub fn with_resettable_pl_time(mut self, x: DateTime<Utc>) -> Self { self.resettable_pl_time = Some(x); self } /// Margin currently used for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountSummary pub fn with_margin_used(mut self, x: f32) -> Self { self.margin_used = Some(x); self } /// The value of the Account's open positions as used for margin closeout /// calculations represented in the Account's home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return AccountSummary pub fn with_margin_closeout_position_value(mut self, x: f32) -> Self { self.margin_closeout_position_value = Some(x); self } /// The number of times that the Account's current margin call was /// extended. /// - param i32 /// - return AccountSummary pub fn with_margin_call_extension_count(mut self, x: i32) -> Self { self.margin_call_extension_count = Some(x); self } /// The home currency of the Account /// format: A string containing an ISO 4217 currency /// (http://en.wikipedia.org/wiki/ISO_4217) /// - param String /// - return AccountSummary pub fn with_currency(mut self, x: String) -> Self { self.currency = Some(x); self } /// The total realized profit/loss for the Account since it was last reset /// by the client. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountSummary pub fn with_resettable_pl(mut self, x: f32) -> Self { self.resettable_pl = Some(x); self } /// The net asset value of the Account. Equal to Account balance + /// unrealizedPL. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountSummary pub fn with_nav(mut self, x: f32) -> Self { self.nav = Some(x); self } /// The date/time of the Account's last margin call extension. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return AccountSummary pub fn with_last_margin_call_extension_time(mut self, x: DateTime<Utc>) -> Self { self.last_margin_call_extension_time = Some(x); self } /// The Account's margin closeout margin used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountSummary pub fn with_margin_closeout_margin_used(mut self, x: f32) -> Self { self.margin_closeout_margin_used = Some(x); self } /// The number of Trades currently open in the Account. /// - param i32 /// - return AccountSummary pub fn with_open_trade_count(mut self, x: i32) -> Self { self.open_trade_count = Some(x); self } /// The Account's identifier /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return AccountSummary pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The number of Positions currently open in the Account. /// - param i32 /// - return AccountSummary pub fn with_open_position_count(mut self, x: i32) -> Self { self.open_position_count = Some(x); self } /// The Account's margin closeout NAV. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountSummary pub fn with_margin_closeout_nav(mut self, x: f32) -> Self { self.margin_closeout_nav = Some(x); self } /// The Account's margin closeout percentage. When this value is 1.0 or /// above the Account is in a margin closeout situation. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return AccountSummary pub fn with_margin_closeout_percent(mut self, x: f32) -> Self { self.margin_closeout_percent = Some(x); self } /// The Account's margin call margin used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountSummary pub fn with_margin_call_margin_used(mut self, x: f32) -> Self { self.margin_call_margin_used = Some(x); self } /// The total amount of commission paid over the lifetime of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountSummary pub fn with_commission(mut self, x: f32) -> Self { self.commission = Some(x); self } /// Flag indicating that the Account has hedging enabled. /// - param bool /// - return AccountSummary pub fn with_hedging_enabled(mut self, x: bool) -> Self { self.hedging_enabled = Some(x); self } /// The value of the Account's open positions represented in the Account's /// home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountSummary pub fn with_position_value(mut self, x: f32) -> Self { self.position_value = Some(x); self } /// The total profit/loss realized over the lifetime of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountSummary pub fn with_pl(mut self, x: f32) -> Self { self.pl = Some(x); self } /// The current guaranteed Stop Loss Order mode of the Account. /// - param String /// - return AccountSummary pub fn with_guaranteed_stop_loss_order_mode(mut self, x: String) -> Self { self.guaranteed_stop_loss_order_mode = Some(x); self } /// The ID of the last Transaction created for the Account. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return AccountSummary pub fn with_last_transaction_id(mut self, x: String) -> Self { self.last_transaction_id = Some(x); self } /// Margin available for Account currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountSummary pub fn with_margin_available(mut self, x: f32) -> Self { self.margin_available = Some(x); self } /// Client-provided margin rate override for the Account. The effective /// margin rate of the Account is the lesser of this value and the OANDA /// margin rate for the Account's division. This value is only provided if /// a margin rate override exists for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return AccountSummary pub fn with_margin_rate(mut self, x: f32) -> Self { self.margin_rate = Some(x); self } /// The Account's margin call percentage. When this value is 1.0 or above /// the Account is in a margin call situation. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return AccountSummary pub fn with_margin_call_percent(mut self, x: f32) -> Self { self.margin_call_percent = Some(x); self } /// The date/time when the Account entered a margin call state. Only /// provided if the Account is in a margin call. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return AccountSummary pub fn with_margin_call_enter_time(mut self, x: DateTime<Utc>) -> Self { self.margin_call_enter_time = Some(x); self } /// The total amount of fees charged over the lifetime of the Account for /// the execution of guaranteed Stop Loss Orders. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountSummary pub fn with_guaranteed_execution_fees(mut self, x: f32) -> Self { self.guaranteed_execution_fees = Some(x); self } /// The total amount of financing paid/collected over the lifetime of the /// Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountSummary pub fn with_financing(mut self, x: f32) -> Self { self.financing = Some(x); self } /// The current balance of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountSummary pub fn with_balance(mut self, x: f32) -> Self { self.balance = Some(x); self } /// The number of Orders currently pending in the Account. /// - param i32 /// - return AccountSummary pub fn with_pending_order_count(mut self, x: i32) -> Self { self.pending_order_count = Some(x); self } /// The current WithdrawalLimit for the account which will be zero or a /// positive value indicating how much can be withdrawn from the account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountSummary pub fn with_withdrawal_limit(mut self, x: f32) -> Self { self.withdrawal_limit = Some(x); self } /// The total unrealized profit/loss for all Trades currently open in the /// Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountSummary pub fn with_unrealized_pl(mut self, x: f32) -> Self { self.unrealized_pl = Some(x); self } /// Client-assigned alias for the Account. Only provided if the Account /// has an alias set /// - param String /// - return AccountSummary pub fn with_alias(mut self, x: String) -> Self { self.alias = Some(x); self } /// ID of the user that created the Account. /// - param i32 /// - return AccountSummary pub fn with_created_by_user_id(mut self, x: i32) -> Self { self.created_by_user_id = Some(x); self } /// The Account's margin closeout unrealized PL. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return AccountSummary pub fn with_margin_closeout_unrealized_pl(mut self, x: f32) -> Self { self.margin_closeout_unrealized_pl = Some(x); self } /// The date/time when the Account was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return AccountSummary pub fn with_created_time(mut self, x: DateTime<Utc>) -> Self { self.created_time = Some(x); self } /// The date/time of the last order that was filled for this account. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return AccountSummary pub fn with_last_order_fill_timestamp(mut self, x: DateTime<Utc>) -> Self { self.last_order_fill_timestamp = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct MarketIfTouchedOrderRequest { /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The price threshold specified for the MarketIfTouched Order. The /// MarketIfTouched Order will only be filled by a market price that /// crosses this price from the direction of the market price at the time /// when the Order was created (the initialMarketPrice). Depending on the /// value of the Order's price and initialMarketPrice, the /// MarketIfTouchedOrder will behave like a Limit or a Stop Order. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The worst market price that may be used to fill this MarketIfTouched /// Order. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "priceBound", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price_bound: Option<f32>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// The time-in-force requested for the MarketIfTouched Order. Restricted /// to "GTC", "GFD" and "GTD" for MarketIfTouched Orders. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The MarketIfTouched Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// The quantity requested to be filled by the MarketIfTouched Order. A /// posititive number of units results in a long Order, and a negative /// number of units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// The date/time when the MarketIfTouched Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, /// The type of the Order to Create. Must be set to "MARKET_IF_TOUCHED" /// when creating a Market If Touched Order. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, } impl MarketIfTouchedOrderRequest { pub fn new() -> MarketIfTouchedOrderRequest { MarketIfTouchedOrderRequest { trigger_condition: None, price: None, price_bound: None, take_profit_on_fill: None, time_in_force: None, instrument: None, trade_client_extensions: None, client_extensions: None, trailing_stop_loss_on_fill: None, units: None, stop_loss_on_fill: None, gtd_time: None, otype: None, position_fill: None, } } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return MarketIfTouchedOrderRequest pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The price threshold specified for the MarketIfTouched Order. The /// MarketIfTouched Order will only be filled by a market price that /// crosses this price from the direction of the market price at the time /// when the Order was created (the initialMarketPrice). Depending on the /// value of the Order's price and initialMarketPrice, the /// MarketIfTouchedOrder will behave like a Limit or a Stop Order. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return MarketIfTouchedOrderRequest pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The worst market price that may be used to fill this MarketIfTouched /// Order. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return MarketIfTouchedOrderRequest pub fn with_price_bound(mut self, x: f32) -> Self { self.price_bound = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return MarketIfTouchedOrderRequest pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// The time-in-force requested for the MarketIfTouched Order. Restricted /// to "GTC", "GFD" and "GTD" for MarketIfTouched Orders. /// - param String /// - return MarketIfTouchedOrderRequest pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The MarketIfTouched Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return MarketIfTouchedOrderRequest pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return MarketIfTouchedOrderRequest pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return MarketIfTouchedOrderRequest pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return MarketIfTouchedOrderRequest pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// The quantity requested to be filled by the MarketIfTouched Order. A /// posititive number of units results in a long Order, and a negative /// number of units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return MarketIfTouchedOrderRequest pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return MarketIfTouchedOrderRequest pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// The date/time when the MarketIfTouched Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarketIfTouchedOrderRequest pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } /// The type of the Order to Create. Must be set to "MARKET_IF_TOUCHED" /// when creating a Market If Touched Order. /// - param String /// - return MarketIfTouchedOrderRequest pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return MarketIfTouchedOrderRequest pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct AccountChanges { /// The Trades reduced. #[serde(default)] #[serde(rename = "tradesReduced", skip_serializing_if = "Option::is_none")] pub trades_reduced: Option<Vec<TradeSummary>>, /// The Trades opened. #[serde(default)] #[serde(rename = "tradesOpened", skip_serializing_if = "Option::is_none")] pub trades_opened: Option<Vec<TradeSummary>>, /// The Orders filled. #[serde(default)] #[serde(rename = "ordersFilled", skip_serializing_if = "Option::is_none")] pub orders_filled: Option<Vec<Order>>, /// The Transactions that have been generated. #[serde(default)] #[serde(rename = "transactions", skip_serializing_if = "Option::is_none")] pub transactions: Option<Vec<Transaction>>, /// The Orders created. These Orders may have been filled, cancelled or /// triggered in the same period. #[serde(default)] #[serde(rename = "ordersCreated", skip_serializing_if = "Option::is_none")] pub orders_created: Option<Vec<Order>>, /// The Positions changed. #[serde(default)] #[serde(rename = "positions", skip_serializing_if = "Option::is_none")] pub positions: Option<Vec<Position>>, /// The Orders triggered. #[serde(default)] #[serde(rename = "ordersTriggered", skip_serializing_if = "Option::is_none")] pub orders_triggered: Option<Vec<Order>>, /// The Orders cancelled. #[serde(default)] #[serde(rename = "ordersCancelled", skip_serializing_if = "Option::is_none")] pub orders_cancelled: Option<Vec<Order>>, /// The Trades closed. #[serde(default)] #[serde(rename = "tradesClosed", skip_serializing_if = "Option::is_none")] pub trades_closed: Option<Vec<TradeSummary>>, } impl AccountChanges { pub fn new() -> AccountChanges { AccountChanges { trades_reduced: None, trades_opened: None, orders_filled: None, transactions: None, orders_created: None, positions: None, orders_triggered: None, orders_cancelled: None, trades_closed: None, } } /// The Trades reduced. /// - param Vec<TradeSummary> /// - return AccountChanges pub fn with_trades_reduced(mut self, x: Vec<TradeSummary>) -> Self { self.trades_reduced = Some(x); self } /// The Trades opened. /// - param Vec<TradeSummary> /// - return AccountChanges pub fn with_trades_opened(mut self, x: Vec<TradeSummary>) -> Self { self.trades_opened = Some(x); self } /// The Orders filled. /// - param Vec<Order> /// - return AccountChanges pub fn with_orders_filled(mut self, x: Vec<Order>) -> Self { self.orders_filled = Some(x); self } /// The Transactions that have been generated. /// - param Vec<Transaction> /// - return AccountChanges pub fn with_transactions(mut self, x: Vec<Transaction>) -> Self { self.transactions = Some(x); self } /// The Orders created. These Orders may have been filled, cancelled or /// triggered in the same period. /// - param Vec<Order> /// - return AccountChanges pub fn with_orders_created(mut self, x: Vec<Order>) -> Self { self.orders_created = Some(x); self } /// The Positions changed. /// - param Vec<Position> /// - return AccountChanges pub fn with_positions(mut self, x: Vec<Position>) -> Self { self.positions = Some(x); self } /// The Orders triggered. /// - param Vec<Order> /// - return AccountChanges pub fn with_orders_triggered(mut self, x: Vec<Order>) -> Self { self.orders_triggered = Some(x); self } /// The Orders cancelled. /// - param Vec<Order> /// - return AccountChanges pub fn with_orders_cancelled(mut self, x: Vec<Order>) -> Self { self.orders_cancelled = Some(x); self } /// The Trades closed. /// - param Vec<TradeSummary> /// - return AccountChanges pub fn with_trades_closed(mut self, x: Vec<TradeSummary>) -> Self { self.trades_closed = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct TakeProfitOrderRejectTransaction { /// The time-in-force requested for the TakeProfit Order. Restricted to /// "GTC", "GFD" and "GTD" for TakeProfit Orders. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Order that this Order was intended to replace (only /// provided if this Order was intended to replace an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde( rename = "intendedReplacesOrderID", skip_serializing_if = "Option::is_none" )] pub intended_replaces_order_id: Option<String>, /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// The price threshold specified for the TakeProfit Order. The associated /// Trade will be closed by a market price that is equal to or better than /// this threshold. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The client ID of the Trade to be closed when the price threshold is /// breached. #[serde(default)] #[serde(rename = "clientTradeID", skip_serializing_if = "Option::is_none")] pub client_trade_id: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Reject Transaction was created #[serde(default)] #[serde(rename = "rejectReason", skip_serializing_if = "Option::is_none")] pub reject_reason: Option<String>, /// The reason that the Take Profit Order was initiated #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The ID of the OrderFill Transaction that caused this Order to be /// created (only provided if this Order was created automatically when /// another Order was filled). /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "orderFillTransactionID", skip_serializing_if = "Option::is_none" )] pub order_fill_transaction_id: Option<String>, /// The date/time when the TakeProfit Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "TAKE_PROFIT_ORDER_REJECT" /// in a TakeProfitOrderRejectTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl TakeProfitOrderRejectTransaction { pub fn new() -> TakeProfitOrderRejectTransaction { TakeProfitOrderRejectTransaction { time_in_force: None, trigger_condition: None, intended_replaces_order_id: None, trade_id: None, price: None, client_trade_id: None, user_id: None, batch_id: None, reject_reason: None, reason: None, request_id: None, client_extensions: None, time: None, order_fill_transaction_id: None, gtd_time: None, otype: None, id: None, account_id: None, } } /// The time-in-force requested for the TakeProfit Order. Restricted to /// "GTC", "GFD" and "GTD" for TakeProfit Orders. /// - param String /// - return TakeProfitOrderRejectTransaction pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return TakeProfitOrderRejectTransaction pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Order that this Order was intended to replace (only /// provided if this Order was intended to replace an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return TakeProfitOrderRejectTransaction pub fn with_intended_replaces_order_id(mut self, x: String) -> Self { self.intended_replaces_order_id = Some(x); self } /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TakeProfitOrderRejectTransaction pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// The price threshold specified for the TakeProfit Order. The associated /// Trade will be closed by a market price that is equal to or better than /// this threshold. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return TakeProfitOrderRejectTransaction pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The client ID of the Trade to be closed when the price threshold is /// breached. /// - param String /// - return TakeProfitOrderRejectTransaction pub fn with_client_trade_id(mut self, x: String) -> Self { self.client_trade_id = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return TakeProfitOrderRejectTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TakeProfitOrderRejectTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Reject Transaction was created /// - param String /// - return TakeProfitOrderRejectTransaction pub fn with_reject_reason(mut self, x: String) -> Self { self.reject_reason = Some(x); self } /// The reason that the Take Profit Order was initiated /// - param String /// - return TakeProfitOrderRejectTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return TakeProfitOrderRejectTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return TakeProfitOrderRejectTransaction pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TakeProfitOrderRejectTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The ID of the OrderFill Transaction that caused this Order to be /// created (only provided if this Order was created automatically when /// another Order was filled). /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TakeProfitOrderRejectTransaction pub fn with_order_fill_transaction_id(mut self, x: String) -> Self { self.order_fill_transaction_id = Some(x); self } /// The date/time when the TakeProfit Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TakeProfitOrderRejectTransaction pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } /// The Type of the Transaction. Always set to "TAKE_PROFIT_ORDER_REJECT" /// in a TakeProfitOrderRejectTransaction. /// - param String /// - return TakeProfitOrderRejectTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TakeProfitOrderRejectTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return TakeProfitOrderRejectTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct TakeProfitOrderRequest { /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// The price threshold specified for the TakeProfit Order. The associated /// Trade will be closed by a market price that is equal to or better than /// this threshold. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The time-in-force requested for the TakeProfit Order. Restricted to /// "GTC", "GFD" and "GTD" for TakeProfit Orders. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The client ID of the Trade to be closed when the price threshold is /// breached. #[serde(default)] #[serde(rename = "clientTradeID", skip_serializing_if = "Option::is_none")] pub client_trade_id: Option<String>, /// The date/time when the TakeProfit Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, /// The type of the Order to Create. Must be set to "TAKE_PROFIT" when /// creating a Take Profit Order. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, } impl TakeProfitOrderRequest { pub fn new() -> TakeProfitOrderRequest { TakeProfitOrderRequest { trigger_condition: None, trade_id: None, price: None, time_in_force: None, client_extensions: None, client_trade_id: None, gtd_time: None, otype: None, } } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return TakeProfitOrderRequest pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TakeProfitOrderRequest pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// The price threshold specified for the TakeProfit Order. The associated /// Trade will be closed by a market price that is equal to or better than /// this threshold. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return TakeProfitOrderRequest pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The time-in-force requested for the TakeProfit Order. Restricted to /// "GTC", "GFD" and "GTD" for TakeProfit Orders. /// - param String /// - return TakeProfitOrderRequest pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return TakeProfitOrderRequest pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The client ID of the Trade to be closed when the price threshold is /// breached. /// - param String /// - return TakeProfitOrderRequest pub fn with_client_trade_id(mut self, x: String) -> Self { self.client_trade_id = Some(x); self } /// The date/time when the TakeProfit Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TakeProfitOrderRequest pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } /// The type of the Order to Create. Must be set to "TAKE_PROFIT" when /// creating a Take Profit Order. /// - param String /// - return TakeProfitOrderRequest pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct CreateTransaction { /// The ID of the user that the Account was created for #[serde(default)] #[serde(rename = "accountUserID", skip_serializing_if = "Option::is_none")] pub account_user_id: Option<i32>, /// The number of the Account within the site/division/user #[serde(default)] #[serde(rename = "accountNumber", skip_serializing_if = "Option::is_none")] pub account_number: Option<i32>, /// The home currency of the Account /// format: A string containing an ISO 4217 currency /// (http://en.wikipedia.org/wiki/ISO_4217) #[serde(default)] #[serde(rename = "homeCurrency", skip_serializing_if = "Option::is_none")] pub home_currency: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The ID of the Site that the Account was created at #[serde(default)] #[serde(rename = "siteID", skip_serializing_if = "Option::is_none")] pub site_id: Option<i32>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The ID of the Division that the Account is in #[serde(default)] #[serde(rename = "divisionID", skip_serializing_if = "Option::is_none")] pub division_id: Option<i32>, /// The Type of the Transaction. Always set to "CREATE" in a /// CreateTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl CreateTransaction { pub fn new() -> CreateTransaction { CreateTransaction { account_user_id: None, account_number: None, home_currency: None, user_id: None, batch_id: None, site_id: None, request_id: None, time: None, division_id: None, otype: None, id: None, account_id: None, } } /// The ID of the user that the Account was created for /// - param i32 /// - return CreateTransaction pub fn with_account_user_id(mut self, x: i32) -> Self { self.account_user_id = Some(x); self } /// The number of the Account within the site/division/user /// - param i32 /// - return CreateTransaction pub fn with_account_number(mut self, x: i32) -> Self { self.account_number = Some(x); self } /// The home currency of the Account /// format: A string containing an ISO 4217 currency /// (http://en.wikipedia.org/wiki/ISO_4217) /// - param String /// - return CreateTransaction pub fn with_home_currency(mut self, x: String) -> Self { self.home_currency = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return CreateTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return CreateTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The ID of the Site that the Account was created at /// - param i32 /// - return CreateTransaction pub fn with_site_id(mut self, x: i32) -> Self { self.site_id = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return CreateTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return CreateTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The ID of the Division that the Account is in /// - param i32 /// - return CreateTransaction pub fn with_division_id(mut self, x: i32) -> Self { self.division_id = Some(x); self } /// The Type of the Transaction. Always set to "CREATE" in a /// CreateTransaction. /// - param String /// - return CreateTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return CreateTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return CreateTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct StopLossDetails { /// Specifies the distance (in price units) from the Trade's open price to /// use as the Stop Loss Order price. Only one of the distance and price /// fields may be specified. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "distance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub distance: Option<f32>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The price that the Stop Loss Order will be triggered at. Only one of /// the price and distance fields may be specified. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// Flag indicating that the price for the Stop Loss Order is guaranteed. /// The default value depends on the GuaranteedStopLossOrderMode of the /// account, if it is REQUIRED, the default will be true, for DISABLED or /// ENABLED the default is false. #[serde(default)] #[serde(rename = "guaranteed", skip_serializing_if = "Option::is_none")] pub guaranteed: Option<bool>, /// The time in force for the created Stop Loss Order. This may only be /// GTC, GTD or GFD. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The date when the Stop Loss Order will be cancelled on if timeInForce /// is GTD. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, } impl StopLossDetails { pub fn new() -> StopLossDetails { StopLossDetails { distance: None, client_extensions: None, price: None, guaranteed: None, time_in_force: None, gtd_time: None, } } /// Specifies the distance (in price units) from the Trade's open price to /// use as the Stop Loss Order price. Only one of the distance and price /// fields may be specified. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return StopLossDetails pub fn with_distance(mut self, x: f32) -> Self { self.distance = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return StopLossDetails pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The price that the Stop Loss Order will be triggered at. Only one of /// the price and distance fields may be specified. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return StopLossDetails pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// Flag indicating that the price for the Stop Loss Order is guaranteed. /// The default value depends on the GuaranteedStopLossOrderMode of the /// account, if it is REQUIRED, the default will be true, for DISABLED or /// ENABLED the default is false. /// - param bool /// - return StopLossDetails pub fn with_guaranteed(mut self, x: bool) -> Self { self.guaranteed = Some(x); self } /// The time in force for the created Stop Loss Order. This may only be /// GTC, GTD or GFD. /// - param String /// - return StopLossDetails pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The date when the Stop Loss Order will be cancelled on if timeInForce /// is GTD. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopLossDetails pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct MarginCallExitTransaction { /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "MARGIN_CALL_EXIT" for an /// MarginCallExitTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl MarginCallExitTransaction { pub fn new() -> MarginCallExitTransaction { MarginCallExitTransaction { user_id: None, batch_id: None, request_id: None, time: None, otype: None, id: None, account_id: None, } } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return MarginCallExitTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarginCallExitTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return MarginCallExitTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarginCallExitTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The Type of the Transaction. Always set to "MARGIN_CALL_EXIT" for an /// MarginCallExitTransaction. /// - param String /// - return MarginCallExitTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarginCallExitTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return MarginCallExitTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } /// The reason that the Take Profit Order was initiated #[derive(Debug, Serialize, Deserialize)] pub enum TakeProfitOrderReason { #[serde(rename = "CLIENT_ORDER")] ClientOrder, #[serde(rename = "REPLACEMENT")] Replacement, #[serde(rename = "ON_FILL")] OnFill, } impl FromStr for TakeProfitOrderReason { type Err = (); fn from_str(s: &str) -> Result<TakeProfitOrderReason, ()> { match s { "CLIENT_ORDER" => Ok(TakeProfitOrderReason::ClientOrder), "REPLACEMENT" => Ok(TakeProfitOrderReason::Replacement), "ON_FILL" => Ok(TakeProfitOrderReason::OnFill), _ => Err(()), } } } impl std::fmt::Display for TakeProfitOrderReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } /// The overall behaviour of the Account regarding guaranteed Stop Loss /// Orders. #[derive(Debug, Serialize, Deserialize)] pub enum GuaranteedStopLossOrderMode { #[serde(rename = "DISABLED")] Disabled, #[serde(rename = "ALLOWED")] Allowed, #[serde(rename = "REQUIRED")] Required, } impl FromStr for GuaranteedStopLossOrderMode { type Err = (); fn from_str(s: &str) -> Result<GuaranteedStopLossOrderMode, ()> { match s { "DISABLED" => Ok(GuaranteedStopLossOrderMode::Disabled), "ALLOWED" => Ok(GuaranteedStopLossOrderMode::Allowed), "REQUIRED" => Ok(GuaranteedStopLossOrderMode::Required), _ => Err(()), } } } impl std::fmt::Display for GuaranteedStopLossOrderMode { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } /// The state to filter the requested Orders by. #[derive(Debug, Serialize, Deserialize)] pub enum OrderStateFilter { #[serde(rename = "PENDING")] Pending, #[serde(rename = "FILLED")] Filled, #[serde(rename = "TRIGGERED")] Triggered, #[serde(rename = "CANCELLED")] Cancelled, #[serde(rename = "ALL")] All, } impl FromStr for OrderStateFilter { type Err = (); fn from_str(s: &str) -> Result<OrderStateFilter, ()> { match s { "PENDING" => Ok(OrderStateFilter::Pending), "FILLED" => Ok(OrderStateFilter::Filled), "TRIGGERED" => Ok(OrderStateFilter::Triggered), "CANCELLED" => Ok(OrderStateFilter::Cancelled), "ALL" => Ok(OrderStateFilter::All), _ => Err(()), } } } impl std::fmt::Display for OrderStateFilter { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct MarketOrderTransaction { /// A MarketOrderPositionCloseout specifies the extensions to a Market /// Order when it has been created to closeout a specific Position. #[serde(default)] #[serde( rename = "longPositionCloseout", skip_serializing_if = "Option::is_none" )] pub long_position_closeout: Option<MarketOrderPositionCloseout>, /// A MarketOrderPositionCloseout specifies the extensions to a Market /// Order when it has been created to closeout a specific Position. #[serde(default)] #[serde( rename = "shortPositionCloseout", skip_serializing_if = "Option::is_none" )] pub short_position_closeout: Option<MarketOrderPositionCloseout>, /// The time-in-force requested for the Market Order. Restricted to FOK or /// IOC for a MarketOrder. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, /// The worst price that the client is willing to have the Market Order /// filled at. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "priceBound", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price_bound: Option<f32>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The Market Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The quantity requested to be filled by the Market Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// The Type of the Transaction. Always set to "MARKET_ORDER" in a /// MarketOrderTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// Details for the Market Order extensions specific to a Market Order /// placed with the intent of fully closing a specific open trade that /// should have already been closed but wasn't due to halted market /// conditions #[serde(default)] #[serde(rename = "delayedTradeClose", skip_serializing_if = "Option::is_none")] pub delayed_trade_close: Option<MarketOrderDelayedTradeClose>, /// The reason that the Market Order was created #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// A MarketOrderTradeClose specifies the extensions to a Market Order /// that has been created specifically to close a Trade. #[serde(default)] #[serde(rename = "tradeClose", skip_serializing_if = "Option::is_none")] pub trade_close: Option<MarketOrderTradeClose>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// Details for the Market Order extensions specific to a Market Order /// placed that is part of a Market Order Margin Closeout in a client's /// account #[serde(default)] #[serde(rename = "marginCloseout", skip_serializing_if = "Option::is_none")] pub margin_closeout: Option<MarketOrderMarginCloseout>, } impl MarketOrderTransaction { pub fn new() -> MarketOrderTransaction { MarketOrderTransaction { long_position_closeout: None, short_position_closeout: None, time_in_force: None, request_id: None, id: None, position_fill: None, price_bound: None, user_id: None, instrument: None, units: None, otype: None, account_id: None, stop_loss_on_fill: None, batch_id: None, delayed_trade_close: None, reason: None, trade_close: None, trailing_stop_loss_on_fill: None, client_extensions: None, take_profit_on_fill: None, trade_client_extensions: None, time: None, margin_closeout: None, } } /// A MarketOrderPositionCloseout specifies the extensions to a Market /// Order when it has been created to closeout a specific Position. /// - param MarketOrderPositionCloseout /// - return MarketOrderTransaction pub fn with_long_position_closeout(mut self, x: MarketOrderPositionCloseout) -> Self { self.long_position_closeout = Some(x); self } /// A MarketOrderPositionCloseout specifies the extensions to a Market /// Order when it has been created to closeout a specific Position. /// - param MarketOrderPositionCloseout /// - return MarketOrderTransaction pub fn with_short_position_closeout(mut self, x: MarketOrderPositionCloseout) -> Self { self.short_position_closeout = Some(x); self } /// The time-in-force requested for the Market Order. Restricted to FOK or /// IOC for a MarketOrder. /// - param String /// - return MarketOrderTransaction pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return MarketOrderTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarketOrderTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return MarketOrderTransaction pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } /// The worst price that the client is willing to have the Market Order /// filled at. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return MarketOrderTransaction pub fn with_price_bound(mut self, x: f32) -> Self { self.price_bound = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return MarketOrderTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The Market Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return MarketOrderTransaction pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The quantity requested to be filled by the Market Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return MarketOrderTransaction pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// The Type of the Transaction. Always set to "MARKET_ORDER" in a /// MarketOrderTransaction. /// - param String /// - return MarketOrderTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return MarketOrderTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return MarketOrderTransaction pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarketOrderTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// Details for the Market Order extensions specific to a Market Order /// placed with the intent of fully closing a specific open trade that /// should have already been closed but wasn't due to halted market /// conditions /// - param MarketOrderDelayedTradeClose /// - return MarketOrderTransaction pub fn with_delayed_trade_close(mut self, x: MarketOrderDelayedTradeClose) -> Self { self.delayed_trade_close = Some(x); self } /// The reason that the Market Order was created /// - param String /// - return MarketOrderTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// A MarketOrderTradeClose specifies the extensions to a Market Order /// that has been created specifically to close a Trade. /// - param MarketOrderTradeClose /// - return MarketOrderTransaction pub fn with_trade_close(mut self, x: MarketOrderTradeClose) -> Self { self.trade_close = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return MarketOrderTransaction pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return MarketOrderTransaction pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return MarketOrderTransaction pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return MarketOrderTransaction pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarketOrderTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// Details for the Market Order extensions specific to a Market Order /// placed that is part of a Market Order Margin Closeout in a client's /// account /// - param MarketOrderMarginCloseout /// - return MarketOrderTransaction pub fn with_margin_closeout(mut self, x: MarketOrderMarginCloseout) -> Self { self.margin_closeout = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct OrderRequest {} impl OrderRequest { pub fn new() -> OrderRequest { OrderRequest {} } } /// The reason that the Limit Order was initiated #[derive(Debug, Serialize, Deserialize)] pub enum LimitOrderReason { #[serde(rename = "CLIENT_ORDER")] ClientOrder, #[serde(rename = "REPLACEMENT")] Replacement, } impl FromStr for LimitOrderReason { type Err = (); fn from_str(s: &str) -> Result<LimitOrderReason, ()> { match s { "CLIENT_ORDER" => Ok(LimitOrderReason::ClientOrder), "REPLACEMENT" => Ok(LimitOrderReason::Replacement), _ => Err(()), } } } impl std::fmt::Display for LimitOrderReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } /// The current state of the Trade. #[derive(Debug, Serialize, Deserialize)] pub enum TradeState { #[serde(rename = "OPEN")] Open, #[serde(rename = "CLOSED")] Closed, #[serde(rename = "CLOSE_WHEN_TRADEABLE")] CloseWhenTradeable, } impl FromStr for TradeState { type Err = (); fn from_str(s: &str) -> Result<TradeState, ()> { match s { "OPEN" => Ok(TradeState::Open), "CLOSED" => Ok(TradeState::Closed), "CLOSE_WHEN_TRADEABLE" => Ok(TradeState::CloseWhenTradeable), _ => Err(()), } } } impl std::fmt::Display for TradeState { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } /// The reason that the Market Order was created to perform a margin /// closeout #[derive(Debug, Serialize, Deserialize)] pub enum MarketOrderMarginCloseoutReason { #[serde(rename = "MARGIN_CHECK_VIOLATION")] MarginCheckViolation, #[serde(rename = "REGULATORY_MARGIN_CALL_VIOLATION")] RegulatoryMarginCallViolation, #[serde(rename = "REGULATORY_MARGIN_CHECK_VIOLATION")] RegulatoryMarginCheckViolation, } impl FromStr for MarketOrderMarginCloseoutReason { type Err = (); fn from_str(s: &str) -> Result<MarketOrderMarginCloseoutReason, ()> { match s { "MARGIN_CHECK_VIOLATION" => Ok(MarketOrderMarginCloseoutReason::MarginCheckViolation), "REGULATORY_MARGIN_CALL_VIOLATION" => { Ok(MarketOrderMarginCloseoutReason::RegulatoryMarginCallViolation) } "REGULATORY_MARGIN_CHECK_VIOLATION" => { Ok(MarketOrderMarginCloseoutReason::RegulatoryMarginCheckViolation) } _ => Err(()), } } } impl std::fmt::Display for MarketOrderMarginCloseoutReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct Transaction { /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl Transaction { pub fn new() -> Transaction { Transaction { user_id: None, batch_id: None, request_id: None, time: None, id: None, account_id: None, } } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return Transaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return Transaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return Transaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return Transaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return Transaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return Transaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct QuoteHomeConversionFactors { /// The factor used to convert a negative amount of the Price's /// Instrument's quote currency into a negative amount of the Account's /// home currency. Conversion is performed by multiplying the quote units /// by the conversion factor. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "negativeUnits", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub negative_units: Option<f32>, /// The factor used to convert a positive amount of the Price's /// Instrument's quote currency into a positive amount of the Account's /// home currency. Conversion is performed by multiplying the quote units /// by the conversion factor. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "positiveUnits", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub positive_units: Option<f32>, } impl QuoteHomeConversionFactors { pub fn new() -> QuoteHomeConversionFactors { QuoteHomeConversionFactors { negative_units: None, positive_units: None, } } /// The factor used to convert a negative amount of the Price's /// Instrument's quote currency into a negative amount of the Account's /// home currency. Conversion is performed by multiplying the quote units /// by the conversion factor. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return QuoteHomeConversionFactors pub fn with_negative_units(mut self, x: f32) -> Self { self.negative_units = Some(x); self } /// The factor used to convert a positive amount of the Price's /// Instrument's quote currency into a positive amount of the Account's /// home currency. Conversion is performed by multiplying the quote units /// by the conversion factor. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return QuoteHomeConversionFactors pub fn with_positive_units(mut self, x: f32) -> Self { self.positive_units = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct OrderBookBucket { /// The lowest price (inclusive) covered by the bucket. The bucket covers /// the price range from the price to price + the order book's /// bucketWidth. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The percentage of the total number of orders represented by the short /// orders found in this bucket. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "shortCountPercent", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub short_count_percent: Option<f32>, /// The percentage of the total number of orders represented by the long /// orders found in this bucket. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "longCountPercent", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub long_count_percent: Option<f32>, } impl OrderBookBucket { pub fn new() -> OrderBookBucket { OrderBookBucket { price: None, short_count_percent: None, long_count_percent: None, } } /// The lowest price (inclusive) covered by the bucket. The bucket covers /// the price range from the price to price + the order book's /// bucketWidth. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return OrderBookBucket pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The percentage of the total number of orders represented by the short /// orders found in this bucket. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return OrderBookBucket pub fn with_short_count_percent(mut self, x: f32) -> Self { self.short_count_percent = Some(x); self } /// The percentage of the total number of orders represented by the long /// orders found in this bucket. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return OrderBookBucket pub fn with_long_count_percent(mut self, x: f32) -> Self { self.long_count_percent = Some(x); self } } /// The reason that the Fixed Price Order was created #[derive(Debug, Serialize, Deserialize)] pub enum FixedPriceOrderReason { #[serde(rename = "PLATFORM_ACCOUNT_MIGRATION")] PlatformAccountMigration, } impl FromStr for FixedPriceOrderReason { type Err = (); fn from_str(s: &str) -> Result<FixedPriceOrderReason, ()> { match s { "PLATFORM_ACCOUNT_MIGRATION" => Ok(FixedPriceOrderReason::PlatformAccountMigration), _ => Err(()), } } } impl std::fmt::Display for FixedPriceOrderReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct TransferFundsTransaction { /// An optional comment that may be attached to a fund transfer for audit /// purposes #[serde(default)] #[serde(rename = "comment", skip_serializing_if = "Option::is_none")] pub comment: Option<String>, /// The reason that an Account is being funded. #[serde(default)] #[serde(rename = "fundingReason", skip_serializing_if = "Option::is_none")] pub funding_reason: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The Account's balance after funds are transferred. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "accountBalance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub account_balance: Option<f32>, /// The amount to deposit/withdraw from the Account in the Account's home /// currency. A positive value indicates a deposit, a negative value /// indicates a withdrawal. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "amount", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub amount: Option<f32>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "TRANSFER_FUNDS" in a /// TransferFundsTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl TransferFundsTransaction { pub fn new() -> TransferFundsTransaction { TransferFundsTransaction { comment: None, funding_reason: None, user_id: None, batch_id: None, account_balance: None, amount: None, request_id: None, time: None, otype: None, id: None, account_id: None, } } /// An optional comment that may be attached to a fund transfer for audit /// purposes /// - param String /// - return TransferFundsTransaction pub fn with_comment(mut self, x: String) -> Self { self.comment = Some(x); self } /// The reason that an Account is being funded. /// - param String /// - return TransferFundsTransaction pub fn with_funding_reason(mut self, x: String) -> Self { self.funding_reason = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return TransferFundsTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TransferFundsTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The Account's balance after funds are transferred. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return TransferFundsTransaction pub fn with_account_balance(mut self, x: f32) -> Self { self.account_balance = Some(x); self } /// The amount to deposit/withdraw from the Account in the Account's home /// currency. A positive value indicates a deposit, a negative value /// indicates a withdrawal. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return TransferFundsTransaction pub fn with_amount(mut self, x: f32) -> Self { self.amount = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return TransferFundsTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TransferFundsTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The Type of the Transaction. Always set to "TRANSFER_FUNDS" in a /// TransferFundsTransaction. /// - param String /// - return TransferFundsTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TransferFundsTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return TransferFundsTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct GuaranteedStopLossOrderEntryData { /// A GuaranteedStopLossOrderLevelRestriction represents the total /// position size that can exist within a given price window for Trades /// with guaranteed Stop Loss Orders attached for a specific Instrument. #[serde(default)] #[serde(rename = "levelRestriction", skip_serializing_if = "Option::is_none")] pub level_restriction: Option<GuaranteedStopLossOrderLevelRestriction>, /// The minimum distance allowed between the Trade's fill price and the /// configured price for guaranteed Stop Loss Orders created for this /// instrument. Specified in price units. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "minimumDistance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub minimum_distance: Option<f32>, /// The amount that is charged to the account if a guaranteed Stop Loss /// Order is triggered and filled. The value is in price units and is /// charged for each unit of the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "premium", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub premium: Option<f32>, } impl GuaranteedStopLossOrderEntryData { pub fn new() -> GuaranteedStopLossOrderEntryData { GuaranteedStopLossOrderEntryData { level_restriction: None, minimum_distance: None, premium: None, } } /// A GuaranteedStopLossOrderLevelRestriction represents the total /// position size that can exist within a given price window for Trades /// with guaranteed Stop Loss Orders attached for a specific Instrument. /// - param GuaranteedStopLossOrderLevelRestriction /// - return GuaranteedStopLossOrderEntryData pub fn with_level_restriction(mut self, x: GuaranteedStopLossOrderLevelRestriction) -> Self { self.level_restriction = Some(x); self } /// The minimum distance allowed between the Trade's fill price and the /// configured price for guaranteed Stop Loss Orders created for this /// instrument. Specified in price units. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return GuaranteedStopLossOrderEntryData pub fn with_minimum_distance(mut self, x: f32) -> Self { self.minimum_distance = Some(x); self } /// The amount that is charged to the account if a guaranteed Stop Loss /// Order is triggered and filled. The value is in price units and is /// charged for each unit of the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return GuaranteedStopLossOrderEntryData pub fn with_premium(mut self, x: f32) -> Self { self.premium = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct StopLossOrderRequest { /// Specifies the distance (in price units) from the Account's current /// price to use as the Stop Loss Order price. If the Trade is short the /// Instrument's bid price is used, and for long Trades the ask is used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "distance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub distance: Option<f32>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// The price threshold specified for the Stop Loss Order. If the /// guaranteed flag is false, the associated Trade will be closed by a /// market price that is equal to or worse than this threshold. If the /// flag is true the associated Trade will be closed at this price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// Flag indicating that the Stop Loss Order is guaranteed. The default /// value depends on the GuaranteedStopLossOrderMode of the account, if it /// is REQUIRED, the default will be true, for DISABLED or ENABLED the /// default is false. #[serde(default)] #[serde(rename = "guaranteed", skip_serializing_if = "Option::is_none")] pub guaranteed: Option<bool>, /// The time-in-force requested for the StopLoss Order. Restricted to /// "GTC", "GFD" and "GTD" for StopLoss Orders. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The client ID of the Trade to be closed when the price threshold is /// breached. #[serde(default)] #[serde(rename = "clientTradeID", skip_serializing_if = "Option::is_none")] pub client_trade_id: Option<String>, /// The date/time when the StopLoss Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, /// The type of the Order to Create. Must be set to "STOP_LOSS" when /// creating a Stop Loss Order. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, } impl StopLossOrderRequest { pub fn new() -> StopLossOrderRequest { StopLossOrderRequest { distance: None, trigger_condition: None, trade_id: None, price: None, guaranteed: None, time_in_force: None, client_extensions: None, client_trade_id: None, gtd_time: None, otype: None, } } /// Specifies the distance (in price units) from the Account's current /// price to use as the Stop Loss Order price. If the Trade is short the /// Instrument's bid price is used, and for long Trades the ask is used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return StopLossOrderRequest pub fn with_distance(mut self, x: f32) -> Self { self.distance = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return StopLossOrderRequest pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return StopLossOrderRequest pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// The price threshold specified for the Stop Loss Order. If the /// guaranteed flag is false, the associated Trade will be closed by a /// market price that is equal to or worse than this threshold. If the /// flag is true the associated Trade will be closed at this price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return StopLossOrderRequest pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// Flag indicating that the Stop Loss Order is guaranteed. The default /// value depends on the GuaranteedStopLossOrderMode of the account, if it /// is REQUIRED, the default will be true, for DISABLED or ENABLED the /// default is false. /// - param bool /// - return StopLossOrderRequest pub fn with_guaranteed(mut self, x: bool) -> Self { self.guaranteed = Some(x); self } /// The time-in-force requested for the StopLoss Order. Restricted to /// "GTC", "GFD" and "GTD" for StopLoss Orders. /// - param String /// - return StopLossOrderRequest pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return StopLossOrderRequest pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The client ID of the Trade to be closed when the price threshold is /// breached. /// - param String /// - return StopLossOrderRequest pub fn with_client_trade_id(mut self, x: String) -> Self { self.client_trade_id = Some(x); self } /// The date/time when the StopLoss Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopLossOrderRequest pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } /// The type of the Order to Create. Must be set to "STOP_LOSS" when /// creating a Stop Loss Order. /// - param String /// - return StopLossOrderRequest pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct OrderBook { /// The partitioned order book, divided into buckets using a default /// bucket width. These buckets are only provided for price ranges which /// actually contain order or position data. #[serde(default)] #[serde(rename = "buckets", skip_serializing_if = "Option::is_none")] pub buckets: Option<Vec<OrderBookBucket>>, /// The order book's instrument /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The price (midpoint) for the order book's instrument at the time of /// the order book snapshot /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The price width for each bucket. Each bucket covers the price range /// from the bucket's price to the bucket's price + bucketWidth. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "bucketWidth", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub bucket_width: Option<f32>, /// The time when the order book snapshot was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, } impl OrderBook { pub fn new() -> OrderBook { OrderBook { buckets: None, instrument: None, price: None, bucket_width: None, time: None, } } /// The partitioned order book, divided into buckets using a default /// bucket width. These buckets are only provided for price ranges which /// actually contain order or position data. /// - param Vec<OrderBookBucket> /// - return OrderBook pub fn with_buckets(mut self, x: Vec<OrderBookBucket>) -> Self { self.buckets = Some(x); self } /// The order book's instrument /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return OrderBook pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The price (midpoint) for the order book's instrument at the time of /// the order book snapshot /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return OrderBook pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The price width for each bucket. Each bucket covers the price range /// from the bucket's price to the bucket's price + bucketWidth. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return OrderBook pub fn with_bucket_width(mut self, x: f32) -> Self { self.bucket_width = Some(x); self } /// The time when the order book snapshot was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return OrderBook pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct CalculatedPositionState { /// The unrealized profit/loss of the Position's short open Trades /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "shortUnrealizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub short_unrealized_pl: Option<f32>, /// The Position's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// Margin currently used by the Position. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_used: Option<f32>, /// The Position's net unrealized profit/loss /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "netUnrealizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub net_unrealized_pl: Option<f32>, /// The unrealized profit/loss of the Position's long open Trades /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "longUnrealizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub long_unrealized_pl: Option<f32>, } impl CalculatedPositionState { pub fn new() -> CalculatedPositionState { CalculatedPositionState { short_unrealized_pl: None, instrument: None, margin_used: None, net_unrealized_pl: None, long_unrealized_pl: None, } } /// The unrealized profit/loss of the Position's short open Trades /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return CalculatedPositionState pub fn with_short_unrealized_pl(mut self, x: f32) -> Self { self.short_unrealized_pl = Some(x); self } /// The Position's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return CalculatedPositionState pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// Margin currently used by the Position. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return CalculatedPositionState pub fn with_margin_used(mut self, x: f32) -> Self { self.margin_used = Some(x); self } /// The Position's net unrealized profit/loss /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return CalculatedPositionState pub fn with_net_unrealized_pl(mut self, x: f32) -> Self { self.net_unrealized_pl = Some(x); self } /// The unrealized profit/loss of the Position's long open Trades /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return CalculatedPositionState pub fn with_long_unrealized_pl(mut self, x: f32) -> Self { self.long_unrealized_pl = Some(x); self } } /// The type of an Instrument. #[derive(Debug, Serialize, Deserialize)] pub enum InstrumentType { #[serde(rename = "CURRENCY")] Currency, #[serde(rename = "CFD")] Cfd, #[serde(rename = "METAL")] Metal, } impl FromStr for InstrumentType { type Err = (); fn from_str(s: &str) -> Result<InstrumentType, ()> { match s { "CURRENCY" => Ok(InstrumentType::Currency), "CFD" => Ok(InstrumentType::Cfd), "METAL" => Ok(InstrumentType::Metal), _ => Err(()), } } } impl std::fmt::Display for InstrumentType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct UnitsAvailable { /// Representation of many units of an Instrument are available to be /// traded for both long and short Orders. #[serde(default)] #[serde(rename = "default", skip_serializing_if = "Option::is_none")] pub default: Option<UnitsAvailableDetails>, /// Representation of many units of an Instrument are available to be /// traded for both long and short Orders. #[serde(default)] #[serde(rename = "reduceOnly", skip_serializing_if = "Option::is_none")] pub reduce_only: Option<UnitsAvailableDetails>, /// Representation of many units of an Instrument are available to be /// traded for both long and short Orders. #[serde(default)] #[serde(rename = "openOnly", skip_serializing_if = "Option::is_none")] pub open_only: Option<UnitsAvailableDetails>, /// Representation of many units of an Instrument are available to be /// traded for both long and short Orders. #[serde(default)] #[serde(rename = "reduceFirst", skip_serializing_if = "Option::is_none")] pub reduce_first: Option<UnitsAvailableDetails>, } impl UnitsAvailable { pub fn new() -> UnitsAvailable { UnitsAvailable { default: None, reduce_only: None, open_only: None, reduce_first: None, } } /// Representation of many units of an Instrument are available to be /// traded for both long and short Orders. /// - param UnitsAvailableDetails /// - return UnitsAvailable pub fn with_default(mut self, x: UnitsAvailableDetails) -> Self { self.default = Some(x); self } /// Representation of many units of an Instrument are available to be /// traded for both long and short Orders. /// - param UnitsAvailableDetails /// - return UnitsAvailable pub fn with_reduce_only(mut self, x: UnitsAvailableDetails) -> Self { self.reduce_only = Some(x); self } /// Representation of many units of an Instrument are available to be /// traded for both long and short Orders. /// - param UnitsAvailableDetails /// - return UnitsAvailable pub fn with_open_only(mut self, x: UnitsAvailableDetails) -> Self { self.open_only = Some(x); self } /// Representation of many units of an Instrument are available to be /// traded for both long and short Orders. /// - param UnitsAvailableDetails /// - return UnitsAvailable pub fn with_reduce_first(mut self, x: UnitsAvailableDetails) -> Self { self.reduce_first = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct PriceBucket { /// The Price offered by the PriceBucket /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The amount of liquidity offered by the PriceBucket #[serde(default)] #[serde(rename = "liquidity", skip_serializing_if = "Option::is_none")] pub liquidity: Option<i32>, } impl PriceBucket { pub fn new() -> PriceBucket { PriceBucket { price: None, liquidity: None, } } /// The Price offered by the PriceBucket /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return PriceBucket pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The amount of liquidity offered by the PriceBucket /// - param i32 /// - return PriceBucket pub fn with_liquidity(mut self, x: i32) -> Self { self.liquidity = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct Trade { /// The financing paid/collected for this Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "financing", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub financing: Option<f32>, /// The date/time when the Trade was opened. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "openTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub open_time: Option<DateTime<Utc>>, /// A TakeProfitOrder is an order that is linked to an open Trade and /// created with a price threshold. The Order will be filled (closing the /// Trade) by the first price that is equal to or better than the /// threshold. A TakeProfitOrder cannot be used to open a new Position. #[serde(default)] #[serde(rename = "takeProfitOrder", skip_serializing_if = "Option::is_none")] pub take_profit_order: Option<TakeProfitOrder>, /// Margin currently used by the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_used: Option<f32>, /// The execution price of the Trade. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The unrealized profit/loss on the open portion of the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "unrealizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub unrealized_pl: Option<f32>, /// The total profit/loss realized on the closed portion of the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "realizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub realized_pl: Option<f32>, /// A TrailingStopLossOrder is an order that is linked to an open Trade /// and created with a price distance. The price distance is used to /// calculate a trailing stop value for the order that is in the losing /// direction from the market price at the time of the order's creation. /// The trailing stop value will follow the market price as it moves in /// the winning direction, and the order will filled (closing the Trade) /// by the first price that is equal to or worse than the trailing stop /// value. A TrailingStopLossOrder cannot be used to open a new Position. #[serde(default)] #[serde( rename = "trailingStopLossOrder", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_order: Option<TrailingStopLossOrder>, /// The date/time when the Trade was fully closed. Only provided for /// Trades whose state is CLOSED. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "closeTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub close_time: Option<DateTime<Utc>>, /// The Trade's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The current state of the Trade. #[serde(default)] #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option<String>, /// The margin required at the time the Trade was created. Note, this is /// the 'pure' margin required, it is not the 'effective' margin used that /// factors in the trade risk if a GSLO is attached to the trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "initialMarginRequired", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub initial_margin_required: Option<f32>, /// The initial size of the Trade. Negative values indicate a short Trade, /// and positive values indicate a long Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "initialUnits", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub initial_units: Option<f32>, /// The average closing price of the Trade. Only present if the Trade has /// been closed or reduced at least once. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "averageClosePrice", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub average_close_price: Option<f32>, /// The number of units currently open for the Trade. This value is /// reduced to 0.0 as the Trade is closed. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "currentUnits", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub current_units: Option<f32>, /// The IDs of the Transactions that have closed portions of this Trade. #[serde(default)] #[serde( rename = "closingTransactionIDs", skip_serializing_if = "Option::is_none" )] pub closing_transaction_i_ds: Option<Vec<String>>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The Trade's identifier, unique within the Trade's Account. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// A StopLossOrder is an order that is linked to an open Trade and /// created with a price threshold. The Order will be filled (closing the /// Trade) by the first price that is equal to or worse than the /// threshold. A StopLossOrder cannot be used to open a new Position. #[serde(default)] #[serde(rename = "stopLossOrder", skip_serializing_if = "Option::is_none")] pub stop_loss_order: Option<StopLossOrder>, } impl Trade { pub fn new() -> Trade { Trade { financing: None, open_time: None, take_profit_order: None, margin_used: None, price: None, unrealized_pl: None, realized_pl: None, trailing_stop_loss_order: None, close_time: None, instrument: None, state: None, initial_margin_required: None, initial_units: None, average_close_price: None, current_units: None, closing_transaction_i_ds: None, client_extensions: None, id: None, stop_loss_order: None, } } /// The financing paid/collected for this Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Trade pub fn with_financing(mut self, x: f32) -> Self { self.financing = Some(x); self } /// The date/time when the Trade was opened. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return Trade pub fn with_open_time(mut self, x: DateTime<Utc>) -> Self { self.open_time = Some(x); self } /// A TakeProfitOrder is an order that is linked to an open Trade and /// created with a price threshold. The Order will be filled (closing the /// Trade) by the first price that is equal to or better than the /// threshold. A TakeProfitOrder cannot be used to open a new Position. /// - param TakeProfitOrder /// - return Trade pub fn with_take_profit_order(mut self, x: TakeProfitOrder) -> Self { self.take_profit_order = Some(x); self } /// Margin currently used by the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Trade pub fn with_margin_used(mut self, x: f32) -> Self { self.margin_used = Some(x); self } /// The execution price of the Trade. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return Trade pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The unrealized profit/loss on the open portion of the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Trade pub fn with_unrealized_pl(mut self, x: f32) -> Self { self.unrealized_pl = Some(x); self } /// The total profit/loss realized on the closed portion of the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Trade pub fn with_realized_pl(mut self, x: f32) -> Self { self.realized_pl = Some(x); self } /// A TrailingStopLossOrder is an order that is linked to an open Trade /// and created with a price distance. The price distance is used to /// calculate a trailing stop value for the order that is in the losing /// direction from the market price at the time of the order's creation. /// The trailing stop value will follow the market price as it moves in /// the winning direction, and the order will filled (closing the Trade) /// by the first price that is equal to or worse than the trailing stop /// value. A TrailingStopLossOrder cannot be used to open a new Position. /// - param TrailingStopLossOrder /// - return Trade pub fn with_trailing_stop_loss_order(mut self, x: TrailingStopLossOrder) -> Self { self.trailing_stop_loss_order = Some(x); self } /// The date/time when the Trade was fully closed. Only provided for /// Trades whose state is CLOSED. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return Trade pub fn with_close_time(mut self, x: DateTime<Utc>) -> Self { self.close_time = Some(x); self } /// The Trade's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return Trade pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The current state of the Trade. /// - param String /// - return Trade pub fn with_state(mut self, x: String) -> Self { self.state = Some(x); self } /// The margin required at the time the Trade was created. Note, this is /// the 'pure' margin required, it is not the 'effective' margin used that /// factors in the trade risk if a GSLO is attached to the trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return Trade pub fn with_initial_margin_required(mut self, x: f32) -> Self { self.initial_margin_required = Some(x); self } /// The initial size of the Trade. Negative values indicate a short Trade, /// and positive values indicate a long Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return Trade pub fn with_initial_units(mut self, x: f32) -> Self { self.initial_units = Some(x); self } /// The average closing price of the Trade. Only present if the Trade has /// been closed or reduced at least once. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return Trade pub fn with_average_close_price(mut self, x: f32) -> Self { self.average_close_price = Some(x); self } /// The number of units currently open for the Trade. This value is /// reduced to 0.0 as the Trade is closed. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return Trade pub fn with_current_units(mut self, x: f32) -> Self { self.current_units = Some(x); self } /// The IDs of the Transactions that have closed portions of this Trade. /// - param Vec<String> /// - return Trade pub fn with_closing_transaction_i_ds(mut self, x: Vec<String>) -> Self { self.closing_transaction_i_ds = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return Trade pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The Trade's identifier, unique within the Trade's Account. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return Trade pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// A StopLossOrder is an order that is linked to an open Trade and /// created with a price threshold. The Order will be filled (closing the /// Trade) by the first price that is equal to or worse than the /// threshold. A StopLossOrder cannot be used to open a new Position. /// - param StopLossOrder /// - return Trade pub fn with_stop_loss_order(mut self, x: StopLossOrder) -> Self { self.stop_loss_order = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct CandlestickData { /// The highest price in the time-range represented by the candlestick. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "h", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub h: Option<f32>, /// The last (closing) price in the time-range represented by the /// candlestick. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "c", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub c: Option<f32>, /// The lowest price in the time-range represented by the candlestick. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "l", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub l: Option<f32>, /// The first (open) price in the time-range represented by the /// candlestick. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "o", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub o: Option<f32>, } impl CandlestickData { pub fn new() -> CandlestickData { CandlestickData { h: None, c: None, l: None, o: None, } } /// The highest price in the time-range represented by the candlestick. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return CandlestickData pub fn with_h(mut self, x: f32) -> Self { self.h = Some(x); self } /// The last (closing) price in the time-range represented by the /// candlestick. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return CandlestickData pub fn with_c(mut self, x: f32) -> Self { self.c = Some(x); self } /// The lowest price in the time-range represented by the candlestick. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return CandlestickData pub fn with_l(mut self, x: f32) -> Self { self.l = Some(x); self } /// The first (open) price in the time-range represented by the /// candlestick. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return CandlestickData pub fn with_o(mut self, x: f32) -> Self { self.o = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct FixedPriceOrderTransaction { /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// The price specified for the Fixed Price Order. This price is the exact /// price that the Fixed Price Order will be filled at. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The Fixed Price Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The reason that the Fixed Price Order was created #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The quantity requested to be filled by the Fixed Price Order. A /// posititive number of units results in a long Order, and a negative /// number of units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// The state that the trade resulting from the Fixed Price Order should /// be set to. #[serde(default)] #[serde(rename = "tradeState", skip_serializing_if = "Option::is_none")] pub trade_state: Option<String>, /// The Type of the Transaction. Always set to "FIXED_PRICE_ORDER" in a /// FixedPriceOrderTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl FixedPriceOrderTransaction { pub fn new() -> FixedPriceOrderTransaction { FixedPriceOrderTransaction { client_extensions: None, trailing_stop_loss_on_fill: None, price: None, stop_loss_on_fill: None, user_id: None, take_profit_on_fill: None, batch_id: None, instrument: None, reason: None, position_fill: None, trade_client_extensions: None, request_id: None, time: None, units: None, trade_state: None, otype: None, id: None, account_id: None, } } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return FixedPriceOrderTransaction pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return FixedPriceOrderTransaction pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// The price specified for the Fixed Price Order. This price is the exact /// price that the Fixed Price Order will be filled at. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return FixedPriceOrderTransaction pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return FixedPriceOrderTransaction pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return FixedPriceOrderTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return FixedPriceOrderTransaction pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return FixedPriceOrderTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The Fixed Price Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return FixedPriceOrderTransaction pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The reason that the Fixed Price Order was created /// - param String /// - return FixedPriceOrderTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return FixedPriceOrderTransaction pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return FixedPriceOrderTransaction pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return FixedPriceOrderTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return FixedPriceOrderTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The quantity requested to be filled by the Fixed Price Order. A /// posititive number of units results in a long Order, and a negative /// number of units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return FixedPriceOrderTransaction pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// The state that the trade resulting from the Fixed Price Order should /// be set to. /// - param String /// - return FixedPriceOrderTransaction pub fn with_trade_state(mut self, x: String) -> Self { self.trade_state = Some(x); self } /// The Type of the Transaction. Always set to "FIXED_PRICE_ORDER" in a /// FixedPriceOrderTransaction. /// - param String /// - return FixedPriceOrderTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return FixedPriceOrderTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return FixedPriceOrderTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct MarginCallExtendTransaction { /// The number of the extensions to the Account's current margin call that /// have been applied. This value will be set to 1 for the first /// MarginCallExtend Transaction #[serde(default)] #[serde(rename = "extensionNumber", skip_serializing_if = "Option::is_none")] pub extension_number: Option<i32>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "MARGIN_CALL_EXTEND" for an /// MarginCallExtendTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl MarginCallExtendTransaction { pub fn new() -> MarginCallExtendTransaction { MarginCallExtendTransaction { extension_number: None, user_id: None, batch_id: None, request_id: None, time: None, otype: None, id: None, account_id: None, } } /// The number of the extensions to the Account's current margin call that /// have been applied. This value will be set to 1 for the first /// MarginCallExtend Transaction /// - param i32 /// - return MarginCallExtendTransaction pub fn with_extension_number(mut self, x: i32) -> Self { self.extension_number = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return MarginCallExtendTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarginCallExtendTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return MarginCallExtendTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarginCallExtendTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The Type of the Transaction. Always set to "MARGIN_CALL_EXTEND" for an /// MarginCallExtendTransaction. /// - param String /// - return MarginCallExtendTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarginCallExtendTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return MarginCallExtendTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct MarketOrderTradeClose { /// Indication of how much of the Trade to close. Either "ALL", or a /// DecimalNumber reflection a partial close of the Trade. #[serde(default)] #[serde(rename = "units", skip_serializing_if = "Option::is_none")] pub units: Option<String>, /// The ID of the Trade requested to be closed /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// The client ID of the Trade requested to be closed #[serde(default)] #[serde(rename = "clientTradeID", skip_serializing_if = "Option::is_none")] pub client_trade_id: Option<String>, } impl MarketOrderTradeClose { pub fn new() -> MarketOrderTradeClose { MarketOrderTradeClose { units: None, trade_id: None, client_trade_id: None, } } /// Indication of how much of the Trade to close. Either "ALL", or a /// DecimalNumber reflection a partial close of the Trade. /// - param String /// - return MarketOrderTradeClose pub fn with_units(mut self, x: String) -> Self { self.units = Some(x); self } /// The ID of the Trade requested to be closed /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return MarketOrderTradeClose pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// The client ID of the Trade requested to be closed /// - param String /// - return MarketOrderTradeClose pub fn with_client_trade_id(mut self, x: String) -> Self { self.client_trade_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct CloseTransaction { /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "CLOSE" in a /// CloseTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl CloseTransaction { pub fn new() -> CloseTransaction { CloseTransaction { user_id: None, batch_id: None, request_id: None, time: None, otype: None, id: None, account_id: None, } } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return CloseTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return CloseTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return CloseTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return CloseTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The Type of the Transaction. Always set to "CLOSE" in a /// CloseTransaction. /// - param String /// - return CloseTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return CloseTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return CloseTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct PositionFinancing { /// The instrument of the Position that financing is being paid/collected /// for. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The amount of financing paid/collected for the Position. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "financing", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub financing: Option<f32>, /// The financing paid/collecte for each open Trade within the Position. #[serde(default)] #[serde( rename = "openTradeFinancings", skip_serializing_if = "Option::is_none" )] pub open_trade_financings: Option<Vec<OpenTradeFinancing>>, } impl PositionFinancing { pub fn new() -> PositionFinancing { PositionFinancing { instrument: None, financing: None, open_trade_financings: None, } } /// The instrument of the Position that financing is being paid/collected /// for. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return PositionFinancing pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The amount of financing paid/collected for the Position. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return PositionFinancing pub fn with_financing(mut self, x: f32) -> Self { self.financing = Some(x); self } /// The financing paid/collecte for each open Trade within the Position. /// - param Vec<OpenTradeFinancing> /// - return PositionFinancing pub fn with_open_trade_financings(mut self, x: Vec<OpenTradeFinancing>) -> Self { self.open_trade_financings = Some(x); self } } /// DateTime header #[derive(Debug, Serialize, Deserialize)] pub enum AcceptDatetimeFormat { #[serde(rename = "UNIX")] Unix, #[serde(rename = "RFC3339")] Rfc3339, } impl FromStr for AcceptDatetimeFormat { type Err = (); fn from_str(s: &str) -> Result<AcceptDatetimeFormat, ()> { match s { "UNIX" => Ok(AcceptDatetimeFormat::Unix), "RFC3339" => Ok(AcceptDatetimeFormat::Rfc3339), _ => Err(()), } } } impl std::fmt::Display for AcceptDatetimeFormat { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } /// The reason that the Market Order was created #[derive(Debug, Serialize, Deserialize)] pub enum MarketOrderReason { #[serde(rename = "CLIENT_ORDER")] ClientOrder, #[serde(rename = "TRADE_CLOSE")] TradeClose, #[serde(rename = "POSITION_CLOSEOUT")] PositionCloseout, #[serde(rename = "MARGIN_CLOSEOUT")] MarginCloseout, #[serde(rename = "DELAYED_TRADE_CLOSE")] DelayedTradeClose, } impl FromStr for MarketOrderReason { type Err = (); fn from_str(s: &str) -> Result<MarketOrderReason, ()> { match s { "CLIENT_ORDER" => Ok(MarketOrderReason::ClientOrder), "TRADE_CLOSE" => Ok(MarketOrderReason::TradeClose), "POSITION_CLOSEOUT" => Ok(MarketOrderReason::PositionCloseout), "MARGIN_CLOSEOUT" => Ok(MarketOrderReason::MarginCloseout), "DELAYED_TRADE_CLOSE" => Ok(MarketOrderReason::DelayedTradeClose), _ => Err(()), } } } impl std::fmt::Display for MarketOrderReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct CalculatedAccountState { /// The Account's margin closeout NAV. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginCloseoutNAV", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_nav: Option<f32>, /// Margin currently used for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_used: Option<f32>, /// Margin available for Account currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginAvailable", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_available: Option<f32>, /// The current WithdrawalLimit for the account which will be zero or a /// positive value indicating how much can be withdrawn from the account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "withdrawalLimit", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub withdrawal_limit: Option<f32>, /// The total unrealized profit/loss for all Trades currently open in the /// Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "unrealizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub unrealized_pl: Option<f32>, /// The Account's margin closeout margin used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginCloseoutMarginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_margin_used: Option<f32>, /// The Account's margin call margin used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginCallMarginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_call_margin_used: Option<f32>, /// The Account's margin call percentage. When this value is 1.0 or above /// the Account is in a margin call situation. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginCallPercent", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_call_percent: Option<f32>, /// The Account's margin closeout percentage. When this value is 1.0 or /// above the Account is in a margin closeout situation. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginCloseoutPercent", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_percent: Option<f32>, /// The net asset value of the Account. Equal to Account balance + /// unrealizedPL. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "NAV", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub nav: Option<f32>, /// The Account's margin closeout unrealized PL. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginCloseoutUnrealizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_unrealized_pl: Option<f32>, /// The value of the Account's open positions as used for margin closeout /// calculations represented in the Account's home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginCloseoutPositionValue", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_closeout_position_value: Option<f32>, /// The value of the Account's open positions represented in the Account's /// home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "positionValue", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub position_value: Option<f32>, } impl CalculatedAccountState { pub fn new() -> CalculatedAccountState { CalculatedAccountState { margin_closeout_nav: None, margin_used: None, margin_available: None, withdrawal_limit: None, unrealized_pl: None, margin_closeout_margin_used: None, margin_call_margin_used: None, margin_call_percent: None, margin_closeout_percent: None, nav: None, margin_closeout_unrealized_pl: None, margin_closeout_position_value: None, position_value: None, } } /// The Account's margin closeout NAV. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return CalculatedAccountState pub fn with_margin_closeout_nav(mut self, x: f32) -> Self { self.margin_closeout_nav = Some(x); self } /// Margin currently used for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return CalculatedAccountState pub fn with_margin_used(mut self, x: f32) -> Self { self.margin_used = Some(x); self } /// Margin available for Account currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return CalculatedAccountState pub fn with_margin_available(mut self, x: f32) -> Self { self.margin_available = Some(x); self } /// The current WithdrawalLimit for the account which will be zero or a /// positive value indicating how much can be withdrawn from the account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return CalculatedAccountState pub fn with_withdrawal_limit(mut self, x: f32) -> Self { self.withdrawal_limit = Some(x); self } /// The total unrealized profit/loss for all Trades currently open in the /// Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return CalculatedAccountState pub fn with_unrealized_pl(mut self, x: f32) -> Self { self.unrealized_pl = Some(x); self } /// The Account's margin closeout margin used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return CalculatedAccountState pub fn with_margin_closeout_margin_used(mut self, x: f32) -> Self { self.margin_closeout_margin_used = Some(x); self } /// The Account's margin call margin used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return CalculatedAccountState pub fn with_margin_call_margin_used(mut self, x: f32) -> Self { self.margin_call_margin_used = Some(x); self } /// The Account's margin call percentage. When this value is 1.0 or above /// the Account is in a margin call situation. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return CalculatedAccountState pub fn with_margin_call_percent(mut self, x: f32) -> Self { self.margin_call_percent = Some(x); self } /// The Account's margin closeout percentage. When this value is 1.0 or /// above the Account is in a margin closeout situation. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return CalculatedAccountState pub fn with_margin_closeout_percent(mut self, x: f32) -> Self { self.margin_closeout_percent = Some(x); self } /// The net asset value of the Account. Equal to Account balance + /// unrealizedPL. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return CalculatedAccountState pub fn with_nav(mut self, x: f32) -> Self { self.nav = Some(x); self } /// The Account's margin closeout unrealized PL. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return CalculatedAccountState pub fn with_margin_closeout_unrealized_pl(mut self, x: f32) -> Self { self.margin_closeout_unrealized_pl = Some(x); self } /// The value of the Account's open positions as used for margin closeout /// calculations represented in the Account's home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return CalculatedAccountState pub fn with_margin_closeout_position_value(mut self, x: f32) -> Self { self.margin_closeout_position_value = Some(x); self } /// The value of the Account's open positions represented in the Account's /// home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return CalculatedAccountState pub fn with_position_value(mut self, x: f32) -> Self { self.position_value = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct OrderFillTransaction { /// The total guaranteed execution fees charged for all Trades opened, /// closed or reduced with guaranteed Stop Loss Orders. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "guaranteedExecutionFee", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub guaranteed_execution_fee: Option<f32>, /// The price that all of the units of the OrderFill should have been /// filled at, in the absence of guaranteed price execution. This factors /// in the Account's current ClientPrice, used liquidity and the units of /// the OrderFill only. If no Trades were closed with their price clamped /// for guaranteed stop loss enforcement, then this value will match the /// price fields of each Trade opened, closed, and reduced, and they will /// all be the exact same. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "fullVWAP", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub full_vwap: Option<f32>, /// A TradeReduce object represents a Trade for an instrument that was /// reduced (either partially or fully) in an Account. It is found /// embedded in Transactions that affect the position of an instrument in /// the account, specifically the OrderFill Transaction. #[serde(default)] #[serde(rename = "tradeReduced", skip_serializing_if = "Option::is_none")] pub trade_reduced: Option<TradeReduce>, /// The Account's balance after the Order was filled. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "accountBalance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub account_balance: Option<f32>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The client Order ID of the Order filled (only provided if the client /// has assigned one). #[serde(default)] #[serde(rename = "clientOrderID", skip_serializing_if = "Option::is_none")] pub client_order_id: Option<String>, /// The commission charged in the Account's home currency as a result of /// filling the Order. The commission is always represented as a positive /// quantity of the Account's home currency, however it reduces the /// balance in the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "commission", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub commission: Option<f32>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The name of the filled Order's instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// This is the conversion factor in effect for the Account at the time of /// the OrderFill for converting any losses realized in Instrument quote /// units into units of the Account's home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "lossQuoteHomeConversionFactor", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub loss_quote_home_conversion_factor: Option<f32>, /// The number of units filled by the OrderFill. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// The Type of the Transaction. Always set to "ORDER_FILL" for an /// OrderFillTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The profit or loss incurred when the Order was filled. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "pl", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub pl: Option<f32>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, /// The specification of an Account-specific Price. #[serde(default)] #[serde(rename = "fullPrice", skip_serializing_if = "Option::is_none")] pub full_price: Option<ClientPrice>, /// This field is now deprecated and should no longer be used. The /// individual tradesClosed, tradeReduced and tradeOpened fields contain /// the exact/official price each unit was filled at. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// This is the conversion factor in effect for the Account at the time of /// the OrderFill for converting any gains realized in Instrument quote /// units into units of the Account's home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "gainQuoteHomeConversionFactor", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub gain_quote_home_conversion_factor: Option<f32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that an Order was filled #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// The half spread cost for the OrderFill, which is the sum of the /// halfSpreadCost values in the tradeOpened, tradesClosed and /// tradeReduced fields. This can be a positive or negative value and is /// represented in the home currency of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "halfSpreadCost", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub half_spread_cost: Option<f32>, /// The ID of the Order filled. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "orderID", skip_serializing_if = "Option::is_none")] pub order_id: Option<String>, /// The financing paid or collected when the Order was filled. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "financing", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub financing: Option<f32>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// A TradeOpen object represents a Trade for an instrument that was /// opened in an Account. It is found embedded in Transactions that affect /// the position of an instrument in the Account, specifically the /// OrderFill Transaction. #[serde(default)] #[serde(rename = "tradeOpened", skip_serializing_if = "Option::is_none")] pub trade_opened: Option<TradeOpen>, /// The Trades that were closed when the Order was filled (only provided /// if filling the Order resulted in a closing open Trades). #[serde(default)] #[serde(rename = "tradesClosed", skip_serializing_if = "Option::is_none")] pub trades_closed: Option<Vec<TradeReduce>>, } impl OrderFillTransaction { pub fn new() -> OrderFillTransaction { OrderFillTransaction { guaranteed_execution_fee: None, full_vwap: None, trade_reduced: None, account_balance: None, request_id: None, id: None, client_order_id: None, commission: None, user_id: None, instrument: None, loss_quote_home_conversion_factor: None, units: None, otype: None, pl: None, account_id: None, full_price: None, price: None, gain_quote_home_conversion_factor: None, batch_id: None, reason: None, half_spread_cost: None, order_id: None, financing: None, time: None, trade_opened: None, trades_closed: None, } } /// The total guaranteed execution fees charged for all Trades opened, /// closed or reduced with guaranteed Stop Loss Orders. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return OrderFillTransaction pub fn with_guaranteed_execution_fee(mut self, x: f32) -> Self { self.guaranteed_execution_fee = Some(x); self } /// The price that all of the units of the OrderFill should have been /// filled at, in the absence of guaranteed price execution. This factors /// in the Account's current ClientPrice, used liquidity and the units of /// the OrderFill only. If no Trades were closed with their price clamped /// for guaranteed stop loss enforcement, then this value will match the /// price fields of each Trade opened, closed, and reduced, and they will /// all be the exact same. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return OrderFillTransaction pub fn with_full_vwap(mut self, x: f32) -> Self { self.full_vwap = Some(x); self } /// A TradeReduce object represents a Trade for an instrument that was /// reduced (either partially or fully) in an Account. It is found /// embedded in Transactions that affect the position of an instrument in /// the account, specifically the OrderFill Transaction. /// - param TradeReduce /// - return OrderFillTransaction pub fn with_trade_reduced(mut self, x: TradeReduce) -> Self { self.trade_reduced = Some(x); self } /// The Account's balance after the Order was filled. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return OrderFillTransaction pub fn with_account_balance(mut self, x: f32) -> Self { self.account_balance = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return OrderFillTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return OrderFillTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The client Order ID of the Order filled (only provided if the client /// has assigned one). /// - param String /// - return OrderFillTransaction pub fn with_client_order_id(mut self, x: String) -> Self { self.client_order_id = Some(x); self } /// The commission charged in the Account's home currency as a result of /// filling the Order. The commission is always represented as a positive /// quantity of the Account's home currency, however it reduces the /// balance in the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return OrderFillTransaction pub fn with_commission(mut self, x: f32) -> Self { self.commission = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return OrderFillTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The name of the filled Order's instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return OrderFillTransaction pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// This is the conversion factor in effect for the Account at the time of /// the OrderFill for converting any losses realized in Instrument quote /// units into units of the Account's home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return OrderFillTransaction pub fn with_loss_quote_home_conversion_factor(mut self, x: f32) -> Self { self.loss_quote_home_conversion_factor = Some(x); self } /// The number of units filled by the OrderFill. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return OrderFillTransaction pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// The Type of the Transaction. Always set to "ORDER_FILL" for an /// OrderFillTransaction. /// - param String /// - return OrderFillTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The profit or loss incurred when the Order was filled. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return OrderFillTransaction pub fn with_pl(mut self, x: f32) -> Self { self.pl = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return OrderFillTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } /// The specification of an Account-specific Price. /// - param ClientPrice /// - return OrderFillTransaction pub fn with_full_price(mut self, x: ClientPrice) -> Self { self.full_price = Some(x); self } /// This field is now deprecated and should no longer be used. The /// individual tradesClosed, tradeReduced and tradeOpened fields contain /// the exact/official price each unit was filled at. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return OrderFillTransaction pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// This is the conversion factor in effect for the Account at the time of /// the OrderFill for converting any gains realized in Instrument quote /// units into units of the Account's home currency. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return OrderFillTransaction pub fn with_gain_quote_home_conversion_factor(mut self, x: f32) -> Self { self.gain_quote_home_conversion_factor = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return OrderFillTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that an Order was filled /// - param String /// - return OrderFillTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// The half spread cost for the OrderFill, which is the sum of the /// halfSpreadCost values in the tradeOpened, tradesClosed and /// tradeReduced fields. This can be a positive or negative value and is /// represented in the home currency of the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return OrderFillTransaction pub fn with_half_spread_cost(mut self, x: f32) -> Self { self.half_spread_cost = Some(x); self } /// The ID of the Order filled. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return OrderFillTransaction pub fn with_order_id(mut self, x: String) -> Self { self.order_id = Some(x); self } /// The financing paid or collected when the Order was filled. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return OrderFillTransaction pub fn with_financing(mut self, x: f32) -> Self { self.financing = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return OrderFillTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// A TradeOpen object represents a Trade for an instrument that was /// opened in an Account. It is found embedded in Transactions that affect /// the position of an instrument in the Account, specifically the /// OrderFill Transaction. /// - param TradeOpen /// - return OrderFillTransaction pub fn with_trade_opened(mut self, x: TradeOpen) -> Self { self.trade_opened = Some(x); self } /// The Trades that were closed when the Order was filled (only provided /// if filling the Order resulted in a closing open Trades). /// - param Vec<TradeReduce> /// - return OrderFillTransaction pub fn with_trades_closed(mut self, x: Vec<TradeReduce>) -> Self { self.trades_closed = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct StopLossOrderRejectTransaction { /// Specifies the distance (in price units) from the Account's current /// price to use as the Stop Loss Order price. If the Trade is short the /// Instrument's bid price is used, and for long Trades the ask is used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "distance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub distance: Option<f32>, /// The time-in-force requested for the StopLoss Order. Restricted to /// "GTC", "GFD" and "GTD" for StopLoss Orders. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Order that this Order was intended to replace (only /// provided if this Order was intended to replace an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde( rename = "intendedReplacesOrderID", skip_serializing_if = "Option::is_none" )] pub intended_replaces_order_id: Option<String>, /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// Flag indicating that the Stop Loss Order is guaranteed. The default /// value depends on the GuaranteedStopLossOrderMode of the account, if it /// is REQUIRED, the default will be true, for DISABLED or ENABLED the /// default is false. #[serde(default)] #[serde(rename = "guaranteed", skip_serializing_if = "Option::is_none")] pub guaranteed: Option<bool>, /// The price threshold specified for the Stop Loss Order. If the /// guaranteed flag is false, the associated Trade will be closed by a /// market price that is equal to or worse than this threshold. If the /// flag is true the associated Trade will be closed at this price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The client ID of the Trade to be closed when the price threshold is /// breached. #[serde(default)] #[serde(rename = "clientTradeID", skip_serializing_if = "Option::is_none")] pub client_trade_id: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Reject Transaction was created #[serde(default)] #[serde(rename = "rejectReason", skip_serializing_if = "Option::is_none")] pub reject_reason: Option<String>, /// The reason that the Stop Loss Order was initiated #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The ID of the OrderFill Transaction that caused this Order to be /// created (only provided if this Order was created automatically when /// another Order was filled). /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "orderFillTransactionID", skip_serializing_if = "Option::is_none" )] pub order_fill_transaction_id: Option<String>, /// The date/time when the StopLoss Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "STOP_LOSS_ORDER_REJECT" in /// a StopLossOrderRejectTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl StopLossOrderRejectTransaction { pub fn new() -> StopLossOrderRejectTransaction { StopLossOrderRejectTransaction { distance: None, time_in_force: None, trigger_condition: None, intended_replaces_order_id: None, trade_id: None, guaranteed: None, price: None, client_trade_id: None, user_id: None, batch_id: None, reject_reason: None, reason: None, request_id: None, client_extensions: None, time: None, order_fill_transaction_id: None, gtd_time: None, otype: None, id: None, account_id: None, } } /// Specifies the distance (in price units) from the Account's current /// price to use as the Stop Loss Order price. If the Trade is short the /// Instrument's bid price is used, and for long Trades the ask is used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return StopLossOrderRejectTransaction pub fn with_distance(mut self, x: f32) -> Self { self.distance = Some(x); self } /// The time-in-force requested for the StopLoss Order. Restricted to /// "GTC", "GFD" and "GTD" for StopLoss Orders. /// - param String /// - return StopLossOrderRejectTransaction pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return StopLossOrderRejectTransaction pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Order that this Order was intended to replace (only /// provided if this Order was intended to replace an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return StopLossOrderRejectTransaction pub fn with_intended_replaces_order_id(mut self, x: String) -> Self { self.intended_replaces_order_id = Some(x); self } /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return StopLossOrderRejectTransaction pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// Flag indicating that the Stop Loss Order is guaranteed. The default /// value depends on the GuaranteedStopLossOrderMode of the account, if it /// is REQUIRED, the default will be true, for DISABLED or ENABLED the /// default is false. /// - param bool /// - return StopLossOrderRejectTransaction pub fn with_guaranteed(mut self, x: bool) -> Self { self.guaranteed = Some(x); self } /// The price threshold specified for the Stop Loss Order. If the /// guaranteed flag is false, the associated Trade will be closed by a /// market price that is equal to or worse than this threshold. If the /// flag is true the associated Trade will be closed at this price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return StopLossOrderRejectTransaction pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The client ID of the Trade to be closed when the price threshold is /// breached. /// - param String /// - return StopLossOrderRejectTransaction pub fn with_client_trade_id(mut self, x: String) -> Self { self.client_trade_id = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return StopLossOrderRejectTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return StopLossOrderRejectTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Reject Transaction was created /// - param String /// - return StopLossOrderRejectTransaction pub fn with_reject_reason(mut self, x: String) -> Self { self.reject_reason = Some(x); self } /// The reason that the Stop Loss Order was initiated /// - param String /// - return StopLossOrderRejectTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return StopLossOrderRejectTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return StopLossOrderRejectTransaction pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopLossOrderRejectTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The ID of the OrderFill Transaction that caused this Order to be /// created (only provided if this Order was created automatically when /// another Order was filled). /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return StopLossOrderRejectTransaction pub fn with_order_fill_transaction_id(mut self, x: String) -> Self { self.order_fill_transaction_id = Some(x); self } /// The date/time when the StopLoss Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopLossOrderRejectTransaction pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } /// The Type of the Transaction. Always set to "STOP_LOSS_ORDER_REJECT" in /// a StopLossOrderRejectTransaction. /// - param String /// - return StopLossOrderRejectTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return StopLossOrderRejectTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return StopLossOrderRejectTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct TrailingStopLossOrderRequest { /// The price distance (in price units) specified for the TrailingStopLoss /// Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "distance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub distance: Option<f32>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// The time-in-force requested for the TrailingStopLoss Order. Restricted /// to "GTC", "GFD" and "GTD" for TrailingStopLoss Orders. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The client ID of the Trade to be closed when the price threshold is /// breached. #[serde(default)] #[serde(rename = "clientTradeID", skip_serializing_if = "Option::is_none")] pub client_trade_id: Option<String>, /// The date/time when the StopLoss Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, /// The type of the Order to Create. Must be set to "TRAILING_STOP_LOSS" /// when creating a Trailng Stop Loss Order. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, } impl TrailingStopLossOrderRequest { pub fn new() -> TrailingStopLossOrderRequest { TrailingStopLossOrderRequest { distance: None, trigger_condition: None, trade_id: None, time_in_force: None, client_extensions: None, client_trade_id: None, gtd_time: None, otype: None, } } /// The price distance (in price units) specified for the TrailingStopLoss /// Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return TrailingStopLossOrderRequest pub fn with_distance(mut self, x: f32) -> Self { self.distance = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return TrailingStopLossOrderRequest pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TrailingStopLossOrderRequest pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// The time-in-force requested for the TrailingStopLoss Order. Restricted /// to "GTC", "GFD" and "GTD" for TrailingStopLoss Orders. /// - param String /// - return TrailingStopLossOrderRequest pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return TrailingStopLossOrderRequest pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The client ID of the Trade to be closed when the price threshold is /// breached. /// - param String /// - return TrailingStopLossOrderRequest pub fn with_client_trade_id(mut self, x: String) -> Self { self.client_trade_id = Some(x); self } /// The date/time when the StopLoss Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TrailingStopLossOrderRequest pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } /// The type of the Order to Create. Must be set to "TRAILING_STOP_LOSS" /// when creating a Trailng Stop Loss Order. /// - param String /// - return TrailingStopLossOrderRequest pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct TransactionHeartbeat { /// The string "HEARTBEAT" #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The ID of the most recent Transaction created for the Account /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "lastTransactionID", skip_serializing_if = "Option::is_none")] pub last_transaction_id: Option<String>, /// The date/time when the TransactionHeartbeat was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, } impl TransactionHeartbeat { pub fn new() -> TransactionHeartbeat { TransactionHeartbeat { otype: None, last_transaction_id: None, time: None, } } /// The string "HEARTBEAT" /// - param String /// - return TransactionHeartbeat pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The ID of the most recent Transaction created for the Account /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TransactionHeartbeat pub fn with_last_transaction_id(mut self, x: String) -> Self { self.last_transaction_id = Some(x); self } /// The date/time when the TransactionHeartbeat was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TransactionHeartbeat pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct Order { /// The current state of the Order. #[serde(default)] #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "createTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub create_time: Option<DateTime<Utc>>, } impl Order { pub fn new() -> Order { Order { state: None, client_extensions: None, id: None, create_time: None, } } /// The current state of the Order. /// - param String /// - return Order pub fn with_state(mut self, x: String) -> Self { self.state = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return Order pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return Order pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return Order pub fn with_create_time(mut self, x: DateTime<Utc>) -> Self { self.create_time = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct ClientConfigureRejectTransaction { /// The reason that the Reject Transaction was created #[serde(default)] #[serde(rename = "rejectReason", skip_serializing_if = "Option::is_none")] pub reject_reason: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The margin rate override for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginRate", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_rate: Option<f32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The client-provided alias for the Account. #[serde(default)] #[serde(rename = "alias", skip_serializing_if = "Option::is_none")] pub alias: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "CLIENT_CONFIGURE_REJECT" /// in a ClientConfigureRejectTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl ClientConfigureRejectTransaction { pub fn new() -> ClientConfigureRejectTransaction { ClientConfigureRejectTransaction { reject_reason: None, user_id: None, margin_rate: None, batch_id: None, alias: None, request_id: None, time: None, otype: None, id: None, account_id: None, } } /// The reason that the Reject Transaction was created /// - param String /// - return ClientConfigureRejectTransaction pub fn with_reject_reason(mut self, x: String) -> Self { self.reject_reason = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return ClientConfigureRejectTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The margin rate override for the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return ClientConfigureRejectTransaction pub fn with_margin_rate(mut self, x: f32) -> Self { self.margin_rate = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return ClientConfigureRejectTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The client-provided alias for the Account. /// - param String /// - return ClientConfigureRejectTransaction pub fn with_alias(mut self, x: String) -> Self { self.alias = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return ClientConfigureRejectTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return ClientConfigureRejectTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The Type of the Transaction. Always set to "CLIENT_CONFIGURE_REJECT" /// in a ClientConfigureRejectTransaction. /// - param String /// - return ClientConfigureRejectTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return ClientConfigureRejectTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return ClientConfigureRejectTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct InstrumentCommission { /// The commission amount (in the Account's home currency) charged per /// unitsTraded of the instrument /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "commission", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub commission: Option<f32>, /// The number of units traded that the commission amount is based on. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "unitsTraded", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units_traded: Option<f32>, /// The minimum commission amount (in the Account's home currency) that is /// charged when an Order is filled for this instrument. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "minimumCommission", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub minimum_commission: Option<f32>, } impl InstrumentCommission { pub fn new() -> InstrumentCommission { InstrumentCommission { commission: None, units_traded: None, minimum_commission: None, } } /// The commission amount (in the Account's home currency) charged per /// unitsTraded of the instrument /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return InstrumentCommission pub fn with_commission(mut self, x: f32) -> Self { self.commission = Some(x); self } /// The number of units traded that the commission amount is based on. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return InstrumentCommission pub fn with_units_traded(mut self, x: f32) -> Self { self.units_traded = Some(x); self } /// The minimum commission amount (in the Account's home currency) that is /// charged when an Order is filled for this instrument. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return InstrumentCommission pub fn with_minimum_commission(mut self, x: f32) -> Self { self.minimum_commission = Some(x); self } } /// The current state of the Order. #[derive(Debug, Serialize, Deserialize)] pub enum OrderState { #[serde(rename = "PENDING")] Pending, #[serde(rename = "FILLED")] Filled, #[serde(rename = "TRIGGERED")] Triggered, #[serde(rename = "CANCELLED")] Cancelled, } impl FromStr for OrderState { type Err = (); fn from_str(s: &str) -> Result<OrderState, ()> { match s { "PENDING" => Ok(OrderState::Pending), "FILLED" => Ok(OrderState::Filled), "TRIGGERED" => Ok(OrderState::Triggered), "CANCELLED" => Ok(OrderState::Cancelled), _ => Err(()), } } } impl std::fmt::Display for OrderState { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct ReopenTransaction { /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "REOPEN" in a /// ReopenTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl ReopenTransaction { pub fn new() -> ReopenTransaction { ReopenTransaction { user_id: None, batch_id: None, request_id: None, time: None, otype: None, id: None, account_id: None, } } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return ReopenTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return ReopenTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return ReopenTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return ReopenTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The Type of the Transaction. Always set to "REOPEN" in a /// ReopenTransaction. /// - param String /// - return ReopenTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return ReopenTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return ReopenTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct TrailingStopLossOrder { /// The price distance (in price units) specified for the TrailingStopLoss /// Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "distance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub distance: Option<f32>, /// The date/time when the StopLoss Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, /// The ID of the Order that was replaced by this Order (only provided if /// this Order was created as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacesOrderID", skip_serializing_if = "Option::is_none")] pub replaces_order_id: Option<String>, /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// Date/time when the Order was filled (only provided when the Order's /// state is FILLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "filledTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub filled_time: Option<DateTime<Utc>>, /// Date/time when the Order was cancelled (only provided when the state /// of the Order is CANCELLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "cancelledTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub cancelled_time: Option<DateTime<Utc>>, /// Trade IDs of Trades closed when the Order was filled (only provided /// when the Order's state is FILLED and one or more Trades were closed as /// a result of the fill) #[serde(default)] #[serde(rename = "tradeClosedIDs", skip_serializing_if = "Option::is_none")] pub trade_closed_i_ds: Option<Vec<String>>, /// Trade ID of Trade opened when the Order was filled (only provided when /// the Order's state is FILLED and a Trade was opened as a result of the /// fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeOpenedID", skip_serializing_if = "Option::is_none")] pub trade_opened_id: Option<String>, /// The trigger price for the Trailing Stop Loss Order. The trailing stop /// value will trail (follow) the market price by the TSL order's /// configured "distance" as the market price moves in the winning /// direction. If the market price moves to a level that is equal to or /// worse than the trailing stop value, the order will be filled and the /// Trade will be closed. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "trailingStopValue", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub trailing_stop_value: Option<f32>, /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "createTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub create_time: Option<DateTime<Utc>>, /// The time-in-force requested for the TrailingStopLoss Order. Restricted /// to "GTC", "GFD" and "GTD" for TrailingStopLoss Orders. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// Trade ID of Trade reduced when the Order was filled (only provided /// when the Order's state is FILLED and a Trade was reduced as a result /// of the fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeReducedID", skip_serializing_if = "Option::is_none")] pub trade_reduced_id: Option<String>, /// The current state of the Order. #[serde(default)] #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option<String>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The client ID of the Trade to be closed when the price threshold is /// breached. #[serde(default)] #[serde(rename = "clientTradeID", skip_serializing_if = "Option::is_none")] pub client_trade_id: Option<String>, /// ID of the Transaction that filled this Order (only provided when the /// Order's state is FILLED) /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "fillingTransactionID", skip_serializing_if = "Option::is_none" )] pub filling_transaction_id: Option<String>, /// ID of the Transaction that cancelled the Order (only provided when the /// Order's state is CANCELLED) /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "cancellingTransactionID", skip_serializing_if = "Option::is_none" )] pub cancelling_transaction_id: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The type of the Order. Always set to "TRAILING_STOP_LOSS" for Trailing /// Stop Loss Orders. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Order that replaced this Order (only provided if this /// Order was cancelled as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacedByOrderID", skip_serializing_if = "Option::is_none")] pub replaced_by_order_id: Option<String>, } impl TrailingStopLossOrder { pub fn new() -> TrailingStopLossOrder { TrailingStopLossOrder { distance: None, gtd_time: None, replaces_order_id: None, trade_id: None, filled_time: None, cancelled_time: None, trade_closed_i_ds: None, trade_opened_id: None, trailing_stop_value: None, create_time: None, time_in_force: None, trade_reduced_id: None, state: None, trigger_condition: None, client_trade_id: None, filling_transaction_id: None, cancelling_transaction_id: None, client_extensions: None, otype: None, id: None, replaced_by_order_id: None, } } /// The price distance (in price units) specified for the TrailingStopLoss /// Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return TrailingStopLossOrder pub fn with_distance(mut self, x: f32) -> Self { self.distance = Some(x); self } /// The date/time when the StopLoss Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TrailingStopLossOrder pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } /// The ID of the Order that was replaced by this Order (only provided if /// this Order was created as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return TrailingStopLossOrder pub fn with_replaces_order_id(mut self, x: String) -> Self { self.replaces_order_id = Some(x); self } /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TrailingStopLossOrder pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// Date/time when the Order was filled (only provided when the Order's /// state is FILLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TrailingStopLossOrder pub fn with_filled_time(mut self, x: DateTime<Utc>) -> Self { self.filled_time = Some(x); self } /// Date/time when the Order was cancelled (only provided when the state /// of the Order is CANCELLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TrailingStopLossOrder pub fn with_cancelled_time(mut self, x: DateTime<Utc>) -> Self { self.cancelled_time = Some(x); self } /// Trade IDs of Trades closed when the Order was filled (only provided /// when the Order's state is FILLED and one or more Trades were closed as /// a result of the fill) /// - param Vec<String> /// - return TrailingStopLossOrder pub fn with_trade_closed_i_ds(mut self, x: Vec<String>) -> Self { self.trade_closed_i_ds = Some(x); self } /// Trade ID of Trade opened when the Order was filled (only provided when /// the Order's state is FILLED and a Trade was opened as a result of the /// fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TrailingStopLossOrder pub fn with_trade_opened_id(mut self, x: String) -> Self { self.trade_opened_id = Some(x); self } /// The trigger price for the Trailing Stop Loss Order. The trailing stop /// value will trail (follow) the market price by the TSL order's /// configured "distance" as the market price moves in the winning /// direction. If the market price moves to a level that is equal to or /// worse than the trailing stop value, the order will be filled and the /// Trade will be closed. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return TrailingStopLossOrder pub fn with_trailing_stop_value(mut self, x: f32) -> Self { self.trailing_stop_value = Some(x); self } /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TrailingStopLossOrder pub fn with_create_time(mut self, x: DateTime<Utc>) -> Self { self.create_time = Some(x); self } /// The time-in-force requested for the TrailingStopLoss Order. Restricted /// to "GTC", "GFD" and "GTD" for TrailingStopLoss Orders. /// - param String /// - return TrailingStopLossOrder pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// Trade ID of Trade reduced when the Order was filled (only provided /// when the Order's state is FILLED and a Trade was reduced as a result /// of the fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TrailingStopLossOrder pub fn with_trade_reduced_id(mut self, x: String) -> Self { self.trade_reduced_id = Some(x); self } /// The current state of the Order. /// - param String /// - return TrailingStopLossOrder pub fn with_state(mut self, x: String) -> Self { self.state = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return TrailingStopLossOrder pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The client ID of the Trade to be closed when the price threshold is /// breached. /// - param String /// - return TrailingStopLossOrder pub fn with_client_trade_id(mut self, x: String) -> Self { self.client_trade_id = Some(x); self } /// ID of the Transaction that filled this Order (only provided when the /// Order's state is FILLED) /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TrailingStopLossOrder pub fn with_filling_transaction_id(mut self, x: String) -> Self { self.filling_transaction_id = Some(x); self } /// ID of the Transaction that cancelled the Order (only provided when the /// Order's state is CANCELLED) /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TrailingStopLossOrder pub fn with_cancelling_transaction_id(mut self, x: String) -> Self { self.cancelling_transaction_id = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return TrailingStopLossOrder pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The type of the Order. Always set to "TRAILING_STOP_LOSS" for Trailing /// Stop Loss Orders. /// - param String /// - return TrailingStopLossOrder pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return TrailingStopLossOrder pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Order that replaced this Order (only provided if this /// Order was cancelled as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return TrailingStopLossOrder pub fn with_replaced_by_order_id(mut self, x: String) -> Self { self.replaced_by_order_id = Some(x); self } } /// The type of the Order. #[derive(Debug, Serialize, Deserialize)] pub enum OrderType { #[serde(rename = "MARKET")] Market, #[serde(rename = "LIMIT")] Limit, #[serde(rename = "STOP")] Stop, #[serde(rename = "MARKET_IF_TOUCHED")] MarketIfTouched, #[serde(rename = "TAKE_PROFIT")] TakeProfit, #[serde(rename = "STOP_LOSS")] StopLoss, #[serde(rename = "TRAILING_STOP_LOSS")] TrailingStopLoss, #[serde(rename = "FIXED_PRICE")] FixedPrice, } impl FromStr for OrderType { type Err = (); fn from_str(s: &str) -> Result<OrderType, ()> { match s { "MARKET" => Ok(OrderType::Market), "LIMIT" => Ok(OrderType::Limit), "STOP" => Ok(OrderType::Stop), "MARKET_IF_TOUCHED" => Ok(OrderType::MarketIfTouched), "TAKE_PROFIT" => Ok(OrderType::TakeProfit), "STOP_LOSS" => Ok(OrderType::StopLoss), "TRAILING_STOP_LOSS" => Ok(OrderType::TrailingStopLoss), "FIXED_PRICE" => Ok(OrderType::FixedPrice), _ => Err(()), } } } impl std::fmt::Display for OrderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } /// The reason that the Market-if-touched Order was initiated #[derive(Debug, Serialize, Deserialize)] pub enum MarketIfTouchedOrderReason { #[serde(rename = "CLIENT_ORDER")] ClientOrder, #[serde(rename = "REPLACEMENT")] Replacement, } impl FromStr for MarketIfTouchedOrderReason { type Err = (); fn from_str(s: &str) -> Result<MarketIfTouchedOrderReason, ()> { match s { "CLIENT_ORDER" => Ok(MarketIfTouchedOrderReason::ClientOrder), "REPLACEMENT" => Ok(MarketIfTouchedOrderReason::Replacement), _ => Err(()), } } } impl std::fmt::Display for MarketIfTouchedOrderReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } /// The type of the Order. #[derive(Debug, Serialize, Deserialize)] pub enum CancellableOrderType { #[serde(rename = "LIMIT")] Limit, #[serde(rename = "STOP")] Stop, #[serde(rename = "MARKET_IF_TOUCHED")] MarketIfTouched, #[serde(rename = "TAKE_PROFIT")] TakeProfit, #[serde(rename = "STOP_LOSS")] StopLoss, #[serde(rename = "TRAILING_STOP_LOSS")] TrailingStopLoss, } impl FromStr for CancellableOrderType { type Err = (); fn from_str(s: &str) -> Result<CancellableOrderType, ()> { match s { "LIMIT" => Ok(CancellableOrderType::Limit), "STOP" => Ok(CancellableOrderType::Stop), "MARKET_IF_TOUCHED" => Ok(CancellableOrderType::MarketIfTouched), "TAKE_PROFIT" => Ok(CancellableOrderType::TakeProfit), "STOP_LOSS" => Ok(CancellableOrderType::StopLoss), "TRAILING_STOP_LOSS" => Ok(CancellableOrderType::TrailingStopLoss), _ => Err(()), } } } impl std::fmt::Display for CancellableOrderType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } /// The way that position values for an Account are calculated and /// aggregated. #[derive(Debug, Serialize, Deserialize)] pub enum PositionAggregationMode { #[serde(rename = "ABSOLUTE_SUM")] AbsoluteSum, #[serde(rename = "MAXIMAL_SIDE")] MaximalSide, #[serde(rename = "NET_SUM")] NetSum, } impl FromStr for PositionAggregationMode { type Err = (); fn from_str(s: &str) -> Result<PositionAggregationMode, ()> { match s { "ABSOLUTE_SUM" => Ok(PositionAggregationMode::AbsoluteSum), "MAXIMAL_SIDE" => Ok(PositionAggregationMode::MaximalSide), "NET_SUM" => Ok(PositionAggregationMode::NetSum), _ => Err(()), } } } impl std::fmt::Display for PositionAggregationMode { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct TrailingStopLossOrderTransaction { /// The price distance (in price units) specified for the TrailingStopLoss /// Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "distance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub distance: Option<f32>, /// The time-in-force requested for the TrailingStopLoss Order. Restricted /// to "GTC", "GFD" and "GTD" for TrailingStopLoss Orders. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Order that this Order replaces (only provided if this /// Order replaces an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacesOrderID", skip_serializing_if = "Option::is_none")] pub replaces_order_id: Option<String>, /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// The client ID of the Trade to be closed when the price threshold is /// breached. #[serde(default)] #[serde(rename = "clientTradeID", skip_serializing_if = "Option::is_none")] pub client_trade_id: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Trailing Stop Loss Order was initiated #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The ID of the OrderFill Transaction that caused this Order to be /// created (only provided if this Order was created automatically when /// another Order was filled). /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "orderFillTransactionID", skip_serializing_if = "Option::is_none" )] pub order_fill_transaction_id: Option<String>, /// The ID of the Transaction that cancels the replaced Order (only /// provided if this Order replaces an existing Order). /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "cancellingTransactionID", skip_serializing_if = "Option::is_none" )] pub cancelling_transaction_id: Option<String>, /// The date/time when the StopLoss Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "TRAILING_STOP_LOSS_ORDER" /// in a TrailingStopLossOrderTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl TrailingStopLossOrderTransaction { pub fn new() -> TrailingStopLossOrderTransaction { TrailingStopLossOrderTransaction { distance: None, time_in_force: None, trigger_condition: None, replaces_order_id: None, trade_id: None, client_trade_id: None, user_id: None, batch_id: None, reason: None, request_id: None, client_extensions: None, time: None, order_fill_transaction_id: None, cancelling_transaction_id: None, gtd_time: None, otype: None, id: None, account_id: None, } } /// The price distance (in price units) specified for the TrailingStopLoss /// Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return TrailingStopLossOrderTransaction pub fn with_distance(mut self, x: f32) -> Self { self.distance = Some(x); self } /// The time-in-force requested for the TrailingStopLoss Order. Restricted /// to "GTC", "GFD" and "GTD" for TrailingStopLoss Orders. /// - param String /// - return TrailingStopLossOrderTransaction pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return TrailingStopLossOrderTransaction pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Order that this Order replaces (only provided if this /// Order replaces an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return TrailingStopLossOrderTransaction pub fn with_replaces_order_id(mut self, x: String) -> Self { self.replaces_order_id = Some(x); self } /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TrailingStopLossOrderTransaction pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// The client ID of the Trade to be closed when the price threshold is /// breached. /// - param String /// - return TrailingStopLossOrderTransaction pub fn with_client_trade_id(mut self, x: String) -> Self { self.client_trade_id = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return TrailingStopLossOrderTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TrailingStopLossOrderTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Trailing Stop Loss Order was initiated /// - param String /// - return TrailingStopLossOrderTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return TrailingStopLossOrderTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return TrailingStopLossOrderTransaction pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TrailingStopLossOrderTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The ID of the OrderFill Transaction that caused this Order to be /// created (only provided if this Order was created automatically when /// another Order was filled). /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TrailingStopLossOrderTransaction pub fn with_order_fill_transaction_id(mut self, x: String) -> Self { self.order_fill_transaction_id = Some(x); self } /// The ID of the Transaction that cancels the replaced Order (only /// provided if this Order replaces an existing Order). /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TrailingStopLossOrderTransaction pub fn with_cancelling_transaction_id(mut self, x: String) -> Self { self.cancelling_transaction_id = Some(x); self } /// The date/time when the StopLoss Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TrailingStopLossOrderTransaction pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } /// The Type of the Transaction. Always set to "TRAILING_STOP_LOSS_ORDER" /// in a TrailingStopLossOrderTransaction. /// - param String /// - return TrailingStopLossOrderTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TrailingStopLossOrderTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return TrailingStopLossOrderTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct PositionBookBucket { /// The lowest price (inclusive) covered by the bucket. The bucket covers /// the price range from the price to price + the position book's /// bucketWidth. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The percentage of the total number of positions represented by the /// short positions found in this bucket. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "shortCountPercent", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub short_count_percent: Option<f32>, /// The percentage of the total number of positions represented by the /// long positions found in this bucket. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "longCountPercent", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub long_count_percent: Option<f32>, } impl PositionBookBucket { pub fn new() -> PositionBookBucket { PositionBookBucket { price: None, short_count_percent: None, long_count_percent: None, } } /// The lowest price (inclusive) covered by the bucket. The bucket covers /// the price range from the price to price + the position book's /// bucketWidth. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return PositionBookBucket pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The percentage of the total number of positions represented by the /// short positions found in this bucket. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return PositionBookBucket pub fn with_short_count_percent(mut self, x: f32) -> Self { self.short_count_percent = Some(x); self } /// The percentage of the total number of positions represented by the /// long positions found in this bucket. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return PositionBookBucket pub fn with_long_count_percent(mut self, x: f32) -> Self { self.long_count_percent = Some(x); self } } /// The possible types of a Transaction #[derive(Debug, Serialize, Deserialize)] pub enum TransactionType { #[serde(rename = "CREATE")] Create, #[serde(rename = "CLOSE")] Close, #[serde(rename = "REOPEN")] Reopen, #[serde(rename = "CLIENT_CONFIGURE")] ClientConfigure, #[serde(rename = "CLIENT_CONFIGURE_REJECT")] ClientConfigureReject, #[serde(rename = "TRANSFER_FUNDS")] TransferFunds, #[serde(rename = "TRANSFER_FUNDS_REJECT")] TransferFundsReject, #[serde(rename = "MARKET_ORDER")] MarketOrder, #[serde(rename = "MARKET_ORDER_REJECT")] MarketOrderReject, #[serde(rename = "FIXED_PRICE_ORDER")] FixedPriceOrder, #[serde(rename = "LIMIT_ORDER")] LimitOrder, #[serde(rename = "LIMIT_ORDER_REJECT")] LimitOrderReject, #[serde(rename = "STOP_ORDER")] StopOrder, #[serde(rename = "STOP_ORDER_REJECT")] StopOrderReject, #[serde(rename = "MARKET_IF_TOUCHED_ORDER")] MarketIfTouchedOrder, #[serde(rename = "MARKET_IF_TOUCHED_ORDER_REJECT")] MarketIfTouchedOrderReject, #[serde(rename = "TAKE_PROFIT_ORDER")] TakeProfitOrder, #[serde(rename = "TAKE_PROFIT_ORDER_REJECT")] TakeProfitOrderReject, #[serde(rename = "STOP_LOSS_ORDER")] StopLossOrder, #[serde(rename = "STOP_LOSS_ORDER_REJECT")] StopLossOrderReject, #[serde(rename = "TRAILING_STOP_LOSS_ORDER")] TrailingStopLossOrder, #[serde(rename = "TRAILING_STOP_LOSS_ORDER_REJECT")] TrailingStopLossOrderReject, #[serde(rename = "ORDER_FILL")] OrderFill, #[serde(rename = "ORDER_CANCEL")] OrderCancel, #[serde(rename = "ORDER_CANCEL_REJECT")] OrderCancelReject, #[serde(rename = "ORDER_CLIENT_EXTENSIONS_MODIFY")] OrderClientExtensionsModify, #[serde(rename = "ORDER_CLIENT_EXTENSIONS_MODIFY_REJECT")] OrderClientExtensionsModifyReject, #[serde(rename = "TRADE_CLIENT_EXTENSIONS_MODIFY")] TradeClientExtensionsModify, #[serde(rename = "TRADE_CLIENT_EXTENSIONS_MODIFY_REJECT")] TradeClientExtensionsModifyReject, #[serde(rename = "MARGIN_CALL_ENTER")] MarginCallEnter, #[serde(rename = "MARGIN_CALL_EXTEND")] MarginCallExtend, #[serde(rename = "MARGIN_CALL_EXIT")] MarginCallExit, #[serde(rename = "DELAYED_TRADE_CLOSURE")] DelayedTradeClosure, #[serde(rename = "DAILY_FINANCING")] DailyFinancing, #[serde(rename = "RESET_RESETTABLE_PL")] ResetResettablePl, } impl FromStr for TransactionType { type Err = (); fn from_str(s: &str) -> Result<TransactionType, ()> { match s { "CREATE" => Ok(TransactionType::Create), "CLOSE" => Ok(TransactionType::Close), "REOPEN" => Ok(TransactionType::Reopen), "CLIENT_CONFIGURE" => Ok(TransactionType::ClientConfigure), "CLIENT_CONFIGURE_REJECT" => Ok(TransactionType::ClientConfigureReject), "TRANSFER_FUNDS" => Ok(TransactionType::TransferFunds), "TRANSFER_FUNDS_REJECT" => Ok(TransactionType::TransferFundsReject), "MARKET_ORDER" => Ok(TransactionType::MarketOrder), "MARKET_ORDER_REJECT" => Ok(TransactionType::MarketOrderReject), "FIXED_PRICE_ORDER" => Ok(TransactionType::FixedPriceOrder), "LIMIT_ORDER" => Ok(TransactionType::LimitOrder), "LIMIT_ORDER_REJECT" => Ok(TransactionType::LimitOrderReject), "STOP_ORDER" => Ok(TransactionType::StopOrder), "STOP_ORDER_REJECT" => Ok(TransactionType::StopOrderReject), "MARKET_IF_TOUCHED_ORDER" => Ok(TransactionType::MarketIfTouchedOrder), "MARKET_IF_TOUCHED_ORDER_REJECT" => Ok(TransactionType::MarketIfTouchedOrderReject), "TAKE_PROFIT_ORDER" => Ok(TransactionType::TakeProfitOrder), "TAKE_PROFIT_ORDER_REJECT" => Ok(TransactionType::TakeProfitOrderReject), "STOP_LOSS_ORDER" => Ok(TransactionType::StopLossOrder), "STOP_LOSS_ORDER_REJECT" => Ok(TransactionType::StopLossOrderReject), "TRAILING_STOP_LOSS_ORDER" => Ok(TransactionType::TrailingStopLossOrder), "TRAILING_STOP_LOSS_ORDER_REJECT" => Ok(TransactionType::TrailingStopLossOrderReject), "ORDER_FILL" => Ok(TransactionType::OrderFill), "ORDER_CANCEL" => Ok(TransactionType::OrderCancel), "ORDER_CANCEL_REJECT" => Ok(TransactionType::OrderCancelReject), "ORDER_CLIENT_EXTENSIONS_MODIFY" => Ok(TransactionType::OrderClientExtensionsModify), "ORDER_CLIENT_EXTENSIONS_MODIFY_REJECT" => { Ok(TransactionType::OrderClientExtensionsModifyReject) } "TRADE_CLIENT_EXTENSIONS_MODIFY" => Ok(TransactionType::TradeClientExtensionsModify), "TRADE_CLIENT_EXTENSIONS_MODIFY_REJECT" => { Ok(TransactionType::TradeClientExtensionsModifyReject) } "MARGIN_CALL_ENTER" => Ok(TransactionType::MarginCallEnter), "MARGIN_CALL_EXTEND" => Ok(TransactionType::MarginCallExtend), "MARGIN_CALL_EXIT" => Ok(TransactionType::MarginCallExit), "DELAYED_TRADE_CLOSURE" => Ok(TransactionType::DelayedTradeClosure), "DAILY_FINANCING" => Ok(TransactionType::DailyFinancing), "RESET_RESETTABLE_PL" => Ok(TransactionType::ResetResettablePl), _ => Err(()), } } } impl std::fmt::Display for TransactionType { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct MarketIfTouchedOrderTransaction { /// The time-in-force requested for the MarketIfTouched Order. Restricted /// to "GTC", "GFD" and "GTD" for MarketIfTouched Orders. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, /// The worst market price that may be used to fill this MarketIfTouched /// Order. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "priceBound", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price_bound: Option<f32>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The MarketIfTouched Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The quantity requested to be filled by the MarketIfTouched Order. A /// posititive number of units results in a long Order, and a negative /// number of units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// The Type of the Transaction. Always set to "MARKET_IF_TOUCHED_ORDER" /// in a MarketIfTouchedOrderTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, /// The price threshold specified for the MarketIfTouched Order. The /// MarketIfTouched Order will only be filled by a market price that /// crosses this price from the direction of the market price at the time /// when the Order was created (the initialMarketPrice). Depending on the /// value of the Order's price and initialMarketPrice, the /// MarketIfTouchedOrder will behave like a Limit or a Stop Order. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Market-if-touched Order was initiated #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Order that this Order replaces (only provided if this /// Order replaces an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacesOrderID", skip_serializing_if = "Option::is_none")] pub replaces_order_id: Option<String>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The ID of the Transaction that cancels the replaced Order (only /// provided if this Order replaces an existing Order). /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "cancellingTransactionID", skip_serializing_if = "Option::is_none" )] pub cancelling_transaction_id: Option<String>, /// The date/time when the MarketIfTouched Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, } impl MarketIfTouchedOrderTransaction { pub fn new() -> MarketIfTouchedOrderTransaction { MarketIfTouchedOrderTransaction { time_in_force: None, request_id: None, id: None, position_fill: None, price_bound: None, user_id: None, instrument: None, units: None, otype: None, account_id: None, price: None, stop_loss_on_fill: None, batch_id: None, reason: None, trailing_stop_loss_on_fill: None, client_extensions: None, trigger_condition: None, replaces_order_id: None, take_profit_on_fill: None, trade_client_extensions: None, time: None, cancelling_transaction_id: None, gtd_time: None, } } /// The time-in-force requested for the MarketIfTouched Order. Restricted /// to "GTC", "GFD" and "GTD" for MarketIfTouched Orders. /// - param String /// - return MarketIfTouchedOrderTransaction pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return MarketIfTouchedOrderTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarketIfTouchedOrderTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return MarketIfTouchedOrderTransaction pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } /// The worst market price that may be used to fill this MarketIfTouched /// Order. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return MarketIfTouchedOrderTransaction pub fn with_price_bound(mut self, x: f32) -> Self { self.price_bound = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return MarketIfTouchedOrderTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The MarketIfTouched Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return MarketIfTouchedOrderTransaction pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The quantity requested to be filled by the MarketIfTouched Order. A /// posititive number of units results in a long Order, and a negative /// number of units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return MarketIfTouchedOrderTransaction pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// The Type of the Transaction. Always set to "MARKET_IF_TOUCHED_ORDER" /// in a MarketIfTouchedOrderTransaction. /// - param String /// - return MarketIfTouchedOrderTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return MarketIfTouchedOrderTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } /// The price threshold specified for the MarketIfTouched Order. The /// MarketIfTouched Order will only be filled by a market price that /// crosses this price from the direction of the market price at the time /// when the Order was created (the initialMarketPrice). Depending on the /// value of the Order's price and initialMarketPrice, the /// MarketIfTouchedOrder will behave like a Limit or a Stop Order. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return MarketIfTouchedOrderTransaction pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return MarketIfTouchedOrderTransaction pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarketIfTouchedOrderTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Market-if-touched Order was initiated /// - param String /// - return MarketIfTouchedOrderTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return MarketIfTouchedOrderTransaction pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return MarketIfTouchedOrderTransaction pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return MarketIfTouchedOrderTransaction pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Order that this Order replaces (only provided if this /// Order replaces an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return MarketIfTouchedOrderTransaction pub fn with_replaces_order_id(mut self, x: String) -> Self { self.replaces_order_id = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return MarketIfTouchedOrderTransaction pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return MarketIfTouchedOrderTransaction pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarketIfTouchedOrderTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The ID of the Transaction that cancels the replaced Order (only /// provided if this Order replaces an existing Order). /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarketIfTouchedOrderTransaction pub fn with_cancelling_transaction_id(mut self, x: String) -> Self { self.cancelling_transaction_id = Some(x); self } /// The date/time when the MarketIfTouched Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarketIfTouchedOrderTransaction pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct PricingHeartbeat { /// The string "HEARTBEAT" #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The date/time when the Heartbeat was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, } impl PricingHeartbeat { pub fn new() -> PricingHeartbeat { PricingHeartbeat { otype: None, time: None, } } /// The string "HEARTBEAT" /// - param String /// - return PricingHeartbeat pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The date/time when the Heartbeat was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return PricingHeartbeat pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct StopOrder { /// Date/time when the Order was filled (only provided when the Order's /// state is FILLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "filledTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub filled_time: Option<DateTime<Utc>>, /// The time-in-force requested for the Stop Order. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, /// The worst market price that may be used to fill this Stop Order. If /// the market gaps and crosses through both the price and the priceBound, /// the Stop Order will be cancelled instead of being filled. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "priceBound", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price_bound: Option<f32>, /// The Stop Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The current state of the Order. #[serde(default)] #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option<String>, /// The quantity requested to be filled by the Stop Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// The type of the Order. Always set to "STOP" for Stop Orders. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// The price threshold specified for the Stop Order. The Stop Order will /// only be filled by a market price that is equal to or worse than this /// price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// Trade ID of Trade opened when the Order was filled (only provided when /// the Order's state is FILLED and a Trade was opened as a result of the /// fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeOpenedID", skip_serializing_if = "Option::is_none")] pub trade_opened_id: Option<String>, /// Trade ID of Trade reduced when the Order was filled (only provided /// when the Order's state is FILLED and a Trade was reduced as a result /// of the fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeReducedID", skip_serializing_if = "Option::is_none")] pub trade_reduced_id: Option<String>, /// Date/time when the Order was cancelled (only provided when the state /// of the Order is CANCELLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "cancelledTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub cancelled_time: Option<DateTime<Utc>>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// ID of the Transaction that filled this Order (only provided when the /// Order's state is FILLED) /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "fillingTransactionID", skip_serializing_if = "Option::is_none" )] pub filling_transaction_id: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "createTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub create_time: Option<DateTime<Utc>>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Order that was replaced by this Order (only provided if /// this Order was created as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacesOrderID", skip_serializing_if = "Option::is_none")] pub replaces_order_id: Option<String>, /// Trade IDs of Trades closed when the Order was filled (only provided /// when the Order's state is FILLED and one or more Trades were closed as /// a result of the fill) #[serde(default)] #[serde(rename = "tradeClosedIDs", skip_serializing_if = "Option::is_none")] pub trade_closed_i_ds: Option<Vec<String>>, /// The ID of the Order that replaced this Order (only provided if this /// Order was cancelled as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacedByOrderID", skip_serializing_if = "Option::is_none")] pub replaced_by_order_id: Option<String>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// ID of the Transaction that cancelled the Order (only provided when the /// Order's state is CANCELLED) /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "cancellingTransactionID", skip_serializing_if = "Option::is_none" )] pub cancelling_transaction_id: Option<String>, /// The date/time when the Stop Order will be cancelled if its timeInForce /// is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, } impl StopOrder { pub fn new() -> StopOrder { StopOrder { filled_time: None, time_in_force: None, id: None, position_fill: None, price_bound: None, instrument: None, state: None, units: None, otype: None, stop_loss_on_fill: None, price: None, trade_opened_id: None, trade_reduced_id: None, cancelled_time: None, trailing_stop_loss_on_fill: None, filling_transaction_id: None, client_extensions: None, create_time: None, trigger_condition: None, replaces_order_id: None, trade_closed_i_ds: None, replaced_by_order_id: None, take_profit_on_fill: None, trade_client_extensions: None, cancelling_transaction_id: None, gtd_time: None, } } /// Date/time when the Order was filled (only provided when the Order's /// state is FILLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopOrder pub fn with_filled_time(mut self, x: DateTime<Utc>) -> Self { self.filled_time = Some(x); self } /// The time-in-force requested for the Stop Order. /// - param String /// - return StopOrder pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return StopOrder pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return StopOrder pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } /// The worst market price that may be used to fill this Stop Order. If /// the market gaps and crosses through both the price and the priceBound, /// the Stop Order will be cancelled instead of being filled. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return StopOrder pub fn with_price_bound(mut self, x: f32) -> Self { self.price_bound = Some(x); self } /// The Stop Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return StopOrder pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The current state of the Order. /// - param String /// - return StopOrder pub fn with_state(mut self, x: String) -> Self { self.state = Some(x); self } /// The quantity requested to be filled by the Stop Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return StopOrder pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// The type of the Order. Always set to "STOP" for Stop Orders. /// - param String /// - return StopOrder pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return StopOrder pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// The price threshold specified for the Stop Order. The Stop Order will /// only be filled by a market price that is equal to or worse than this /// price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return StopOrder pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// Trade ID of Trade opened when the Order was filled (only provided when /// the Order's state is FILLED and a Trade was opened as a result of the /// fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return StopOrder pub fn with_trade_opened_id(mut self, x: String) -> Self { self.trade_opened_id = Some(x); self } /// Trade ID of Trade reduced when the Order was filled (only provided /// when the Order's state is FILLED and a Trade was reduced as a result /// of the fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return StopOrder pub fn with_trade_reduced_id(mut self, x: String) -> Self { self.trade_reduced_id = Some(x); self } /// Date/time when the Order was cancelled (only provided when the state /// of the Order is CANCELLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopOrder pub fn with_cancelled_time(mut self, x: DateTime<Utc>) -> Self { self.cancelled_time = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return StopOrder pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// ID of the Transaction that filled this Order (only provided when the /// Order's state is FILLED) /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return StopOrder pub fn with_filling_transaction_id(mut self, x: String) -> Self { self.filling_transaction_id = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return StopOrder pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopOrder pub fn with_create_time(mut self, x: DateTime<Utc>) -> Self { self.create_time = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return StopOrder pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Order that was replaced by this Order (only provided if /// this Order was created as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return StopOrder pub fn with_replaces_order_id(mut self, x: String) -> Self { self.replaces_order_id = Some(x); self } /// Trade IDs of Trades closed when the Order was filled (only provided /// when the Order's state is FILLED and one or more Trades were closed as /// a result of the fill) /// - param Vec<String> /// - return StopOrder pub fn with_trade_closed_i_ds(mut self, x: Vec<String>) -> Self { self.trade_closed_i_ds = Some(x); self } /// The ID of the Order that replaced this Order (only provided if this /// Order was cancelled as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return StopOrder pub fn with_replaced_by_order_id(mut self, x: String) -> Self { self.replaced_by_order_id = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return StopOrder pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return StopOrder pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// ID of the Transaction that cancelled the Order (only provided when the /// Order's state is CANCELLED) /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return StopOrder pub fn with_cancelling_transaction_id(mut self, x: String) -> Self { self.cancelling_transaction_id = Some(x); self } /// The date/time when the Stop Order will be cancelled if its timeInForce /// is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopOrder pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } } /// The granularity of a candlestick #[derive(Debug, Serialize, Deserialize)] pub enum CandlestickGranularity { #[serde(rename = "S5")] S5, #[serde(rename = "S10")] S10, #[serde(rename = "S15")] S15, #[serde(rename = "S30")] S30, #[serde(rename = "M1")] M1, #[serde(rename = "M2")] M2, #[serde(rename = "M4")] M4, #[serde(rename = "M5")] M5, #[serde(rename = "M10")] M10, #[serde(rename = "M15")] M15, #[serde(rename = "M30")] M30, #[serde(rename = "H1")] H1, #[serde(rename = "H2")] H2, #[serde(rename = "H3")] H3, #[serde(rename = "H4")] H4, #[serde(rename = "H6")] H6, #[serde(rename = "H8")] H8, #[serde(rename = "H12")] H12, #[serde(rename = "D")] D, #[serde(rename = "W")] W, #[serde(rename = "M")] M, } impl FromStr for CandlestickGranularity { type Err = (); fn from_str(s: &str) -> Result<CandlestickGranularity, ()> { match s { "S5" => Ok(CandlestickGranularity::S5), "S10" => Ok(CandlestickGranularity::S10), "S15" => Ok(CandlestickGranularity::S15), "S30" => Ok(CandlestickGranularity::S30), "M1" => Ok(CandlestickGranularity::M1), "M2" => Ok(CandlestickGranularity::M2), "M4" => Ok(CandlestickGranularity::M4), "M5" => Ok(CandlestickGranularity::M5), "M10" => Ok(CandlestickGranularity::M10), "M15" => Ok(CandlestickGranularity::M15), "M30" => Ok(CandlestickGranularity::M30), "H1" => Ok(CandlestickGranularity::H1), "H2" => Ok(CandlestickGranularity::H2), "H3" => Ok(CandlestickGranularity::H3), "H4" => Ok(CandlestickGranularity::H4), "H6" => Ok(CandlestickGranularity::H6), "H8" => Ok(CandlestickGranularity::H8), "H12" => Ok(CandlestickGranularity::H12), "D" => Ok(CandlestickGranularity::D), "W" => Ok(CandlestickGranularity::W), "M" => Ok(CandlestickGranularity::M), _ => Err(()), } } } impl std::fmt::Display for CandlestickGranularity { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct TakeProfitDetails { /// The time in force for the created Take Profit Order. This may only be /// GTC, GTD or GFD. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The price that the Take Profit Order will be triggered at. Only one of /// the price and distance fields may be specified. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The date when the Take Profit Order will be cancelled on if /// timeInForce is GTD. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, } impl TakeProfitDetails { pub fn new() -> TakeProfitDetails { TakeProfitDetails { time_in_force: None, price: None, gtd_time: None, client_extensions: None, } } /// The time in force for the created Take Profit Order. This may only be /// GTC, GTD or GFD. /// - param String /// - return TakeProfitDetails pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The price that the Take Profit Order will be triggered at. Only one of /// the price and distance fields may be specified. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return TakeProfitDetails pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The date when the Take Profit Order will be cancelled on if /// timeInForce is GTD. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TakeProfitDetails pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return TakeProfitDetails pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct ClientExtensions { /// A comment associated with the Order/Trade #[serde(default)] #[serde(rename = "comment", skip_serializing_if = "Option::is_none")] pub comment: Option<String>, /// A tag associated with the Order/Trade #[serde(default)] #[serde(rename = "tag", skip_serializing_if = "Option::is_none")] pub tag: Option<String>, /// The Client ID of the Order/Trade #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, } impl ClientExtensions { pub fn new() -> ClientExtensions { ClientExtensions { comment: None, tag: None, id: None, } } /// A comment associated with the Order/Trade /// - param String /// - return ClientExtensions pub fn with_comment(mut self, x: String) -> Self { self.comment = Some(x); self } /// A tag associated with the Order/Trade /// - param String /// - return ClientExtensions pub fn with_tag(mut self, x: String) -> Self { self.tag = Some(x); self } /// The Client ID of the Order/Trade /// - param String /// - return ClientExtensions pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } } /// The state to filter the Trades by #[derive(Debug, Serialize, Deserialize)] pub enum TradeStateFilter { #[serde(rename = "OPEN")] Open, #[serde(rename = "CLOSED")] Closed, #[serde(rename = "CLOSE_WHEN_TRADEABLE")] CloseWhenTradeable, #[serde(rename = "ALL")] All, } impl FromStr for TradeStateFilter { type Err = (); fn from_str(s: &str) -> Result<TradeStateFilter, ()> { match s { "OPEN" => Ok(TradeStateFilter::Open), "CLOSED" => Ok(TradeStateFilter::Closed), "CLOSE_WHEN_TRADEABLE" => Ok(TradeStateFilter::CloseWhenTradeable), "ALL" => Ok(TradeStateFilter::All), _ => Err(()), } } } impl std::fmt::Display for TradeStateFilter { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } /// The classification of TradePLs. #[derive(Debug, Serialize, Deserialize)] pub enum TradePL { #[serde(rename = "POSITIVE")] Positive, #[serde(rename = "NEGATIVE")] Negative, #[serde(rename = "ZERO")] Zero, } impl FromStr for TradePL { type Err = (); fn from_str(s: &str) -> Result<TradePL, ()> { match s { "POSITIVE" => Ok(TradePL::Positive), "NEGATIVE" => Ok(TradePL::Negative), "ZERO" => Ok(TradePL::Zero), _ => Err(()), } } } impl std::fmt::Display for TradePL { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } /// The reason that the Stop Loss Order was initiated #[derive(Debug, Serialize, Deserialize)] pub enum StopLossOrderReason { #[serde(rename = "CLIENT_ORDER")] ClientOrder, #[serde(rename = "REPLACEMENT")] Replacement, #[serde(rename = "ON_FILL")] OnFill, } impl FromStr for StopLossOrderReason { type Err = (); fn from_str(s: &str) -> Result<StopLossOrderReason, ()> { match s { "CLIENT_ORDER" => Ok(StopLossOrderReason::ClientOrder), "REPLACEMENT" => Ok(StopLossOrderReason::Replacement), "ON_FILL" => Ok(StopLossOrderReason::OnFill), _ => Err(()), } } } impl std::fmt::Display for StopLossOrderReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct TakeProfitOrder { /// Date/time when the Order was filled (only provided when the Order's /// state is FILLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "filledTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub filled_time: Option<DateTime<Utc>>, /// The date/time when the TakeProfit Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, /// The ID of the Order that was replaced by this Order (only provided if /// this Order was created as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacesOrderID", skip_serializing_if = "Option::is_none")] pub replaces_order_id: Option<String>, /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// Date/time when the Order was cancelled (only provided when the state /// of the Order is CANCELLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "cancelledTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub cancelled_time: Option<DateTime<Utc>>, /// The price threshold specified for the TakeProfit Order. The associated /// Trade will be closed by a market price that is equal to or better than /// this threshold. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// Trade ID of Trade opened when the Order was filled (only provided when /// the Order's state is FILLED and a Trade was opened as a result of the /// fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeOpenedID", skip_serializing_if = "Option::is_none")] pub trade_opened_id: Option<String>, /// Trade IDs of Trades closed when the Order was filled (only provided /// when the Order's state is FILLED and one or more Trades were closed as /// a result of the fill) #[serde(default)] #[serde(rename = "tradeClosedIDs", skip_serializing_if = "Option::is_none")] pub trade_closed_i_ds: Option<Vec<String>>, /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "createTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub create_time: Option<DateTime<Utc>>, /// The time-in-force requested for the TakeProfit Order. Restricted to /// "GTC", "GFD" and "GTD" for TakeProfit Orders. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// Trade ID of Trade reduced when the Order was filled (only provided /// when the Order's state is FILLED and a Trade was reduced as a result /// of the fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeReducedID", skip_serializing_if = "Option::is_none")] pub trade_reduced_id: Option<String>, /// The current state of the Order. #[serde(default)] #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option<String>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The client ID of the Trade to be closed when the price threshold is /// breached. #[serde(default)] #[serde(rename = "clientTradeID", skip_serializing_if = "Option::is_none")] pub client_trade_id: Option<String>, /// ID of the Transaction that filled this Order (only provided when the /// Order's state is FILLED) /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "fillingTransactionID", skip_serializing_if = "Option::is_none" )] pub filling_transaction_id: Option<String>, /// ID of the Transaction that cancelled the Order (only provided when the /// Order's state is CANCELLED) /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "cancellingTransactionID", skip_serializing_if = "Option::is_none" )] pub cancelling_transaction_id: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The type of the Order. Always set to "TAKE_PROFIT" for Take Profit /// Orders. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Order that replaced this Order (only provided if this /// Order was cancelled as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacedByOrderID", skip_serializing_if = "Option::is_none")] pub replaced_by_order_id: Option<String>, } impl TakeProfitOrder { pub fn new() -> TakeProfitOrder { TakeProfitOrder { filled_time: None, gtd_time: None, replaces_order_id: None, trade_id: None, cancelled_time: None, price: None, trade_opened_id: None, trade_closed_i_ds: None, create_time: None, time_in_force: None, trade_reduced_id: None, state: None, trigger_condition: None, client_trade_id: None, filling_transaction_id: None, cancelling_transaction_id: None, client_extensions: None, otype: None, id: None, replaced_by_order_id: None, } } /// Date/time when the Order was filled (only provided when the Order's /// state is FILLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TakeProfitOrder pub fn with_filled_time(mut self, x: DateTime<Utc>) -> Self { self.filled_time = Some(x); self } /// The date/time when the TakeProfit Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TakeProfitOrder pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } /// The ID of the Order that was replaced by this Order (only provided if /// this Order was created as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return TakeProfitOrder pub fn with_replaces_order_id(mut self, x: String) -> Self { self.replaces_order_id = Some(x); self } /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TakeProfitOrder pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// Date/time when the Order was cancelled (only provided when the state /// of the Order is CANCELLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TakeProfitOrder pub fn with_cancelled_time(mut self, x: DateTime<Utc>) -> Self { self.cancelled_time = Some(x); self } /// The price threshold specified for the TakeProfit Order. The associated /// Trade will be closed by a market price that is equal to or better than /// this threshold. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return TakeProfitOrder pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// Trade ID of Trade opened when the Order was filled (only provided when /// the Order's state is FILLED and a Trade was opened as a result of the /// fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TakeProfitOrder pub fn with_trade_opened_id(mut self, x: String) -> Self { self.trade_opened_id = Some(x); self } /// Trade IDs of Trades closed when the Order was filled (only provided /// when the Order's state is FILLED and one or more Trades were closed as /// a result of the fill) /// - param Vec<String> /// - return TakeProfitOrder pub fn with_trade_closed_i_ds(mut self, x: Vec<String>) -> Self { self.trade_closed_i_ds = Some(x); self } /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TakeProfitOrder pub fn with_create_time(mut self, x: DateTime<Utc>) -> Self { self.create_time = Some(x); self } /// The time-in-force requested for the TakeProfit Order. Restricted to /// "GTC", "GFD" and "GTD" for TakeProfit Orders. /// - param String /// - return TakeProfitOrder pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// Trade ID of Trade reduced when the Order was filled (only provided /// when the Order's state is FILLED and a Trade was reduced as a result /// of the fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TakeProfitOrder pub fn with_trade_reduced_id(mut self, x: String) -> Self { self.trade_reduced_id = Some(x); self } /// The current state of the Order. /// - param String /// - return TakeProfitOrder pub fn with_state(mut self, x: String) -> Self { self.state = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return TakeProfitOrder pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The client ID of the Trade to be closed when the price threshold is /// breached. /// - param String /// - return TakeProfitOrder pub fn with_client_trade_id(mut self, x: String) -> Self { self.client_trade_id = Some(x); self } /// ID of the Transaction that filled this Order (only provided when the /// Order's state is FILLED) /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TakeProfitOrder pub fn with_filling_transaction_id(mut self, x: String) -> Self { self.filling_transaction_id = Some(x); self } /// ID of the Transaction that cancelled the Order (only provided when the /// Order's state is CANCELLED) /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TakeProfitOrder pub fn with_cancelling_transaction_id(mut self, x: String) -> Self { self.cancelling_transaction_id = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return TakeProfitOrder pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The type of the Order. Always set to "TAKE_PROFIT" for Take Profit /// Orders. /// - param String /// - return TakeProfitOrder pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return TakeProfitOrder pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Order that replaced this Order (only provided if this /// Order was cancelled as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return TakeProfitOrder pub fn with_replaced_by_order_id(mut self, x: String) -> Self { self.replaced_by_order_id = Some(x); self } } /// The reason that the Trailing Stop Loss Order was initiated #[derive(Debug, Serialize, Deserialize)] pub enum TrailingStopLossOrderReason { #[serde(rename = "CLIENT_ORDER")] ClientOrder, #[serde(rename = "REPLACEMENT")] Replacement, #[serde(rename = "ON_FILL")] OnFill, } impl FromStr for TrailingStopLossOrderReason { type Err = (); fn from_str(s: &str) -> Result<TrailingStopLossOrderReason, ()> { match s { "CLIENT_ORDER" => Ok(TrailingStopLossOrderReason::ClientOrder), "REPLACEMENT" => Ok(TrailingStopLossOrderReason::Replacement), "ON_FILL" => Ok(TrailingStopLossOrderReason::OnFill), _ => Err(()), } } } impl std::fmt::Display for TrailingStopLossOrderReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct LimitOrderRequest { /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The price threshold specified for the Limit Order. The Limit Order /// will only be filled by a market price that is equal to or better than /// this price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// The time-in-force requested for the Limit Order. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The Limit Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// The quantity requested to be filled by the Limit Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// The date/time when the Limit Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, /// The type of the Order to Create. Must be set to "LIMIT" when creating /// a Market Order. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, } impl LimitOrderRequest { pub fn new() -> LimitOrderRequest { LimitOrderRequest { trigger_condition: None, price: None, stop_loss_on_fill: None, take_profit_on_fill: None, time_in_force: None, instrument: None, trade_client_extensions: None, client_extensions: None, trailing_stop_loss_on_fill: None, units: None, gtd_time: None, otype: None, position_fill: None, } } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return LimitOrderRequest pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The price threshold specified for the Limit Order. The Limit Order /// will only be filled by a market price that is equal to or better than /// this price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return LimitOrderRequest pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return LimitOrderRequest pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return LimitOrderRequest pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// The time-in-force requested for the Limit Order. /// - param String /// - return LimitOrderRequest pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The Limit Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return LimitOrderRequest pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return LimitOrderRequest pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return LimitOrderRequest pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return LimitOrderRequest pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// The quantity requested to be filled by the Limit Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return LimitOrderRequest pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// The date/time when the Limit Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return LimitOrderRequest pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } /// The type of the Order to Create. Must be set to "LIMIT" when creating /// a Market Order. /// - param String /// - return LimitOrderRequest pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return LimitOrderRequest pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct Instrument { /// The smallest number of units allowed to be traded for this instrument. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "minimumTradeSize", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub minimum_trade_size: Option<f32>, /// The display name of the Instrument #[serde(default)] #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")] pub display_name: Option<String>, /// The name of the Instrument /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option<String>, /// The number of decimal places that should be used to display prices for /// this instrument. (e.g. a displayPrecision of 5 would result in a price /// of "1" being displayed as "1.00000") #[serde(default)] #[serde(rename = "displayPrecision", skip_serializing_if = "Option::is_none")] pub display_precision: Option<i32>, /// The maximum trailing stop distance allowed for a trailing stop loss /// created for this instrument. Specified in price units. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "maximumTrailingStopDistance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub maximum_trailing_stop_distance: Option<f32>, /// The minimum trailing stop distance allowed for a trailing stop loss /// created for this instrument. Specified in price units. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "minimumTrailingStopDistance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub minimum_trailing_stop_distance: Option<f32>, /// The margin rate for this instrument. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "marginRate", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_rate: Option<f32>, /// An InstrumentCommission represents an instrument-specific commission #[serde(default)] #[serde(rename = "commission", skip_serializing_if = "Option::is_none")] pub commission: Option<InstrumentCommission>, /// The amount of decimal places that may be provided when specifying the /// number of units traded for this instrument. #[serde(default)] #[serde( rename = "tradeUnitsPrecision", skip_serializing_if = "Option::is_none" )] pub trade_units_precision: Option<i32>, /// The location of the "pip" for this instrument. The decimal position of /// the pip in this Instrument's price can be found at 10 ^ pipLocation /// (e.g. -4 pipLocation results in a decimal pip position of 10 ^ -4 = /// 0.0001). #[serde(default)] #[serde(rename = "pipLocation", skip_serializing_if = "Option::is_none")] pub pip_location: Option<i32>, /// The maximum units allowed for an Order placed for this instrument. /// Specified in units. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "maximumOrderUnits", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub maximum_order_units: Option<f32>, /// The maximum position size allowed for this instrument. Specified in /// units. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "maximumPositionSize", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub maximum_position_size: Option<f32>, /// The type of the Instrument #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, } impl Instrument { pub fn new() -> Instrument { Instrument { minimum_trade_size: None, display_name: None, name: None, display_precision: None, maximum_trailing_stop_distance: None, minimum_trailing_stop_distance: None, margin_rate: None, commission: None, trade_units_precision: None, pip_location: None, maximum_order_units: None, maximum_position_size: None, otype: None, } } /// The smallest number of units allowed to be traded for this instrument. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return Instrument pub fn with_minimum_trade_size(mut self, x: f32) -> Self { self.minimum_trade_size = Some(x); self } /// The display name of the Instrument /// - param String /// - return Instrument pub fn with_display_name(mut self, x: String) -> Self { self.display_name = Some(x); self } /// The name of the Instrument /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return Instrument pub fn with_name(mut self, x: String) -> Self { self.name = Some(x); self } /// The number of decimal places that should be used to display prices for /// this instrument. (e.g. a displayPrecision of 5 would result in a price /// of "1" being displayed as "1.00000") /// - param i32 /// - return Instrument pub fn with_display_precision(mut self, x: i32) -> Self { self.display_precision = Some(x); self } /// The maximum trailing stop distance allowed for a trailing stop loss /// created for this instrument. Specified in price units. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return Instrument pub fn with_maximum_trailing_stop_distance(mut self, x: f32) -> Self { self.maximum_trailing_stop_distance = Some(x); self } /// The minimum trailing stop distance allowed for a trailing stop loss /// created for this instrument. Specified in price units. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return Instrument pub fn with_minimum_trailing_stop_distance(mut self, x: f32) -> Self { self.minimum_trailing_stop_distance = Some(x); self } /// The margin rate for this instrument. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return Instrument pub fn with_margin_rate(mut self, x: f32) -> Self { self.margin_rate = Some(x); self } /// An InstrumentCommission represents an instrument-specific commission /// - param InstrumentCommission /// - return Instrument pub fn with_commission(mut self, x: InstrumentCommission) -> Self { self.commission = Some(x); self } /// The amount of decimal places that may be provided when specifying the /// number of units traded for this instrument. /// - param i32 /// - return Instrument pub fn with_trade_units_precision(mut self, x: i32) -> Self { self.trade_units_precision = Some(x); self } /// The location of the "pip" for this instrument. The decimal position of /// the pip in this Instrument's price can be found at 10 ^ pipLocation /// (e.g. -4 pipLocation results in a decimal pip position of 10 ^ -4 = /// 0.0001). /// - param i32 /// - return Instrument pub fn with_pip_location(mut self, x: i32) -> Self { self.pip_location = Some(x); self } /// The maximum units allowed for an Order placed for this instrument. /// Specified in units. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return Instrument pub fn with_maximum_order_units(mut self, x: f32) -> Self { self.maximum_order_units = Some(x); self } /// The maximum position size allowed for this instrument. Specified in /// units. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return Instrument pub fn with_maximum_position_size(mut self, x: f32) -> Self { self.maximum_position_size = Some(x); self } /// The type of the Instrument /// - param String /// - return Instrument pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct OpenTradeFinancing { /// The amount of financing paid/collected for the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "financing", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub financing: Option<f32>, /// The ID of the Trade that financing is being paid/collected for. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, } impl OpenTradeFinancing { pub fn new() -> OpenTradeFinancing { OpenTradeFinancing { financing: None, trade_id: None, } } /// The amount of financing paid/collected for the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return OpenTradeFinancing pub fn with_financing(mut self, x: f32) -> Self { self.financing = Some(x); self } /// The ID of the Trade that financing is being paid/collected for. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return OpenTradeFinancing pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } } /// The reason that an Order was cancelled. #[derive(Debug, Serialize, Deserialize)] pub enum OrderCancelReason { #[serde(rename = "INTERNAL_SERVER_ERROR")] InternalServerError, #[serde(rename = "ACCOUNT_LOCKED")] AccountLocked, #[serde(rename = "ACCOUNT_NEW_POSITIONS_LOCKED")] AccountNewPositionsLocked, #[serde(rename = "ACCOUNT_ORDER_CREATION_LOCKED")] AccountOrderCreationLocked, #[serde(rename = "ACCOUNT_ORDER_FILL_LOCKED")] AccountOrderFillLocked, #[serde(rename = "CLIENT_REQUEST")] ClientRequest, #[serde(rename = "MIGRATION")] Migration, #[serde(rename = "MARKET_HALTED")] MarketHalted, #[serde(rename = "LINKED_TRADE_CLOSED")] LinkedTradeClosed, #[serde(rename = "TIME_IN_FORCE_EXPIRED")] TimeInForceExpired, #[serde(rename = "INSUFFICIENT_MARGIN")] InsufficientMargin, #[serde(rename = "FIFO_VIOLATION")] FifoViolation, #[serde(rename = "BOUNDS_VIOLATION")] BoundsViolation, #[serde(rename = "CLIENT_REQUEST_REPLACED")] ClientRequestReplaced, #[serde(rename = "INSUFFICIENT_LIQUIDITY")] InsufficientLiquidity, #[serde(rename = "TAKE_PROFIT_ON_FILL_GTD_TIMESTAMP_IN_PAST")] TakeProfitOnFillGtdTimestampInPast, #[serde(rename = "TAKE_PROFIT_ON_FILL_LOSS")] TakeProfitOnFillLoss, #[serde(rename = "LOSING_TAKE_PROFIT")] LosingTakeProfit, #[serde(rename = "STOP_LOSS_ON_FILL_GTD_TIMESTAMP_IN_PAST")] StopLossOnFillGtdTimestampInPast, #[serde(rename = "STOP_LOSS_ON_FILL_LOSS")] StopLossOnFillLoss, #[serde(rename = "STOP_LOSS_ON_FILL_PRICE_DISTANCE_MAXIMUM_EXCEEDED")] StopLossOnFillPriceDistanceMaximumExceeded, #[serde(rename = "STOP_LOSS_ON_FILL_REQUIRED")] StopLossOnFillRequired, #[serde(rename = "STOP_LOSS_ON_FILL_GUARANTEED_REQUIRED")] StopLossOnFillGuaranteedRequired, #[serde(rename = "STOP_LOSS_ON_FILL_GUARANTEED_NOT_ALLOWED")] StopLossOnFillGuaranteedNotAllowed, #[serde(rename = "STOP_LOSS_ON_FILL_GUARANTEED_MINIMUM_DISTANCE_NOT_MET")] StopLossOnFillGuaranteedMinimumDistanceNotMet, #[serde(rename = "STOP_LOSS_ON_FILL_GUARANTEED_LEVEL_RESTRICTION_EXCEEDED")] StopLossOnFillGuaranteedLevelRestrictionExceeded, #[serde(rename = "STOP_LOSS_ON_FILL_GUARANTEED_HEDGING_NOT_ALLOWED")] StopLossOnFillGuaranteedHedgingNotAllowed, #[serde(rename = "STOP_LOSS_ON_FILL_TIME_IN_FORCE_INVALID")] StopLossOnFillTimeInForceInvalid, #[serde(rename = "STOP_LOSS_ON_FILL_TRIGGER_CONDITION_INVALID")] StopLossOnFillTriggerConditionInvalid, #[serde(rename = "TAKE_PROFIT_ON_FILL_PRICE_DISTANCE_MAXIMUM_EXCEEDED")] TakeProfitOnFillPriceDistanceMaximumExceeded, #[serde(rename = "TRAILING_STOP_LOSS_ON_FILL_GTD_TIMESTAMP_IN_PAST")] TrailingStopLossOnFillGtdTimestampInPast, #[serde(rename = "CLIENT_TRADE_ID_ALREADY_EXISTS")] ClientTradeIdAlreadyExists, #[serde(rename = "POSITION_CLOSEOUT_FAILED")] PositionCloseoutFailed, #[serde(rename = "OPEN_TRADES_ALLOWED_EXCEEDED")] OpenTradesAllowedExceeded, #[serde(rename = "PENDING_ORDERS_ALLOWED_EXCEEDED")] PendingOrdersAllowedExceeded, #[serde(rename = "TAKE_PROFIT_ON_FILL_CLIENT_ORDER_ID_ALREADY_EXISTS")] TakeProfitOnFillClientOrderIdAlreadyExists, #[serde(rename = "STOP_LOSS_ON_FILL_CLIENT_ORDER_ID_ALREADY_EXISTS")] StopLossOnFillClientOrderIdAlreadyExists, #[serde(rename = "TRAILING_STOP_LOSS_ON_FILL_CLIENT_ORDER_ID_ALREADY_EXISTS")] TrailingStopLossOnFillClientOrderIdAlreadyExists, #[serde(rename = "POSITION_SIZE_EXCEEDED")] PositionSizeExceeded, #[serde(rename = "HEDGING_GSLO_VIOLATION")] HedgingGsloViolation, #[serde(rename = "ACCOUNT_POSITION_VALUE_LIMIT_EXCEEDED")] AccountPositionValueLimitExceeded, #[serde(rename = "INSTRUMENT_BID_REDUCE_ONLY")] InstrumentBidReduceOnly, #[serde(rename = "INSTRUMENT_ASK_REDUCE_ONLY")] InstrumentAskReduceOnly, #[serde(rename = "INSTRUMENT_BID_HALTED")] InstrumentBidHalted, #[serde(rename = "INSTRUMENT_ASK_HALTED")] InstrumentAskHalted, #[serde(rename = "STOP_LOSS_ON_FILL_GUARANTEED_BID_HALTED")] StopLossOnFillGuaranteedBidHalted, #[serde(rename = "STOP_LOSS_ON_FILL_GUARANTEED_ASK_HALTED")] StopLossOnFillGuaranteedAskHalted, } impl FromStr for OrderCancelReason { type Err = (); fn from_str(s: &str) -> Result<OrderCancelReason, ()> { match s { "INTERNAL_SERVER_ERROR" => Ok(OrderCancelReason::InternalServerError), "ACCOUNT_LOCKED" => Ok(OrderCancelReason::AccountLocked), "ACCOUNT_NEW_POSITIONS_LOCKED" => Ok(OrderCancelReason::AccountNewPositionsLocked), "ACCOUNT_ORDER_CREATION_LOCKED" => Ok(OrderCancelReason::AccountOrderCreationLocked), "ACCOUNT_ORDER_FILL_LOCKED" => Ok(OrderCancelReason::AccountOrderFillLocked), "CLIENT_REQUEST" => Ok(OrderCancelReason::ClientRequest), "MIGRATION" => Ok(OrderCancelReason::Migration), "MARKET_HALTED" => Ok(OrderCancelReason::MarketHalted), "LINKED_TRADE_CLOSED" => Ok(OrderCancelReason::LinkedTradeClosed), "TIME_IN_FORCE_EXPIRED" => Ok(OrderCancelReason::TimeInForceExpired), "INSUFFICIENT_MARGIN" => Ok(OrderCancelReason::InsufficientMargin), "FIFO_VIOLATION" => Ok(OrderCancelReason::FifoViolation), "BOUNDS_VIOLATION" => Ok(OrderCancelReason::BoundsViolation), "CLIENT_REQUEST_REPLACED" => Ok(OrderCancelReason::ClientRequestReplaced), "INSUFFICIENT_LIQUIDITY" => Ok(OrderCancelReason::InsufficientLiquidity), "TAKE_PROFIT_ON_FILL_GTD_TIMESTAMP_IN_PAST" => { Ok(OrderCancelReason::TakeProfitOnFillGtdTimestampInPast) } "TAKE_PROFIT_ON_FILL_LOSS" => Ok(OrderCancelReason::TakeProfitOnFillLoss), "LOSING_TAKE_PROFIT" => Ok(OrderCancelReason::LosingTakeProfit), "STOP_LOSS_ON_FILL_GTD_TIMESTAMP_IN_PAST" => { Ok(OrderCancelReason::StopLossOnFillGtdTimestampInPast) } "STOP_LOSS_ON_FILL_LOSS" => Ok(OrderCancelReason::StopLossOnFillLoss), "STOP_LOSS_ON_FILL_PRICE_DISTANCE_MAXIMUM_EXCEEDED" => { Ok(OrderCancelReason::StopLossOnFillPriceDistanceMaximumExceeded) } "STOP_LOSS_ON_FILL_REQUIRED" => Ok(OrderCancelReason::StopLossOnFillRequired), "STOP_LOSS_ON_FILL_GUARANTEED_REQUIRED" => { Ok(OrderCancelReason::StopLossOnFillGuaranteedRequired) } "STOP_LOSS_ON_FILL_GUARANTEED_NOT_ALLOWED" => { Ok(OrderCancelReason::StopLossOnFillGuaranteedNotAllowed) } "STOP_LOSS_ON_FILL_GUARANTEED_MINIMUM_DISTANCE_NOT_MET" => { Ok(OrderCancelReason::StopLossOnFillGuaranteedMinimumDistanceNotMet) } "STOP_LOSS_ON_FILL_GUARANTEED_LEVEL_RESTRICTION_EXCEEDED" => { Ok(OrderCancelReason::StopLossOnFillGuaranteedLevelRestrictionExceeded) } "STOP_LOSS_ON_FILL_GUARANTEED_HEDGING_NOT_ALLOWED" => { Ok(OrderCancelReason::StopLossOnFillGuaranteedHedgingNotAllowed) } "STOP_LOSS_ON_FILL_TIME_IN_FORCE_INVALID" => { Ok(OrderCancelReason::StopLossOnFillTimeInForceInvalid) } "STOP_LOSS_ON_FILL_TRIGGER_CONDITION_INVALID" => { Ok(OrderCancelReason::StopLossOnFillTriggerConditionInvalid) } "TAKE_PROFIT_ON_FILL_PRICE_DISTANCE_MAXIMUM_EXCEEDED" => { Ok(OrderCancelReason::TakeProfitOnFillPriceDistanceMaximumExceeded) } "TRAILING_STOP_LOSS_ON_FILL_GTD_TIMESTAMP_IN_PAST" => { Ok(OrderCancelReason::TrailingStopLossOnFillGtdTimestampInPast) } "CLIENT_TRADE_ID_ALREADY_EXISTS" => Ok(OrderCancelReason::ClientTradeIdAlreadyExists), "POSITION_CLOSEOUT_FAILED" => Ok(OrderCancelReason::PositionCloseoutFailed), "OPEN_TRADES_ALLOWED_EXCEEDED" => Ok(OrderCancelReason::OpenTradesAllowedExceeded), "PENDING_ORDERS_ALLOWED_EXCEEDED" => { Ok(OrderCancelReason::PendingOrdersAllowedExceeded) } "TAKE_PROFIT_ON_FILL_CLIENT_ORDER_ID_ALREADY_EXISTS" => { Ok(OrderCancelReason::TakeProfitOnFillClientOrderIdAlreadyExists) } "STOP_LOSS_ON_FILL_CLIENT_ORDER_ID_ALREADY_EXISTS" => { Ok(OrderCancelReason::StopLossOnFillClientOrderIdAlreadyExists) } "TRAILING_STOP_LOSS_ON_FILL_CLIENT_ORDER_ID_ALREADY_EXISTS" => { Ok(OrderCancelReason::TrailingStopLossOnFillClientOrderIdAlreadyExists) } "POSITION_SIZE_EXCEEDED" => Ok(OrderCancelReason::PositionSizeExceeded), "HEDGING_GSLO_VIOLATION" => Ok(OrderCancelReason::HedgingGsloViolation), "ACCOUNT_POSITION_VALUE_LIMIT_EXCEEDED" => { Ok(OrderCancelReason::AccountPositionValueLimitExceeded) } "INSTRUMENT_BID_REDUCE_ONLY" => Ok(OrderCancelReason::InstrumentBidReduceOnly), "INSTRUMENT_ASK_REDUCE_ONLY" => Ok(OrderCancelReason::InstrumentAskReduceOnly), "INSTRUMENT_BID_HALTED" => Ok(OrderCancelReason::InstrumentBidHalted), "INSTRUMENT_ASK_HALTED" => Ok(OrderCancelReason::InstrumentAskHalted), "STOP_LOSS_ON_FILL_GUARANTEED_BID_HALTED" => { Ok(OrderCancelReason::StopLossOnFillGuaranteedBidHalted) } "STOP_LOSS_ON_FILL_GUARANTEED_ASK_HALTED" => { Ok(OrderCancelReason::StopLossOnFillGuaranteedAskHalted) } _ => Err(()), } } } impl std::fmt::Display for OrderCancelReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct TrailingStopLossDetails { /// The time in force for the created Trailing Stop Loss Order. This may /// only be GTC, GTD or GFD. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The distance (in price units) from the Trade's fill price that the /// Trailing Stop Loss Order will be triggered at. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "distance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub distance: Option<f32>, /// The date when the Trailing Stop Loss Order will be cancelled on if /// timeInForce is GTD. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, } impl TrailingStopLossDetails { pub fn new() -> TrailingStopLossDetails { TrailingStopLossDetails { time_in_force: None, distance: None, gtd_time: None, client_extensions: None, } } /// The time in force for the created Trailing Stop Loss Order. This may /// only be GTC, GTD or GFD. /// - param String /// - return TrailingStopLossDetails pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The distance (in price units) from the Trade's fill price that the /// Trailing Stop Loss Order will be triggered at. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return TrailingStopLossDetails pub fn with_distance(mut self, x: f32) -> Self { self.distance = Some(x); self } /// The date when the Trailing Stop Loss Order will be cancelled on if /// timeInForce is GTD. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TrailingStopLossDetails pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return TrailingStopLossDetails pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct LiquidityRegenerationSchedule { /// The steps in the Liquidity Regeneration Schedule #[serde(default)] #[serde(rename = "steps", skip_serializing_if = "Option::is_none")] pub steps: Option<Vec<LiquidityRegenerationScheduleStep>>, } impl LiquidityRegenerationSchedule { pub fn new() -> LiquidityRegenerationSchedule { LiquidityRegenerationSchedule { steps: None } } /// The steps in the Liquidity Regeneration Schedule /// - param Vec<LiquidityRegenerationScheduleStep> /// - return LiquidityRegenerationSchedule pub fn with_steps(mut self, x: Vec<LiquidityRegenerationScheduleStep>) -> Self { self.steps = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct MarketOrder { /// Date/time when the Order was filled (only provided when the Order's /// state is FILLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "filledTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub filled_time: Option<DateTime<Utc>>, /// A MarketOrderPositionCloseout specifies the extensions to a Market /// Order when it has been created to closeout a specific Position. #[serde(default)] #[serde( rename = "longPositionCloseout", skip_serializing_if = "Option::is_none" )] pub long_position_closeout: Option<MarketOrderPositionCloseout>, /// A MarketOrderPositionCloseout specifies the extensions to a Market /// Order when it has been created to closeout a specific Position. #[serde(default)] #[serde( rename = "shortPositionCloseout", skip_serializing_if = "Option::is_none" )] pub short_position_closeout: Option<MarketOrderPositionCloseout>, /// The time-in-force requested for the Market Order. Restricted to FOK or /// IOC for a MarketOrder. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, /// The worst price that the client is willing to have the Market Order /// filled at. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "priceBound", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price_bound: Option<f32>, /// The Market Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The current state of the Order. #[serde(default)] #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option<String>, /// The quantity requested to be filled by the Market Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// The type of the Order. Always set to "MARKET" for Market Orders. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// Trade ID of Trade opened when the Order was filled (only provided when /// the Order's state is FILLED and a Trade was opened as a result of the /// fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeOpenedID", skip_serializing_if = "Option::is_none")] pub trade_opened_id: Option<String>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// Details for the Market Order extensions specific to a Market Order /// placed with the intent of fully closing a specific open trade that /// should have already been closed but wasn't due to halted market /// conditions #[serde(default)] #[serde(rename = "delayedTradeClose", skip_serializing_if = "Option::is_none")] pub delayed_trade_close: Option<MarketOrderDelayedTradeClose>, /// A MarketOrderTradeClose specifies the extensions to a Market Order /// that has been created specifically to close a Trade. #[serde(default)] #[serde(rename = "tradeClose", skip_serializing_if = "Option::is_none")] pub trade_close: Option<MarketOrderTradeClose>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// ID of the Transaction that filled this Order (only provided when the /// Order's state is FILLED) /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "fillingTransactionID", skip_serializing_if = "Option::is_none" )] pub filling_transaction_id: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "createTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub create_time: Option<DateTime<Utc>>, /// Date/time when the Order was cancelled (only provided when the state /// of the Order is CANCELLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "cancelledTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub cancelled_time: Option<DateTime<Utc>>, /// Trade ID of Trade reduced when the Order was filled (only provided /// when the Order's state is FILLED and a Trade was reduced as a result /// of the fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeReducedID", skip_serializing_if = "Option::is_none")] pub trade_reduced_id: Option<String>, /// Trade IDs of Trades closed when the Order was filled (only provided /// when the Order's state is FILLED and one or more Trades were closed as /// a result of the fill) #[serde(default)] #[serde(rename = "tradeClosedIDs", skip_serializing_if = "Option::is_none")] pub trade_closed_i_ds: Option<Vec<String>>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// Details for the Market Order extensions specific to a Market Order /// placed that is part of a Market Order Margin Closeout in a client's /// account #[serde(default)] #[serde(rename = "marginCloseout", skip_serializing_if = "Option::is_none")] pub margin_closeout: Option<MarketOrderMarginCloseout>, /// ID of the Transaction that cancelled the Order (only provided when the /// Order's state is CANCELLED) /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "cancellingTransactionID", skip_serializing_if = "Option::is_none" )] pub cancelling_transaction_id: Option<String>, } impl MarketOrder { pub fn new() -> MarketOrder { MarketOrder { filled_time: None, long_position_closeout: None, short_position_closeout: None, time_in_force: None, id: None, position_fill: None, price_bound: None, instrument: None, state: None, units: None, otype: None, trade_opened_id: None, stop_loss_on_fill: None, delayed_trade_close: None, trade_close: None, trailing_stop_loss_on_fill: None, filling_transaction_id: None, client_extensions: None, create_time: None, cancelled_time: None, trade_reduced_id: None, trade_closed_i_ds: None, take_profit_on_fill: None, trade_client_extensions: None, margin_closeout: None, cancelling_transaction_id: None, } } /// Date/time when the Order was filled (only provided when the Order's /// state is FILLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarketOrder pub fn with_filled_time(mut self, x: DateTime<Utc>) -> Self { self.filled_time = Some(x); self } /// A MarketOrderPositionCloseout specifies the extensions to a Market /// Order when it has been created to closeout a specific Position. /// - param MarketOrderPositionCloseout /// - return MarketOrder pub fn with_long_position_closeout(mut self, x: MarketOrderPositionCloseout) -> Self { self.long_position_closeout = Some(x); self } /// A MarketOrderPositionCloseout specifies the extensions to a Market /// Order when it has been created to closeout a specific Position. /// - param MarketOrderPositionCloseout /// - return MarketOrder pub fn with_short_position_closeout(mut self, x: MarketOrderPositionCloseout) -> Self { self.short_position_closeout = Some(x); self } /// The time-in-force requested for the Market Order. Restricted to FOK or /// IOC for a MarketOrder. /// - param String /// - return MarketOrder pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return MarketOrder pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return MarketOrder pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } /// The worst price that the client is willing to have the Market Order /// filled at. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return MarketOrder pub fn with_price_bound(mut self, x: f32) -> Self { self.price_bound = Some(x); self } /// The Market Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return MarketOrder pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The current state of the Order. /// - param String /// - return MarketOrder pub fn with_state(mut self, x: String) -> Self { self.state = Some(x); self } /// The quantity requested to be filled by the Market Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return MarketOrder pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// The type of the Order. Always set to "MARKET" for Market Orders. /// - param String /// - return MarketOrder pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// Trade ID of Trade opened when the Order was filled (only provided when /// the Order's state is FILLED and a Trade was opened as a result of the /// fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return MarketOrder pub fn with_trade_opened_id(mut self, x: String) -> Self { self.trade_opened_id = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return MarketOrder pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// Details for the Market Order extensions specific to a Market Order /// placed with the intent of fully closing a specific open trade that /// should have already been closed but wasn't due to halted market /// conditions /// - param MarketOrderDelayedTradeClose /// - return MarketOrder pub fn with_delayed_trade_close(mut self, x: MarketOrderDelayedTradeClose) -> Self { self.delayed_trade_close = Some(x); self } /// A MarketOrderTradeClose specifies the extensions to a Market Order /// that has been created specifically to close a Trade. /// - param MarketOrderTradeClose /// - return MarketOrder pub fn with_trade_close(mut self, x: MarketOrderTradeClose) -> Self { self.trade_close = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return MarketOrder pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// ID of the Transaction that filled this Order (only provided when the /// Order's state is FILLED) /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarketOrder pub fn with_filling_transaction_id(mut self, x: String) -> Self { self.filling_transaction_id = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return MarketOrder pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarketOrder pub fn with_create_time(mut self, x: DateTime<Utc>) -> Self { self.create_time = Some(x); self } /// Date/time when the Order was cancelled (only provided when the state /// of the Order is CANCELLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarketOrder pub fn with_cancelled_time(mut self, x: DateTime<Utc>) -> Self { self.cancelled_time = Some(x); self } /// Trade ID of Trade reduced when the Order was filled (only provided /// when the Order's state is FILLED and a Trade was reduced as a result /// of the fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return MarketOrder pub fn with_trade_reduced_id(mut self, x: String) -> Self { self.trade_reduced_id = Some(x); self } /// Trade IDs of Trades closed when the Order was filled (only provided /// when the Order's state is FILLED and one or more Trades were closed as /// a result of the fill) /// - param Vec<String> /// - return MarketOrder pub fn with_trade_closed_i_ds(mut self, x: Vec<String>) -> Self { self.trade_closed_i_ds = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return MarketOrder pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return MarketOrder pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// Details for the Market Order extensions specific to a Market Order /// placed that is part of a Market Order Margin Closeout in a client's /// account /// - param MarketOrderMarginCloseout /// - return MarketOrder pub fn with_margin_closeout(mut self, x: MarketOrderMarginCloseout) -> Self { self.margin_closeout = Some(x); self } /// ID of the Transaction that cancelled the Order (only provided when the /// Order's state is CANCELLED) /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarketOrder pub fn with_cancelling_transaction_id(mut self, x: String) -> Self { self.cancelling_transaction_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct OrderCancelRejectTransaction { /// The ID of the Order intended to be cancelled /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "orderID", skip_serializing_if = "Option::is_none")] pub order_id: Option<String>, /// The client ID of the Order intended to be cancelled (only provided if /// the Order has a client Order ID). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "clientOrderID", skip_serializing_if = "Option::is_none")] pub client_order_id: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Reject Transaction was created #[serde(default)] #[serde(rename = "rejectReason", skip_serializing_if = "Option::is_none")] pub reject_reason: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "ORDER_CANCEL_REJECT" for /// an OrderCancelRejectTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl OrderCancelRejectTransaction { pub fn new() -> OrderCancelRejectTransaction { OrderCancelRejectTransaction { order_id: None, client_order_id: None, user_id: None, batch_id: None, reject_reason: None, request_id: None, time: None, otype: None, id: None, account_id: None, } } /// The ID of the Order intended to be cancelled /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return OrderCancelRejectTransaction pub fn with_order_id(mut self, x: String) -> Self { self.order_id = Some(x); self } /// The client ID of the Order intended to be cancelled (only provided if /// the Order has a client Order ID). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return OrderCancelRejectTransaction pub fn with_client_order_id(mut self, x: String) -> Self { self.client_order_id = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return OrderCancelRejectTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return OrderCancelRejectTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Reject Transaction was created /// - param String /// - return OrderCancelRejectTransaction pub fn with_reject_reason(mut self, x: String) -> Self { self.reject_reason = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return OrderCancelRejectTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return OrderCancelRejectTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The Type of the Transaction. Always set to "ORDER_CANCEL_REJECT" for /// an OrderCancelRejectTransaction. /// - param String /// - return OrderCancelRejectTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return OrderCancelRejectTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return OrderCancelRejectTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct StopLossOrderTransaction { /// Specifies the distance (in price units) from the Account's current /// price to use as the Stop Loss Order price. If the Trade is short the /// Instrument's bid price is used, and for long Trades the ask is used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "distance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub distance: Option<f32>, /// The time-in-force requested for the StopLoss Order. Restricted to /// "GTC", "GFD" and "GTD" for StopLoss Orders. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Order that this Order replaces (only provided if this /// Order replaces an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacesOrderID", skip_serializing_if = "Option::is_none")] pub replaces_order_id: Option<String>, /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// Flag indicating that the Stop Loss Order is guaranteed. The default /// value depends on the GuaranteedStopLossOrderMode of the account, if it /// is REQUIRED, the default will be true, for DISABLED or ENABLED the /// default is false. #[serde(default)] #[serde(rename = "guaranteed", skip_serializing_if = "Option::is_none")] pub guaranteed: Option<bool>, /// The price threshold specified for the Stop Loss Order. If the /// guaranteed flag is false, the associated Trade will be closed by a /// market price that is equal to or worse than this threshold. If the /// flag is true the associated Trade will be closed at this price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The client ID of the Trade to be closed when the price threshold is /// breached. #[serde(default)] #[serde(rename = "clientTradeID", skip_serializing_if = "Option::is_none")] pub client_trade_id: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Stop Loss Order was initiated #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// The fee that will be charged if the Stop Loss Order is guaranteed and /// the Order is filled at the guaranteed price. The value is determined /// at Order creation time. It is in price units and is charged for each /// unit of the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "guaranteedExecutionPremium", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub guaranteed_execution_premium: Option<f32>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The ID of the OrderFill Transaction that caused this Order to be /// created (only provided if this Order was created automatically when /// another Order was filled). /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "orderFillTransactionID", skip_serializing_if = "Option::is_none" )] pub order_fill_transaction_id: Option<String>, /// The ID of the Transaction that cancels the replaced Order (only /// provided if this Order replaces an existing Order). /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "cancellingTransactionID", skip_serializing_if = "Option::is_none" )] pub cancelling_transaction_id: Option<String>, /// The date/time when the StopLoss Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "STOP_LOSS_ORDER" in a /// StopLossOrderTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl StopLossOrderTransaction { pub fn new() -> StopLossOrderTransaction { StopLossOrderTransaction { distance: None, time_in_force: None, trigger_condition: None, replaces_order_id: None, trade_id: None, guaranteed: None, price: None, client_trade_id: None, user_id: None, batch_id: None, reason: None, guaranteed_execution_premium: None, request_id: None, client_extensions: None, time: None, order_fill_transaction_id: None, cancelling_transaction_id: None, gtd_time: None, otype: None, id: None, account_id: None, } } /// Specifies the distance (in price units) from the Account's current /// price to use as the Stop Loss Order price. If the Trade is short the /// Instrument's bid price is used, and for long Trades the ask is used. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return StopLossOrderTransaction pub fn with_distance(mut self, x: f32) -> Self { self.distance = Some(x); self } /// The time-in-force requested for the StopLoss Order. Restricted to /// "GTC", "GFD" and "GTD" for StopLoss Orders. /// - param String /// - return StopLossOrderTransaction pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return StopLossOrderTransaction pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Order that this Order replaces (only provided if this /// Order replaces an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return StopLossOrderTransaction pub fn with_replaces_order_id(mut self, x: String) -> Self { self.replaces_order_id = Some(x); self } /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return StopLossOrderTransaction pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// Flag indicating that the Stop Loss Order is guaranteed. The default /// value depends on the GuaranteedStopLossOrderMode of the account, if it /// is REQUIRED, the default will be true, for DISABLED or ENABLED the /// default is false. /// - param bool /// - return StopLossOrderTransaction pub fn with_guaranteed(mut self, x: bool) -> Self { self.guaranteed = Some(x); self } /// The price threshold specified for the Stop Loss Order. If the /// guaranteed flag is false, the associated Trade will be closed by a /// market price that is equal to or worse than this threshold. If the /// flag is true the associated Trade will be closed at this price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return StopLossOrderTransaction pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The client ID of the Trade to be closed when the price threshold is /// breached. /// - param String /// - return StopLossOrderTransaction pub fn with_client_trade_id(mut self, x: String) -> Self { self.client_trade_id = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return StopLossOrderTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return StopLossOrderTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Stop Loss Order was initiated /// - param String /// - return StopLossOrderTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// The fee that will be charged if the Stop Loss Order is guaranteed and /// the Order is filled at the guaranteed price. The value is determined /// at Order creation time. It is in price units and is charged for each /// unit of the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return StopLossOrderTransaction pub fn with_guaranteed_execution_premium(mut self, x: f32) -> Self { self.guaranteed_execution_premium = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return StopLossOrderTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return StopLossOrderTransaction pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopLossOrderTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The ID of the OrderFill Transaction that caused this Order to be /// created (only provided if this Order was created automatically when /// another Order was filled). /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return StopLossOrderTransaction pub fn with_order_fill_transaction_id(mut self, x: String) -> Self { self.order_fill_transaction_id = Some(x); self } /// The ID of the Transaction that cancels the replaced Order (only /// provided if this Order replaces an existing Order). /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return StopLossOrderTransaction pub fn with_cancelling_transaction_id(mut self, x: String) -> Self { self.cancelling_transaction_id = Some(x); self } /// The date/time when the StopLoss Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopLossOrderTransaction pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } /// The Type of the Transaction. Always set to "STOP_LOSS_ORDER" in a /// StopLossOrderTransaction. /// - param String /// - return StopLossOrderTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return StopLossOrderTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return StopLossOrderTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct Price { /// The list of prices and liquidity available on the Instrument's ask /// side. It is possible for this list to be empty if there is no ask /// liquidity currently available for the Instrument in the Account. #[serde(default)] #[serde(rename = "asks", skip_serializing_if = "Option::is_none")] pub asks: Option<Vec<PriceBucket>>, /// The base ask price as calculated by pricing. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "baseAsk", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub base_ask: Option<f32>, /// The date/time when the Price was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "timestamp", skip_serializing_if = "Option::is_none", with = "serdates" )] pub timestamp: Option<DateTime<Utc>>, /// The closeout bid price. This price is used when a bid is required to /// closeout a Position (margin closeout or manual) yet there is no bid /// liquidity. The closeout bid is never used to open a new position. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "closeoutBid", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub closeout_bid: Option<f32>, /// The list of prices and liquidity available on the Instrument's bid /// side. It is possible for this list to be empty if there is no bid /// liquidity currently available for the Instrument in the Account. #[serde(default)] #[serde(rename = "bids", skip_serializing_if = "Option::is_none")] pub bids: Option<Vec<PriceBucket>>, /// The Price's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The base bid price as calculated by pricing. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "baseBid", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub base_bid: Option<f32>, /// The closeout ask price. This price is used when an ask is required to /// closeout a Position (margin closeout or manual) yet there is no ask /// liquidity. The closeout ask is never used to open a new position. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "closeoutAsk", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub closeout_ask: Option<f32>, /// Flag indicating if the Price is tradeable or not #[serde(default)] #[serde(rename = "tradeable", skip_serializing_if = "Option::is_none")] pub tradeable: Option<bool>, } impl Price { pub fn new() -> Price { Price { asks: None, base_ask: None, timestamp: None, closeout_bid: None, bids: None, instrument: None, base_bid: None, closeout_ask: None, tradeable: None, } } /// The list of prices and liquidity available on the Instrument's ask /// side. It is possible for this list to be empty if there is no ask /// liquidity currently available for the Instrument in the Account. /// - param Vec<PriceBucket> /// - return Price pub fn with_asks(mut self, x: Vec<PriceBucket>) -> Self { self.asks = Some(x); self } /// The base ask price as calculated by pricing. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return Price pub fn with_base_ask(mut self, x: f32) -> Self { self.base_ask = Some(x); self } /// The date/time when the Price was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return Price pub fn with_timestamp(mut self, x: DateTime<Utc>) -> Self { self.timestamp = Some(x); self } /// The closeout bid price. This price is used when a bid is required to /// closeout a Position (margin closeout or manual) yet there is no bid /// liquidity. The closeout bid is never used to open a new position. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return Price pub fn with_closeout_bid(mut self, x: f32) -> Self { self.closeout_bid = Some(x); self } /// The list of prices and liquidity available on the Instrument's bid /// side. It is possible for this list to be empty if there is no bid /// liquidity currently available for the Instrument in the Account. /// - param Vec<PriceBucket> /// - return Price pub fn with_bids(mut self, x: Vec<PriceBucket>) -> Self { self.bids = Some(x); self } /// The Price's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return Price pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The base bid price as calculated by pricing. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return Price pub fn with_base_bid(mut self, x: f32) -> Self { self.base_bid = Some(x); self } /// The closeout ask price. This price is used when an ask is required to /// closeout a Position (margin closeout or manual) yet there is no ask /// liquidity. The closeout ask is never used to open a new position. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return Price pub fn with_closeout_ask(mut self, x: f32) -> Self { self.closeout_ask = Some(x); self } /// Flag indicating if the Price is tradeable or not /// - param bool /// - return Price pub fn with_tradeable(mut self, x: bool) -> Self { self.tradeable = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct LimitOrder { /// Date/time when the Order was filled (only provided when the Order's /// state is FILLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "filledTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub filled_time: Option<DateTime<Utc>>, /// The time-in-force requested for the Limit Order. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, /// The Limit Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The current state of the Order. #[serde(default)] #[serde(rename = "state", skip_serializing_if = "Option::is_none")] pub state: Option<String>, /// The quantity requested to be filled by the Limit Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// The type of the Order. Always set to "LIMIT" for Limit Orders. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// Trade ID of Trade opened when the Order was filled (only provided when /// the Order's state is FILLED and a Trade was opened as a result of the /// fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeOpenedID", skip_serializing_if = "Option::is_none")] pub trade_opened_id: Option<String>, /// The price threshold specified for the Limit Order. The Limit Order /// will only be filled by a market price that is equal to or better than /// this price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// Trade ID of Trade reduced when the Order was filled (only provided /// when the Order's state is FILLED and a Trade was reduced as a result /// of the fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeReducedID", skip_serializing_if = "Option::is_none")] pub trade_reduced_id: Option<String>, /// Date/time when the Order was cancelled (only provided when the state /// of the Order is CANCELLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "cancelledTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub cancelled_time: Option<DateTime<Utc>>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// ID of the Transaction that filled this Order (only provided when the /// Order's state is FILLED) /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "fillingTransactionID", skip_serializing_if = "Option::is_none" )] pub filling_transaction_id: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "createTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub create_time: Option<DateTime<Utc>>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Order that was replaced by this Order (only provided if /// this Order was created as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacesOrderID", skip_serializing_if = "Option::is_none")] pub replaces_order_id: Option<String>, /// Trade IDs of Trades closed when the Order was filled (only provided /// when the Order's state is FILLED and one or more Trades were closed as /// a result of the fill) #[serde(default)] #[serde(rename = "tradeClosedIDs", skip_serializing_if = "Option::is_none")] pub trade_closed_i_ds: Option<Vec<String>>, /// The ID of the Order that replaced this Order (only provided if this /// Order was cancelled as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacedByOrderID", skip_serializing_if = "Option::is_none")] pub replaced_by_order_id: Option<String>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// ID of the Transaction that cancelled the Order (only provided when the /// Order's state is CANCELLED) /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "cancellingTransactionID", skip_serializing_if = "Option::is_none" )] pub cancelling_transaction_id: Option<String>, /// The date/time when the Limit Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, } impl LimitOrder { pub fn new() -> LimitOrder { LimitOrder { filled_time: None, time_in_force: None, id: None, position_fill: None, instrument: None, state: None, units: None, otype: None, trade_opened_id: None, price: None, stop_loss_on_fill: None, trade_reduced_id: None, cancelled_time: None, trailing_stop_loss_on_fill: None, filling_transaction_id: None, client_extensions: None, create_time: None, trigger_condition: None, replaces_order_id: None, trade_closed_i_ds: None, replaced_by_order_id: None, take_profit_on_fill: None, trade_client_extensions: None, cancelling_transaction_id: None, gtd_time: None, } } /// Date/time when the Order was filled (only provided when the Order's /// state is FILLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return LimitOrder pub fn with_filled_time(mut self, x: DateTime<Utc>) -> Self { self.filled_time = Some(x); self } /// The time-in-force requested for the Limit Order. /// - param String /// - return LimitOrder pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The Order's identifier, unique within the Order's Account. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return LimitOrder pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return LimitOrder pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } /// The Limit Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return LimitOrder pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The current state of the Order. /// - param String /// - return LimitOrder pub fn with_state(mut self, x: String) -> Self { self.state = Some(x); self } /// The quantity requested to be filled by the Limit Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return LimitOrder pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// The type of the Order. Always set to "LIMIT" for Limit Orders. /// - param String /// - return LimitOrder pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// Trade ID of Trade opened when the Order was filled (only provided when /// the Order's state is FILLED and a Trade was opened as a result of the /// fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return LimitOrder pub fn with_trade_opened_id(mut self, x: String) -> Self { self.trade_opened_id = Some(x); self } /// The price threshold specified for the Limit Order. The Limit Order /// will only be filled by a market price that is equal to or better than /// this price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return LimitOrder pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return LimitOrder pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// Trade ID of Trade reduced when the Order was filled (only provided /// when the Order's state is FILLED and a Trade was reduced as a result /// of the fill) /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return LimitOrder pub fn with_trade_reduced_id(mut self, x: String) -> Self { self.trade_reduced_id = Some(x); self } /// Date/time when the Order was cancelled (only provided when the state /// of the Order is CANCELLED) /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return LimitOrder pub fn with_cancelled_time(mut self, x: DateTime<Utc>) -> Self { self.cancelled_time = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return LimitOrder pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// ID of the Transaction that filled this Order (only provided when the /// Order's state is FILLED) /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return LimitOrder pub fn with_filling_transaction_id(mut self, x: String) -> Self { self.filling_transaction_id = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return LimitOrder pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The time when the Order was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return LimitOrder pub fn with_create_time(mut self, x: DateTime<Utc>) -> Self { self.create_time = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return LimitOrder pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Order that was replaced by this Order (only provided if /// this Order was created as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return LimitOrder pub fn with_replaces_order_id(mut self, x: String) -> Self { self.replaces_order_id = Some(x); self } /// Trade IDs of Trades closed when the Order was filled (only provided /// when the Order's state is FILLED and one or more Trades were closed as /// a result of the fill) /// - param Vec<String> /// - return LimitOrder pub fn with_trade_closed_i_ds(mut self, x: Vec<String>) -> Self { self.trade_closed_i_ds = Some(x); self } /// The ID of the Order that replaced this Order (only provided if this /// Order was cancelled as part of a cancel/replace). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return LimitOrder pub fn with_replaced_by_order_id(mut self, x: String) -> Self { self.replaced_by_order_id = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return LimitOrder pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return LimitOrder pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// ID of the Transaction that cancelled the Order (only provided when the /// Order's state is CANCELLED) /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return LimitOrder pub fn with_cancelling_transaction_id(mut self, x: String) -> Self { self.cancelling_transaction_id = Some(x); self } /// The date/time when the Limit Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return LimitOrder pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct TrailingStopLossOrderRejectTransaction { /// The price distance (in price units) specified for the TrailingStopLoss /// Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "distance", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub distance: Option<f32>, /// The time-in-force requested for the TrailingStopLoss Order. Restricted /// to "GTC", "GFD" and "GTD" for TrailingStopLoss Orders. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Order that this Order was intended to replace (only /// provided if this Order was intended to replace an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde( rename = "intendedReplacesOrderID", skip_serializing_if = "Option::is_none" )] pub intended_replaces_order_id: Option<String>, /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// The client ID of the Trade to be closed when the price threshold is /// breached. #[serde(default)] #[serde(rename = "clientTradeID", skip_serializing_if = "Option::is_none")] pub client_trade_id: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Reject Transaction was created #[serde(default)] #[serde(rename = "rejectReason", skip_serializing_if = "Option::is_none")] pub reject_reason: Option<String>, /// The reason that the Trailing Stop Loss Order was initiated #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The ID of the OrderFill Transaction that caused this Order to be /// created (only provided if this Order was created automatically when /// another Order was filled). /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "orderFillTransactionID", skip_serializing_if = "Option::is_none" )] pub order_fill_transaction_id: Option<String>, /// The date/time when the StopLoss Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to /// "TRAILING_STOP_LOSS_ORDER_REJECT" in a /// TrailingStopLossOrderRejectTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl TrailingStopLossOrderRejectTransaction { pub fn new() -> TrailingStopLossOrderRejectTransaction { TrailingStopLossOrderRejectTransaction { distance: None, time_in_force: None, trigger_condition: None, intended_replaces_order_id: None, trade_id: None, client_trade_id: None, user_id: None, batch_id: None, reject_reason: None, reason: None, request_id: None, client_extensions: None, time: None, order_fill_transaction_id: None, gtd_time: None, otype: None, id: None, account_id: None, } } /// The price distance (in price units) specified for the TrailingStopLoss /// Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return TrailingStopLossOrderRejectTransaction pub fn with_distance(mut self, x: f32) -> Self { self.distance = Some(x); self } /// The time-in-force requested for the TrailingStopLoss Order. Restricted /// to "GTC", "GFD" and "GTD" for TrailingStopLoss Orders. /// - param String /// - return TrailingStopLossOrderRejectTransaction pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return TrailingStopLossOrderRejectTransaction pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Order that this Order was intended to replace (only /// provided if this Order was intended to replace an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return TrailingStopLossOrderRejectTransaction pub fn with_intended_replaces_order_id(mut self, x: String) -> Self { self.intended_replaces_order_id = Some(x); self } /// The ID of the Trade to close when the price threshold is breached. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TrailingStopLossOrderRejectTransaction pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// The client ID of the Trade to be closed when the price threshold is /// breached. /// - param String /// - return TrailingStopLossOrderRejectTransaction pub fn with_client_trade_id(mut self, x: String) -> Self { self.client_trade_id = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return TrailingStopLossOrderRejectTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TrailingStopLossOrderRejectTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Reject Transaction was created /// - param String /// - return TrailingStopLossOrderRejectTransaction pub fn with_reject_reason(mut self, x: String) -> Self { self.reject_reason = Some(x); self } /// The reason that the Trailing Stop Loss Order was initiated /// - param String /// - return TrailingStopLossOrderRejectTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return TrailingStopLossOrderRejectTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return TrailingStopLossOrderRejectTransaction pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TrailingStopLossOrderRejectTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The ID of the OrderFill Transaction that caused this Order to be /// created (only provided if this Order was created automatically when /// another Order was filled). /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TrailingStopLossOrderRejectTransaction pub fn with_order_fill_transaction_id(mut self, x: String) -> Self { self.order_fill_transaction_id = Some(x); self } /// The date/time when the StopLoss Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TrailingStopLossOrderRejectTransaction pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } /// The Type of the Transaction. Always set to /// "TRAILING_STOP_LOSS_ORDER_REJECT" in a /// TrailingStopLossOrderRejectTransaction. /// - param String /// - return TrailingStopLossOrderRejectTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TrailingStopLossOrderRejectTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return TrailingStopLossOrderRejectTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct OrderClientExtensionsModifyTransaction { /// The ID of the Order who's client extensions are to be modified. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "orderID", skip_serializing_if = "Option::is_none")] pub order_id: Option<String>, /// The original Client ID of the Order who's client extensions are to be /// modified. #[serde(default)] #[serde(rename = "clientOrderID", skip_serializing_if = "Option::is_none")] pub client_order_id: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "clientExtensionsModify", skip_serializing_if = "Option::is_none" )] pub client_extensions_modify: Option<ClientExtensions>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensionsModify", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions_modify: Option<ClientExtensions>, /// The Type of the Transaction. Always set to /// "ORDER_CLIENT_EXTENSIONS_MODIFY" for a /// OrderClienteExtensionsModifyTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl OrderClientExtensionsModifyTransaction { pub fn new() -> OrderClientExtensionsModifyTransaction { OrderClientExtensionsModifyTransaction { order_id: None, client_order_id: None, user_id: None, batch_id: None, client_extensions_modify: None, request_id: None, time: None, trade_client_extensions_modify: None, otype: None, id: None, account_id: None, } } /// The ID of the Order who's client extensions are to be modified. /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return OrderClientExtensionsModifyTransaction pub fn with_order_id(mut self, x: String) -> Self { self.order_id = Some(x); self } /// The original Client ID of the Order who's client extensions are to be /// modified. /// - param String /// - return OrderClientExtensionsModifyTransaction pub fn with_client_order_id(mut self, x: String) -> Self { self.client_order_id = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return OrderClientExtensionsModifyTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return OrderClientExtensionsModifyTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return OrderClientExtensionsModifyTransaction pub fn with_client_extensions_modify(mut self, x: ClientExtensions) -> Self { self.client_extensions_modify = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return OrderClientExtensionsModifyTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return OrderClientExtensionsModifyTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return OrderClientExtensionsModifyTransaction pub fn with_trade_client_extensions_modify(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions_modify = Some(x); self } /// The Type of the Transaction. Always set to /// "ORDER_CLIENT_EXTENSIONS_MODIFY" for a /// OrderClienteExtensionsModifyTransaction. /// - param String /// - return OrderClientExtensionsModifyTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return OrderClientExtensionsModifyTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return OrderClientExtensionsModifyTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct MarketOrderRequest { /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, /// The worst price that the client is willing to have the Market Order /// filled at. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "priceBound", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price_bound: Option<f32>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// The time-in-force requested for the Market Order. Restricted to FOK or /// IOC for a MarketOrder. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The Market Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// The quantity requested to be filled by the Market Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// The type of the Order to Create. Must be set to "MARKET" when creating /// a Market Order. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, } impl MarketOrderRequest { pub fn new() -> MarketOrderRequest { MarketOrderRequest { stop_loss_on_fill: None, position_fill: None, price_bound: None, take_profit_on_fill: None, time_in_force: None, instrument: None, trade_client_extensions: None, trailing_stop_loss_on_fill: None, units: None, client_extensions: None, otype: None, } } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return MarketOrderRequest pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return MarketOrderRequest pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } /// The worst price that the client is willing to have the Market Order /// filled at. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return MarketOrderRequest pub fn with_price_bound(mut self, x: f32) -> Self { self.price_bound = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return MarketOrderRequest pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// The time-in-force requested for the Market Order. Restricted to FOK or /// IOC for a MarketOrder. /// - param String /// - return MarketOrderRequest pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The Market Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return MarketOrderRequest pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return MarketOrderRequest pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return MarketOrderRequest pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// The quantity requested to be filled by the Market Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return MarketOrderRequest pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return MarketOrderRequest pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// The type of the Order to Create. Must be set to "MARKET" when creating /// a Market Order. /// - param String /// - return MarketOrderRequest pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct UserInfo { /// The user-provided username. #[serde(default)] #[serde(rename = "username", skip_serializing_if = "Option::is_none")] pub username: Option<String>, /// The country that the user is based in. #[serde(default)] #[serde(rename = "country", skip_serializing_if = "Option::is_none")] pub country: Option<String>, /// The user's email address. #[serde(default)] #[serde(rename = "emailAddress", skip_serializing_if = "Option::is_none")] pub email_address: Option<String>, /// The user's OANDA-assigned user ID. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, } impl UserInfo { pub fn new() -> UserInfo { UserInfo { username: None, country: None, email_address: None, user_id: None, } } /// The user-provided username. /// - param String /// - return UserInfo pub fn with_username(mut self, x: String) -> Self { self.username = Some(x); self } /// The country that the user is based in. /// - param String /// - return UserInfo pub fn with_country(mut self, x: String) -> Self { self.country = Some(x); self } /// The user's email address. /// - param String /// - return UserInfo pub fn with_email_address(mut self, x: String) -> Self { self.email_address = Some(x); self } /// The user's OANDA-assigned user ID. /// - param i32 /// - return UserInfo pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct TransferFundsRejectTransaction { /// An optional comment that may be attached to a fund transfer for audit /// purposes #[serde(default)] #[serde(rename = "comment", skip_serializing_if = "Option::is_none")] pub comment: Option<String>, /// The reason that an Account is being funded. #[serde(default)] #[serde(rename = "fundingReason", skip_serializing_if = "Option::is_none")] pub funding_reason: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Reject Transaction was created #[serde(default)] #[serde(rename = "rejectReason", skip_serializing_if = "Option::is_none")] pub reject_reason: Option<String>, /// The amount to deposit/withdraw from the Account in the Account's home /// currency. A positive value indicates a deposit, a negative value /// indicates a withdrawal. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "amount", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub amount: Option<f32>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "TRANSFER_FUNDS_REJECT" in /// a TransferFundsRejectTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl TransferFundsRejectTransaction { pub fn new() -> TransferFundsRejectTransaction { TransferFundsRejectTransaction { comment: None, funding_reason: None, user_id: None, batch_id: None, reject_reason: None, amount: None, request_id: None, time: None, otype: None, id: None, account_id: None, } } /// An optional comment that may be attached to a fund transfer for audit /// purposes /// - param String /// - return TransferFundsRejectTransaction pub fn with_comment(mut self, x: String) -> Self { self.comment = Some(x); self } /// The reason that an Account is being funded. /// - param String /// - return TransferFundsRejectTransaction pub fn with_funding_reason(mut self, x: String) -> Self { self.funding_reason = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return TransferFundsRejectTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TransferFundsRejectTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Reject Transaction was created /// - param String /// - return TransferFundsRejectTransaction pub fn with_reject_reason(mut self, x: String) -> Self { self.reject_reason = Some(x); self } /// The amount to deposit/withdraw from the Account in the Account's home /// currency. A positive value indicates a deposit, a negative value /// indicates a withdrawal. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return TransferFundsRejectTransaction pub fn with_amount(mut self, x: f32) -> Self { self.amount = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return TransferFundsRejectTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return TransferFundsRejectTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The Type of the Transaction. Always set to "TRANSFER_FUNDS_REJECT" in /// a TransferFundsRejectTransaction. /// - param String /// - return TransferFundsRejectTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return TransferFundsRejectTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return TransferFundsRejectTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct LiquidityRegenerationScheduleStep { /// The amount of bid liquidity used at this step in the schedule. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "bidLiquidityUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub bid_liquidity_used: Option<f32>, /// The timestamp of the schedule step. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "timestamp", skip_serializing_if = "Option::is_none", with = "serdates" )] pub timestamp: Option<DateTime<Utc>>, /// The amount of ask liquidity used at this step in the schedule. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "askLiquidityUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub ask_liquidity_used: Option<f32>, } impl LiquidityRegenerationScheduleStep { pub fn new() -> LiquidityRegenerationScheduleStep { LiquidityRegenerationScheduleStep { bid_liquidity_used: None, timestamp: None, ask_liquidity_used: None, } } /// The amount of bid liquidity used at this step in the schedule. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return LiquidityRegenerationScheduleStep pub fn with_bid_liquidity_used(mut self, x: f32) -> Self { self.bid_liquidity_used = Some(x); self } /// The timestamp of the schedule step. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return LiquidityRegenerationScheduleStep pub fn with_timestamp(mut self, x: DateTime<Utc>) -> Self { self.timestamp = Some(x); self } /// The amount of ask liquidity used at this step in the schedule. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return LiquidityRegenerationScheduleStep pub fn with_ask_liquidity_used(mut self, x: f32) -> Self { self.ask_liquidity_used = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct OrderIdentifier { /// The OANDA-assigned Order ID /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "orderID", skip_serializing_if = "Option::is_none")] pub order_id: Option<String>, /// The client-provided client Order ID #[serde(default)] #[serde(rename = "clientOrderID", skip_serializing_if = "Option::is_none")] pub client_order_id: Option<String>, } impl OrderIdentifier { pub fn new() -> OrderIdentifier { OrderIdentifier { order_id: None, client_order_id: None, } } /// The OANDA-assigned Order ID /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return OrderIdentifier pub fn with_order_id(mut self, x: String) -> Self { self.order_id = Some(x); self } /// The client-provided client Order ID /// - param String /// - return OrderIdentifier pub fn with_client_order_id(mut self, x: String) -> Self { self.client_order_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct MarketOrderRejectTransaction { /// A MarketOrderPositionCloseout specifies the extensions to a Market /// Order when it has been created to closeout a specific Position. #[serde(default)] #[serde( rename = "longPositionCloseout", skip_serializing_if = "Option::is_none" )] pub long_position_closeout: Option<MarketOrderPositionCloseout>, /// A MarketOrderPositionCloseout specifies the extensions to a Market /// Order when it has been created to closeout a specific Position. #[serde(default)] #[serde( rename = "shortPositionCloseout", skip_serializing_if = "Option::is_none" )] pub short_position_closeout: Option<MarketOrderPositionCloseout>, /// The time-in-force requested for the Market Order. Restricted to FOK or /// IOC for a MarketOrder. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, /// The worst price that the client is willing to have the Market Order /// filled at. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "priceBound", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price_bound: Option<f32>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The Market Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The quantity requested to be filled by the Market Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// The Type of the Transaction. Always set to "MARKET_ORDER_REJECT" in a /// MarketOrderRejectTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// Details for the Market Order extensions specific to a Market Order /// placed with the intent of fully closing a specific open trade that /// should have already been closed but wasn't due to halted market /// conditions #[serde(default)] #[serde(rename = "delayedTradeClose", skip_serializing_if = "Option::is_none")] pub delayed_trade_close: Option<MarketOrderDelayedTradeClose>, /// The reason that the Market Order was created #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// A MarketOrderTradeClose specifies the extensions to a Market Order /// that has been created specifically to close a Trade. #[serde(default)] #[serde(rename = "tradeClose", skip_serializing_if = "Option::is_none")] pub trade_close: Option<MarketOrderTradeClose>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// The reason that the Reject Transaction was created #[serde(default)] #[serde(rename = "rejectReason", skip_serializing_if = "Option::is_none")] pub reject_reason: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// Details for the Market Order extensions specific to a Market Order /// placed that is part of a Market Order Margin Closeout in a client's /// account #[serde(default)] #[serde(rename = "marginCloseout", skip_serializing_if = "Option::is_none")] pub margin_closeout: Option<MarketOrderMarginCloseout>, } impl MarketOrderRejectTransaction { pub fn new() -> MarketOrderRejectTransaction { MarketOrderRejectTransaction { long_position_closeout: None, short_position_closeout: None, time_in_force: None, request_id: None, id: None, position_fill: None, price_bound: None, user_id: None, instrument: None, units: None, otype: None, account_id: None, stop_loss_on_fill: None, batch_id: None, delayed_trade_close: None, reason: None, trade_close: None, trailing_stop_loss_on_fill: None, client_extensions: None, take_profit_on_fill: None, reject_reason: None, trade_client_extensions: None, time: None, margin_closeout: None, } } /// A MarketOrderPositionCloseout specifies the extensions to a Market /// Order when it has been created to closeout a specific Position. /// - param MarketOrderPositionCloseout /// - return MarketOrderRejectTransaction pub fn with_long_position_closeout(mut self, x: MarketOrderPositionCloseout) -> Self { self.long_position_closeout = Some(x); self } /// A MarketOrderPositionCloseout specifies the extensions to a Market /// Order when it has been created to closeout a specific Position. /// - param MarketOrderPositionCloseout /// - return MarketOrderRejectTransaction pub fn with_short_position_closeout(mut self, x: MarketOrderPositionCloseout) -> Self { self.short_position_closeout = Some(x); self } /// The time-in-force requested for the Market Order. Restricted to FOK or /// IOC for a MarketOrder. /// - param String /// - return MarketOrderRejectTransaction pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return MarketOrderRejectTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarketOrderRejectTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return MarketOrderRejectTransaction pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } /// The worst price that the client is willing to have the Market Order /// filled at. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return MarketOrderRejectTransaction pub fn with_price_bound(mut self, x: f32) -> Self { self.price_bound = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return MarketOrderRejectTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The Market Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return MarketOrderRejectTransaction pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The quantity requested to be filled by the Market Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return MarketOrderRejectTransaction pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// The Type of the Transaction. Always set to "MARKET_ORDER_REJECT" in a /// MarketOrderRejectTransaction. /// - param String /// - return MarketOrderRejectTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return MarketOrderRejectTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return MarketOrderRejectTransaction pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarketOrderRejectTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// Details for the Market Order extensions specific to a Market Order /// placed with the intent of fully closing a specific open trade that /// should have already been closed but wasn't due to halted market /// conditions /// - param MarketOrderDelayedTradeClose /// - return MarketOrderRejectTransaction pub fn with_delayed_trade_close(mut self, x: MarketOrderDelayedTradeClose) -> Self { self.delayed_trade_close = Some(x); self } /// The reason that the Market Order was created /// - param String /// - return MarketOrderRejectTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// A MarketOrderTradeClose specifies the extensions to a Market Order /// that has been created specifically to close a Trade. /// - param MarketOrderTradeClose /// - return MarketOrderRejectTransaction pub fn with_trade_close(mut self, x: MarketOrderTradeClose) -> Self { self.trade_close = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return MarketOrderRejectTransaction pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return MarketOrderRejectTransaction pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return MarketOrderRejectTransaction pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// The reason that the Reject Transaction was created /// - param String /// - return MarketOrderRejectTransaction pub fn with_reject_reason(mut self, x: String) -> Self { self.reject_reason = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return MarketOrderRejectTransaction pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarketOrderRejectTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// Details for the Market Order extensions specific to a Market Order /// placed that is part of a Market Order Margin Closeout in a client's /// account /// - param MarketOrderMarginCloseout /// - return MarketOrderRejectTransaction pub fn with_margin_closeout(mut self, x: MarketOrderMarginCloseout) -> Self { self.margin_closeout = Some(x); self } } /// Specification of how Positions in the Account are modified when the /// Order is filled. #[derive(Debug, Serialize, Deserialize)] pub enum OrderPositionFill { #[serde(rename = "OPEN_ONLY")] OpenOnly, #[serde(rename = "REDUCE_FIRST")] ReduceFirst, #[serde(rename = "REDUCE_ONLY")] ReduceOnly, #[serde(rename = "DEFAULT")] Default, } impl FromStr for OrderPositionFill { type Err = (); fn from_str(s: &str) -> Result<OrderPositionFill, ()> { match s { "OPEN_ONLY" => Ok(OrderPositionFill::OpenOnly), "REDUCE_FIRST" => Ok(OrderPositionFill::ReduceFirst), "REDUCE_ONLY" => Ok(OrderPositionFill::ReduceOnly), "DEFAULT" => Ok(OrderPositionFill::Default), _ => Err(()), } } } impl std::fmt::Display for OrderPositionFill { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct AccountProperties { /// The Account's associated MT4 Account ID. This field will not be /// present if the Account is not an MT4 account. #[serde(default)] #[serde(rename = "mt4AccountID", skip_serializing_if = "Option::is_none")] pub mt4_account_id: Option<i32>, /// The Account's identifier /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The Account's tags #[serde(default)] #[serde(rename = "tags", skip_serializing_if = "Option::is_none")] pub tags: Option<Vec<String>>, } impl AccountProperties { pub fn new() -> AccountProperties { AccountProperties { mt4_account_id: None, id: None, tags: None, } } /// The Account's associated MT4 Account ID. This field will not be /// present if the Account is not an MT4 account. /// - param i32 /// - return AccountProperties pub fn with_mt4_account_id(mut self, x: i32) -> Self { self.mt4_account_id = Some(x); self } /// The Account's identifier /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return AccountProperties pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The Account's tags /// - param Vec<String> /// - return AccountProperties pub fn with_tags(mut self, x: Vec<String>) -> Self { self.tags = Some(x); self } } /// The reason that the Stop Order was initiated #[derive(Debug, Serialize, Deserialize)] pub enum StopOrderReason { #[serde(rename = "CLIENT_ORDER")] ClientOrder, #[serde(rename = "REPLACEMENT")] Replacement, } impl FromStr for StopOrderReason { type Err = (); fn from_str(s: &str) -> Result<StopOrderReason, ()> { match s { "CLIENT_ORDER" => Ok(StopOrderReason::ClientOrder), "REPLACEMENT" => Ok(StopOrderReason::Replacement), _ => Err(()), } } } impl std::fmt::Display for StopOrderReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct StopOrderRejectTransaction { /// The time-in-force requested for the Stop Order. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, /// The worst market price that may be used to fill this Stop Order. If /// the market gaps and crosses through both the price and the priceBound, /// the Stop Order will be cancelled instead of being filled. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "priceBound", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price_bound: Option<f32>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The Stop Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The quantity requested to be filled by the Stop Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// The Type of the Transaction. Always set to "STOP_ORDER_REJECT" in a /// StopOrderRejectTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, /// The price threshold specified for the Stop Order. The Stop Order will /// only be filled by a market price that is equal to or worse than this /// price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Stop Order was initiated #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Order that this Order was intended to replace (only /// provided if this Order was intended to replace an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde( rename = "intendedReplacesOrderID", skip_serializing_if = "Option::is_none" )] pub intended_replaces_order_id: Option<String>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// The reason that the Reject Transaction was created #[serde(default)] #[serde(rename = "rejectReason", skip_serializing_if = "Option::is_none")] pub reject_reason: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The date/time when the Stop Order will be cancelled if its timeInForce /// is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, } impl StopOrderRejectTransaction { pub fn new() -> StopOrderRejectTransaction { StopOrderRejectTransaction { time_in_force: None, request_id: None, id: None, position_fill: None, price_bound: None, user_id: None, instrument: None, units: None, otype: None, account_id: None, price: None, stop_loss_on_fill: None, batch_id: None, reason: None, trailing_stop_loss_on_fill: None, client_extensions: None, trigger_condition: None, intended_replaces_order_id: None, take_profit_on_fill: None, reject_reason: None, trade_client_extensions: None, time: None, gtd_time: None, } } /// The time-in-force requested for the Stop Order. /// - param String /// - return StopOrderRejectTransaction pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return StopOrderRejectTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return StopOrderRejectTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return StopOrderRejectTransaction pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } /// The worst market price that may be used to fill this Stop Order. If /// the market gaps and crosses through both the price and the priceBound, /// the Stop Order will be cancelled instead of being filled. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return StopOrderRejectTransaction pub fn with_price_bound(mut self, x: f32) -> Self { self.price_bound = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return StopOrderRejectTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The Stop Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return StopOrderRejectTransaction pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The quantity requested to be filled by the Stop Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return StopOrderRejectTransaction pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// The Type of the Transaction. Always set to "STOP_ORDER_REJECT" in a /// StopOrderRejectTransaction. /// - param String /// - return StopOrderRejectTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return StopOrderRejectTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } /// The price threshold specified for the Stop Order. The Stop Order will /// only be filled by a market price that is equal to or worse than this /// price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return StopOrderRejectTransaction pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return StopOrderRejectTransaction pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return StopOrderRejectTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Stop Order was initiated /// - param String /// - return StopOrderRejectTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return StopOrderRejectTransaction pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return StopOrderRejectTransaction pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return StopOrderRejectTransaction pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Order that this Order was intended to replace (only /// provided if this Order was intended to replace an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return StopOrderRejectTransaction pub fn with_intended_replaces_order_id(mut self, x: String) -> Self { self.intended_replaces_order_id = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return StopOrderRejectTransaction pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// The reason that the Reject Transaction was created /// - param String /// - return StopOrderRejectTransaction pub fn with_reject_reason(mut self, x: String) -> Self { self.reject_reason = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return StopOrderRejectTransaction pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopOrderRejectTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The date/time when the Stop Order will be cancelled if its timeInForce /// is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopOrderRejectTransaction pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct MarginCallEnterTransaction { /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The Type of the Transaction. Always set to "MARGIN_CALL_ENTER" for an /// MarginCallEnterTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, } impl MarginCallEnterTransaction { pub fn new() -> MarginCallEnterTransaction { MarginCallEnterTransaction { user_id: None, batch_id: None, request_id: None, time: None, otype: None, id: None, account_id: None, } } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return MarginCallEnterTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarginCallEnterTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return MarginCallEnterTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarginCallEnterTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The Type of the Transaction. Always set to "MARGIN_CALL_ENTER" for an /// MarginCallEnterTransaction. /// - param String /// - return MarginCallEnterTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarginCallEnterTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return MarginCallEnterTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct MarketIfTouchedOrderRejectTransaction { /// The time-in-force requested for the MarketIfTouched Order. Restricted /// to "GTC", "GFD" and "GTD" for MarketIfTouched Orders. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, /// The worst market price that may be used to fill this MarketIfTouched /// Order. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "priceBound", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price_bound: Option<f32>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The MarketIfTouched Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The quantity requested to be filled by the MarketIfTouched Order. A /// posititive number of units results in a long Order, and a negative /// number of units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// The Type of the Transaction. Always set to /// "MARKET_IF_TOUCHED_ORDER_REJECT" in a /// MarketIfTouchedOrderRejectTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, /// The price threshold specified for the MarketIfTouched Order. The /// MarketIfTouched Order will only be filled by a market price that /// crosses this price from the direction of the market price at the time /// when the Order was created (the initialMarketPrice). Depending on the /// value of the Order's price and initialMarketPrice, the /// MarketIfTouchedOrder will behave like a Limit or a Stop Order. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Market-if-touched Order was initiated #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Order that this Order was intended to replace (only /// provided if this Order was intended to replace an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde( rename = "intendedReplacesOrderID", skip_serializing_if = "Option::is_none" )] pub intended_replaces_order_id: Option<String>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// The reason that the Reject Transaction was created #[serde(default)] #[serde(rename = "rejectReason", skip_serializing_if = "Option::is_none")] pub reject_reason: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The date/time when the MarketIfTouched Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, } impl MarketIfTouchedOrderRejectTransaction { pub fn new() -> MarketIfTouchedOrderRejectTransaction { MarketIfTouchedOrderRejectTransaction { time_in_force: None, request_id: None, id: None, position_fill: None, price_bound: None, user_id: None, instrument: None, units: None, otype: None, account_id: None, price: None, stop_loss_on_fill: None, batch_id: None, reason: None, trailing_stop_loss_on_fill: None, client_extensions: None, trigger_condition: None, intended_replaces_order_id: None, take_profit_on_fill: None, reject_reason: None, trade_client_extensions: None, time: None, gtd_time: None, } } /// The time-in-force requested for the MarketIfTouched Order. Restricted /// to "GTC", "GFD" and "GTD" for MarketIfTouched Orders. /// - param String /// - return MarketIfTouchedOrderRejectTransaction pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return MarketIfTouchedOrderRejectTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarketIfTouchedOrderRejectTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return MarketIfTouchedOrderRejectTransaction pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } /// The worst market price that may be used to fill this MarketIfTouched /// Order. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return MarketIfTouchedOrderRejectTransaction pub fn with_price_bound(mut self, x: f32) -> Self { self.price_bound = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return MarketIfTouchedOrderRejectTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The MarketIfTouched Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return MarketIfTouchedOrderRejectTransaction pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The quantity requested to be filled by the MarketIfTouched Order. A /// posititive number of units results in a long Order, and a negative /// number of units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return MarketIfTouchedOrderRejectTransaction pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// The Type of the Transaction. Always set to /// "MARKET_IF_TOUCHED_ORDER_REJECT" in a /// MarketIfTouchedOrderRejectTransaction. /// - param String /// - return MarketIfTouchedOrderRejectTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return MarketIfTouchedOrderRejectTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } /// The price threshold specified for the MarketIfTouched Order. The /// MarketIfTouched Order will only be filled by a market price that /// crosses this price from the direction of the market price at the time /// when the Order was created (the initialMarketPrice). Depending on the /// value of the Order's price and initialMarketPrice, the /// MarketIfTouchedOrder will behave like a Limit or a Stop Order. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return MarketIfTouchedOrderRejectTransaction pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return MarketIfTouchedOrderRejectTransaction pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return MarketIfTouchedOrderRejectTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Market-if-touched Order was initiated /// - param String /// - return MarketIfTouchedOrderRejectTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return MarketIfTouchedOrderRejectTransaction pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return MarketIfTouchedOrderRejectTransaction pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return MarketIfTouchedOrderRejectTransaction pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Order that this Order was intended to replace (only /// provided if this Order was intended to replace an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return MarketIfTouchedOrderRejectTransaction pub fn with_intended_replaces_order_id(mut self, x: String) -> Self { self.intended_replaces_order_id = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return MarketIfTouchedOrderRejectTransaction pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// The reason that the Reject Transaction was created /// - param String /// - return MarketIfTouchedOrderRejectTransaction pub fn with_reject_reason(mut self, x: String) -> Self { self.reject_reason = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return MarketIfTouchedOrderRejectTransaction pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarketIfTouchedOrderRejectTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The date/time when the MarketIfTouched Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return MarketIfTouchedOrderRejectTransaction pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct UnitsAvailableDetails { /// The units available for short Orders. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "short", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub short: Option<f32>, /// The units available for long Orders. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "long", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub long: Option<f32>, } impl UnitsAvailableDetails { pub fn new() -> UnitsAvailableDetails { UnitsAvailableDetails { short: None, long: None, } } /// The units available for short Orders. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return UnitsAvailableDetails pub fn with_short(mut self, x: f32) -> Self { self.short = Some(x); self } /// The units available for long Orders. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return UnitsAvailableDetails pub fn with_long(mut self, x: f32) -> Self { self.long = Some(x); self } } /// The reason that a Transaction was rejected. #[derive(Debug, Serialize, Deserialize)] pub enum TransactionRejectReason { #[serde(rename = "INTERNAL_SERVER_ERROR")] InternalServerError, #[serde(rename = "INSTRUMENT_PRICE_UNKNOWN")] InstrumentPriceUnknown, #[serde(rename = "ACCOUNT_NOT_ACTIVE")] AccountNotActive, #[serde(rename = "ACCOUNT_LOCKED")] AccountLocked, #[serde(rename = "ACCOUNT_ORDER_CREATION_LOCKED")] AccountOrderCreationLocked, #[serde(rename = "ACCOUNT_CONFIGURATION_LOCKED")] AccountConfigurationLocked, #[serde(rename = "ACCOUNT_DEPOSIT_LOCKED")] AccountDepositLocked, #[serde(rename = "ACCOUNT_WITHDRAWAL_LOCKED")] AccountWithdrawalLocked, #[serde(rename = "ACCOUNT_ORDER_CANCEL_LOCKED")] AccountOrderCancelLocked, #[serde(rename = "INSTRUMENT_NOT_TRADEABLE")] InstrumentNotTradeable, #[serde(rename = "PENDING_ORDERS_ALLOWED_EXCEEDED")] PendingOrdersAllowedExceeded, #[serde(rename = "ORDER_ID_UNSPECIFIED")] OrderIdUnspecified, #[serde(rename = "ORDER_DOESNT_EXIST")] OrderDoesntExist, #[serde(rename = "ORDER_IDENTIFIER_INCONSISTENCY")] OrderIdentifierInconsistency, #[serde(rename = "TRADE_ID_UNSPECIFIED")] TradeIdUnspecified, #[serde(rename = "TRADE_DOESNT_EXIST")] TradeDoesntExist, #[serde(rename = "TRADE_IDENTIFIER_INCONSISTENCY")] TradeIdentifierInconsistency, #[serde(rename = "INSUFFICIENT_MARGIN")] InsufficientMargin, #[serde(rename = "INSTRUMENT_MISSING")] InstrumentMissing, #[serde(rename = "INSTRUMENT_UNKNOWN")] InstrumentUnknown, #[serde(rename = "UNITS_MISSING")] UnitsMissing, #[serde(rename = "UNITS_INVALID")] UnitsInvalid, #[serde(rename = "UNITS_PRECISION_EXCEEDED")] UnitsPrecisionExceeded, #[serde(rename = "UNITS_LIMIT_EXCEEDED")] UnitsLimitExceeded, #[serde(rename = "UNITS_MIMIMUM_NOT_MET")] UnitsMimimumNotMet, #[serde(rename = "PRICE_MISSING")] PriceMissing, #[serde(rename = "PRICE_INVALID")] PriceInvalid, #[serde(rename = "PRICE_PRECISION_EXCEEDED")] PricePrecisionExceeded, #[serde(rename = "PRICE_DISTANCE_MISSING")] PriceDistanceMissing, #[serde(rename = "PRICE_DISTANCE_INVALID")] PriceDistanceInvalid, #[serde(rename = "PRICE_DISTANCE_PRECISION_EXCEEDED")] PriceDistancePrecisionExceeded, #[serde(rename = "PRICE_DISTANCE_MAXIMUM_EXCEEDED")] PriceDistanceMaximumExceeded, #[serde(rename = "PRICE_DISTANCE_MINIMUM_NOT_MET")] PriceDistanceMinimumNotMet, #[serde(rename = "TIME_IN_FORCE_MISSING")] TimeInForceMissing, #[serde(rename = "TIME_IN_FORCE_INVALID")] TimeInForceInvalid, #[serde(rename = "TIME_IN_FORCE_GTD_TIMESTAMP_MISSING")] TimeInForceGtdTimestampMissing, #[serde(rename = "TIME_IN_FORCE_GTD_TIMESTAMP_IN_PAST")] TimeInForceGtdTimestampInPast, #[serde(rename = "PRICE_BOUND_INVALID")] PriceBoundInvalid, #[serde(rename = "PRICE_BOUND_PRECISION_EXCEEDED")] PriceBoundPrecisionExceeded, #[serde(rename = "ORDERS_ON_FILL_DUPLICATE_CLIENT_ORDER_IDS")] OrdersOnFillDuplicateClientOrderIds, #[serde(rename = "TRADE_ON_FILL_CLIENT_EXTENSIONS_NOT_SUPPORTED")] TradeOnFillClientExtensionsNotSupported, #[serde(rename = "CLIENT_ORDER_ID_INVALID")] ClientOrderIdInvalid, #[serde(rename = "CLIENT_ORDER_ID_ALREADY_EXISTS")] ClientOrderIdAlreadyExists, #[serde(rename = "CLIENT_ORDER_TAG_INVALID")] ClientOrderTagInvalid, #[serde(rename = "CLIENT_ORDER_COMMENT_INVALID")] ClientOrderCommentInvalid, #[serde(rename = "CLIENT_TRADE_ID_INVALID")] ClientTradeIdInvalid, #[serde(rename = "CLIENT_TRADE_ID_ALREADY_EXISTS")] ClientTradeIdAlreadyExists, #[serde(rename = "CLIENT_TRADE_TAG_INVALID")] ClientTradeTagInvalid, #[serde(rename = "CLIENT_TRADE_COMMENT_INVALID")] ClientTradeCommentInvalid, #[serde(rename = "ORDER_FILL_POSITION_ACTION_MISSING")] OrderFillPositionActionMissing, #[serde(rename = "ORDER_FILL_POSITION_ACTION_INVALID")] OrderFillPositionActionInvalid, #[serde(rename = "TRIGGER_CONDITION_MISSING")] TriggerConditionMissing, #[serde(rename = "TRIGGER_CONDITION_INVALID")] TriggerConditionInvalid, #[serde(rename = "ORDER_PARTIAL_FILL_OPTION_MISSING")] OrderPartialFillOptionMissing, #[serde(rename = "ORDER_PARTIAL_FILL_OPTION_INVALID")] OrderPartialFillOptionInvalid, #[serde(rename = "INVALID_REISSUE_IMMEDIATE_PARTIAL_FILL")] InvalidReissueImmediatePartialFill, #[serde(rename = "TAKE_PROFIT_ORDER_ALREADY_EXISTS")] TakeProfitOrderAlreadyExists, #[serde(rename = "TAKE_PROFIT_ON_FILL_PRICE_MISSING")] TakeProfitOnFillPriceMissing, #[serde(rename = "TAKE_PROFIT_ON_FILL_PRICE_INVALID")] TakeProfitOnFillPriceInvalid, #[serde(rename = "TAKE_PROFIT_ON_FILL_PRICE_PRECISION_EXCEEDED")] TakeProfitOnFillPricePrecisionExceeded, #[serde(rename = "TAKE_PROFIT_ON_FILL_TIME_IN_FORCE_MISSING")] TakeProfitOnFillTimeInForceMissing, #[serde(rename = "TAKE_PROFIT_ON_FILL_TIME_IN_FORCE_INVALID")] TakeProfitOnFillTimeInForceInvalid, #[serde(rename = "TAKE_PROFIT_ON_FILL_GTD_TIMESTAMP_MISSING")] TakeProfitOnFillGtdTimestampMissing, #[serde(rename = "TAKE_PROFIT_ON_FILL_GTD_TIMESTAMP_IN_PAST")] TakeProfitOnFillGtdTimestampInPast, #[serde(rename = "TAKE_PROFIT_ON_FILL_CLIENT_ORDER_ID_INVALID")] TakeProfitOnFillClientOrderIdInvalid, #[serde(rename = "TAKE_PROFIT_ON_FILL_CLIENT_ORDER_TAG_INVALID")] TakeProfitOnFillClientOrderTagInvalid, #[serde(rename = "TAKE_PROFIT_ON_FILL_CLIENT_ORDER_COMMENT_INVALID")] TakeProfitOnFillClientOrderCommentInvalid, #[serde(rename = "TAKE_PROFIT_ON_FILL_TRIGGER_CONDITION_MISSING")] TakeProfitOnFillTriggerConditionMissing, #[serde(rename = "TAKE_PROFIT_ON_FILL_TRIGGER_CONDITION_INVALID")] TakeProfitOnFillTriggerConditionInvalid, #[serde(rename = "STOP_LOSS_ORDER_ALREADY_EXISTS")] StopLossOrderAlreadyExists, #[serde(rename = "STOP_LOSS_ORDER_GUARANTEED_REQUIRED")] StopLossOrderGuaranteedRequired, #[serde(rename = "STOP_LOSS_ORDER_GUARANTEED_PRICE_WITHIN_SPREAD")] StopLossOrderGuaranteedPriceWithinSpread, #[serde(rename = "STOP_LOSS_ORDER_GUARANTEED_NOT_ALLOWED")] StopLossOrderGuaranteedNotAllowed, #[serde(rename = "STOP_LOSS_ORDER_GUARANTEED_HALTED_CREATE_VIOLATION")] StopLossOrderGuaranteedHaltedCreateViolation, #[serde(rename = "STOP_LOSS_ORDER_GUARANTEED_HALTED_TIGHTEN_VIOLATION")] StopLossOrderGuaranteedHaltedTightenViolation, #[serde(rename = "STOP_LOSS_ORDER_GUARANTEED_HEDGING_NOT_ALLOWED")] StopLossOrderGuaranteedHedgingNotAllowed, #[serde(rename = "STOP_LOSS_ORDER_GUARANTEED_MINIMUM_DISTANCE_NOT_MET")] StopLossOrderGuaranteedMinimumDistanceNotMet, #[serde(rename = "STOP_LOSS_ORDER_NOT_CANCELABLE")] StopLossOrderNotCancelable, #[serde(rename = "STOP_LOSS_ORDER_NOT_REPLACEABLE")] StopLossOrderNotReplaceable, #[serde(rename = "STOP_LOSS_ORDER_GUARANTEED_LEVEL_RESTRICTION_EXCEEDED")] StopLossOrderGuaranteedLevelRestrictionExceeded, #[serde(rename = "STOP_LOSS_ORDER_PRICE_AND_DISTANCE_BOTH_SPECIFIED")] StopLossOrderPriceAndDistanceBothSpecified, #[serde(rename = "STOP_LOSS_ORDER_PRICE_AND_DISTANCE_BOTH_MISSING")] StopLossOrderPriceAndDistanceBothMissing, #[serde(rename = "STOP_LOSS_ON_FILL_REQUIRED_FOR_PENDING_ORDER")] StopLossOnFillRequiredForPendingOrder, #[serde(rename = "STOP_LOSS_ON_FILL_GUARANTEED_NOT_ALLOWED")] StopLossOnFillGuaranteedNotAllowed, #[serde(rename = "STOP_LOSS_ON_FILL_GUARANTEED_REQUIRED")] StopLossOnFillGuaranteedRequired, #[serde(rename = "STOP_LOSS_ON_FILL_PRICE_MISSING")] StopLossOnFillPriceMissing, #[serde(rename = "STOP_LOSS_ON_FILL_PRICE_INVALID")] StopLossOnFillPriceInvalid, #[serde(rename = "STOP_LOSS_ON_FILL_PRICE_PRECISION_EXCEEDED")] StopLossOnFillPricePrecisionExceeded, #[serde(rename = "STOP_LOSS_ON_FILL_GUARANTEED_MINIMUM_DISTANCE_NOT_MET")] StopLossOnFillGuaranteedMinimumDistanceNotMet, #[serde(rename = "STOP_LOSS_ON_FILL_GUARANTEED_LEVEL_RESTRICTION_EXCEEDED")] StopLossOnFillGuaranteedLevelRestrictionExceeded, #[serde(rename = "STOP_LOSS_ON_FILL_DISTANCE_INVALID")] StopLossOnFillDistanceInvalid, #[serde(rename = "STOP_LOSS_ON_FILL_PRICE_DISTANCE_MAXIMUM_EXCEEDED")] StopLossOnFillPriceDistanceMaximumExceeded, #[serde(rename = "STOP_LOSS_ON_FILL_DISTANCE_PRECISION_EXCEEDED")] StopLossOnFillDistancePrecisionExceeded, #[serde(rename = "STOP_LOSS_ON_FILL_PRICE_AND_DISTANCE_BOTH_SPECIFIED")] StopLossOnFillPriceAndDistanceBothSpecified, #[serde(rename = "STOP_LOSS_ON_FILL_PRICE_AND_DISTANCE_BOTH_MISSING")] StopLossOnFillPriceAndDistanceBothMissing, #[serde(rename = "STOP_LOSS_ON_FILL_TIME_IN_FORCE_MISSING")] StopLossOnFillTimeInForceMissing, #[serde(rename = "STOP_LOSS_ON_FILL_TIME_IN_FORCE_INVALID")] StopLossOnFillTimeInForceInvalid, #[serde(rename = "STOP_LOSS_ON_FILL_GTD_TIMESTAMP_MISSING")] StopLossOnFillGtdTimestampMissing, #[serde(rename = "STOP_LOSS_ON_FILL_GTD_TIMESTAMP_IN_PAST")] StopLossOnFillGtdTimestampInPast, #[serde(rename = "STOP_LOSS_ON_FILL_CLIENT_ORDER_ID_INVALID")] StopLossOnFillClientOrderIdInvalid, #[serde(rename = "STOP_LOSS_ON_FILL_CLIENT_ORDER_TAG_INVALID")] StopLossOnFillClientOrderTagInvalid, #[serde(rename = "STOP_LOSS_ON_FILL_CLIENT_ORDER_COMMENT_INVALID")] StopLossOnFillClientOrderCommentInvalid, #[serde(rename = "STOP_LOSS_ON_FILL_TRIGGER_CONDITION_MISSING")] StopLossOnFillTriggerConditionMissing, #[serde(rename = "STOP_LOSS_ON_FILL_TRIGGER_CONDITION_INVALID")] StopLossOnFillTriggerConditionInvalid, #[serde(rename = "TRAILING_STOP_LOSS_ORDER_ALREADY_EXISTS")] TrailingStopLossOrderAlreadyExists, #[serde(rename = "TRAILING_STOP_LOSS_ON_FILL_PRICE_DISTANCE_MISSING")] TrailingStopLossOnFillPriceDistanceMissing, #[serde(rename = "TRAILING_STOP_LOSS_ON_FILL_PRICE_DISTANCE_INVALID")] TrailingStopLossOnFillPriceDistanceInvalid, #[serde(rename = "TRAILING_STOP_LOSS_ON_FILL_PRICE_DISTANCE_PRECISION_EXCEEDED")] TrailingStopLossOnFillPriceDistancePrecisionExceeded, #[serde(rename = "TRAILING_STOP_LOSS_ON_FILL_PRICE_DISTANCE_MAXIMUM_EXCEEDED")] TrailingStopLossOnFillPriceDistanceMaximumExceeded, #[serde(rename = "TRAILING_STOP_LOSS_ON_FILL_PRICE_DISTANCE_MINIMUM_NOT_MET")] TrailingStopLossOnFillPriceDistanceMinimumNotMet, #[serde(rename = "TRAILING_STOP_LOSS_ON_FILL_TIME_IN_FORCE_MISSING")] TrailingStopLossOnFillTimeInForceMissing, #[serde(rename = "TRAILING_STOP_LOSS_ON_FILL_TIME_IN_FORCE_INVALID")] TrailingStopLossOnFillTimeInForceInvalid, #[serde(rename = "TRAILING_STOP_LOSS_ON_FILL_GTD_TIMESTAMP_MISSING")] TrailingStopLossOnFillGtdTimestampMissing, #[serde(rename = "TRAILING_STOP_LOSS_ON_FILL_GTD_TIMESTAMP_IN_PAST")] TrailingStopLossOnFillGtdTimestampInPast, #[serde(rename = "TRAILING_STOP_LOSS_ON_FILL_CLIENT_ORDER_ID_INVALID")] TrailingStopLossOnFillClientOrderIdInvalid, #[serde(rename = "TRAILING_STOP_LOSS_ON_FILL_CLIENT_ORDER_TAG_INVALID")] TrailingStopLossOnFillClientOrderTagInvalid, #[serde(rename = "TRAILING_STOP_LOSS_ON_FILL_CLIENT_ORDER_COMMENT_INVALID")] TrailingStopLossOnFillClientOrderCommentInvalid, #[serde(rename = "TRAILING_STOP_LOSS_ORDERS_NOT_SUPPORTED")] TrailingStopLossOrdersNotSupported, #[serde(rename = "TRAILING_STOP_LOSS_ON_FILL_TRIGGER_CONDITION_MISSING")] TrailingStopLossOnFillTriggerConditionMissing, #[serde(rename = "TRAILING_STOP_LOSS_ON_FILL_TRIGGER_CONDITION_INVALID")] TrailingStopLossOnFillTriggerConditionInvalid, #[serde(rename = "CLOSE_TRADE_TYPE_MISSING")] CloseTradeTypeMissing, #[serde(rename = "CLOSE_TRADE_PARTIAL_UNITS_MISSING")] CloseTradePartialUnitsMissing, #[serde(rename = "CLOSE_TRADE_UNITS_EXCEED_TRADE_SIZE")] CloseTradeUnitsExceedTradeSize, #[serde(rename = "CLOSEOUT_POSITION_DOESNT_EXIST")] CloseoutPositionDoesntExist, #[serde(rename = "CLOSEOUT_POSITION_INCOMPLETE_SPECIFICATION")] CloseoutPositionIncompleteSpecification, #[serde(rename = "CLOSEOUT_POSITION_UNITS_EXCEED_POSITION_SIZE")] CloseoutPositionUnitsExceedPositionSize, #[serde(rename = "CLOSEOUT_POSITION_REJECT")] CloseoutPositionReject, #[serde(rename = "CLOSEOUT_POSITION_PARTIAL_UNITS_MISSING")] CloseoutPositionPartialUnitsMissing, #[serde(rename = "MARKUP_GROUP_ID_INVALID")] MarkupGroupIdInvalid, #[serde(rename = "POSITION_AGGREGATION_MODE_INVALID")] PositionAggregationModeInvalid, #[serde(rename = "ADMIN_CONFIGURE_DATA_MISSING")] AdminConfigureDataMissing, #[serde(rename = "MARGIN_RATE_INVALID")] MarginRateInvalid, #[serde(rename = "MARGIN_RATE_WOULD_TRIGGER_CLOSEOUT")] MarginRateWouldTriggerCloseout, #[serde(rename = "ALIAS_INVALID")] AliasInvalid, #[serde(rename = "CLIENT_CONFIGURE_DATA_MISSING")] ClientConfigureDataMissing, #[serde(rename = "MARGIN_RATE_WOULD_TRIGGER_MARGIN_CALL")] MarginRateWouldTriggerMarginCall, #[serde(rename = "AMOUNT_INVALID")] AmountInvalid, #[serde(rename = "INSUFFICIENT_FUNDS")] InsufficientFunds, #[serde(rename = "AMOUNT_MISSING")] AmountMissing, #[serde(rename = "FUNDING_REASON_MISSING")] FundingReasonMissing, #[serde(rename = "CLIENT_EXTENSIONS_DATA_MISSING")] ClientExtensionsDataMissing, #[serde(rename = "REPLACING_ORDER_INVALID")] ReplacingOrderInvalid, #[serde(rename = "REPLACING_TRADE_ID_INVALID")] ReplacingTradeIdInvalid, } impl FromStr for TransactionRejectReason { type Err = (); fn from_str(s: &str) -> Result<TransactionRejectReason, ()> { match s { "INTERNAL_SERVER_ERROR" => Ok(TransactionRejectReason::InternalServerError), "INSTRUMENT_PRICE_UNKNOWN" => Ok(TransactionRejectReason::InstrumentPriceUnknown), "ACCOUNT_NOT_ACTIVE" => Ok(TransactionRejectReason::AccountNotActive), "ACCOUNT_LOCKED" => Ok(TransactionRejectReason::AccountLocked), "ACCOUNT_ORDER_CREATION_LOCKED" => { Ok(TransactionRejectReason::AccountOrderCreationLocked) } "ACCOUNT_CONFIGURATION_LOCKED" => { Ok(TransactionRejectReason::AccountConfigurationLocked) } "ACCOUNT_DEPOSIT_LOCKED" => Ok(TransactionRejectReason::AccountDepositLocked), "ACCOUNT_WITHDRAWAL_LOCKED" => Ok(TransactionRejectReason::AccountWithdrawalLocked), "ACCOUNT_ORDER_CANCEL_LOCKED" => Ok(TransactionRejectReason::AccountOrderCancelLocked), "INSTRUMENT_NOT_TRADEABLE" => Ok(TransactionRejectReason::InstrumentNotTradeable), "PENDING_ORDERS_ALLOWED_EXCEEDED" => { Ok(TransactionRejectReason::PendingOrdersAllowedExceeded) } "ORDER_ID_UNSPECIFIED" => Ok(TransactionRejectReason::OrderIdUnspecified), "ORDER_DOESNT_EXIST" => Ok(TransactionRejectReason::OrderDoesntExist), "ORDER_IDENTIFIER_INCONSISTENCY" => { Ok(TransactionRejectReason::OrderIdentifierInconsistency) } "TRADE_ID_UNSPECIFIED" => Ok(TransactionRejectReason::TradeIdUnspecified), "TRADE_DOESNT_EXIST" => Ok(TransactionRejectReason::TradeDoesntExist), "TRADE_IDENTIFIER_INCONSISTENCY" => { Ok(TransactionRejectReason::TradeIdentifierInconsistency) } "INSUFFICIENT_MARGIN" => Ok(TransactionRejectReason::InsufficientMargin), "INSTRUMENT_MISSING" => Ok(TransactionRejectReason::InstrumentMissing), "INSTRUMENT_UNKNOWN" => Ok(TransactionRejectReason::InstrumentUnknown), "UNITS_MISSING" => Ok(TransactionRejectReason::UnitsMissing), "UNITS_INVALID" => Ok(TransactionRejectReason::UnitsInvalid), "UNITS_PRECISION_EXCEEDED" => Ok(TransactionRejectReason::UnitsPrecisionExceeded), "UNITS_LIMIT_EXCEEDED" => Ok(TransactionRejectReason::UnitsLimitExceeded), "UNITS_MIMIMUM_NOT_MET" => Ok(TransactionRejectReason::UnitsMimimumNotMet), "PRICE_MISSING" => Ok(TransactionRejectReason::PriceMissing), "PRICE_INVALID" => Ok(TransactionRejectReason::PriceInvalid), "PRICE_PRECISION_EXCEEDED" => Ok(TransactionRejectReason::PricePrecisionExceeded), "PRICE_DISTANCE_MISSING" => Ok(TransactionRejectReason::PriceDistanceMissing), "PRICE_DISTANCE_INVALID" => Ok(TransactionRejectReason::PriceDistanceInvalid), "PRICE_DISTANCE_PRECISION_EXCEEDED" => { Ok(TransactionRejectReason::PriceDistancePrecisionExceeded) } "PRICE_DISTANCE_MAXIMUM_EXCEEDED" => { Ok(TransactionRejectReason::PriceDistanceMaximumExceeded) } "PRICE_DISTANCE_MINIMUM_NOT_MET" => { Ok(TransactionRejectReason::PriceDistanceMinimumNotMet) } "TIME_IN_FORCE_MISSING" => Ok(TransactionRejectReason::TimeInForceMissing), "TIME_IN_FORCE_INVALID" => Ok(TransactionRejectReason::TimeInForceInvalid), "TIME_IN_FORCE_GTD_TIMESTAMP_MISSING" => { Ok(TransactionRejectReason::TimeInForceGtdTimestampMissing) } "TIME_IN_FORCE_GTD_TIMESTAMP_IN_PAST" => { Ok(TransactionRejectReason::TimeInForceGtdTimestampInPast) } "PRICE_BOUND_INVALID" => Ok(TransactionRejectReason::PriceBoundInvalid), "PRICE_BOUND_PRECISION_EXCEEDED" => { Ok(TransactionRejectReason::PriceBoundPrecisionExceeded) } "ORDERS_ON_FILL_DUPLICATE_CLIENT_ORDER_IDS" => { Ok(TransactionRejectReason::OrdersOnFillDuplicateClientOrderIds) } "TRADE_ON_FILL_CLIENT_EXTENSIONS_NOT_SUPPORTED" => { Ok(TransactionRejectReason::TradeOnFillClientExtensionsNotSupported) } "CLIENT_ORDER_ID_INVALID" => Ok(TransactionRejectReason::ClientOrderIdInvalid), "CLIENT_ORDER_ID_ALREADY_EXISTS" => { Ok(TransactionRejectReason::ClientOrderIdAlreadyExists) } "CLIENT_ORDER_TAG_INVALID" => Ok(TransactionRejectReason::ClientOrderTagInvalid), "CLIENT_ORDER_COMMENT_INVALID" => { Ok(TransactionRejectReason::ClientOrderCommentInvalid) } "CLIENT_TRADE_ID_INVALID" => Ok(TransactionRejectReason::ClientTradeIdInvalid), "CLIENT_TRADE_ID_ALREADY_EXISTS" => { Ok(TransactionRejectReason::ClientTradeIdAlreadyExists) } "CLIENT_TRADE_TAG_INVALID" => Ok(TransactionRejectReason::ClientTradeTagInvalid), "CLIENT_TRADE_COMMENT_INVALID" => { Ok(TransactionRejectReason::ClientTradeCommentInvalid) } "ORDER_FILL_POSITION_ACTION_MISSING" => { Ok(TransactionRejectReason::OrderFillPositionActionMissing) } "ORDER_FILL_POSITION_ACTION_INVALID" => { Ok(TransactionRejectReason::OrderFillPositionActionInvalid) } "TRIGGER_CONDITION_MISSING" => Ok(TransactionRejectReason::TriggerConditionMissing), "TRIGGER_CONDITION_INVALID" => Ok(TransactionRejectReason::TriggerConditionInvalid), "ORDER_PARTIAL_FILL_OPTION_MISSING" => { Ok(TransactionRejectReason::OrderPartialFillOptionMissing) } "ORDER_PARTIAL_FILL_OPTION_INVALID" => { Ok(TransactionRejectReason::OrderPartialFillOptionInvalid) } "INVALID_REISSUE_IMMEDIATE_PARTIAL_FILL" => { Ok(TransactionRejectReason::InvalidReissueImmediatePartialFill) } "TAKE_PROFIT_ORDER_ALREADY_EXISTS" => { Ok(TransactionRejectReason::TakeProfitOrderAlreadyExists) } "TAKE_PROFIT_ON_FILL_PRICE_MISSING" => { Ok(TransactionRejectReason::TakeProfitOnFillPriceMissing) } "TAKE_PROFIT_ON_FILL_PRICE_INVALID" => { Ok(TransactionRejectReason::TakeProfitOnFillPriceInvalid) } "TAKE_PROFIT_ON_FILL_PRICE_PRECISION_EXCEEDED" => { Ok(TransactionRejectReason::TakeProfitOnFillPricePrecisionExceeded) } "TAKE_PROFIT_ON_FILL_TIME_IN_FORCE_MISSING" => { Ok(TransactionRejectReason::TakeProfitOnFillTimeInForceMissing) } "TAKE_PROFIT_ON_FILL_TIME_IN_FORCE_INVALID" => { Ok(TransactionRejectReason::TakeProfitOnFillTimeInForceInvalid) } "TAKE_PROFIT_ON_FILL_GTD_TIMESTAMP_MISSING" => { Ok(TransactionRejectReason::TakeProfitOnFillGtdTimestampMissing) } "TAKE_PROFIT_ON_FILL_GTD_TIMESTAMP_IN_PAST" => { Ok(TransactionRejectReason::TakeProfitOnFillGtdTimestampInPast) } "TAKE_PROFIT_ON_FILL_CLIENT_ORDER_ID_INVALID" => { Ok(TransactionRejectReason::TakeProfitOnFillClientOrderIdInvalid) } "TAKE_PROFIT_ON_FILL_CLIENT_ORDER_TAG_INVALID" => { Ok(TransactionRejectReason::TakeProfitOnFillClientOrderTagInvalid) } "TAKE_PROFIT_ON_FILL_CLIENT_ORDER_COMMENT_INVALID" => { Ok(TransactionRejectReason::TakeProfitOnFillClientOrderCommentInvalid) } "TAKE_PROFIT_ON_FILL_TRIGGER_CONDITION_MISSING" => { Ok(TransactionRejectReason::TakeProfitOnFillTriggerConditionMissing) } "TAKE_PROFIT_ON_FILL_TRIGGER_CONDITION_INVALID" => { Ok(TransactionRejectReason::TakeProfitOnFillTriggerConditionInvalid) } "STOP_LOSS_ORDER_ALREADY_EXISTS" => { Ok(TransactionRejectReason::StopLossOrderAlreadyExists) } "STOP_LOSS_ORDER_GUARANTEED_REQUIRED" => { Ok(TransactionRejectReason::StopLossOrderGuaranteedRequired) } "STOP_LOSS_ORDER_GUARANTEED_PRICE_WITHIN_SPREAD" => { Ok(TransactionRejectReason::StopLossOrderGuaranteedPriceWithinSpread) } "STOP_LOSS_ORDER_GUARANTEED_NOT_ALLOWED" => { Ok(TransactionRejectReason::StopLossOrderGuaranteedNotAllowed) } "STOP_LOSS_ORDER_GUARANTEED_HALTED_CREATE_VIOLATION" => { Ok(TransactionRejectReason::StopLossOrderGuaranteedHaltedCreateViolation) } "STOP_LOSS_ORDER_GUARANTEED_HALTED_TIGHTEN_VIOLATION" => { Ok(TransactionRejectReason::StopLossOrderGuaranteedHaltedTightenViolation) } "STOP_LOSS_ORDER_GUARANTEED_HEDGING_NOT_ALLOWED" => { Ok(TransactionRejectReason::StopLossOrderGuaranteedHedgingNotAllowed) } "STOP_LOSS_ORDER_GUARANTEED_MINIMUM_DISTANCE_NOT_MET" => { Ok(TransactionRejectReason::StopLossOrderGuaranteedMinimumDistanceNotMet) } "STOP_LOSS_ORDER_NOT_CANCELABLE" => { Ok(TransactionRejectReason::StopLossOrderNotCancelable) } "STOP_LOSS_ORDER_NOT_REPLACEABLE" => { Ok(TransactionRejectReason::StopLossOrderNotReplaceable) } "STOP_LOSS_ORDER_GUARANTEED_LEVEL_RESTRICTION_EXCEEDED" => { Ok(TransactionRejectReason::StopLossOrderGuaranteedLevelRestrictionExceeded) } "STOP_LOSS_ORDER_PRICE_AND_DISTANCE_BOTH_SPECIFIED" => { Ok(TransactionRejectReason::StopLossOrderPriceAndDistanceBothSpecified) } "STOP_LOSS_ORDER_PRICE_AND_DISTANCE_BOTH_MISSING" => { Ok(TransactionRejectReason::StopLossOrderPriceAndDistanceBothMissing) } "STOP_LOSS_ON_FILL_REQUIRED_FOR_PENDING_ORDER" => { Ok(TransactionRejectReason::StopLossOnFillRequiredForPendingOrder) } "STOP_LOSS_ON_FILL_GUARANTEED_NOT_ALLOWED" => { Ok(TransactionRejectReason::StopLossOnFillGuaranteedNotAllowed) } "STOP_LOSS_ON_FILL_GUARANTEED_REQUIRED" => { Ok(TransactionRejectReason::StopLossOnFillGuaranteedRequired) } "STOP_LOSS_ON_FILL_PRICE_MISSING" => { Ok(TransactionRejectReason::StopLossOnFillPriceMissing) } "STOP_LOSS_ON_FILL_PRICE_INVALID" => { Ok(TransactionRejectReason::StopLossOnFillPriceInvalid) } "STOP_LOSS_ON_FILL_PRICE_PRECISION_EXCEEDED" => { Ok(TransactionRejectReason::StopLossOnFillPricePrecisionExceeded) } "STOP_LOSS_ON_FILL_GUARANTEED_MINIMUM_DISTANCE_NOT_MET" => { Ok(TransactionRejectReason::StopLossOnFillGuaranteedMinimumDistanceNotMet) } "STOP_LOSS_ON_FILL_GUARANTEED_LEVEL_RESTRICTION_EXCEEDED" => { Ok(TransactionRejectReason::StopLossOnFillGuaranteedLevelRestrictionExceeded) } "STOP_LOSS_ON_FILL_DISTANCE_INVALID" => { Ok(TransactionRejectReason::StopLossOnFillDistanceInvalid) } "STOP_LOSS_ON_FILL_PRICE_DISTANCE_MAXIMUM_EXCEEDED" => { Ok(TransactionRejectReason::StopLossOnFillPriceDistanceMaximumExceeded) } "STOP_LOSS_ON_FILL_DISTANCE_PRECISION_EXCEEDED" => { Ok(TransactionRejectReason::StopLossOnFillDistancePrecisionExceeded) } "STOP_LOSS_ON_FILL_PRICE_AND_DISTANCE_BOTH_SPECIFIED" => { Ok(TransactionRejectReason::StopLossOnFillPriceAndDistanceBothSpecified) } "STOP_LOSS_ON_FILL_PRICE_AND_DISTANCE_BOTH_MISSING" => { Ok(TransactionRejectReason::StopLossOnFillPriceAndDistanceBothMissing) } "STOP_LOSS_ON_FILL_TIME_IN_FORCE_MISSING" => { Ok(TransactionRejectReason::StopLossOnFillTimeInForceMissing) } "STOP_LOSS_ON_FILL_TIME_IN_FORCE_INVALID" => { Ok(TransactionRejectReason::StopLossOnFillTimeInForceInvalid) } "STOP_LOSS_ON_FILL_GTD_TIMESTAMP_MISSING" => { Ok(TransactionRejectReason::StopLossOnFillGtdTimestampMissing) } "STOP_LOSS_ON_FILL_GTD_TIMESTAMP_IN_PAST" => { Ok(TransactionRejectReason::StopLossOnFillGtdTimestampInPast) } "STOP_LOSS_ON_FILL_CLIENT_ORDER_ID_INVALID" => { Ok(TransactionRejectReason::StopLossOnFillClientOrderIdInvalid) } "STOP_LOSS_ON_FILL_CLIENT_ORDER_TAG_INVALID" => { Ok(TransactionRejectReason::StopLossOnFillClientOrderTagInvalid) } "STOP_LOSS_ON_FILL_CLIENT_ORDER_COMMENT_INVALID" => { Ok(TransactionRejectReason::StopLossOnFillClientOrderCommentInvalid) } "STOP_LOSS_ON_FILL_TRIGGER_CONDITION_MISSING" => { Ok(TransactionRejectReason::StopLossOnFillTriggerConditionMissing) } "STOP_LOSS_ON_FILL_TRIGGER_CONDITION_INVALID" => { Ok(TransactionRejectReason::StopLossOnFillTriggerConditionInvalid) } "TRAILING_STOP_LOSS_ORDER_ALREADY_EXISTS" => { Ok(TransactionRejectReason::TrailingStopLossOrderAlreadyExists) } "TRAILING_STOP_LOSS_ON_FILL_PRICE_DISTANCE_MISSING" => { Ok(TransactionRejectReason::TrailingStopLossOnFillPriceDistanceMissing) } "TRAILING_STOP_LOSS_ON_FILL_PRICE_DISTANCE_INVALID" => { Ok(TransactionRejectReason::TrailingStopLossOnFillPriceDistanceInvalid) } "TRAILING_STOP_LOSS_ON_FILL_PRICE_DISTANCE_PRECISION_EXCEEDED" => { Ok(TransactionRejectReason::TrailingStopLossOnFillPriceDistancePrecisionExceeded) } "TRAILING_STOP_LOSS_ON_FILL_PRICE_DISTANCE_MAXIMUM_EXCEEDED" => { Ok(TransactionRejectReason::TrailingStopLossOnFillPriceDistanceMaximumExceeded) } "TRAILING_STOP_LOSS_ON_FILL_PRICE_DISTANCE_MINIMUM_NOT_MET" => { Ok(TransactionRejectReason::TrailingStopLossOnFillPriceDistanceMinimumNotMet) } "TRAILING_STOP_LOSS_ON_FILL_TIME_IN_FORCE_MISSING" => { Ok(TransactionRejectReason::TrailingStopLossOnFillTimeInForceMissing) } "TRAILING_STOP_LOSS_ON_FILL_TIME_IN_FORCE_INVALID" => { Ok(TransactionRejectReason::TrailingStopLossOnFillTimeInForceInvalid) } "TRAILING_STOP_LOSS_ON_FILL_GTD_TIMESTAMP_MISSING" => { Ok(TransactionRejectReason::TrailingStopLossOnFillGtdTimestampMissing) } "TRAILING_STOP_LOSS_ON_FILL_GTD_TIMESTAMP_IN_PAST" => { Ok(TransactionRejectReason::TrailingStopLossOnFillGtdTimestampInPast) } "TRAILING_STOP_LOSS_ON_FILL_CLIENT_ORDER_ID_INVALID" => { Ok(TransactionRejectReason::TrailingStopLossOnFillClientOrderIdInvalid) } "TRAILING_STOP_LOSS_ON_FILL_CLIENT_ORDER_TAG_INVALID" => { Ok(TransactionRejectReason::TrailingStopLossOnFillClientOrderTagInvalid) } "TRAILING_STOP_LOSS_ON_FILL_CLIENT_ORDER_COMMENT_INVALID" => { Ok(TransactionRejectReason::TrailingStopLossOnFillClientOrderCommentInvalid) } "TRAILING_STOP_LOSS_ORDERS_NOT_SUPPORTED" => { Ok(TransactionRejectReason::TrailingStopLossOrdersNotSupported) } "TRAILING_STOP_LOSS_ON_FILL_TRIGGER_CONDITION_MISSING" => { Ok(TransactionRejectReason::TrailingStopLossOnFillTriggerConditionMissing) } "TRAILING_STOP_LOSS_ON_FILL_TRIGGER_CONDITION_INVALID" => { Ok(TransactionRejectReason::TrailingStopLossOnFillTriggerConditionInvalid) } "CLOSE_TRADE_TYPE_MISSING" => Ok(TransactionRejectReason::CloseTradeTypeMissing), "CLOSE_TRADE_PARTIAL_UNITS_MISSING" => { Ok(TransactionRejectReason::CloseTradePartialUnitsMissing) } "CLOSE_TRADE_UNITS_EXCEED_TRADE_SIZE" => { Ok(TransactionRejectReason::CloseTradeUnitsExceedTradeSize) } "CLOSEOUT_POSITION_DOESNT_EXIST" => { Ok(TransactionRejectReason::CloseoutPositionDoesntExist) } "CLOSEOUT_POSITION_INCOMPLETE_SPECIFICATION" => { Ok(TransactionRejectReason::CloseoutPositionIncompleteSpecification) } "CLOSEOUT_POSITION_UNITS_EXCEED_POSITION_SIZE" => { Ok(TransactionRejectReason::CloseoutPositionUnitsExceedPositionSize) } "CLOSEOUT_POSITION_REJECT" => Ok(TransactionRejectReason::CloseoutPositionReject), "CLOSEOUT_POSITION_PARTIAL_UNITS_MISSING" => { Ok(TransactionRejectReason::CloseoutPositionPartialUnitsMissing) } "MARKUP_GROUP_ID_INVALID" => Ok(TransactionRejectReason::MarkupGroupIdInvalid), "POSITION_AGGREGATION_MODE_INVALID" => { Ok(TransactionRejectReason::PositionAggregationModeInvalid) } "ADMIN_CONFIGURE_DATA_MISSING" => { Ok(TransactionRejectReason::AdminConfigureDataMissing) } "MARGIN_RATE_INVALID" => Ok(TransactionRejectReason::MarginRateInvalid), "MARGIN_RATE_WOULD_TRIGGER_CLOSEOUT" => { Ok(TransactionRejectReason::MarginRateWouldTriggerCloseout) } "ALIAS_INVALID" => Ok(TransactionRejectReason::AliasInvalid), "CLIENT_CONFIGURE_DATA_MISSING" => { Ok(TransactionRejectReason::ClientConfigureDataMissing) } "MARGIN_RATE_WOULD_TRIGGER_MARGIN_CALL" => { Ok(TransactionRejectReason::MarginRateWouldTriggerMarginCall) } "AMOUNT_INVALID" => Ok(TransactionRejectReason::AmountInvalid), "INSUFFICIENT_FUNDS" => Ok(TransactionRejectReason::InsufficientFunds), "AMOUNT_MISSING" => Ok(TransactionRejectReason::AmountMissing), "FUNDING_REASON_MISSING" => Ok(TransactionRejectReason::FundingReasonMissing), "CLIENT_EXTENSIONS_DATA_MISSING" => { Ok(TransactionRejectReason::ClientExtensionsDataMissing) } "REPLACING_ORDER_INVALID" => Ok(TransactionRejectReason::ReplacingOrderInvalid), "REPLACING_TRADE_ID_INVALID" => Ok(TransactionRejectReason::ReplacingTradeIdInvalid), _ => Err(()), } } } impl std::fmt::Display for TransactionRejectReason { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct StopOrderRequest { /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The price threshold specified for the Stop Order. The Stop Order will /// only be filled by a market price that is equal to or worse than this /// price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The worst market price that may be used to fill this Stop Order. If /// the market gaps and crosses through both the price and the priceBound, /// the Stop Order will be cancelled instead of being filled. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "priceBound", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price_bound: Option<f32>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// The time-in-force requested for the Stop Order. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The Stop Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// The quantity requested to be filled by the Stop Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// The date/time when the Stop Order will be cancelled if its timeInForce /// is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, /// The type of the Order to Create. Must be set to "STOP" when creating a /// Stop Order. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, } impl StopOrderRequest { pub fn new() -> StopOrderRequest { StopOrderRequest { trigger_condition: None, price: None, price_bound: None, take_profit_on_fill: None, time_in_force: None, instrument: None, trade_client_extensions: None, client_extensions: None, trailing_stop_loss_on_fill: None, units: None, stop_loss_on_fill: None, gtd_time: None, otype: None, position_fill: None, } } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return StopOrderRequest pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The price threshold specified for the Stop Order. The Stop Order will /// only be filled by a market price that is equal to or worse than this /// price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return StopOrderRequest pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The worst market price that may be used to fill this Stop Order. If /// the market gaps and crosses through both the price and the priceBound, /// the Stop Order will be cancelled instead of being filled. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return StopOrderRequest pub fn with_price_bound(mut self, x: f32) -> Self { self.price_bound = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return StopOrderRequest pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// The time-in-force requested for the Stop Order. /// - param String /// - return StopOrderRequest pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The Stop Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return StopOrderRequest pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return StopOrderRequest pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return StopOrderRequest pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return StopOrderRequest pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// The quantity requested to be filled by the Stop Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return StopOrderRequest pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return StopOrderRequest pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// The date/time when the Stop Order will be cancelled if its timeInForce /// is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopOrderRequest pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } /// The type of the Order to Create. Must be set to "STOP" when creating a /// Stop Order. /// - param String /// - return StopOrderRequest pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return StopOrderRequest pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct UserInfoExternal { /// The country that the user is based in. #[serde(default)] #[serde(rename = "country", skip_serializing_if = "Option::is_none")] pub country: Option<String>, /// The user's OANDA-assigned user ID. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// Flag indicating if the the user's Accounts adhere to FIFO execution /// rules. #[serde(default)] #[serde(rename = "FIFO", skip_serializing_if = "Option::is_none")] pub fifo: Option<bool>, } impl UserInfoExternal { pub fn new() -> UserInfoExternal { UserInfoExternal { country: None, user_id: None, fifo: None, } } /// The country that the user is based in. /// - param String /// - return UserInfoExternal pub fn with_country(mut self, x: String) -> Self { self.country = Some(x); self } /// The user's OANDA-assigned user ID. /// - param i32 /// - return UserInfoExternal pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// Flag indicating if the the user's Accounts adhere to FIFO execution /// rules. /// - param bool /// - return UserInfoExternal pub fn with_fifo(mut self, x: bool) -> Self { self.fifo = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct CalculatedTradeState { /// The Trade's unrealized profit/loss. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "unrealizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub unrealized_pl: Option<f32>, /// The Trade's ID. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// Margin currently used by the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "marginUsed", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub margin_used: Option<f32>, } impl CalculatedTradeState { pub fn new() -> CalculatedTradeState { CalculatedTradeState { unrealized_pl: None, id: None, margin_used: None, } } /// The Trade's unrealized profit/loss. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return CalculatedTradeState pub fn with_unrealized_pl(mut self, x: f32) -> Self { self.unrealized_pl = Some(x); self } /// The Trade's ID. /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return CalculatedTradeState pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// Margin currently used by the Trade. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return CalculatedTradeState pub fn with_margin_used(mut self, x: f32) -> Self { self.margin_used = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct TradeReduce { /// The financing paid/collected when reducing the Trade /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "financing", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub financing: Option<f32>, /// The ID of the Trade that was reduced or closed /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. #[serde(default)] #[serde(rename = "tradeID", skip_serializing_if = "Option::is_none")] pub trade_id: Option<String>, /// This is the fee that is charged for closing the Trade if it has a /// guaranteed Stop Loss Order attached to it. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "guaranteedExecutionFee", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub guaranteed_execution_fee: Option<f32>, /// The average price that the units were closed at. This price may be /// clamped for guaranteed Stop Loss Orders. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The PL realized when reducing the Trade /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "realizedPL", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub realized_pl: Option<f32>, /// The number of units that the Trade was reduced by /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// The half spread cost for the trade reduce/close. This can be a /// positive or negative value and is represented in the home currency of /// the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. #[serde(default)] #[serde( rename = "halfSpreadCost", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub half_spread_cost: Option<f32>, } impl TradeReduce { pub fn new() -> TradeReduce { TradeReduce { financing: None, trade_id: None, guaranteed_execution_fee: None, price: None, realized_pl: None, units: None, half_spread_cost: None, } } /// The financing paid/collected when reducing the Trade /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return TradeReduce pub fn with_financing(mut self, x: f32) -> Self { self.financing = Some(x); self } /// The ID of the Trade that was reduced or closed /// format: The string representation of the OANDA-assigned TradeID. OANDA- /// assigned TradeIDs are positive integers, and are derived from the /// TransactionID of the Transaction that opened the Trade. /// - param String /// - return TradeReduce pub fn with_trade_id(mut self, x: String) -> Self { self.trade_id = Some(x); self } /// This is the fee that is charged for closing the Trade if it has a /// guaranteed Stop Loss Order attached to it. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return TradeReduce pub fn with_guaranteed_execution_fee(mut self, x: f32) -> Self { self.guaranteed_execution_fee = Some(x); self } /// The average price that the units were closed at. This price may be /// clamped for guaranteed Stop Loss Orders. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return TradeReduce pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The PL realized when reducing the Trade /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return TradeReduce pub fn with_realized_pl(mut self, x: f32) -> Self { self.realized_pl = Some(x); self } /// The number of units that the Trade was reduced by /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return TradeReduce pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// The half spread cost for the trade reduce/close. This can be a /// positive or negative value and is represented in the home currency of /// the Account. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on the Account's home currency. /// - param f32 /// - return TradeReduce pub fn with_half_spread_cost(mut self, x: f32) -> Self { self.half_spread_cost = Some(x); self } } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[derive(Debug, Serialize, Deserialize)] pub enum OrderTriggerCondition { #[serde(rename = "DEFAULT")] Default, #[serde(rename = "INVERSE")] Inverse, #[serde(rename = "BID")] Bid, #[serde(rename = "ASK")] Ask, #[serde(rename = "MID")] Mid, } impl FromStr for OrderTriggerCondition { type Err = (); fn from_str(s: &str) -> Result<OrderTriggerCondition, ()> { match s { "DEFAULT" => Ok(OrderTriggerCondition::Default), "INVERSE" => Ok(OrderTriggerCondition::Inverse), "BID" => Ok(OrderTriggerCondition::Bid), "ASK" => Ok(OrderTriggerCondition::Ask), "MID" => Ok(OrderTriggerCondition::Mid), _ => Err(()), } } } impl std::fmt::Display for OrderTriggerCondition { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } /// The time-in-force of an Order. TimeInForce describes how long an Order /// should remain pending before being automatically cancelled by the /// execution system. #[derive(Debug, Serialize, Deserialize)] pub enum TimeInForce { #[serde(rename = "GTC")] Gtc, #[serde(rename = "GTD")] Gtd, #[serde(rename = "GFD")] Gfd, #[serde(rename = "FOK")] Fok, #[serde(rename = "IOC")] Ioc, } impl FromStr for TimeInForce { type Err = (); fn from_str(s: &str) -> Result<TimeInForce, ()> { match s { "GTC" => Ok(TimeInForce::Gtc), "GTD" => Ok(TimeInForce::Gtd), "GFD" => Ok(TimeInForce::Gfd), "FOK" => Ok(TimeInForce::Fok), "IOC" => Ok(TimeInForce::Ioc), _ => Err(()), } } } impl std::fmt::Display for TimeInForce { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Serialize, Deserialize)] pub struct ClientPrice { /// The status of the Price. #[serde(default)] #[serde(rename = "status", skip_serializing_if = "Option::is_none")] pub status: Option<String>, /// QuoteHomeConversionFactors represents the factors that can be used /// used to convert quantities of a Price's Instrument's quote currency /// into the Account's home currency. #[serde(default)] #[serde( rename = "quoteHomeConversionFactors", skip_serializing_if = "Option::is_none" )] pub quote_home_conversion_factors: Option<QuoteHomeConversionFactors>, /// The list of prices and liquidity available on the Instrument's ask /// side. It is possible for this list to be empty if there is no ask /// liquidity currently available for the Instrument in the Account. #[serde(default)] #[serde(rename = "asks", skip_serializing_if = "Option::is_none")] pub asks: Option<Vec<PriceBucket>>, /// Representation of how many units of an Instrument are available to be /// traded by an Order depending on its postionFill option. #[serde(default)] #[serde(rename = "unitsAvailable", skip_serializing_if = "Option::is_none")] pub units_available: Option<UnitsAvailable>, /// The closeout bid Price. This Price is used when a bid is required to /// closeout a Position (margin closeout or manual) yet there is no bid /// liquidity. The closeout bid is never used to open a new position. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "closeoutBid", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub closeout_bid: Option<f32>, /// The list of prices and liquidity available on the Instrument's bid /// side. It is possible for this list to be empty if there is no bid /// liquidity currently available for the Instrument in the Account. #[serde(default)] #[serde(rename = "bids", skip_serializing_if = "Option::is_none")] pub bids: Option<Vec<PriceBucket>>, /// The Price's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The date/time when the Price was created /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The closeout ask Price. This Price is used when a ask is required to /// closeout a Position (margin closeout or manual) yet there is no ask /// liquidity. The closeout ask is never used to open a new position. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "closeoutAsk", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub closeout_ask: Option<f32>, /// The string "PRICE". Used to identify the a Price object when found in /// a stream. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// Flag indicating if the Price is tradeable or not #[serde(default)] #[serde(rename = "tradeable", skip_serializing_if = "Option::is_none")] pub tradeable: Option<bool>, } impl ClientPrice { pub fn new() -> ClientPrice { ClientPrice { status: None, quote_home_conversion_factors: None, asks: None, units_available: None, closeout_bid: None, bids: None, instrument: None, time: None, closeout_ask: None, otype: None, tradeable: None, } } /// The status of the Price. /// - param String /// - return ClientPrice pub fn with_status(mut self, x: String) -> Self { self.status = Some(x); self } /// QuoteHomeConversionFactors represents the factors that can be used /// used to convert quantities of a Price's Instrument's quote currency /// into the Account's home currency. /// - param QuoteHomeConversionFactors /// - return ClientPrice pub fn with_quote_home_conversion_factors(mut self, x: QuoteHomeConversionFactors) -> Self { self.quote_home_conversion_factors = Some(x); self } /// The list of prices and liquidity available on the Instrument's ask /// side. It is possible for this list to be empty if there is no ask /// liquidity currently available for the Instrument in the Account. /// - param Vec<PriceBucket> /// - return ClientPrice pub fn with_asks(mut self, x: Vec<PriceBucket>) -> Self { self.asks = Some(x); self } /// Representation of how many units of an Instrument are available to be /// traded by an Order depending on its postionFill option. /// - param UnitsAvailable /// - return ClientPrice pub fn with_units_available(mut self, x: UnitsAvailable) -> Self { self.units_available = Some(x); self } /// The closeout bid Price. This Price is used when a bid is required to /// closeout a Position (margin closeout or manual) yet there is no bid /// liquidity. The closeout bid is never used to open a new position. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return ClientPrice pub fn with_closeout_bid(mut self, x: f32) -> Self { self.closeout_bid = Some(x); self } /// The list of prices and liquidity available on the Instrument's bid /// side. It is possible for this list to be empty if there is no bid /// liquidity currently available for the Instrument in the Account. /// - param Vec<PriceBucket> /// - return ClientPrice pub fn with_bids(mut self, x: Vec<PriceBucket>) -> Self { self.bids = Some(x); self } /// The Price's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return ClientPrice pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The date/time when the Price was created /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return ClientPrice pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The closeout ask Price. This Price is used when a ask is required to /// closeout a Position (margin closeout or manual) yet there is no ask /// liquidity. The closeout ask is never used to open a new position. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return ClientPrice pub fn with_closeout_ask(mut self, x: f32) -> Self { self.closeout_ask = Some(x); self } /// The string "PRICE". Used to identify the a Price object when found in /// a stream. /// - param String /// - return ClientPrice pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// Flag indicating if the Price is tradeable or not /// - param bool /// - return ClientPrice pub fn with_tradeable(mut self, x: bool) -> Self { self.tradeable = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct LimitOrderTransaction { /// The time-in-force requested for the Limit Order. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The Limit Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The quantity requested to be filled by the Limit Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// The Type of the Transaction. Always set to "LIMIT_ORDER" in a /// LimitOrderTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, /// The price threshold specified for the Limit Order. The Limit Order /// will only be filled by a market price that is equal to or better than /// this price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Limit Order was initiated #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Order that this Order replaces (only provided if this /// Order replaces an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacesOrderID", skip_serializing_if = "Option::is_none")] pub replaces_order_id: Option<String>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The ID of the Transaction that cancels the replaced Order (only /// provided if this Order replaces an existing Order). /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "cancellingTransactionID", skip_serializing_if = "Option::is_none" )] pub cancelling_transaction_id: Option<String>, /// The date/time when the Limit Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, } impl LimitOrderTransaction { pub fn new() -> LimitOrderTransaction { LimitOrderTransaction { time_in_force: None, request_id: None, id: None, position_fill: None, user_id: None, instrument: None, units: None, otype: None, account_id: None, price: None, stop_loss_on_fill: None, batch_id: None, reason: None, trailing_stop_loss_on_fill: None, client_extensions: None, trigger_condition: None, replaces_order_id: None, take_profit_on_fill: None, trade_client_extensions: None, time: None, cancelling_transaction_id: None, gtd_time: None, } } /// The time-in-force requested for the Limit Order. /// - param String /// - return LimitOrderTransaction pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return LimitOrderTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return LimitOrderTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return LimitOrderTransaction pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return LimitOrderTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The Limit Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return LimitOrderTransaction pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The quantity requested to be filled by the Limit Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return LimitOrderTransaction pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// The Type of the Transaction. Always set to "LIMIT_ORDER" in a /// LimitOrderTransaction. /// - param String /// - return LimitOrderTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return LimitOrderTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } /// The price threshold specified for the Limit Order. The Limit Order /// will only be filled by a market price that is equal to or better than /// this price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return LimitOrderTransaction pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return LimitOrderTransaction pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return LimitOrderTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Limit Order was initiated /// - param String /// - return LimitOrderTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return LimitOrderTransaction pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return LimitOrderTransaction pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return LimitOrderTransaction pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Order that this Order replaces (only provided if this /// Order replaces an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return LimitOrderTransaction pub fn with_replaces_order_id(mut self, x: String) -> Self { self.replaces_order_id = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return LimitOrderTransaction pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return LimitOrderTransaction pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return LimitOrderTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The ID of the Transaction that cancels the replaced Order (only /// provided if this Order replaces an existing Order). /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return LimitOrderTransaction pub fn with_cancelling_transaction_id(mut self, x: String) -> Self { self.cancelling_transaction_id = Some(x); self } /// The date/time when the Limit Order will be cancelled if its /// timeInForce is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return LimitOrderTransaction pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct PositionBook { /// The partitioned position book, divided into buckets using a default /// bucket width. These buckets are only provided for price ranges which /// actually contain order or position data. #[serde(default)] #[serde(rename = "buckets", skip_serializing_if = "Option::is_none")] pub buckets: Option<Vec<PositionBookBucket>>, /// The position book's instrument /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The price (midpoint) for the position book's instrument at the time of /// the position book snapshot /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// The price width for each bucket. Each bucket covers the price range /// from the bucket's price to the bucket's price + bucketWidth. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "bucketWidth", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub bucket_width: Option<f32>, /// The time when the position book snapshot was created /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, } impl PositionBook { pub fn new() -> PositionBook { PositionBook { buckets: None, instrument: None, price: None, bucket_width: None, time: None, } } /// The partitioned position book, divided into buckets using a default /// bucket width. These buckets are only provided for price ranges which /// actually contain order or position data. /// - param Vec<PositionBookBucket> /// - return PositionBook pub fn with_buckets(mut self, x: Vec<PositionBookBucket>) -> Self { self.buckets = Some(x); self } /// The position book's instrument /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return PositionBook pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The price (midpoint) for the position book's instrument at the time of /// the position book snapshot /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return PositionBook pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// The price width for each bucket. Each bucket covers the price range /// from the bucket's price to the bucket's price + bucketWidth. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return PositionBook pub fn with_bucket_width(mut self, x: f32) -> Self { self.bucket_width = Some(x); self } /// The time when the position book snapshot was created /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return PositionBook pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } } #[derive(Debug, Serialize, Deserialize)] pub struct StopOrderTransaction { /// The time-in-force requested for the Stop Order. #[serde(default)] #[serde(rename = "timeInForce", skip_serializing_if = "Option::is_none")] pub time_in_force: Option<String>, /// The Request ID of the request which generated the transaction. #[serde(default)] #[serde(rename = "requestID", skip_serializing_if = "Option::is_none")] pub request_id: Option<String>, /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option<String>, /// Specification of how Positions in the Account are modified when the /// Order is filled. #[serde(default)] #[serde(rename = "positionFill", skip_serializing_if = "Option::is_none")] pub position_fill: Option<String>, /// The worst market price that may be used to fill this Stop Order. If /// the market gaps and crosses through both the price and the priceBound, /// the Stop Order will be cancelled instead of being filled. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "priceBound", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price_bound: Option<f32>, /// The ID of the user that initiated the creation of the Transaction. #[serde(default)] #[serde(rename = "userID", skip_serializing_if = "Option::is_none")] pub user_id: Option<i32>, /// The Stop Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". #[serde(default)] #[serde(rename = "instrument", skip_serializing_if = "Option::is_none")] pub instrument: Option<String>, /// The quantity requested to be filled by the Stop Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. #[serde(default)] #[serde( rename = "units", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub units: Option<f32>, /// The Type of the Transaction. Always set to "STOP_ORDER" in a /// StopOrderTransaction. #[serde(default)] #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub otype: Option<String>, /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" #[serde(default)] #[serde(rename = "accountID", skip_serializing_if = "Option::is_none")] pub account_id: Option<String>, /// The price threshold specified for the Stop Order. The Stop Order will /// only be filled by a market price that is equal to or worse than this /// price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. #[serde(default)] #[serde( rename = "price", skip_serializing_if = "Option::is_none", with = "serfloats" )] pub price: Option<f32>, /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "stopLossOnFill", skip_serializing_if = "Option::is_none")] pub stop_loss_on_fill: Option<StopLossDetails>, /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde(rename = "batchID", skip_serializing_if = "Option::is_none")] pub batch_id: Option<String>, /// The reason that the Stop Order was initiated #[serde(default)] #[serde(rename = "reason", skip_serializing_if = "Option::is_none")] pub reason: Option<String>, /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. #[serde(default)] #[serde( rename = "trailingStopLossOnFill", skip_serializing_if = "Option::is_none" )] pub trailing_stop_loss_on_fill: Option<TrailingStopLossDetails>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde(rename = "clientExtensions", skip_serializing_if = "Option::is_none")] pub client_extensions: Option<ClientExtensions>, /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. #[serde(default)] #[serde(rename = "triggerCondition", skip_serializing_if = "Option::is_none")] pub trigger_condition: Option<String>, /// The ID of the Order that this Order replaces (only provided if this /// Order replaces an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. #[serde(default)] #[serde(rename = "replacesOrderID", skip_serializing_if = "Option::is_none")] pub replaces_order_id: Option<String>, /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. #[serde(default)] #[serde(rename = "takeProfitOnFill", skip_serializing_if = "Option::is_none")] pub take_profit_on_fill: Option<TakeProfitDetails>, /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. #[serde(default)] #[serde( rename = "tradeClientExtensions", skip_serializing_if = "Option::is_none" )] pub trade_client_extensions: Option<ClientExtensions>, /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "time", skip_serializing_if = "Option::is_none", with = "serdates" )] pub time: Option<DateTime<Utc>>, /// The ID of the Transaction that cancels the replaced Order (only /// provided if this Order replaces an existing Order). /// format: String representation of the numerical OANDA-assigned TransactionID #[serde(default)] #[serde( rename = "cancellingTransactionID", skip_serializing_if = "Option::is_none" )] pub cancelling_transaction_id: Option<String>, /// The date/time when the Stop Order will be cancelled if its timeInForce /// is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). #[serde(default)] #[serde( rename = "gtdTime", skip_serializing_if = "Option::is_none", with = "serdates" )] pub gtd_time: Option<DateTime<Utc>>, } impl StopOrderTransaction { pub fn new() -> StopOrderTransaction { StopOrderTransaction { time_in_force: None, request_id: None, id: None, position_fill: None, price_bound: None, user_id: None, instrument: None, units: None, otype: None, account_id: None, price: None, stop_loss_on_fill: None, batch_id: None, reason: None, trailing_stop_loss_on_fill: None, client_extensions: None, trigger_condition: None, replaces_order_id: None, take_profit_on_fill: None, trade_client_extensions: None, time: None, cancelling_transaction_id: None, gtd_time: None, } } /// The time-in-force requested for the Stop Order. /// - param String /// - return StopOrderTransaction pub fn with_time_in_force(mut self, x: String) -> Self { self.time_in_force = Some(x); self } /// The Request ID of the request which generated the transaction. /// - param String /// - return StopOrderTransaction pub fn with_request_id(mut self, x: String) -> Self { self.request_id = Some(x); self } /// The Transaction's Identifier. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return StopOrderTransaction pub fn with_id(mut self, x: String) -> Self { self.id = Some(x); self } /// Specification of how Positions in the Account are modified when the /// Order is filled. /// - param String /// - return StopOrderTransaction pub fn with_position_fill(mut self, x: String) -> Self { self.position_fill = Some(x); self } /// The worst market price that may be used to fill this Stop Order. If /// the market gaps and crosses through both the price and the priceBound, /// the Stop Order will be cancelled instead of being filled. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return StopOrderTransaction pub fn with_price_bound(mut self, x: f32) -> Self { self.price_bound = Some(x); self } /// The ID of the user that initiated the creation of the Transaction. /// - param i32 /// - return StopOrderTransaction pub fn with_user_id(mut self, x: i32) -> Self { self.user_id = Some(x); self } /// The Stop Order's Instrument. /// format: A string containing the base currency and quote currency delimited by /// a "_". /// - param String /// - return StopOrderTransaction pub fn with_instrument(mut self, x: String) -> Self { self.instrument = Some(x); self } /// The quantity requested to be filled by the Stop Order. A posititive /// number of units results in a long Order, and a negative number of /// units results in a short Order. /// format: A decimal number encoded as a string. The amount of precision provided /// depends on what the number represents. /// - param f32 /// - return StopOrderTransaction pub fn with_units(mut self, x: f32) -> Self { self.units = Some(x); self } /// The Type of the Transaction. Always set to "STOP_ORDER" in a /// StopOrderTransaction. /// - param String /// - return StopOrderTransaction pub fn with_otype(mut self, x: String) -> Self { self.otype = Some(x); self } /// The ID of the Account the Transaction was created for. /// format: "-"-delimited string with format /// "{siteID}-{divisionID}-{userID}-{accountNumber}" /// - param String /// - return StopOrderTransaction pub fn with_account_id(mut self, x: String) -> Self { self.account_id = Some(x); self } /// The price threshold specified for the Stop Order. The Stop Order will /// only be filled by a market price that is equal to or worse than this /// price. /// format: A decimal number encodes as a string. The amount of precision provided /// depends on the Instrument. /// - param f32 /// - return StopOrderTransaction pub fn with_price(mut self, x: f32) -> Self { self.price = Some(x); self } /// StopLossDetails specifies the details of a Stop Loss Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Stop Loss, or when a Trade's dependent /// Stop Loss Order is modified directly through the Trade. /// - param StopLossDetails /// - return StopOrderTransaction pub fn with_stop_loss_on_fill(mut self, x: StopLossDetails) -> Self { self.stop_loss_on_fill = Some(x); self } /// The ID of the "batch" that the Transaction belongs to. Transactions in /// the same batch are applied to the Account simultaneously. /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return StopOrderTransaction pub fn with_batch_id(mut self, x: String) -> Self { self.batch_id = Some(x); self } /// The reason that the Stop Order was initiated /// - param String /// - return StopOrderTransaction pub fn with_reason(mut self, x: String) -> Self { self.reason = Some(x); self } /// TrailingStopLossDetails specifies the details of a Trailing Stop Loss /// Order to be created on behalf of a client. This may happen when an /// Order is filled that opens a Trade requiring a Trailing Stop Loss, or /// when a Trade's dependent Trailing Stop Loss Order is modified directly /// through the Trade. /// - param TrailingStopLossDetails /// - return StopOrderTransaction pub fn with_trailing_stop_loss_on_fill(mut self, x: TrailingStopLossDetails) -> Self { self.trailing_stop_loss_on_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return StopOrderTransaction pub fn with_client_extensions(mut self, x: ClientExtensions) -> Self { self.client_extensions = Some(x); self } /// Specification of which price component should be used when determining /// if an Order should be triggered and filled. This allows Orders to be /// triggered based on the bid, ask, mid, default (ask for buy, bid for /// sell) or inverse (ask for sell, bid for buy) price depending on the /// desired behaviour. Orders are always filled using their default price /// component. This feature is only provided through the REST API. Clients /// who choose to specify a non-default trigger condition will not see it /// reflected in any of OANDA's proprietary or partner trading platforms, /// their transaction history or their account statements. OANDA platforms /// always assume that an Order's trigger condition is set to the default /// value when indicating the distance from an Order's trigger price, and /// will always provide the default trigger condition when creating or /// modifying an Order. A special restriction applies when creating a /// guaranteed Stop Loss Order. In this case the TriggerCondition value /// must either be "DEFAULT", or the "natural" trigger side "DEFAULT" /// results in. So for a Stop Loss Order for a long trade valid values are /// "DEFAULT" and "BID", and for short trades "DEFAULT" and "ASK" are /// valid. /// - param String /// - return StopOrderTransaction pub fn with_trigger_condition(mut self, x: String) -> Self { self.trigger_condition = Some(x); self } /// The ID of the Order that this Order replaces (only provided if this /// Order replaces an existing Order). /// format: The string representation of the OANDA-assigned OrderID. OANDA- /// assigned OrderIDs are positive integers, and are derived from the /// TransactionID of the Transaction that created the Order. /// - param String /// - return StopOrderTransaction pub fn with_replaces_order_id(mut self, x: String) -> Self { self.replaces_order_id = Some(x); self } /// TakeProfitDetails specifies the details of a Take Profit Order to be /// created on behalf of a client. This may happen when an Order is filled /// that opens a Trade requiring a Take Profit, or when a Trade's /// dependent Take Profit Order is modified directly through the Trade. /// - param TakeProfitDetails /// - return StopOrderTransaction pub fn with_take_profit_on_fill(mut self, x: TakeProfitDetails) -> Self { self.take_profit_on_fill = Some(x); self } /// A ClientExtensions object allows a client to attach a clientID, tag /// and comment to Orders and Trades in their Account. Do not set, /// modify, or delete this field if your account is associated with MT4. /// - param ClientExtensions /// - return StopOrderTransaction pub fn with_trade_client_extensions(mut self, x: ClientExtensions) -> Self { self.trade_client_extensions = Some(x); self } /// The date/time when the Transaction was created. /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopOrderTransaction pub fn with_time(mut self, x: DateTime<Utc>) -> Self { self.time = Some(x); self } /// The ID of the Transaction that cancels the replaced Order (only /// provided if this Order replaces an existing Order). /// format: String representation of the numerical OANDA-assigned TransactionID /// - param String /// - return StopOrderTransaction pub fn with_cancelling_transaction_id(mut self, x: String) -> Self { self.cancelling_transaction_id = Some(x); self } /// The date/time when the Stop Order will be cancelled if its timeInForce /// is "GTD". /// format: The RFC 3339 representation is a string conforming to /// https://tools.ietf.org/rfc/rfc3339.txt. The Unix representation is a /// string representing the number of seconds since the Unix Epoch /// (January 1st, 1970 at UTC). The value is a fractional number, where /// the fractional part represents a fraction of a second (up to nine /// decimal places). /// - param DateTime<Utc> /// - return StopOrderTransaction pub fn with_gtd_time(mut self, x: DateTime<Utc>) -> Self { self.gtd_time = Some(x); self } }
use clap::{crate_description, crate_name, crate_version, App, Arg}; use morgan::clusterMessage::{Node, FULLNODE_PORT_RANGE}; use morgan::connectionInfo::ContactInfo; use morgan::cloner::Replicator; use morgan::socketaddr; use morgan_interface::signature::{read_keypair, Keypair, KeypairUtil}; use std::process::exit; use std::sync::Arc; fn main() { morgan_logger::setup(); let matches = App::new(crate_name!()) .about(crate_description!()) .version(crate_version!()) .arg( Arg::with_name("identity") .short("i") .long("identity") .value_name("PATH") .takes_value(true) .help("File containing an identity (keypair)"), ) .arg( Arg::with_name("entrypoint") .short("n") .long("entrypoint") .value_name("HOST:PORT") .takes_value(true) .required(true) .help("Rendezvous with the cluster at this entry point"), ) .arg( Arg::with_name("ledger") .short("l") .long("ledger") .value_name("DIR") .takes_value(true) .required(true) .help("use DIR as persistent ledger location"), ) .arg( Arg::with_name("storage_keypair") .short("s") .long("storage-keypair") .value_name("PATH") .takes_value(true) .required(true) .help("File containing the storage account keypair"), ) .get_matches(); let ledger_path = matches.value_of("ledger").unwrap(); let keypair = if let Some(identity) = matches.value_of("identity") { read_keypair(identity).unwrap_or_else(|err| { eprintln!("{}: Unable to open keypair file: {}", err, identity); exit(1); }) } else { Keypair::new() }; let storage_keypair = if let Some(storage_keypair) = matches.value_of("storage_keypair") { read_keypair(storage_keypair).unwrap_or_else(|err| { eprintln!("{}: Unable to open keypair file: {}", err, storage_keypair); exit(1); }) } else { Keypair::new() }; let entrypoint_addr = matches .value_of("entrypoint") .map(|entrypoint| { morgan_netutil::parse_host_port(entrypoint).expect("failed to parse entrypoint address") }) .unwrap(); let gossip_addr = { let mut addr = socketaddr!([127, 0, 0, 1], 8700); addr.set_ip(morgan_netutil::get_public_ip_addr(&entrypoint_addr).unwrap()); addr }; let node = Node::new_replicator_with_external_ip(&keypair.pubkey(), &gossip_addr, FULLNODE_PORT_RANGE); println!( "replicating the data with keypair={:?} gossip_addr={:?}", keypair.pubkey(), gossip_addr ); let entrypoint_info = ContactInfo::new_gossip_entry_point(&entrypoint_addr); let mut replicator = Replicator::new( ledger_path, node, entrypoint_info, Arc::new(keypair), Arc::new(storage_keypair), ) .unwrap(); replicator.run(); replicator.close(); }
use regex::Regex; use std::fs; fn main() { let result = solve_puzzle(); println!("And the result is: {}", result); } fn solve_puzzle() -> usize { let data = read_lines(); data.iter().filter(|x| is_valid(x)).count() } struct ParsedLine { first: u32, second: u32, letter: char, password: String, } impl ParsedLine { fn new(line: &str) -> ParsedLine { let re = Regex::new(r"(?P<first>\d+)-(?P<second>\d+) (?P<letter>[a-z]): (?P<password>[a-z]+)") .unwrap(); let caps = re.captures(line).unwrap(); ParsedLine { first: caps["first"].to_string().parse::<u32>().unwrap(), second: caps["second"].to_string().parse::<u32>().unwrap(), letter: caps["letter"].to_string().chars().next().unwrap(), password: caps["password"].to_string(), } } } fn is_valid(line: &&ParsedLine) -> bool { let first = line.password.chars().nth(line.first as usize - 1).unwrap(); let second = line.password.chars().nth(line.second as usize - 1).unwrap(); match (first == line.letter, second == line.letter) { (true, true) => false, (true, false) => true, (false, true) => true, (false, false) => false, } } fn read_lines() -> Vec<ParsedLine> { fs::read_to_string("input") .expect("Error") .lines() .map(|x| ParsedLine::new(x)) .collect::<Vec<ParsedLine>>() } #[cfg(test)] mod test { use super::*; #[test] fn test_solution() { assert_eq!(605, solve_puzzle()); } }
use std::any::Any; use std::ops::{Bound, RangeBounds}; use crate::mutators::integer::binary_search_arbitrary_u32; use crate::{DefaultMutator, Mutator, MutatorExt}; const INITIAL_MUTATION_STEP: u64 = 0; // quickly written but inefficient implementation of a general mutator for char // // does not lean towards any particular char. Use CharWithinRangeMutator or CharacterMutator // for more focused mutators impl DefaultMutator for char { type Mutator = impl Mutator<char>; #[no_coverage] fn default_mutator() -> Self::Mutator { u32::default_mutator() .filter( #[no_coverage] |x| char::from_u32(*x).is_some(), ) .map( #[no_coverage] |x| char::from_u32(*x).unwrap(), |c| Some(*c as u32), ) } } /// Mutator for a `char` within a given range pub struct CharWithinRangeMutator { start_range: u32, len_range: u32, rng: fastrand::Rng, search_space_complexity: f64, } impl CharWithinRangeMutator { #[no_coverage] pub fn new<RB: RangeBounds<char>>(range: RB) -> Self { let start = match range.start_bound() { Bound::Included(b) => *b as u32, Bound::Excluded(b) => { assert_ne!(*b as u32, <u32>::MAX); *b as u32 + 1 } Bound::Unbounded => <u32>::MIN, }; let end = match range.end_bound() { Bound::Included(b) => *b as u32, Bound::Excluded(b) => { assert_ne!(*b as u32, <u32>::MIN); (*b as u32) - 1 } Bound::Unbounded => <u32>::MAX, }; if !(start <= end) { panic!( "You have provided a character range where the value of the start of the range \ is larger than the end of the range!\nRange start: {:#?}\nRange end: {:#?}", range.start_bound(), range.end_bound() ) } let len_range = end.wrapping_sub(start); let search_space_complexity = crate::mutators::size_to_cplxity(len_range as usize); Self { start_range: start, len_range: len_range as u32, rng: fastrand::Rng::default(), search_space_complexity, } } } impl Mutator<char> for CharWithinRangeMutator { #[doc(hidden)] type Cache = f64; // complexity of the character #[doc(hidden)] type MutationStep = u64; // mutation step #[doc(hidden)] type ArbitraryStep = u64; #[doc(hidden)] type UnmutateToken = char; // old value #[doc(hidden)] #[no_coverage] fn initialize(&self) {} #[doc(hidden)] #[no_coverage] fn default_arbitrary_step(&self) -> Self::ArbitraryStep { 0 } #[doc(hidden)] #[no_coverage] fn is_valid(&self, value: &char) -> bool { (self.start_range..=self.start_range + self.len_range).contains(&(*value as u32)) } #[doc(hidden)] #[no_coverage] fn validate_value(&self, value: &char) -> Option<Self::Cache> { if (self.start_range..=self.start_range + self.len_range).contains(&(*value as u32)) { Some((value.len_utf8() * 8) as f64) } else { None } } #[doc(hidden)] #[no_coverage] fn default_mutation_step(&self, _value: &char, _cache: &Self::Cache) -> Self::MutationStep { INITIAL_MUTATION_STEP } #[doc(hidden)] #[no_coverage] fn global_search_space_complexity(&self) -> f64 { self.search_space_complexity } #[doc(hidden)] #[no_coverage] fn max_complexity(&self) -> f64 { 32.0 } #[doc(hidden)] #[no_coverage] fn min_complexity(&self) -> f64 { 8.0 } #[doc(hidden)] #[no_coverage] fn complexity(&self, _value: &char, cache: &Self::Cache) -> f64 { *cache } #[doc(hidden)] #[no_coverage] fn ordered_arbitrary(&self, step: &mut Self::ArbitraryStep, max_cplx: f64) -> Option<(char, f64)> { if max_cplx < self.min_complexity() { return None; } if *step > self.len_range as u64 { None } else { let result = binary_search_arbitrary_u32(0, self.len_range, *step); *step += 1; if let Some(c) = char::from_u32(self.start_range.wrapping_add(result)) { Some((c, (c.len_utf8() * 8) as f64)) } else { *step += 1; self.ordered_arbitrary(step, max_cplx) } } } #[doc(hidden)] #[no_coverage] fn random_arbitrary(&self, max_cplx: f64) -> (char, f64) { let value = self .rng .u32(self.start_range..=self.start_range.wrapping_add(self.len_range)); if let Some(value) = char::from_u32(value) { (value, (value.len_utf8() * 8) as f64) } else { // try again self.random_arbitrary(max_cplx) } } #[doc(hidden)] #[no_coverage] fn ordered_mutate( &self, value: &mut char, cache: &mut Self::Cache, step: &mut Self::MutationStep, subvalue_provider: &dyn crate::SubValueProvider, max_cplx: f64, ) -> Option<(Self::UnmutateToken, f64)> { if max_cplx < self.min_complexity() { return None; } if *step > self.len_range as u64 { return None; } let token = *value; let result = binary_search_arbitrary_u32(0, self.len_range, *step); // TODO: loop instead of recurse if let Some(result) = char::from_u32(self.start_range.wrapping_add(result)) { *step += 1; if result == *value { return self.ordered_mutate(value, cache, step, subvalue_provider, max_cplx); } *value = result; Some((token, (value.len_utf8() * 8) as f64)) } else { *step += 1; self.ordered_mutate(value, cache, step, subvalue_provider, max_cplx) } } #[doc(hidden)] #[no_coverage] fn random_mutate(&self, value: &mut char, _cache: &mut Self::Cache, _max_cplx: f64) -> (Self::UnmutateToken, f64) { let old_value = std::mem::replace( value, char::from_u32( self.rng .u32(self.start_range..=self.start_range.wrapping_add(self.len_range)), ) .unwrap_or(*value), ); (old_value, (value.len_utf8() * 8) as f64) } #[doc(hidden)] #[no_coverage] fn unmutate(&self, value: &mut char, _cache: &mut Self::Cache, t: Self::UnmutateToken) { *value = t; } #[doc(hidden)] #[no_coverage] fn visit_subvalues<'a>(&self, _value: &'a char, _cache: &'a Self::Cache, _visit: &mut dyn FnMut(&'a dyn Any, f64)) { } }
use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Serialize, Deserialize, Eq, Ord, PartialEq, PartialOrd)] pub struct Price { pub shop_id: String, pub value: usize, //en centimes pour 1 unité (Kg, L) pub unit: String, } #[derive(Debug, FromForm)] pub struct PriceForm { pub shop_id: String, pub article_id: String, pub price: String, pub quantity: f32, pub unit: String, } #[derive(Debug, FromForm)] pub struct PriceDeleteForm { pub shop_id: String, pub article_id: String, } pub fn price_per_unit(price: f32, weight: f32, unit: String) -> f32 { use crate::models::article; let units = Vec::from(article::UNITS); match units.iter().find(|x| x.0 == unit) { Some(u) => (price / weight) * u.1, _ => 0.0, } } impl Price { pub fn euros(&self) -> f32 { self.value as f32 / 100.0 } }
extern crate uptime_lib; use std::fmt; struct CompoundTime { w: usize, d: usize, h: usize, m: usize, s: usize, } macro_rules! reduce { ($s: ident, $(($from: ident, $to: ident, $factor: expr)),+) => {{ $( $s.$to += $s.$from / $factor; $s.$from %= $factor; )+ }} } impl CompoundTime { #[inline] fn new(w: usize, d: usize, h: usize, m: usize, s: usize) -> Self{ CompoundTime { w: w, d: d, h: h, m: m, s: s, } } #[inline] fn balance(&mut self) { reduce!(self, (s, m, 60), (m, h, 60), (h, d, 24), (d, w, 7)); } } impl fmt::Display for CompoundTime { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut res = String::new(); if self.w > 0 { res.push_str(format!("{} week(s) ", self.w).as_str()); } if self.d > 0 { res.push_str(format!("{} day(s) ", self.d).as_str()); } if self.h > 0 { res.push_str(format!("{} hour(s) ", self.h).as_str()); } if self.m > 0 { res.push_str(format!("{} minute(s) ", self.m).as_str()); } res.push_str(format!("{} seconds", self.s).as_str()); write!(f, "{}", &res) } } pub fn display_uptime(matches: clap::ArgMatches) { let sec: f64; let mut ct: CompoundTime; match uptime_lib::get() { Ok(uptime) => { sec = uptime.num_milliseconds() as f64 / 1000.0; ct = CompoundTime::new(0,0,0,0, sec as usize); ct.balance(); } Err(err) => { eprintln!("{}", err); std::process::exit(1); } } if matches.is_present("weeks") { println!("{}", sec as usize / 604800); return; } if matches.is_present("days") { println!("{}", sec as usize / 86400); return; } if matches.is_present("hours") { println!("{}", sec as usize / 3600); return; } if matches.is_present("minutes") { println!("{}", sec as usize / 60); return; } if matches.is_present("seconds") { println!("{}", sec as usize); return; } println!("{}", ct); }
#[doc = "Reader of register CSR"] pub type R = crate::R<u32, super::CSR>; #[doc = "Writer for register CSR"] pub type W = crate::W<u32, super::CSR>; #[doc = "Register CSR `reset()`'s with value 0"] impl crate::ResetValue for super::CSR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Clear Tamper event\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum CTE_AW { #[doc = "1: Reset the TEF Tamper event flag (and the Tamper detector)"] RESET = 1, } impl From<CTE_AW> for bool { #[inline(always)] fn from(variant: CTE_AW) -> Self { variant as u8 != 0 } } #[doc = "Write proxy for field `CTE`"] pub struct CTE_W<'a> { w: &'a mut W, } impl<'a> CTE_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: CTE_AW) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Reset the TEF Tamper event flag (and the Tamper detector)"] #[inline(always)] pub fn reset(self) -> &'a mut W { self.variant(CTE_AW::RESET) } #[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 = "Clear Tamper Interrupt\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum CTI_AW { #[doc = "1: Clear the Tamper interrupt and the TIF Tamper interrupt flag"] CLEAR = 1, } impl From<CTI_AW> for bool { #[inline(always)] fn from(variant: CTI_AW) -> Self { variant as u8 != 0 } } #[doc = "Write proxy for field `CTI`"] pub struct CTI_W<'a> { w: &'a mut W, } impl<'a> CTI_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: CTI_AW) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Clear the Tamper interrupt and the TIF Tamper interrupt flag"] #[inline(always)] pub fn clear(self) -> &'a mut W { self.variant(CTI_AW::CLEAR) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1); self.w } } #[doc = "Tamper Pin interrupt enable\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum TPIE_A { #[doc = "0: Tamper interrupt disabled"] DISABLED = 0, #[doc = "1: Tamper interrupt enabled (the TPE bit must also be set in the BKP_CR register"] ENABLED = 1, } impl From<TPIE_A> for bool { #[inline(always)] fn from(variant: TPIE_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `TPIE`"] pub type TPIE_R = crate::R<bool, TPIE_A>; impl TPIE_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> TPIE_A { match self.bits { false => TPIE_A::DISABLED, true => TPIE_A::ENABLED, } } #[doc = "Checks if the value of the field is `DISABLED`"] #[inline(always)] pub fn is_disabled(&self) -> bool { *self == TPIE_A::DISABLED } #[doc = "Checks if the value of the field is `ENABLED`"] #[inline(always)] pub fn is_enabled(&self) -> bool { *self == TPIE_A::ENABLED } } #[doc = "Write proxy for field `TPIE`"] pub struct TPIE_W<'a> { w: &'a mut W, } impl<'a> TPIE_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: TPIE_A) -> &'a mut W { { self.bit(variant.into()) } } #[doc = "Tamper interrupt disabled"] #[inline(always)] pub fn disabled(self) -> &'a mut W { self.variant(TPIE_A::DISABLED) } #[doc = "Tamper interrupt enabled (the TPE bit must also be set in the BKP_CR register"] #[inline(always)] pub fn enabled(self) -> &'a mut W { self.variant(TPIE_A::ENABLED) } #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2); self.w } } #[doc = "Reader of field `TEF`"] pub type TEF_R = crate::R<bool, bool>; #[doc = "Reader of field `TIF`"] pub type TIF_R = crate::R<bool, bool>; impl R { #[doc = "Bit 2 - Tamper Pin interrupt enable"] #[inline(always)] pub fn tpie(&self) -> TPIE_R { TPIE_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 8 - Tamper Event Flag"] #[inline(always)] pub fn tef(&self) -> TEF_R { TEF_R::new(((self.bits >> 8) & 0x01) != 0) } #[doc = "Bit 9 - Tamper Interrupt Flag"] #[inline(always)] pub fn tif(&self) -> TIF_R { TIF_R::new(((self.bits >> 9) & 0x01) != 0) } } impl W { #[doc = "Bit 0 - Clear Tamper event"] #[inline(always)] pub fn cte(&mut self) -> CTE_W { CTE_W { w: self } } #[doc = "Bit 1 - Clear Tamper Interrupt"] #[inline(always)] pub fn cti(&mut self) -> CTI_W { CTI_W { w: self } } #[doc = "Bit 2 - Tamper Pin interrupt enable"] #[inline(always)] pub fn tpie(&mut self) -> TPIE_W { TPIE_W { w: self } } }
pub mod level; pub mod level_loader; use amethyst::ecs::{ Entities, Entity, Join, ReadStorage, World, WorldExt, WriteStorage, }; pub use level::Level; use crate::components::prelude::*; use crate::resources::prelude::*; use crate::savefile_data::prelude::*; use crate::settings::prelude::*; use level_loader::{BuildType, LevelLoader, ToBuild}; pub struct LevelManager { pub level: Level, pub level_loader: LevelLoader, should_delete_save: bool, } impl LevelManager { pub fn new(level: Level) -> Self { Self { level: level, level_loader: Default::default(), should_delete_save: false, } } pub fn with_delete_save(level: Level) -> Self { Self { level: level, level_loader: Default::default(), should_delete_save: true, } } pub fn setup(&mut self, world: &mut World) { self.level_loader = LevelLoader::default(); self.reset_level(world); self.load_from_savefile(world); if world.read_resource::<Music>().should_audio_stop() { world.write_resource::<StopAudio>().0 = true; } // Create timer if a timer should run if world.read_resource::<CheckpointRes>().0.is_none() { world.write_resource::<TimerRes>().add_timer(); } else { world.write_resource::<TimerRes>().remove_timer(); } } pub fn reset(&mut self, world: &mut World) { self.level_loader.to_build = ToBuild::none() .with(BuildType::Backgrounds) .with(BuildType::Camera) .with(BuildType::Enemies) .with(BuildType::Features) .with(BuildType::Indicators) .with(BuildType::Player); self.level_loader.build(world); self.apply_checkpoint(world); if world.read_resource::<Music>().should_audio_stop() { world.write_resource::<StopAudio>().0 = true; } } pub fn win_level(&mut self, world: &mut World) { // Finish timer here, so the time is saved to the savefile. if let Some(timer) = world.write_resource::<TimerRes>().0.as_mut() { if timer.state.is_running() { timer.finish().unwrap(); println!("---\nLEVEL TIME: {}\n---", timer.time_output()); } } world.write_resource::<WinGame>().0 = true; // Clear these resources, so when the game saves, // it resets the relevant data for this level. // This way, after the level was beaten and the player // starts the same level again, they will start at the beginning. world.write_resource::<CheckpointRes>().0 = None; world.write_resource::<Music>().reset(); world.write_resource::<PlayerDeaths>().0 = 0; self.save_to_savefile(world, true); } pub fn save_to_savefile(&mut self, world: &mut World, won: bool) { { let checkpoint_data = world.read_resource::<CheckpointRes>().0.clone(); let music_data = MusicData::from(&*world.read_resource::<Music>()); let player_deaths = world.read_resource::<PlayerDeaths>().0; let savefile_data_res = &mut world.write_resource::<SavefileDataRes>().0; let savefile_data = savefile_data_res.get_or_insert_with(Default::default); let existing_level_data = savefile_data.levels.get(&self.level); let time = world .read_resource::<TimerRes>() .0 .as_ref() .filter(|timer| timer.state.is_finished()) .map(|timer| timer.time_output()); let level_data = LevelSaveData { checkpoint: checkpoint_data.clone(), music: music_data, stats: StatsData { player_deaths }, best_time: existing_level_data .and_then(|p| p.best_time) .map(|prev_time| { if let Some(time) = time { if time < prev_time { time } else { prev_time } } else { prev_time } }) .or(time), won: won || existing_level_data.map(|d| d.won).unwrap_or(false), }; savefile_data.levels.insert(self.level.clone(), level_data); } save_savefile_data(world); } fn load_from_savefile(&mut self, world: &mut World) { let mut should_apply_checkpoint = false; if let Some(savefile_data) = world.read_resource::<SavefileDataRes>().0.as_ref() { if let Some(level_data) = savefile_data.level(&self.level) { // Set SHOULD_DISPLAY_TIMER world.write_resource::<ShouldDisplayTimer>().0 = level_data.won && (level_data.checkpoint.is_none() || self.should_delete_save); // Set BEST_TIME if let Some(best_time) = level_data.best_time.as_ref() { world.write_resource::<BestTime>().0 = Some(best_time.clone()); } // Don't apply this level's save if !self.should_delete_save { { // Set CHECKPOINT world.write_resource::<CheckpointRes>().0 = level_data.checkpoint.clone(); // Set MUSIC world.write_resource::<Music>().queue = level_data.music.queue.clone(); // Set PLAYER_DEATHS world.write_resource::<PlayerDeaths>().0 = level_data.stats.player_deaths; // Apply the set checkpoint data later (due to borrow checker) should_apply_checkpoint = true; } } } else { // No save for this level } } else { // No savefile } // Apply checkpoint if should_apply_checkpoint { self.apply_checkpoint(world); } } fn reset_level(&mut self, world: &mut World) { // Reset some resources // Reset CHECKPOINT world.write_resource::<CheckpointRes>().0 = None; // Reset MUSIC world.write_resource::<Music>().reset(); // Reset PLAYER_DEATHS world.write_resource::<PlayerDeaths>().0 = 0; // Reset SHOULD_DISPLAY_TIMER world.write_resource::<ShouldDisplayTimer>().0 = false; // Reset BEST_TIME world.write_resource::<BestTime>().0 = None; // Load level self.load_level(world); } fn load_level(&mut self, world: &mut World) { let level_filename = world .read_resource::<Settings>() .level_manager .level(&self.level) .filename .clone(); world.delete_all(); world.write_resource::<CheckpointRes>().0 = None; self.level_loader.to_build = ToBuild::all(); self.level_loader.load(level_filename); self.level_loader.build(world); } fn apply_checkpoint(&self, world: &mut World) { world.maintain(); let checkpoint_data = world.read_resource::<CheckpointRes>().0.clone(); if let Some(checkpoint) = checkpoint_data { world.exec( |( entities, players, features, mut transforms, mut force_apply_features, ): ( Entities, ReadStorage<Player>, ReadStorage<Feature>, WriteStorage<Transform>, WriteStorage<ForceApplyFeature>, )| { // Set player position if let Some((_, player_transform)) = (&players, &mut transforms).join().next() { player_transform .set_translation_x(checkpoint.position.0); player_transform .set_translation_y(checkpoint.position.1); } // Set features to force apply let mut song_feature: Option<(Entity, FeatureType)> = None; for (feature_entity, feature) in (&entities, &features).join() { if checkpoint.features.contains(&feature.feature_type) { match feature.feature_type { FeatureType::SetSong(n) => { if let Some(( _, FeatureType::SetSong(last_n), )) = song_feature.as_ref() { if n > *last_n { song_feature = Some(( feature_entity, feature.feature_type.clone(), )); } } else { song_feature = Some(( feature_entity, feature.feature_type.clone(), )); } } _ => { force_apply_features .insert( feature_entity, ForceApplyFeature::default(), ) .expect( "Should add ForceApplyFeature to \ Feature", ); } } } } if let Some((feature_entity, _)) = song_feature { force_apply_features .insert( feature_entity, ForceApplyFeature::default(), ) .expect( "Should add ForceApplyFeature to Feature \ (song)", ); } }, ); } else { // If no checkpoint was set, then stop audio world.write_resource::<StopAudio>().0 = true; } } }
use std::{ error, fmt::{self, Display, Formatter}, }; #[derive(Debug)] #[cfg_attr(test, derive(PartialEq))] pub enum Error { InvalidInput { token: String, position: usize, }, InvalidOpcode { opcode: i64, position: usize, }, MissingParameter { parameter: u8, opcode: i64, position: usize, }, NegativePositionalParameter { value: i64, parameter: u8, opcode: i64, position: usize, }, InvalidParameterMode { mode: i64, parameter: u8, opcode: i64, position: usize, }, } impl Display for Error { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match self { Error::InvalidInput { token, position } => { write!(f, "Invalid token \"{}\" at position {}", token, position) } Error::InvalidOpcode { opcode, position } => { write!(f, "Invalid opcode \"{}\" at position {}", opcode, position) } Error::MissingParameter { parameter, opcode, position, } => write!( f, "Missing parameter {} for opcode \"{}\" at position {}", parameter, opcode, position ), Error::NegativePositionalParameter { value, parameter, opcode, position, } => write!( f, "Negative value {} for positional parameter {} for opcode \"{}\" at position {}", value, parameter, opcode, position ), Error::InvalidParameterMode { mode, parameter, opcode, position, } => write!( f, "Invalid parameter mode \"{}\" for parameter {} of opcode \"{}\" at position {}", mode, parameter, opcode, position ), } } } impl error::Error for Error {}
extern crate coinbase_pro_rs; extern crate serde_json; mod common; use coinbase_pro_rs::structs::reqs; use coinbase_pro_rs::*; use common::delay; use coinbase_pro_rs::structs::reqs::{OrderTimeInForce, OrderTimeInForceCancelAfter}; static KEY: &str = "9eaa4603717ffdc322771a933ae12501"; static SECRET: &str = "RrLem7Ihmnn57ryW4Cc3Rp31h+Bm2DEPmzNbRiPrQQRE1yH6WNybmhK8xSqHjUNaR/V8huS+JMhBlr8PKt2GhQ=="; static PASSPHRASE: &str = "sandbox"; #[test] fn test_get_accounts() { delay(); let client: Private<Sync> = Private::new(SANDBOX_URL, KEY, SECRET, PASSPHRASE); let accounts = client.get_accounts().unwrap(); assert!( format!("{:?}", accounts) .contains(r#"currency: "BTC""#) ); assert!( format!("{:?}", accounts) .contains(r#"currency: "ETH""#) ); } #[test] fn test_get_account() { delay(); // super::super::pretty_env_logger::init_custom_env("RUST_LOG=trace"); let client: Private<Sync> = Private::new(SANDBOX_URL, KEY, SECRET, PASSPHRASE); let coin_acc = client .get_accounts() .unwrap() .into_iter() .find(|x| x.currency == "BTC") .unwrap(); let account = client.get_account(coin_acc.id); let account_str = format!("{:?}", account); assert!(account_str.contains("id:")); assert!(account_str.contains("currency: \"BTC\"")); assert!(account_str.contains("balance:")); assert!(account_str.contains("available:")); assert!(account_str.contains("hold:")); assert!(account_str.contains("profile_id:")); } #[test] fn test_get_account_hist() { delay(); // super::super::pretty_env_logger::init_custom_env("RUST_LOG=trace"); let client: Private<Sync> = Private::new(SANDBOX_URL, KEY, SECRET, PASSPHRASE); let coin_acc = client .get_accounts() .unwrap() .into_iter() .find(|x| x.currency == "USD") .unwrap(); let account = client.get_account_hist(coin_acc.id); let account_str = format!("{:?}", account); // println!("{}", account_str); assert!(account_str.contains("type: Match, details: Match")); } #[test] #[ignore] fn test_get_account_holds() { delay(); // super::super::pretty_env_logger::init_custom_env("RUST_LOG=trace"); let client: Private<Sync> = Private::new(SANDBOX_URL, KEY, SECRET, PASSPHRASE); let coin_acc = client .get_accounts() .unwrap() .into_iter() .find(|x| x.currency == "USD") .unwrap(); let acc_holds = client.get_account_holds(coin_acc.id); let _str = format!("{:?}", acc_holds); // assert!(account_str.contains("transfer_type: Deposit")); //println!("{:?}", str); assert!(false); // TODO: holds are empty now } #[test] fn test_new_order_ser() { delay(); let order = reqs::Order::buy_market("BTC-UST", 1.1); let str = serde_json::to_string(&order).unwrap(); assert_eq!( vec![0], str.match_indices("{").map(|(x, _)| x).collect::<Vec<_>>() ); } #[test] #[ignore] // sandbox price is too high fn test_set_order_limit() { delay(); let client: Private<Sync> = Private::new(SANDBOX_URL, KEY, SECRET, PASSPHRASE); let order = client.buy_limit("BTC-USD", 1.0, 1.12, true).unwrap(); let str = format!("{:?}", order); assert!(str.contains("side: Buy")); assert!(str.contains("_type: Limit {")); let order = client .sell_limit("BTC-USD", 0.001, 100000.0, true) .unwrap(); let str = format!("{:?}", order); assert!(str.contains("side: Sell")); assert!(str.contains("_type: Limit {")); } #[test] fn test_set_order_limit_gtc() { delay(); let client: Private<Sync> = Private::new(SANDBOX_URL, KEY, SECRET, PASSPHRASE); let order = reqs::Order::buy_limit("BTC-USD", 1.0, 1.12, true) .time_in_force(OrderTimeInForce::GTT {cancel_after: OrderTimeInForceCancelAfter::Min}); let order = client.set_order(order).unwrap(); // let order = client.buy("BTC-USD", 1.0).limit(1.0, 1.12).post_only().gtt(min).send() let str = format!("{:?}", order); assert!(str.contains("time_in_force: GTT { expire_time: 2")); } #[test] #[ignore] // sandbox price is too high fn test_set_order_market() { delay(); let client: Private<Sync> = Private::new(SANDBOX_URL, KEY, SECRET, PASSPHRASE); let order = client.buy_market("BTC-USD", 0.001).unwrap(); let str = format!("{:?}", order); assert!(str.contains("side: Buy")); assert!(str.contains("_type: Market {")); let order = client.sell_market("BTC-USD", 0.001).unwrap(); let str = format!("{:?}", order); assert!(str.contains("side: Sell")); assert!(str.contains("_type: Market {")); assert!(false); } #[test] fn test_cancel_order() { delay(); let client: Private<Sync> = Private::new(SANDBOX_URL, KEY, SECRET, PASSPHRASE); let order = client.buy_limit("BTC-USD", 1.0, 1.12, true).unwrap(); let res = client.cancel_order(order.id).unwrap(); assert_eq!(order.id, res); } #[test] fn test_cancel_all() { delay(); let client: Private<Sync> = Private::new(SANDBOX_URL, KEY, SECRET, PASSPHRASE); let order1 = client.buy_limit("BTC-USD", 1.0, 1.12, true).unwrap(); let order2 = client.buy_limit("BTC-USD", 1.0, 1.12, true).unwrap(); let res = client.cancel_all(Some("BTC-USD")).unwrap(); assert!(res.iter().find(|x| **x == order1.id).is_some()); assert!(res.iter().find(|x| **x == order2.id).is_some()); } #[test] #[ignore] fn test_get_orders() { delay(); let client: Private<Sync> = Private::new(SANDBOX_URL, KEY, SECRET, PASSPHRASE); let orders = client.get_orders(None, None).unwrap(); let str = format!("{:?}", orders); println!("{}", str); assert!(false); } #[test] fn test_get_order() { delay(); let client: Private<Sync> = Private::new(SANDBOX_URL, KEY, SECRET, PASSPHRASE); let order = client.buy_limit("BTC-USD", 1.0, 1.12, true).unwrap(); let order_res = client.get_order(order.id).unwrap(); assert_eq!(order.id, order_res.id); } #[test] fn test_get_fills() { delay(); let client: Private<Sync> = Private::new(SANDBOX_URL, KEY, SECRET, PASSPHRASE); let fills = client.get_fills(None, Some("BTC-USD")).unwrap(); let str = format!("{:?}", fills); assert!(str.contains("Fill { trade_id: ")); } #[test] #[ignore] fn test_get_trailing_volume() { delay(); let client: Private<Sync> = Private::new(SANDBOX_URL, KEY, SECRET, PASSPHRASE); let vols = client.get_trailing_volume().unwrap(); let str = format!("{:?}", vols); assert!(str == "[]"); // nothing now } #[test] fn test_get_pub() { delay(); let client: Private<Sync> = Private::new(SANDBOX_URL, KEY, SECRET, PASSPHRASE); let time = client.public().get_time().unwrap(); let time_str = format!("{:?}", time); assert!(time_str.starts_with("Time {")); assert!(time_str.contains("iso:")); assert!(time_str.contains("epoch:")); assert!(time_str.ends_with("}")); }
use failure::Error; use geometry::{Placement, Point, Rectangle, Rotation::*}; use problem::{Problem, Variant}; use std::fmt::{self, Formatter}; use std::iter; use std::result; use std::str::FromStr; use std::time::Duration; type Result<T, E = Error> = result::Result<T, E>; #[derive(Clone, Debug, PartialEq)] pub struct Solution { variant: Variant, allow_rotation: bool, source: Option<Problem>, placements: Vec<Placement>, } impl Solution { /// Checks whether this solution is valid. /// /// # Complexity /// /// Takes quadratic (in `self.placements.len()`) time. pub fn is_valid(&self) -> bool { if let Some((p1, p2)) = self .placements .iter() .enumerate() .flat_map(|(i, p)| iter::repeat(p).zip(self.placements.iter().skip(i + 1))) .find(|(p1, p2)| p1.overlaps(p2)) { eprintln!("Overlap found: {:#?} and {:#?}", p1, p2); false } else { true } } pub fn evaluate(&mut self, duration: Duration) -> Result<Evaluation> { if !self.is_valid() { bail!("Overlap in solution") } let container = self.container()?; let min_area = self.placements.iter_mut().map(|p| p.rectangle.area()).sum(); let empty_area = container.area() as i64 - min_area as i64; let filling_rate = (min_area as f64 / container.area() as f64) as f32; if filling_rate > 1.0 { bail!("Undetected overlap in solution") } Ok(Evaluation { container, min_area, empty_area, filling_rate, duration, }) } pub fn container(&self) -> Result<Rectangle> { use std::cmp::max; let (x, y) = self.placements.iter().fold((0, 0), |(x, y), p| { let tr = p.top_right; let x = max(x, tr.x); let y = max(y, tr.y); (x, y) }); let (x, y) = (x + 1, y + 1); let p = self.source.as_ref().unwrap(); let container = match p.variant { Variant::Fixed(k) if y > k => bail!( "Solution placements exceed problem bounds: top: {}, bound: {}", y, k ), Variant::Fixed(k) => Rectangle::new(x, k), _ => Rectangle::new(x, y), }; Ok(container) } pub fn source(&mut self, p: Problem) { self.source = Some(p); } } #[derive(Clone, Copy, Debug, PartialEq)] pub struct Evaluation { pub container: Rectangle, pub min_area: u64, pub empty_area: i64, pub filling_rate: f32, pub duration: Duration, } impl fmt::Display for Evaluation { fn fmt(&self, f: &mut Formatter) -> fmt::Result { let Evaluation { min_area, container, empty_area, filling_rate, duration, } = self; let bb_area = container.area(); write!( f, "lower bound on area: {}\nbounding box: {}, area: {}\nunused area in bounding box: \ {}\nfilling_rate: {:.2}\ntook {}.{:.3}s", min_area, container, bb_area, empty_area, filling_rate, duration.as_secs(), duration.subsec_millis(), ) } } impl FromStr for Solution { type Err = Error; fn from_str(s: &str) -> Result<Self, <Self as FromStr>::Err> { let mut parts = s.split("placement of rectangles").map(str::trim); let problem: Problem = parts .next() .ok_or_else(|| format_err!("Unexpected end of file: unable to parse problem"))? .parse()?; let Problem { variant, allow_rotation, source, rectangles, } = problem; let n = rectangles.len(); let placements: Vec<Placement> = parts .next() .ok_or_else(|| format_err!("Unexpected end of file: unable to parse placements"))? .lines() .map(|s| { let tokens: Vec<&str> = s.split_whitespace().collect(); let result = match (allow_rotation, tokens.as_slice()) { (false, [x, y]) => { let p = Point::new(x.parse()?, y.parse()?); (Normal, p) } (true, [rot, x, y]) => { let p = Point::new(x.parse()?, y.parse()?); (rot.parse()?, p) } _ => bail!("Invalid format: {}", tokens.join(" ")), }; Ok(result) }) .zip(rectangles.iter()) .map(|(result, &r)| result.map(|(rot, coord)| Placement::new(r, rot, coord))) .collect::<Result<_, _>>()?; if placements.len() != n { bail!("Solution contains a different number of placements than rectangles"); } Ok(Solution { variant, allow_rotation, source: None, placements, }) } } #[cfg(test)] mod tests { use super::*; use domain::{problem::Variant, Rectangle}; use std::iter; #[test] fn solution_parsing() { let r1 = Rectangle::new(12, 8); let r2 = Rectangle::new(10, 9); let expected = Solution { variant: Variant::Fixed(22), allow_rotation: false, source: None, evaluation: None, placements: vec![ Placement::new(r1, Normal, Point::new(0, 0)), Placement::new(r2, Normal, Point::new(24, 3)), ], }; let input = "container height: fixed 22\nrotations allowed: no\nnumber of rectangles: \ 6\n12 8\n10 9\nplacement of rectangles\n0 0\n24 3"; let result: Solution = input.parse().unwrap(); assert_eq!(result, expected); } #[test] fn validation() { let r = Rectangle::new(10, 9); let mut coord = Point::new(0, 0); let placements = iter::repeat(r) .take(10000) .map(|r| { let result = Placement::new(r, Normal, coord); coord.x += 11; result }) .collect(); let mut solution = { Solution { variant: Variant::Fixed(22), allow_rotation: false, source: None, evaluation: None, placements, } }; assert!(solution.is_valid()); let p = Placement::new(r, Normal, Point::new(0, 0)); solution.placements = vec![p; 10000]; assert!(!solution.is_valid()); } }
use codespan_reporting::diagnostic::{Diagnostic, Label}; use crate::{ ast::Program, lexer::{LexicalError, Location, Token, TokenKind}, }; lalrpop_mod!(pub grammar); // synthesized by LALRPOP #[derive(Debug, Clone)] pub struct SyntaxError<'source>( lalrpop_util::ParseError<Location<'source>, TokenKind<'source>, LexicalError<'source>>, ); fn error_diagnostic_from_location(loc: &Location) -> Diagnostic<usize> { Diagnostic::error() .with_message("syntax error") .with_labels(vec![Label::primary(loc.file_id, loc.span.clone())]) } impl<'source> SyntaxError<'source> { pub fn to_diagnostic(&self) -> Diagnostic<usize> { use lalrpop_util::ParseError::*; match &self.0 { ExtraToken { token: (loc, token, _), } => error_diagnostic_from_location(loc) .with_message(format!("extra token: {:?}", token)), InvalidToken { location } => error_diagnostic_from_location(location) .with_message(format!("invalid token: {:?}", location.text,)), UnrecognizedEOF { location, expected } => error_diagnostic_from_location(location) .with_message(format!( "file ended too early, expected: {:?}", expected.join(",").replace('"', "") )), UnrecognizedToken { token: (loc, _, _), expected, } => error_diagnostic_from_location(loc).with_message(format!( "found token: {:?}, expected: {:?}", loc.text, expected.join(",").replace('"', "") )), User { error } => error.to_diagnostic(), } } } pub fn parse<'a, TokenIter: Iterator<Item = Token<'a>>>( tokens: TokenIter, ) -> Result<Program<'a>, SyntaxError<'a>> { grammar::PROGRAMParser::new() .parse(tokens.map(Token::to_spanned)) .map_err(SyntaxError) } #[cfg(test)] mod tests { use super::*; use crate::ast::{ BinOp::*, Expression::*, LValue::*, Program::*, Statement::*, Type::*, UnaryOp::*, *, }; use crate::lexer::Lexer; fn parse_str(input: &str) -> Program { parse(Lexer::new(input, 1)).expect("parsing failed") } #[test] fn parse_statement() { assert_eq!( parse_str("int a;"), Statement(VariableDeclaration(Int, "a")) ); assert_eq!( parse_str("int a[3][4];"), Statement(VariableDeclaration( Array( Box::new(Array(Box::new(Int), Box::new(IntLiteral(3)))), Box::new(IntLiteral(4)) ), "a" )) ); } #[test] fn parse_funclist() { assert_eq!( parse_str("def foo() { int a; }"), FuncList(vec![FunctionDefinition { name: "foo", parameters: vec![], body: vec![VariableDeclaration(Int, "a")] }]) ); } #[test] fn parse_ifstat() { assert_eq!( parse_str("if (-3 >= 0) { int a; }"), Statement(If { condition: (Binary( Box::new(Unary(Negative, Box::new(IntLiteral(3)))), GreaterThanEqual, Box::new(IntLiteral(0)) )), true_path: Box::new(StatementList(vec![VariableDeclaration(Int, "a")])), false_path: None, }) ); assert_eq!( parse_str("if (1) { a = 1; } else { a = 2; }"), Statement(If { condition: IntLiteral(1), true_path: Box::new(StatementList(vec![Assignment( NameReference("a"), IntLiteral(1) )])), false_path: Some(Box::new(StatementList(vec![Assignment( NameReference("a"), IntLiteral(2) )]))), }) ); } #[test] fn parse_read() { assert_eq!( parse_str("read nome;"), Statement(Read(NameReference("nome"))) ); } #[test] fn parse_return() { assert_eq!(parse_str("return;"), Statement(Return)); } #[test] fn parse_print() { assert_eq!( parse_str("print (3 * 4);"), Statement(Print(Binary( Box::new(IntLiteral(3)), Mul, Box::new(IntLiteral(4)) ))) ); } #[test] fn parse_attrib() { assert_eq!( parse_str("a = 3;"), Statement(Assignment(NameReference("a"), IntLiteral(3))) ); } #[test] fn parse_for() { let program = r" for (i = 0; i < 10; i = i + 1) { int a; a = i * i; }"; assert_eq!( parse_str(program), Statement(For { initial_assignment: Box::new(Assignment(NameReference("i"), IntLiteral(0))), condition: Binary( Box::new(LValue(Box::new(NameReference("i")))), LessThan, Box::new(IntLiteral(10)) ), post_assignment: Box::new(Assignment( NameReference("i"), Binary( Box::new(LValue(Box::new(NameReference("i")))), Add, Box::new(IntLiteral(1)) ) )), body: Box::new(StatementList(vec![ VariableDeclaration(Int, "a"), Assignment( NameReference("a"), Binary( Box::new(LValue(Box::new(NameReference("i")))), Mul, Box::new(LValue(Box::new(NameReference("i")))) ) ) ])) }), ); } #[test] fn parse_funccall() { assert_eq!( parse_str("a = foo(a, b);"), Statement(Assignment( NameReference("a"), FunctionCall("foo", vec!["a", "b"]) )) ); } #[test] fn parse_array_access() { assert_eq!( parse_str("print arr[3][2 * 4];"), Statement(Print(LValue(Box::new(ArrayAccess( Box::new(ArrayAccess( Box::new(NameReference("arr")), Box::new(IntLiteral(3)) )), Box::new(Binary( Box::new(IntLiteral(2)), Mul, Box::new(IntLiteral(4)) )) ))))) ); } #[test] fn parse_array_element_assignment() { assert_eq!( parse_str("arr[3] = foo();"), Statement(Assignment( ArrayAccess(Box::new(NameReference("arr")), Box::new(IntLiteral(3))), FunctionCall("foo", vec![]) )) ); } #[test] fn parse_array_allocation() { assert_eq!( parse_str("arr = new int[10];"), Statement(Assignment( NameReference("arr"), Alloc(Array(Box::new(Int), Box::new(IntLiteral(10)))) )) ); } #[test] fn parse_complex_expression() { assert_eq!( parse_str("print 1 + 2 + 3;"), Statement(Print(Binary( Box::new(Binary( Box::new(IntLiteral(1)), Add, Box::new(IntLiteral(2)) )), Add, Box::new(IntLiteral(3)) ))) ) } }
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use glib::object::IsA; use glib::translate::*; use glib::GString; use libc; use std::fmt; use webkit2_webextension_sys; use DOMElement; use DOMEventTarget; use DOMHTMLElement; use DOMNode; use DOMObject; glib_wrapper! { pub struct DOMHTMLBaseFontElement(Object<webkit2_webextension_sys::WebKitDOMHTMLBaseFontElement, webkit2_webextension_sys::WebKitDOMHTMLBaseFontElementClass, DOMHTMLBaseFontElementClass>) @extends DOMHTMLElement, DOMElement, DOMNode, DOMObject, @implements DOMEventTarget; match fn { get_type => || webkit2_webextension_sys::webkit_dom_html_base_font_element_get_type(), } } pub const NONE_DOMHTML_BASE_FONT_ELEMENT: Option<&DOMHTMLBaseFontElement> = None; pub trait DOMHTMLBaseFontElementExt: 'static { #[cfg_attr(feature = "v2_12", deprecated)] fn get_color(&self) -> Option<GString>; #[cfg_attr(feature = "v2_12", deprecated)] fn get_face(&self) -> Option<GString>; #[cfg_attr(feature = "v2_12", deprecated)] fn get_size(&self) -> libc::c_long; #[cfg_attr(feature = "v2_12", deprecated)] fn set_color(&self, value: &str); #[cfg_attr(feature = "v2_12", deprecated)] fn set_face(&self, value: &str); #[cfg_attr(feature = "v2_12", deprecated)] fn set_size(&self, value: libc::c_long); } impl<O: IsA<DOMHTMLBaseFontElement>> DOMHTMLBaseFontElementExt for O { fn get_color(&self) -> Option<GString> { unsafe { from_glib_full( webkit2_webextension_sys::webkit_dom_html_base_font_element_get_color( self.as_ref().to_glib_none().0, ), ) } } fn get_face(&self) -> Option<GString> { unsafe { from_glib_full( webkit2_webextension_sys::webkit_dom_html_base_font_element_get_face( self.as_ref().to_glib_none().0, ), ) } } fn get_size(&self) -> libc::c_long { unsafe { webkit2_webextension_sys::webkit_dom_html_base_font_element_get_size( self.as_ref().to_glib_none().0, ) } } fn set_color(&self, value: &str) { unsafe { webkit2_webextension_sys::webkit_dom_html_base_font_element_set_color( self.as_ref().to_glib_none().0, value.to_glib_none().0, ); } } fn set_face(&self, value: &str) { unsafe { webkit2_webextension_sys::webkit_dom_html_base_font_element_set_face( self.as_ref().to_glib_none().0, value.to_glib_none().0, ); } } fn set_size(&self, value: libc::c_long) { unsafe { webkit2_webextension_sys::webkit_dom_html_base_font_element_set_size( self.as_ref().to_glib_none().0, value, ); } } } impl fmt::Display for DOMHTMLBaseFontElement { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "DOMHTMLBaseFontElement") } }
use log::debug; use log::error; use log::info; use std::env; use std::fs; use std::io::{stdin, stdout, Result as SimpleResult, Write}; use std::os::unix; use std::path::Path; use std::result::Result; use structopt::StructOpt; use thiserror::Error; use crate::common; #[derive(Debug, PartialEq, StructOpt)] pub struct Args { #[structopt(short, long)] name: String, } #[derive(Error, Debug)] enum ApplyCommandError { #[error("reading .rpilot file failed. Make sure this project is initialised properly.")] NotInitialized, #[error("the specified profile name does not exists for this project. Please make sure that you are passing the correvt name.")] NotExists, #[error("the command was aborted")] Aborted, #[error("Failed at saving the selected profile")] SaveFileError, #[error("Failed at reading the config")] ConfigReadError, #[error("external library failed")] ExternalFail(#[from] std::io::Error), } pub fn execute(args: &Args) { match _execute(args) { Ok(_) => info!("successfully updated the current .env file"), Err(e) => { error!("{}", e); } } } fn _execute(args: &Args) -> Result<(), ApplyCommandError> { let pwd = env::current_dir()?; let project_dir = common::get_data_dir()?; let project_id = common::get_project_id(&pwd); if project_id.is_none() { return Err(ApplyCommandError::NotInitialized); } let project_id = project_id.unwrap(); let (mut config_path, mut project) = common::read_config(&project_dir, &project_id) .map_err(|_| ApplyCommandError::ConfigReadError)?; let profile = common::select_profile(&project, &args.name).map_err(|_| ApplyCommandError::NotExists)?; let (env_path, _) = common::read_env(&project_dir, &project_id, &profile.id); let should_apply = should_apply_env()?; if should_apply { set_symlink(&pwd, &env_path)?; project.current_profile = Box::new(Some(String::from(&args.name))); return common::save_config(&project, &mut config_path) .map_err(|_| ApplyCommandError::SaveFileError); } Err(ApplyCommandError::Aborted) } fn should_apply_env() -> Result<bool, ApplyCommandError> { let mut buffer = String::new(); print!("This will create a symlink to .env file proceed if it is ok: [Y/N]"); stdout().flush()?; let input = match stdin().read_line(&mut buffer) { Ok(_) => Ok(buffer), Err(_) => Err(ApplyCommandError::Aborted), }?; match input.as_str() { "Y\n" | "y\n" => Ok(true), v => { print!("{}", v); Ok(false) } } } fn set_symlink(pwd: &Path, env_path: &Path) -> SimpleResult<()> { let current_env_path = pwd.join(".env"); if fs::remove_file(&current_env_path).is_err() { debug!(".env file does not exist in the current directory") } unix::fs::symlink(env_path, &current_env_path)?; let mut perms = fs::metadata(&current_env_path)?.permissions(); perms.set_readonly(true); fs::set_permissions(&current_env_path, perms)?; Ok(()) }
extern crate quicksilver; use quicksilver::input::Keyboard; use quicksilver::input::Key; use quicksilver::input::ButtonState; const KEY_LIST: &[Key] = &[Key::Key1, Key::Key2, Key::Key3, Key::Key4, Key::Key5, Key::Key6, Key::Key7, Key::Key8, Key::Key9, Key::Key0, Key::A, Key::B, Key::C, Key::D, Key::E, Key::F, Key::G, Key::H, Key::I, Key::J, Key::K, Key::L, Key::M, Key::N, Key::O, Key::P, Key::Q, Key::R, Key::S, Key::T, Key::U, Key::V, Key::W, Key::X, Key::Y, Key::Z, Key::Escape, Key::F1, Key::F2, Key::F3, Key::F4, Key::F5, Key::F6, Key::F7, Key::F8, Key::F9, Key::F10, Key::F11, Key::F12, Key::F13, Key::F14, Key::F15, Key::Snapshot, Key::Scroll, Key::Pause, Key::Insert, Key::Home, Key::Delete, Key::End, Key::PageDown, Key::PageUp, Key::Left, Key::Up, Key::Right, Key::Down, Key::Back, Key::Return, Key::Space, Key::Compose, Key::Caret, Key::Numlock, Key::Numpad0, Key::Numpad1, Key::Numpad2, Key::Numpad3, Key::Numpad4, Key::Numpad5, Key::Numpad6, Key::Numpad7, Key::Numpad8, Key::Numpad9, Key::AbntC1, Key::AbntC2, Key::Add, Key::Apostrophe, Key::Apps, Key::At, Key::Ax, Key::Backslash, Key::Calculator, Key::Capital, Key::Colon, Key::Comma, Key::Convert, Key::Decimal, Key::Divide, Key::Equals, Key::Grave, Key::Kana, Key::Kanji, Key::LAlt, Key::LBracket, Key::LControl, Key::LShift, Key::LWin, Key::Mail, Key::MediaSelect, Key::MediaStop, Key::Minus, Key::Multiply, Key::Mute, Key::MyComputer, Key::NavigateForward, Key::NavigateBackward, Key::NextTrack, Key::NoConvert, Key::NumpadComma, Key::NumpadEnter, Key::NumpadEquals, Key::OEM102, Key::Period, Key::PlayPause, Key::Power, Key::PrevTrack, Key::RAlt, Key::RBracket, Key::RControl, Key::RShift, Key::RWin, Key::Semicolon, Key::Slash, Key::Sleep, Key::Stop, Key::Subtract, Key::Sysrq, Key::Tab, Key::Underline, Key::Unlabeled, Key::VolumeDown, Key::VolumeUp, Key::Wake, Key::WebBack, Key::WebFavorites, Key::WebForward, Key::WebHome, Key::WebRefresh, Key::WebSearch, Key::WebStop, Key::Yen]; pub struct TextInput { capslock: bool, } impl TextInput { pub fn new() -> TextInput { TextInput{ capslock: false, } } pub fn char(&mut self, keyboard: &Keyboard) -> Option<char> { if keyboard[Key::Capital] == ButtonState::Pressed { self.capslock = !self.capslock; } let shift_held = keyboard[Key::LShift].is_down(); for i in (Key::Key1 as u8)..(Key::Z as u8 + 1) { if keyboard[KEY_LIST[i as usize]] == ButtonState::Pressed { return Some( if i >= (Key::A as u8) { let base = if (self.capslock && !shift_held) || (!self.capslock && shift_held) { 'A' as u8 } else { 'a' as u8 }; (base + (i - (Key::A as u8))) as char }else if i == (Key::Key0 as u8) { '0' }else { (('1' as u8) + (i - (Key::Key1 as u8))) as char }); } } None } }
// Copyright 2018 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. // aux-build:nested-item-spans.rs #![feature(use_extern_macros)] extern crate nested_item_spans; use nested_item_spans::foo; #[foo] fn another() { fn bar() { let x: u32 = "x"; //~ ERROR: mismatched types } bar(); } fn main() { #[foo] fn bar() { let x: u32 = "x"; //~ ERROR: mismatched types } bar(); another(); }
use crate::{Cons, Nil}; pub trait Extend<T> { type Output; fn extend(self, val: T) -> Self::Output; } impl<A, H, T> Extend<T> for Cons<A, H> where H: Extend<T>, { type Output = Cons<A, H::Output>; fn extend(self, val: T) -> Self::Output { Cons(self.0, self.1.extend(val)) } } impl<T> Extend<T> for Nil { type Output = T; fn extend(self, val: T) -> Self::Output { val } }
use crate::bot::components::create_launch_components; use crate::bot::embeds::{create_apod_embed, create_basic_embed, create_launch_embed}; use crate::models::apod::Apod; use crate::models::launch::Launch; use serenity::Result; use serenity::{ async_trait, builder::CreateEmbed, client, model::prelude::{Channel, Message}, }; #[async_trait] pub trait ChannelExt { async fn send_embed<F>(&self, ctx: &client::Context, build: F) -> Result<Message> where F: FnOnce(&mut CreateEmbed) + Send + Sync; async fn send_launch(&self, ctx: &client::Context, n: &Launch, r: &String) -> Result<Message>; async fn send_apod(&self, ctx: &client::Context, n: &Apod) -> Result<Message>; } #[async_trait] impl ChannelExt for Channel { async fn send_embed<F>(&self, ctx: &client::Context, build: F) -> Result<Message> where F: FnOnce(&mut CreateEmbed) + Send + Sync, { let mut e = create_basic_embed(); build(&mut e); self.id() .send_message(ctx, move |m| { m.allowed_mentions(|f| f.replied_user(false)); m.set_embed(e) }) .await } async fn send_launch(&self, ctx: &client::Context, n: &Launch, r: &String) -> Result<Message> { let e = create_launch_embed(n, r); let c = create_launch_components(&n.id); self.id() .send_message(ctx, move |m| { m.set_embed(e); m.set_components(c); m }) .await } async fn send_apod(&self, ctx: &client::Context, n: &Apod) -> Result<Message> { let e = create_apod_embed(n); self.id().send_message(ctx, move |m| m.set_embed(e)).await } }
use std::io::{stdin, BufRead}; fn main() { let stdin = stdin(); let mut iterator = stdin.lock().lines(); let str = iterator .next() .unwrap() .unwrap(); println!("{}", str.chars().count()); }
//! Colors used for drawing to a Cairo buffer use std::convert::From; /// Color to draw to the screen, including the alpha channel. /// NOTE: At this point, the parsed colors return the colors red and blue switched. /// This is due to a bug in WLC, causing the colors to be switched when drawing. /// Example: "00FF0000" will draw as red (correct), but the Color structure will contain 0 for `red` and 255 for `blue`. #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] pub struct Color { red: u8, green: u8, blue: u8, alpha: u8 } impl Color { /// Creates a new color with an alphachannel pub fn rgba(r: u8, g: u8, b: u8, a: u8) -> Color { // There is a bug in wlc, causing red and blue to be inverted: // https://github.com/Cloudef/wlc/issues/142 // We can work around it, by just switching red with blue, until the issue is resolved. // When the bug is fixed, this code path can be deleted and the tests must be adjusted. Color { red: b, green: g, blue: r, alpha: a } } /// Gets the values of the colors, in this order: /// (Red, Green, Blue, Alpha) pub fn values(&self) -> (u8, u8, u8, u8) { (self.red, self.green, self.blue, self.alpha) } /// Parses a String into a Color /// The following formats are supported: /// - "RRGGBB" /// - "AARRGGBB" /// - "#RRGGBB" /// - "#AARRGGBB" /// - "0xRRGGBB" /// - "0xAARRGGBB" pub fn parse(s: &str) -> Option<Color> { if s.starts_with("#") { let (_, sub) = s.split_at(1); Color::parse(sub) } else if s.starts_with("0x") { let (_, sub) = s.split_at(2); Color::parse(sub) } else if s.len() == 8 { Color::parse_argb(s) } else if s.len() == 6 { Color::parse_rgb(s) } else { None } } /// Parses an ARGB String into a Color fn parse_argb(s: &str) -> Option<Color> { if s.len() == 8 { let (str_a, str_rgb) = s.split_at(2); // Due to the bug, the colors are already inverted, so in the returned color // red is blue and blue is red. let alpha = Color::parse_color(str_a)?; let colors = Color::parse_rgb(str_rgb); colors.map(|rgb| Color::rgba(rgb.blue, rgb.green, rgb.red, alpha)) } else { None } } /// Parses a RGB String into a Color fn parse_rgb(s: &str) -> Option<Color> { if s.len() == 6 { let (s_red, s_rest) = s.split_at(2); let (s_green, s_blue) = s_rest.split_at(2); let red = Color::parse_color(s_red)?; let green = Color::parse_color(s_green)?; let blue = Color::parse_color(s_blue); blue.map(|b| Color::rgba(red, green, b, 255)) } else { None } } /// Parses exactly one single color value from a String (eg "AA", "RR", "GG" or "BB") fn parse_color(s: &str) -> Option<u8> { let mut chars = s.chars().take(2); let digit1 = chars.next().and_then(Color::hex_to_u8)?; let digit2 = chars.next().and_then(Color::hex_to_u8); digit2.map(|i2| (digit1 << 4) | i2) } /// Converts a hex char into a u8 fn hex_to_u8(c: char) -> Option<u8> { c.to_digit(16).map(|x| (x as u8)) } } impl From<u32> for Color { fn from(val: u32) -> Self { let red = ((val & 0xff0000) >> 16) as u8; let green = ((val & 0x00ff00) >> 8) as u8; let blue = (val & 0x0000ff) as u8; Color::rgba(red, green, blue, 255) } } #[cfg(test)] mod test { use ::render::Color; #[test] fn test_from_u32() { let hex_red = 0xFF0000; let hex_green = 0x00FF00; let hex_blue = 0x0000FF; let r: Color = hex_red.into(); let g: Color = hex_green.into(); let b: Color = hex_blue.into(); // test red values assert_eq!(0x00, r.red); assert_eq!(0x00, r.green); assert_eq!(0xFF, r.blue); // test green values assert_eq!(0x00, g.red); assert_eq!(0xFF, g.green); assert_eq!(0x00, g.blue); // test blue values assert_eq!(0xFF, b.red); assert_eq!(0x00, b.green); assert_eq!(0x00, b.blue); } #[test] fn parse_color() { // test all numbers, uppercase and lowercase letters assert_eq!(17 * 0, Color::parse_color("00").unwrap()); assert_eq!(17 * 1, Color::parse_color("11").unwrap()); assert_eq!(17 * 2, Color::parse_color("22").unwrap()); assert_eq!(17 * 3, Color::parse_color("33").unwrap()); assert_eq!(17 * 4, Color::parse_color("44").unwrap()); assert_eq!(17 * 5, Color::parse_color("55").unwrap()); assert_eq!(17 * 6, Color::parse_color("66").unwrap()); assert_eq!(17 * 7, Color::parse_color("77").unwrap()); assert_eq!(17 * 8, Color::parse_color("88").unwrap()); assert_eq!(17 * 9, Color::parse_color("99").unwrap()); assert_eq!(17 * 10, Color::parse_color("aa").unwrap()); assert_eq!(17 * 10, Color::parse_color("AA").unwrap()); assert_eq!(17 * 11, Color::parse_color("bb").unwrap()); assert_eq!(17 * 11, Color::parse_color("BB").unwrap()); assert_eq!(17 * 12, Color::parse_color("cc").unwrap()); assert_eq!(17 * 12, Color::parse_color("CC").unwrap()); assert_eq!(17 * 13, Color::parse_color("dd").unwrap()); assert_eq!(17 * 13, Color::parse_color("DD").unwrap()); assert_eq!(17 * 14, Color::parse_color("ee").unwrap()); assert_eq!(17 * 14, Color::parse_color("EE").unwrap()); assert_eq!(17 * 15, Color::parse_color("ff").unwrap()); assert_eq!(17 * 15, Color::parse_color("FF").unwrap()); // test a few mixed values assert_eq!(00, Color::parse_color("00").unwrap()); assert_eq!(50, Color::parse_color("32").unwrap()); assert_eq!(100, Color::parse_color("64").unwrap()); assert_eq!(150, Color::parse_color("96").unwrap()); assert_eq!(200, Color::parse_color("c8").unwrap()); assert_eq!(250, Color::parse_color("fa").unwrap()); assert_eq!(255, Color::parse_color("ff").unwrap()); // test invalid values assert_eq!(false, Color::parse_color("").is_some()); assert_eq!(false, Color::parse_color("h").is_some()); assert_eq!(false, Color::parse_color("h2").is_some()); assert_eq!(false, Color::parse_color("yz").is_some()); assert_eq!(false, Color::parse_color("3x").is_some()); } #[test] fn parse_rgb() { // test some valid color values let rgb_black = Color::parse_rgb("000000").unwrap(); assert_eq!(0, rgb_black.red); assert_eq!(0, rgb_black.green); assert_eq!(0, rgb_black.blue); assert_eq!(255, rgb_black.alpha); let rgb_red = Color::parse_rgb("ff0000").unwrap(); assert_eq!(0, rgb_red.red); assert_eq!(0, rgb_red.green); assert_eq!(255, rgb_red.blue); assert_eq!(255, rgb_red.alpha); let rgb_green = Color::parse_rgb("00ff00").unwrap(); assert_eq!(0, rgb_green.red); assert_eq!(255, rgb_green.green); assert_eq!(0, rgb_green.blue); assert_eq!(255, rgb_green.alpha); let rgb_blue = Color::parse_rgb("0000ff").unwrap(); assert_eq!(255, rgb_blue.red); assert_eq!(0, rgb_blue.green); assert_eq!(0, rgb_blue.blue); assert_eq!(255, rgb_blue.alpha); let rgb_white = Color::parse_rgb("ffffff").unwrap(); assert_eq!(255, rgb_white.red); assert_eq!(255, rgb_white.green); assert_eq!(255, rgb_white.blue); assert_eq!(255, rgb_white.alpha); // test invalid formats assert_eq!(false, Color::parse_rgb("").is_some()); assert_eq!(false, Color::parse_rgb("0").is_some()); assert_eq!(false, Color::parse_rgb("00").is_some()); assert_eq!(false, Color::parse_rgb("000").is_some()); assert_eq!(false, Color::parse_rgb("0000").is_some()); assert_eq!(false, Color::parse_rgb("00000").is_some()); assert_eq!(false, Color::parse_rgb("xxxxxx").is_some()); assert_eq!(false, Color::parse_rgb("0000000").is_some()); assert_eq!(false, Color::parse_rgb("00000000").is_some()); } #[test] fn parse_argb() { // test some valid color values let rgb_transparent = Color::parse_argb("00000000").unwrap(); assert_eq!(0, rgb_transparent.red); assert_eq!(0, rgb_transparent.green); assert_eq!(0, rgb_transparent.blue); assert_eq!(0, rgb_transparent.alpha); let rgb_red = Color::parse_argb("40ff0000").unwrap(); assert_eq!(0, rgb_red.red); assert_eq!(0, rgb_red.green); assert_eq!(255, rgb_red.blue); assert_eq!(64, rgb_red.alpha); let rgb_green = Color::parse_argb("8000ff00").unwrap(); assert_eq!(0, rgb_green.red); assert_eq!(255, rgb_green.green); assert_eq!(0, rgb_green.blue); assert_eq!(128, rgb_green.alpha); let rgb_blue = Color::parse_argb("c00000ff").unwrap(); assert_eq!(255, rgb_blue.red); assert_eq!(0, rgb_blue.green); assert_eq!(0, rgb_blue.blue); assert_eq!(192, rgb_blue.alpha); let rgb_white = Color::parse_argb("ffffffff").unwrap(); assert_eq!(255, rgb_white.red); assert_eq!(255, rgb_white.green); assert_eq!(255, rgb_white.blue); assert_eq!(255, rgb_white.alpha); // test some invalid formats assert_eq!(false, Color::parse_argb("").is_some()); assert_eq!(false, Color::parse_argb("0").is_some()); assert_eq!(false, Color::parse_argb("00").is_some()); assert_eq!(false, Color::parse_argb("000").is_some()); assert_eq!(false, Color::parse_argb("0000").is_some()); assert_eq!(false, Color::parse_argb("00000").is_some()); assert_eq!(false, Color::parse_argb("000000").is_some()); assert_eq!(false, Color::parse_argb("0000000").is_some()); assert_eq!(false, Color::parse_argb("xxxxxxxx").is_some()); assert_eq!(false, Color::parse_argb("000000000").is_some()); assert_eq!(false, Color::parse_argb("0000000000").is_some()); } #[test] fn parse() { // #-prefixed (HTML-style) assert_eq!(true, Color::parse("#000000").is_some()); assert_eq!(true, Color::parse("#00000000").is_some()); // 0x-prefixed (Hex-style) assert_eq!(true, Color::parse("0x000000").is_some()); assert_eq!(true, Color::parse("0x00000000").is_some()); // No prefix assert_eq!(true, Color::parse("000000").is_some()); assert_eq!(true, Color::parse("00000000").is_some()); // Actual colors let red = Color::parse("0xFFFF0000").unwrap(); assert_eq!(0, red.red); assert_eq!(0, red.green); assert_eq!(255, red.blue); assert_eq!(255, red.alpha); let green = Color::parse("0xFF00FF00").unwrap(); assert_eq!(0, green.red); assert_eq!(255, green.green); assert_eq!(0, green.blue); assert_eq!(255, green.alpha); let blue = Color::parse("0xFF0000FF").unwrap(); assert_eq!(255, blue.red); assert_eq!(0, blue.green); assert_eq!(0, blue.blue); assert_eq!(255, blue.alpha); // wrong formats assert_eq!(false, Color::parse("").is_some()); assert_eq!(false, Color::parse("0").is_some()); assert_eq!(false, Color::parse("00").is_some()); assert_eq!(false, Color::parse("000").is_some()); assert_eq!(false, Color::parse("0000").is_some()); assert_eq!(false, Color::parse("00000").is_some()); assert_eq!(false, Color::parse("0000000").is_some()); } }
use vec3::*; #[derive(Debug)] pub struct Onb { axis: [Vec3<f64>; 3] } impl Onb { pub fn new() -> Onb { Onb { axis: [Vec3::zero(), Vec3::zero(), Vec3::zero()] } } pub fn new_from_w(n: &Vec3<f64>) -> Onb { let w = n.unit_vector(); let a; if w.x.abs() > 0.9 { a = Vec3::new(0., 1., 0.); } else { a = Vec3::new(1., 0., 0.); } let v = cross(&w, &a).unit_vector(); let u = cross(&w, &v); return Onb {axis: [u, v, w]}; } pub fn u(&self) -> Vec3<f64> { self.axis[0] } pub fn v(&self) -> Vec3<f64> { self.axis[1] } pub fn w(&self) -> Vec3<f64> { self.axis[2] } pub fn local_scalar(&self, a: f64, b: f64, c: f64) -> Vec3<f64> { a*self.u() + b*self.v() + c*self.w() } pub fn local_vec(&self, a: &Vec3<f64>) -> Vec3<f64> { a.x*self.u() + a.y*self.v() + a.z*self.w() } }
extern crate bytes; extern crate byteorder; extern crate futures; extern crate tokio_core; extern crate tokio_io; extern crate tokio_proto; extern crate tokio_service; use std::str; use std::io::{self, Error, Write, Read}; use std::net::TcpStream; use std::thread; use std::time::Duration; use bytes::{BigEndian, Buf, ByteOrder, BytesMut, IntoBuf}; use byteorder::{WriteBytesExt}; use futures::{future, Future, BoxFuture}; use tokio_io::codec::{Decoder, Encoder, Framed}; use tokio_io::{AsyncRead, AsyncWrite}; use tokio_proto::TcpServer; use tokio_proto::pipeline::ServerProto; use tokio_service::Service; // First, we implement a *codec*, which provides a way of encoding and // decoding messages for the protocol. See the documentation for `Framed`, // `Decoder`, and `Encoder in `tokio-io` for more details on how that works. #[derive(Default)] pub struct IntCodec; impl Decoder for IntCodec { type Item = u64; type Error = Error; // Attempts to decode a message from the given buffer if a complete // message is available; returns `Ok(None)` if the buffer does not // yet hold a complete message. fn decode(&mut self, src: &mut BytesMut) -> Result<Option<u64>, Error> { if src.len() < 8 { return Ok(None); } let eight_bytes = src.split_to(8); let num = eight_bytes.into_buf().get_u64::<BigEndian>(); Ok(Some(num)) } } impl Encoder for IntCodec { type Item = u64; type Error = Error; // Write the u64 into the destination buffer fn encode(&mut self, item: u64, dst: &mut BytesMut) -> Result<(), Error> { let mut u64v: Vec<u8> = Vec::with_capacity(8); (&mut u64v as &mut Write).write_u64::<byteorder::BigEndian>(item).expect("8/8"); Ok(dst.extend(u64v)) } } // Next, we implement the server protocol, which just hooks up the codec above. pub struct IntProto; impl<T: AsyncRead + AsyncWrite + 'static> ServerProto<T> for IntProto { type Request = u64; type Response = u64; type Transport = Framed<T, IntCodec>; type BindTransport = Result<Self::Transport, io::Error>; fn bind_transport(&self, io: T) -> Self::BindTransport { Ok(io.framed(IntCodec)) } } // Now we implement a service we'd like to run on top of this protocol pub struct Doubler; impl Service for Doubler { type Request = u64; type Response = u64; type Error = io::Error; type Future = BoxFuture<u64, io::Error>; fn call(&self, req: u64) -> Self::Future { // Just return the request, doubled future::finished(req * 2).boxed() } } // Finally, we can actually host this service locally! fn main() { let addr = "127.0.0.1:12345".parse().unwrap(); thread::spawn(move || { TcpServer::new(IntProto, addr).serve(|| Ok(Doubler)); }); thread::sleep(Duration::new(1, 0)); let mut stream = TcpStream::connect(addr).expect("Could not connect to addr"); let mut buff = [0; 8]; for i in 0..100000 { BigEndian::write_u64(&mut buff, i); let _ = stream .write(&buff) .expect(&format!("Failed to write {}", i)); let read_in = stream .read(&mut buff) .expect(&format!("Failed to read {}", i)); if read_in != 8 { println!("Only read {} bytes", read_in); continue; } let result = BigEndian::read_u64(&buff); assert_eq!(i * 2, result) } println!("Ran successfully!"); }
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::batch::WriteBatch; use crate::storage::{ColumnFamilyName, InnerStore, WriteOp}; use crate::VEC_PREFIX_NAME; use anyhow::{bail, format_err, Error, Result}; use logger::prelude::*; use rocksdb::{ CFHandle, ColumnFamilyOptions, DBOptions, Writable, WriteBatch as DBWriteBatch, WriteOptions, DB, }; use std::collections::HashMap; use std::path::Path; pub const DEFAULT_CF_NAME: ColumnFamilyName = "default"; /// Type alias to improve readability. pub type ColumnFamilyOptionsMap = HashMap<ColumnFamilyName, ColumnFamilyOptions>; pub struct DBStorage { db: DB, } impl DBStorage { pub fn new<P: AsRef<Path> + Clone>(db_root_path: P) -> Self { Self::open(db_root_path, false, None).expect("Unable to open StarcoinDB") } pub fn open<P: AsRef<Path> + Clone>( db_root_path: P, readonly: bool, log_dir: Option<P>, ) -> Result<Self> { let mut cf_opts_map = ColumnFamilyOptionsMap::new(); for prefix_name in &VEC_PREFIX_NAME.to_vec() { cf_opts_map.insert(prefix_name, ColumnFamilyOptions::default()); } cf_opts_map.insert(DEFAULT_CF_NAME, ColumnFamilyOptions::default()); let path = db_root_path.as_ref().join("starcoindb"); let db = if readonly { let db_log_dir = log_dir .ok_or_else(|| format_err!("Must provide log_dir if opening in readonly mode."))?; if !db_log_dir.as_ref().is_dir() { bail!("Invalid log directory: {:?}", db_log_dir.as_ref()); } info!("log stored at {:?}", db_log_dir.as_ref()); Self::open_readonly(path.clone(), cf_opts_map, db_log_dir.as_ref().to_path_buf())? } else { Self::open_inner(path.clone(), cf_opts_map)? }; info!("Opened StarcoinDB at {:?}", path); Ok(DBStorage { db }) } fn open_inner<P: AsRef<Path>>(path: P, mut cf_opts_map: ColumnFamilyOptionsMap) -> Result<DB> { let mut db_opts = DBOptions::new(); // For now we set the max total WAL size to be 1G. This config can be useful when column // families are updated at non-uniform frequencies. db_opts.set_max_total_wal_size(1 << 30); // If db exists, just open it with all cfs. if Self::db_exists(path.as_ref()) { match DB::open_cf( db_opts, path.as_ref().to_str().ok_or_else(|| { format_err!("Path {:?} can not be converted to string.", path.as_ref()) })?, cf_opts_map.into_iter().collect(), ) { Ok(db) => return Ok(db), Err(e) => bail!("open cf err: {:?}", e), } } // If db doesn't exist, create a db first with all column families. db_opts.create_if_missing(true); let mut db = match DB::open_cf( db_opts.clone(), path.as_ref().to_str().ok_or_else(|| { format_err!("Path {:?} can not be converted to string.", path.as_ref()) })?, vec![cf_opts_map .remove_entry(&DEFAULT_CF_NAME) .ok_or_else(|| format_err!("No \"default\" column family name found"))?], ) { Ok(db) => db, Err(e) => bail!("open cf err: {:?}", e), }; cf_opts_map .into_iter() .map(|(cf_name, cf_opts)| { let _cf_handle = db .create_cf((cf_name, cf_opts)) .map_err(Self::convert_rocksdb_err)?; Ok(()) }) .collect::<Result<Vec<_>>>()?; Ok(db) } fn open_readonly<P: AsRef<Path>>( path: P, cf_opts_map: ColumnFamilyOptionsMap, db_log_dir: P, ) -> Result<DB> { if !Self::db_exists(path.as_ref()) { bail!("DB doesn't exists."); } let mut db_opts = DBOptions::new(); db_opts.create_if_missing(false); db_opts.set_db_log_dir(db_log_dir.as_ref().to_str().ok_or_else(|| { format_err!( "db_log_dir {:?} can not be converted to string.", db_log_dir.as_ref() ) })?); Ok( match DB::open_cf_for_read_only( db_opts, path.as_ref().to_str().ok_or_else(|| { format_err!("Path {:?} can not be converted to string.", path.as_ref()) })?, cf_opts_map.into_iter().collect(), true, ) { Ok(db) => db, Err(e) => bail!("open cf err: {:?}", e), }, ) } pub fn drop_cf(&mut self) -> Result<(), Error> { for cf in &VEC_PREFIX_NAME.to_vec() { self.db .drop_cf(cf) .map_err(Self::convert_rocksdb_err) .unwrap(); } Ok(()) } fn db_exists(path: &Path) -> bool { let rocksdb_current_file = path.join("CURRENT"); rocksdb_current_file.is_file() } pub fn convert_rocksdb_err(msg: String) -> anyhow::Error { format_err!("RocksDB internal error: {}.", msg) } fn get_cf_handle(&self, cf_name: &str) -> Result<&CFHandle> { self.db.cf_handle(cf_name).ok_or_else(|| { format_err!( "DB::cf_handle not found for column family name: {}", cf_name ) }) } fn default_write_options() -> WriteOptions { let mut opts = WriteOptions::new(); opts.set_sync(true); opts } } impl InnerStore for DBStorage { fn get(&self, prefix_name: &str, key: Vec<u8>) -> Result<Option<Vec<u8>>> { let cf_handle = self.get_cf_handle(prefix_name)?; match self .db .get_cf(cf_handle, key.as_slice()) .map_err(Self::convert_rocksdb_err) { Ok(Some(value)) => Ok(Some(value.to_vec())), _ => Ok(None), } } fn put(&self, prefix_name: &str, key: Vec<u8>, value: Vec<u8>) -> Result<()> { let cf_handle = self.get_cf_handle(prefix_name)?; self.db .put_cf_opt(cf_handle, &key, &value, &Self::default_write_options()) .map_err(Self::convert_rocksdb_err) } fn contains_key(&self, prefix_name: &str, key: Vec<u8>) -> Result<bool> { match self.get(prefix_name, key) { Ok(Some(_)) => Ok(true), _ => Ok(false), } } fn remove(&self, prefix_name: &str, key: Vec<u8>) -> Result<()> { let cf_handle = self.get_cf_handle(prefix_name)?; self.db .delete_cf(cf_handle, &key) .map_err(Self::convert_rocksdb_err) } /// Writes a group of records wrapped in a WriteBatch. fn write_batch(&self, batch: WriteBatch) -> Result<()> { let db_batch = DBWriteBatch::new(); for (cf_name, rows) in &batch.rows { let cf_handle = self.get_cf_handle(cf_name)?; for (key, write_op) in rows { match write_op { WriteOp::Value(value) => db_batch.put_cf(cf_handle, key, value), WriteOp::Deletion => db_batch.delete_cf(cf_handle, key), } .map_err(Self::convert_rocksdb_err)?; } } self.db .write_opt(&db_batch, &Self::default_write_options()) .map_err(Self::convert_rocksdb_err)?; Ok(()) } fn get_len(&self) -> Result<u64, Error> { unimplemented!() } fn keys(&self) -> Result<Vec<Vec<u8>>, Error> { unimplemented!() } }
#[doc = "Reader of register MACQTxFCR"] pub type R = crate::R<u32, super::MACQTXFCR>; #[doc = "Writer for register MACQTxFCR"] pub type W = crate::W<u32, super::MACQTXFCR>; #[doc = "Register MACQTxFCR `reset()`'s with value 0"] impl crate::ResetValue for super::MACQTXFCR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `FCB_BPA`"] pub type FCB_BPA_R = crate::R<bool, bool>; #[doc = "Write proxy for field `FCB_BPA`"] pub struct FCB_BPA_W<'a> { w: &'a mut W, } impl<'a> FCB_BPA_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 `TFE`"] pub type TFE_R = crate::R<bool, bool>; #[doc = "Write proxy for field `TFE`"] pub struct TFE_W<'a> { w: &'a mut W, } impl<'a> TFE_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 `PLT`"] pub type PLT_R = crate::R<u8, u8>; #[doc = "Write proxy for field `PLT`"] pub struct PLT_W<'a> { w: &'a mut W, } impl<'a> PLT_W<'a> { #[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 `DZPQ`"] pub type DZPQ_R = crate::R<bool, bool>; #[doc = "Write proxy for field `DZPQ`"] pub struct DZPQ_W<'a> { w: &'a mut W, } impl<'a> DZPQ_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7); self.w } } #[doc = "Reader of field `PT`"] pub type PT_R = crate::R<u16, u16>; #[doc = "Write proxy for field `PT`"] pub struct PT_W<'a> { w: &'a mut W, } impl<'a> PT_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u16) -> &'a mut W { self.w.bits = (self.w.bits & !(0xffff << 16)) | (((value as u32) & 0xffff) << 16); self.w } } impl R { #[doc = "Bit 0 - FCB_BPA"] #[inline(always)] pub fn fcb_bpa(&self) -> FCB_BPA_R { FCB_BPA_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - TFE"] #[inline(always)] pub fn tfe(&self) -> TFE_R { TFE_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bits 4:6 - PLT"] #[inline(always)] pub fn plt(&self) -> PLT_R { PLT_R::new(((self.bits >> 4) & 0x07) as u8) } #[doc = "Bit 7 - DZPQ"] #[inline(always)] pub fn dzpq(&self) -> DZPQ_R { DZPQ_R::new(((self.bits >> 7) & 0x01) != 0) } #[doc = "Bits 16:31 - PT"] #[inline(always)] pub fn pt(&self) -> PT_R { PT_R::new(((self.bits >> 16) & 0xffff) as u16) } } impl W { #[doc = "Bit 0 - FCB_BPA"] #[inline(always)] pub fn fcb_bpa(&mut self) -> FCB_BPA_W { FCB_BPA_W { w: self } } #[doc = "Bit 1 - TFE"] #[inline(always)] pub fn tfe(&mut self) -> TFE_W { TFE_W { w: self } } #[doc = "Bits 4:6 - PLT"] #[inline(always)] pub fn plt(&mut self) -> PLT_W { PLT_W { w: self } } #[doc = "Bit 7 - DZPQ"] #[inline(always)] pub fn dzpq(&mut self) -> DZPQ_W { DZPQ_W { w: self } } #[doc = "Bits 16:31 - PT"] #[inline(always)] pub fn pt(&mut self) -> PT_W { PT_W { w: self } } }
// Copyright (C) 2020, Cloudflare, Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //! Module-defined Event and functions to work with qlog data structures. //! //! The Qlog data structures are very flexible, which makes working with them //! liable to simple semantic errors. This module provides some helper functions //! that focus on creating valid types, while also reducing some of the //! verbosity of using the raw data structures. use super::*; /// A representation of qlog events that couple EventCategory, EventType and /// EventData. /// /// Functions are provided to help construct valid events. Most events consist /// of several optional fields, so minimal versions of these functions are /// provided, which accept only mandatory qlog parameters. Minimal functions are /// identified by a `_min` suffix. #[derive(Clone)] pub struct Event { pub category: EventCategory, pub ty: EventType, pub data: EventData, } #[allow(clippy::too_many_arguments)] impl Event { // Connectivity events. /// Returns: /// * `EventCategory`=`Connectivity` /// * `EventType`=`ConnectivityEventType::ServerListening` /// * `EventData`=`ServerListening`. pub fn server_listening( ip_v4: Option<String>, ip_v6: Option<String>, port_v4: u32, port_v6: u32, quic_versions: Option<Vec<String>>, alpn_values: Option<Vec<String>>, stateless_reset_required: Option<bool>, ) -> Self { Event { category: EventCategory::Connectivity, ty: EventType::ConnectivityEventType( ConnectivityEventType::ServerListening, ), data: EventData::ServerListening { ip_v4, ip_v6, port_v4, port_v6, quic_versions, alpn_values, stateless_reset_required, }, } } pub fn server_listening_min(port_v4: u32, port_v6: u32) -> Self { Event::server_listening(None, None, port_v4, port_v6, None, None, None) } /// Returns: /// * `EventCategory`=`Connectivity` /// * `EventType`=`ConnectivityEventType::ConnectionStarted` /// * `EventData`=`ConnectionStarted`. pub fn connection_started( ip_version: String, src_ip: String, dst_ip: String, protocol: Option<String>, src_port: u32, dst_port: u32, quic_version: Option<String>, src_cid: Option<String>, dst_cid: Option<String>, ) -> Self { Event { category: EventCategory::Connectivity, ty: EventType::ConnectivityEventType( ConnectivityEventType::ConnectionStarted, ), data: EventData::ConnectionStarted { ip_version, src_ip, dst_ip, protocol, src_port, dst_port, quic_version, src_cid, dst_cid, }, } } pub fn connection_started_min( ip_version: String, src_ip: String, dst_ip: String, src_port: u32, dst_port: u32, ) -> Self { Event::connection_started( ip_version, src_ip, dst_ip, None, src_port, dst_port, None, None, None, ) } /// Returns: /// * `EventCategory`=`Connectivity` /// * `EventType`=`ConnectivityEventType::ConnectionIdUpdated` /// * `EventData`=`ConnectionIdUpdated`. pub fn connection_id_updated( src_old: Option<String>, src_new: Option<String>, dst_old: Option<String>, dst_new: Option<String>, ) -> Self { Event { category: EventCategory::Connectivity, ty: EventType::ConnectivityEventType( ConnectivityEventType::ConnectionIdUpdated, ), data: EventData::ConnectionIdUpdated { src_old, src_new, dst_old, dst_new, }, } } pub fn connection_id_updated_min() -> Self { Event::connection_id_updated(None, None, None, None) } /// Returns: /// * `EventCategory`=`Connectivity` /// * `EventType`=`ConnectivityEventType::SpinBitUpdated` /// * `EventData`=`SpinBitUpdated`. pub fn spinbit_updated(state: bool) -> Self { Event { category: EventCategory::Connectivity, ty: EventType::ConnectivityEventType( ConnectivityEventType::SpinBitUpdated, ), data: EventData::SpinBitUpdated { state }, } } /// Returns: /// * `EventCategory`=`Connectivity` /// * `EventType`=`ConnectivityEventType::ConnectionState` /// * `EventData`=`ConnectionState`. pub fn connection_state_updated( old: Option<ConnectionState>, new: ConnectionState, ) -> Self { Event { category: EventCategory::Connectivity, ty: EventType::ConnectivityEventType( ConnectivityEventType::ConnectionStateUpdated, ), data: EventData::ConnectionStateUpdated { old, new }, } } pub fn connection_state_updated_min(new: ConnectionState) -> Self { Event::connection_state_updated(None, new) } // Transport events. /// Returns: /// * `EventCategory`=`Transport` /// * `EventType`=`TransportEventType::ParametersSet` /// * `EventData`=`ParametersSet`. pub fn transport_parameters_set( owner: Option<TransportOwner>, resumption_allowed: Option<bool>, early_data_enabled: Option<bool>, alpn: Option<String>, version: Option<String>, tls_cipher: Option<String>, original_connection_id: Option<String>, stateless_reset_token: Option<String>, disable_active_migration: Option<bool>, idle_timeout: Option<u64>, max_udp_payload_size: Option<u32>, ack_delay_exponent: Option<u16>, max_ack_delay: Option<u16>, active_connection_id_limit: Option<u64>, initial_max_data: Option<u64>, initial_max_stream_data_bidi_local: Option<u64>, initial_max_stream_data_bidi_remote: Option<u64>, initial_max_stream_data_uni: Option<u64>, initial_max_streams_bidi: Option<u64>, initial_max_streams_uni: Option<u64>, preferred_address: Option<PreferredAddress>, ) -> Self { Event { category: EventCategory::Transport, ty: EventType::TransportEventType(TransportEventType::ParametersSet), data: EventData::TransportParametersSet { owner, resumption_allowed, early_data_enabled, alpn, version, tls_cipher, original_connection_id, stateless_reset_token, disable_active_migration, idle_timeout, max_udp_payload_size, ack_delay_exponent, max_ack_delay, active_connection_id_limit, initial_max_data, initial_max_stream_data_bidi_local, initial_max_stream_data_bidi_remote, initial_max_stream_data_uni, initial_max_streams_bidi, initial_max_streams_uni, preferred_address, }, } } pub fn transport_parameters_set_min() -> Self { Event::transport_parameters_set( None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ) } /// Returns: /// * `EventCategory`=`Transport` /// * `EventType`=`TransportEventType::DatagramsReceived` /// * `EventData`=`DatagramsReceived`. pub fn datagrams_received( count: Option<u16>, byte_length: Option<u64>, ) -> Self { Event { category: EventCategory::Transport, ty: EventType::TransportEventType( TransportEventType::DatagramsReceived, ), data: EventData::DatagramsReceived { count, byte_length }, } } pub fn datagrams_received_min() -> Self { Event::datagrams_received(None, None) } /// Returns: /// * `EventCategory`=`Transport` /// * `EventType`=`TransportEventType::DatagramsSent` /// * `EventData`=`DatagramsSent`. pub fn datagrams_sent(count: Option<u16>, byte_length: Option<u64>) -> Self { Event { category: EventCategory::Transport, ty: EventType::TransportEventType(TransportEventType::DatagramsSent), data: EventData::DatagramsSent { count, byte_length }, } } pub fn datagrams_sent_min() -> Self { Event::datagrams_sent(None, None) } /// Returns: /// * `EventCategory`=`Transport` /// * `EventType`=`TransportEventType::DatagramDropped` /// * `EventData`=`DatagramDropped`. pub fn datagram_dropped(byte_length: Option<u64>) -> Self { Event { category: EventCategory::Transport, ty: EventType::TransportEventType( TransportEventType::DatagramDropped, ), data: EventData::DatagramDropped { byte_length }, } } pub fn datagram_dropped_min() -> Self { Event::datagram_dropped(None) } /// Returns: /// * `EventCategory`=`Transport` /// * `EventType`=`TransportEventType::PacketReceived` /// * `EventData`=`PacketReceived`. pub fn packet_received( packet_type: PacketType, header: PacketHeader, frames: Option<Vec<QuicFrame>>, is_coalesced: Option<bool>, raw_encrypted: Option<String>, raw_decrypted: Option<String>, ) -> Self { Event { category: EventCategory::Transport, ty: EventType::TransportEventType(TransportEventType::PacketReceived), data: EventData::PacketReceived { packet_type, header, frames, is_coalesced, raw_encrypted, raw_decrypted, }, } } pub fn packet_received_min( packet_type: PacketType, header: PacketHeader, ) -> Self { Event::packet_received(packet_type, header, None, None, None, None) } /// Returns: /// * `EventCategory`=`Transport` /// * `EventType`=`TransportEventType::PacketSent` /// * `EventData`=`PacketSent`. pub fn packet_sent( packet_type: PacketType, header: PacketHeader, frames: Option<Vec<QuicFrame>>, is_coalesced: Option<bool>, raw_encrypted: Option<String>, raw_decrypted: Option<String>, ) -> Self { Event { category: EventCategory::Transport, ty: EventType::TransportEventType(TransportEventType::PacketSent), data: EventData::PacketSent { packet_type, header, frames, is_coalesced, raw_encrypted, raw_decrypted, }, } } pub fn packet_sent_min( packet_type: PacketType, header: PacketHeader, frames: Option<Vec<QuicFrame>>, ) -> Self { Event::packet_sent(packet_type, header, frames, None, None, None) } /// Returns: /// * `EventCategory`=`Transport` /// * `EventType`=`TransportEventType::PacketDropped` /// * `EventData`=`PacketDropped`. pub fn packet_dropped( packet_type: Option<PacketType>, packet_size: Option<u64>, raw: Option<String>, ) -> Self { Event { category: EventCategory::Transport, ty: EventType::TransportEventType(TransportEventType::PacketDropped), data: EventData::PacketDropped { packet_type, packet_size, raw, }, } } pub fn packet_dropped_min() -> Self { Event::packet_dropped(None, None, None) } /// Returns: /// * `EventCategory`=`Transport` /// * `EventType`=`TransportEventType::PacketBuffered` /// * `EventData`=`PacketBuffered`. pub fn packet_buffered( packet_type: PacketType, packet_number: String, ) -> Self { Event { category: EventCategory::Transport, ty: EventType::TransportEventType(TransportEventType::PacketBuffered), data: EventData::PacketBuffered { packet_type, packet_number, }, } } /// Returns: /// * `EventCategory`=`Transport` /// * `EventType`=`TransportEventType::StreamStateUpdated` /// * `EventData`=`StreamStateUpdated`. pub fn stream_state_updated( stream_id: u64, stream_type: Option<StreamType>, old: Option<StreamState>, new: StreamState, stream_side: Option<StreamSide>, ) -> Self { Event { category: EventCategory::Connectivity, ty: EventType::TransportEventType( TransportEventType::StreamStateUpdated, ), data: EventData::StreamStateUpdated { stream_id, stream_type, old, new, stream_side, }, } } pub fn stream_state_updated_min(stream_id: u64, new: StreamState) -> Self { Event::stream_state_updated(stream_id, None, None, new, None) } /// Returns: /// * `EventCategory`=`Transport` /// * `EventType`=`TransportEventType::FramesProcessed` /// * `EventData`=`FramesProcessed`. pub fn frames_processed(frames: Vec<QuicFrame>) -> Self { Event { category: EventCategory::Transport, ty: EventType::TransportEventType( TransportEventType::FramesProcessed, ), data: EventData::FramesProcessed { frames }, } } // Recovery events. /// Returns: /// * `EventCategory`=`Recovery` /// * `EventType`=`RecoveryEventType::ParametersSet` /// * `EventData`=`RecoveryParametersSet`. pub fn recovery_parameters_set( reordering_threshold: Option<u16>, time_threshold: Option<f32>, timer_granularity: Option<u16>, initial_rtt: Option<f32>, max_datagram_size: Option<u32>, initial_congestion_window: Option<u64>, minimum_congestion_window: Option<u32>, loss_reduction_factor: Option<f32>, persistent_congestion_threshold: Option<u16>, ) -> Self { Event { category: EventCategory::Recovery, ty: EventType::RecoveryEventType(RecoveryEventType::ParametersSet), data: EventData::RecoveryParametersSet { reordering_threshold, time_threshold, timer_granularity, initial_rtt, max_datagram_size, initial_congestion_window, minimum_congestion_window, loss_reduction_factor, persistent_congestion_threshold, }, } } pub fn recovery_parameters_set_min() -> Self { Event::recovery_parameters_set( None, None, None, None, None, None, None, None, None, ) } /// Returns: /// * `EventCategory`=`Recovery` /// * `EventType`=`RecoveryEventType::MetricsUpdated` /// * `EventData`=`MetricsUpdated`. pub fn metrics_updated( min_rtt: Option<f32>, smoothed_rtt: Option<f32>, latest_rtt: Option<f32>, rtt_variance: Option<f32>, max_ack_delay: Option<u64>, pto_count: Option<u16>, congestion_window: Option<u64>, bytes_in_flight: Option<u64>, ssthresh: Option<u64>, packets_in_flight: Option<u64>, in_recovery: Option<bool>, pacing_rate: Option<u64>, ) -> Self { Event { category: EventCategory::Recovery, ty: EventType::RecoveryEventType(RecoveryEventType::MetricsUpdated), data: EventData::MetricsUpdated { min_rtt, smoothed_rtt, latest_rtt, rtt_variance, max_ack_delay, pto_count, congestion_window, bytes_in_flight, ssthresh, packets_in_flight, in_recovery, pacing_rate, }, } } pub fn metrics_updated_min() -> Self { Event::metrics_updated( None, None, None, None, None, None, None, None, None, None, None, None, ) } /// Returns: /// * `EventCategory`=`Recovery` /// * `EventType`=`RecoveryEventType::CongestionStateUpdated` /// * `EventData`=`CongestionStateUpdated`. pub fn congestion_state_updated(old: Option<String>, new: String) -> Self { Event { category: EventCategory::Recovery, ty: EventType::RecoveryEventType( RecoveryEventType::CongestionStateUpdated, ), data: EventData::CongestionStateUpdated { old, new }, } } pub fn congestion_state_updated_min(new: String) -> Self { Event::congestion_state_updated(None, new) } /// Returns: /// * `EventCategory`=`Recovery` /// * `EventType`=`RecoveryEventType::LossTimerSet` /// * `EventData`=`LossTimerSet`. pub fn loss_timer_set( timer_type: Option<TimerType>, timeout: Option<String>, ) -> Self { Event { category: EventCategory::Recovery, ty: EventType::RecoveryEventType(RecoveryEventType::LossTimerSet), data: EventData::LossTimerSet { timer_type, timeout, }, } } pub fn loss_timer_set_min() -> Self { Event::loss_timer_set(None, None) } /// Returns: /// * `EventCategory`=`Recovery` /// * `EventType`=`RecoveryEventType::PacketLost` /// * `EventData`=`PacketLost`. pub fn packet_lost( packet_type: PacketType, packet_number: String, header: Option<PacketHeader>, frames: Vec<QuicFrame>, ) -> Self { Event { category: EventCategory::Recovery, ty: EventType::RecoveryEventType(RecoveryEventType::PacketLost), data: EventData::PacketLost { packet_type, packet_number, header, frames, }, } } pub fn packet_lost_min( packet_type: PacketType, packet_number: String, frames: Vec<QuicFrame>, ) -> Self { Event::packet_lost(packet_type, packet_number, None, frames) } /// Returns: /// * `EventCategory`=`Recovery` /// * `EventType`=`RecoveryEventType::MarkedForRetransmit` /// * `EventData`=`MarkedForRetransmit`. pub fn marked_for_retransmit(frames: Vec<QuicFrame>) -> Self { Event { category: EventCategory::Recovery, ty: EventType::RecoveryEventType( RecoveryEventType::MarkedForRetransmit, ), data: EventData::MarkedForRetransmit { frames }, } } // HTTP/3 events. /// Returns: /// * `EventCategory`=`Http` /// * `EventType`=`Http3EventType::ParametersSet` /// * `EventData`=`H3ParametersSet`. pub fn h3_parameters_set( owner: Option<H3Owner>, max_header_list_size: Option<u64>, max_table_capacity: Option<u64>, blocked_streams_count: Option<u64>, push_allowed: Option<bool>, waits_for_settings: Option<bool>, ) -> Self { Event { category: EventCategory::Http, ty: EventType::Http3EventType(Http3EventType::ParametersSet), data: EventData::H3ParametersSet { owner, max_header_list_size, max_table_capacity, blocked_streams_count, push_allowed, waits_for_settings, }, } } pub fn h3_parameters_set_min() -> Self { Event::h3_parameters_set(None, None, None, None, None, None) } /// Returns: /// * `EventCategory`=`Http` /// * `EventType`=`Http3EventType::StreamTypeSet` /// * `EventData`=`H3StreamTypeSet`. pub fn h3_stream_type_set( stream_id: u64, owner: Option<H3Owner>, old: Option<H3StreamType>, new: H3StreamType, ) -> Self { Event { category: EventCategory::Http, ty: EventType::Http3EventType(Http3EventType::StreamTypeSet), data: EventData::H3StreamTypeSet { stream_id, owner, old, new, }, } } pub fn h3_stream_type_set_min(stream_id: u64, new: H3StreamType) -> Self { Event::h3_stream_type_set(stream_id, None, None, new) } /// Returns: /// * `EventCategory`=`Http` /// * `EventType`=`Http3EventType::FrameCreated` /// * `EventData`=`H3FrameCreated`. pub fn h3_frame_created( stream_id: u64, frame: Http3Frame, byte_length: Option<u64>, raw: Option<String>, ) -> Self { Event { category: EventCategory::Http, ty: EventType::Http3EventType(Http3EventType::FrameCreated), data: EventData::H3FrameCreated { stream_id, frame, byte_length, raw, }, } } pub fn h3_frame_created_min(stream_id: u64, frame: Http3Frame) -> Self { Event::h3_frame_created(stream_id, frame, None, None) } /// Returns: /// * `EventCategory`=`Http` /// * `EventType`=`Http3EventType::FrameParsed` /// * `EventData`=`H3FrameParsed`. pub fn h3_frame_parsed( stream_id: u64, frame: Http3Frame, byte_length: Option<u64>, raw: Option<String>, ) -> Self { Event { category: EventCategory::Http, ty: EventType::Http3EventType(Http3EventType::FrameParsed), data: EventData::H3FrameParsed { stream_id, frame, byte_length, raw, }, } } pub fn h3_frame_parsed_min(stream_id: u64, frame: Http3Frame) -> Self { Event::h3_frame_parsed(stream_id, frame, None, None) } /// Returns: /// * `EventCategory`=`Http` /// * `EventType`=`Http3EventType::DataMoved` /// * `EventData`=`H3DataMoved`. pub fn h3_data_moved( stream_id: u64, offset: Option<u64>, length: Option<u64>, from: Option<H3DataRecipient>, to: Option<H3DataRecipient>, raw: Option<String>, ) -> Self { Event { category: EventCategory::Http, ty: EventType::Http3EventType(Http3EventType::DataMoved), data: EventData::H3DataMoved { stream_id, offset, length, from, to, raw, }, } } pub fn h3_data_moved_min(stream_id: u64) -> Self { Event::h3_data_moved(stream_id, None, None, None, None, None) } /// Returns: /// * `EventCategory`=`Http` /// * `EventType`=`Http3EventType::PushResolved` /// * `EventData`=`H3PushResolved`. pub fn h3_push_resolved( push_id: Option<u64>, stream_id: Option<u64>, decision: Option<H3PushDecision>, ) -> Self { Event { category: EventCategory::Http, ty: EventType::Http3EventType(Http3EventType::PushResolved), data: EventData::H3PushResolved { push_id, stream_id, decision, }, } } pub fn h3_push_resolved_min() -> Self { Event::h3_push_resolved(None, None, None) } // QPACK events. /// Returns: /// * `EventCategory`=`Qpack` /// * `EventType`=`QpackEventType::StateUpdated` /// * `EventData`=`QpackStateUpdated`. pub fn qpack_state_updated( owner: Option<QpackOwner>, dynamic_table_capacity: Option<u64>, dynamic_table_size: Option<u64>, known_received_count: Option<u64>, current_insert_count: Option<u64>, ) -> Self { Event { category: EventCategory::Qpack, ty: EventType::QpackEventType(QpackEventType::StateUpdated), data: EventData::QpackStateUpdated { owner, dynamic_table_capacity, dynamic_table_size, known_received_count, current_insert_count, }, } } pub fn qpack_state_updated_min() -> Self { Event::qpack_state_updated(None, None, None, None, None) } /// Returns: /// * `EventCategory`=`Qpack` /// * `EventType`=`QpackEventType::StreamStateUpdated` /// * `EventData`=`QpackStreamStateUpdated`. pub fn qpack_stream_state_updated( stream_id: u64, state: QpackStreamState, ) -> Self { Event { category: EventCategory::Qpack, ty: EventType::QpackEventType(QpackEventType::StreamStateUpdated), data: EventData::QpackStreamStateUpdated { stream_id, state }, } } /// Returns: /// * `EventCategory`=`Qpack` /// * `EventType`=`QpackEventType::DynamicTableUpdated` /// * `EventData`=`QpackDynamicTableUpdated`. pub fn qpack_dynamic_table_updated( update_type: QpackUpdateType, entries: Vec<QpackDynamicTableEntry>, ) -> Self { Event { category: EventCategory::Qpack, ty: EventType::QpackEventType(QpackEventType::DynamicTableUpdated), data: EventData::QpackDynamicTableUpdated { update_type, entries, }, } } /// Returns: /// * `EventCategory`=`Qpack` /// * `EventType`=`QpackEventType::HeadersEncoded` /// * `EventData`=`QpackHeadersEncoded`. pub fn qpack_headers_encoded( stream_id: Option<u64>, headers: Option<HttpHeader>, block_prefix: QpackHeaderBlockPrefix, header_block: Vec<QpackHeaderBlockRepresentation>, raw: Option<String>, ) -> Self { Event { category: EventCategory::Qpack, ty: EventType::QpackEventType(QpackEventType::HeadersEncoded), data: EventData::QpackHeadersEncoded { stream_id, headers, block_prefix, header_block, raw, }, } } pub fn qpack_headers_encoded_min( block_prefix: QpackHeaderBlockPrefix, header_block: Vec<QpackHeaderBlockRepresentation>, ) -> Self { Event::qpack_headers_encoded(None, None, block_prefix, header_block, None) } /// Returns: /// * `EventCategory`=`Qpack` /// * `EventType`=`QpackEventType::HeadersDecoded` /// * `EventData`=`QpackHeadersDecoded`. pub fn qpack_headers_decoded( stream_id: Option<u64>, headers: Option<HttpHeader>, block_prefix: QpackHeaderBlockPrefix, header_block: Vec<QpackHeaderBlockRepresentation>, raw: Option<String>, ) -> Self { Event { category: EventCategory::Qpack, ty: EventType::QpackEventType(QpackEventType::HeadersDecoded), data: EventData::QpackHeadersDecoded { stream_id, headers, block_prefix, header_block, raw, }, } } pub fn qpack_headers_decoded_min( block_prefix: QpackHeaderBlockPrefix, header_block: Vec<QpackHeaderBlockRepresentation>, ) -> Self { Event::qpack_headers_decoded(None, None, block_prefix, header_block, None) } /// Returns: /// * `EventCategory`=`Qpack` /// * `EventType`=`QpackEventType::InstructionSent` /// * `EventData`=`QpackInstructionSent`. pub fn qpack_instruction_sent( instruction: QPackInstruction, byte_length: Option<u32>, raw: Option<String>, ) -> Self { Event { category: EventCategory::Qpack, ty: EventType::QpackEventType(QpackEventType::InstructionSent), data: EventData::QpackInstructionSent { instruction, byte_length, raw, }, } } pub fn qpack_instruction_sent_min(instruction: QPackInstruction) -> Self { Event::qpack_instruction_sent(instruction, None, None) } /// Returns: /// * `EventCategory`=`Qpack` /// * `EventType`=`QpackEventType::InstructionReceived` /// * `EventData`=`QpackInstructionReceived`. pub fn qpack_instruction_received( instruction: QPackInstruction, byte_length: Option<u32>, raw: Option<String>, ) -> Self { Event { category: EventCategory::Qpack, ty: EventType::QpackEventType(QpackEventType::InstructionReceived), data: EventData::QpackInstructionReceived { instruction, byte_length, raw, }, } } pub fn qpack_instruction_received_min(instruction: QPackInstruction) -> Self { Event::qpack_instruction_received(instruction, None, None) } /// Checks if the the combination of `EventCategory`, `EventType` and /// `EventData` is valid. pub fn is_valid(&self) -> bool { match (&self.category, &self.ty) { ( EventCategory::Connectivity, EventType::ConnectivityEventType(_), ) => matches!( &self.data, EventData::ServerListening { .. } | EventData::ConnectionStarted { .. } | EventData::ConnectionIdUpdated { .. } | EventData::SpinBitUpdated { .. } | EventData::ConnectionStateUpdated { .. } ), (EventCategory::Transport, EventType::TransportEventType(_)) => matches!( &self.data, EventData::TransportParametersSet { .. } | EventData::DatagramsReceived { .. } | EventData::DatagramsSent { .. } | EventData::DatagramDropped { .. } | EventData::PacketReceived { .. } | EventData::PacketSent { .. } | EventData::PacketDropped { .. } | EventData::PacketBuffered { .. } | EventData::StreamStateUpdated { .. } | EventData::FramesProcessed { .. } ), (EventCategory::Security, EventType::SecurityEventType(_)) => matches!( &self.data, EventData::KeyUpdated { .. } | EventData::KeyRetired { .. } ), (EventCategory::Recovery, EventType::RecoveryEventType(_)) => matches!( &self.data, EventData::RecoveryParametersSet { .. } | EventData::MetricsUpdated { .. } | EventData::CongestionStateUpdated { .. } | EventData::LossTimerSet { .. } | EventData::PacketLost { .. } | EventData::MarkedForRetransmit { .. } ), (EventCategory::Http, EventType::Http3EventType(_)) => matches!( &self.data, EventData::H3ParametersSet { .. } | EventData::H3StreamTypeSet { .. } | EventData::H3FrameCreated { .. } | EventData::H3FrameParsed { .. } | EventData::H3DataMoved { .. } | EventData::H3PushResolved { .. } ), (EventCategory::Qpack, EventType::QpackEventType(_)) => matches!( &self.data, EventData::QpackStateUpdated { .. } | EventData::QpackStreamStateUpdated { .. } | EventData::QpackDynamicTableUpdated { .. } | EventData::QpackHeadersEncoded { .. } | EventData::QpackHeadersDecoded { .. } | EventData::QpackInstructionSent { .. } | EventData::QpackInstructionReceived { .. } ), // TODO: in qlog-01 there is no sane default category defined for // GenericEventType (_, EventType::GenericEventType(_)) => matches!( &self.data, EventData::ConnectionError { .. } | EventData::ApplicationError { .. } | EventData::InternalError { .. } | EventData::InternalWarning { .. } | EventData::Message { .. } | EventData::Marker { .. } ), _ => false, } } }
/* * @lc app=leetcode id=725 lang=rust * * [725] Split Linked List in Parts */ // Definition for singly-linked list. // #[derive(PartialEq, Eq, Clone, Debug)] // pub struct ListNode { // pub val: i32, // pub next: Option<Box<ListNode>> // } // // impl ListNode { // #[inline] // fn new(val: i32) -> Self { // ListNode { // next: None, // val // } // } // } impl Solution { pub fn split_list_to_parts(root: Option<Box<ListNode>>, k: i32) -> Vec<Option<Box<ListNode>>> { let k = k as usize; let mut n = 0; let mut current = &root; while let Some(node) = current { n += 1; current = &node.next; } let mut parts = Vec::new(); let mut head = root; for i in 0..k { let mut tail = &mut head; for j in 0..(n / k + (i < n % k)) { tail = &mut tail.as_mut().unwrap().next; } let new_head = tail.take(); parts.push(head); head = new_head; } parts } }
use super::File; use futures::{Future, Poll}; use std::io; /// Future returned by `File::try_clone`. /// /// Clones a file handle into two file handles. /// /// # Panics /// /// Will panic if polled after returning an item or error. #[derive(Debug)] pub struct CloneFuture { file: Option<File>, } impl CloneFuture { pub(crate) fn new(file: File) -> Self { Self { file: Some(file) } } } impl Future for CloneFuture { type Item = (File, File); type Error = (File, io::Error); fn poll(&mut self) -> Poll<Self::Item, Self::Error> { self.file .as_mut() .expect("Cannot poll `CloneFuture` after it resolves") .poll_try_clone() .map(|inner| inner.map(|cloned| (self.file.take().unwrap(), cloned))) .map_err(|err| (self.file.take().unwrap(), err)) } }
use tuber::engine::state::State; use tuber::engine::Result; use tuber::engine::TuberRunner; use tuber::engine::{Engine, EngineSettings}; use tuber::WinitTuberRunner; fn main() -> Result<()> { env_logger::init(); let engine = Engine::new(EngineSettings { application_title: None, initial_state: Some(Box::new(MainState)), }); WinitTuberRunner.run(engine) } struct MainState; impl State for MainState {}
extern crate kvm_ioctls; extern crate vm_memory; use vm_memory::*; use kvm_ioctls::*; use kvm_bindings::*; use std::{str, process}; fn main() { println!("Hello, world!"); test_vm() } fn test_vm() { // This example based on https://lwn.net/Articles/658511/ // next, don't load a simple binary, load a kernel! let code = [ 0xba, 0xf8, 0x03, /* mov $0x3f8, %dx */ 0x00, 0xd8, /* add %bl, %al */ 0x04, b'0', /* add $'0', %al */ 0xee, /* out %al, (%dx) */ 0xb0, b'\n', /* mov $'\n', %al */ 0xee, /* out %al, (%dx) */ 0xf4, /* hlt */ ]; let mem_size = 0x1000; let load_addr = GuestAddress(0x1000); let mem = GuestMemoryMmap::new(&[(load_addr, mem_size)]).unwrap(); let kvm = Kvm::new().expect("new KVM instance creation failed"); let vm_fd = kvm.create_vm().expect("new VM fd creation failed"); mem.with_regions(|index, region| { let mem_region = kvm_userspace_memory_region { slot: index as u32, guest_phys_addr: region.start_addr().raw_value(), memory_size: region.len() as u64, userspace_addr: region.as_ptr() as u64, flags: 0, }; // Safe because the guest regions are guaranteed not to overlap. unsafe { vm_fd.set_user_memory_region(mem_region) } }) .expect("Cannot configure guest memory"); mem.write_slice(&code, load_addr) .expect("Writing code to memory failed"); let vcpu_fd = vm_fd.create_vcpu(0).expect("new VcpuFd failed"); let mut vcpu_sregs = vcpu_fd.get_sregs().expect("get sregs failed"); vcpu_sregs.cs.base = 0; vcpu_sregs.cs.selector = 0; vcpu_fd.set_sregs(&vcpu_sregs).expect("set sregs failed"); let mut vcpu_regs = vcpu_fd.get_regs().expect("get regs failed"); vcpu_regs.rip = 0x1000; vcpu_regs.rax = 2; vcpu_regs.rbx = 3; vcpu_regs.rflags = 2; vcpu_fd.set_regs(&vcpu_regs).expect("set regs failed"); loop { match vcpu_fd.run().expect("run failed") { VcpuExit::IoIn(addr, data) => { println!( "IO in -- addr: {:#x} data [{:?}]", addr, str::from_utf8(&data).unwrap() ); } VcpuExit::IoOut(addr, data) => { println!( "IO out -- addr: {:#x} data [{:?}]", addr, str::from_utf8(&data).unwrap() ); } VcpuExit::MmioRead(_addr, _data) => {} VcpuExit::MmioWrite(_addr, _data) => {} VcpuExit::Unknown => {} VcpuExit::Exception => {} VcpuExit::Hypercall => {} VcpuExit::Debug => {} VcpuExit::Hlt => { println!("HLT"); process::exit(0x0100); } VcpuExit::IrqWindowOpen => {} VcpuExit::Shutdown => {} VcpuExit::FailEntry => {} VcpuExit::Intr => {} VcpuExit::SetTpr => {} VcpuExit::TprAccess => {} VcpuExit::S390Sieic => {} VcpuExit::S390Reset => {} VcpuExit::Dcr => {} VcpuExit::Nmi => {} VcpuExit::InternalError => {} VcpuExit::Osi => {} VcpuExit::PaprHcall => {} VcpuExit::S390Ucontrol => {} VcpuExit::Watchdog => {} VcpuExit::S390Tsch => {} VcpuExit::Epr => {} VcpuExit::SystemEvent => {} VcpuExit::S390Stsi => {} VcpuExit::IoapicEoi(_vector) => {} VcpuExit::Hyperv => {} } // r => panic!("unexpected exit reason: {:?}", r), } }
use crate::accounts_db::{ get_paths_vec, AccountInfo, AccountStorage, AccountsDB, ErrorCounters, InstructionAccounts, InstructionLoaders, }; use crate::accounts_index::{AccountsIndex, Fork}; use crate::append_vec::StoredAccount; use crate::message_processor::has_duplicates; use bincode::serialize; use hashbrown::{HashMap, HashSet}; use log::*; use morgan_metricbot::inc_new_counter_error; use morgan_interface::account::Account; use morgan_interface::fee_calculator::FeeCalculator; use morgan_interface::hash::{Hash, Hasher}; use morgan_interface::native_loader; use morgan_interface::pubkey::Pubkey; use morgan_interface::signature::{Keypair, KeypairUtil}; use morgan_interface::system_program; use morgan_interface::transaction::Result; use morgan_interface::transaction::{Transaction, TransactionError}; use std::borrow::Borrow; use std::env; use std::fs::remove_dir_all; use std::iter::once; use std::ops::Neg; use std::path::Path; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::{Arc, Mutex}; use std::thread::sleep; use std::time::Duration; const ACCOUNTSDB_DIR: &str = "accountsdb"; const NUM_ACCOUNT_DIRS: usize = 4; const WAIT_FOR_PARENT_MS: u64 = 5; #[derive(Clone, PartialEq, Eq, Debug)] pub enum AccountLockType { AccountLock, RecordLock, } type AccountLocks = Mutex<HashSet<Pubkey>>; // Locks for accounts that are currently being recorded + committed type RecordLocks = ( // Record Locks for the current bank Arc<AccountLocks>, // Any unreleased record locks from all parent/grandparent banks. We use Arc<Mutex> to // avoid copies when calling new_from_parent(). Vec<Arc<AccountLocks>>, ); /// This structure handles synchronization for db #[derive(Default)] pub struct Accounts { /// Single global AccountsDB pub accounts_db: Arc<AccountsDB>, /// set of accounts which are currently in the pipeline account_locks: AccountLocks, /// set of accounts which are about to record + commit record_locks: Mutex<RecordLocks>, /// List of persistent stores paths: String, /// set to true if object created the directories in paths /// when true, delete parents of 'paths' on drop own_paths: bool, } impl Drop for Accounts { fn drop(&mut self) { let paths = get_paths_vec(&self.paths); paths.iter().for_each(|p| { let _ignored = remove_dir_all(p); // it is safe to delete the parent if self.own_paths { let path = Path::new(p); let _ignored = remove_dir_all(path.parent().unwrap()); } }); } } impl Accounts { fn make_new_dir() -> String { static ACCOUNT_DIR: AtomicUsize = AtomicUsize::new(0); let dir = ACCOUNT_DIR.fetch_add(1, Ordering::Relaxed); let out_dir = env::var("OUT_DIR").unwrap_or_else(|_| "target".to_string()); let keypair = Keypair::new(); format!( "{}/{}/{}/{}", out_dir, ACCOUNTSDB_DIR, keypair.pubkey(), dir.to_string() ) } fn make_default_paths() -> String { let mut paths = "".to_string(); for index in 0..NUM_ACCOUNT_DIRS { if index > 0 { paths.push_str(","); } paths.push_str(&Self::make_new_dir()); } paths } pub fn new(in_paths: Option<String>) -> Self { let (paths, own_paths) = if in_paths.is_none() { (Self::make_default_paths(), true) } else { (in_paths.unwrap(), false) }; let accounts_db = Arc::new(AccountsDB::new(&paths)); Accounts { accounts_db, account_locks: Mutex::new(HashSet::new()), record_locks: Mutex::new((Arc::new(Mutex::new(HashSet::new())), vec![])), paths, own_paths, } } pub fn new_from_parent(parent: &Accounts) -> Self { let accounts_db = parent.accounts_db.clone(); let parent_record_locks: Vec<_> = { let (ref record_locks, ref mut grandparent_record_locks) = *parent.record_locks.lock().unwrap(); // Note that when creating a child bank, we only care about the locks that are held for // accounts that are in txs that are currently recording + committing, because other // incoming txs on this bank that are not yet recording will not make it to bank commit. // // Thus: // 1) The child doesn't need to care about potential "future" account locks on its parent // bank that the parent does not currently hold. // 2) The child only needs the currently held "record locks" from the parent. // 3) The parent doesn't need to retain any of the locks other than the ones it owns so // that unlock() can be called later (the grandparent locks can be given to the child). once(record_locks.clone()) .chain(grandparent_record_locks.drain(..)) .filter(|a| !a.lock().unwrap().is_empty()) .collect() }; Accounts { accounts_db, account_locks: Mutex::new(HashSet::new()), record_locks: Mutex::new((Arc::new(Mutex::new(HashSet::new())), parent_record_locks)), paths: parent.paths.clone(), own_paths: parent.own_paths, } } fn load_tx_accounts( storage: &AccountStorage, ancestors: &HashMap<Fork, usize>, accounts_index: &AccountsIndex<AccountInfo>, tx: &Transaction, fee: u64, error_counters: &mut ErrorCounters, ) -> Result<Vec<Account>> { // Copy all the accounts let message = tx.message(); if tx.signatures.is_empty() && fee != 0 { Err(TransactionError::MissingSignatureForFee) } else { // Check for unique account keys if has_duplicates(&message.account_keys) { error_counters.account_loaded_twice += 1; return Err(TransactionError::AccountLoadedTwice); } // There is no way to predict what program will execute without an error // If a fee can pay for execution then the program will be scheduled let mut called_accounts: Vec<Account> = vec![]; for key in &message.account_keys { if !message.program_ids().contains(&key) { called_accounts.push( AccountsDB::load(storage, ancestors, accounts_index, key) .map(|(account, _)| account) .unwrap_or_default(), ); } } if called_accounts.is_empty() || called_accounts[0].difs == 0 { error_counters.account_not_found += 1; Err(TransactionError::AccountNotFound) } else if called_accounts[0].owner != system_program::id() { error_counters.invalid_account_for_fee += 1; Err(TransactionError::InvalidAccountForFee) } else if called_accounts[0].difs < fee { error_counters.insufficient_funds += 1; Err(TransactionError::InsufficientFundsForFee) } else { called_accounts[0].difs -= fee; Ok(called_accounts) } } } fn load_executable_accounts( storage: &AccountStorage, ancestors: &HashMap<Fork, usize>, accounts_index: &AccountsIndex<AccountInfo>, program_id: &Pubkey, error_counters: &mut ErrorCounters, ) -> Result<Vec<(Pubkey, Account)>> { let mut accounts = Vec::new(); let mut depth = 0; let mut program_id = *program_id; loop { if native_loader::check_id(&program_id) { // at the root of the chain, ready to dispatch break; } if depth >= 5 { error_counters.call_chain_too_deep += 1; return Err(TransactionError::CallChainTooDeep); } depth += 1; let program = match AccountsDB::load(storage, ancestors, accounts_index, &program_id) .map(|(account, _)| account) { Some(program) => program, None => { error_counters.account_not_found += 1; return Err(TransactionError::ProgramAccountNotFound); } }; if !program.executable || program.owner == Pubkey::default() { error_counters.account_not_found += 1; return Err(TransactionError::AccountNotFound); } // add loader to chain program_id = program.owner; accounts.insert(0, (program_id, program)); } Ok(accounts) } /// For each program_id in the transaction, load its loaders. fn load_loaders( storage: &AccountStorage, ancestors: &HashMap<Fork, usize>, accounts_index: &AccountsIndex<AccountInfo>, tx: &Transaction, error_counters: &mut ErrorCounters, ) -> Result<Vec<Vec<(Pubkey, Account)>>> { let message = tx.message(); message .instructions .iter() .map(|ix| { if message.account_keys.len() <= ix.program_ids_index as usize { error_counters.account_not_found += 1; return Err(TransactionError::AccountNotFound); } let program_id = message.account_keys[ix.program_ids_index as usize]; Self::load_executable_accounts( storage, ancestors, accounts_index, &program_id, error_counters, ) }) .collect() } fn load_accounts_internal( &self, ancestors: &HashMap<Fork, usize>, txs: &[Transaction], lock_results: Vec<Result<()>>, fee_calculator: &FeeCalculator, error_counters: &mut ErrorCounters, ) -> Vec<Result<(InstructionAccounts, InstructionLoaders)>> { //PERF: hold the lock to scan for the references, but not to clone the accounts //TODO: two locks usually leads to deadlocks, should this be one structure? let accounts_index = self.accounts_db.accounts_index.read().unwrap(); let storage = self.accounts_db.storage.read().unwrap(); txs.iter() .zip(lock_results.into_iter()) .map(|etx| match etx { (tx, Ok(())) => { let fee = fee_calculator.calculate_fee(tx.message()); let accounts = Self::load_tx_accounts( &storage, ancestors, &accounts_index, tx, fee, error_counters, )?; let loaders = Self::load_loaders( &storage, ancestors, &accounts_index, tx, error_counters, )?; Ok((accounts, loaders)) } (_, Err(e)) => Err(e), }) .collect() } /// Slow because lock is held for 1 operation instead of many pub fn load_slow( &self, ancestors: &HashMap<Fork, usize>, pubkey: &Pubkey, ) -> Option<(Account, Fork)> { self.accounts_db .load_slow(ancestors, pubkey) .filter(|(acc, _)| acc.difs != 0) } pub fn load_by_program(&self, fork: Fork, program_id: &Pubkey) -> Vec<(Pubkey, Account)> { let accumulator: Vec<Vec<(Pubkey, u64, Account)>> = self.accounts_db.scan_account_storage( fork, |stored_account: &StoredAccount, accum: &mut Vec<(Pubkey, u64, Account)>| { if stored_account.balance.owner == *program_id { let val = ( stored_account.meta.pubkey, stored_account.meta.write_version, stored_account.clone_account(), ); accum.push(val) } }, ); let mut versions: Vec<(Pubkey, u64, Account)> = accumulator.into_iter().flat_map(|x| x).collect(); versions.sort_by_key(|s| (s.0, (s.1 as i64).neg())); versions.dedup_by_key(|s| s.0); versions.into_iter().map(|s| (s.0, s.2)).collect() } /// Slow because lock is held for 1 operation instead of many pub fn store_slow(&self, fork: Fork, pubkey: &Pubkey, account: &Account) { self.accounts_db.store(fork, &[(pubkey, account)]); } fn lock_account( (fork_locks, parent_locks): (&mut HashSet<Pubkey>, &mut Vec<Arc<AccountLocks>>), keys: &[Pubkey], error_counters: &mut ErrorCounters, ) -> Result<()> { // Copy all the accounts for k in keys { let is_locked = { if fork_locks.contains(k) { true } else { // Check parent locks. As soon as a set of parent locks is empty, // we can remove it from the list b/c that means the parent has // released the locks. parent_locks.retain(|p| { loop { { // If a parent bank holds a record lock for this account, then loop // until that lock is released let p = p.lock().unwrap(); if !p.contains(k) { break; } } // If a parent is currently recording for this key, then drop lock and wait sleep(Duration::from_millis(WAIT_FOR_PARENT_MS)); } let p = p.lock().unwrap(); !p.is_empty() }); false } }; if is_locked { error_counters.account_in_use += 1; debug!("Account in use: {:?}", k); return Err(TransactionError::AccountInUse); } } for k in keys { fork_locks.insert(*k); } Ok(()) } fn lock_record_account(record_locks: &AccountLocks, keys: &[Pubkey]) { let mut fork_locks = record_locks.lock().unwrap(); for k in keys { // The fork locks should always be a subset of the account locks, so // the account locks should prevent record locks from ever touching the // same accounts assert!(!fork_locks.contains(k)); fork_locks.insert(*k); } } fn unlock_account(tx: &Transaction, result: &Result<()>, locks: &mut HashSet<Pubkey>) { match result { Err(TransactionError::AccountInUse) => (), _ => { for k in &tx.message().account_keys { locks.remove(k); } } } } fn unlock_record_account<I>(tx: &I, locks: &mut HashSet<Pubkey>) where I: Borrow<Transaction>, { for k in &tx.borrow().message().account_keys { locks.remove(k); } } fn hash_account(stored_account: &StoredAccount) -> Hash { let mut hasher = Hasher::default(); hasher.hash(&serialize(&stored_account.balance).unwrap()); hasher.hash(stored_account.data); hasher.result() } pub fn hash_internal_state(&self, fork_id: Fork) -> Option<Hash> { let accumulator: Vec<Vec<(Pubkey, u64, Hash)>> = self.accounts_db.scan_account_storage( fork_id, |stored_account: &StoredAccount, accum: &mut Vec<(Pubkey, u64, Hash)>| { accum.push(( stored_account.meta.pubkey, stored_account.meta.write_version, Self::hash_account(stored_account), )); }, ); let mut account_hashes: Vec<_> = accumulator.into_iter().flat_map(|x| x).collect(); account_hashes.sort_by_key(|s| (s.0, (s.1 as i64).neg())); account_hashes.dedup_by_key(|s| s.0); if account_hashes.is_empty() { None } else { let mut hasher = Hasher::default(); for (_, _, hash) in account_hashes { hasher.hash(hash.as_ref()); } Some(hasher.result()) } } /// This function will prevent multiple threads from modifying the same account state at the /// same time #[must_use] pub fn lock_accounts<I>(&self, txs: &[I]) -> Vec<Result<()>> where I: Borrow<Transaction>, { let (_, ref mut parent_record_locks) = *self.record_locks.lock().unwrap(); let mut error_counters = ErrorCounters::default(); let rv = txs .iter() .map(|tx| { let message = tx.borrow().message(); Self::lock_account( (&mut self.account_locks.lock().unwrap(), parent_record_locks), &message.account_keys[..(message.account_keys.len() - message.header.num_credit_only_unsigned_accounts as usize)], &mut error_counters, ) }) .collect(); if error_counters.account_in_use != 0 { inc_new_counter_error!( "bank-process_transactions-account_in_use", error_counters.account_in_use, 0, 100 ); } rv } pub fn lock_record_accounts<I>(&self, txs: &[I]) where I: Borrow<Transaction>, { let record_locks = self.record_locks.lock().unwrap(); for tx in txs { let message = tx.borrow().message(); Self::lock_record_account( &record_locks.0, &message.account_keys[..(message.account_keys.len() - message.header.num_credit_only_unsigned_accounts as usize)], ); } } /// Once accounts are unlocked, new transactions that modify that state can enter the pipeline pub fn unlock_accounts<I>(&self, txs: &[I], results: &[Result<()>]) where I: Borrow<Transaction>, { let my_locks = &mut self.account_locks.lock().unwrap(); debug!("bank unlock accounts"); txs.iter() .zip(results.iter()) .for_each(|(tx, result)| Self::unlock_account(tx.borrow(), result, my_locks)); } pub fn unlock_record_accounts<I>(&self, txs: &[I]) where I: Borrow<Transaction>, { let (ref my_record_locks, _) = *self.record_locks.lock().unwrap(); for tx in txs { Self::unlock_record_account(tx, &mut my_record_locks.lock().unwrap()) } } pub fn has_accounts(&self, fork: Fork) -> bool { self.accounts_db.has_accounts(fork) } pub fn load_accounts( &self, ancestors: &HashMap<Fork, usize>, txs: &[Transaction], results: Vec<Result<()>>, fee_calculator: &FeeCalculator, error_counters: &mut ErrorCounters, ) -> Vec<Result<(InstructionAccounts, InstructionLoaders)>> { self.load_accounts_internal(ancestors, txs, results, fee_calculator, error_counters) } /// Store the accounts into the DB pub fn store_accounts( &self, fork: Fork, txs: &[Transaction], res: &[Result<()>], loaded: &[Result<(InstructionAccounts, InstructionLoaders)>], ) { let mut accounts: Vec<(&Pubkey, &Account)> = vec![]; for (i, raccs) in loaded.iter().enumerate() { if res[i].is_err() || raccs.is_err() { continue; } let message = &txs[i].message(); let acc = raccs.as_ref().unwrap(); for (key, account) in message.account_keys.iter().zip(acc.0.iter()) { accounts.push((key, account)); } } self.accounts_db.store(fork, &accounts); } /// Purge a fork if it is not a root /// Root forks cannot be purged pub fn purge_fork(&self, fork: Fork) { self.accounts_db.purge_fork(fork); } /// Add a fork to root. Root forks cannot be purged pub fn add_root(&self, fork: Fork) { self.accounts_db.add_root(fork) } } #[cfg(test)] mod tests { // TODO: all the bank tests are bank specific, issue: 2194 use super::*; use morgan_interface::account::Account; use morgan_interface::hash::Hash; use morgan_interface::instruction::CompiledInstruction; use morgan_interface::signature::{Keypair, KeypairUtil}; use morgan_interface::transaction::Transaction; use std::thread::{sleep, Builder}; use std::time::Duration; fn load_accounts_with_fee( tx: Transaction, ka: &Vec<(Pubkey, Account)>, fee_calculator: &FeeCalculator, error_counters: &mut ErrorCounters, ) -> Vec<Result<(InstructionAccounts, InstructionLoaders)>> { let accounts = Accounts::new(None); for ka in ka.iter() { accounts.store_slow(0, &ka.0, &ka.1); } let ancestors = vec![(0, 0)].into_iter().collect(); let res = accounts.load_accounts( &ancestors, &[tx], vec![Ok(())], &fee_calculator, error_counters, ); res } fn load_accounts( tx: Transaction, ka: &Vec<(Pubkey, Account)>, error_counters: &mut ErrorCounters, ) -> Vec<Result<(InstructionAccounts, InstructionLoaders)>> { let fee_calculator = FeeCalculator::default(); load_accounts_with_fee(tx, ka, &fee_calculator, error_counters) } #[test] fn test_load_accounts_no_key() { let accounts: Vec<(Pubkey, Account)> = Vec::new(); let mut error_counters = ErrorCounters::default(); let instructions = vec![CompiledInstruction::new(0, &(), vec![0])]; let tx = Transaction::new_with_compiled_instructions::<Keypair>( &[], &[], Hash::default(), vec![native_loader::id()], instructions, ); let loaded_accounts = load_accounts(tx, &accounts, &mut error_counters); assert_eq!(error_counters.account_not_found, 1); assert_eq!(loaded_accounts.len(), 1); assert_eq!(loaded_accounts[0], Err(TransactionError::AccountNotFound)); } #[test] fn test_load_accounts_no_account_0_exists() { let accounts: Vec<(Pubkey, Account)> = Vec::new(); let mut error_counters = ErrorCounters::default(); let keypair = Keypair::new(); let instructions = vec![CompiledInstruction::new(1, &(), vec![0])]; let tx = Transaction::new_with_compiled_instructions( &[&keypair], &[], Hash::default(), vec![native_loader::id()], instructions, ); let loaded_accounts = load_accounts(tx, &accounts, &mut error_counters); assert_eq!(error_counters.account_not_found, 1); assert_eq!(loaded_accounts.len(), 1); assert_eq!(loaded_accounts[0], Err(TransactionError::AccountNotFound)); } #[test] fn test_load_accounts_unknown_program_id() { let mut accounts: Vec<(Pubkey, Account)> = Vec::new(); let mut error_counters = ErrorCounters::default(); let keypair = Keypair::new(); let key0 = keypair.pubkey(); let key1 = Pubkey::new(&[5u8; 32]); let account = Account::new(1, 0, 1, &Pubkey::default()); accounts.push((key0, account)); let account = Account::new(2, 0, 1, &Pubkey::default()); accounts.push((key1, account)); let instructions = vec![CompiledInstruction::new(1, &(), vec![0])]; let tx = Transaction::new_with_compiled_instructions( &[&keypair], &[], Hash::default(), vec![Pubkey::default()], instructions, ); let loaded_accounts = load_accounts(tx, &accounts, &mut error_counters); assert_eq!(error_counters.account_not_found, 1); assert_eq!(loaded_accounts.len(), 1); assert_eq!( loaded_accounts[0], Err(TransactionError::ProgramAccountNotFound) ); } #[test] fn test_load_accounts_insufficient_funds() { let mut accounts: Vec<(Pubkey, Account)> = Vec::new(); let mut error_counters = ErrorCounters::default(); let keypair = Keypair::new(); let key0 = keypair.pubkey(); let account = Account::new(1, 0, 1, &Pubkey::default()); accounts.push((key0, account)); let instructions = vec![CompiledInstruction::new(1, &(), vec![0])]; let tx = Transaction::new_with_compiled_instructions( &[&keypair], &[], Hash::default(), vec![native_loader::id()], instructions, ); let fee_calculator = FeeCalculator::new(10); assert_eq!(fee_calculator.calculate_fee(tx.message()), 10); let loaded_accounts = load_accounts_with_fee(tx, &accounts, &fee_calculator, &mut error_counters); assert_eq!(error_counters.insufficient_funds, 1); assert_eq!(loaded_accounts.len(), 1); assert_eq!( loaded_accounts[0], Err(TransactionError::InsufficientFundsForFee) ); } #[test] fn test_load_accounts_invalid_account_for_fee() { let mut accounts: Vec<(Pubkey, Account)> = Vec::new(); let mut error_counters = ErrorCounters::default(); let keypair = Keypair::new(); let key0 = keypair.pubkey(); let account = Account::new(1, 0, 1, &Pubkey::new_rand()); // <-- owner is not the system program accounts.push((key0, account)); let instructions = vec![CompiledInstruction::new(1, &(), vec![0])]; let tx = Transaction::new_with_compiled_instructions( &[&keypair], &[], Hash::default(), vec![native_loader::id()], instructions, ); let loaded_accounts = load_accounts(tx, &accounts, &mut error_counters); assert_eq!(error_counters.invalid_account_for_fee, 1); assert_eq!(loaded_accounts.len(), 1); assert_eq!( loaded_accounts[0], Err(TransactionError::InvalidAccountForFee) ); } #[test] fn test_load_accounts_no_loaders() { let mut accounts: Vec<(Pubkey, Account)> = Vec::new(); let mut error_counters = ErrorCounters::default(); let keypair = Keypair::new(); let key0 = keypair.pubkey(); let key1 = Pubkey::new(&[5u8; 32]); let account = Account::new(1, 0, 1, &Pubkey::default()); accounts.push((key0, account)); let account = Account::new(2, 0, 1, &Pubkey::default()); accounts.push((key1, account)); let instructions = vec![CompiledInstruction::new(2, &(), vec![0, 1])]; let tx = Transaction::new_with_compiled_instructions( &[&keypair], &[key1], Hash::default(), vec![native_loader::id()], instructions, ); let loaded_accounts = load_accounts(tx, &accounts, &mut error_counters); assert_eq!(error_counters.account_not_found, 0); assert_eq!(loaded_accounts.len(), 1); match &loaded_accounts[0] { Ok((a, l)) => { assert_eq!(a.len(), 2); assert_eq!(a[0], accounts[0].1); assert_eq!(l.len(), 1); assert_eq!(l[0].len(), 0); } Err(e) => Err(e).unwrap(), } } #[test] fn test_load_accounts_max_call_depth() { let mut accounts: Vec<(Pubkey, Account)> = Vec::new(); let mut error_counters = ErrorCounters::default(); let keypair = Keypair::new(); let key0 = keypair.pubkey(); let key1 = Pubkey::new(&[5u8; 32]); let key2 = Pubkey::new(&[6u8; 32]); let key3 = Pubkey::new(&[7u8; 32]); let key4 = Pubkey::new(&[8u8; 32]); let key5 = Pubkey::new(&[9u8; 32]); let key6 = Pubkey::new(&[10u8; 32]); let account = Account::new(1, 0, 1, &Pubkey::default()); accounts.push((key0, account)); let mut account = Account::new(40, 0, 1, &Pubkey::default()); account.executable = true; account.owner = native_loader::id(); accounts.push((key1, account)); let mut account = Account::new(41, 0, 1, &Pubkey::default()); account.executable = true; account.owner = key1; accounts.push((key2, account)); let mut account = Account::new(42, 0, 1, &Pubkey::default()); account.executable = true; account.owner = key2; accounts.push((key3, account)); let mut account = Account::new(43, 0, 1, &Pubkey::default()); account.executable = true; account.owner = key3; accounts.push((key4, account)); let mut account = Account::new(44, 0, 1, &Pubkey::default()); account.executable = true; account.owner = key4; accounts.push((key5, account)); let mut account = Account::new(45, 0, 1, &Pubkey::default()); account.executable = true; account.owner = key5; accounts.push((key6, account)); let instructions = vec![CompiledInstruction::new(1, &(), vec![0])]; let tx = Transaction::new_with_compiled_instructions( &[&keypair], &[], Hash::default(), vec![key6], instructions, ); let loaded_accounts = load_accounts(tx, &accounts, &mut error_counters); assert_eq!(error_counters.call_chain_too_deep, 1); assert_eq!(loaded_accounts.len(), 1); assert_eq!(loaded_accounts[0], Err(TransactionError::CallChainTooDeep)); } #[test] fn test_load_accounts_bad_program_id() { let mut accounts: Vec<(Pubkey, Account)> = Vec::new(); let mut error_counters = ErrorCounters::default(); let keypair = Keypair::new(); let key0 = keypair.pubkey(); let key1 = Pubkey::new(&[5u8; 32]); let account = Account::new(1, 0, 1, &Pubkey::default()); accounts.push((key0, account)); let mut account = Account::new(40, 0, 1, &Pubkey::default()); account.executable = true; account.owner = Pubkey::default(); accounts.push((key1, account)); let instructions = vec![CompiledInstruction::new(0, &(), vec![0])]; let tx = Transaction::new_with_compiled_instructions( &[&keypair], &[], Hash::default(), vec![key1], instructions, ); let loaded_accounts = load_accounts(tx, &accounts, &mut error_counters); assert_eq!(error_counters.account_not_found, 1); assert_eq!(loaded_accounts.len(), 1); assert_eq!(loaded_accounts[0], Err(TransactionError::AccountNotFound)); } #[test] fn test_load_accounts_not_executable() { let mut accounts: Vec<(Pubkey, Account)> = Vec::new(); let mut error_counters = ErrorCounters::default(); let keypair = Keypair::new(); let key0 = keypair.pubkey(); let key1 = Pubkey::new(&[5u8; 32]); let account = Account::new(1, 0, 1, &Pubkey::default()); accounts.push((key0, account)); let mut account = Account::new(40, 0, 1, &Pubkey::default()); account.owner = native_loader::id(); accounts.push((key1, account)); let instructions = vec![CompiledInstruction::new(1, &(), vec![0])]; let tx = Transaction::new_with_compiled_instructions( &[&keypair], &[], Hash::default(), vec![key1], instructions, ); let loaded_accounts = load_accounts(tx, &accounts, &mut error_counters); assert_eq!(error_counters.account_not_found, 1); assert_eq!(loaded_accounts.len(), 1); assert_eq!(loaded_accounts[0], Err(TransactionError::AccountNotFound)); } #[test] fn test_load_accounts_multiple_loaders() { let mut accounts: Vec<(Pubkey, Account)> = Vec::new(); let mut error_counters = ErrorCounters::default(); let keypair = Keypair::new(); let key0 = keypair.pubkey(); let key1 = Pubkey::new(&[5u8; 32]); let key2 = Pubkey::new(&[6u8; 32]); let key3 = Pubkey::new(&[7u8; 32]); let account = Account::new(1, 0, 1, &Pubkey::default()); accounts.push((key0, account)); let mut account = Account::new(40, 0, 1, &Pubkey::default()); account.executable = true; account.owner = native_loader::id(); accounts.push((key1, account)); let mut account = Account::new(41, 0, 1, &Pubkey::default()); account.executable = true; account.owner = key1; accounts.push((key2, account)); let mut account = Account::new(42, 0, 1, &Pubkey::default()); account.executable = true; account.owner = key2; accounts.push((key3, account)); let instructions = vec![ CompiledInstruction::new(1, &(), vec![0]), CompiledInstruction::new(2, &(), vec![0]), ]; let tx = Transaction::new_with_compiled_instructions( &[&keypair], &[], Hash::default(), vec![key1, key2], instructions, ); let loaded_accounts = load_accounts(tx, &accounts, &mut error_counters); assert_eq!(error_counters.account_not_found, 0); assert_eq!(loaded_accounts.len(), 1); match &loaded_accounts[0] { Ok((a, l)) => { assert_eq!(a.len(), 1); assert_eq!(a[0], accounts[0].1); assert_eq!(l.len(), 2); assert_eq!(l[0].len(), 1); assert_eq!(l[1].len(), 2); for instruction_loaders in l.iter() { for (i, a) in instruction_loaders.iter().enumerate() { // +1 to skip first not loader account assert_eq![a.1, accounts[i + 1].1]; } } } Err(e) => Err(e).unwrap(), } } #[test] fn test_load_account_pay_to_self() { let mut accounts: Vec<(Pubkey, Account)> = Vec::new(); let mut error_counters = ErrorCounters::default(); let keypair = Keypair::new(); let pubkey = keypair.pubkey(); let account = Account::new(10, 0, 1, &Pubkey::default()); accounts.push((pubkey, account)); let instructions = vec![CompiledInstruction::new(0, &(), vec![0, 1])]; // Simulate pay-to-self transaction, which loads the same account twice let tx = Transaction::new_with_compiled_instructions( &[&keypair], &[pubkey], Hash::default(), vec![native_loader::id()], instructions, ); let loaded_accounts = load_accounts(tx, &accounts, &mut error_counters); assert_eq!(error_counters.account_loaded_twice, 1); assert_eq!(loaded_accounts.len(), 1); loaded_accounts[0].clone().unwrap_err(); assert_eq!( loaded_accounts[0], Err(TransactionError::AccountLoadedTwice) ); } #[test] fn test_load_by_program() { let accounts = Accounts::new(None); // Load accounts owned by various programs into AccountsDB let pubkey0 = Pubkey::new_rand(); let account0 = Account::new(1, 0, 0, &Pubkey::new(&[2; 32])); accounts.store_slow(0, &pubkey0, &account0); let pubkey1 = Pubkey::new_rand(); let account1 = Account::new(1, 0, 0, &Pubkey::new(&[2; 32])); accounts.store_slow(0, &pubkey1, &account1); let pubkey2 = Pubkey::new_rand(); let account2 = Account::new(1, 0, 0, &Pubkey::new(&[3; 32])); accounts.store_slow(0, &pubkey2, &account2); let loaded = accounts.load_by_program(0, &Pubkey::new(&[2; 32])); assert_eq!(loaded.len(), 2); let loaded = accounts.load_by_program(0, &Pubkey::new(&[3; 32])); assert_eq!(loaded, vec![(pubkey2, account2)]); let loaded = accounts.load_by_program(0, &Pubkey::new(&[4; 32])); assert_eq!(loaded, vec![]); } #[test] fn test_accounts_account_not_found() { let accounts = Accounts::new(None); let mut error_counters = ErrorCounters::default(); let ancestors = vec![(0, 0)].into_iter().collect(); let accounts_index = accounts.accounts_db.accounts_index.read().unwrap(); let storage = accounts.accounts_db.storage.read().unwrap(); assert_eq!( Accounts::load_executable_accounts( &storage, &ancestors, &accounts_index, &Pubkey::new_rand(), &mut error_counters ), Err(TransactionError::ProgramAccountNotFound) ); assert_eq!(error_counters.account_not_found, 1); } #[test] fn test_accounts_empty_hash_internal_state() { let accounts = Accounts::new(None); assert_eq!(accounts.hash_internal_state(0), None); } #[test] fn test_parent_locked_record_accounts() { let mut parent = Accounts::new(None); let locked_pubkey = Keypair::new().pubkey(); let mut locked_accounts = HashSet::new(); locked_accounts.insert(locked_pubkey); parent.record_locks = Mutex::new((Arc::new(Mutex::new(locked_accounts.clone())), vec![])); let parent = Arc::new(parent); let child = Accounts::new_from_parent(&parent); // Make sure child record locks contains the parent's locked record accounts { let (_, ref parent_record_locks) = *child.record_locks.lock().unwrap(); assert_eq!(parent_record_locks.len(), 1); assert_eq!(locked_accounts, *parent_record_locks[0].lock().unwrap()); } let parent_ = parent.clone(); let parent_thread = Builder::new() .name("exit".to_string()) .spawn(move || { sleep(Duration::from_secs(2)); // Unlock the accounts in the parent { let (ref parent_record_locks, _) = *parent_.record_locks.lock().unwrap(); parent_record_locks.lock().unwrap().clear(); } }) .unwrap(); // Function will block until the parent_thread unlocks the parent's record lock assert_eq!( Accounts::lock_account( ( &mut child.account_locks.lock().unwrap(), &mut child.record_locks.lock().unwrap().1 ), &vec![locked_pubkey], &mut ErrorCounters::default() ), Ok(()) ); // Make sure that the function blocked parent_thread.join().unwrap(); { // Check the lock was successfully obtained let child_account_locks = &mut child.account_locks.lock().unwrap(); let parent_record_locks = child.record_locks.lock().unwrap(); assert_eq!(child_account_locks.len(), 1); // Make sure child removed the parent's record locks after the parent had // released all its locks assert!(parent_record_locks.1.is_empty()); // After all the checks pass, clear the account we just locked from the // set of locks child_account_locks.clear(); } // Make sure calling new_from_parent() on the child bank also cleans up the copy of old locked // parent accounts, in case the child doesn't call lock_account() after a parent has // released their account locks { // Mock an empty set of parent record accounts in the child bank let (_, ref mut parent_record_locks) = *child.record_locks.lock().unwrap(); parent_record_locks.push(Arc::new(Mutex::new(HashSet::new()))); } // Call new_from_parent, make sure the empty parent locked_accounts is purged let child2 = Accounts::new_from_parent(&child); { let (_, ref mut parent_record_locks) = *child.record_locks.lock().unwrap(); assert!(parent_record_locks.is_empty()); let (_, ref mut parent_record_locks2) = *child2.record_locks.lock().unwrap(); assert!(parent_record_locks2.is_empty()); } } }
use std::io::stdin; struct Game { current_room: usize, inventory: Vec<Item>, rooms: Vec<Room> } impl Game { fn room(&self) -> &Room { &self.rooms[self.current_room] } fn room_mut(&mut self) -> &mut Room { &mut self.rooms[self.current_room] } fn exits(&self) { println!("{} has {} exits:", &self.room().name, &self.room().exits.len()); for (index, exit) in self.room().exits.iter().enumerate() { println!("({}) {}", index, self.rooms[*exit].name); } } fn view_inventory(&self) { println!("You have {} items:", self.inventory.len()); for (index, item) in self.inventory.iter().enumerate() { println!("({}) {}", index, item.name); } } fn move_room(&mut self, room: usize) { self.current_room = self.room().exits[room]; } fn take(&mut self, item: usize) -> &Item { let item = self.room_mut().items.remove(item); self.inventory.push(item); &self.inventory.last().unwrap() } } struct Item { name: String, description: String } struct Room { name: String, description: String, exits: Vec<usize>, items: Vec<Item> } impl Room { fn look(&self) { println!("{}", self.description) } fn inspect(&self) { println!("{} has {} items:", &self.name, &self.items.len()); for (index, item) in self.items.iter().enumerate() { println!("({}) {}", index, item.name); } } } fn main() { let rooms = vec![ Room { name: String::from("Bedroom"), description: String::from("A tidy, clean bedroom with 1 door and a balcony"), exits: vec![1, 2], items: vec![ Item { name: String::from("Key"), description: String::from("A golden key") }] }, Room { name: String::from("Balcony"), description: String::from("An outdoor balcony that overlooks a gray garden"), exits: vec![0], items: vec![] }, Room { name: String::from("Landing"), description: String::from("A carpetted landing with doors leading off it. It overlooks a large living space. A set of stairs leads down"), exits: vec![0], items: vec![] }, ]; let mut player = Game { current_room: 0, rooms: rooms, inventory: vec![] }; println!("Type `look' to look around. Type `move <room no>' to switch room"); loop { let mut input = String::new(); match stdin().read_line(&mut input) { Ok(_) => { let mut commands = input.trim().split_whitespace(); match commands.next() { Some("look") => { player.room().look(); player.exits(); }, Some("move") => { let args: Vec<&str> = commands.collect(); if args.len() != 1 { println!("Incorrect args."); continue; } let room_no: usize = match args[0].parse() { Ok(a) => {a}, Err(e) => { println!("{}", e); continue } }; player.move_room(room_no); println!("You moved to {}", player.room().name); }, Some("inventory") => { player.view_inventory(); }, Some("inspect") => { player.room().inspect(); }, Some("take") => { let args: Vec<&str> = commands.collect(); if args.len() != 1 { println!("Incorrect args."); continue; } let item_no: usize = match args[0].parse() { Ok(a) => a, Err(e) => { println!("{}", e); continue } }; let item = player.take(item_no); println!("You collected {}", item.name); } _ => {}, } }, Err(error) => panic!("Error occured reading stdin: {}", error), } } }
#[doc = r"Value read from the register"] pub struct R { bits: u32, } #[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::IF2MCTL { #[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() -> u32 { 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 CAN_IF2MCTL_DLCR { bits: u8, } impl CAN_IF2MCTL_DLCR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bits(&self) -> u8 { self.bits } } #[doc = r"Proxy"] pub struct _CAN_IF2MCTL_DLCW<'a> { w: &'a mut W, } impl<'a> _CAN_IF2MCTL_DLCW<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits &= !(15 << 0); self.w.bits |= ((value as u32) & 15) << 0; self.w } } #[doc = r"Value of the field"] pub struct CAN_IF2MCTL_EOBR { bits: bool, } impl CAN_IF2MCTL_EOBR { #[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 _CAN_IF2MCTL_EOBW<'a> { w: &'a mut W, } impl<'a> _CAN_IF2MCTL_EOBW<'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 u32) & 1) << 7; self.w } } #[doc = r"Value of the field"] pub struct CAN_IF2MCTL_TXRQSTR { bits: bool, } impl CAN_IF2MCTL_TXRQSTR { #[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 _CAN_IF2MCTL_TXRQSTW<'a> { w: &'a mut W, } impl<'a> _CAN_IF2MCTL_TXRQSTW<'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 << 8); self.w.bits |= ((value as u32) & 1) << 8; self.w } } #[doc = r"Value of the field"] pub struct CAN_IF2MCTL_RMTENR { bits: bool, } impl CAN_IF2MCTL_RMTENR { #[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 _CAN_IF2MCTL_RMTENW<'a> { w: &'a mut W, } impl<'a> _CAN_IF2MCTL_RMTENW<'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 << 9); self.w.bits |= ((value as u32) & 1) << 9; self.w } } #[doc = r"Value of the field"] pub struct CAN_IF2MCTL_RXIER { bits: bool, } impl CAN_IF2MCTL_RXIER { #[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 _CAN_IF2MCTL_RXIEW<'a> { w: &'a mut W, } impl<'a> _CAN_IF2MCTL_RXIEW<'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 << 10); self.w.bits |= ((value as u32) & 1) << 10; self.w } } #[doc = r"Value of the field"] pub struct CAN_IF2MCTL_TXIER { bits: bool, } impl CAN_IF2MCTL_TXIER { #[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 _CAN_IF2MCTL_TXIEW<'a> { w: &'a mut W, } impl<'a> _CAN_IF2MCTL_TXIEW<'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 << 11); self.w.bits |= ((value as u32) & 1) << 11; self.w } } #[doc = r"Value of the field"] pub struct CAN_IF2MCTL_UMASKR { bits: bool, } impl CAN_IF2MCTL_UMASKR { #[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 _CAN_IF2MCTL_UMASKW<'a> { w: &'a mut W, } impl<'a> _CAN_IF2MCTL_UMASKW<'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 << 12); self.w.bits |= ((value as u32) & 1) << 12; self.w } } #[doc = r"Value of the field"] pub struct CAN_IF2MCTL_INTPNDR { bits: bool, } impl CAN_IF2MCTL_INTPNDR { #[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 _CAN_IF2MCTL_INTPNDW<'a> { w: &'a mut W, } impl<'a> _CAN_IF2MCTL_INTPNDW<'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 << 13); self.w.bits |= ((value as u32) & 1) << 13; self.w } } #[doc = r"Value of the field"] pub struct CAN_IF2MCTL_MSGLSTR { bits: bool, } impl CAN_IF2MCTL_MSGLSTR { #[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 _CAN_IF2MCTL_MSGLSTW<'a> { w: &'a mut W, } impl<'a> _CAN_IF2MCTL_MSGLSTW<'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 << 14); self.w.bits |= ((value as u32) & 1) << 14; self.w } } #[doc = r"Value of the field"] pub struct CAN_IF2MCTL_NEWDATR { bits: bool, } impl CAN_IF2MCTL_NEWDATR { #[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 _CAN_IF2MCTL_NEWDATW<'a> { w: &'a mut W, } impl<'a> _CAN_IF2MCTL_NEWDATW<'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 << 15); self.w.bits |= ((value as u32) & 1) << 15; self.w } } impl R { #[doc = r"Value of the register as raw bits"] #[inline(always)] pub fn bits(&self) -> u32 { self.bits } #[doc = "Bits 0:3 - Data Length Code"] #[inline(always)] pub fn can_if2mctl_dlc(&self) -> CAN_IF2MCTL_DLCR { let bits = ((self.bits >> 0) & 15) as u8; CAN_IF2MCTL_DLCR { bits } } #[doc = "Bit 7 - End of Buffer"] #[inline(always)] pub fn can_if2mctl_eob(&self) -> CAN_IF2MCTL_EOBR { let bits = ((self.bits >> 7) & 1) != 0; CAN_IF2MCTL_EOBR { bits } } #[doc = "Bit 8 - Transmit Request"] #[inline(always)] pub fn can_if2mctl_txrqst(&self) -> CAN_IF2MCTL_TXRQSTR { let bits = ((self.bits >> 8) & 1) != 0; CAN_IF2MCTL_TXRQSTR { bits } } #[doc = "Bit 9 - Remote Enable"] #[inline(always)] pub fn can_if2mctl_rmten(&self) -> CAN_IF2MCTL_RMTENR { let bits = ((self.bits >> 9) & 1) != 0; CAN_IF2MCTL_RMTENR { bits } } #[doc = "Bit 10 - Receive Interrupt Enable"] #[inline(always)] pub fn can_if2mctl_rxie(&self) -> CAN_IF2MCTL_RXIER { let bits = ((self.bits >> 10) & 1) != 0; CAN_IF2MCTL_RXIER { bits } } #[doc = "Bit 11 - Transmit Interrupt Enable"] #[inline(always)] pub fn can_if2mctl_txie(&self) -> CAN_IF2MCTL_TXIER { let bits = ((self.bits >> 11) & 1) != 0; CAN_IF2MCTL_TXIER { bits } } #[doc = "Bit 12 - Use Acceptance Mask"] #[inline(always)] pub fn can_if2mctl_umask(&self) -> CAN_IF2MCTL_UMASKR { let bits = ((self.bits >> 12) & 1) != 0; CAN_IF2MCTL_UMASKR { bits } } #[doc = "Bit 13 - Interrupt Pending"] #[inline(always)] pub fn can_if2mctl_intpnd(&self) -> CAN_IF2MCTL_INTPNDR { let bits = ((self.bits >> 13) & 1) != 0; CAN_IF2MCTL_INTPNDR { bits } } #[doc = "Bit 14 - Message Lost"] #[inline(always)] pub fn can_if2mctl_msglst(&self) -> CAN_IF2MCTL_MSGLSTR { let bits = ((self.bits >> 14) & 1) != 0; CAN_IF2MCTL_MSGLSTR { bits } } #[doc = "Bit 15 - New Data"] #[inline(always)] pub fn can_if2mctl_newdat(&self) -> CAN_IF2MCTL_NEWDATR { let bits = ((self.bits >> 15) & 1) != 0; CAN_IF2MCTL_NEWDATR { bits } } } impl W { #[doc = r"Writes raw bits to the register"] #[inline(always)] pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { self.bits = bits; self } #[doc = "Bits 0:3 - Data Length Code"] #[inline(always)] pub fn can_if2mctl_dlc(&mut self) -> _CAN_IF2MCTL_DLCW { _CAN_IF2MCTL_DLCW { w: self } } #[doc = "Bit 7 - End of Buffer"] #[inline(always)] pub fn can_if2mctl_eob(&mut self) -> _CAN_IF2MCTL_EOBW { _CAN_IF2MCTL_EOBW { w: self } } #[doc = "Bit 8 - Transmit Request"] #[inline(always)] pub fn can_if2mctl_txrqst(&mut self) -> _CAN_IF2MCTL_TXRQSTW { _CAN_IF2MCTL_TXRQSTW { w: self } } #[doc = "Bit 9 - Remote Enable"] #[inline(always)] pub fn can_if2mctl_rmten(&mut self) -> _CAN_IF2MCTL_RMTENW { _CAN_IF2MCTL_RMTENW { w: self } } #[doc = "Bit 10 - Receive Interrupt Enable"] #[inline(always)] pub fn can_if2mctl_rxie(&mut self) -> _CAN_IF2MCTL_RXIEW { _CAN_IF2MCTL_RXIEW { w: self } } #[doc = "Bit 11 - Transmit Interrupt Enable"] #[inline(always)] pub fn can_if2mctl_txie(&mut self) -> _CAN_IF2MCTL_TXIEW { _CAN_IF2MCTL_TXIEW { w: self } } #[doc = "Bit 12 - Use Acceptance Mask"] #[inline(always)] pub fn can_if2mctl_umask(&mut self) -> _CAN_IF2MCTL_UMASKW { _CAN_IF2MCTL_UMASKW { w: self } } #[doc = "Bit 13 - Interrupt Pending"] #[inline(always)] pub fn can_if2mctl_intpnd(&mut self) -> _CAN_IF2MCTL_INTPNDW { _CAN_IF2MCTL_INTPNDW { w: self } } #[doc = "Bit 14 - Message Lost"] #[inline(always)] pub fn can_if2mctl_msglst(&mut self) -> _CAN_IF2MCTL_MSGLSTW { _CAN_IF2MCTL_MSGLSTW { w: self } } #[doc = "Bit 15 - New Data"] #[inline(always)] pub fn can_if2mctl_newdat(&mut self) -> _CAN_IF2MCTL_NEWDATW { _CAN_IF2MCTL_NEWDATW { w: self } } }
use winapi::um::winnt::*; #[repr(u32)] pub enum ProcessAccessMask { Terminate = PROCESS_TERMINATE, CreateThread = PROCESS_CREATE_THREAD, SetSessionId = PROCESS_SET_SESSIONID, VmOperation = PROCESS_VM_OPERATION, VmRead = PROCESS_VM_READ, VmWrite = PROCESS_VM_WRITE, DupHandle = PROCESS_DUP_HANDLE, CreateProcess = PROCESS_CREATE_PROCESS, SetQuota = PROCESS_SET_QUOTA, SetInformation = PROCESS_SET_INFORMATION, QueryInformation = PROCESS_QUERY_INFORMATION, SuspendResume = PROCESS_SUSPEND_RESUME, QueryLimitedInformation = PROCESS_QUERY_LIMITED_INFORMATION, SetLimitedInformation = PROCESS_SET_LIMITED_INFORMATION, }
// Copyright (c) 2017 Martijn Rijkeboer <mrr@sru-systems.com> // // 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. use crate::error::Error; use std::result; /// A specialized result type for Argon2 operations. pub type Result<T> = result::Result<T, Error>;
use thiserror::Error; use crate::direction::Direction; use crate::op::*; pub trait Game { fn is_second_round(&self) -> bool; fn stage(&self) -> u8; // 面 (1..=16) fn hero_x(&self) -> u8; fn hero_y(&self) -> u8; fn rand(&mut self) -> u8; fn try_shoot_aim(&mut self, x: u8, y: u8, speed_mask: u8, force_homing: bool); fn restore_music(&mut self); fn play_sound(&mut self, sound: u8); } #[derive(Debug, Error)] pub enum InterpretError { #[error("address {addr:#04X}: decode failed")] Decode { addr: usize, #[source] source: DecodeError, }, } pub type InterpretResult<T> = Result<T, InterpretError>; #[derive(Debug)] pub struct InterpreterInit { pub program: Vec<u8>, pub pc: usize, pub boss: bool, pub difficulty: u8, pub shot_with_rank: bool, // 低ランクでは自機狙い弾を撃たない pub accel_shot_with_rank: bool, // ランクが上がると自機狙い弾が高速化 pub homing_shot_with_rank: bool, // ランクが上がると自機狙い弾が誘導弾になる pub extra_act_with_rank: bool, // ランクが上がると移動後に再行動する pub accel_with_rank: bool, // ランクが上がると移動スピード増加 pub rank: u8, pub x: u8, pub y: u8, } impl InterpreterInit { pub fn init(self) -> Interpreter { assert!((0..=7).contains(&self.rank)); Interpreter { program: self.program, pc: self.pc, boss: self.boss, difficulty: self.difficulty, shot_with_rank: self.shot_with_rank, accel_shot_with_rank: self.accel_shot_with_rank, homing_shot_with_rank: self.homing_shot_with_rank, extra_act_with_rank: self.extra_act_with_rank, accel_with_rank: self.accel_with_rank, rank: self.rank, state: EnemyState::Alive, x: self.x, y: self.y, inv_x: false, inv_y: false, health: 0, sprite_idx: 0, part: 0, sleep_timer: 0, homing_timer: 0, loop_start_addr: self.pc, loop_counter: 0, jump_on_damage: 0, } } } #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub enum EnemyState { Alive, Dying, Leaving, } #[derive(Debug)] pub struct Interpreter { program: Vec<u8>, pc: usize, boss: bool, difficulty: u8, shot_with_rank: bool, accel_shot_with_rank: bool, homing_shot_with_rank: bool, extra_act_with_rank: bool, accel_with_rank: bool, rank: u8, state: EnemyState, x: u8, y: u8, inv_x: bool, inv_y: bool, health: u8, sprite_idx: u8, part: u8, sleep_timer: u8, homing_timer: u8, loop_start_addr: usize, loop_counter: u8, jump_on_damage: u8, } impl Interpreter { pub fn step<G: Game>(&mut self, game: &mut G) -> InterpretResult<()> { assert!(matches!(self.state, EnemyState::Alive)); if self.sleep_timer > 0 { self.sleep_timer -= 1; return Ok(()); } let mut do_try_homing = true; let mut do_try_extra_act = self.extra_act_with_rank; loop { // ホーミング処理(基本的には1回のみ) if do_try_homing && self.homing_timer > 0 { self.homing_timer -= 1; let dir = Direction::aim((self.x, self.y), (game.hero_x(), game.hero_y())); let (dx, dy) = dir.displacement_object(); self.x = self.x.wrapping_add(dx as u8); self.y = self.y.wrapping_add(dy as u8); let extra_act = self.clip(game, &mut do_try_extra_act); if extra_act { continue; } else { return Ok(()); } } do_try_homing = false; let op = self.fetch()?; match op { Op::Move(dir) => { // 低速移動は特定条件下で高速化 let dir = if (0..=0x1F).contains(&dir.index()) { if self.cond_accel1(game) { Direction::new(dir.index() + 0x10) } else if self.cond_accel2(game) { Direction::new(dir.index() + 0x20) } else { dir } } else { dir }; let (dx, dy) = dir.displacement_object(); let dx = if self.inv_x { -dx } else { dx }; let dy = if self.inv_y { -dy } else { dy }; self.x = self.x.wrapping_add(dx as u8); self.y = self.y.wrapping_add(dy as u8); let extra_act = self.clip(game, &mut do_try_extra_act); if !extra_act { return Ok(()); } } Op::Jump(addr) => { self.pc = usize::from(addr); } Op::SetSleepTimer(idx) => { self.sleep_timer = 4 * idx; return Ok(()); } Op::LoopBegin(idx) => { self.loop_start_addr = self.pc; self.loop_counter = idx; } Op::LoopEnd => { self.loop_counter = self.loop_counter.wrapping_sub(1); if self.loop_counter > 0 { self.pc = self.loop_start_addr; } } Op::ShootDirection(_dir) => { todo!(); } Op::SetSprite(idx) => { self.sprite_idx = idx; } Op::SetHomingTimer(idx) => { self.homing_timer = if idx == 0 { 252 } else { 4 * idx }; do_try_homing = true; } Op::SetInversion(inv_x, inv_y) => { self.inv_x = inv_x; self.inv_y = inv_y; } Op::SetPosition(x, y) => { self.x = x; self.y = y; } Op::SetJumpOnDamage(addr) => { assert!(!self.boss); self.jump_on_damage = addr; return Ok(()); } Op::UnsetJumpOnDamage => { assert!(!self.boss); self.jump_on_damage = 0; return Ok(()); } Op::SetHealth(health) => { assert!(self.boss); self.health = health; return Ok(()); } Op::IncrementSprite => { self.sprite_idx += 1; } Op::DecrementSprite => { self.sprite_idx -= 1; } Op::SetPart(part) => { self.part = part; } Op::RandomizeX(mask) => { self.x = (self.x & !mask) | (game.rand() & mask); } Op::RandomizeY(mask) => { self.y = (self.y & !mask) | (game.rand() & mask); } Op::BccX(addr) => { if self.x < game.hero_x() { self.pc = usize::from(addr); } } Op::BcsX(addr) => { if self.x >= game.hero_x() { self.pc = usize::from(addr); } } Op::BccY(addr) => { if self.y < game.hero_y() { self.pc = usize::from(addr); } } Op::BcsY(addr) => { if self.y >= game.hero_y() { self.pc = usize::from(addr); } } Op::ShootAim(_) => { if !self.cond_shoot_aim() { continue; } let (speed_mask, force_homing) = self.shoot_aim_param(game); game.try_shoot_aim(self.x, self.y, speed_mask, force_homing); } Op::RestoreMusic => { game.restore_music(); } Op::PlaySound(sound) => { game.play_sound(sound); } } } } pub fn damage<G: Game>(&mut self, _game: &mut G) { assert!(matches!(self.state, EnemyState::Alive)); if self.boss { if self.health == 0 { self.state = EnemyState::Dying; // TODO: 本来は撃破音が鳴る } else { self.health -= 1; // TODO: 本来はダメージ音が鳴る } } else { if self.jump_on_damage == 0 { self.state = EnemyState::Dying; // TODO: 本来は撃破音が鳴る } else { self.pc = usize::from(self.jump_on_damage); // TODO: 本来はダメージ音が鳴る } } } pub fn state(&self) -> EnemyState { self.state } pub fn x(&self) -> u8 { self.x } pub fn y(&self) -> u8 { self.y } pub fn sprite_index(&self) -> u8 { self.sprite_idx } fn fetch(&mut self) -> InterpretResult<Op> { let mut op = Op::decode(&self.program[self.pc..]).map_err(|e| InterpretError::Decode { addr: self.pc, source: e, })?; if self.boss { match op { Op::SetJumpOnDamage(addr) => op = Op::SetHealth(addr), Op::UnsetJumpOnDamage => op = Op::SetHealth(0), _ => {} } } self.pc += op.len(); Ok(op) } /// 画面外に出たら消滅させる。 /// また、do_try_extra_act が真の場合、再行動条件を満たしているか判定する。 /// 再行動するかどうかを返す。 fn clip<G: Game>(&mut self, game: &G, do_try_extra_act: &mut bool) -> bool { const CLIP_Y_MIN: u8 = 239; if self.y >= CLIP_Y_MIN { self.state = EnemyState::Leaving; return false; } if *do_try_extra_act && game.stage() >= self.difficulty && self.rank >= 4 { *do_try_extra_act = false; return true; } false } /// 自機狙い弾を撃つ条件を満たしているかどうかを返す。 fn cond_shoot_aim(&self) -> bool { !(self.shot_with_rank && self.rank < 4) } /// 自機狙い弾のパラメータ (スピード指定マスク, 誘導弾フラグ) を返す。 fn shoot_aim_param<G: Game>(&self, game: &G) -> (u8, bool) { // 誘導弾にする場合、スピード指定マスクは 0 にする。 if self.homing_shot_with_rank && game.is_second_round() && self.rank == 7 { (0, true) } else if self.accel_shot_with_rank { ((self.rank << 3) & 0x30, false) } else { (0, false) } } /// 移動スピード1段階増加条件を満たしているかどうかを返す。 fn cond_accel1<G: Game>(&self, game: &G) -> bool { self.accel_with_rank && game.stage() >= self.difficulty && (4..=6).contains(&self.rank) } /// 移動スピード2段階増加条件を満たしているかどうかを返す。 fn cond_accel2<G: Game>(&self, game: &G) -> bool { self.accel_with_rank && game.stage() >= self.difficulty && self.rank == 7 } }
//! Messages that can be emitted by contracts. /// Messages can be emitted by contracts and are processed after the contract execution completes. #[non_exhaustive] #[derive(Clone, Debug, cbor::Encode, cbor::Decode)] pub enum Message { /// Calls an arbitrary runtime method handler in a child context with an optional gas limit. /// /// The call is executed in the context of the smart contract as the caller within the same /// transaction. /// /// This can be used to call other smart contracts. #[cbor(rename = "call")] Call { #[cbor(optional, default)] id: u64, reply: NotifyReply, method: String, body: cbor::Value, #[cbor(optional)] max_gas: Option<u64>, #[cbor(optional)] data: Option<cbor::Value>, }, } /// Specifies when the caller (smart contract) wants to be notified of a reply. #[derive(Clone, Copy, Debug, PartialEq, Eq, cbor::Encode, cbor::Decode)] #[repr(u8)] pub enum NotifyReply { Never = 0, OnError = 1, OnSuccess = 2, Always = 3, } /// Replies to delivered messages. #[non_exhaustive] #[derive(Clone, Debug, cbor::Encode, cbor::Decode)] pub enum Reply { /// Reply from a call message. #[cbor(rename = "call")] Call { #[cbor(optional, default)] id: u64, result: CallResult, #[cbor(optional)] data: Option<cbor::Value>, }, } /// Call result. #[derive(Clone, Debug, cbor::Encode, cbor::Decode)] pub enum CallResult { #[cbor(rename = "ok")] Ok(cbor::Value), #[cbor(rename = "fail")] Failed { module: String, code: u32 }, } impl CallResult { /// Check whether the call result indicates a successful operation or not. pub fn is_success(&self) -> bool { match self { CallResult::Ok(_) => true, CallResult::Failed { .. } => false, } } } #[cfg(feature = "oasis-runtime-sdk")] impl From<oasis_runtime_sdk::module::CallResult> for CallResult { fn from(r: oasis_runtime_sdk::module::CallResult) -> Self { match r { oasis_runtime_sdk::module::CallResult::Ok(value) => Self::Ok(value), oasis_runtime_sdk::module::CallResult::Failed { module, code, .. } => { Self::Failed { module, code } } oasis_runtime_sdk::module::CallResult::Aborted(err) => { use oasis_runtime_sdk::error::Error; Self::Failed { module: err.module_name().to_string(), code: err.code(), } } } } }
//! Sequencer related error types. use serde::{Deserialize, Serialize}; /// Sequencer errors. #[derive(Debug, thiserror::Error)] pub enum SequencerError { /// Starknet specific errors. #[error(transparent)] StarknetError(#[from] StarknetError), /// Errors directly coming from reqwest #[error(transparent)] ReqwestError(#[from] reqwest::Error), /// Custom errors that we fidded with because the original error was either /// not informative enough or bloated #[error("error decoding response body: invalid error variant")] InvalidStarknetErrorVariant, } /// Used for deserializing specific Starknet sequencer error data. #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] pub struct StarknetError { pub code: StarknetErrorCode, pub message: String, // The `problems` field is intentionally omitted here // Let's deserialize it if it proves necessary } impl std::error::Error for StarknetError {} impl std::fmt::Display for StarknetError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{self:?}") } } /// Represents a starknet error code reported by the sequencer. #[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] #[serde(untagged)] pub enum StarknetErrorCode { Known(KnownStarknetErrorCode), Unknown(String), } impl From<KnownStarknetErrorCode> for StarknetErrorCode { fn from(value: KnownStarknetErrorCode) -> Self { Self::Known(value) } } /// Represents well-known starknet specific error codes reported by the sequencer. #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] pub enum KnownStarknetErrorCode { #[serde(rename = "StarknetErrorCode.BLOCK_NOT_FOUND")] BlockNotFound, #[serde(rename = "StarknetErrorCode.ENTRY_POINT_NOT_FOUND_IN_CONTRACT")] EntryPointNotFound, #[serde(rename = "StarknetErrorCode.OUT_OF_RANGE_CONTRACT_ADDRESS")] OutOfRangeContractAddress, #[serde(rename = "StarkErrorCode.SCHEMA_VALIDATION_ERROR")] SchemaValidationError, #[serde(rename = "StarknetErrorCode.TRANSACTION_FAILED")] TransactionFailed, #[serde(rename = "StarknetErrorCode.UNINITIALIZED_CONTRACT")] UninitializedContract, #[serde(rename = "StarknetErrorCode.OUT_OF_RANGE_BLOCK_HASH")] OutOfRangeBlockHash, #[serde(rename = "StarknetErrorCode.OUT_OF_RANGE_TRANSACTION_HASH")] OutOfRangeTransactionHash, #[serde(rename = "StarkErrorCode.MALFORMED_REQUEST")] MalformedRequest, #[serde(rename = "StarknetErrorCode.UNSUPPORTED_SELECTOR_FOR_FEE")] UnsupportedSelectorForFee, #[serde(rename = "StarknetErrorCode.INVALID_CONTRACT_DEFINITION")] InvalidContractDefinition, #[serde(rename = "StarknetErrorCode.NON_PERMITTED_CONTRACT")] NotPermittedContract, #[serde(rename = "StarknetErrorCode.UNDECLARED_CLASS")] UndeclaredClass, /// May be returned by the transaction write api. #[serde(rename = "StarknetErrorCode.TRANSACTION_LIMIT_EXCEEDED")] TransactionLimitExceeded, #[serde(rename = "StarknetErrorCode.INVALID_TRANSACTION_NONCE")] InvalidTransactionNonce, #[serde(rename = "StarknetErrorCode.OUT_OF_RANGE_FEE")] OutOfRangeFee, #[serde(rename = "StarknetErrorCode.INVALID_TRANSACTION_VERSION")] InvalidTransactionVersion, #[serde(rename = "StarknetErrorCode.INVALID_PROGRAM")] InvalidProgram, #[serde(rename = "StarknetErrorCode.DEPRECATED_TRANSACTION")] DeprecatedTransaction, #[serde(rename = "StarknetErrorCode.INVALID_COMPILED_CLASS_HASH")] InvalidCompiledClassHash, #[serde(rename = "StarknetErrorCode.COMPILATION_FAILED")] CompilationFailed, #[serde(rename = "StarknetErrorCode.UNAUTHORIZED_ENTRY_POINT_FOR_INVOKE")] UnauthorizedEntryPointForInvoke, #[serde(rename = "StarknetErrorCode.INVALID_CONTRACT_CLASS")] InvalidContractClass, #[serde(rename = "StarknetErrorCode.CLASS_ALREADY_DECLARED")] ClassAlreadyDeclared, #[serde(rename = "StarkErrorCode.INVALID_SIGNATURE")] InvalidSignature, #[serde(rename = "StarknetErrorCode.INSUFFICIENT_ACCOUNT_BALANCE")] InsufficientAccountBalance, #[serde(rename = "StarknetErrorCode.INSUFFICIENT_MAX_FEE")] InsufficientMaxFee, #[serde(rename = "StarknetErrorCode.VALIDATE_FAILURE")] ValidateFailure, #[serde(rename = "StarknetErrorCode.CONTRACT_BYTECODE_SIZE_TOO_LARGE")] ContractBytecodeSizeTooLarge, #[serde(rename = "StarknetErrorCode.CONTRACT_CLASS_OBJECT_SIZE_TOO_LARGE")] ContractClassObjectSizeTooLarge, #[serde(rename = "StarknetErrorCode.DUPLICATED_TRANSACTION")] DuplicatedTransaction, #[serde(rename = "StarknetErrorCode.INVALID_CONTRACT_CLASS_VERSION")] InvalidContractClassVersion, } #[cfg(test)] mod tests { use crate::error::KnownStarknetErrorCode; use super::StarknetErrorCode; #[test] fn test_known_error_code() { let e = serde_json::from_str::<StarknetErrorCode>(r#""StarknetErrorCode.BLOCK_NOT_FOUND""#) .unwrap(); assert_eq!(e, KnownStarknetErrorCode::BlockNotFound.into()) } #[test] fn test_unknown_error_code() { let e = serde_json::from_str::<StarknetErrorCode>(r#""StarknetErrorCode.UNKNOWN_ERROR""#) .unwrap(); assert_eq!( e, StarknetErrorCode::Unknown("StarknetErrorCode.UNKNOWN_ERROR".to_owned()) ) } }
#[doc = r"Value read from the register"] pub struct R { bits: u32, } #[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::HB16TIME2 { #[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() -> u32 { 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 EPI_HB16TIME2_RDWSMR { bits: bool, } impl EPI_HB16TIME2_RDWSMR { #[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 _EPI_HB16TIME2_RDWSMW<'a> { w: &'a mut W, } impl<'a> _EPI_HB16TIME2_RDWSMW<'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 u32) & 1) << 0; self.w } } #[doc = r"Value of the field"] pub struct EPI_HB16TIME2_WRWSMR { bits: bool, } impl EPI_HB16TIME2_WRWSMR { #[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 _EPI_HB16TIME2_WRWSMW<'a> { w: &'a mut W, } impl<'a> _EPI_HB16TIME2_WRWSMW<'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 u32) & 1) << 4; self.w } } #[doc = r"Value of the field"] pub struct EPI_HB16TIME2_CAPWIDTHR { bits: u8, } impl EPI_HB16TIME2_CAPWIDTHR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bits(&self) -> u8 { self.bits } } #[doc = r"Proxy"] pub struct _EPI_HB16TIME2_CAPWIDTHW<'a> { w: &'a mut W, } impl<'a> _EPI_HB16TIME2_CAPWIDTHW<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits &= !(3 << 12); self.w.bits |= ((value as u32) & 3) << 12; self.w } } #[doc = "Possible values of the field `EPI_HB16TIME2_PSRAMSZ`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum EPI_HB16TIME2_PSRAMSZR { #[doc = "No row size limitation"] EPI_HB16TIME2_PSRAMSZ_0, #[doc = "128 B"] EPI_HB16TIME2_PSRAMSZ_128B, #[doc = "256 B"] EPI_HB16TIME2_PSRAMSZ_256B, #[doc = "512 B"] EPI_HB16TIME2_PSRAMSZ_512B, #[doc = "1024 B"] EPI_HB16TIME2_PSRAMSZ_1KB, #[doc = "2048 B"] EPI_HB16TIME2_PSRAMSZ_2KB, #[doc = "4096 B"] EPI_HB16TIME2_PSRAMSZ_4KB, #[doc = "8192 B"] EPI_HB16TIME2_PSRAMSZ_8KB, } impl EPI_HB16TIME2_PSRAMSZR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bits(&self) -> u8 { match *self { EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_0 => 0, EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_128B => 1, EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_256B => 2, EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_512B => 3, EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_1KB => 4, EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_2KB => 5, EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_4KB => 6, EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_8KB => 7, } } #[allow(missing_docs)] #[doc(hidden)] #[inline(always)] pub fn _from(value: u8) -> EPI_HB16TIME2_PSRAMSZR { match value { 0 => EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_0, 1 => EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_128B, 2 => EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_256B, 3 => EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_512B, 4 => EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_1KB, 5 => EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_2KB, 6 => EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_4KB, 7 => EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_8KB, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `EPI_HB16TIME2_PSRAMSZ_0`"] #[inline(always)] pub fn is_epi_hb16time2_psramsz_0(&self) -> bool { *self == EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_0 } #[doc = "Checks if the value of the field is `EPI_HB16TIME2_PSRAMSZ_128B`"] #[inline(always)] pub fn is_epi_hb16time2_psramsz_128b(&self) -> bool { *self == EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_128B } #[doc = "Checks if the value of the field is `EPI_HB16TIME2_PSRAMSZ_256B`"] #[inline(always)] pub fn is_epi_hb16time2_psramsz_256b(&self) -> bool { *self == EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_256B } #[doc = "Checks if the value of the field is `EPI_HB16TIME2_PSRAMSZ_512B`"] #[inline(always)] pub fn is_epi_hb16time2_psramsz_512b(&self) -> bool { *self == EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_512B } #[doc = "Checks if the value of the field is `EPI_HB16TIME2_PSRAMSZ_1KB`"] #[inline(always)] pub fn is_epi_hb16time2_psramsz_1kb(&self) -> bool { *self == EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_1KB } #[doc = "Checks if the value of the field is `EPI_HB16TIME2_PSRAMSZ_2KB`"] #[inline(always)] pub fn is_epi_hb16time2_psramsz_2kb(&self) -> bool { *self == EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_2KB } #[doc = "Checks if the value of the field is `EPI_HB16TIME2_PSRAMSZ_4KB`"] #[inline(always)] pub fn is_epi_hb16time2_psramsz_4kb(&self) -> bool { *self == EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_4KB } #[doc = "Checks if the value of the field is `EPI_HB16TIME2_PSRAMSZ_8KB`"] #[inline(always)] pub fn is_epi_hb16time2_psramsz_8kb(&self) -> bool { *self == EPI_HB16TIME2_PSRAMSZR::EPI_HB16TIME2_PSRAMSZ_8KB } } #[doc = "Values that can be written to the field `EPI_HB16TIME2_PSRAMSZ`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum EPI_HB16TIME2_PSRAMSZW { #[doc = "No row size limitation"] EPI_HB16TIME2_PSRAMSZ_0, #[doc = "128 B"] EPI_HB16TIME2_PSRAMSZ_128B, #[doc = "256 B"] EPI_HB16TIME2_PSRAMSZ_256B, #[doc = "512 B"] EPI_HB16TIME2_PSRAMSZ_512B, #[doc = "1024 B"] EPI_HB16TIME2_PSRAMSZ_1KB, #[doc = "2048 B"] EPI_HB16TIME2_PSRAMSZ_2KB, #[doc = "4096 B"] EPI_HB16TIME2_PSRAMSZ_4KB, #[doc = "8192 B"] EPI_HB16TIME2_PSRAMSZ_8KB, } impl EPI_HB16TIME2_PSRAMSZW { #[allow(missing_docs)] #[doc(hidden)] #[inline(always)] pub fn _bits(&self) -> u8 { match *self { EPI_HB16TIME2_PSRAMSZW::EPI_HB16TIME2_PSRAMSZ_0 => 0, EPI_HB16TIME2_PSRAMSZW::EPI_HB16TIME2_PSRAMSZ_128B => 1, EPI_HB16TIME2_PSRAMSZW::EPI_HB16TIME2_PSRAMSZ_256B => 2, EPI_HB16TIME2_PSRAMSZW::EPI_HB16TIME2_PSRAMSZ_512B => 3, EPI_HB16TIME2_PSRAMSZW::EPI_HB16TIME2_PSRAMSZ_1KB => 4, EPI_HB16TIME2_PSRAMSZW::EPI_HB16TIME2_PSRAMSZ_2KB => 5, EPI_HB16TIME2_PSRAMSZW::EPI_HB16TIME2_PSRAMSZ_4KB => 6, EPI_HB16TIME2_PSRAMSZW::EPI_HB16TIME2_PSRAMSZ_8KB => 7, } } } #[doc = r"Proxy"] pub struct _EPI_HB16TIME2_PSRAMSZW<'a> { w: &'a mut W, } impl<'a> _EPI_HB16TIME2_PSRAMSZW<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: EPI_HB16TIME2_PSRAMSZW) -> &'a mut W { { self.bits(variant._bits()) } } #[doc = "No row size limitation"] #[inline(always)] pub fn epi_hb16time2_psramsz_0(self) -> &'a mut W { self.variant(EPI_HB16TIME2_PSRAMSZW::EPI_HB16TIME2_PSRAMSZ_0) } #[doc = "128 B"] #[inline(always)] pub fn epi_hb16time2_psramsz_128b(self) -> &'a mut W { self.variant(EPI_HB16TIME2_PSRAMSZW::EPI_HB16TIME2_PSRAMSZ_128B) } #[doc = "256 B"] #[inline(always)] pub fn epi_hb16time2_psramsz_256b(self) -> &'a mut W { self.variant(EPI_HB16TIME2_PSRAMSZW::EPI_HB16TIME2_PSRAMSZ_256B) } #[doc = "512 B"] #[inline(always)] pub fn epi_hb16time2_psramsz_512b(self) -> &'a mut W { self.variant(EPI_HB16TIME2_PSRAMSZW::EPI_HB16TIME2_PSRAMSZ_512B) } #[doc = "1024 B"] #[inline(always)] pub fn epi_hb16time2_psramsz_1kb(self) -> &'a mut W { self.variant(EPI_HB16TIME2_PSRAMSZW::EPI_HB16TIME2_PSRAMSZ_1KB) } #[doc = "2048 B"] #[inline(always)] pub fn epi_hb16time2_psramsz_2kb(self) -> &'a mut W { self.variant(EPI_HB16TIME2_PSRAMSZW::EPI_HB16TIME2_PSRAMSZ_2KB) } #[doc = "4096 B"] #[inline(always)] pub fn epi_hb16time2_psramsz_4kb(self) -> &'a mut W { self.variant(EPI_HB16TIME2_PSRAMSZW::EPI_HB16TIME2_PSRAMSZ_4KB) } #[doc = "8192 B"] #[inline(always)] pub fn epi_hb16time2_psramsz_8kb(self) -> &'a mut W { self.variant(EPI_HB16TIME2_PSRAMSZW::EPI_HB16TIME2_PSRAMSZ_8KB) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits &= !(7 << 16); self.w.bits |= ((value as u32) & 7) << 16; self.w } } #[doc = r"Value of the field"] pub struct EPI_HB16TIME2_IRDYDLYR { bits: u8, } impl EPI_HB16TIME2_IRDYDLYR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bits(&self) -> u8 { self.bits } } #[doc = r"Proxy"] pub struct _EPI_HB16TIME2_IRDYDLYW<'a> { w: &'a mut W, } impl<'a> _EPI_HB16TIME2_IRDYDLYW<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits &= !(3 << 24); self.w.bits |= ((value as u32) & 3) << 24; self.w } } impl R { #[doc = r"Value of the register as raw bits"] #[inline(always)] pub fn bits(&self) -> u32 { self.bits } #[doc = "Bit 0 - CS1n Read Wait State Minus One"] #[inline(always)] pub fn epi_hb16time2_rdwsm(&self) -> EPI_HB16TIME2_RDWSMR { let bits = ((self.bits >> 0) & 1) != 0; EPI_HB16TIME2_RDWSMR { bits } } #[doc = "Bit 4 - CS1n Write Wait State Minus One"] #[inline(always)] pub fn epi_hb16time2_wrwsm(&self) -> EPI_HB16TIME2_WRWSMR { let bits = ((self.bits >> 4) & 1) != 0; EPI_HB16TIME2_WRWSMR { bits } } #[doc = "Bits 12:13 - CS1n Inter-transfer Capture Width"] #[inline(always)] pub fn epi_hb16time2_capwidth(&self) -> EPI_HB16TIME2_CAPWIDTHR { let bits = ((self.bits >> 12) & 3) as u8; EPI_HB16TIME2_CAPWIDTHR { bits } } #[doc = "Bits 16:18 - PSRAM Row Size"] #[inline(always)] pub fn epi_hb16time2_psramsz(&self) -> EPI_HB16TIME2_PSRAMSZR { EPI_HB16TIME2_PSRAMSZR::_from(((self.bits >> 16) & 7) as u8) } #[doc = "Bits 24:25 - CS1n Input Ready Delay"] #[inline(always)] pub fn epi_hb16time2_irdydly(&self) -> EPI_HB16TIME2_IRDYDLYR { let bits = ((self.bits >> 24) & 3) as u8; EPI_HB16TIME2_IRDYDLYR { bits } } } impl W { #[doc = r"Writes raw bits to the register"] #[inline(always)] pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { self.bits = bits; self } #[doc = "Bit 0 - CS1n Read Wait State Minus One"] #[inline(always)] pub fn epi_hb16time2_rdwsm(&mut self) -> _EPI_HB16TIME2_RDWSMW { _EPI_HB16TIME2_RDWSMW { w: self } } #[doc = "Bit 4 - CS1n Write Wait State Minus One"] #[inline(always)] pub fn epi_hb16time2_wrwsm(&mut self) -> _EPI_HB16TIME2_WRWSMW { _EPI_HB16TIME2_WRWSMW { w: self } } #[doc = "Bits 12:13 - CS1n Inter-transfer Capture Width"] #[inline(always)] pub fn epi_hb16time2_capwidth(&mut self) -> _EPI_HB16TIME2_CAPWIDTHW { _EPI_HB16TIME2_CAPWIDTHW { w: self } } #[doc = "Bits 16:18 - PSRAM Row Size"] #[inline(always)] pub fn epi_hb16time2_psramsz(&mut self) -> _EPI_HB16TIME2_PSRAMSZW { _EPI_HB16TIME2_PSRAMSZW { w: self } } #[doc = "Bits 24:25 - CS1n Input Ready Delay"] #[inline(always)] pub fn epi_hb16time2_irdydly(&mut self) -> _EPI_HB16TIME2_IRDYDLYW { _EPI_HB16TIME2_IRDYDLYW { w: self } } }
use anyhow::{self, Context}; use std::fs; use std::thread; use ggez::{self, ContextBuilder, GameResult}; use ggez::conf::{WindowSetup, WindowMode}; use ggez::event::{self, EventHandler}; use ggez::graphics::{self, Rect}; use ggez::input::keyboard::{KeyCode, KeyMods}; use ggez::timer; use tinyfiledialogs; use crate::chip8::{Chip8, Chip8Output}; use crate::ui::{Assets, AssemblyDisplay, Chip8Display, HelpDisplay, RegisterDisplay}; pub struct ChipperUI { chip8: Chip8, assets: Assets, help_display: HelpDisplay, register_display: RegisterDisplay, chip8_display: Chip8Display, assembly_window: AssemblyDisplay, } impl ChipperUI { const WIDTH: f32 = RegisterDisplay::WIDTH + Chip8Display::WIDTH + AssemblyDisplay::WIDTH; const HEIGHT: f32 = Chip8Display::HEIGHT; pub fn run() -> anyhow::Result<()> { // Make a Context. let (mut ctx, mut event_loop) = ContextBuilder::new("chipper", "Jake Woods") .window_setup(WindowSetup::default().title("Chipper")) .window_mode(WindowMode::default().dimensions(ChipperUI::WIDTH, ChipperUI::HEIGHT)) .build() .context("Could not create ggez context!")?; let mut chipper_ui = ChipperUI::new(&mut ctx); event::run(&mut ctx, &mut event_loop, &mut chipper_ui) .context("Event loop error") } pub fn new(ctx: &mut ggez::Context) -> ChipperUI { let assets = Assets::load(ctx); let chip8 = Chip8::new_with_default_rom(); let help_display = HelpDisplay::new(&assets, 20.0, 0.0); let register_display = RegisterDisplay::new(20.0, HelpDisplay::HEIGHT); let chip8_display = Chip8Display::new(ctx, &chip8, RegisterDisplay::WIDTH, 0.0); let assembly_window = AssemblyDisplay::new(RegisterDisplay::WIDTH + Chip8Display::WIDTH, 0.0); ChipperUI { assets, chip8, help_display, register_display, chip8_display, assembly_window } } fn load_rom_from_dialog(&mut self) -> anyhow::Result<()> { let current_dir = std::env::current_dir() .ok() .map(|x| x.to_string_lossy().into_owned()) .unwrap_or(String::new().into()); if let Some(file_path) = tinyfiledialogs::open_file_dialog("Choose a Chip 8 ROM", &current_dir, None) { let rom = fs::read(&file_path) .with_context(|| format!("Failed to read ROM from path: {}", file_path))?; self.chip8 = Chip8::new_with_rom(rom); self.assembly_window.refresh(&self.assets, &self.chip8); } Ok(()) } fn refresh_chip8(&mut self, ctx: &mut ggez::Context, chip8_output: Chip8Output) -> GameResult<()> { if chip8_output == Chip8Output::Tick || chip8_output == Chip8Output::Redraw { self.register_display.update(&self.assets, &self.chip8)?; self.assembly_window.update(ctx, &self.assets, &self.chip8)?; } if chip8_output == Chip8Output::Redraw { self.chip8_display.update(ctx, &self.chip8) } Ok(()) } } impl EventHandler for ChipperUI { fn resize_event(&mut self, ctx: &mut ggez::Context, _width: f32, _height: f32) { graphics::set_screen_coordinates(ctx, Rect::new(0.0, 0.0, ChipperUI::WIDTH, ChipperUI::HEIGHT)) .expect("Failed to set screen coordinates"); } fn key_down_event(&mut self, ctx: &mut ggez::Context, keycode: KeyCode, keymods: KeyMods, _repeat: bool) { match keycode { KeyCode::F2 => self.load_rom_from_dialog().expect("Failed to load ROM"), KeyCode::F3 => { self.load_rom_from_dialog().expect("Failed to load ROM"); self.chip8.debug_mode = true; } KeyCode::F5 => self.chip8.debug_mode = !self.chip8.debug_mode, KeyCode::F6 => { let chip8_output = self.chip8.step() .expect("Failed to step chip8"); self.refresh_chip8(ctx, chip8_output) .expect("Failed to refresh chip8"); }, KeyCode::Key1 => self.chip8.press_key(0x1), KeyCode::Key2 => self.chip8.press_key(0x2), KeyCode::Key3 => self.chip8.press_key(0x3), KeyCode::Key4 => self.chip8.press_key(0xC), KeyCode::Q => self.chip8.press_key(0x4), KeyCode::W => self.chip8.press_key(0x5), KeyCode::E => self.chip8.press_key(0x6), KeyCode::R => self.chip8.press_key(0xD), KeyCode::A => self.chip8.press_key(0x7), KeyCode::S => self.chip8.press_key(0x8), KeyCode::D => self.chip8.press_key(0x9), KeyCode::F => self.chip8.press_key(0xE), KeyCode::Z => self.chip8.press_key(0xA), KeyCode::X => self.chip8.press_key(0x0), KeyCode::C => self.chip8.press_key(0xB), KeyCode::V => self.chip8.press_key(0xF), _ => {} } match (keymods, keycode) { (KeyMods::SHIFT, KeyCode::F1) => println!("{:?}", self.chip8.gpu), _ => {} } } fn key_up_event(&mut self, _ctx: &mut ggez::Context, keycode: KeyCode, _keymods: KeyMods) { match keycode { KeyCode::Key1 => self.chip8.release_key(0x1), KeyCode::Key2 => self.chip8.release_key(0x2), KeyCode::Key3 => self.chip8.release_key(0x3), KeyCode::Key4 => self.chip8.release_key(0xC), KeyCode::Q => self.chip8.release_key(0x4), KeyCode::W => self.chip8.release_key(0x5), KeyCode::E => self.chip8.release_key(0x6), KeyCode::R => self.chip8.release_key(0xD), KeyCode::A => self.chip8.release_key(0x7), KeyCode::S => self.chip8.release_key(0x8), KeyCode::D => self.chip8.release_key(0x9), KeyCode::F => self.chip8.release_key(0xE), KeyCode::Z => self.chip8.release_key(0xA), KeyCode::X => self.chip8.release_key(0x0), KeyCode::C => self.chip8.release_key(0xB), KeyCode::V => self.chip8.release_key(0xF), _ => {} } } fn update(&mut self, ctx: &mut ggez::Context) -> GameResult<()> { let delta_time = timer::delta(ctx); let chip8_output = self.chip8.tick(delta_time) .expect("Failed to tick chip8"); self.refresh_chip8(ctx, chip8_output)?; Ok(()) } fn draw(&mut self, ctx: &mut ggez::Context) -> GameResult<()> { graphics::clear(ctx, graphics::BLACK); self.chip8_display.draw(ctx)?; self.assembly_window.draw(ctx)?; self.help_display.draw(ctx)?; self.register_display.draw(ctx)?; graphics::present(ctx)?; // We don't need to run faster then the chip8 clock speed and // we can tolerate longer sleeps by simulating multiple cycles // in the same step. // // This means we can rely on sleep to help avoid hammering the CPU thread::sleep(self.chip8.clock_speed); Ok(()) } }
//! Win32-specific implementations and API extensions. pub(crate) mod ffi; pub(crate) mod imp; // Required re-exports pub(crate) use imp::spawn_window; pub(crate) type WindowRepr = imp::WindowImpl; // Bonus pub use ffi::{HINSTANCE, HMONITOR, HWND}; pub use imp::{this_hinstance, WindowExt, WindowBuilderExt};
//use yew::services::console::ConsoleService; pub struct App { selected: i32, message: String, } pub enum Msg { Select(i32), StartFetch, FinishFetch(String), } impl yew::Component for App { type Message = Msg; type Properties = (); fn create(_: &yew::Context<Self>) -> Self { App { selected: 0, message: "Nothing are fetched yet.".to_string(), } } fn update(&mut self, ctx: &yew::Context<Self>, msg: Self::Message) -> bool { match msg { Msg::Select(selected) => { self.selected = selected; true } Msg::StartFetch => { let path = if 0 == self.selected { "/red.json" } else { "/green.json" }; let req = gloo_net::http::Request::get(path); ctx.link().send_future(async { let response = req.send().await; gloo_console::log!( "response:", wasm_bindgen::JsValue::from(format!("{:?}", response)) ); match response { Ok(resp) => match resp.text().await { Ok(body) => Msg::FinishFetch(body), Err(err) => Msg::FinishFetch(err.to_string()), }, Err(err) => Msg::FinishFetch(err.to_string()), } }); self.message = "Fetching...".to_string(); true } Msg::FinishFetch(resp_text) => { self.message = resp_text; true } } } fn view(&self, ctx: &yew::Context<Self>) -> yew::Html { use yew::html; html! { <> <input type="radio" id="selector0" name="selector" value="0" checked={0==self.selected} onchange={ ctx.link().callback(|_| Msg::Select(0)) } /> <label for="selector0">{" red.json" }</label> <input type="radio" id="selector1" name="selector" value="1" checked={1==self.selected} onchange={ ctx.link().callback(|_| Msg::Select(1)) } /> <label for="selector1">{" green.json" }</label> <br /> <button onclick={ ctx.link().callback(|_| Msg::StartFetch) }>{"Fetch"}</button> <br /> <p>{ &self.message }</p> </> } } }
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "Devices_Geolocation_Geofencing")] pub mod Geofencing; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct AltitudeReferenceSystem(pub i32); impl AltitudeReferenceSystem { pub const Unspecified: AltitudeReferenceSystem = AltitudeReferenceSystem(0i32); pub const Terrain: AltitudeReferenceSystem = AltitudeReferenceSystem(1i32); pub const Ellipsoid: AltitudeReferenceSystem = AltitudeReferenceSystem(2i32); pub const Geoid: AltitudeReferenceSystem = AltitudeReferenceSystem(3i32); pub const Surface: AltitudeReferenceSystem = AltitudeReferenceSystem(4i32); } impl ::core::convert::From<i32> for AltitudeReferenceSystem { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for AltitudeReferenceSystem { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for AltitudeReferenceSystem { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Devices.Geolocation.AltitudeReferenceSystem;i4)"); } impl ::windows::core::DefaultType for AltitudeReferenceSystem { type DefaultType = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct BasicGeoposition { pub Latitude: f64, pub Longitude: f64, pub Altitude: f64, } impl BasicGeoposition {} impl ::core::default::Default for BasicGeoposition { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for BasicGeoposition { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("BasicGeoposition").field("Latitude", &self.Latitude).field("Longitude", &self.Longitude).field("Altitude", &self.Altitude).finish() } } impl ::core::cmp::PartialEq for BasicGeoposition { fn eq(&self, other: &Self) -> bool { self.Latitude == other.Latitude && self.Longitude == other.Longitude && self.Altitude == other.Altitude } } impl ::core::cmp::Eq for BasicGeoposition {} unsafe impl ::windows::core::Abi for BasicGeoposition { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for BasicGeoposition { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"struct(Windows.Devices.Geolocation.BasicGeoposition;f8;f8;f8)"); } impl ::windows::core::DefaultType for BasicGeoposition { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct CivicAddress(pub ::windows::core::IInspectable); impl CivicAddress { pub fn Country(&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 State(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn City(&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 PostalCode(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn Timestamp(&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).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::DateTime>(result__) } } } unsafe impl ::windows::core::RuntimeType for CivicAddress { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Geolocation.CivicAddress;{a8567a1a-64f4-4d48-bcea-f6b008eca34c})"); } unsafe impl ::windows::core::Interface for CivicAddress { type Vtable = ICivicAddress_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa8567a1a_64f4_4d48_bcea_f6b008eca34c); } impl ::windows::core::RuntimeName for CivicAddress { const NAME: &'static str = "Windows.Devices.Geolocation.CivicAddress"; } impl ::core::convert::From<CivicAddress> for ::windows::core::IUnknown { fn from(value: CivicAddress) -> Self { value.0 .0 } } impl ::core::convert::From<&CivicAddress> for ::windows::core::IUnknown { fn from(value: &CivicAddress) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for CivicAddress { 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 CivicAddress { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<CivicAddress> for ::windows::core::IInspectable { fn from(value: CivicAddress) -> Self { value.0 } } impl ::core::convert::From<&CivicAddress> for ::windows::core::IInspectable { fn from(value: &CivicAddress) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for CivicAddress { 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 CivicAddress { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for CivicAddress {} unsafe impl ::core::marker::Sync for CivicAddress {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct GeoboundingBox(pub ::windows::core::IInspectable); impl GeoboundingBox { pub fn NorthwestCorner(&self) -> ::windows::core::Result<BasicGeoposition> { let this = self; unsafe { let mut result__: BasicGeoposition = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BasicGeoposition>(result__) } } pub fn SoutheastCorner(&self) -> ::windows::core::Result<BasicGeoposition> { let this = self; unsafe { let mut result__: BasicGeoposition = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BasicGeoposition>(result__) } } pub fn Center(&self) -> ::windows::core::Result<BasicGeoposition> { let this = self; unsafe { let mut result__: BasicGeoposition = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BasicGeoposition>(result__) } } pub fn MinAltitude(&self) -> ::windows::core::Result<f64> { let this = self; unsafe { let mut result__: f64 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<f64>(result__) } } pub fn MaxAltitude(&self) -> ::windows::core::Result<f64> { let this = self; unsafe { let mut result__: f64 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<f64>(result__) } } pub fn GeoshapeType(&self) -> ::windows::core::Result<GeoshapeType> { let this = &::windows::core::Interface::cast::<IGeoshape>(self)?; unsafe { let mut result__: GeoshapeType = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<GeoshapeType>(result__) } } pub fn SpatialReferenceId(&self) -> ::windows::core::Result<u32> { let this = &::windows::core::Interface::cast::<IGeoshape>(self)?; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn AltitudeReferenceSystem(&self) -> ::windows::core::Result<AltitudeReferenceSystem> { let this = &::windows::core::Interface::cast::<IGeoshape>(self)?; unsafe { let mut result__: AltitudeReferenceSystem = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<AltitudeReferenceSystem>(result__) } } pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, BasicGeoposition>, Param1: ::windows::core::IntoParam<'a, BasicGeoposition>>(northwestcorner: Param0, southeastcorner: Param1) -> ::windows::core::Result<GeoboundingBox> { Self::IGeoboundingBoxFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), northwestcorner.into_param().abi(), southeastcorner.into_param().abi(), &mut result__).from_abi::<GeoboundingBox>(result__) }) } pub fn CreateWithAltitudeReference<'a, Param0: ::windows::core::IntoParam<'a, BasicGeoposition>, Param1: ::windows::core::IntoParam<'a, BasicGeoposition>>(northwestcorner: Param0, southeastcorner: Param1, altitudereferencesystem: AltitudeReferenceSystem) -> ::windows::core::Result<GeoboundingBox> { Self::IGeoboundingBoxFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), northwestcorner.into_param().abi(), southeastcorner.into_param().abi(), altitudereferencesystem, &mut result__).from_abi::<GeoboundingBox>(result__) }) } pub fn CreateWithAltitudeReferenceAndSpatialReference<'a, Param0: ::windows::core::IntoParam<'a, BasicGeoposition>, Param1: ::windows::core::IntoParam<'a, BasicGeoposition>>(northwestcorner: Param0, southeastcorner: Param1, altitudereferencesystem: AltitudeReferenceSystem, spatialreferenceid: u32) -> ::windows::core::Result<GeoboundingBox> { Self::IGeoboundingBoxFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), northwestcorner.into_param().abi(), southeastcorner.into_param().abi(), altitudereferencesystem, spatialreferenceid, &mut result__).from_abi::<GeoboundingBox>(result__) }) } #[cfg(feature = "Foundation_Collections")] pub fn TryCompute<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IIterable<BasicGeoposition>>>(positions: Param0) -> ::windows::core::Result<GeoboundingBox> { Self::IGeoboundingBoxStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), positions.into_param().abi(), &mut result__).from_abi::<GeoboundingBox>(result__) }) } #[cfg(feature = "Foundation_Collections")] pub fn TryComputeWithAltitudeReference<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IIterable<BasicGeoposition>>>(positions: Param0, altituderefsystem: AltitudeReferenceSystem) -> ::windows::core::Result<GeoboundingBox> { Self::IGeoboundingBoxStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), positions.into_param().abi(), altituderefsystem, &mut result__).from_abi::<GeoboundingBox>(result__) }) } #[cfg(feature = "Foundation_Collections")] pub fn TryComputeWithAltitudeReferenceAndSpatialReference<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IIterable<BasicGeoposition>>>(positions: Param0, altituderefsystem: AltitudeReferenceSystem, spatialreferenceid: u32) -> ::windows::core::Result<GeoboundingBox> { Self::IGeoboundingBoxStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), positions.into_param().abi(), altituderefsystem, spatialreferenceid, &mut result__).from_abi::<GeoboundingBox>(result__) }) } pub fn IGeoboundingBoxFactory<R, F: FnOnce(&IGeoboundingBoxFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<GeoboundingBox, IGeoboundingBoxFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn IGeoboundingBoxStatics<R, F: FnOnce(&IGeoboundingBoxStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<GeoboundingBox, IGeoboundingBoxStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for GeoboundingBox { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Geolocation.GeoboundingBox;{0896c80b-274f-43da-9a06-cbfcdaeb4ec2})"); } unsafe impl ::windows::core::Interface for GeoboundingBox { type Vtable = IGeoboundingBox_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0896c80b_274f_43da_9a06_cbfcdaeb4ec2); } impl ::windows::core::RuntimeName for GeoboundingBox { const NAME: &'static str = "Windows.Devices.Geolocation.GeoboundingBox"; } impl ::core::convert::From<GeoboundingBox> for ::windows::core::IUnknown { fn from(value: GeoboundingBox) -> Self { value.0 .0 } } impl ::core::convert::From<&GeoboundingBox> for ::windows::core::IUnknown { fn from(value: &GeoboundingBox) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for GeoboundingBox { 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 GeoboundingBox { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<GeoboundingBox> for ::windows::core::IInspectable { fn from(value: GeoboundingBox) -> Self { value.0 } } impl ::core::convert::From<&GeoboundingBox> for ::windows::core::IInspectable { fn from(value: &GeoboundingBox) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for GeoboundingBox { 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 GeoboundingBox { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<GeoboundingBox> for IGeoshape { type Error = ::windows::core::Error; fn try_from(value: GeoboundingBox) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&GeoboundingBox> for IGeoshape { type Error = ::windows::core::Error; fn try_from(value: &GeoboundingBox) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IGeoshape> for GeoboundingBox { fn into_param(self) -> ::windows::core::Param<'a, IGeoshape> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IGeoshape> for &GeoboundingBox { fn into_param(self) -> ::windows::core::Param<'a, IGeoshape> { ::core::convert::TryInto::<IGeoshape>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for GeoboundingBox {} unsafe impl ::core::marker::Sync for GeoboundingBox {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct Geocircle(pub ::windows::core::IInspectable); impl Geocircle { pub fn Center(&self) -> ::windows::core::Result<BasicGeoposition> { let this = self; unsafe { let mut result__: BasicGeoposition = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BasicGeoposition>(result__) } } pub fn Radius(&self) -> ::windows::core::Result<f64> { let this = self; unsafe { let mut result__: f64 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<f64>(result__) } } pub fn GeoshapeType(&self) -> ::windows::core::Result<GeoshapeType> { let this = &::windows::core::Interface::cast::<IGeoshape>(self)?; unsafe { let mut result__: GeoshapeType = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<GeoshapeType>(result__) } } pub fn SpatialReferenceId(&self) -> ::windows::core::Result<u32> { let this = &::windows::core::Interface::cast::<IGeoshape>(self)?; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn AltitudeReferenceSystem(&self) -> ::windows::core::Result<AltitudeReferenceSystem> { let this = &::windows::core::Interface::cast::<IGeoshape>(self)?; unsafe { let mut result__: AltitudeReferenceSystem = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<AltitudeReferenceSystem>(result__) } } pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, BasicGeoposition>>(position: Param0, radius: f64) -> ::windows::core::Result<Geocircle> { Self::IGeocircleFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), position.into_param().abi(), radius, &mut result__).from_abi::<Geocircle>(result__) }) } pub fn CreateWithAltitudeReferenceSystem<'a, Param0: ::windows::core::IntoParam<'a, BasicGeoposition>>(position: Param0, radius: f64, altitudereferencesystem: AltitudeReferenceSystem) -> ::windows::core::Result<Geocircle> { Self::IGeocircleFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), position.into_param().abi(), radius, altitudereferencesystem, &mut result__).from_abi::<Geocircle>(result__) }) } pub fn CreateWithAltitudeReferenceSystemAndSpatialReferenceId<'a, Param0: ::windows::core::IntoParam<'a, BasicGeoposition>>(position: Param0, radius: f64, altitudereferencesystem: AltitudeReferenceSystem, spatialreferenceid: u32) -> ::windows::core::Result<Geocircle> { Self::IGeocircleFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), position.into_param().abi(), radius, altitudereferencesystem, spatialreferenceid, &mut result__).from_abi::<Geocircle>(result__) }) } pub fn IGeocircleFactory<R, F: FnOnce(&IGeocircleFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<Geocircle, IGeocircleFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for Geocircle { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Geolocation.Geocircle;{39e45843-a7f9-4e63-92a7-ba0c28d124b1})"); } unsafe impl ::windows::core::Interface for Geocircle { type Vtable = IGeocircle_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x39e45843_a7f9_4e63_92a7_ba0c28d124b1); } impl ::windows::core::RuntimeName for Geocircle { const NAME: &'static str = "Windows.Devices.Geolocation.Geocircle"; } impl ::core::convert::From<Geocircle> for ::windows::core::IUnknown { fn from(value: Geocircle) -> Self { value.0 .0 } } impl ::core::convert::From<&Geocircle> for ::windows::core::IUnknown { fn from(value: &Geocircle) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for Geocircle { 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 Geocircle { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<Geocircle> for ::windows::core::IInspectable { fn from(value: Geocircle) -> Self { value.0 } } impl ::core::convert::From<&Geocircle> for ::windows::core::IInspectable { fn from(value: &Geocircle) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for Geocircle { 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 Geocircle { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<Geocircle> for IGeoshape { type Error = ::windows::core::Error; fn try_from(value: Geocircle) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&Geocircle> for IGeoshape { type Error = ::windows::core::Error; fn try_from(value: &Geocircle) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IGeoshape> for Geocircle { fn into_param(self) -> ::windows::core::Param<'a, IGeoshape> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IGeoshape> for &Geocircle { fn into_param(self) -> ::windows::core::Param<'a, IGeoshape> { ::core::convert::TryInto::<IGeoshape>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for Geocircle {} unsafe impl ::core::marker::Sync for Geocircle {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct Geocoordinate(pub ::windows::core::IInspectable); impl Geocoordinate { #[cfg(feature = "deprecated")] pub fn Latitude(&self) -> ::windows::core::Result<f64> { let this = self; unsafe { let mut result__: f64 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<f64>(result__) } } #[cfg(feature = "deprecated")] pub fn Longitude(&self) -> ::windows::core::Result<f64> { let this = self; unsafe { let mut result__: f64 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<f64>(result__) } } #[cfg(feature = "deprecated")] #[cfg(feature = "Foundation")] pub fn Altitude(&self) -> ::windows::core::Result<super::super::Foundation::IReference<f64>> { 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::IReference<f64>>(result__) } } pub fn Accuracy(&self) -> ::windows::core::Result<f64> { let this = self; unsafe { let mut result__: f64 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<f64>(result__) } } #[cfg(feature = "Foundation")] pub fn AltitudeAccuracy(&self) -> ::windows::core::Result<super::super::Foundation::IReference<f64>> { 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::IReference<f64>>(result__) } } #[cfg(feature = "Foundation")] pub fn Heading(&self) -> ::windows::core::Result<super::super::Foundation::IReference<f64>> { 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::IReference<f64>>(result__) } } #[cfg(feature = "Foundation")] pub fn Speed(&self) -> ::windows::core::Result<super::super::Foundation::IReference<f64>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IReference<f64>>(result__) } } #[cfg(feature = "Foundation")] pub fn Timestamp(&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__) } } pub fn Point(&self) -> ::windows::core::Result<Geopoint> { let this = &::windows::core::Interface::cast::<IGeocoordinateWithPoint>(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::<Geopoint>(result__) } } pub fn PositionSource(&self) -> ::windows::core::Result<PositionSource> { let this = &::windows::core::Interface::cast::<IGeocoordinateWithPositionData>(self)?; unsafe { let mut result__: PositionSource = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<PositionSource>(result__) } } pub fn SatelliteData(&self) -> ::windows::core::Result<GeocoordinateSatelliteData> { let this = &::windows::core::Interface::cast::<IGeocoordinateWithPositionData>(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::<GeocoordinateSatelliteData>(result__) } } #[cfg(feature = "Foundation")] pub fn PositionSourceTimestamp(&self) -> ::windows::core::Result<super::super::Foundation::IReference<super::super::Foundation::DateTime>> { let this = &::windows::core::Interface::cast::<IGeocoordinateWithPositionSourceTimestamp>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IReference<super::super::Foundation::DateTime>>(result__) } } pub fn IsRemoteSource(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<IGeocoordinateWithRemoteSource>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } } unsafe impl ::windows::core::RuntimeType for Geocoordinate { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Geolocation.Geocoordinate;{ee21a3aa-976a-4c70-803d-083ea55bcbc4})"); } unsafe impl ::windows::core::Interface for Geocoordinate { type Vtable = IGeocoordinate_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xee21a3aa_976a_4c70_803d_083ea55bcbc4); } impl ::windows::core::RuntimeName for Geocoordinate { const NAME: &'static str = "Windows.Devices.Geolocation.Geocoordinate"; } impl ::core::convert::From<Geocoordinate> for ::windows::core::IUnknown { fn from(value: Geocoordinate) -> Self { value.0 .0 } } impl ::core::convert::From<&Geocoordinate> for ::windows::core::IUnknown { fn from(value: &Geocoordinate) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for Geocoordinate { 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 Geocoordinate { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<Geocoordinate> for ::windows::core::IInspectable { fn from(value: Geocoordinate) -> Self { value.0 } } impl ::core::convert::From<&Geocoordinate> for ::windows::core::IInspectable { fn from(value: &Geocoordinate) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for Geocoordinate { 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 Geocoordinate { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for Geocoordinate {} unsafe impl ::core::marker::Sync for Geocoordinate {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct GeocoordinateSatelliteData(pub ::windows::core::IInspectable); impl GeocoordinateSatelliteData { #[cfg(feature = "Foundation")] pub fn PositionDilutionOfPrecision(&self) -> ::windows::core::Result<super::super::Foundation::IReference<f64>> { 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::IReference<f64>>(result__) } } #[cfg(feature = "Foundation")] pub fn HorizontalDilutionOfPrecision(&self) -> ::windows::core::Result<super::super::Foundation::IReference<f64>> { 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::IReference<f64>>(result__) } } #[cfg(feature = "Foundation")] pub fn VerticalDilutionOfPrecision(&self) -> ::windows::core::Result<super::super::Foundation::IReference<f64>> { 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::IReference<f64>>(result__) } } #[cfg(feature = "Foundation")] pub fn GeometricDilutionOfPrecision(&self) -> ::windows::core::Result<super::super::Foundation::IReference<f64>> { let this = &::windows::core::Interface::cast::<IGeocoordinateSatelliteData2>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IReference<f64>>(result__) } } #[cfg(feature = "Foundation")] pub fn TimeDilutionOfPrecision(&self) -> ::windows::core::Result<super::super::Foundation::IReference<f64>> { let this = &::windows::core::Interface::cast::<IGeocoordinateSatelliteData2>(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::IReference<f64>>(result__) } } } unsafe impl ::windows::core::RuntimeType for GeocoordinateSatelliteData { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Geolocation.GeocoordinateSatelliteData;{c32a74d9-2608-474c-912c-06dd490f4af7})"); } unsafe impl ::windows::core::Interface for GeocoordinateSatelliteData { type Vtable = IGeocoordinateSatelliteData_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc32a74d9_2608_474c_912c_06dd490f4af7); } impl ::windows::core::RuntimeName for GeocoordinateSatelliteData { const NAME: &'static str = "Windows.Devices.Geolocation.GeocoordinateSatelliteData"; } impl ::core::convert::From<GeocoordinateSatelliteData> for ::windows::core::IUnknown { fn from(value: GeocoordinateSatelliteData) -> Self { value.0 .0 } } impl ::core::convert::From<&GeocoordinateSatelliteData> for ::windows::core::IUnknown { fn from(value: &GeocoordinateSatelliteData) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for GeocoordinateSatelliteData { 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 GeocoordinateSatelliteData { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<GeocoordinateSatelliteData> for ::windows::core::IInspectable { fn from(value: GeocoordinateSatelliteData) -> Self { value.0 } } impl ::core::convert::From<&GeocoordinateSatelliteData> for ::windows::core::IInspectable { fn from(value: &GeocoordinateSatelliteData) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for GeocoordinateSatelliteData { 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 GeocoordinateSatelliteData { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for GeocoordinateSatelliteData {} unsafe impl ::core::marker::Sync for GeocoordinateSatelliteData {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct GeolocationAccessStatus(pub i32); impl GeolocationAccessStatus { pub const Unspecified: GeolocationAccessStatus = GeolocationAccessStatus(0i32); pub const Allowed: GeolocationAccessStatus = GeolocationAccessStatus(1i32); pub const Denied: GeolocationAccessStatus = GeolocationAccessStatus(2i32); } impl ::core::convert::From<i32> for GeolocationAccessStatus { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for GeolocationAccessStatus { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for GeolocationAccessStatus { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Devices.Geolocation.GeolocationAccessStatus;i4)"); } impl ::windows::core::DefaultType for GeolocationAccessStatus { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct Geolocator(pub ::windows::core::IInspectable); impl Geolocator { 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<Geolocator, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn DesiredAccuracy(&self) -> ::windows::core::Result<PositionAccuracy> { let this = self; unsafe { let mut result__: PositionAccuracy = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<PositionAccuracy>(result__) } } pub fn SetDesiredAccuracy(&self, value: PositionAccuracy) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value).ok() } } pub fn MovementThreshold(&self) -> ::windows::core::Result<f64> { let this = self; unsafe { let mut result__: f64 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<f64>(result__) } } pub fn SetMovementThreshold(&self, value: f64) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value).ok() } } pub fn ReportInterval(&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 SetReportInterval(&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 LocationStatus(&self) -> ::windows::core::Result<PositionStatus> { let this = self; unsafe { let mut result__: PositionStatus = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<PositionStatus>(result__) } } #[cfg(feature = "Foundation")] pub fn GetGeopositionAsync(&self) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<Geoposition>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<Geoposition>>(result__) } } #[cfg(feature = "Foundation")] pub fn GetGeopositionAsyncWithAgeAndTimeout<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, maximumage: Param0, timeout: Param1) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<Geoposition>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), maximumage.into_param().abi(), timeout.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<Geoposition>>(result__) } } #[cfg(feature = "Foundation")] pub fn PositionChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<Geolocator, PositionChangedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemovePositionChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn StatusChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<Geolocator, StatusChangedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveStatusChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn DesiredAccuracyInMeters(&self) -> ::windows::core::Result<super::super::Foundation::IReference<u32>> { let this = &::windows::core::Interface::cast::<IGeolocatorWithScalarAccuracy>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IReference<u32>>(result__) } } #[cfg(feature = "Foundation")] pub fn SetDesiredAccuracyInMeters<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<u32>>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IGeolocatorWithScalarAccuracy>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn RequestAccessAsync() -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<GeolocationAccessStatus>> { Self::IGeolocatorStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<GeolocationAccessStatus>>(result__) }) } #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub fn GetGeopositionHistoryAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::DateTime>>(starttime: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<super::super::Foundation::Collections::IVectorView<Geoposition>>> { Self::IGeolocatorStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), starttime.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<super::super::Foundation::Collections::IVectorView<Geoposition>>>(result__) }) } #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub fn GetGeopositionHistoryWithDurationAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::DateTime>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(starttime: Param0, duration: Param1) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<super::super::Foundation::Collections::IVectorView<Geoposition>>> { Self::IGeolocatorStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), starttime.into_param().abi(), duration.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<super::super::Foundation::Collections::IVectorView<Geoposition>>>(result__) }) } pub fn AllowFallbackToConsentlessPositions(&self) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IGeolocator2>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this)).ok() } } pub fn IsDefaultGeopositionRecommended() -> ::windows::core::Result<bool> { Self::IGeolocatorStatics2(|this| unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) }) } #[cfg(feature = "Foundation")] pub fn SetDefaultGeoposition<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<BasicGeoposition>>>(value: Param0) -> ::windows::core::Result<()> { Self::IGeolocatorStatics2(|this| unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() }) } #[cfg(feature = "Foundation")] pub fn DefaultGeoposition() -> ::windows::core::Result<super::super::Foundation::IReference<BasicGeoposition>> { Self::IGeolocatorStatics2(|this| 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::IReference<BasicGeoposition>>(result__) }) } pub fn IGeolocatorStatics<R, F: FnOnce(&IGeolocatorStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<Geolocator, IGeolocatorStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn IGeolocatorStatics2<R, F: FnOnce(&IGeolocatorStatics2) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<Geolocator, IGeolocatorStatics2> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for Geolocator { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Geolocation.Geolocator;{a9c3bf62-4524-4989-8aa9-de019d2e551f})"); } unsafe impl ::windows::core::Interface for Geolocator { type Vtable = IGeolocator_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa9c3bf62_4524_4989_8aa9_de019d2e551f); } impl ::windows::core::RuntimeName for Geolocator { const NAME: &'static str = "Windows.Devices.Geolocation.Geolocator"; } impl ::core::convert::From<Geolocator> for ::windows::core::IUnknown { fn from(value: Geolocator) -> Self { value.0 .0 } } impl ::core::convert::From<&Geolocator> for ::windows::core::IUnknown { fn from(value: &Geolocator) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for Geolocator { 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 Geolocator { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<Geolocator> for ::windows::core::IInspectable { fn from(value: Geolocator) -> Self { value.0 } } impl ::core::convert::From<&Geolocator> for ::windows::core::IInspectable { fn from(value: &Geolocator) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for Geolocator { 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 Geolocator { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for Geolocator {} unsafe impl ::core::marker::Sync for Geolocator {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct Geopath(pub ::windows::core::IInspectable); impl Geopath { #[cfg(feature = "Foundation_Collections")] pub fn Positions(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<BasicGeoposition>> { 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::IVectorView<BasicGeoposition>>(result__) } } pub fn GeoshapeType(&self) -> ::windows::core::Result<GeoshapeType> { let this = &::windows::core::Interface::cast::<IGeoshape>(self)?; unsafe { let mut result__: GeoshapeType = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<GeoshapeType>(result__) } } pub fn SpatialReferenceId(&self) -> ::windows::core::Result<u32> { let this = &::windows::core::Interface::cast::<IGeoshape>(self)?; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn AltitudeReferenceSystem(&self) -> ::windows::core::Result<AltitudeReferenceSystem> { let this = &::windows::core::Interface::cast::<IGeoshape>(self)?; unsafe { let mut result__: AltitudeReferenceSystem = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<AltitudeReferenceSystem>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IIterable<BasicGeoposition>>>(positions: Param0) -> ::windows::core::Result<Geopath> { Self::IGeopathFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), positions.into_param().abi(), &mut result__).from_abi::<Geopath>(result__) }) } #[cfg(feature = "Foundation_Collections")] pub fn CreateWithAltitudeReference<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IIterable<BasicGeoposition>>>(positions: Param0, altitudereferencesystem: AltitudeReferenceSystem) -> ::windows::core::Result<Geopath> { Self::IGeopathFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), positions.into_param().abi(), altitudereferencesystem, &mut result__).from_abi::<Geopath>(result__) }) } #[cfg(feature = "Foundation_Collections")] pub fn CreateWithAltitudeReferenceAndSpatialReference<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IIterable<BasicGeoposition>>>(positions: Param0, altitudereferencesystem: AltitudeReferenceSystem, spatialreferenceid: u32) -> ::windows::core::Result<Geopath> { Self::IGeopathFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), positions.into_param().abi(), altitudereferencesystem, spatialreferenceid, &mut result__).from_abi::<Geopath>(result__) }) } pub fn IGeopathFactory<R, F: FnOnce(&IGeopathFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<Geopath, IGeopathFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for Geopath { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Geolocation.Geopath;{e53fd7b9-2da4-4714-a652-de8593289898})"); } unsafe impl ::windows::core::Interface for Geopath { type Vtable = IGeopath_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe53fd7b9_2da4_4714_a652_de8593289898); } impl ::windows::core::RuntimeName for Geopath { const NAME: &'static str = "Windows.Devices.Geolocation.Geopath"; } impl ::core::convert::From<Geopath> for ::windows::core::IUnknown { fn from(value: Geopath) -> Self { value.0 .0 } } impl ::core::convert::From<&Geopath> for ::windows::core::IUnknown { fn from(value: &Geopath) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for Geopath { 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 Geopath { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<Geopath> for ::windows::core::IInspectable { fn from(value: Geopath) -> Self { value.0 } } impl ::core::convert::From<&Geopath> for ::windows::core::IInspectable { fn from(value: &Geopath) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for Geopath { 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 Geopath { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<Geopath> for IGeoshape { type Error = ::windows::core::Error; fn try_from(value: Geopath) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&Geopath> for IGeoshape { type Error = ::windows::core::Error; fn try_from(value: &Geopath) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IGeoshape> for Geopath { fn into_param(self) -> ::windows::core::Param<'a, IGeoshape> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IGeoshape> for &Geopath { fn into_param(self) -> ::windows::core::Param<'a, IGeoshape> { ::core::convert::TryInto::<IGeoshape>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for Geopath {} unsafe impl ::core::marker::Sync for Geopath {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct Geopoint(pub ::windows::core::IInspectable); impl Geopoint { pub fn Position(&self) -> ::windows::core::Result<BasicGeoposition> { let this = self; unsafe { let mut result__: BasicGeoposition = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<BasicGeoposition>(result__) } } pub fn GeoshapeType(&self) -> ::windows::core::Result<GeoshapeType> { let this = &::windows::core::Interface::cast::<IGeoshape>(self)?; unsafe { let mut result__: GeoshapeType = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<GeoshapeType>(result__) } } pub fn SpatialReferenceId(&self) -> ::windows::core::Result<u32> { let this = &::windows::core::Interface::cast::<IGeoshape>(self)?; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn AltitudeReferenceSystem(&self) -> ::windows::core::Result<AltitudeReferenceSystem> { let this = &::windows::core::Interface::cast::<IGeoshape>(self)?; unsafe { let mut result__: AltitudeReferenceSystem = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<AltitudeReferenceSystem>(result__) } } pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, BasicGeoposition>>(position: Param0) -> ::windows::core::Result<Geopoint> { Self::IGeopointFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), position.into_param().abi(), &mut result__).from_abi::<Geopoint>(result__) }) } pub fn CreateWithAltitudeReferenceSystem<'a, Param0: ::windows::core::IntoParam<'a, BasicGeoposition>>(position: Param0, altitudereferencesystem: AltitudeReferenceSystem) -> ::windows::core::Result<Geopoint> { Self::IGeopointFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), position.into_param().abi(), altitudereferencesystem, &mut result__).from_abi::<Geopoint>(result__) }) } pub fn CreateWithAltitudeReferenceSystemAndSpatialReferenceId<'a, Param0: ::windows::core::IntoParam<'a, BasicGeoposition>>(position: Param0, altitudereferencesystem: AltitudeReferenceSystem, spatialreferenceid: u32) -> ::windows::core::Result<Geopoint> { Self::IGeopointFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), position.into_param().abi(), altitudereferencesystem, spatialreferenceid, &mut result__).from_abi::<Geopoint>(result__) }) } pub fn IGeopointFactory<R, F: FnOnce(&IGeopointFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<Geopoint, IGeopointFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for Geopoint { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Geolocation.Geopoint;{6bfa00eb-e56e-49bb-9caf-cbaa78a8bcef})"); } unsafe impl ::windows::core::Interface for Geopoint { type Vtable = IGeopoint_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6bfa00eb_e56e_49bb_9caf_cbaa78a8bcef); } impl ::windows::core::RuntimeName for Geopoint { const NAME: &'static str = "Windows.Devices.Geolocation.Geopoint"; } impl ::core::convert::From<Geopoint> for ::windows::core::IUnknown { fn from(value: Geopoint) -> Self { value.0 .0 } } impl ::core::convert::From<&Geopoint> for ::windows::core::IUnknown { fn from(value: &Geopoint) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for Geopoint { 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 Geopoint { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<Geopoint> for ::windows::core::IInspectable { fn from(value: Geopoint) -> Self { value.0 } } impl ::core::convert::From<&Geopoint> for ::windows::core::IInspectable { fn from(value: &Geopoint) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for Geopoint { 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 Geopoint { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<Geopoint> for IGeoshape { type Error = ::windows::core::Error; fn try_from(value: Geopoint) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&Geopoint> for IGeoshape { type Error = ::windows::core::Error; fn try_from(value: &Geopoint) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IGeoshape> for Geopoint { fn into_param(self) -> ::windows::core::Param<'a, IGeoshape> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IGeoshape> for &Geopoint { fn into_param(self) -> ::windows::core::Param<'a, IGeoshape> { ::core::convert::TryInto::<IGeoshape>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for Geopoint {} unsafe impl ::core::marker::Sync for Geopoint {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct Geoposition(pub ::windows::core::IInspectable); impl Geoposition { pub fn Coordinate(&self) -> ::windows::core::Result<Geocoordinate> { 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::<Geocoordinate>(result__) } } pub fn CivicAddress(&self) -> ::windows::core::Result<CivicAddress> { 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::<CivicAddress>(result__) } } pub fn VenueData(&self) -> ::windows::core::Result<VenueData> { let this = &::windows::core::Interface::cast::<IGeoposition2>(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::<VenueData>(result__) } } } unsafe impl ::windows::core::RuntimeType for Geoposition { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Geolocation.Geoposition;{c18d0454-7d41-4ff7-a957-9dffb4ef7f5b})"); } unsafe impl ::windows::core::Interface for Geoposition { type Vtable = IGeoposition_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc18d0454_7d41_4ff7_a957_9dffb4ef7f5b); } impl ::windows::core::RuntimeName for Geoposition { const NAME: &'static str = "Windows.Devices.Geolocation.Geoposition"; } impl ::core::convert::From<Geoposition> for ::windows::core::IUnknown { fn from(value: Geoposition) -> Self { value.0 .0 } } impl ::core::convert::From<&Geoposition> for ::windows::core::IUnknown { fn from(value: &Geoposition) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for Geoposition { 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 Geoposition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<Geoposition> for ::windows::core::IInspectable { fn from(value: Geoposition) -> Self { value.0 } } impl ::core::convert::From<&Geoposition> for ::windows::core::IInspectable { fn from(value: &Geoposition) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for Geoposition { 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 Geoposition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for Geoposition {} unsafe impl ::core::marker::Sync for Geoposition {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct GeoshapeType(pub i32); impl GeoshapeType { pub const Geopoint: GeoshapeType = GeoshapeType(0i32); pub const Geocircle: GeoshapeType = GeoshapeType(1i32); pub const Geopath: GeoshapeType = GeoshapeType(2i32); pub const GeoboundingBox: GeoshapeType = GeoshapeType(3i32); } impl ::core::convert::From<i32> for GeoshapeType { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for GeoshapeType { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for GeoshapeType { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Devices.Geolocation.GeoshapeType;i4)"); } impl ::windows::core::DefaultType for GeoshapeType { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct Geovisit(pub ::windows::core::IInspectable); impl Geovisit { pub fn Position(&self) -> ::windows::core::Result<Geoposition> { 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::<Geoposition>(result__) } } pub fn StateChange(&self) -> ::windows::core::Result<VisitStateChange> { let this = self; unsafe { let mut result__: VisitStateChange = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<VisitStateChange>(result__) } } #[cfg(feature = "Foundation")] pub fn Timestamp(&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).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::DateTime>(result__) } } } unsafe impl ::windows::core::RuntimeType for Geovisit { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Geolocation.Geovisit;{b1877a76-9ef6-41ab-a0dd-793ece76e2de})"); } unsafe impl ::windows::core::Interface for Geovisit { type Vtable = IGeovisit_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb1877a76_9ef6_41ab_a0dd_793ece76e2de); } impl ::windows::core::RuntimeName for Geovisit { const NAME: &'static str = "Windows.Devices.Geolocation.Geovisit"; } impl ::core::convert::From<Geovisit> for ::windows::core::IUnknown { fn from(value: Geovisit) -> Self { value.0 .0 } } impl ::core::convert::From<&Geovisit> for ::windows::core::IUnknown { fn from(value: &Geovisit) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for Geovisit { 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 Geovisit { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<Geovisit> for ::windows::core::IInspectable { fn from(value: Geovisit) -> Self { value.0 } } impl ::core::convert::From<&Geovisit> for ::windows::core::IInspectable { fn from(value: &Geovisit) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for Geovisit { 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 Geovisit { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for Geovisit {} unsafe impl ::core::marker::Sync for Geovisit {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct GeovisitMonitor(pub ::windows::core::IInspectable); impl GeovisitMonitor { 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<GeovisitMonitor, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn MonitoringScope(&self) -> ::windows::core::Result<VisitMonitoringScope> { let this = self; unsafe { let mut result__: VisitMonitoringScope = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<VisitMonitoringScope>(result__) } } pub fn Start(&self, value: VisitMonitoringScope) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value).ok() } } pub fn Stop(&self) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this)).ok() } } #[cfg(feature = "Foundation")] pub fn VisitStateChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<GeovisitMonitor, GeovisitStateChangedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveVisitStateChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn GetLastReportAsync() -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<Geovisit>> { Self::IGeovisitMonitorStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<Geovisit>>(result__) }) } pub fn IGeovisitMonitorStatics<R, F: FnOnce(&IGeovisitMonitorStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<GeovisitMonitor, IGeovisitMonitorStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for GeovisitMonitor { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Geolocation.GeovisitMonitor;{80118aaf-5944-4591-83c1-396647f54f2c})"); } unsafe impl ::windows::core::Interface for GeovisitMonitor { type Vtable = IGeovisitMonitor_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x80118aaf_5944_4591_83c1_396647f54f2c); } impl ::windows::core::RuntimeName for GeovisitMonitor { const NAME: &'static str = "Windows.Devices.Geolocation.GeovisitMonitor"; } impl ::core::convert::From<GeovisitMonitor> for ::windows::core::IUnknown { fn from(value: GeovisitMonitor) -> Self { value.0 .0 } } impl ::core::convert::From<&GeovisitMonitor> for ::windows::core::IUnknown { fn from(value: &GeovisitMonitor) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for GeovisitMonitor { 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 GeovisitMonitor { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<GeovisitMonitor> for ::windows::core::IInspectable { fn from(value: GeovisitMonitor) -> Self { value.0 } } impl ::core::convert::From<&GeovisitMonitor> for ::windows::core::IInspectable { fn from(value: &GeovisitMonitor) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for GeovisitMonitor { 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 GeovisitMonitor { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for GeovisitMonitor {} unsafe impl ::core::marker::Sync for GeovisitMonitor {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct GeovisitStateChangedEventArgs(pub ::windows::core::IInspectable); impl GeovisitStateChangedEventArgs { pub fn Visit(&self) -> ::windows::core::Result<Geovisit> { 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::<Geovisit>(result__) } } } unsafe impl ::windows::core::RuntimeType for GeovisitStateChangedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Geolocation.GeovisitStateChangedEventArgs;{ceb4d1ff-8b53-4968-beed-4cecd029ce15})"); } unsafe impl ::windows::core::Interface for GeovisitStateChangedEventArgs { type Vtable = IGeovisitStateChangedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xceb4d1ff_8b53_4968_beed_4cecd029ce15); } impl ::windows::core::RuntimeName for GeovisitStateChangedEventArgs { const NAME: &'static str = "Windows.Devices.Geolocation.GeovisitStateChangedEventArgs"; } impl ::core::convert::From<GeovisitStateChangedEventArgs> for ::windows::core::IUnknown { fn from(value: GeovisitStateChangedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&GeovisitStateChangedEventArgs> for ::windows::core::IUnknown { fn from(value: &GeovisitStateChangedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for GeovisitStateChangedEventArgs { 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 GeovisitStateChangedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<GeovisitStateChangedEventArgs> for ::windows::core::IInspectable { fn from(value: GeovisitStateChangedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&GeovisitStateChangedEventArgs> for ::windows::core::IInspectable { fn from(value: &GeovisitStateChangedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for GeovisitStateChangedEventArgs { 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 GeovisitStateChangedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for GeovisitStateChangedEventArgs {} unsafe impl ::core::marker::Sync for GeovisitStateChangedEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct GeovisitTriggerDetails(pub ::windows::core::IInspectable); impl GeovisitTriggerDetails { #[cfg(feature = "Foundation_Collections")] pub fn ReadReports(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<Geovisit>> { 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::IVectorView<Geovisit>>(result__) } } } unsafe impl ::windows::core::RuntimeType for GeovisitTriggerDetails { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Geolocation.GeovisitTriggerDetails;{ea770d9e-d1c9-454b-99b7-b2f8cdd2482f})"); } unsafe impl ::windows::core::Interface for GeovisitTriggerDetails { type Vtable = IGeovisitTriggerDetails_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xea770d9e_d1c9_454b_99b7_b2f8cdd2482f); } impl ::windows::core::RuntimeName for GeovisitTriggerDetails { const NAME: &'static str = "Windows.Devices.Geolocation.GeovisitTriggerDetails"; } impl ::core::convert::From<GeovisitTriggerDetails> for ::windows::core::IUnknown { fn from(value: GeovisitTriggerDetails) -> Self { value.0 .0 } } impl ::core::convert::From<&GeovisitTriggerDetails> for ::windows::core::IUnknown { fn from(value: &GeovisitTriggerDetails) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for GeovisitTriggerDetails { 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 GeovisitTriggerDetails { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<GeovisitTriggerDetails> for ::windows::core::IInspectable { fn from(value: GeovisitTriggerDetails) -> Self { value.0 } } impl ::core::convert::From<&GeovisitTriggerDetails> for ::windows::core::IInspectable { fn from(value: &GeovisitTriggerDetails) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for GeovisitTriggerDetails { 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 GeovisitTriggerDetails { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for GeovisitTriggerDetails {} unsafe impl ::core::marker::Sync for GeovisitTriggerDetails {} #[repr(transparent)] #[doc(hidden)] pub struct ICivicAddress(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ICivicAddress { type Vtable = ICivicAddress_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa8567a1a_64f4_4d48_bcea_f6b008eca34c); } #[repr(C)] #[doc(hidden)] pub struct ICivicAddress_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::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, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeoboundingBox(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeoboundingBox { type Vtable = IGeoboundingBox_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0896c80b_274f_43da_9a06_cbfcdaeb4ec2); } #[repr(C)] #[doc(hidden)] pub struct IGeoboundingBox_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 BasicGeoposition) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut BasicGeoposition) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut BasicGeoposition) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut f64) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut f64) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeoboundingBoxFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeoboundingBoxFactory { type Vtable = IGeoboundingBoxFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4dfba589_0411_4abc_b3b5_5bbccb57d98c); } #[repr(C)] #[doc(hidden)] pub struct IGeoboundingBoxFactory_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, northwestcorner: BasicGeoposition, southeastcorner: BasicGeoposition, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, northwestcorner: BasicGeoposition, southeastcorner: BasicGeoposition, altitudereferencesystem: AltitudeReferenceSystem, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, northwestcorner: BasicGeoposition, southeastcorner: BasicGeoposition, altitudereferencesystem: AltitudeReferenceSystem, spatialreferenceid: u32, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeoboundingBoxStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeoboundingBoxStatics { type Vtable = IGeoboundingBoxStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x67b80708_e61a_4cd0_841b_93233792b5ca); } #[repr(C)] #[doc(hidden)] pub struct IGeoboundingBoxStatics_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, positions: ::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, positions: ::windows::core::RawPtr, altituderefsystem: AltitudeReferenceSystem, 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, positions: ::windows::core::RawPtr, altituderefsystem: AltitudeReferenceSystem, spatialreferenceid: u32, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeocircle(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeocircle { type Vtable = IGeocircle_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x39e45843_a7f9_4e63_92a7_ba0c28d124b1); } #[repr(C)] #[doc(hidden)] pub struct IGeocircle_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 BasicGeoposition) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut f64) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeocircleFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeocircleFactory { type Vtable = IGeocircleFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xafd6531f_72b1_4f7d_87cc_4ed4c9849c05); } #[repr(C)] #[doc(hidden)] pub struct IGeocircleFactory_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, position: BasicGeoposition, radius: f64, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, position: BasicGeoposition, radius: f64, altitudereferencesystem: AltitudeReferenceSystem, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, position: BasicGeoposition, radius: f64, altitudereferencesystem: AltitudeReferenceSystem, spatialreferenceid: u32, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeocoordinate(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeocoordinate { type Vtable = IGeocoordinate_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xee21a3aa_976a_4c70_803d_083ea55bcbc4); } #[repr(C)] #[doc(hidden)] pub struct IGeocoordinate_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 f64) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut f64) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut f64) -> ::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 super::super::Foundation::DateTime) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeocoordinateSatelliteData(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeocoordinateSatelliteData { type Vtable = IGeocoordinateSatelliteData_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc32a74d9_2608_474c_912c_06dd490f4af7); } #[repr(C)] #[doc(hidden)] pub struct IGeocoordinateSatelliteData_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, 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, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeocoordinateSatelliteData2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeocoordinateSatelliteData2 { type Vtable = IGeocoordinateSatelliteData2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x761c8cfd_a19d_5a51_80f5_71676115483e); } #[repr(C)] #[doc(hidden)] pub struct IGeocoordinateSatelliteData2_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, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeocoordinateWithPoint(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeocoordinateWithPoint { type Vtable = IGeocoordinateWithPoint_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfeea0525_d22c_4d46_b527_0b96066fc7db); } #[repr(C)] #[doc(hidden)] pub struct IGeocoordinateWithPoint_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeocoordinateWithPositionData(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeocoordinateWithPositionData { type Vtable = IGeocoordinateWithPositionData_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x95e634be_dbd6_40ac_b8f2_a65c0340d9a6); } #[repr(C)] #[doc(hidden)] pub struct IGeocoordinateWithPositionData_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 PositionSource) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeocoordinateWithPositionSourceTimestamp(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeocoordinateWithPositionSourceTimestamp { type Vtable = IGeocoordinateWithPositionSourceTimestamp_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8543fc02_c9f1_4610_afe0_8bc3a6a87036); } #[repr(C)] #[doc(hidden)] pub struct IGeocoordinateWithPositionSourceTimestamp_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, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeocoordinateWithRemoteSource(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeocoordinateWithRemoteSource { type Vtable = IGeocoordinateWithRemoteSource_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x397cebd7_ee38_5f3b_8900_c4a7bc9cf953); } #[repr(C)] #[doc(hidden)] pub struct IGeocoordinateWithRemoteSource_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeolocator(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeolocator { type Vtable = IGeolocator_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa9c3bf62_4524_4989_8aa9_de019d2e551f); } #[repr(C)] #[doc(hidden)] pub struct IGeolocator_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 PositionAccuracy) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: PositionAccuracy) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut f64) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: f64) -> ::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 PositionStatus) -> ::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, maximumage: super::super::Foundation::TimeSpan, timeout: super::super::Foundation::TimeSpan, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeolocator2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeolocator2 { type Vtable = IGeolocator2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd1b42e6d_8891_43b4_ad36_27c6fe9a97b1); } #[repr(C)] #[doc(hidden)] pub struct IGeolocator2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeolocatorStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeolocatorStatics { type Vtable = IGeolocatorStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9a8e7571_2df5_4591_9f87_eb5fd894e9b7); } #[repr(C)] #[doc(hidden)] pub struct IGeolocatorStatics_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, starttime: super::super::Foundation::DateTime, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Foundation_Collections")))] usize, #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, starttime: super::super::Foundation::DateTime, duration: super::super::Foundation::TimeSpan, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Foundation_Collections")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeolocatorStatics2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeolocatorStatics2 { type Vtable = IGeolocatorStatics2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x993011a2_fa1c_4631_a71d_0dbeb1250d9c); } #[repr(C)] #[doc(hidden)] pub struct IGeolocatorStatics2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, #[cfg(feature = "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, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeolocatorWithScalarAccuracy(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeolocatorWithScalarAccuracy { type Vtable = IGeolocatorWithScalarAccuracy_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x96f5d3c1_b80f_460a_994d_a96c47a51aa4); } #[repr(C)] #[doc(hidden)] pub struct IGeolocatorWithScalarAccuracy_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 IGeopath(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeopath { type Vtable = IGeopath_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe53fd7b9_2da4_4714_a652_de8593289898); } #[repr(C)] #[doc(hidden)] pub struct IGeopath_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeopathFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeopathFactory { type Vtable = IGeopathFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x27bea9c8_c7e7_4359_9b9b_fca3e05ef593); } #[repr(C)] #[doc(hidden)] pub struct IGeopathFactory_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, positions: ::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, positions: ::windows::core::RawPtr, altitudereferencesystem: AltitudeReferenceSystem, 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, positions: ::windows::core::RawPtr, altitudereferencesystem: AltitudeReferenceSystem, spatialreferenceid: u32, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeopoint(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeopoint { type Vtable = IGeopoint_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6bfa00eb_e56e_49bb_9caf_cbaa78a8bcef); } #[repr(C)] #[doc(hidden)] pub struct IGeopoint_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 BasicGeoposition) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeopointFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeopointFactory { type Vtable = IGeopointFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xdb6b8d33_76bd_4e30_8af7_a844dc37b7a0); } #[repr(C)] #[doc(hidden)] pub struct IGeopointFactory_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, position: BasicGeoposition, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, position: BasicGeoposition, altitudereferencesystem: AltitudeReferenceSystem, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, position: BasicGeoposition, altitudereferencesystem: AltitudeReferenceSystem, spatialreferenceid: u32, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeoposition(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeoposition { type Vtable = IGeoposition_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc18d0454_7d41_4ff7_a957_9dffb4ef7f5b); } #[repr(C)] #[doc(hidden)] pub struct IGeoposition_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeoposition2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeoposition2 { type Vtable = IGeoposition2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7f62f697_8671_4b0d_86f8_474a8496187c); } #[repr(C)] #[doc(hidden)] pub struct IGeoposition2_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IGeoshape(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeoshape { type Vtable = IGeoshape_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc99ca2af_c729_43c1_8fab_d6dec914df7e); } impl IGeoshape { pub fn GeoshapeType(&self) -> ::windows::core::Result<GeoshapeType> { let this = self; unsafe { let mut result__: GeoshapeType = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<GeoshapeType>(result__) } } pub fn SpatialReferenceId(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } pub fn AltitudeReferenceSystem(&self) -> ::windows::core::Result<AltitudeReferenceSystem> { let this = self; unsafe { let mut result__: AltitudeReferenceSystem = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<AltitudeReferenceSystem>(result__) } } } unsafe impl ::windows::core::RuntimeType for IGeoshape { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{c99ca2af-c729-43c1-8fab-d6dec914df7e}"); } impl ::core::convert::From<IGeoshape> for ::windows::core::IUnknown { fn from(value: IGeoshape) -> Self { value.0 .0 } } impl ::core::convert::From<&IGeoshape> for ::windows::core::IUnknown { fn from(value: &IGeoshape) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IGeoshape { 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 IGeoshape { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<IGeoshape> for ::windows::core::IInspectable { fn from(value: IGeoshape) -> Self { value.0 } } impl ::core::convert::From<&IGeoshape> for ::windows::core::IInspectable { fn from(value: &IGeoshape) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for IGeoshape { 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 IGeoshape { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IGeoshape_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 GeoshapeType) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut AltitudeReferenceSystem) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeovisit(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeovisit { type Vtable = IGeovisit_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb1877a76_9ef6_41ab_a0dd_793ece76e2de); } #[repr(C)] #[doc(hidden)] pub struct IGeovisit_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut VisitStateChange) -> ::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, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeovisitMonitor(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeovisitMonitor { type Vtable = IGeovisitMonitor_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x80118aaf_5944_4591_83c1_396647f54f2c); } #[repr(C)] #[doc(hidden)] pub struct IGeovisitMonitor_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 VisitMonitoringScope) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: VisitMonitoringScope) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeovisitMonitorStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeovisitMonitorStatics { type Vtable = IGeovisitMonitorStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xbcf976a7_bbf2_4cdd_95cf_554c82edfb87); } #[repr(C)] #[doc(hidden)] pub struct IGeovisitMonitorStatics_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, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeovisitStateChangedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeovisitStateChangedEventArgs { type Vtable = IGeovisitStateChangedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xceb4d1ff_8b53_4968_beed_4cecd029ce15); } #[repr(C)] #[doc(hidden)] pub struct IGeovisitStateChangedEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IGeovisitTriggerDetails(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IGeovisitTriggerDetails { type Vtable = IGeovisitTriggerDetails_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xea770d9e_d1c9_454b_99b7_b2f8cdd2482f); } #[repr(C)] #[doc(hidden)] pub struct IGeovisitTriggerDetails_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IPositionChangedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IPositionChangedEventArgs { type Vtable = IPositionChangedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x37859ce5_9d1e_46c5_bf3b_6ad8cac1a093); } #[repr(C)] #[doc(hidden)] pub struct IPositionChangedEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IStatusChangedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IStatusChangedEventArgs { type Vtable = IStatusChangedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3453d2da_8c93_4111_a205_9aecfc9be5c0); } #[repr(C)] #[doc(hidden)] pub struct IStatusChangedEventArgs_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 PositionStatus) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IVenueData(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IVenueData { type Vtable = IVenueData_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x66f39187_60e3_4b2f_b527_4f53f1c3c677); } #[repr(C)] #[doc(hidden)] pub struct IVenueData_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, ); #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct PositionAccuracy(pub i32); impl PositionAccuracy { pub const Default: PositionAccuracy = PositionAccuracy(0i32); pub const High: PositionAccuracy = PositionAccuracy(1i32); } impl ::core::convert::From<i32> for PositionAccuracy { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for PositionAccuracy { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for PositionAccuracy { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Devices.Geolocation.PositionAccuracy;i4)"); } impl ::windows::core::DefaultType for PositionAccuracy { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct PositionChangedEventArgs(pub ::windows::core::IInspectable); impl PositionChangedEventArgs { pub fn Position(&self) -> ::windows::core::Result<Geoposition> { 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::<Geoposition>(result__) } } } unsafe impl ::windows::core::RuntimeType for PositionChangedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Geolocation.PositionChangedEventArgs;{37859ce5-9d1e-46c5-bf3b-6ad8cac1a093})"); } unsafe impl ::windows::core::Interface for PositionChangedEventArgs { type Vtable = IPositionChangedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x37859ce5_9d1e_46c5_bf3b_6ad8cac1a093); } impl ::windows::core::RuntimeName for PositionChangedEventArgs { const NAME: &'static str = "Windows.Devices.Geolocation.PositionChangedEventArgs"; } impl ::core::convert::From<PositionChangedEventArgs> for ::windows::core::IUnknown { fn from(value: PositionChangedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&PositionChangedEventArgs> for ::windows::core::IUnknown { fn from(value: &PositionChangedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for PositionChangedEventArgs { 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 PositionChangedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<PositionChangedEventArgs> for ::windows::core::IInspectable { fn from(value: PositionChangedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&PositionChangedEventArgs> for ::windows::core::IInspectable { fn from(value: &PositionChangedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for PositionChangedEventArgs { 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 PositionChangedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for PositionChangedEventArgs {} unsafe impl ::core::marker::Sync for PositionChangedEventArgs {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct PositionSource(pub i32); impl PositionSource { pub const Cellular: PositionSource = PositionSource(0i32); pub const Satellite: PositionSource = PositionSource(1i32); pub const WiFi: PositionSource = PositionSource(2i32); pub const IPAddress: PositionSource = PositionSource(3i32); pub const Unknown: PositionSource = PositionSource(4i32); pub const Default: PositionSource = PositionSource(5i32); pub const Obfuscated: PositionSource = PositionSource(6i32); } impl ::core::convert::From<i32> for PositionSource { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for PositionSource { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for PositionSource { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Devices.Geolocation.PositionSource;i4)"); } impl ::windows::core::DefaultType for PositionSource { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct PositionStatus(pub i32); impl PositionStatus { pub const Ready: PositionStatus = PositionStatus(0i32); pub const Initializing: PositionStatus = PositionStatus(1i32); pub const NoData: PositionStatus = PositionStatus(2i32); pub const Disabled: PositionStatus = PositionStatus(3i32); pub const NotInitialized: PositionStatus = PositionStatus(4i32); pub const NotAvailable: PositionStatus = PositionStatus(5i32); } impl ::core::convert::From<i32> for PositionStatus { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for PositionStatus { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for PositionStatus { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Devices.Geolocation.PositionStatus;i4)"); } impl ::windows::core::DefaultType for PositionStatus { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct StatusChangedEventArgs(pub ::windows::core::IInspectable); impl StatusChangedEventArgs { pub fn Status(&self) -> ::windows::core::Result<PositionStatus> { let this = self; unsafe { let mut result__: PositionStatus = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<PositionStatus>(result__) } } } unsafe impl ::windows::core::RuntimeType for StatusChangedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Geolocation.StatusChangedEventArgs;{3453d2da-8c93-4111-a205-9aecfc9be5c0})"); } unsafe impl ::windows::core::Interface for StatusChangedEventArgs { type Vtable = IStatusChangedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3453d2da_8c93_4111_a205_9aecfc9be5c0); } impl ::windows::core::RuntimeName for StatusChangedEventArgs { const NAME: &'static str = "Windows.Devices.Geolocation.StatusChangedEventArgs"; } impl ::core::convert::From<StatusChangedEventArgs> for ::windows::core::IUnknown { fn from(value: StatusChangedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&StatusChangedEventArgs> for ::windows::core::IUnknown { fn from(value: &StatusChangedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for StatusChangedEventArgs { 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 StatusChangedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<StatusChangedEventArgs> for ::windows::core::IInspectable { fn from(value: StatusChangedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&StatusChangedEventArgs> for ::windows::core::IInspectable { fn from(value: &StatusChangedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for StatusChangedEventArgs { 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 StatusChangedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for StatusChangedEventArgs {} unsafe impl ::core::marker::Sync for StatusChangedEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct VenueData(pub ::windows::core::IInspectable); impl VenueData { pub fn Id(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn Level(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } } unsafe impl ::windows::core::RuntimeType for VenueData { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Geolocation.VenueData;{66f39187-60e3-4b2f-b527-4f53f1c3c677})"); } unsafe impl ::windows::core::Interface for VenueData { type Vtable = IVenueData_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x66f39187_60e3_4b2f_b527_4f53f1c3c677); } impl ::windows::core::RuntimeName for VenueData { const NAME: &'static str = "Windows.Devices.Geolocation.VenueData"; } impl ::core::convert::From<VenueData> for ::windows::core::IUnknown { fn from(value: VenueData) -> Self { value.0 .0 } } impl ::core::convert::From<&VenueData> for ::windows::core::IUnknown { fn from(value: &VenueData) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for VenueData { 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 VenueData { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<VenueData> for ::windows::core::IInspectable { fn from(value: VenueData) -> Self { value.0 } } impl ::core::convert::From<&VenueData> for ::windows::core::IInspectable { fn from(value: &VenueData) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for VenueData { 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 VenueData { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for VenueData {} unsafe impl ::core::marker::Sync for VenueData {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct VisitMonitoringScope(pub i32); impl VisitMonitoringScope { pub const Venue: VisitMonitoringScope = VisitMonitoringScope(0i32); pub const City: VisitMonitoringScope = VisitMonitoringScope(1i32); } impl ::core::convert::From<i32> for VisitMonitoringScope { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for VisitMonitoringScope { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for VisitMonitoringScope { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Devices.Geolocation.VisitMonitoringScope;i4)"); } impl ::windows::core::DefaultType for VisitMonitoringScope { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct VisitStateChange(pub i32); impl VisitStateChange { pub const TrackingLost: VisitStateChange = VisitStateChange(0i32); pub const Arrived: VisitStateChange = VisitStateChange(1i32); pub const Departed: VisitStateChange = VisitStateChange(2i32); pub const OtherMovement: VisitStateChange = VisitStateChange(3i32); } impl ::core::convert::From<i32> for VisitStateChange { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for VisitStateChange { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for VisitStateChange { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Devices.Geolocation.VisitStateChange;i4)"); } impl ::windows::core::DefaultType for VisitStateChange { type DefaultType = Self; }
mod episode; mod podcast; use structopt::StructOpt; use threadpool::ThreadPool; #[derive(Debug, StructOpt)] #[structopt(raw(setting = "structopt::clap::AppSettings::ColoredHelp"))] #[structopt( name = "Podder", about = "An app to download your podcasts, fast and easy" )] struct Cli { #[structopt( help = "RSS feed urls for the podcasts we want to download", parse(from_str) )] urls: Vec<String>, #[structopt(short = "b", long = "backlog", default_value = "5")] backlog: usize, #[structopt(short = "j", long = "threads", default_value = "3")] threads: usize, } // Program fn main() -> Result<(), Box<std::error::Error>> { // Get CLI args and flags let args = Cli::from_args(); let pool = ThreadPool::new(args.threads); // Create a worker pool // Get RSS channels from the arguments let feeds: Vec<rss::Channel> = args .urls .iter() .map(|x| { let mut t = rss::Channel::from_url(&x).expect("Failed to parse url"); t.set_link(x as &str); t }) .collect(); let pods: Vec<podcast::Podcast> = feeds .iter() .map(move |f| { return podcast::Podcast { title: f.title().parse().expect("Failed to read podcast title"), url: f.link().parse().expect("Failed to read the link"), episodes: f.clone().into_items().len(), }; }) .collect(); println!("{}\n", pods[0]); // TODO: make this iterate over all channels let eps = feeds[0].clone().into_items(); let episodes = get_episodes(eps)?; // Start downloading the episodes for i in 0..args.backlog { let mut eps = episodes[i].clone(); pool.execute(move || { eps.download(); }); } pool.join(); // Wait untill all the workers have finished Ok(()) } // Creates episodes from an RSS feed fn get_episodes(items: Vec<rss::Item>) -> Result<Vec<episode::Episode>, Box<std::error::Error>> { let mut episodes: Vec<episode::Episode> = Vec::new(); for ep in items.iter() { episodes.push(episode::Episode::from_item(ep.clone())?); } Ok(episodes) }
use crate::ConnectParams; use tokio::{ io::{BufReader, BufWriter}, net::{ tcp::{OwnedReadHalf, OwnedWriteHalf}, TcpStream, }, }; // An plain async tcp connection #[derive(Debug)] pub struct AsyncPlainTcpClient { params: ConnectParams, reader: BufReader<OwnedReadHalf>, writer: BufWriter<OwnedWriteHalf>, } impl AsyncPlainTcpClient { pub async fn try_new(params: ConnectParams) -> std::io::Result<Self> { let (reader, writer) = TcpStream::connect(params.addr()).await?.into_split(); Ok(Self { params, writer: BufWriter::new(writer), reader: BufReader::new(reader), }) } pub fn connect_params(&self) -> &ConnectParams { &self.params } pub fn writer(&mut self) -> &mut BufWriter<OwnedWriteHalf> { &mut self.writer } pub fn reader(&mut self) -> &mut BufReader<OwnedReadHalf> { &mut self.reader } }
// Copyright 2018 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. use syntax::ast::*; use syntax::codemap::Spanned; use syntax::ext::base::*; use syntax::ext::build::AstBuilder; use syntax::parse::token; use syntax::print::pprust; use syntax::symbol::Symbol; use syntax::tokenstream::{TokenStream, TokenTree}; use syntax_pos::{Span, DUMMY_SP}; pub fn expand_assert<'cx>( cx: &'cx mut ExtCtxt, sp: Span, tts: &[TokenTree], ) -> Box<dyn MacResult + 'cx> { let mut parser = cx.new_parser_from_tts(tts); let cond_expr = panictry!(parser.parse_expr()); let custom_msg_args = if parser.eat(&token::Comma) { let ts = parser.parse_tokens(); if !ts.is_empty() { Some(ts) } else { None } } else { None }; let sp = sp.apply_mark(cx.current_expansion.mark); let panic_call = Mac_ { path: Path::from_ident(Ident::new(Symbol::intern("panic"), sp)), tts: if let Some(ts) = custom_msg_args { ts.into() } else { TokenStream::from(TokenTree::Token( DUMMY_SP, token::Literal( token::Lit::Str_(Name::intern(&format!( "assertion failed: {}", pprust::expr_to_string(&cond_expr).escape_debug() ))), None, ), )).into() }, delim: MacDelimiter::Parenthesis, }; let if_expr = cx.expr_if( sp, cx.expr(sp, ExprKind::Unary(UnOp::Not, cond_expr)), cx.expr( sp, ExprKind::Mac(Spanned { span: sp, node: panic_call, }), ), None, ); MacEager::expr(if_expr) }
pub mod dna; pub mod dna4; pub mod dnax; // mod util {} use std::os::raw::c_char; #[inline] fn to_ptrs(forward: &str) -> (*const c_char, *const c_char) { let size = forward.len(); let begin = forward.as_ptr() as *const c_char; let end = unsafe { begin.offset(size as isize) }; (begin, end) } #[inline] fn create_and_overwrite<F>(capacity: usize, filler: F) -> String where F: Fn(*mut u8) -> usize, { let mut buffer = Vec::<u8>::with_capacity(capacity); // uninitalized let dest = buffer.as_mut_ptr(); let up_to = filler(dest); unsafe { buffer.set_len(up_to); String::from_utf8_unchecked(buffer) } } fn create_string_and_overwrite<F>(capacity: usize, filler: F) -> String where F: Fn(*mut c_char) -> *mut c_char, { let mut buffer = Vec::<u8>::with_capacity(capacity); // uninitalized let dest = buffer.as_mut_ptr() as *mut c_char; let up_to = filler(dest); unsafe { let length = up_to.offset_from(dest) as usize; buffer.set_len(length); String::from_utf8_unchecked(buffer) } }
use crate::image::Image; pub use crate::prelude::*; use fltk_sys::valuator::*; use std::{ ffi::{CStr, CString}, mem, os::raw, }; /// Creates a slider widget #[derive(WidgetExt, ValuatorExt, Debug)] pub struct Slider { _inner: *mut Fl_Slider, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Creates a nice slider widget #[derive(WidgetExt, ValuatorExt, Debug)] pub struct NiceSlider { _inner: *mut Fl_Nice_Slider, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Defines slider types #[repr(i32)] #[derive(WidgetType, Debug, Copy, Clone, PartialEq)] pub enum SliderType { VerticalSlider = 0, HorizontalSlider = 1, VerticalFillSlider = 2, HorizontalFillSlider = 3, VerticalNiceSlider = 4, HorizontalNiceSlider = 5, } /// Creates a dial widget #[derive(WidgetExt, ValuatorExt, Debug)] pub struct Dial { _inner: *mut Fl_Dial, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Creates a line dial widget #[derive(WidgetExt, ValuatorExt, Debug)] pub struct LineDial { _inner: *mut Fl_Line_Dial, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Defines dial types #[repr(i32)] #[derive(WidgetType, Debug, Copy, Clone, PartialEq)] pub enum DialType { NormalDial = 0, LineDial = 1, FillDial = 2, } /// Creates a counter widget #[derive(WidgetExt, ValuatorExt, Debug)] pub struct Counter { _inner: *mut Fl_Counter, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Defines counter types #[repr(i32)] #[derive(WidgetType, Debug, Copy, Clone, PartialEq)] pub enum CounterType { NormalCounter = 0, SimpleCounter = 1, } /// Creates a scrollbar widget #[derive(WidgetExt, ValuatorExt, Debug)] pub struct Scrollbar { _inner: *mut Fl_Scrollbar, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Defines scrollbar types #[repr(i32)] #[derive(WidgetType, Debug, Copy, Clone, PartialEq)] pub enum ScrollBarType { VerticalScrollBar = 0, HorizontalScrollBar = 1, VerticalFillScrollBar = 2, HorizontalFillScrollBar = 3, VerticalNiceScrollBar = 4, HorizontalNiceScrollBar = 5, } /// Creates a roller widget #[derive(WidgetExt, ValuatorExt, Debug)] pub struct Roller { _inner: *mut Fl_Roller, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Creates a value slider widget #[derive(WidgetExt, ValuatorExt, Debug)] pub struct ValueSlider { _inner: *mut Fl_Value_Slider, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Creates an adjuster widget #[derive(WidgetExt, ValuatorExt, Debug)] pub struct Adjuster { _inner: *mut Fl_Adjuster, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Creates an value input widget #[derive(WidgetExt, ValuatorExt, Debug)] pub struct ValueInput { _inner: *mut Fl_Value_Input, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Creates an value output widget #[derive(WidgetExt, ValuatorExt, Debug)] pub struct ValueOutput { _inner: *mut Fl_Value_Output, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Creates a fill slider #[derive(WidgetExt, ValuatorExt, Debug)] pub struct FillSlider { _inner: *mut Fl_Fill_Slider, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Creates a fill dial #[derive(WidgetExt, ValuatorExt, Debug)] pub struct FillDial { _inner: *mut Fl_Fill_Dial, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Creates a horizontal slider #[derive(WidgetExt, ValuatorExt, Debug)] pub struct HorSlider { _inner: *mut Fl_Hor_Slider, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Creates a horizontal fill slider #[derive(WidgetExt, ValuatorExt, Debug)] pub struct HorFillSlider { _inner: *mut Fl_Hor_Fill_Slider, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Creates a horizontal nice slider #[derive(WidgetExt, ValuatorExt, Debug)] pub struct HorNiceSlider { _inner: *mut Fl_Hor_Nice_Slider, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, } /// Creates a horizontal value slider #[derive(WidgetExt, ValuatorExt, Debug)] pub struct HorValueSlider { _inner: *mut Fl_Hor_Value_Slider, _tracker: *mut fltk_sys::fl::Fl_Widget_Tracker, }
// Copyright 2019, The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following // disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the // following disclaimer in the documentation and/or other materials provided with the distribution. // // 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote // products derived from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //! Actor for DHT functionality. //! //! The DhtActor is responsible for sending a join request on startup //! and furnishing [DhtRequest]s. //! //! [DhtRequest]: ./enum.DhtRequest.html use crate::{ broadcast_strategy::BroadcastStrategy, discovery::DhtDiscoveryError, outbound::{OutboundMessageRequester, SendMessageParams}, proto::{dht::JoinMessage, envelope::DhtMessageType}, storage::{DbConnection, DhtDatabase, DhtMetadataKey, StorageError}, DhtConfig, }; use chrono::{DateTime, Utc}; use derive_error::Error; use futures::{ channel::{mpsc, mpsc::SendError, oneshot}, future, future::BoxFuture, stream::{Fuse, FuturesUnordered}, SinkExt, StreamExt, }; use log::*; use std::{fmt, fmt::Display, sync::Arc}; use tari_comms::{ peer_manager::{ node_id::NodeDistance, NodeId, NodeIdentity, Peer, PeerFeatures, PeerManager, PeerManagerError, PeerQuery, PeerQuerySortBy, }, types::CommsPublicKey, }; use tari_shutdown::ShutdownSignal; use tari_utilities::{ message_format::{MessageFormat, MessageFormatError}, ByteArray, }; use tokio::task; use ttl_cache::TtlCache; const LOG_TARGET: &str = "comms::dht::actor"; #[derive(Debug, Error)] pub enum DhtActorError { /// MPSC channel is disconnected ChannelDisconnected, /// MPSC sender was unable to send because the channel buffer is full SendBufferFull, /// Reply sender canceled the request ReplyCanceled, PeerManagerError(PeerManagerError), #[error(msg_embedded, no_from, non_std)] SendFailed(String), DiscoveryError(DhtDiscoveryError), BlockingJoinError(tokio::task::JoinError), StorageError(StorageError), #[error(no_from)] StoredValueFailedToDeserialize(MessageFormatError), #[error(no_from)] FailedToSerializeValue(MessageFormatError), } impl From<SendError> for DhtActorError { fn from(err: SendError) -> Self { if err.is_disconnected() { DhtActorError::ChannelDisconnected } else if err.is_full() { DhtActorError::SendBufferFull } else { unreachable!(); } } } #[derive(Debug)] pub enum DhtRequest { /// Send a Join request to the network SendJoin, /// Inserts a message signature to the msg hash cache. This operation replies with a boolean /// which is true if the signature already exists in the cache, otherwise false MsgHashCacheInsert(Vec<u8>, oneshot::Sender<bool>), /// Fetch selected peers according to the broadcast strategy SelectPeers(BroadcastStrategy, oneshot::Sender<Vec<Peer>>), GetMetadata(DhtMetadataKey, oneshot::Sender<Result<Option<Vec<u8>>, DhtActorError>>), SetMetadata(DhtMetadataKey, Vec<u8>), } impl Display for DhtRequest { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { use DhtRequest::*; match self { SendJoin => f.write_str("SendJoin"), MsgHashCacheInsert(_, _) => f.write_str("MsgHashCacheInsert"), SelectPeers(s, _) => f.write_str(&format!("SelectPeers (Strategy={})", s)), GetMetadata(key, _) => f.write_str(&format!("GetSetting (key={})", key)), SetMetadata(key, value) => f.write_str(&format!("SetSetting (key={}, value={} bytes)", key, value.len())), } } } #[derive(Clone)] pub struct DhtRequester { sender: mpsc::Sender<DhtRequest>, } impl DhtRequester { pub fn new(sender: mpsc::Sender<DhtRequest>) -> Self { Self { sender } } pub async fn send_join(&mut self) -> Result<(), DhtActorError> { self.sender.send(DhtRequest::SendJoin).await.map_err(Into::into) } pub async fn select_peers(&mut self, broadcast_strategy: BroadcastStrategy) -> Result<Vec<Peer>, DhtActorError> { let (reply_tx, reply_rx) = oneshot::channel(); self.sender .send(DhtRequest::SelectPeers(broadcast_strategy, reply_tx)) .await?; reply_rx.await.map_err(|_| DhtActorError::ReplyCanceled) } pub async fn insert_message_hash(&mut self, signature: Vec<u8>) -> Result<bool, DhtActorError> { let (reply_tx, reply_rx) = oneshot::channel(); self.sender .send(DhtRequest::MsgHashCacheInsert(signature, reply_tx)) .await?; reply_rx.await.map_err(|_| DhtActorError::ReplyCanceled) } pub async fn get_metadata<T: MessageFormat>(&mut self, key: DhtMetadataKey) -> Result<Option<T>, DhtActorError> { let (reply_tx, reply_rx) = oneshot::channel(); self.sender.send(DhtRequest::GetMetadata(key, reply_tx)).await?; match reply_rx.await.map_err(|_| DhtActorError::ReplyCanceled)?? { Some(bytes) => T::from_binary(&bytes) .map(Some) .map_err(DhtActorError::StoredValueFailedToDeserialize), None => Ok(None), } } pub async fn set_metadata<T: MessageFormat>(&mut self, key: DhtMetadataKey, value: T) -> Result<(), DhtActorError> { let bytes = value.to_binary().map_err(DhtActorError::FailedToSerializeValue)?; self.sender.send(DhtRequest::SetMetadata(key, bytes)).await?; Ok(()) } } pub struct DhtActor<'a> { node_identity: Arc<NodeIdentity>, peer_manager: Arc<PeerManager>, database: DhtDatabase, outbound_requester: OutboundMessageRequester, config: DhtConfig, shutdown_signal: Option<ShutdownSignal>, request_rx: Fuse<mpsc::Receiver<DhtRequest>>, msg_hash_cache: TtlCache<Vec<u8>, ()>, pending_jobs: FuturesUnordered<BoxFuture<'a, Result<(), DhtActorError>>>, } impl DhtActor<'static> { pub async fn spawn(self) -> Result<(), DhtActorError> { task::spawn(Self::run(self)); Ok(()) } } impl<'a> DhtActor<'a> { pub fn new( config: DhtConfig, conn: DbConnection, node_identity: Arc<NodeIdentity>, peer_manager: Arc<PeerManager>, outbound_requester: OutboundMessageRequester, request_rx: mpsc::Receiver<DhtRequest>, shutdown_signal: ShutdownSignal, ) -> Self { Self { msg_hash_cache: TtlCache::new(config.msg_hash_cache_capacity), config, database: DhtDatabase::new(conn), outbound_requester, peer_manager, node_identity, shutdown_signal: Some(shutdown_signal), request_rx: request_rx.fuse(), pending_jobs: FuturesUnordered::new(), } } async fn run(mut self) { let offline_ts = self .database .get_metadata_value::<DateTime<Utc>>(DhtMetadataKey::OfflineTimestamp) .await .ok() .flatten(); info!( target: LOG_TARGET, "DhtActor started. {}", offline_ts .map(|dt| format!("Dht has been offline since '{}'", dt)) .unwrap_or_else(String::new) ); let mut shutdown_signal = self .shutdown_signal .take() .expect("DhtActor initialized without shutdown_signal"); loop { futures::select! { request = self.request_rx.select_next_some() => { debug!(target: LOG_TARGET, "DhtActor received message: {}", request); let handler = self.request_handler(request); self.pending_jobs.push(handler); }, result = self.pending_jobs.select_next_some() => { match result { Ok(_) => { trace!(target: LOG_TARGET, "DHT Actor request succeeded"); }, Err(err) => { error!(target: LOG_TARGET, "Error when handling DHT request message. {}", err); }, } }, _ = shutdown_signal => { info!(target: LOG_TARGET, "DhtActor is shutting down because it received a shutdown signal."); // Called with reference to database otherwise DhtActor is not Send Self::mark_shutdown_time(&self.database).await; break; }, } } } async fn mark_shutdown_time(db: &DhtDatabase) { if let Err(err) = db .set_metadata_value(DhtMetadataKey::OfflineTimestamp, Utc::now()) .await { error!(target: LOG_TARGET, "Failed to mark offline time: {:?}", err); } } fn request_handler(&mut self, request: DhtRequest) -> BoxFuture<'a, Result<(), DhtActorError>> { use DhtRequest::*; match request { SendJoin => { let node_identity = Arc::clone(&self.node_identity); let outbound_requester = self.outbound_requester.clone(); Box::pin(Self::send_join( node_identity, outbound_requester, self.config.num_neighbouring_nodes, )) }, MsgHashCacheInsert(hash, reply_tx) => { // No locks needed here. Downside is this isn't really async, however this should be // fine as it is very quick let already_exists = self .msg_hash_cache .insert(hash, (), self.config.msg_hash_cache_ttl) .is_some(); let result = reply_tx.send(already_exists).map_err(|_| DhtActorError::ReplyCanceled); Box::pin(future::ready(result)) }, SelectPeers(broadcast_strategy, reply_tx) => { let peer_manager = Arc::clone(&self.peer_manager); let node_identity = Arc::clone(&self.node_identity); let config = self.config.clone(); Box::pin(async move { match Self::select_peers(config, node_identity, peer_manager, broadcast_strategy).await { Ok(peers) => reply_tx.send(peers).map_err(|_| DhtActorError::ReplyCanceled), Err(err) => { error!(target: LOG_TARGET, "Peer selection failed: {:?}", err); reply_tx.send(Vec::new()).map_err(|_| DhtActorError::ReplyCanceled) }, } }) }, GetMetadata(key, reply_tx) => { let db = self.database.clone(); Box::pin(async move { let _ = reply_tx.send(db.get_metadata_value_bytes(key).await.map_err(Into::into)); Ok(()) }) }, SetMetadata(key, value) => { let db = self.database.clone(); Box::pin(async move { match db.set_metadata_value_bytes(key, value).await { Ok(_) => { info!(target: LOG_TARGET, "Dht setting '{}' set", key); }, Err(err) => { error!(target: LOG_TARGET, "set_setting failed because {:?}", err); }, } Ok(()) }) }, } } async fn send_join( node_identity: Arc<NodeIdentity>, mut outbound_requester: OutboundMessageRequester, num_neighbouring_nodes: usize, ) -> Result<(), DhtActorError> { let message = JoinMessage { node_id: node_identity.node_id().to_vec(), addresses: vec![node_identity.public_address().to_string()], peer_features: node_identity.features().bits(), }; debug!( target: LOG_TARGET, "Sending Join message to (at most) {} closest peers", num_neighbouring_nodes ); outbound_requester .send_message_no_header( SendMessageParams::new() .neighbours(Vec::new()) .with_dht_message_type(DhtMessageType::Join) .force_origin() .finish(), message, ) .await .map_err(|err| DhtActorError::SendFailed(format!("Failed to send join message: {}", err)))?; Ok(()) } async fn select_peers( config: DhtConfig, node_identity: Arc<NodeIdentity>, peer_manager: Arc<PeerManager>, broadcast_strategy: BroadcastStrategy, ) -> Result<Vec<Peer>, DhtActorError> { use BroadcastStrategy::*; match broadcast_strategy { DirectNodeId(node_id) => { // Send to a particular peer matching the given node ID peer_manager .direct_identity_node_id(&node_id) .await .map(|peer| peer.map(|p| vec![p]).unwrap_or_default()) .map_err(Into::into) }, DirectPublicKey(public_key) => { // Send to a particular peer matching the given node ID peer_manager .direct_identity_public_key(&public_key) .await .map(|peer| peer.map(|p| vec![p]).unwrap_or_default()) .map_err(Into::into) }, Flood => { // Send to all known peers peer_manager.flood_peers().await.map_err(Into::into) }, Closest(closest_request) => { Self::select_closest_peers_for_propagation( &config, &peer_manager, &closest_request.node_id, closest_request.n, &closest_request.excluded_peers, closest_request.peer_features, ) .await }, Random(n, excluded) => { // Send to a random set of peers of size n that are Communication Nodes peer_manager.random_peers(n, excluded).await.map_err(Into::into) }, // TODO: This is a common and expensive search - values here should be cached Neighbours(exclude, include_all_communication_clients) => { // Send to a random set of peers of size n that are Communication Nodes let mut candidates = Self::select_closest_peers_for_propagation( &config, &peer_manager, node_identity.node_id(), config.num_neighbouring_nodes, &exclude, PeerFeatures::MESSAGE_PROPAGATION, ) .await?; if include_all_communication_clients { let region_dist = peer_manager .calc_region_threshold( node_identity.node_id(), config.num_neighbouring_nodes, PeerFeatures::COMMUNICATION_CLIENT, ) .await?; Self::add_communication_client_nodes_within_region( &peer_manager, node_identity.node_id(), region_dist, &exclude, &mut candidates, ) .await?; } Ok(candidates) }, } } async fn add_communication_client_nodes_within_region( peer_manager: &PeerManager, ref_node_id: &NodeId, threshold_dist: NodeDistance, excluded_peers: &[CommsPublicKey], list: &mut Vec<Peer>, ) -> Result<(), DhtActorError> { let query = PeerQuery::new() .select_where(|peer| { if peer.features != PeerFeatures::COMMUNICATION_CLIENT { return false; } if peer.is_banned() || peer.is_offline() { return false; } if excluded_peers.contains(&peer.public_key) { return false; } let dist = ref_node_id.distance(&peer.node_id); if dist > threshold_dist { return false; } true }) .sort_by(PeerQuerySortBy::DistanceFrom(ref_node_id)); let peers = peer_manager.perform_query(query).await?; list.extend(peers); Ok(()) } /// Selects at least `n` MESSAGE_PROPAGATION peers (assuming that many are known) that are closest to `node_id` as /// well as other peers which do not advertise the MESSAGE_PROPAGATION flag (unless excluded by some other means /// e.g. `excluded` list, filter_predicate etc. The filter_predicate is called on each peer excluding them from /// the final results if that returns false. /// /// This ensures that peers are selected which are able to propagate the message further while still allowing /// clients to propagate to non-propagation nodes if required (e.g. Discovery messages) async fn select_closest_peers_for_propagation( config: &DhtConfig, peer_manager: &PeerManager, node_id: &NodeId, n: usize, excluded_peers: &[CommsPublicKey], features: PeerFeatures, ) -> Result<Vec<Peer>, DhtActorError> { // TODO: This query is expensive. We can probably cache a list of neighbouring peers which are online // Fetch to all n nearest neighbour Communication Nodes // which are eligible for connection. // Currently that means: // - The peer isn't banned, // - it has the required features // - it didn't recently fail to connect, and // - it is not in the exclusion list in closest_request let mut connect_ineligable_count = 0; let mut banned_count = 0; let mut excluded_count = 0; let mut filtered_out_node_count = 0; let query = PeerQuery::new() .select_where(|peer| { if peer.is_banned() { trace!(target: LOG_TARGET, "[{}] is banned", peer.node_id); banned_count += 1; return false; } if !peer.features.contains(features) { trace!( target: LOG_TARGET, "[{}] is does not have the required features {:?}", peer.node_id, features ); filtered_out_node_count += 1; return false; } let is_connect_eligible = { !peer.is_offline() && // Check this peer was recently connectable (peer.connection_stats.failed_attempts() <= config.broadcast_cooldown_max_attempts || peer.connection_stats .time_since_last_failure() .map(|failed_since| failed_since >= config.broadcast_cooldown_period) .unwrap_or(true)) }; if !is_connect_eligible { trace!( target: LOG_TARGET, "[{}] suffered too many connection attempt failures or is offline", peer.node_id ); connect_ineligable_count += 1; return false; } let is_excluded = excluded_peers.contains(&peer.public_key); if is_excluded { trace!(target: LOG_TARGET, "[{}] is explicitly excluded", peer.node_id); excluded_count += 1; return false; } true }) .sort_by(PeerQuerySortBy::DistanceFrom(&node_id)) .limit(n); let peers = peer_manager.perform_query(query).await?; let total_excluded = banned_count + connect_ineligable_count + excluded_count + filtered_out_node_count; if total_excluded > 0 { debug!( target: LOG_TARGET, "\n====================================\n Closest Peer Selection\n\n {num_peers} peer(s) selected\n \ {total} peer(s) were not selected \n\n {banned} banned\n {filtered_out} not communication node\n \ {not_connectable} are not connectable\n {excluded} explicitly excluded \ \n====================================\n", num_peers = peers.len(), total = total_excluded, banned = banned_count, filtered_out = filtered_out_node_count, not_connectable = connect_ineligable_count, excluded = excluded_count ); } Ok(peers) } } #[cfg(test)] mod test { use super::*; use crate::{ broadcast_strategy::BroadcastClosestRequest, test_utils::{make_node_identity, make_peer_manager}, }; use chrono::{DateTime, Utc}; use tari_comms::{ net_address::MultiaddressesWithStats, peer_manager::{PeerFeatures, PeerFlags}, }; use tari_shutdown::Shutdown; use tari_test_utils::random; async fn db_connection() -> DbConnection { let conn = DbConnection::connect_memory(random::string(8)).await.unwrap(); conn.migrate().await.unwrap(); conn } #[tokio_macros::test_basic] async fn send_join_request() { let node_identity = make_node_identity(); let peer_manager = make_peer_manager(); let (out_tx, mut out_rx) = mpsc::channel(1); let (actor_tx, actor_rx) = mpsc::channel(1); let mut requester = DhtRequester::new(actor_tx); let outbound_requester = OutboundMessageRequester::new(out_tx); let shutdown = Shutdown::new(); let actor = DhtActor::new( Default::default(), db_connection().await, node_identity, peer_manager, outbound_requester, actor_rx, shutdown.to_signal(), ); actor.spawn().await.unwrap(); requester.send_join().await.unwrap(); let (params, _) = unwrap_oms_send_msg!(out_rx.next().await.unwrap()); assert_eq!(params.dht_message_type, DhtMessageType::Join); } #[tokio_macros::test_basic] async fn insert_message_signature() { let node_identity = make_node_identity(); let peer_manager = make_peer_manager(); let (out_tx, _) = mpsc::channel(1); let (actor_tx, actor_rx) = mpsc::channel(1); let mut requester = DhtRequester::new(actor_tx); let outbound_requester = OutboundMessageRequester::new(out_tx); let shutdown = Shutdown::new(); let actor = DhtActor::new( Default::default(), db_connection().await, node_identity, peer_manager, outbound_requester, actor_rx, shutdown.to_signal(), ); actor.spawn().await.unwrap(); let signature = vec![1u8, 2, 3]; let is_dup = requester.insert_message_hash(signature.clone()).await.unwrap(); assert_eq!(is_dup, false); let is_dup = requester.insert_message_hash(signature).await.unwrap(); assert_eq!(is_dup, true); let is_dup = requester.insert_message_hash(Vec::new()).await.unwrap(); assert_eq!(is_dup, false); } #[tokio_macros::test_basic] async fn select_peers() { let node_identity = make_node_identity(); let peer_manager = make_peer_manager(); peer_manager .add_peer(Peer::new( node_identity.public_key().clone(), node_identity.node_id().clone(), MultiaddressesWithStats::new(vec![]), PeerFlags::empty(), PeerFeatures::COMMUNICATION_CLIENT, &[], )) .await .unwrap(); peer_manager .add_peer({ let node_identity = make_node_identity(); Peer::new( node_identity.public_key().clone(), node_identity.node_id().clone(), MultiaddressesWithStats::new(vec![]), PeerFlags::empty(), PeerFeatures::COMMUNICATION_NODE, &[], ) }) .await .unwrap(); let (out_tx, _) = mpsc::channel(1); let (actor_tx, actor_rx) = mpsc::channel(1); let mut requester = DhtRequester::new(actor_tx); let outbound_requester = OutboundMessageRequester::new(out_tx); let shutdown = Shutdown::new(); let actor = DhtActor::new( Default::default(), db_connection().await, Arc::clone(&node_identity), peer_manager, outbound_requester, actor_rx, shutdown.to_signal(), ); actor.spawn().await.unwrap(); let peers = requester .select_peers(BroadcastStrategy::Neighbours(Vec::new(), false)) .await .unwrap(); assert_eq!(peers.len(), 1); let peers = requester .select_peers(BroadcastStrategy::Neighbours(Vec::new(), true)) .await .unwrap(); assert_eq!(peers.len(), 2); let send_request = Box::new(BroadcastClosestRequest { n: 10, node_id: node_identity.node_id().clone(), peer_features: PeerFeatures::DHT_STORE_FORWARD, excluded_peers: vec![], }); let peers = requester .select_peers(BroadcastStrategy::Closest(send_request)) .await .unwrap(); assert_eq!(peers.len(), 1); let peers = requester .select_peers(BroadcastStrategy::DirectNodeId(Box::new( node_identity.node_id().clone(), ))) .await .unwrap(); assert_eq!(peers.len(), 1); } #[tokio_macros::test_basic] async fn get_and_set_metadata() { let node_identity = make_node_identity(); let peer_manager = make_peer_manager(); let (out_tx, _out_rx) = mpsc::channel(1); let (actor_tx, actor_rx) = mpsc::channel(1); let mut requester = DhtRequester::new(actor_tx); let outbound_requester = OutboundMessageRequester::new(out_tx); let shutdown = Shutdown::new(); let actor = DhtActor::new( Default::default(), db_connection().await, node_identity, peer_manager, outbound_requester, actor_rx, shutdown.to_signal(), ); actor.spawn().await.unwrap(); assert!(requester .get_metadata::<DateTime<Utc>>(DhtMetadataKey::OfflineTimestamp,) .await .unwrap() .is_none()); let ts = Utc::now(); requester .set_metadata(DhtMetadataKey::OfflineTimestamp, ts) .await .unwrap(); let got_ts = requester .get_metadata::<DateTime<Utc>>(DhtMetadataKey::OfflineTimestamp) .await .unwrap() .unwrap(); assert_eq!(got_ts, ts); // Check upsert let ts = Utc::now().checked_add_signed(chrono::Duration::seconds(123)).unwrap(); requester .set_metadata(DhtMetadataKey::OfflineTimestamp, ts) .await .unwrap(); let got_ts = requester .get_metadata::<DateTime<Utc>>(DhtMetadataKey::OfflineTimestamp) .await .unwrap() .unwrap(); assert_eq!(got_ts, ts); } }
extern crate machine; pub fn main() { machine::run() }
//! `hermit-abi` is small interface to call functions from the unikernel //! [RustyHermit](https://github.com/hermitcore/libhermit-rs). #![no_std] #![allow(nonstandard_style)] #![allow(clippy::missing_safety_doc)] #![allow(clippy::result_unit_err)] pub mod errno; pub mod tcplistener; pub mod tcpstream; use core::ffi::{c_int, c_void}; /// A thread handle type pub type Tid = u32; /// Maximum number of priorities pub const NO_PRIORITIES: usize = 31; /// Priority of a thread #[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Copy)] pub struct Priority(u8); impl Priority { pub const fn into(self) -> u8 { self.0 } pub const fn from(x: u8) -> Self { Priority(x) } } pub const HIGH_PRIO: Priority = Priority::from(3); pub const NORMAL_PRIO: Priority = Priority::from(2); pub const LOW_PRIO: Priority = Priority::from(1); /// A handle, identifying a socket #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default, Hash)] pub struct Handle(usize); pub const NSEC_PER_SEC: u64 = 1_000_000_000; pub const FUTEX_RELATIVE_TIMEOUT: u32 = 1; pub const CLOCK_REALTIME: u64 = 1; pub const CLOCK_MONOTONIC: u64 = 4; pub const STDIN_FILENO: c_int = 0; pub const STDOUT_FILENO: c_int = 1; pub const STDERR_FILENO: c_int = 2; pub const O_RDONLY: i32 = 0o0; pub const O_WRONLY: i32 = 0o1; pub const O_RDWR: i32 = 0o2; pub const O_CREAT: i32 = 0o100; pub const O_EXCL: i32 = 0o200; pub const O_TRUNC: i32 = 0o1000; pub const O_APPEND: i32 = 0o2000; /// returns true if file descriptor `fd` is a tty pub fn isatty(_fd: c_int) -> bool { false } /// `timespec` is used by `clock_gettime` to retrieve the /// current time #[derive(Copy, Clone, Debug)] #[repr(C)] pub struct timespec { /// seconds pub tv_sec: i64, /// nanoseconds pub tv_nsec: i64, } /// Internet protocol version. #[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] pub enum Version { Unspecified, Ipv4, Ipv6, } /// A four-octet IPv4 address. #[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default)] pub struct Ipv4Address(pub [u8; 4]); /// A sixteen-octet IPv6 address. #[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default)] pub struct Ipv6Address(pub [u8; 16]); /// An internetworking address. #[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] pub enum IpAddress { /// An unspecified address. /// May be used as a placeholder for storage where the address is not assigned yet. Unspecified, /// An IPv4 address. Ipv4(Ipv4Address), /// An IPv6 address. Ipv6(Ipv6Address), } /// The largest number `rand` will return pub const RAND_MAX: u64 = 2_147_483_647; pub const AF_INET: i32 = 0; pub const AF_INET6: i32 = 1; pub const IPPROTO_IP: i32 = 0; pub const IPPROTO_IPV6: i32 = 41; pub const IPPROTO_UDP: i32 = 17; pub const IPPROTO_TCP: i32 = 6; pub const IPV6_ADD_MEMBERSHIP: i32 = 12; pub const IPV6_DROP_MEMBERSHIP: i32 = 13; pub const IPV6_MULTICAST_LOOP: i32 = 19; pub const IPV6_V6ONLY: i32 = 27; pub const IP_TTL: i32 = 2; pub const IP_MULTICAST_TTL: i32 = 5; pub const IP_MULTICAST_LOOP: i32 = 7; pub const IP_ADD_MEMBERSHIP: i32 = 3; pub const IP_DROP_MEMBERSHIP: i32 = 4; pub const SHUT_RD: i32 = 0; pub const SHUT_WR: i32 = 1; pub const SHUT_RDWR: i32 = 2; pub const SOCK_DGRAM: i32 = 2; pub const SOCK_STREAM: i32 = 1; pub const SOL_SOCKET: i32 = 4095; pub const SO_BROADCAST: i32 = 32; pub const SO_ERROR: i32 = 4103; pub const SO_RCVTIMEO: i32 = 4102; pub const SO_REUSEADDR: i32 = 4; pub const SO_SNDTIMEO: i32 = 4101; pub const SO_LINGER: i32 = 128; pub const TCP_NODELAY: i32 = 1; pub const MSG_PEEK: i32 = 1; pub const FIONBIO: i32 = 0x8008667eu32 as i32; pub const EAI_NONAME: i32 = -2200; pub const EAI_SERVICE: i32 = -2201; pub const EAI_FAIL: i32 = -2202; pub const EAI_MEMORY: i32 = -2203; pub const EAI_FAMILY: i32 = -2204; pub const POLLIN: i16 = 0x1; pub const POLLPRI: i16 = 0x2; pub const POLLOUT: i16 = 0x4; pub const POLLERR: i16 = 0x8; pub const POLLHUP: i16 = 0x10; pub const POLLNVAL: i16 = 0x20; pub const POLLRDNORM: i16 = 0x040; pub const POLLRDBAND: i16 = 0x080; pub const POLLRDHUP: i16 = 0x2000; pub type sa_family_t = u8; pub type socklen_t = u32; pub type in_addr_t = u32; pub type in_port_t = u16; pub type time_t = i64; pub type suseconds_t = i64; pub type nfds_t = usize; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct in_addr { pub s_addr: u32, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct in6_addr { pub s6_addr: [u8; 16], } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct sockaddr { pub sa_len: u8, pub sa_family: sa_family_t, pub sa_data: [u8; 14], } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct sockaddr_in { pub sin_len: u8, pub sin_family: sa_family_t, pub sin_port: u16, pub sin_addr: in_addr, pub sin_zero: [u8; 8], } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct sockaddr_in6 { pub sin6_family: sa_family_t, pub sin6_port: u16, pub sin6_addr: in6_addr, pub sin6_flowinfo: u32, pub sin6_scope_id: u32, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct addrinfo { pub ai_flags: i32, pub ai_family: i32, pub ai_socktype: i32, pub ai_protocol: i32, pub ai_addrlen: socklen_t, pub ai_addr: *mut sockaddr, pub ai_canonname: *mut u8, pub ai_next: *mut addrinfo, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct sockaddr_storage { pub s2_len: u8, pub ss_family: sa_family_t, pub s2_data1: [i8; 2usize], pub s2_data2: [u32; 3usize], } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ip_mreq { pub imr_multiaddr: in_addr, pub imr_interface: in_addr, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ipv6_mreq { pub ipv6mr_multiaddr: in6_addr, pub ipv6mr_interface: u32, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct linger { pub l_onoff: i32, pub l_linger: i32, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct timeval { pub tv_sec: time_t, pub tv_usec: suseconds_t, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct pollfd { pub fd: i32, /* file descriptor */ pub events: i16, /* events to look for */ pub revents: i16, /* events returned */ } // sysmbols, which are part of the library operating system extern "C" { /// If the value at address matches the expected value, park the current thread until it is either /// woken up with [`futex_wake`] (returns 0) or an optional timeout elapses (returns -ETIMEDOUT). /// /// Setting `timeout` to null means the function will only return if [`futex_wake`] is called. /// Otherwise, `timeout` is interpreted as an absolute time measured with [`CLOCK_MONOTONIC`]. /// If [`FUTEX_RELATIVE_TIMEOUT`] is set in `flags` the timeout is understood to be relative /// to the current time. /// /// Returns -EINVAL if `address` is null, the timeout is negative or `flags` contains unknown values. #[link_name = "sys_futex_wait"] pub fn futex_wait( address: *mut u32, expected: u32, timeout: *const timespec, flags: u32, ) -> i32; /// Wake `count` threads waiting on the futex at `address`. Returns the number of threads /// woken up (saturates to `i32::MAX`). If `count` is `i32::MAX`, wake up all matching /// waiting threads. If `count` is negative or `address` is null, returns -EINVAL. #[link_name = "sys_futex_wake"] pub fn futex_wake(address: *mut u32, count: i32) -> i32; /// sem_init() initializes the unnamed semaphore at the address /// pointed to by `sem`. The `value` argument specifies the /// initial value for the semaphore. #[link_name = "sys_sem_init"] pub fn sem_init(sem: *mut *const c_void, value: u32) -> i32; /// sem_destroy() frees the unnamed semaphore at the address /// pointed to by `sem`. #[link_name = "sys_sem_destroy"] pub fn sem_destroy(sem: *const c_void) -> i32; /// sem_post() increments the semaphore pointed to by `sem`. /// If the semaphore's value consequently becomes greater /// than zero, then another thread blocked in a sem_wait call /// will be woken up and proceed to lock the semaphore. #[link_name = "sys_sem_post"] pub fn sem_post(sem: *const c_void) -> i32; /// try to decrement a semaphore /// /// sem_trywait() is the same as sem_timedwait(), except that /// if the decrement cannot be immediately performed, then call /// returns a negative value instead of blocking. #[link_name = "sys_sem_trywait"] pub fn sem_trywait(sem: *const c_void) -> i32; /// decrement a semaphore /// /// sem_timedwait() decrements the semaphore pointed to by `sem`. /// If the semaphore's value is greater than zero, then the /// the function returns immediately. If the semaphore currently /// has the value zero, then the call blocks until either /// it becomes possible to perform the decrement of the time limit /// to wait for the semaphore is expired. A time limit `ms` of /// means infinity waiting time. #[link_name = "sys_timedwait"] pub fn sem_timedwait(sem: *const c_void, ms: u32) -> i32; /// Determines the id of the current thread #[link_name = "sys_getpid"] pub fn getpid() -> u32; /// cause normal termination and return `arg` /// to the host system #[link_name = "sys_exit"] pub fn exit(arg: i32) -> !; /// cause abnormal termination #[link_name = "sys_abort"] pub fn abort() -> !; /// suspend execution for microsecond intervals /// /// The usleep() function suspends execution of the calling /// thread for (at least) `usecs` microseconds. #[link_name = "sys_usleep"] pub fn usleep(usecs: u64); /// spawn a new thread /// /// spawn() starts a new thread. The new thread starts execution /// by invoking `func(usize)`; `arg` is passed as the argument /// to `func`. `prio` defines the priority of the new thread, /// which can be between `LOW_PRIO` and `HIGH_PRIO`. /// `core_id` defines the core, where the thread is located. /// A negative value give the operating system the possibility /// to select the core by its own. #[link_name = "sys_spawn"] pub fn spawn( id: *mut Tid, func: extern "C" fn(usize), arg: usize, prio: u8, core_id: isize, ) -> i32; /// spawn a new thread with user-specified stack size /// /// spawn2() starts a new thread. The new thread starts execution /// by invoking `func(usize)`; `arg` is passed as the argument /// to `func`. `prio` defines the priority of the new thread, /// which can be between `LOW_PRIO` and `HIGH_PRIO`. /// `core_id` defines the core, where the thread is located. /// A negative value give the operating system the possibility /// to select the core by its own. /// In contrast to spawn(), spawn2() is able to define the /// stack size. #[link_name = "sys_spawn2"] pub fn spawn2( func: extern "C" fn(usize), arg: usize, prio: u8, stack_size: usize, core_id: isize, ) -> Tid; /// join with a terminated thread /// /// The join() function waits for the thread specified by `id` /// to terminate. #[link_name = "sys_join"] pub fn join(id: Tid) -> i32; /// yield the processor /// /// causes the calling thread to relinquish the CPU. The thread /// is moved to the end of the queue for its static priority. #[link_name = "sys_yield"] pub fn yield_now(); /// get current time /// /// The clock_gettime() functions allow the calling thread /// to retrieve the value used by a clock which is specified /// by `clock_id`. /// /// `CLOCK_REALTIME`: the system's real time clock, /// expressed as the amount of time since the Epoch. /// /// `CLOCK_MONOTONIC`: clock that increments monotonically, /// tracking the time since an arbitrary point #[link_name = "sys_clock_gettime"] pub fn clock_gettime(clock_id: u64, tp: *mut timespec) -> i32; /// open and possibly create a file /// /// The open() system call opens the file specified by `name`. /// If the specified file does not exist, it may optionally /// be created by open(). #[link_name = "sys_open"] pub fn open(name: *const i8, flags: i32, mode: i32) -> i32; /// delete the file it refers to `name` #[link_name = "sys_unlink"] pub fn unlink(name: *const i8) -> i32; /// determines the number of activated processors #[link_name = "sys_get_processor_count"] pub fn get_processor_count() -> usize; #[link_name = "sys_malloc"] pub fn malloc(size: usize, align: usize) -> *mut u8; #[doc(hidden)] #[link_name = "sys_realloc"] pub fn realloc(ptr: *mut u8, size: usize, align: usize, new_size: usize) -> *mut u8; #[doc(hidden)] #[link_name = "sys_free"] pub fn free(ptr: *mut u8, size: usize, align: usize); #[link_name = "sys_notify"] pub fn notify(id: usize, count: i32) -> i32; #[doc(hidden)] #[link_name = "sys_add_queue"] pub fn add_queue(id: usize, timeout_ns: i64) -> i32; #[doc(hidden)] #[link_name = "sys_wait"] pub fn wait(id: usize) -> i32; #[doc(hidden)] #[link_name = "sys_init_queue"] pub fn init_queue(id: usize) -> i32; #[doc(hidden)] #[link_name = "sys_destroy_queue"] pub fn destroy_queue(id: usize) -> i32; /// initialize the network stack #[link_name = "sys_network_init"] pub fn network_init() -> i32; /// Add current task to the queue of blocked tasks. After calling `block_current_task`, /// call `yield_now` to switch to another task. #[link_name = "sys_block_current_task"] pub fn block_current_task(); /// Add current task to the queue of blocked tasks, but wake it when `timeout` milliseconds /// have elapsed. /// /// After calling `block_current_task`, call `yield_now` to switch to another task. #[link_name = "sys_block_current_task_with_timeout"] pub fn block_current_task_with_timeout(timeout: u64); /// Wakeup task with the thread id `tid` #[link_name = "sys_wakeup_taskt"] pub fn wakeup_task(tid: Tid); #[link_name = "sys_accept"] pub fn accept(s: i32, addr: *mut sockaddr, addrlen: *mut socklen_t) -> i32; /// bind a name to a socket #[link_name = "sys_bind"] pub fn bind(s: i32, name: *const sockaddr, namelen: socklen_t) -> i32; #[link_name = "sys_connect"] pub fn connect(s: i32, name: *const sockaddr, namelen: socklen_t) -> i32; /// read from a file descriptor /// /// read() attempts to read `len` bytes of data from the object /// referenced by the descriptor `fd` into the buffer pointed /// to by `buf`. #[link_name = "sys_read"] pub fn read(fd: i32, buf: *mut u8, len: usize) -> isize; /// Fill `len` bytes in `buf` with cryptographically secure random data. /// /// Returns either the number of bytes written to buf (a positive value) or /// * `-EINVAL` if `flags` contains unknown flags. /// * `-ENOSYS` if the system does not support random data generation. #[link_name = "sys_read_entropy"] pub fn read_entropy(buf: *mut u8, len: usize, flags: u32) -> isize; /// receive() a message from a socket #[link_name = "sys_recv"] pub fn recv(socket: i32, buf: *mut u8, len: usize, flags: i32) -> isize; /// receive() a message from a socket #[link_name = "sys_recvfrom"] pub fn recvfrom( socket: i32, buf: *mut u8, len: usize, flags: i32, addr: *mut sockaddr, addrlen: *mut socklen_t, ) -> isize; /// write to a file descriptor /// /// write() attempts to write `len` of data to the object /// referenced by the descriptor `fd` from the /// buffer pointed to by `buf`. #[link_name = "sys_write"] pub fn write(fd: i32, buf: *const u8, len: usize) -> isize; /// close a file descriptor /// /// The close() call deletes a file descriptor `fd` from the object /// reference table. #[link_name = "sys_close"] pub fn close(fd: i32) -> i32; /// duplicate an existing file descriptor #[link_name = "sys_dup"] pub fn dup(fd: i32) -> i32; #[link_name = "sys_getpeername"] pub fn getpeername(s: i32, name: *mut sockaddr, namelen: *mut socklen_t) -> i32; #[link_name = "sys_getsockname"] pub fn getsockname(s: i32, name: *mut sockaddr, namelen: *mut socklen_t) -> i32; #[link_name = "sys_getsockopt"] pub fn getsockopt( s: i32, level: i32, optname: i32, optval: *mut c_void, optlen: *mut socklen_t, ) -> i32; #[link_name = "sys_setsockopt"] pub fn setsockopt( s: i32, level: i32, optname: i32, optval: *const c_void, optlen: socklen_t, ) -> i32; #[link_name = "sys_ioctl"] pub fn ioctl(s: i32, cmd: i32, argp: *mut c_void) -> i32; #[link_name = "sys_pool"] pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: i32) -> i32; /// listen for connections on a socket /// /// The `backlog` parameter defines the maximum length for the queue of pending /// connections. Currently, the `backlog` must be one. #[link_name = "sys_listen"] pub fn listen(s: i32, backlog: i32) -> i32; #[link_name = "sys_send"] pub fn send(s: i32, mem: *const c_void, len: usize, flags: i32) -> isize; #[link_name = "sys_sendto"] pub fn sendto( s: i32, mem: *const c_void, len: usize, flags: i32, to: *const sockaddr, tolen: socklen_t, ) -> isize; /// shut down part of a full-duplex connection #[link_name = "sys_shutdown_socket"] pub fn shutdown_socket(s: i32, how: i32) -> i32; #[link_name = "sys_socket"] pub fn socket(domain: i32, type_: i32, protocol: i32) -> i32; #[link_name = "sys_freeaddrinfo"] pub fn freeaddrinfo(ai: *mut addrinfo); #[link_name = "sys_getaddrinfo"] pub fn getaddrinfo( nodename: *const i8, servname: *const u8, hints: *const addrinfo, res: *mut *mut addrinfo, ) -> i32; fn sys_get_priority() -> u8; fn sys_set_priority(tid: Tid, prio: u8); } /// Determine the priority of the current thread #[inline(always)] pub unsafe fn get_priority() -> Priority { Priority::from(sys_get_priority()) } /// Determine the priority of the current thread #[inline(always)] pub unsafe fn set_priority(tid: Tid, prio: Priority) { sys_set_priority(tid, prio.into()); }
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtGui/qstandarditemmodel.h // dst-file: /src/gui/qstandarditemmodel.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::super::core::qabstractitemmodel::*; // 771 use std::ops::Deref; use super::super::core::qobject::*; // 771 use super::super::core::qstring::*; // 771 // use super::qstandarditemmodel::QStandardItem; // 773 use super::super::core::qvariant::*; // 771 // use super::qlist::*; // 775 use super::super::core::qobjectdefs::*; // 771 use super::super::core::qstringlist::*; // 771 use super::super::core::qmimedata::*; // 771 // use super::qmap::*; // 775 // use super::qstandarditemmodel::QStandardItemModel; // 773 use super::qbrush::*; // 773 use super::qicon::*; // 773 use super::super::core::qdatastream::*; // 771 use super::qfont::*; // 773 use super::super::core::qsize::*; // 771 // <= use block end // ext block begin => // #[link(name = "Qt5Core")] // #[link(name = "Qt5Gui")] // #[link(name = "Qt5Widgets")] // #[link(name = "QtInline")] extern { fn QStandardItemModel_Class_Size() -> c_int; // proto: void QStandardItemModel::QStandardItemModel(int rows, int columns, QObject * parent); fn C_ZN18QStandardItemModelC2EiiP7QObject(arg0: c_int, arg1: c_int, arg2: *mut c_void) -> u64; // proto: void QStandardItemModel::clear(); fn C_ZN18QStandardItemModel5clearEv(qthis: u64 /* *mut c_void*/); // proto: QStandardItem * QStandardItemModel::item(int row, int column); fn C_ZNK18QStandardItemModel4itemEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int) -> *mut c_void; // proto: bool QStandardItemModel::insertRow(int row, const QModelIndex & parent); fn C_ZN18QStandardItemModel9insertRowEiRK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void) -> c_char; // proto: void QStandardItemModel::setItem(int row, QStandardItem * item); fn C_ZN18QStandardItemModel7setItemEiP13QStandardItem(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void); // proto: QModelIndex QStandardItemModel::index(int row, int column, const QModelIndex & parent); fn C_ZNK18QStandardItemModel5indexEiiRK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: *mut c_void) -> *mut c_void; // proto: bool QStandardItemModel::setData(const QModelIndex & index, const QVariant & value, int role); fn C_ZN18QStandardItemModel7setDataERK11QModelIndexRK8QVarianti(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: *mut c_void, arg2: c_int) -> c_char; // proto: int QStandardItemModel::columnCount(const QModelIndex & parent); fn C_ZNK18QStandardItemModel11columnCountERK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_int; // proto: QStandardItem * QStandardItemModel::takeItem(int row, int column); fn C_ZN18QStandardItemModel8takeItemEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int) -> *mut c_void; // proto: void QStandardItemModel::setRowCount(int rows); fn C_ZN18QStandardItemModel11setRowCountEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: QStandardItem * QStandardItemModel::itemFromIndex(const QModelIndex & index); fn C_ZNK18QStandardItemModel13itemFromIndexERK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: bool QStandardItemModel::insertColumn(int column, const QModelIndex & parent); fn C_ZN18QStandardItemModel12insertColumnEiRK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void) -> c_char; // proto: void QStandardItemModel::setVerticalHeaderItem(int row, QStandardItem * item); fn C_ZN18QStandardItemModel21setVerticalHeaderItemEiP13QStandardItem(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void); // proto: void QStandardItemModel::QStandardItemModel(QObject * parent); fn C_ZN18QStandardItemModelC2EP7QObject(arg0: *mut c_void) -> u64; // proto: QList<QStandardItem *> QStandardItemModel::takeColumn(int column); fn C_ZN18QStandardItemModel10takeColumnEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: QStandardItem * QStandardItemModel::takeVerticalHeaderItem(int row); fn C_ZN18QStandardItemModel22takeVerticalHeaderItemEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: bool QStandardItemModel::insertColumns(int column, int count, const QModelIndex & parent); fn C_ZN18QStandardItemModel13insertColumnsEiiRK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: *mut c_void) -> c_char; // proto: const QMetaObject * QStandardItemModel::metaObject(); fn C_ZNK18QStandardItemModel10metaObjectEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: bool QStandardItemModel::insertRows(int row, int count, const QModelIndex & parent); fn C_ZN18QStandardItemModel10insertRowsEiiRK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: *mut c_void) -> c_char; // proto: void QStandardItemModel::insertRow(int row, QStandardItem * item); fn C_ZN18QStandardItemModel9insertRowEiP13QStandardItem(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void); // proto: QStandardItem * QStandardItemModel::invisibleRootItem(); fn C_ZNK18QStandardItemModel17invisibleRootItemEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QStandardItemModel::setItemPrototype(const QStandardItem * item); fn C_ZN18QStandardItemModel16setItemPrototypeEPK13QStandardItem(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QStandardItemModel::setHorizontalHeaderLabels(const QStringList & labels); fn C_ZN18QStandardItemModel25setHorizontalHeaderLabelsERK11QStringList(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QModelIndex QStandardItemModel::parent(const QModelIndex & child); fn C_ZNK18QStandardItemModel6parentERK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: bool QStandardItemModel::removeColumns(int column, int count, const QModelIndex & parent); fn C_ZN18QStandardItemModel13removeColumnsEiiRK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: *mut c_void) -> c_char; // proto: QModelIndex QStandardItemModel::sibling(int row, int column, const QModelIndex & idx); fn C_ZNK18QStandardItemModel7siblingEiiRK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: *mut c_void) -> *mut c_void; // proto: int QStandardItemModel::sortRole(); fn C_ZNK18QStandardItemModel8sortRoleEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: QStandardItem * QStandardItemModel::takeHorizontalHeaderItem(int column); fn C_ZN18QStandardItemModel24takeHorizontalHeaderItemEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: QModelIndex QStandardItemModel::indexFromItem(const QStandardItem * item); fn C_ZNK18QStandardItemModel13indexFromItemEPK13QStandardItem(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: const QStandardItem * QStandardItemModel::itemPrototype(); fn C_ZNK18QStandardItemModel13itemPrototypeEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QStandardItemModel::setHorizontalHeaderItem(int column, QStandardItem * item); fn C_ZN18QStandardItemModel23setHorizontalHeaderItemEiP13QStandardItem(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void); // proto: QStandardItem * QStandardItemModel::horizontalHeaderItem(int column); fn C_ZNK18QStandardItemModel20horizontalHeaderItemEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: void QStandardItemModel::appendRow(QStandardItem * item); fn C_ZN18QStandardItemModel9appendRowEP13QStandardItem(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QMap<int, QVariant> QStandardItemModel::itemData(const QModelIndex & index); fn C_ZNK18QStandardItemModel8itemDataERK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> *mut c_void; // proto: void QStandardItemModel::setSortRole(int role); fn C_ZN18QStandardItemModel11setSortRoleEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: bool QStandardItemModel::hasChildren(const QModelIndex & parent); fn C_ZNK18QStandardItemModel11hasChildrenERK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_char; // proto: void QStandardItemModel::~QStandardItemModel(); fn C_ZN18QStandardItemModelD2Ev(qthis: u64 /* *mut c_void*/); // proto: QVariant QStandardItemModel::data(const QModelIndex & index, int role); fn C_ZNK18QStandardItemModel4dataERK11QModelIndexi(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int) -> *mut c_void; // proto: QList<QStandardItem *> QStandardItemModel::takeRow(int row); fn C_ZN18QStandardItemModel7takeRowEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: void QStandardItemModel::setColumnCount(int columns); fn C_ZN18QStandardItemModel14setColumnCountEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: QStandardItem * QStandardItemModel::verticalHeaderItem(int row); fn C_ZNK18QStandardItemModel18verticalHeaderItemEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: bool QStandardItemModel::removeRows(int row, int count, const QModelIndex & parent); fn C_ZN18QStandardItemModel10removeRowsEiiRK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: *mut c_void) -> c_char; // proto: void QStandardItemModel::setVerticalHeaderLabels(const QStringList & labels); fn C_ZN18QStandardItemModel23setVerticalHeaderLabelsERK11QStringList(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QStandardItemModel::setItem(int row, int column, QStandardItem * item); fn C_ZN18QStandardItemModel7setItemEiiP13QStandardItem(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: *mut c_void); // proto: QStringList QStandardItemModel::mimeTypes(); fn C_ZNK18QStandardItemModel9mimeTypesEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: int QStandardItemModel::rowCount(const QModelIndex & parent); fn C_ZNK18QStandardItemModel8rowCountERK11QModelIndex(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_int; fn QStandardItem_Class_Size() -> c_int; // proto: void QStandardItem::setChild(int row, QStandardItem * item); fn C_ZN13QStandardItem8setChildEiPS_(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void); // proto: QStandardItemModel * QStandardItem::model(); fn C_ZNK13QStandardItem5modelEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QStandardItem::insertColumns(int column, int count); fn C_ZN13QStandardItem13insertColumnsEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int); // proto: void QStandardItem::setSelectable(bool selectable); fn C_ZN13QStandardItem13setSelectableEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: int QStandardItem::column(); fn C_ZNK13QStandardItem6columnEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: QString QStandardItem::whatsThis(); fn C_ZNK13QStandardItem9whatsThisEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QList<QStandardItem *> QStandardItem::takeColumn(int column); fn C_ZN13QStandardItem10takeColumnEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: void QStandardItem::setForeground(const QBrush & brush); fn C_ZN13QStandardItem13setForegroundERK6QBrush(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: bool QStandardItem::isEditable(); fn C_ZNK13QStandardItem10isEditableEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QIcon QStandardItem::icon(); fn C_ZNK13QStandardItem4iconEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QStandardItem::setWhatsThis(const QString & whatsThis); fn C_ZN13QStandardItem12setWhatsThisERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QStandardItem * QStandardItem::takeChild(int row, int column); fn C_ZN13QStandardItem9takeChildEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int) -> *mut c_void; // proto: int QStandardItem::type(); fn C_ZNK13QStandardItem4typeEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: QList<QStandardItem *> QStandardItem::takeRow(int row); fn C_ZN13QStandardItem7takeRowEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: int QStandardItem::row(); fn C_ZNK13QStandardItem3rowEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: bool QStandardItem::isCheckable(); fn C_ZNK13QStandardItem11isCheckableEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QString QStandardItem::text(); fn C_ZNK13QStandardItem4textEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QStandardItem::insertRows(int row, int count); fn C_ZN13QStandardItem10insertRowsEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int); // proto: bool QStandardItem::isDropEnabled(); fn C_ZNK13QStandardItem13isDropEnabledEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: bool QStandardItem::hasChildren(); fn C_ZNK13QStandardItem11hasChildrenEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QString QStandardItem::statusTip(); fn C_ZNK13QStandardItem9statusTipEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QStandardItem::setStatusTip(const QString & statusTip); fn C_ZN13QStandardItem12setStatusTipERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QStandardItem::appendRow(QStandardItem * item); fn C_ZN13QStandardItem9appendRowEPS_(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QStandardItem::setChild(int row, int column, QStandardItem * item); fn C_ZN13QStandardItem8setChildEiiPS_(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int, arg2: *mut c_void); // proto: QModelIndex QStandardItem::index(); fn C_ZNK13QStandardItem5indexEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QStandardItem::setIcon(const QIcon & icon); fn C_ZN13QStandardItem7setIconERK5QIcon(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QStandardItem::setToolTip(const QString & toolTip); fn C_ZN13QStandardItem10setToolTipERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QStandardItem::setData(const QVariant & value, int role); fn C_ZN13QStandardItem7setDataERK8QVarianti(qthis: u64 /* *mut c_void*/, arg0: *mut c_void, arg1: c_int); // proto: QBrush QStandardItem::background(); fn C_ZNK13QStandardItem10backgroundEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QVariant QStandardItem::data(int role); fn C_ZNK13QStandardItem4dataEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> *mut c_void; // proto: QStandardItem * QStandardItem::child(int row, int column); fn C_ZNK13QStandardItem5childEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int) -> *mut c_void; // proto: bool QStandardItem::isSelectable(); fn C_ZNK13QStandardItem12isSelectableEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QString QStandardItem::toolTip(); fn C_ZNK13QStandardItem7toolTipEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QStandardItem::setRowCount(int rows); fn C_ZN13QStandardItem11setRowCountEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: void QStandardItem::QStandardItem(const QString & text); fn C_ZN13QStandardItemC2ERK7QString(arg0: *mut c_void) -> u64; // proto: void QStandardItem::write(QDataStream & out); fn C_ZNK13QStandardItem5writeER11QDataStream(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: bool QStandardItem::isDragEnabled(); fn C_ZNK13QStandardItem13isDragEnabledEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: void QStandardItem::setAccessibleText(const QString & accessibleText); fn C_ZN13QStandardItem17setAccessibleTextERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: int QStandardItem::rowCount(); fn C_ZNK13QStandardItem8rowCountEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QStandardItem::removeColumn(int column); fn C_ZN13QStandardItem12removeColumnEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: void QStandardItem::removeRow(int row); fn C_ZN13QStandardItem9removeRowEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: int QStandardItem::columnCount(); fn C_ZNK13QStandardItem11columnCountEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: bool QStandardItem::isTristate(); fn C_ZNK13QStandardItem10isTristateEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: QStandardItem * QStandardItem::parent(); fn C_ZNK13QStandardItem6parentEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QStandardItem::insertRow(int row, QStandardItem * item); fn C_ZN13QStandardItem9insertRowEiPS_(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: *mut c_void); // proto: void QStandardItem::QStandardItem(const QIcon & icon, const QString & text); fn C_ZN13QStandardItemC2ERK5QIconRK7QString(arg0: *mut c_void, arg1: *mut c_void) -> u64; // proto: void QStandardItem::setFont(const QFont & font); fn C_ZN13QStandardItem7setFontERK5QFont(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QStandardItem::removeColumns(int column, int count); fn C_ZN13QStandardItem13removeColumnsEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int); // proto: void QStandardItem::~QStandardItem(); fn C_ZN13QStandardItemD2Ev(qthis: u64 /* *mut c_void*/); // proto: void QStandardItem::QStandardItem(); fn C_ZN13QStandardItemC2Ev() -> u64; // proto: QFont QStandardItem::font(); fn C_ZNK13QStandardItem4fontEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QStandardItem::setEditable(bool editable); fn C_ZN13QStandardItem11setEditableEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: void QStandardItem::setText(const QString & text); fn C_ZN13QStandardItem7setTextERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QStandardItem::QStandardItem(int rows, int columns); fn C_ZN13QStandardItemC2Eii(arg0: c_int, arg1: c_int) -> u64; // proto: bool QStandardItem::isEnabled(); fn C_ZNK13QStandardItem9isEnabledEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: void QStandardItem::setDropEnabled(bool dropEnabled); fn C_ZN13QStandardItem14setDropEnabledEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: void QStandardItem::setColumnCount(int columns); fn C_ZN13QStandardItem14setColumnCountEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: QString QStandardItem::accessibleText(); fn C_ZNK13QStandardItem14accessibleTextEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QStandardItem::read(QDataStream & in); fn C_ZN13QStandardItem4readER11QDataStream(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QStandardItem::setCheckable(bool checkable); fn C_ZN13QStandardItem12setCheckableEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: void QStandardItem::setDragEnabled(bool dragEnabled); fn C_ZN13QStandardItem14setDragEnabledEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: QBrush QStandardItem::foreground(); fn C_ZNK13QStandardItem10foregroundEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: QStandardItem * QStandardItem::clone(); fn C_ZNK13QStandardItem5cloneEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QStandardItem::removeRows(int row, int count); fn C_ZN13QStandardItem10removeRowsEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int); // proto: QSize QStandardItem::sizeHint(); fn C_ZNK13QStandardItem8sizeHintEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QStandardItem::setEnabled(bool enabled); fn C_ZN13QStandardItem10setEnabledEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: void QStandardItem::setBackground(const QBrush & brush); fn C_ZN13QStandardItem13setBackgroundERK6QBrush(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QStandardItem::setAccessibleDescription(const QString & accessibleDescription); fn C_ZN13QStandardItem24setAccessibleDescriptionERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: void QStandardItem::setSizeHint(const QSize & sizeHint); fn C_ZN13QStandardItem11setSizeHintERK5QSize(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: QString QStandardItem::accessibleDescription(); fn C_ZNK13QStandardItem21accessibleDescriptionEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QStandardItem::setTristate(bool tristate); fn C_ZN13QStandardItem11setTristateEb(qthis: u64 /* *mut c_void*/, arg0: c_char); fn QStandardItemModel_SlotProxy_connect__ZN18QStandardItemModel11itemChangedEP13QStandardItem(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); } // <= ext block end // body block begin => // class sizeof(QStandardItemModel)=1 #[derive(Default)] pub struct QStandardItemModel { qbase: QAbstractItemModel, pub qclsinst: u64 /* *mut c_void*/, pub _itemChanged: QStandardItemModel_itemChanged_signal, } // class sizeof(QStandardItem)=1 #[derive(Default)] pub struct QStandardItem { // qbase: None, pub qclsinst: u64 /* *mut c_void*/, } impl /*struct*/ QStandardItemModel { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QStandardItemModel { return QStandardItemModel{qbase: QAbstractItemModel::inheritFrom(qthis), qclsinst: qthis, ..Default::default()}; } } impl Deref for QStandardItemModel { type Target = QAbstractItemModel; fn deref(&self) -> &QAbstractItemModel { return & self.qbase; } } impl AsRef<QAbstractItemModel> for QStandardItemModel { fn as_ref(& self) -> & QAbstractItemModel { return & self.qbase; } } // proto: void QStandardItemModel::QStandardItemModel(int rows, int columns, QObject * parent); impl /*struct*/ QStandardItemModel { pub fn new<T: QStandardItemModel_new>(value: T) -> QStandardItemModel { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QStandardItemModel_new { fn new(self) -> QStandardItemModel; } // proto: void QStandardItemModel::QStandardItemModel(int rows, int columns, QObject * parent); impl<'a> /*trait*/ QStandardItemModel_new for (i32, i32, Option<&'a QObject>) { fn new(self) -> QStandardItemModel { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModelC2EiiP7QObject()}; let ctysz: c_int = unsafe{QStandardItemModel_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let arg2 = (if self.2.is_none() {0} else {self.2.unwrap().qclsinst}) as *mut c_void; let qthis: u64 = unsafe {C_ZN18QStandardItemModelC2EiiP7QObject(arg0, arg1, arg2)}; let rsthis = QStandardItemModel{qbase: QAbstractItemModel::inheritFrom(qthis), qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QStandardItemModel::clear(); impl /*struct*/ QStandardItemModel { pub fn clear<RetType, T: QStandardItemModel_clear<RetType>>(& self, overload_args: T) -> RetType { return overload_args.clear(self); // return 1; } } pub trait QStandardItemModel_clear<RetType> { fn clear(self , rsthis: & QStandardItemModel) -> RetType; } // proto: void QStandardItemModel::clear(); impl<'a> /*trait*/ QStandardItemModel_clear<()> for () { fn clear(self , rsthis: & QStandardItemModel) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel5clearEv()}; unsafe {C_ZN18QStandardItemModel5clearEv(rsthis.qclsinst)}; // return 1; } } // proto: QStandardItem * QStandardItemModel::item(int row, int column); impl /*struct*/ QStandardItemModel { pub fn item<RetType, T: QStandardItemModel_item<RetType>>(& self, overload_args: T) -> RetType { return overload_args.item(self); // return 1; } } pub trait QStandardItemModel_item<RetType> { fn item(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QStandardItem * QStandardItemModel::item(int row, int column); impl<'a> /*trait*/ QStandardItemModel_item<QStandardItem> for (i32, Option<i32>) { fn item(self , rsthis: & QStandardItemModel) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel4itemEii()}; let arg0 = self.0 as c_int; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK18QStandardItemModel4itemEii(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QStandardItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QStandardItemModel::insertRow(int row, const QModelIndex & parent); impl /*struct*/ QStandardItemModel { pub fn insertRow<RetType, T: QStandardItemModel_insertRow<RetType>>(& self, overload_args: T) -> RetType { return overload_args.insertRow(self); // return 1; } } pub trait QStandardItemModel_insertRow<RetType> { fn insertRow(self , rsthis: & QStandardItemModel) -> RetType; } // proto: bool QStandardItemModel::insertRow(int row, const QModelIndex & parent); impl<'a> /*trait*/ QStandardItemModel_insertRow<i8> for (i32, Option<&'a QModelIndex>) { fn insertRow(self , rsthis: & QStandardItemModel) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel9insertRowEiRK11QModelIndex()}; let arg0 = self.0 as c_int; let arg1 = (if self.1.is_none() {QModelIndex::new(()).qclsinst} else {self.1.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZN18QStandardItemModel9insertRowEiRK11QModelIndex(rsthis.qclsinst, arg0, arg1)}; return ret as i8; // 1 // return 1; } } // proto: void QStandardItemModel::setItem(int row, QStandardItem * item); impl /*struct*/ QStandardItemModel { pub fn setItem<RetType, T: QStandardItemModel_setItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setItem(self); // return 1; } } pub trait QStandardItemModel_setItem<RetType> { fn setItem(self , rsthis: & QStandardItemModel) -> RetType; } // proto: void QStandardItemModel::setItem(int row, QStandardItem * item); impl<'a> /*trait*/ QStandardItemModel_setItem<()> for (i32, &'a QStandardItem) { fn setItem(self , rsthis: & QStandardItemModel) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel7setItemEiP13QStandardItem()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; unsafe {C_ZN18QStandardItemModel7setItemEiP13QStandardItem(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: QModelIndex QStandardItemModel::index(int row, int column, const QModelIndex & parent); impl /*struct*/ QStandardItemModel { pub fn index<RetType, T: QStandardItemModel_index<RetType>>(& self, overload_args: T) -> RetType { return overload_args.index(self); // return 1; } } pub trait QStandardItemModel_index<RetType> { fn index(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QModelIndex QStandardItemModel::index(int row, int column, const QModelIndex & parent); impl<'a> /*trait*/ QStandardItemModel_index<QModelIndex> for (i32, i32, Option<&'a QModelIndex>) { fn index(self , rsthis: & QStandardItemModel) -> QModelIndex { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel5indexEiiRK11QModelIndex()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let arg2 = (if self.2.is_none() {QModelIndex::new(()).qclsinst} else {self.2.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK18QStandardItemModel5indexEiiRK11QModelIndex(rsthis.qclsinst, arg0, arg1, arg2)}; let mut ret1 = QModelIndex::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QStandardItemModel::setData(const QModelIndex & index, const QVariant & value, int role); impl /*struct*/ QStandardItemModel { pub fn setData<RetType, T: QStandardItemModel_setData<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setData(self); // return 1; } } pub trait QStandardItemModel_setData<RetType> { fn setData(self , rsthis: & QStandardItemModel) -> RetType; } // proto: bool QStandardItemModel::setData(const QModelIndex & index, const QVariant & value, int role); impl<'a> /*trait*/ QStandardItemModel_setData<i8> for (&'a QModelIndex, &'a QVariant, Option<i32>) { fn setData(self , rsthis: & QStandardItemModel) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel7setDataERK11QModelIndexRK8QVarianti()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let arg2 = (if self.2.is_none() {0 as i32} else {self.2.unwrap()}) as c_int; let mut ret = unsafe {C_ZN18QStandardItemModel7setDataERK11QModelIndexRK8QVarianti(rsthis.qclsinst, arg0, arg1, arg2)}; return ret as i8; // 1 // return 1; } } // proto: int QStandardItemModel::columnCount(const QModelIndex & parent); impl /*struct*/ QStandardItemModel { pub fn columnCount<RetType, T: QStandardItemModel_columnCount<RetType>>(& self, overload_args: T) -> RetType { return overload_args.columnCount(self); // return 1; } } pub trait QStandardItemModel_columnCount<RetType> { fn columnCount(self , rsthis: & QStandardItemModel) -> RetType; } // proto: int QStandardItemModel::columnCount(const QModelIndex & parent); impl<'a> /*trait*/ QStandardItemModel_columnCount<i32> for (Option<&'a QModelIndex>) { fn columnCount(self , rsthis: & QStandardItemModel) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel11columnCountERK11QModelIndex()}; let arg0 = (if self.is_none() {QModelIndex::new(()).qclsinst} else {self.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK18QStandardItemModel11columnCountERK11QModelIndex(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: QStandardItem * QStandardItemModel::takeItem(int row, int column); impl /*struct*/ QStandardItemModel { pub fn takeItem<RetType, T: QStandardItemModel_takeItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.takeItem(self); // return 1; } } pub trait QStandardItemModel_takeItem<RetType> { fn takeItem(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QStandardItem * QStandardItemModel::takeItem(int row, int column); impl<'a> /*trait*/ QStandardItemModel_takeItem<QStandardItem> for (i32, Option<i32>) { fn takeItem(self , rsthis: & QStandardItemModel) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel8takeItemEii()}; let arg0 = self.0 as c_int; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN18QStandardItemModel8takeItemEii(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QStandardItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QStandardItemModel::setRowCount(int rows); impl /*struct*/ QStandardItemModel { pub fn setRowCount<RetType, T: QStandardItemModel_setRowCount<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setRowCount(self); // return 1; } } pub trait QStandardItemModel_setRowCount<RetType> { fn setRowCount(self , rsthis: & QStandardItemModel) -> RetType; } // proto: void QStandardItemModel::setRowCount(int rows); impl<'a> /*trait*/ QStandardItemModel_setRowCount<()> for (i32) { fn setRowCount(self , rsthis: & QStandardItemModel) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel11setRowCountEi()}; let arg0 = self as c_int; unsafe {C_ZN18QStandardItemModel11setRowCountEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QStandardItem * QStandardItemModel::itemFromIndex(const QModelIndex & index); impl /*struct*/ QStandardItemModel { pub fn itemFromIndex<RetType, T: QStandardItemModel_itemFromIndex<RetType>>(& self, overload_args: T) -> RetType { return overload_args.itemFromIndex(self); // return 1; } } pub trait QStandardItemModel_itemFromIndex<RetType> { fn itemFromIndex(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QStandardItem * QStandardItemModel::itemFromIndex(const QModelIndex & index); impl<'a> /*trait*/ QStandardItemModel_itemFromIndex<QStandardItem> for (&'a QModelIndex) { fn itemFromIndex(self , rsthis: & QStandardItemModel) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel13itemFromIndexERK11QModelIndex()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK18QStandardItemModel13itemFromIndexERK11QModelIndex(rsthis.qclsinst, arg0)}; let mut ret1 = QStandardItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QStandardItemModel::insertColumn(int column, const QModelIndex & parent); impl /*struct*/ QStandardItemModel { pub fn insertColumn<RetType, T: QStandardItemModel_insertColumn<RetType>>(& self, overload_args: T) -> RetType { return overload_args.insertColumn(self); // return 1; } } pub trait QStandardItemModel_insertColumn<RetType> { fn insertColumn(self , rsthis: & QStandardItemModel) -> RetType; } // proto: bool QStandardItemModel::insertColumn(int column, const QModelIndex & parent); impl<'a> /*trait*/ QStandardItemModel_insertColumn<i8> for (i32, Option<&'a QModelIndex>) { fn insertColumn(self , rsthis: & QStandardItemModel) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel12insertColumnEiRK11QModelIndex()}; let arg0 = self.0 as c_int; let arg1 = (if self.1.is_none() {QModelIndex::new(()).qclsinst} else {self.1.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZN18QStandardItemModel12insertColumnEiRK11QModelIndex(rsthis.qclsinst, arg0, arg1)}; return ret as i8; // 1 // return 1; } } // proto: void QStandardItemModel::setVerticalHeaderItem(int row, QStandardItem * item); impl /*struct*/ QStandardItemModel { pub fn setVerticalHeaderItem<RetType, T: QStandardItemModel_setVerticalHeaderItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setVerticalHeaderItem(self); // return 1; } } pub trait QStandardItemModel_setVerticalHeaderItem<RetType> { fn setVerticalHeaderItem(self , rsthis: & QStandardItemModel) -> RetType; } // proto: void QStandardItemModel::setVerticalHeaderItem(int row, QStandardItem * item); impl<'a> /*trait*/ QStandardItemModel_setVerticalHeaderItem<()> for (i32, &'a QStandardItem) { fn setVerticalHeaderItem(self , rsthis: & QStandardItemModel) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel21setVerticalHeaderItemEiP13QStandardItem()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; unsafe {C_ZN18QStandardItemModel21setVerticalHeaderItemEiP13QStandardItem(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: void QStandardItemModel::QStandardItemModel(QObject * parent); impl<'a> /*trait*/ QStandardItemModel_new for (Option<&'a QObject>) { fn new(self) -> QStandardItemModel { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModelC2EP7QObject()}; let ctysz: c_int = unsafe{QStandardItemModel_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_ZN18QStandardItemModelC2EP7QObject(arg0)}; let rsthis = QStandardItemModel{qbase: QAbstractItemModel::inheritFrom(qthis), qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: QList<QStandardItem *> QStandardItemModel::takeColumn(int column); impl /*struct*/ QStandardItemModel { pub fn takeColumn<RetType, T: QStandardItemModel_takeColumn<RetType>>(& self, overload_args: T) -> RetType { return overload_args.takeColumn(self); // return 1; } } pub trait QStandardItemModel_takeColumn<RetType> { fn takeColumn(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QList<QStandardItem *> QStandardItemModel::takeColumn(int column); impl<'a> /*trait*/ QStandardItemModel_takeColumn<u64> for (i32) { fn takeColumn(self , rsthis: & QStandardItemModel) -> u64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel10takeColumnEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZN18QStandardItemModel10takeColumnEi(rsthis.qclsinst, arg0)}; return ret as u64; // 5 // return 1; } } // proto: QStandardItem * QStandardItemModel::takeVerticalHeaderItem(int row); impl /*struct*/ QStandardItemModel { pub fn takeVerticalHeaderItem<RetType, T: QStandardItemModel_takeVerticalHeaderItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.takeVerticalHeaderItem(self); // return 1; } } pub trait QStandardItemModel_takeVerticalHeaderItem<RetType> { fn takeVerticalHeaderItem(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QStandardItem * QStandardItemModel::takeVerticalHeaderItem(int row); impl<'a> /*trait*/ QStandardItemModel_takeVerticalHeaderItem<QStandardItem> for (i32) { fn takeVerticalHeaderItem(self , rsthis: & QStandardItemModel) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel22takeVerticalHeaderItemEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZN18QStandardItemModel22takeVerticalHeaderItemEi(rsthis.qclsinst, arg0)}; let mut ret1 = QStandardItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QStandardItemModel::insertColumns(int column, int count, const QModelIndex & parent); impl /*struct*/ QStandardItemModel { pub fn insertColumns<RetType, T: QStandardItemModel_insertColumns<RetType>>(& self, overload_args: T) -> RetType { return overload_args.insertColumns(self); // return 1; } } pub trait QStandardItemModel_insertColumns<RetType> { fn insertColumns(self , rsthis: & QStandardItemModel) -> RetType; } // proto: bool QStandardItemModel::insertColumns(int column, int count, const QModelIndex & parent); impl<'a> /*trait*/ QStandardItemModel_insertColumns<i8> for (i32, i32, Option<&'a QModelIndex>) { fn insertColumns(self , rsthis: & QStandardItemModel) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel13insertColumnsEiiRK11QModelIndex()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let arg2 = (if self.2.is_none() {QModelIndex::new(()).qclsinst} else {self.2.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZN18QStandardItemModel13insertColumnsEiiRK11QModelIndex(rsthis.qclsinst, arg0, arg1, arg2)}; return ret as i8; // 1 // return 1; } } // proto: const QMetaObject * QStandardItemModel::metaObject(); impl /*struct*/ QStandardItemModel { pub fn metaObject<RetType, T: QStandardItemModel_metaObject<RetType>>(& self, overload_args: T) -> RetType { return overload_args.metaObject(self); // return 1; } } pub trait QStandardItemModel_metaObject<RetType> { fn metaObject(self , rsthis: & QStandardItemModel) -> RetType; } // proto: const QMetaObject * QStandardItemModel::metaObject(); impl<'a> /*trait*/ QStandardItemModel_metaObject<QMetaObject> for () { fn metaObject(self , rsthis: & QStandardItemModel) -> QMetaObject { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel10metaObjectEv()}; let mut ret = unsafe {C_ZNK18QStandardItemModel10metaObjectEv(rsthis.qclsinst)}; let mut ret1 = QMetaObject::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QStandardItemModel::insertRows(int row, int count, const QModelIndex & parent); impl /*struct*/ QStandardItemModel { pub fn insertRows<RetType, T: QStandardItemModel_insertRows<RetType>>(& self, overload_args: T) -> RetType { return overload_args.insertRows(self); // return 1; } } pub trait QStandardItemModel_insertRows<RetType> { fn insertRows(self , rsthis: & QStandardItemModel) -> RetType; } // proto: bool QStandardItemModel::insertRows(int row, int count, const QModelIndex & parent); impl<'a> /*trait*/ QStandardItemModel_insertRows<i8> for (i32, i32, Option<&'a QModelIndex>) { fn insertRows(self , rsthis: & QStandardItemModel) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel10insertRowsEiiRK11QModelIndex()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let arg2 = (if self.2.is_none() {QModelIndex::new(()).qclsinst} else {self.2.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZN18QStandardItemModel10insertRowsEiiRK11QModelIndex(rsthis.qclsinst, arg0, arg1, arg2)}; return ret as i8; // 1 // return 1; } } // proto: void QStandardItemModel::insertRow(int row, QStandardItem * item); impl<'a> /*trait*/ QStandardItemModel_insertRow<()> for (i32, &'a QStandardItem) { fn insertRow(self , rsthis: & QStandardItemModel) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel9insertRowEiP13QStandardItem()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; unsafe {C_ZN18QStandardItemModel9insertRowEiP13QStandardItem(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: QStandardItem * QStandardItemModel::invisibleRootItem(); impl /*struct*/ QStandardItemModel { pub fn invisibleRootItem<RetType, T: QStandardItemModel_invisibleRootItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.invisibleRootItem(self); // return 1; } } pub trait QStandardItemModel_invisibleRootItem<RetType> { fn invisibleRootItem(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QStandardItem * QStandardItemModel::invisibleRootItem(); impl<'a> /*trait*/ QStandardItemModel_invisibleRootItem<QStandardItem> for () { fn invisibleRootItem(self , rsthis: & QStandardItemModel) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel17invisibleRootItemEv()}; let mut ret = unsafe {C_ZNK18QStandardItemModel17invisibleRootItemEv(rsthis.qclsinst)}; let mut ret1 = QStandardItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QStandardItemModel::setItemPrototype(const QStandardItem * item); impl /*struct*/ QStandardItemModel { pub fn setItemPrototype<RetType, T: QStandardItemModel_setItemPrototype<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setItemPrototype(self); // return 1; } } pub trait QStandardItemModel_setItemPrototype<RetType> { fn setItemPrototype(self , rsthis: & QStandardItemModel) -> RetType; } // proto: void QStandardItemModel::setItemPrototype(const QStandardItem * item); impl<'a> /*trait*/ QStandardItemModel_setItemPrototype<()> for (&'a QStandardItem) { fn setItemPrototype(self , rsthis: & QStandardItemModel) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel16setItemPrototypeEPK13QStandardItem()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN18QStandardItemModel16setItemPrototypeEPK13QStandardItem(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItemModel::setHorizontalHeaderLabels(const QStringList & labels); impl /*struct*/ QStandardItemModel { pub fn setHorizontalHeaderLabels<RetType, T: QStandardItemModel_setHorizontalHeaderLabels<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setHorizontalHeaderLabels(self); // return 1; } } pub trait QStandardItemModel_setHorizontalHeaderLabels<RetType> { fn setHorizontalHeaderLabels(self , rsthis: & QStandardItemModel) -> RetType; } // proto: void QStandardItemModel::setHorizontalHeaderLabels(const QStringList & labels); impl<'a> /*trait*/ QStandardItemModel_setHorizontalHeaderLabels<()> for (&'a QStringList) { fn setHorizontalHeaderLabels(self , rsthis: & QStandardItemModel) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel25setHorizontalHeaderLabelsERK11QStringList()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN18QStandardItemModel25setHorizontalHeaderLabelsERK11QStringList(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QModelIndex QStandardItemModel::parent(const QModelIndex & child); impl /*struct*/ QStandardItemModel { pub fn parent<RetType, T: QStandardItemModel_parent<RetType>>(& self, overload_args: T) -> RetType { return overload_args.parent(self); // return 1; } } pub trait QStandardItemModel_parent<RetType> { fn parent(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QModelIndex QStandardItemModel::parent(const QModelIndex & child); impl<'a> /*trait*/ QStandardItemModel_parent<QModelIndex> for (&'a QModelIndex) { fn parent(self , rsthis: & QStandardItemModel) -> QModelIndex { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel6parentERK11QModelIndex()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK18QStandardItemModel6parentERK11QModelIndex(rsthis.qclsinst, arg0)}; let mut ret1 = QModelIndex::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QStandardItemModel::removeColumns(int column, int count, const QModelIndex & parent); impl /*struct*/ QStandardItemModel { pub fn removeColumns<RetType, T: QStandardItemModel_removeColumns<RetType>>(& self, overload_args: T) -> RetType { return overload_args.removeColumns(self); // return 1; } } pub trait QStandardItemModel_removeColumns<RetType> { fn removeColumns(self , rsthis: & QStandardItemModel) -> RetType; } // proto: bool QStandardItemModel::removeColumns(int column, int count, const QModelIndex & parent); impl<'a> /*trait*/ QStandardItemModel_removeColumns<i8> for (i32, i32, Option<&'a QModelIndex>) { fn removeColumns(self , rsthis: & QStandardItemModel) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel13removeColumnsEiiRK11QModelIndex()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let arg2 = (if self.2.is_none() {QModelIndex::new(()).qclsinst} else {self.2.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZN18QStandardItemModel13removeColumnsEiiRK11QModelIndex(rsthis.qclsinst, arg0, arg1, arg2)}; return ret as i8; // 1 // return 1; } } // proto: QModelIndex QStandardItemModel::sibling(int row, int column, const QModelIndex & idx); impl /*struct*/ QStandardItemModel { pub fn sibling<RetType, T: QStandardItemModel_sibling<RetType>>(& self, overload_args: T) -> RetType { return overload_args.sibling(self); // return 1; } } pub trait QStandardItemModel_sibling<RetType> { fn sibling(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QModelIndex QStandardItemModel::sibling(int row, int column, const QModelIndex & idx); impl<'a> /*trait*/ QStandardItemModel_sibling<QModelIndex> for (i32, i32, &'a QModelIndex) { fn sibling(self , rsthis: & QStandardItemModel) -> QModelIndex { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel7siblingEiiRK11QModelIndex()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let arg2 = self.2.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK18QStandardItemModel7siblingEiiRK11QModelIndex(rsthis.qclsinst, arg0, arg1, arg2)}; let mut ret1 = QModelIndex::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QStandardItemModel::sortRole(); impl /*struct*/ QStandardItemModel { pub fn sortRole<RetType, T: QStandardItemModel_sortRole<RetType>>(& self, overload_args: T) -> RetType { return overload_args.sortRole(self); // return 1; } } pub trait QStandardItemModel_sortRole<RetType> { fn sortRole(self , rsthis: & QStandardItemModel) -> RetType; } // proto: int QStandardItemModel::sortRole(); impl<'a> /*trait*/ QStandardItemModel_sortRole<i32> for () { fn sortRole(self , rsthis: & QStandardItemModel) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel8sortRoleEv()}; let mut ret = unsafe {C_ZNK18QStandardItemModel8sortRoleEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: QStandardItem * QStandardItemModel::takeHorizontalHeaderItem(int column); impl /*struct*/ QStandardItemModel { pub fn takeHorizontalHeaderItem<RetType, T: QStandardItemModel_takeHorizontalHeaderItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.takeHorizontalHeaderItem(self); // return 1; } } pub trait QStandardItemModel_takeHorizontalHeaderItem<RetType> { fn takeHorizontalHeaderItem(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QStandardItem * QStandardItemModel::takeHorizontalHeaderItem(int column); impl<'a> /*trait*/ QStandardItemModel_takeHorizontalHeaderItem<QStandardItem> for (i32) { fn takeHorizontalHeaderItem(self , rsthis: & QStandardItemModel) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel24takeHorizontalHeaderItemEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZN18QStandardItemModel24takeHorizontalHeaderItemEi(rsthis.qclsinst, arg0)}; let mut ret1 = QStandardItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QModelIndex QStandardItemModel::indexFromItem(const QStandardItem * item); impl /*struct*/ QStandardItemModel { pub fn indexFromItem<RetType, T: QStandardItemModel_indexFromItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.indexFromItem(self); // return 1; } } pub trait QStandardItemModel_indexFromItem<RetType> { fn indexFromItem(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QModelIndex QStandardItemModel::indexFromItem(const QStandardItem * item); impl<'a> /*trait*/ QStandardItemModel_indexFromItem<QModelIndex> for (&'a QStandardItem) { fn indexFromItem(self , rsthis: & QStandardItemModel) -> QModelIndex { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel13indexFromItemEPK13QStandardItem()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK18QStandardItemModel13indexFromItemEPK13QStandardItem(rsthis.qclsinst, arg0)}; let mut ret1 = QModelIndex::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: const QStandardItem * QStandardItemModel::itemPrototype(); impl /*struct*/ QStandardItemModel { pub fn itemPrototype<RetType, T: QStandardItemModel_itemPrototype<RetType>>(& self, overload_args: T) -> RetType { return overload_args.itemPrototype(self); // return 1; } } pub trait QStandardItemModel_itemPrototype<RetType> { fn itemPrototype(self , rsthis: & QStandardItemModel) -> RetType; } // proto: const QStandardItem * QStandardItemModel::itemPrototype(); impl<'a> /*trait*/ QStandardItemModel_itemPrototype<QStandardItem> for () { fn itemPrototype(self , rsthis: & QStandardItemModel) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel13itemPrototypeEv()}; let mut ret = unsafe {C_ZNK18QStandardItemModel13itemPrototypeEv(rsthis.qclsinst)}; let mut ret1 = QStandardItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QStandardItemModel::setHorizontalHeaderItem(int column, QStandardItem * item); impl /*struct*/ QStandardItemModel { pub fn setHorizontalHeaderItem<RetType, T: QStandardItemModel_setHorizontalHeaderItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setHorizontalHeaderItem(self); // return 1; } } pub trait QStandardItemModel_setHorizontalHeaderItem<RetType> { fn setHorizontalHeaderItem(self , rsthis: & QStandardItemModel) -> RetType; } // proto: void QStandardItemModel::setHorizontalHeaderItem(int column, QStandardItem * item); impl<'a> /*trait*/ QStandardItemModel_setHorizontalHeaderItem<()> for (i32, &'a QStandardItem) { fn setHorizontalHeaderItem(self , rsthis: & QStandardItemModel) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel23setHorizontalHeaderItemEiP13QStandardItem()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; unsafe {C_ZN18QStandardItemModel23setHorizontalHeaderItemEiP13QStandardItem(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: QStandardItem * QStandardItemModel::horizontalHeaderItem(int column); impl /*struct*/ QStandardItemModel { pub fn horizontalHeaderItem<RetType, T: QStandardItemModel_horizontalHeaderItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.horizontalHeaderItem(self); // return 1; } } pub trait QStandardItemModel_horizontalHeaderItem<RetType> { fn horizontalHeaderItem(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QStandardItem * QStandardItemModel::horizontalHeaderItem(int column); impl<'a> /*trait*/ QStandardItemModel_horizontalHeaderItem<QStandardItem> for (i32) { fn horizontalHeaderItem(self , rsthis: & QStandardItemModel) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel20horizontalHeaderItemEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK18QStandardItemModel20horizontalHeaderItemEi(rsthis.qclsinst, arg0)}; let mut ret1 = QStandardItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QStandardItemModel::appendRow(QStandardItem * item); impl /*struct*/ QStandardItemModel { pub fn appendRow<RetType, T: QStandardItemModel_appendRow<RetType>>(& self, overload_args: T) -> RetType { return overload_args.appendRow(self); // return 1; } } pub trait QStandardItemModel_appendRow<RetType> { fn appendRow(self , rsthis: & QStandardItemModel) -> RetType; } // proto: void QStandardItemModel::appendRow(QStandardItem * item); impl<'a> /*trait*/ QStandardItemModel_appendRow<()> for (&'a QStandardItem) { fn appendRow(self , rsthis: & QStandardItemModel) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel9appendRowEP13QStandardItem()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN18QStandardItemModel9appendRowEP13QStandardItem(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QMap<int, QVariant> QStandardItemModel::itemData(const QModelIndex & index); impl /*struct*/ QStandardItemModel { pub fn itemData<RetType, T: QStandardItemModel_itemData<RetType>>(& self, overload_args: T) -> RetType { return overload_args.itemData(self); // return 1; } } pub trait QStandardItemModel_itemData<RetType> { fn itemData(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QMap<int, QVariant> QStandardItemModel::itemData(const QModelIndex & index); impl<'a> /*trait*/ QStandardItemModel_itemData<u64> for (&'a QModelIndex) { fn itemData(self , rsthis: & QStandardItemModel) -> u64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel8itemDataERK11QModelIndex()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK18QStandardItemModel8itemDataERK11QModelIndex(rsthis.qclsinst, arg0)}; return ret as u64; // 5 // return 1; } } // proto: void QStandardItemModel::setSortRole(int role); impl /*struct*/ QStandardItemModel { pub fn setSortRole<RetType, T: QStandardItemModel_setSortRole<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setSortRole(self); // return 1; } } pub trait QStandardItemModel_setSortRole<RetType> { fn setSortRole(self , rsthis: & QStandardItemModel) -> RetType; } // proto: void QStandardItemModel::setSortRole(int role); impl<'a> /*trait*/ QStandardItemModel_setSortRole<()> for (i32) { fn setSortRole(self , rsthis: & QStandardItemModel) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel11setSortRoleEi()}; let arg0 = self as c_int; unsafe {C_ZN18QStandardItemModel11setSortRoleEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QStandardItemModel::hasChildren(const QModelIndex & parent); impl /*struct*/ QStandardItemModel { pub fn hasChildren<RetType, T: QStandardItemModel_hasChildren<RetType>>(& self, overload_args: T) -> RetType { return overload_args.hasChildren(self); // return 1; } } pub trait QStandardItemModel_hasChildren<RetType> { fn hasChildren(self , rsthis: & QStandardItemModel) -> RetType; } // proto: bool QStandardItemModel::hasChildren(const QModelIndex & parent); impl<'a> /*trait*/ QStandardItemModel_hasChildren<i8> for (Option<&'a QModelIndex>) { fn hasChildren(self , rsthis: & QStandardItemModel) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel11hasChildrenERK11QModelIndex()}; let arg0 = (if self.is_none() {QModelIndex::new(()).qclsinst} else {self.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK18QStandardItemModel11hasChildrenERK11QModelIndex(rsthis.qclsinst, arg0)}; return ret as i8; // 1 // return 1; } } // proto: void QStandardItemModel::~QStandardItemModel(); impl /*struct*/ QStandardItemModel { pub fn free<RetType, T: QStandardItemModel_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QStandardItemModel_free<RetType> { fn free(self , rsthis: & QStandardItemModel) -> RetType; } // proto: void QStandardItemModel::~QStandardItemModel(); impl<'a> /*trait*/ QStandardItemModel_free<()> for () { fn free(self , rsthis: & QStandardItemModel) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModelD2Ev()}; unsafe {C_ZN18QStandardItemModelD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: QVariant QStandardItemModel::data(const QModelIndex & index, int role); impl /*struct*/ QStandardItemModel { pub fn data<RetType, T: QStandardItemModel_data<RetType>>(& self, overload_args: T) -> RetType { return overload_args.data(self); // return 1; } } pub trait QStandardItemModel_data<RetType> { fn data(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QVariant QStandardItemModel::data(const QModelIndex & index, int role); impl<'a> /*trait*/ QStandardItemModel_data<QVariant> for (&'a QModelIndex, Option<i32>) { fn data(self , rsthis: & QStandardItemModel) -> QVariant { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel4dataERK11QModelIndexi()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {0 as i32} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK18QStandardItemModel4dataERK11QModelIndexi(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QVariant::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QList<QStandardItem *> QStandardItemModel::takeRow(int row); impl /*struct*/ QStandardItemModel { pub fn takeRow<RetType, T: QStandardItemModel_takeRow<RetType>>(& self, overload_args: T) -> RetType { return overload_args.takeRow(self); // return 1; } } pub trait QStandardItemModel_takeRow<RetType> { fn takeRow(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QList<QStandardItem *> QStandardItemModel::takeRow(int row); impl<'a> /*trait*/ QStandardItemModel_takeRow<u64> for (i32) { fn takeRow(self , rsthis: & QStandardItemModel) -> u64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel7takeRowEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZN18QStandardItemModel7takeRowEi(rsthis.qclsinst, arg0)}; return ret as u64; // 5 // return 1; } } // proto: void QStandardItemModel::setColumnCount(int columns); impl /*struct*/ QStandardItemModel { pub fn setColumnCount<RetType, T: QStandardItemModel_setColumnCount<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setColumnCount(self); // return 1; } } pub trait QStandardItemModel_setColumnCount<RetType> { fn setColumnCount(self , rsthis: & QStandardItemModel) -> RetType; } // proto: void QStandardItemModel::setColumnCount(int columns); impl<'a> /*trait*/ QStandardItemModel_setColumnCount<()> for (i32) { fn setColumnCount(self , rsthis: & QStandardItemModel) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel14setColumnCountEi()}; let arg0 = self as c_int; unsafe {C_ZN18QStandardItemModel14setColumnCountEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QStandardItem * QStandardItemModel::verticalHeaderItem(int row); impl /*struct*/ QStandardItemModel { pub fn verticalHeaderItem<RetType, T: QStandardItemModel_verticalHeaderItem<RetType>>(& self, overload_args: T) -> RetType { return overload_args.verticalHeaderItem(self); // return 1; } } pub trait QStandardItemModel_verticalHeaderItem<RetType> { fn verticalHeaderItem(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QStandardItem * QStandardItemModel::verticalHeaderItem(int row); impl<'a> /*trait*/ QStandardItemModel_verticalHeaderItem<QStandardItem> for (i32) { fn verticalHeaderItem(self , rsthis: & QStandardItemModel) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel18verticalHeaderItemEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK18QStandardItemModel18verticalHeaderItemEi(rsthis.qclsinst, arg0)}; let mut ret1 = QStandardItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QStandardItemModel::removeRows(int row, int count, const QModelIndex & parent); impl /*struct*/ QStandardItemModel { pub fn removeRows<RetType, T: QStandardItemModel_removeRows<RetType>>(& self, overload_args: T) -> RetType { return overload_args.removeRows(self); // return 1; } } pub trait QStandardItemModel_removeRows<RetType> { fn removeRows(self , rsthis: & QStandardItemModel) -> RetType; } // proto: bool QStandardItemModel::removeRows(int row, int count, const QModelIndex & parent); impl<'a> /*trait*/ QStandardItemModel_removeRows<i8> for (i32, i32, Option<&'a QModelIndex>) { fn removeRows(self , rsthis: & QStandardItemModel) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel10removeRowsEiiRK11QModelIndex()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let arg2 = (if self.2.is_none() {QModelIndex::new(()).qclsinst} else {self.2.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZN18QStandardItemModel10removeRowsEiiRK11QModelIndex(rsthis.qclsinst, arg0, arg1, arg2)}; return ret as i8; // 1 // return 1; } } // proto: void QStandardItemModel::setVerticalHeaderLabels(const QStringList & labels); impl /*struct*/ QStandardItemModel { pub fn setVerticalHeaderLabels<RetType, T: QStandardItemModel_setVerticalHeaderLabels<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setVerticalHeaderLabels(self); // return 1; } } pub trait QStandardItemModel_setVerticalHeaderLabels<RetType> { fn setVerticalHeaderLabels(self , rsthis: & QStandardItemModel) -> RetType; } // proto: void QStandardItemModel::setVerticalHeaderLabels(const QStringList & labels); impl<'a> /*trait*/ QStandardItemModel_setVerticalHeaderLabels<()> for (&'a QStringList) { fn setVerticalHeaderLabels(self , rsthis: & QStandardItemModel) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel23setVerticalHeaderLabelsERK11QStringList()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN18QStandardItemModel23setVerticalHeaderLabelsERK11QStringList(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItemModel::setItem(int row, int column, QStandardItem * item); impl<'a> /*trait*/ QStandardItemModel_setItem<()> for (i32, i32, &'a QStandardItem) { fn setItem(self , rsthis: & QStandardItemModel) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN18QStandardItemModel7setItemEiiP13QStandardItem()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let arg2 = self.2.qclsinst as *mut c_void; unsafe {C_ZN18QStandardItemModel7setItemEiiP13QStandardItem(rsthis.qclsinst, arg0, arg1, arg2)}; // return 1; } } // proto: QStringList QStandardItemModel::mimeTypes(); impl /*struct*/ QStandardItemModel { pub fn mimeTypes<RetType, T: QStandardItemModel_mimeTypes<RetType>>(& self, overload_args: T) -> RetType { return overload_args.mimeTypes(self); // return 1; } } pub trait QStandardItemModel_mimeTypes<RetType> { fn mimeTypes(self , rsthis: & QStandardItemModel) -> RetType; } // proto: QStringList QStandardItemModel::mimeTypes(); impl<'a> /*trait*/ QStandardItemModel_mimeTypes<QStringList> for () { fn mimeTypes(self , rsthis: & QStandardItemModel) -> QStringList { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel9mimeTypesEv()}; let mut ret = unsafe {C_ZNK18QStandardItemModel9mimeTypesEv(rsthis.qclsinst)}; let mut ret1 = QStringList::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QStandardItemModel::rowCount(const QModelIndex & parent); impl /*struct*/ QStandardItemModel { pub fn rowCount<RetType, T: QStandardItemModel_rowCount<RetType>>(& self, overload_args: T) -> RetType { return overload_args.rowCount(self); // return 1; } } pub trait QStandardItemModel_rowCount<RetType> { fn rowCount(self , rsthis: & QStandardItemModel) -> RetType; } // proto: int QStandardItemModel::rowCount(const QModelIndex & parent); impl<'a> /*trait*/ QStandardItemModel_rowCount<i32> for (Option<&'a QModelIndex>) { fn rowCount(self , rsthis: & QStandardItemModel) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK18QStandardItemModel8rowCountERK11QModelIndex()}; let arg0 = (if self.is_none() {QModelIndex::new(()).qclsinst} else {self.unwrap().qclsinst}) as *mut c_void; let mut ret = unsafe {C_ZNK18QStandardItemModel8rowCountERK11QModelIndex(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } impl /*struct*/ QStandardItem { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QStandardItem { return QStandardItem{qclsinst: qthis, ..Default::default()}; } } // proto: void QStandardItem::setChild(int row, QStandardItem * item); impl /*struct*/ QStandardItem { pub fn setChild<RetType, T: QStandardItem_setChild<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setChild(self); // return 1; } } pub trait QStandardItem_setChild<RetType> { fn setChild(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setChild(int row, QStandardItem * item); impl<'a> /*trait*/ QStandardItem_setChild<()> for (i32, &'a QStandardItem) { fn setChild(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem8setChildEiPS_()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; unsafe {C_ZN13QStandardItem8setChildEiPS_(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: QStandardItemModel * QStandardItem::model(); impl /*struct*/ QStandardItem { pub fn model<RetType, T: QStandardItem_model<RetType>>(& self, overload_args: T) -> RetType { return overload_args.model(self); // return 1; } } pub trait QStandardItem_model<RetType> { fn model(self , rsthis: & QStandardItem) -> RetType; } // proto: QStandardItemModel * QStandardItem::model(); impl<'a> /*trait*/ QStandardItem_model<QStandardItemModel> for () { fn model(self , rsthis: & QStandardItem) -> QStandardItemModel { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem5modelEv()}; let mut ret = unsafe {C_ZNK13QStandardItem5modelEv(rsthis.qclsinst)}; let mut ret1 = QStandardItemModel::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QStandardItem::insertColumns(int column, int count); impl /*struct*/ QStandardItem { pub fn insertColumns<RetType, T: QStandardItem_insertColumns<RetType>>(& self, overload_args: T) -> RetType { return overload_args.insertColumns(self); // return 1; } } pub trait QStandardItem_insertColumns<RetType> { fn insertColumns(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::insertColumns(int column, int count); impl<'a> /*trait*/ QStandardItem_insertColumns<()> for (i32, i32) { fn insertColumns(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem13insertColumnsEii()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; unsafe {C_ZN13QStandardItem13insertColumnsEii(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: void QStandardItem::setSelectable(bool selectable); impl /*struct*/ QStandardItem { pub fn setSelectable<RetType, T: QStandardItem_setSelectable<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setSelectable(self); // return 1; } } pub trait QStandardItem_setSelectable<RetType> { fn setSelectable(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setSelectable(bool selectable); impl<'a> /*trait*/ QStandardItem_setSelectable<()> for (i8) { fn setSelectable(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem13setSelectableEb()}; let arg0 = self as c_char; unsafe {C_ZN13QStandardItem13setSelectableEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int QStandardItem::column(); impl /*struct*/ QStandardItem { pub fn column<RetType, T: QStandardItem_column<RetType>>(& self, overload_args: T) -> RetType { return overload_args.column(self); // return 1; } } pub trait QStandardItem_column<RetType> { fn column(self , rsthis: & QStandardItem) -> RetType; } // proto: int QStandardItem::column(); impl<'a> /*trait*/ QStandardItem_column<i32> for () { fn column(self , rsthis: & QStandardItem) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem6columnEv()}; let mut ret = unsafe {C_ZNK13QStandardItem6columnEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: QString QStandardItem::whatsThis(); impl /*struct*/ QStandardItem { pub fn whatsThis<RetType, T: QStandardItem_whatsThis<RetType>>(& self, overload_args: T) -> RetType { return overload_args.whatsThis(self); // return 1; } } pub trait QStandardItem_whatsThis<RetType> { fn whatsThis(self , rsthis: & QStandardItem) -> RetType; } // proto: QString QStandardItem::whatsThis(); impl<'a> /*trait*/ QStandardItem_whatsThis<QString> for () { fn whatsThis(self , rsthis: & QStandardItem) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem9whatsThisEv()}; let mut ret = unsafe {C_ZNK13QStandardItem9whatsThisEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QList<QStandardItem *> QStandardItem::takeColumn(int column); impl /*struct*/ QStandardItem { pub fn takeColumn<RetType, T: QStandardItem_takeColumn<RetType>>(& self, overload_args: T) -> RetType { return overload_args.takeColumn(self); // return 1; } } pub trait QStandardItem_takeColumn<RetType> { fn takeColumn(self , rsthis: & QStandardItem) -> RetType; } // proto: QList<QStandardItem *> QStandardItem::takeColumn(int column); impl<'a> /*trait*/ QStandardItem_takeColumn<u64> for (i32) { fn takeColumn(self , rsthis: & QStandardItem) -> u64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem10takeColumnEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZN13QStandardItem10takeColumnEi(rsthis.qclsinst, arg0)}; return ret as u64; // 5 // return 1; } } // proto: void QStandardItem::setForeground(const QBrush & brush); impl /*struct*/ QStandardItem { pub fn setForeground<RetType, T: QStandardItem_setForeground<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setForeground(self); // return 1; } } pub trait QStandardItem_setForeground<RetType> { fn setForeground(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setForeground(const QBrush & brush); impl<'a> /*trait*/ QStandardItem_setForeground<()> for (&'a QBrush) { fn setForeground(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem13setForegroundERK6QBrush()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN13QStandardItem13setForegroundERK6QBrush(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QStandardItem::isEditable(); impl /*struct*/ QStandardItem { pub fn isEditable<RetType, T: QStandardItem_isEditable<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isEditable(self); // return 1; } } pub trait QStandardItem_isEditable<RetType> { fn isEditable(self , rsthis: & QStandardItem) -> RetType; } // proto: bool QStandardItem::isEditable(); impl<'a> /*trait*/ QStandardItem_isEditable<i8> for () { fn isEditable(self , rsthis: & QStandardItem) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem10isEditableEv()}; let mut ret = unsafe {C_ZNK13QStandardItem10isEditableEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QIcon QStandardItem::icon(); impl /*struct*/ QStandardItem { pub fn icon<RetType, T: QStandardItem_icon<RetType>>(& self, overload_args: T) -> RetType { return overload_args.icon(self); // return 1; } } pub trait QStandardItem_icon<RetType> { fn icon(self , rsthis: & QStandardItem) -> RetType; } // proto: QIcon QStandardItem::icon(); impl<'a> /*trait*/ QStandardItem_icon<QIcon> for () { fn icon(self , rsthis: & QStandardItem) -> QIcon { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem4iconEv()}; let mut ret = unsafe {C_ZNK13QStandardItem4iconEv(rsthis.qclsinst)}; let mut ret1 = QIcon::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QStandardItem::setWhatsThis(const QString & whatsThis); impl /*struct*/ QStandardItem { pub fn setWhatsThis<RetType, T: QStandardItem_setWhatsThis<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setWhatsThis(self); // return 1; } } pub trait QStandardItem_setWhatsThis<RetType> { fn setWhatsThis(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setWhatsThis(const QString & whatsThis); impl<'a> /*trait*/ QStandardItem_setWhatsThis<()> for (&'a QString) { fn setWhatsThis(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem12setWhatsThisERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN13QStandardItem12setWhatsThisERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QStandardItem * QStandardItem::takeChild(int row, int column); impl /*struct*/ QStandardItem { pub fn takeChild<RetType, T: QStandardItem_takeChild<RetType>>(& self, overload_args: T) -> RetType { return overload_args.takeChild(self); // return 1; } } pub trait QStandardItem_takeChild<RetType> { fn takeChild(self , rsthis: & QStandardItem) -> RetType; } // proto: QStandardItem * QStandardItem::takeChild(int row, int column); impl<'a> /*trait*/ QStandardItem_takeChild<QStandardItem> for (i32, Option<i32>) { fn takeChild(self , rsthis: & QStandardItem) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem9takeChildEii()}; let arg0 = self.0 as c_int; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZN13QStandardItem9takeChildEii(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QStandardItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QStandardItem::type(); impl /*struct*/ QStandardItem { pub fn type_<RetType, T: QStandardItem_type_<RetType>>(& self, overload_args: T) -> RetType { return overload_args.type_(self); // return 1; } } pub trait QStandardItem_type_<RetType> { fn type_(self , rsthis: & QStandardItem) -> RetType; } // proto: int QStandardItem::type(); impl<'a> /*trait*/ QStandardItem_type_<i32> for () { fn type_(self , rsthis: & QStandardItem) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem4typeEv()}; let mut ret = unsafe {C_ZNK13QStandardItem4typeEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: QList<QStandardItem *> QStandardItem::takeRow(int row); impl /*struct*/ QStandardItem { pub fn takeRow<RetType, T: QStandardItem_takeRow<RetType>>(& self, overload_args: T) -> RetType { return overload_args.takeRow(self); // return 1; } } pub trait QStandardItem_takeRow<RetType> { fn takeRow(self , rsthis: & QStandardItem) -> RetType; } // proto: QList<QStandardItem *> QStandardItem::takeRow(int row); impl<'a> /*trait*/ QStandardItem_takeRow<u64> for (i32) { fn takeRow(self , rsthis: & QStandardItem) -> u64 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem7takeRowEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZN13QStandardItem7takeRowEi(rsthis.qclsinst, arg0)}; return ret as u64; // 5 // return 1; } } // proto: int QStandardItem::row(); impl /*struct*/ QStandardItem { pub fn row<RetType, T: QStandardItem_row<RetType>>(& self, overload_args: T) -> RetType { return overload_args.row(self); // return 1; } } pub trait QStandardItem_row<RetType> { fn row(self , rsthis: & QStandardItem) -> RetType; } // proto: int QStandardItem::row(); impl<'a> /*trait*/ QStandardItem_row<i32> for () { fn row(self , rsthis: & QStandardItem) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem3rowEv()}; let mut ret = unsafe {C_ZNK13QStandardItem3rowEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: bool QStandardItem::isCheckable(); impl /*struct*/ QStandardItem { pub fn isCheckable<RetType, T: QStandardItem_isCheckable<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isCheckable(self); // return 1; } } pub trait QStandardItem_isCheckable<RetType> { fn isCheckable(self , rsthis: & QStandardItem) -> RetType; } // proto: bool QStandardItem::isCheckable(); impl<'a> /*trait*/ QStandardItem_isCheckable<i8> for () { fn isCheckable(self , rsthis: & QStandardItem) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem11isCheckableEv()}; let mut ret = unsafe {C_ZNK13QStandardItem11isCheckableEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QString QStandardItem::text(); impl /*struct*/ QStandardItem { pub fn text<RetType, T: QStandardItem_text<RetType>>(& self, overload_args: T) -> RetType { return overload_args.text(self); // return 1; } } pub trait QStandardItem_text<RetType> { fn text(self , rsthis: & QStandardItem) -> RetType; } // proto: QString QStandardItem::text(); impl<'a> /*trait*/ QStandardItem_text<QString> for () { fn text(self , rsthis: & QStandardItem) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem4textEv()}; let mut ret = unsafe {C_ZNK13QStandardItem4textEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QStandardItem::insertRows(int row, int count); impl /*struct*/ QStandardItem { pub fn insertRows<RetType, T: QStandardItem_insertRows<RetType>>(& self, overload_args: T) -> RetType { return overload_args.insertRows(self); // return 1; } } pub trait QStandardItem_insertRows<RetType> { fn insertRows(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::insertRows(int row, int count); impl<'a> /*trait*/ QStandardItem_insertRows<()> for (i32, i32) { fn insertRows(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem10insertRowsEii()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; unsafe {C_ZN13QStandardItem10insertRowsEii(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: bool QStandardItem::isDropEnabled(); impl /*struct*/ QStandardItem { pub fn isDropEnabled<RetType, T: QStandardItem_isDropEnabled<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isDropEnabled(self); // return 1; } } pub trait QStandardItem_isDropEnabled<RetType> { fn isDropEnabled(self , rsthis: & QStandardItem) -> RetType; } // proto: bool QStandardItem::isDropEnabled(); impl<'a> /*trait*/ QStandardItem_isDropEnabled<i8> for () { fn isDropEnabled(self , rsthis: & QStandardItem) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem13isDropEnabledEv()}; let mut ret = unsafe {C_ZNK13QStandardItem13isDropEnabledEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: bool QStandardItem::hasChildren(); impl /*struct*/ QStandardItem { pub fn hasChildren<RetType, T: QStandardItem_hasChildren<RetType>>(& self, overload_args: T) -> RetType { return overload_args.hasChildren(self); // return 1; } } pub trait QStandardItem_hasChildren<RetType> { fn hasChildren(self , rsthis: & QStandardItem) -> RetType; } // proto: bool QStandardItem::hasChildren(); impl<'a> /*trait*/ QStandardItem_hasChildren<i8> for () { fn hasChildren(self , rsthis: & QStandardItem) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem11hasChildrenEv()}; let mut ret = unsafe {C_ZNK13QStandardItem11hasChildrenEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QString QStandardItem::statusTip(); impl /*struct*/ QStandardItem { pub fn statusTip<RetType, T: QStandardItem_statusTip<RetType>>(& self, overload_args: T) -> RetType { return overload_args.statusTip(self); // return 1; } } pub trait QStandardItem_statusTip<RetType> { fn statusTip(self , rsthis: & QStandardItem) -> RetType; } // proto: QString QStandardItem::statusTip(); impl<'a> /*trait*/ QStandardItem_statusTip<QString> for () { fn statusTip(self , rsthis: & QStandardItem) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem9statusTipEv()}; let mut ret = unsafe {C_ZNK13QStandardItem9statusTipEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QStandardItem::setStatusTip(const QString & statusTip); impl /*struct*/ QStandardItem { pub fn setStatusTip<RetType, T: QStandardItem_setStatusTip<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setStatusTip(self); // return 1; } } pub trait QStandardItem_setStatusTip<RetType> { fn setStatusTip(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setStatusTip(const QString & statusTip); impl<'a> /*trait*/ QStandardItem_setStatusTip<()> for (&'a QString) { fn setStatusTip(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem12setStatusTipERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN13QStandardItem12setStatusTipERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItem::appendRow(QStandardItem * item); impl /*struct*/ QStandardItem { pub fn appendRow<RetType, T: QStandardItem_appendRow<RetType>>(& self, overload_args: T) -> RetType { return overload_args.appendRow(self); // return 1; } } pub trait QStandardItem_appendRow<RetType> { fn appendRow(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::appendRow(QStandardItem * item); impl<'a> /*trait*/ QStandardItem_appendRow<()> for (&'a QStandardItem) { fn appendRow(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem9appendRowEPS_()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN13QStandardItem9appendRowEPS_(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItem::setChild(int row, int column, QStandardItem * item); impl<'a> /*trait*/ QStandardItem_setChild<()> for (i32, i32, &'a QStandardItem) { fn setChild(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem8setChildEiiPS_()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let arg2 = self.2.qclsinst as *mut c_void; unsafe {C_ZN13QStandardItem8setChildEiiPS_(rsthis.qclsinst, arg0, arg1, arg2)}; // return 1; } } // proto: QModelIndex QStandardItem::index(); impl /*struct*/ QStandardItem { pub fn index<RetType, T: QStandardItem_index<RetType>>(& self, overload_args: T) -> RetType { return overload_args.index(self); // return 1; } } pub trait QStandardItem_index<RetType> { fn index(self , rsthis: & QStandardItem) -> RetType; } // proto: QModelIndex QStandardItem::index(); impl<'a> /*trait*/ QStandardItem_index<QModelIndex> for () { fn index(self , rsthis: & QStandardItem) -> QModelIndex { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem5indexEv()}; let mut ret = unsafe {C_ZNK13QStandardItem5indexEv(rsthis.qclsinst)}; let mut ret1 = QModelIndex::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QStandardItem::setIcon(const QIcon & icon); impl /*struct*/ QStandardItem { pub fn setIcon<RetType, T: QStandardItem_setIcon<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setIcon(self); // return 1; } } pub trait QStandardItem_setIcon<RetType> { fn setIcon(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setIcon(const QIcon & icon); impl<'a> /*trait*/ QStandardItem_setIcon<()> for (&'a QIcon) { fn setIcon(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem7setIconERK5QIcon()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN13QStandardItem7setIconERK5QIcon(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItem::setToolTip(const QString & toolTip); impl /*struct*/ QStandardItem { pub fn setToolTip<RetType, T: QStandardItem_setToolTip<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setToolTip(self); // return 1; } } pub trait QStandardItem_setToolTip<RetType> { fn setToolTip(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setToolTip(const QString & toolTip); impl<'a> /*trait*/ QStandardItem_setToolTip<()> for (&'a QString) { fn setToolTip(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem10setToolTipERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN13QStandardItem10setToolTipERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItem::setData(const QVariant & value, int role); impl /*struct*/ QStandardItem { pub fn setData<RetType, T: QStandardItem_setData<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setData(self); // return 1; } } pub trait QStandardItem_setData<RetType> { fn setData(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setData(const QVariant & value, int role); impl<'a> /*trait*/ QStandardItem_setData<()> for (&'a QVariant, Option<i32>) { fn setData(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem7setDataERK8QVarianti()}; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = (if self.1.is_none() {0 as i32} else {self.1.unwrap()}) as c_int; unsafe {C_ZN13QStandardItem7setDataERK8QVarianti(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: QBrush QStandardItem::background(); impl /*struct*/ QStandardItem { pub fn background<RetType, T: QStandardItem_background<RetType>>(& self, overload_args: T) -> RetType { return overload_args.background(self); // return 1; } } pub trait QStandardItem_background<RetType> { fn background(self , rsthis: & QStandardItem) -> RetType; } // proto: QBrush QStandardItem::background(); impl<'a> /*trait*/ QStandardItem_background<QBrush> for () { fn background(self , rsthis: & QStandardItem) -> QBrush { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem10backgroundEv()}; let mut ret = unsafe {C_ZNK13QStandardItem10backgroundEv(rsthis.qclsinst)}; let mut ret1 = QBrush::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QVariant QStandardItem::data(int role); impl /*struct*/ QStandardItem { pub fn data<RetType, T: QStandardItem_data<RetType>>(& self, overload_args: T) -> RetType { return overload_args.data(self); // return 1; } } pub trait QStandardItem_data<RetType> { fn data(self , rsthis: & QStandardItem) -> RetType; } // proto: QVariant QStandardItem::data(int role); impl<'a> /*trait*/ QStandardItem_data<QVariant> for (Option<i32>) { fn data(self , rsthis: & QStandardItem) -> QVariant { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem4dataEi()}; let arg0 = (if self.is_none() {0 as i32} else {self.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK13QStandardItem4dataEi(rsthis.qclsinst, arg0)}; let mut ret1 = QVariant::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QStandardItem * QStandardItem::child(int row, int column); impl /*struct*/ QStandardItem { pub fn child<RetType, T: QStandardItem_child<RetType>>(& self, overload_args: T) -> RetType { return overload_args.child(self); // return 1; } } pub trait QStandardItem_child<RetType> { fn child(self , rsthis: & QStandardItem) -> RetType; } // proto: QStandardItem * QStandardItem::child(int row, int column); impl<'a> /*trait*/ QStandardItem_child<QStandardItem> for (i32, Option<i32>) { fn child(self , rsthis: & QStandardItem) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem5childEii()}; let arg0 = self.0 as c_int; let arg1 = (if self.1.is_none() {0} else {self.1.unwrap()}) as c_int; let mut ret = unsafe {C_ZNK13QStandardItem5childEii(rsthis.qclsinst, arg0, arg1)}; let mut ret1 = QStandardItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QStandardItem::isSelectable(); impl /*struct*/ QStandardItem { pub fn isSelectable<RetType, T: QStandardItem_isSelectable<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isSelectable(self); // return 1; } } pub trait QStandardItem_isSelectable<RetType> { fn isSelectable(self , rsthis: & QStandardItem) -> RetType; } // proto: bool QStandardItem::isSelectable(); impl<'a> /*trait*/ QStandardItem_isSelectable<i8> for () { fn isSelectable(self , rsthis: & QStandardItem) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem12isSelectableEv()}; let mut ret = unsafe {C_ZNK13QStandardItem12isSelectableEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QString QStandardItem::toolTip(); impl /*struct*/ QStandardItem { pub fn toolTip<RetType, T: QStandardItem_toolTip<RetType>>(& self, overload_args: T) -> RetType { return overload_args.toolTip(self); // return 1; } } pub trait QStandardItem_toolTip<RetType> { fn toolTip(self , rsthis: & QStandardItem) -> RetType; } // proto: QString QStandardItem::toolTip(); impl<'a> /*trait*/ QStandardItem_toolTip<QString> for () { fn toolTip(self , rsthis: & QStandardItem) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem7toolTipEv()}; let mut ret = unsafe {C_ZNK13QStandardItem7toolTipEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QStandardItem::setRowCount(int rows); impl /*struct*/ QStandardItem { pub fn setRowCount<RetType, T: QStandardItem_setRowCount<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setRowCount(self); // return 1; } } pub trait QStandardItem_setRowCount<RetType> { fn setRowCount(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setRowCount(int rows); impl<'a> /*trait*/ QStandardItem_setRowCount<()> for (i32) { fn setRowCount(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem11setRowCountEi()}; let arg0 = self as c_int; unsafe {C_ZN13QStandardItem11setRowCountEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItem::QStandardItem(const QString & text); impl /*struct*/ QStandardItem { pub fn new<T: QStandardItem_new>(value: T) -> QStandardItem { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QStandardItem_new { fn new(self) -> QStandardItem; } // proto: void QStandardItem::QStandardItem(const QString & text); impl<'a> /*trait*/ QStandardItem_new for (&'a QString) { fn new(self) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItemC2ERK7QString()}; let ctysz: c_int = unsafe{QStandardItem_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.qclsinst as *mut c_void; let qthis: u64 = unsafe {C_ZN13QStandardItemC2ERK7QString(arg0)}; let rsthis = QStandardItem{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QStandardItem::write(QDataStream & out); impl /*struct*/ QStandardItem { pub fn write<RetType, T: QStandardItem_write<RetType>>(& self, overload_args: T) -> RetType { return overload_args.write(self); // return 1; } } pub trait QStandardItem_write<RetType> { fn write(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::write(QDataStream & out); impl<'a> /*trait*/ QStandardItem_write<()> for (&'a QDataStream) { fn write(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem5writeER11QDataStream()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZNK13QStandardItem5writeER11QDataStream(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QStandardItem::isDragEnabled(); impl /*struct*/ QStandardItem { pub fn isDragEnabled<RetType, T: QStandardItem_isDragEnabled<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isDragEnabled(self); // return 1; } } pub trait QStandardItem_isDragEnabled<RetType> { fn isDragEnabled(self , rsthis: & QStandardItem) -> RetType; } // proto: bool QStandardItem::isDragEnabled(); impl<'a> /*trait*/ QStandardItem_isDragEnabled<i8> for () { fn isDragEnabled(self , rsthis: & QStandardItem) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem13isDragEnabledEv()}; let mut ret = unsafe {C_ZNK13QStandardItem13isDragEnabledEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QStandardItem::setAccessibleText(const QString & accessibleText); impl /*struct*/ QStandardItem { pub fn setAccessibleText<RetType, T: QStandardItem_setAccessibleText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setAccessibleText(self); // return 1; } } pub trait QStandardItem_setAccessibleText<RetType> { fn setAccessibleText(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setAccessibleText(const QString & accessibleText); impl<'a> /*trait*/ QStandardItem_setAccessibleText<()> for (&'a QString) { fn setAccessibleText(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem17setAccessibleTextERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN13QStandardItem17setAccessibleTextERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int QStandardItem::rowCount(); impl /*struct*/ QStandardItem { pub fn rowCount<RetType, T: QStandardItem_rowCount<RetType>>(& self, overload_args: T) -> RetType { return overload_args.rowCount(self); // return 1; } } pub trait QStandardItem_rowCount<RetType> { fn rowCount(self , rsthis: & QStandardItem) -> RetType; } // proto: int QStandardItem::rowCount(); impl<'a> /*trait*/ QStandardItem_rowCount<i32> for () { fn rowCount(self , rsthis: & QStandardItem) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem8rowCountEv()}; let mut ret = unsafe {C_ZNK13QStandardItem8rowCountEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QStandardItem::removeColumn(int column); impl /*struct*/ QStandardItem { pub fn removeColumn<RetType, T: QStandardItem_removeColumn<RetType>>(& self, overload_args: T) -> RetType { return overload_args.removeColumn(self); // return 1; } } pub trait QStandardItem_removeColumn<RetType> { fn removeColumn(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::removeColumn(int column); impl<'a> /*trait*/ QStandardItem_removeColumn<()> for (i32) { fn removeColumn(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem12removeColumnEi()}; let arg0 = self as c_int; unsafe {C_ZN13QStandardItem12removeColumnEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItem::removeRow(int row); impl /*struct*/ QStandardItem { pub fn removeRow<RetType, T: QStandardItem_removeRow<RetType>>(& self, overload_args: T) -> RetType { return overload_args.removeRow(self); // return 1; } } pub trait QStandardItem_removeRow<RetType> { fn removeRow(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::removeRow(int row); impl<'a> /*trait*/ QStandardItem_removeRow<()> for (i32) { fn removeRow(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem9removeRowEi()}; let arg0 = self as c_int; unsafe {C_ZN13QStandardItem9removeRowEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int QStandardItem::columnCount(); impl /*struct*/ QStandardItem { pub fn columnCount<RetType, T: QStandardItem_columnCount<RetType>>(& self, overload_args: T) -> RetType { return overload_args.columnCount(self); // return 1; } } pub trait QStandardItem_columnCount<RetType> { fn columnCount(self , rsthis: & QStandardItem) -> RetType; } // proto: int QStandardItem::columnCount(); impl<'a> /*trait*/ QStandardItem_columnCount<i32> for () { fn columnCount(self , rsthis: & QStandardItem) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem11columnCountEv()}; let mut ret = unsafe {C_ZNK13QStandardItem11columnCountEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: bool QStandardItem::isTristate(); impl /*struct*/ QStandardItem { pub fn isTristate<RetType, T: QStandardItem_isTristate<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isTristate(self); // return 1; } } pub trait QStandardItem_isTristate<RetType> { fn isTristate(self , rsthis: & QStandardItem) -> RetType; } // proto: bool QStandardItem::isTristate(); impl<'a> /*trait*/ QStandardItem_isTristate<i8> for () { fn isTristate(self , rsthis: & QStandardItem) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem10isTristateEv()}; let mut ret = unsafe {C_ZNK13QStandardItem10isTristateEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: QStandardItem * QStandardItem::parent(); impl /*struct*/ QStandardItem { pub fn parent<RetType, T: QStandardItem_parent<RetType>>(& self, overload_args: T) -> RetType { return overload_args.parent(self); // return 1; } } pub trait QStandardItem_parent<RetType> { fn parent(self , rsthis: & QStandardItem) -> RetType; } // proto: QStandardItem * QStandardItem::parent(); impl<'a> /*trait*/ QStandardItem_parent<QStandardItem> for () { fn parent(self , rsthis: & QStandardItem) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem6parentEv()}; let mut ret = unsafe {C_ZNK13QStandardItem6parentEv(rsthis.qclsinst)}; let mut ret1 = QStandardItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QStandardItem::insertRow(int row, QStandardItem * item); impl /*struct*/ QStandardItem { pub fn insertRow<RetType, T: QStandardItem_insertRow<RetType>>(& self, overload_args: T) -> RetType { return overload_args.insertRow(self); // return 1; } } pub trait QStandardItem_insertRow<RetType> { fn insertRow(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::insertRow(int row, QStandardItem * item); impl<'a> /*trait*/ QStandardItem_insertRow<()> for (i32, &'a QStandardItem) { fn insertRow(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem9insertRowEiPS_()}; let arg0 = self.0 as c_int; let arg1 = self.1.qclsinst as *mut c_void; unsafe {C_ZN13QStandardItem9insertRowEiPS_(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: void QStandardItem::QStandardItem(const QIcon & icon, const QString & text); impl<'a> /*trait*/ QStandardItem_new for (&'a QIcon, &'a QString) { fn new(self) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItemC2ERK5QIconRK7QString()}; let ctysz: c_int = unsafe{QStandardItem_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.0.qclsinst as *mut c_void; let arg1 = self.1.qclsinst as *mut c_void; let qthis: u64 = unsafe {C_ZN13QStandardItemC2ERK5QIconRK7QString(arg0, arg1)}; let rsthis = QStandardItem{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: void QStandardItem::setFont(const QFont & font); impl /*struct*/ QStandardItem { pub fn setFont<RetType, T: QStandardItem_setFont<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setFont(self); // return 1; } } pub trait QStandardItem_setFont<RetType> { fn setFont(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setFont(const QFont & font); impl<'a> /*trait*/ QStandardItem_setFont<()> for (&'a QFont) { fn setFont(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem7setFontERK5QFont()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN13QStandardItem7setFontERK5QFont(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItem::removeColumns(int column, int count); impl /*struct*/ QStandardItem { pub fn removeColumns<RetType, T: QStandardItem_removeColumns<RetType>>(& self, overload_args: T) -> RetType { return overload_args.removeColumns(self); // return 1; } } pub trait QStandardItem_removeColumns<RetType> { fn removeColumns(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::removeColumns(int column, int count); impl<'a> /*trait*/ QStandardItem_removeColumns<()> for (i32, i32) { fn removeColumns(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem13removeColumnsEii()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; unsafe {C_ZN13QStandardItem13removeColumnsEii(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: void QStandardItem::~QStandardItem(); impl /*struct*/ QStandardItem { pub fn free<RetType, T: QStandardItem_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QStandardItem_free<RetType> { fn free(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::~QStandardItem(); impl<'a> /*trait*/ QStandardItem_free<()> for () { fn free(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItemD2Ev()}; unsafe {C_ZN13QStandardItemD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: void QStandardItem::QStandardItem(); impl<'a> /*trait*/ QStandardItem_new for () { fn new(self) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItemC2Ev()}; let ctysz: c_int = unsafe{QStandardItem_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let qthis: u64 = unsafe {C_ZN13QStandardItemC2Ev()}; let rsthis = QStandardItem{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: QFont QStandardItem::font(); impl /*struct*/ QStandardItem { pub fn font<RetType, T: QStandardItem_font<RetType>>(& self, overload_args: T) -> RetType { return overload_args.font(self); // return 1; } } pub trait QStandardItem_font<RetType> { fn font(self , rsthis: & QStandardItem) -> RetType; } // proto: QFont QStandardItem::font(); impl<'a> /*trait*/ QStandardItem_font<QFont> for () { fn font(self , rsthis: & QStandardItem) -> QFont { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem4fontEv()}; let mut ret = unsafe {C_ZNK13QStandardItem4fontEv(rsthis.qclsinst)}; let mut ret1 = QFont::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QStandardItem::setEditable(bool editable); impl /*struct*/ QStandardItem { pub fn setEditable<RetType, T: QStandardItem_setEditable<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setEditable(self); // return 1; } } pub trait QStandardItem_setEditable<RetType> { fn setEditable(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setEditable(bool editable); impl<'a> /*trait*/ QStandardItem_setEditable<()> for (i8) { fn setEditable(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem11setEditableEb()}; let arg0 = self as c_char; unsafe {C_ZN13QStandardItem11setEditableEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItem::setText(const QString & text); impl /*struct*/ QStandardItem { pub fn setText<RetType, T: QStandardItem_setText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setText(self); // return 1; } } pub trait QStandardItem_setText<RetType> { fn setText(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setText(const QString & text); impl<'a> /*trait*/ QStandardItem_setText<()> for (&'a QString) { fn setText(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem7setTextERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN13QStandardItem7setTextERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItem::QStandardItem(int rows, int columns); impl<'a> /*trait*/ QStandardItem_new for (i32, Option<i32>) { fn new(self) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItemC2Eii()}; let ctysz: c_int = unsafe{QStandardItem_Class_Size()}; let qthis_ph: u64 = unsafe{calloc(1, ctysz as usize)} as u64; let arg0 = self.0 as c_int; let arg1 = (if self.1.is_none() {1} else {self.1.unwrap()}) as c_int; let qthis: u64 = unsafe {C_ZN13QStandardItemC2Eii(arg0, arg1)}; let rsthis = QStandardItem{qclsinst: qthis, ..Default::default()}; return rsthis; // return 1; } } // proto: bool QStandardItem::isEnabled(); impl /*struct*/ QStandardItem { pub fn isEnabled<RetType, T: QStandardItem_isEnabled<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isEnabled(self); // return 1; } } pub trait QStandardItem_isEnabled<RetType> { fn isEnabled(self , rsthis: & QStandardItem) -> RetType; } // proto: bool QStandardItem::isEnabled(); impl<'a> /*trait*/ QStandardItem_isEnabled<i8> for () { fn isEnabled(self , rsthis: & QStandardItem) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem9isEnabledEv()}; let mut ret = unsafe {C_ZNK13QStandardItem9isEnabledEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QStandardItem::setDropEnabled(bool dropEnabled); impl /*struct*/ QStandardItem { pub fn setDropEnabled<RetType, T: QStandardItem_setDropEnabled<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setDropEnabled(self); // return 1; } } pub trait QStandardItem_setDropEnabled<RetType> { fn setDropEnabled(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setDropEnabled(bool dropEnabled); impl<'a> /*trait*/ QStandardItem_setDropEnabled<()> for (i8) { fn setDropEnabled(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem14setDropEnabledEb()}; let arg0 = self as c_char; unsafe {C_ZN13QStandardItem14setDropEnabledEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItem::setColumnCount(int columns); impl /*struct*/ QStandardItem { pub fn setColumnCount<RetType, T: QStandardItem_setColumnCount<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setColumnCount(self); // return 1; } } pub trait QStandardItem_setColumnCount<RetType> { fn setColumnCount(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setColumnCount(int columns); impl<'a> /*trait*/ QStandardItem_setColumnCount<()> for (i32) { fn setColumnCount(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem14setColumnCountEi()}; let arg0 = self as c_int; unsafe {C_ZN13QStandardItem14setColumnCountEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QString QStandardItem::accessibleText(); impl /*struct*/ QStandardItem { pub fn accessibleText<RetType, T: QStandardItem_accessibleText<RetType>>(& self, overload_args: T) -> RetType { return overload_args.accessibleText(self); // return 1; } } pub trait QStandardItem_accessibleText<RetType> { fn accessibleText(self , rsthis: & QStandardItem) -> RetType; } // proto: QString QStandardItem::accessibleText(); impl<'a> /*trait*/ QStandardItem_accessibleText<QString> for () { fn accessibleText(self , rsthis: & QStandardItem) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem14accessibleTextEv()}; let mut ret = unsafe {C_ZNK13QStandardItem14accessibleTextEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QStandardItem::read(QDataStream & in); impl /*struct*/ QStandardItem { pub fn read<RetType, T: QStandardItem_read<RetType>>(& self, overload_args: T) -> RetType { return overload_args.read(self); // return 1; } } pub trait QStandardItem_read<RetType> { fn read(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::read(QDataStream & in); impl<'a> /*trait*/ QStandardItem_read<()> for (&'a QDataStream) { fn read(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem4readER11QDataStream()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN13QStandardItem4readER11QDataStream(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItem::setCheckable(bool checkable); impl /*struct*/ QStandardItem { pub fn setCheckable<RetType, T: QStandardItem_setCheckable<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setCheckable(self); // return 1; } } pub trait QStandardItem_setCheckable<RetType> { fn setCheckable(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setCheckable(bool checkable); impl<'a> /*trait*/ QStandardItem_setCheckable<()> for (i8) { fn setCheckable(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem12setCheckableEb()}; let arg0 = self as c_char; unsafe {C_ZN13QStandardItem12setCheckableEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItem::setDragEnabled(bool dragEnabled); impl /*struct*/ QStandardItem { pub fn setDragEnabled<RetType, T: QStandardItem_setDragEnabled<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setDragEnabled(self); // return 1; } } pub trait QStandardItem_setDragEnabled<RetType> { fn setDragEnabled(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setDragEnabled(bool dragEnabled); impl<'a> /*trait*/ QStandardItem_setDragEnabled<()> for (i8) { fn setDragEnabled(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem14setDragEnabledEb()}; let arg0 = self as c_char; unsafe {C_ZN13QStandardItem14setDragEnabledEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QBrush QStandardItem::foreground(); impl /*struct*/ QStandardItem { pub fn foreground<RetType, T: QStandardItem_foreground<RetType>>(& self, overload_args: T) -> RetType { return overload_args.foreground(self); // return 1; } } pub trait QStandardItem_foreground<RetType> { fn foreground(self , rsthis: & QStandardItem) -> RetType; } // proto: QBrush QStandardItem::foreground(); impl<'a> /*trait*/ QStandardItem_foreground<QBrush> for () { fn foreground(self , rsthis: & QStandardItem) -> QBrush { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem10foregroundEv()}; let mut ret = unsafe {C_ZNK13QStandardItem10foregroundEv(rsthis.qclsinst)}; let mut ret1 = QBrush::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: QStandardItem * QStandardItem::clone(); impl /*struct*/ QStandardItem { pub fn clone<RetType, T: QStandardItem_clone<RetType>>(& self, overload_args: T) -> RetType { return overload_args.clone(self); // return 1; } } pub trait QStandardItem_clone<RetType> { fn clone(self , rsthis: & QStandardItem) -> RetType; } // proto: QStandardItem * QStandardItem::clone(); impl<'a> /*trait*/ QStandardItem_clone<QStandardItem> for () { fn clone(self , rsthis: & QStandardItem) -> QStandardItem { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem5cloneEv()}; let mut ret = unsafe {C_ZNK13QStandardItem5cloneEv(rsthis.qclsinst)}; let mut ret1 = QStandardItem::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QStandardItem::removeRows(int row, int count); impl /*struct*/ QStandardItem { pub fn removeRows<RetType, T: QStandardItem_removeRows<RetType>>(& self, overload_args: T) -> RetType { return overload_args.removeRows(self); // return 1; } } pub trait QStandardItem_removeRows<RetType> { fn removeRows(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::removeRows(int row, int count); impl<'a> /*trait*/ QStandardItem_removeRows<()> for (i32, i32) { fn removeRows(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem10removeRowsEii()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; unsafe {C_ZN13QStandardItem10removeRowsEii(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: QSize QStandardItem::sizeHint(); impl /*struct*/ QStandardItem { pub fn sizeHint<RetType, T: QStandardItem_sizeHint<RetType>>(& self, overload_args: T) -> RetType { return overload_args.sizeHint(self); // return 1; } } pub trait QStandardItem_sizeHint<RetType> { fn sizeHint(self , rsthis: & QStandardItem) -> RetType; } // proto: QSize QStandardItem::sizeHint(); impl<'a> /*trait*/ QStandardItem_sizeHint<QSize> for () { fn sizeHint(self , rsthis: & QStandardItem) -> QSize { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem8sizeHintEv()}; let mut ret = unsafe {C_ZNK13QStandardItem8sizeHintEv(rsthis.qclsinst)}; let mut ret1 = QSize::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QStandardItem::setEnabled(bool enabled); impl /*struct*/ QStandardItem { pub fn setEnabled<RetType, T: QStandardItem_setEnabled<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setEnabled(self); // return 1; } } pub trait QStandardItem_setEnabled<RetType> { fn setEnabled(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setEnabled(bool enabled); impl<'a> /*trait*/ QStandardItem_setEnabled<()> for (i8) { fn setEnabled(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem10setEnabledEb()}; let arg0 = self as c_char; unsafe {C_ZN13QStandardItem10setEnabledEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItem::setBackground(const QBrush & brush); impl /*struct*/ QStandardItem { pub fn setBackground<RetType, T: QStandardItem_setBackground<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setBackground(self); // return 1; } } pub trait QStandardItem_setBackground<RetType> { fn setBackground(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setBackground(const QBrush & brush); impl<'a> /*trait*/ QStandardItem_setBackground<()> for (&'a QBrush) { fn setBackground(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem13setBackgroundERK6QBrush()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN13QStandardItem13setBackgroundERK6QBrush(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItem::setAccessibleDescription(const QString & accessibleDescription); impl /*struct*/ QStandardItem { pub fn setAccessibleDescription<RetType, T: QStandardItem_setAccessibleDescription<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setAccessibleDescription(self); // return 1; } } pub trait QStandardItem_setAccessibleDescription<RetType> { fn setAccessibleDescription(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setAccessibleDescription(const QString & accessibleDescription); impl<'a> /*trait*/ QStandardItem_setAccessibleDescription<()> for (&'a QString) { fn setAccessibleDescription(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem24setAccessibleDescriptionERK7QString()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN13QStandardItem24setAccessibleDescriptionERK7QString(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QStandardItem::setSizeHint(const QSize & sizeHint); impl /*struct*/ QStandardItem { pub fn setSizeHint<RetType, T: QStandardItem_setSizeHint<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setSizeHint(self); // return 1; } } pub trait QStandardItem_setSizeHint<RetType> { fn setSizeHint(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setSizeHint(const QSize & sizeHint); impl<'a> /*trait*/ QStandardItem_setSizeHint<()> for (&'a QSize) { fn setSizeHint(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem11setSizeHintERK5QSize()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN13QStandardItem11setSizeHintERK5QSize(rsthis.qclsinst, arg0)}; // return 1; } } // proto: QString QStandardItem::accessibleDescription(); impl /*struct*/ QStandardItem { pub fn accessibleDescription<RetType, T: QStandardItem_accessibleDescription<RetType>>(& self, overload_args: T) -> RetType { return overload_args.accessibleDescription(self); // return 1; } } pub trait QStandardItem_accessibleDescription<RetType> { fn accessibleDescription(self , rsthis: & QStandardItem) -> RetType; } // proto: QString QStandardItem::accessibleDescription(); impl<'a> /*trait*/ QStandardItem_accessibleDescription<QString> for () { fn accessibleDescription(self , rsthis: & QStandardItem) -> QString { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK13QStandardItem21accessibleDescriptionEv()}; let mut ret = unsafe {C_ZNK13QStandardItem21accessibleDescriptionEv(rsthis.qclsinst)}; let mut ret1 = QString::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QStandardItem::setTristate(bool tristate); impl /*struct*/ QStandardItem { pub fn setTristate<RetType, T: QStandardItem_setTristate<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setTristate(self); // return 1; } } pub trait QStandardItem_setTristate<RetType> { fn setTristate(self , rsthis: & QStandardItem) -> RetType; } // proto: void QStandardItem::setTristate(bool tristate); impl<'a> /*trait*/ QStandardItem_setTristate<()> for (i8) { fn setTristate(self , rsthis: & QStandardItem) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN13QStandardItem11setTristateEb()}; let arg0 = self as c_char; unsafe {C_ZN13QStandardItem11setTristateEb(rsthis.qclsinst, arg0)}; // return 1; } } #[derive(Default)] // for QStandardItemModel_itemChanged pub struct QStandardItemModel_itemChanged_signal{poi:u64} impl /* struct */ QStandardItemModel { pub fn itemChanged(&self) -> QStandardItemModel_itemChanged_signal { return QStandardItemModel_itemChanged_signal{poi:self.qclsinst}; } } impl /* struct */ QStandardItemModel_itemChanged_signal { pub fn connect<T: QStandardItemModel_itemChanged_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QStandardItemModel_itemChanged_signal_connect { fn connect(self, sigthis: QStandardItemModel_itemChanged_signal); } // itemChanged(class QStandardItem *) extern fn QStandardItemModel_itemChanged_signal_connect_cb_0(rsfptr:fn(QStandardItem), arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsarg0 = QStandardItem::inheritFrom(arg0 as u64); rsfptr(rsarg0); } extern fn QStandardItemModel_itemChanged_signal_connect_cb_box_0(rsfptr_raw:*mut Box<Fn(QStandardItem)>, arg0: *mut c_void) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = QStandardItem::inheritFrom(arg0 as u64); // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QStandardItemModel_itemChanged_signal_connect for fn(QStandardItem) { fn connect(self, sigthis: QStandardItemModel_itemChanged_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QStandardItemModel_itemChanged_signal_connect_cb_0 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QStandardItemModel_SlotProxy_connect__ZN18QStandardItemModel11itemChangedEP13QStandardItem(arg0, arg1, arg2)}; } } impl /* trait */ QStandardItemModel_itemChanged_signal_connect for Box<Fn(QStandardItem)> { fn connect(self, sigthis: QStandardItemModel_itemChanged_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QStandardItemModel_itemChanged_signal_connect_cb_box_0 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QStandardItemModel_SlotProxy_connect__ZN18QStandardItemModel11itemChangedEP13QStandardItem(arg0, arg1, arg2)}; } } // <= body block end
//! Implements P-256 keys use ring::{ error, rand, signature::{ EcdsaKeyPair, KeyPair, VerificationAlgorithm, ECDSA_P256_SHA256_ASN1, ECDSA_P256_SHA256_ASN1_SIGNING, }, }; use rustls::internal::msgs::codec::{Codec, Reader}; /// p-256 public key #[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq)] pub struct PublicKey(Vec<u8>); impl PublicKey { /// Verify P-256 signature /// FIXME: types to distinguish between signature and message payloads pub fn verify_signature(&self, msg: &[u8], sig: &[u8]) -> Result<(), error::Unspecified> { ECDSA_P256_SHA256_ASN1.verify(self.0.as_slice().into(), msg.into(), sig.into()) } } impl AsRef<[u8]> for PublicKey { #[inline] fn as_ref(&self) -> &[u8] { &self.0 } } impl Codec for PublicKey { fn encode(&self, bytes: &mut Vec<u8>) { let len = self.0.len(); debug_assert!(len <= 0xffff); (len as u16).encode(bytes); bytes.extend_from_slice(&self.0); } fn read(r: &mut Reader) -> Option<Self> { let len = u16::read(r)? as usize; r.take(len).map(|slice| Self(slice.to_vec())) } } /// p-256 private key (key pair) pub struct PrivateKey(EcdsaKeyPair); impl PrivateKey { pub fn from_pkcs8(data: &[u8]) -> Result<Self, error::KeyRejected> { EcdsaKeyPair::from_pkcs8(&ECDSA_P256_SHA256_ASN1_SIGNING, data).map(Self) } pub fn public_key_raw(&self) -> &[u8] { self.0.public_key().as_ref() } pub fn public_key(&self) -> PublicKey { PublicKey(self.0.public_key().as_ref().to_vec()) } pub fn sign(&self, msg: &[u8]) -> Vec<u8> { self.0 .sign(&rand::SystemRandom::new(), msg) .unwrap() .as_ref() .to_vec() } }
use crate::prelude::*; use std::os::raw::c_void; use std::ptr; #[repr(C)] #[derive(Debug)] pub struct VkShaderModuleCreateInfo { pub sType: VkStructureType, pub pNext: *const c_void, pub flags: VkShaderModuleCreateFlagBits, pub codeSize: usize, pub pCode: *const u32, } impl VkShaderModuleCreateInfo { pub fn new<T>(flags: T, code: &[u8]) -> Self where T: Into<VkShaderModuleCreateFlagBits>, { VkShaderModuleCreateInfo { sType: VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO, pNext: ptr::null(), flags: flags.into(), codeSize: code.len(), pCode: code.as_ptr() as *const u32, } } }
use std::collections::HashMap; use std::fs::File; use std::io::BufWriter; use std::io::Write; // Trait system needs to allow for graph construction. // Main data structure holds basic data, like node // looks. // start with the root node. Add the node to the stack. // Get the node at the top of the stack. For each of its children, // Pop the node at the top of the stack. First check if // the refernce has a name. If not, name it, and bind the // the reference to the name. Then, look at the references. pub trait CreatesGraphviz { fn get_name(&self) -> String; fn get_connections(&self) -> Vec<&CreatesGraphviz>; } struct NodeEntry <'a> { name: String, children: Vec<&'a CreatesGraphviz> } pub struct Graphviz { labels: HashMap<String, String>, connections: Vec<(String, String)>, } impl Graphviz { pub fn write_file(&self, filename: String) { let output_file = File::create(&filename).expect(&format!("Could not open file {}", &filename)); let mut writer = BufWriter::new(output_file); writeln!(&mut writer, "digraph output {{").expect(&format!("Could not write to file {}", &filename)); for (name, label) in &self.labels { writeln!(&mut writer, " {} [label=\"{}\"];", name, label).expect(&format!("Could not write to file {}", &filename)); } for (from, to) in &self.connections { writeln!(&mut writer, " {} -> {};", from, to).expect(&format!("Could not write to file {}", &filename)); } writeln!(&mut writer, "}}").expect(&format!("Could not write to file {}", &filename)); writer.flush().expect(&format!("Error while finalizing {}", &filename)); } } impl From<&CreatesGraphviz> for Graphviz { fn from(item: &CreatesGraphviz) -> Self { let mut node_listing: HashMap<*const CreatesGraphviz, NodeEntry> = HashMap::new(); let mut labeling: HashMap<String, String> = HashMap::new(); let mut connections: Vec<(String, String)> = Vec::new(); let mut stack: Vec<&CreatesGraphviz> = vec![item]; while stack.len() > 0 { let top_node: &CreatesGraphviz = stack.pop().unwrap(); if let Some(entry) = node_listing.get(&(top_node as *const CreatesGraphviz)) { for child in &entry.children { let connected_name = &node_listing.get(&(*child as *const CreatesGraphviz)).unwrap().name; connections.push((entry.name.clone(), connected_name.clone())); } } else { let name = format!("_{}", node_listing.len()); labeling.insert(name.clone(), top_node.get_name()); let children = top_node.get_connections(); let mut unvisited: Vec<&CreatesGraphviz> = Vec::new(); for child in children { if let Some(connected_node) = node_listing.get(&(top_node as *const CreatesGraphviz)) { connections.push((name.clone(), connected_node.name.clone())); } else { unvisited.push(child); } } if unvisited.len() > 0 { stack.push(top_node); for unvisited_node in &unvisited { stack.push(*unvisited_node) } } let node = NodeEntry { name: name, children: unvisited }; node_listing.insert(top_node as *const CreatesGraphviz, node); } } let result = Graphviz { labels: labeling, connections: connections }; return result; } }
mod common; use std::str::FromStr; use std::string::ToString; use self::common::*; use rusty_git::object::{self, ObjectData}; use rusty_git::repository::Repository; #[test] fn reading_tag_produces_same_result_as_libgit2() { run_test_in_new_repo(|path| { git_tag(path, "mytag", Some("my message")); let lg_repo = git2::Repository::open(path).unwrap(); let rg_repo = Repository::open(path).unwrap(); let lg_ref = lg_repo.find_reference("refs/tags/mytag").unwrap(); let lg_id = lg_ref.target().unwrap(); let rg_id = object::Id::from_str(&lg_id.to_string()).unwrap(); let lg_tag = lg_repo.find_tag(lg_id).unwrap(); let rg_obj = rg_repo.object_database().parse_object(rg_id).unwrap(); let rg_tag = match rg_obj.data() { ObjectData::Tag(tag) => tag, _ => panic!("expected tag"), }; assert_eq!(lg_tag.name_bytes(), rg_tag.tag()); assert_eq!(lg_tag.target_id().to_string(), rg_tag.object().to_string()); assert_eq!(lg_tag.message_bytes().unwrap(), rg_tag.message().unwrap()); assert_eq!( lg_tag.tagger().unwrap().name_bytes(), rg_tag.tagger().unwrap().name() ); }) }
/* @author: xiao cai niao @datetime: 2019/12/04 */ use actix_web::web; use crate::storage::rocks::{DbInfo, CfNameTypeCode, KeyValue, PrefixTypeCode}; use std::{time, thread}; use crate::ha::procotol::{MysqlState}; use std::error::Error; use crate::ha::nodes_manager::CheckState; use crate::storage::opdb::{HaChangeLog, HostInfoValue}; use serde::{Serialize, Deserialize}; /// /// 每个mysql实例ip及端口信息 #[derive(Serialize, Deserialize, Debug)] pub struct MysqlHostInfo { pub host: String, pub port: usize } /// /// 集群路由信息 /// #[derive(Serialize, Deserialize, Debug)] pub struct RouteInfo { pub cluster_name: String, pub write: MysqlHostInfo, pub read: Vec<MysqlHostInfo> } impl RouteInfo { pub fn new(cluster_name: String) -> RouteInfo { RouteInfo{ cluster_name, write: MysqlHostInfo { host: "".to_string(), port: 0 }, read: vec![] } } fn split_str(&self, host_info: String) -> String { let host_info = host_info.split(":"); let host_vec = host_info.collect::<Vec<&str>>(); return host_vec[0].to_string(); } fn set_master_info(&mut self, node: &NodeInfo) { let host = self.split_str(node.value.host.clone()); self.write = MysqlHostInfo{ host, port: node.value.dbport.clone() }; } fn set_slave_info(&mut self, node: &NodeInfo) { let host = self.split_str(node.value.host.clone()); self.read.push(MysqlHostInfo{host, port: node.value.dbport.clone()}); } /// /// 获取宕机状态数据, 检查是db还是client宕机 /// /// 如果检查的为master: /// mysql实例宕机继续检查recovery状态, 检查switch状态是否成功,如果成功返回false剔除该节点,使用新master /// 如果switch状态为false或者db中没有recovery数据, 将不对该cluster路由信息做修改,返回error /// /// 原因有二: 有可能切换失败, 有可能正在切换中 /// /// client宕机将直接返回true fn check_down_status(&mut self, key: &String, db: &web::Data<DbInfo>, role: String) -> Result<bool, Box<dyn Error>> { let result = db.get(key, &CfNameTypeCode::CheckState.get())?; //info!("check_status: {}:{:?}", key, result); let value: CheckState = serde_json::from_str(&result.value)?; if value.db_down { if role == "master".to_string() { self.check_recovery_status(key, db)?; return Ok(false) }else if role == "slave".to_string() { return Ok(false) } } return Ok(true); } fn check_recovery_status(&self, key: &String, db: &web::Data<DbInfo>) -> Result<(), Box<dyn Error>> { let result = db.prefix_iterator(key, &CfNameTypeCode::HaChangeLog.get())?; //info!("{:?}", result); let mut tmp = vec![]; for row in result { if row.key.starts_with(key){ tmp.push(row); } } if tmp.len() > 0 { tmp.sort_by(|a, b| b.key.cmp(&a.key)); let key = tmp[0].key.clone(); let value: HaChangeLog = serde_json::from_str(&tmp[0].value)?; //info!("{:?}", value); //判断切换状态, 如果为成功则需再次判断是否已恢复,如果是已恢复状态表示是旧数据 //因为正常切换恢复和切换之间至少得有时间差, 有可能在进行路由判断时正处在切换的时候 //这个时候没有切换数据,这里就会获取到最后一条 if value.switch_status{ if !value.recovery_status{ //这里继续执行表示最后一条数据未正常恢复 //比较时间, 和当前时间进行比较如果超过10秒表示有可能是脏数据,将不进行操作 self.check_time_dif(&key)?; return Ok(()); } } //如果表示最后一条所有状态都正常或者未正常切换,比较时间差,超过10秒表示为脏数据不进行操作 self.check_time_dif(&key)?; // } //到这里如果还没返回,表示有可能还在切换中返回一个错误不进行操作 let err = format!("host: {} is master, but status unusual", key); return Err(err.into()); } fn check_time_dif(&self, key: &String) -> Result<(), Box<dyn Error>>{ let tmp_list = key.split("_"); let tmp_list = tmp_list.collect::<Vec<&str>>(); let tmp_time: i64 = tmp_list[1].to_string().parse()?; if (crate::timestamp() - tmp_time) > 10000 as i64 { let err = format!("key: {} recovery status unusual", key); return Err(err.into()); } Ok(()) } } /// /// 节点信息 #[derive(Clone, Debug)] struct NodeInfo { key: String, value: HostInfoValue } impl NodeInfo { fn new(kv: &KeyValue) -> Result<NodeInfo, Box<dyn Error>> { let key = kv.key.clone(); let value = serde_json::from_str(&kv.value)?; Ok(NodeInfo{ key, value }) } } /// /// 集群信息 #[derive(Debug, Clone)] struct ClusterNodeInfo{ cluster_name: String, slave_behind_setting: usize, //slave 延迟配置 node_list: Vec<NodeInfo> } impl ClusterNodeInfo { fn new(ninfo: &NodeInfo, slave_behind: usize) -> ClusterNodeInfo { ClusterNodeInfo{ cluster_name: ninfo.value.cluster_name.clone(), slave_behind_setting: slave_behind, node_list: vec![ninfo.clone()] } } fn my_clone(&self) -> ClusterNodeInfo { ClusterNodeInfo{ cluster_name: self.cluster_name.clone(), slave_behind_setting: self.slave_behind_setting.clone(), node_list: self.node_list.clone(), } } fn update(&mut self, ninfo: &NodeInfo) { self.node_list.push(ninfo.clone()); } fn route_check(&self, db: &web::Data<DbInfo>) -> Result<RouteInfo, Box<dyn Error>> { let mut route_info = RouteInfo::new(self.cluster_name.clone()); for node in &self.node_list{ let cur_state = node.value.get_state(db)?; if self.master_check(&node, &cur_state, db, &mut route_info)?{ continue; }; self.slave_check(&node, &cur_state, db, &mut route_info)?; } Ok(route_info) } /// /// 对role为master的节点进行判断, 如果为online直接写入信息,如果宕机则需要检查宕机检查数据是否为实例宕机,如果为实例宕机则需要检查是否已经切换 /// 因为在实例或者client宕机时则不会更新检查状态,所以宕机之前为master如果未恢复则会一直为master状态 fn master_check(&self, node: &NodeInfo, node_status: &MysqlState, db: &web::Data<DbInfo>, route_info: &mut RouteInfo) -> Result<bool, Box<dyn Error>> { //info!("{:?}", node_status); if node_status.role == "master".to_string() { //info!("master_check: {:?}",node_status); if node.value.online { route_info.set_master_info(node); return Ok(true); }else { if route_info.check_down_status(&node.key, db, "master".to_string())?{ route_info.set_master_info(node); return Ok(true); }; } } Ok(false) } /// /// 检查slave节点状态 /// 1、在线时需要检查replication延迟状态, behind超过100将剔除该节点,如果配置为0表示不检查延迟 /// 2、如果宕机则需要检查是实例宕机还是client宕机 /// 3、如果为实例宕机直接剔除 /// 4、如果client宕机将不做任何操作, 直接添加对应节点, 这里无法检测hebind值,因为如果client宕机将不会更新状态 fn slave_check(&self, node: &NodeInfo, node_status: &MysqlState, db: &web::Data<DbInfo>, route_info: &mut RouteInfo) -> Result<(), Box<dyn Error>> { //info!("{:?}", node_status); if node.value.maintain{return Ok(())} if node_status.role == "slave".to_string() { if node.value.online{ if !node_status.sql_thread { return Ok(()); } if !node_status.io_thread { return Ok(()) } if self.slave_behind_setting == 0{ //为0表示不判断延迟 route_info.set_slave_info(node); } else if node_status.seconds_behind <= self.slave_behind_setting { route_info.set_slave_info(node); } }else { if route_info.check_down_status(&node.key, db, "slave".to_string())?{ route_info.set_slave_info(node); } } } Ok(()) } } /// /// 所有节点信息 #[derive(Debug)] struct AllNode { nodes: Vec<ClusterNodeInfo> } impl AllNode { /// /// 从db获取所有节点并通过cluster_name进行分类 fn new(db: &web::Data<DbInfo>) -> Result<AllNode, Box<dyn Error>> { let all_node = db.iterator(&CfNameTypeCode::HaNodesInfo.get(), &"".to_string())?; let mut nodes_info: Vec<ClusterNodeInfo> = vec![]; 'all: for node in all_node { let ninfo = NodeInfo::new(&node)?; if ninfo.value.rtype == "route".to_string() { continue 'all; } 'inner: for (idx,cluster_info) in nodes_info.iter().enumerate(){ let mut my_cluster_info = cluster_info.my_clone(); if &my_cluster_info.cluster_name == &ninfo.value.cluster_name { my_cluster_info.update(&ninfo); nodes_info[idx] = my_cluster_info; continue 'all; } } let mut delay = 100; let delay_check = db.get_hehind_setting(&ninfo.value.cluster_name); match delay_check { Ok(v) => { delay = v.delay; } Err(e) => { info!("check slave behind setting for cluster_name:{} , Error: {:?}", &ninfo.value.cluster_name,e.to_string()); } } nodes_info.push(ClusterNodeInfo::new(&ninfo, delay)); } Ok(AllNode{ nodes: nodes_info }) } /// /// 对cluster信息进行循环检查,并把对应route信息写入db fn route_manager(&self, db: &web::Data<DbInfo>) { for cluster in &self.nodes { self.run_check_state(cluster,db); } } fn run_check_state(&self, cluster: &ClusterNodeInfo, db: &web::Data<DbInfo>){ let check_state = cluster.route_check(db); match check_state { Ok(rinfo) => { if rinfo.write.host == "".to_string(){ thread::sleep(time::Duration::from_secs(1)); self.run_check_state(cluster, db); return; } if let Err(e) = db.prefix_put(&PrefixTypeCode::RouteInfo, &rinfo.cluster_name, &rinfo){ info!("{:?}", e.to_string()); }; } Err(_e) => { //info!("Error: {:?} for cluster: {:?}", e.to_string(), &cluster); } } } } pub fn manager(db: web::Data<DbInfo>) { let mut all_node = AllNode::new(&db).unwrap(); let mut start_time = crate::timestamp(); loop { if crate::timestamp() - start_time >= 10000 { //每10秒获取一次rocksdb中节点信息 all_node = AllNode::new(&db).unwrap(); //info!("node list: {:?}",all_node); start_time = crate::timestamp(); } all_node.route_manager(&db); thread::sleep(time::Duration::from_secs(1)); } }
//! This module provides a reference implementation of [`QueryNamespace`] for use in testing. //! //! AKA it is a Mock use crate::{ exec::{ stringset::{StringSet, StringSetRef}, Executor, ExecutorType, IOxSessionContext, }, pruning::prune_chunks, QueryChunk, QueryChunkData, QueryCompletedToken, QueryNamespace, QueryText, }; use arrow::array::{BooleanArray, Float64Array}; use arrow::datatypes::SchemaRef; use arrow::{ array::{ ArrayRef, DictionaryArray, Int64Array, StringArray, TimestampNanosecondArray, UInt64Array, }, datatypes::{DataType, Int32Type, TimeUnit}, record_batch::RecordBatch, }; use async_trait::async_trait; use data_types::{ChunkId, ChunkOrder, PartitionKey, TableId, TransitionPartitionId}; use datafusion::error::DataFusionError; use datafusion::execution::context::SessionState; use datafusion::logical_expr::Expr; use datafusion::physical_plan::ExecutionPlan; use datafusion::{catalog::schema::SchemaProvider, logical_expr::LogicalPlan}; use datafusion::{catalog::CatalogProvider, physical_plan::displayable}; use datafusion::{ datasource::{object_store::ObjectStoreUrl, TableProvider, TableType}, physical_plan::{ColumnStatistics, Statistics as DataFusionStatistics}, scalar::ScalarValue, }; use datafusion_util::config::DEFAULT_SCHEMA; use itertools::Itertools; use object_store::{path::Path, ObjectMeta}; use parking_lot::Mutex; use parquet_file::storage::ParquetExecInput; use predicate::Predicate; use schema::{ builder::SchemaBuilder, merge::SchemaMerger, sort::SortKey, Schema, TIME_COLUMN_NAME, }; use std::{ any::Any, collections::{BTreeMap, HashMap}, fmt, num::NonZeroU64, sync::Arc, }; use trace::ctx::SpanContext; #[derive(Debug)] pub struct TestDatabase { executor: Arc<Executor>, /// Partitions which have been saved to this test database /// Key is partition name /// Value is map of chunk_id to chunk partitions: Mutex<BTreeMap<String, BTreeMap<ChunkId, Arc<TestChunk>>>>, /// `column_names` to return upon next request column_names: Arc<Mutex<Option<StringSetRef>>>, /// The predicate passed to the most recent call to `chunks()` chunks_predicate: Mutex<Vec<Expr>>, /// Retention time ns. retention_time_ns: Option<i64>, } impl TestDatabase { pub fn new(executor: Arc<Executor>) -> Self { Self { executor, partitions: Default::default(), column_names: Default::default(), chunks_predicate: Default::default(), retention_time_ns: None, } } /// Add a test chunk to the database pub fn add_chunk(&self, partition_key: &str, chunk: Arc<TestChunk>) -> &Self { let mut partitions = self.partitions.lock(); let chunks = partitions .entry(partition_key.to_string()) .or_insert_with(BTreeMap::new); chunks.insert(chunk.id(), chunk); self } /// Add a test chunk to the database pub fn with_chunk(self, partition_key: &str, chunk: Arc<TestChunk>) -> Self { self.add_chunk(partition_key, chunk); self } /// Get the specified chunk pub fn get_chunk(&self, partition_key: &str, id: ChunkId) -> Option<Arc<TestChunk>> { self.partitions .lock() .get(partition_key) .and_then(|p| p.get(&id).cloned()) } /// Return the most recent predicate passed to get_chunks() pub fn get_chunks_predicate(&self) -> Vec<Expr> { self.chunks_predicate.lock().clone() } /// Set the list of column names that will be returned on a call to /// column_names pub fn set_column_names(&self, column_names: Vec<String>) { let column_names = column_names.into_iter().collect::<StringSet>(); let column_names = Arc::new(column_names); *Arc::clone(&self.column_names).lock() = Some(column_names) } /// Set retention time. pub fn with_retention_time_ns(mut self, retention_time_ns: Option<i64>) -> Self { self.retention_time_ns = retention_time_ns; self } } #[async_trait] impl QueryNamespace for TestDatabase { async fn chunks( &self, table_name: &str, filters: &[Expr], _projection: Option<&Vec<usize>>, _ctx: IOxSessionContext, ) -> Result<Vec<Arc<dyn QueryChunk>>, DataFusionError> { // save last predicate *self.chunks_predicate.lock() = filters.to_vec(); let predicate = Predicate::default().with_exprs(filters.iter().cloned()); let partitions = self.partitions.lock().clone(); Ok(partitions .values() .flat_map(|x| x.values()) // filter by table .filter(|c| c.table_name == table_name) // only keep chunks if their statistics overlap .filter(|c| { prune_chunks( c.schema(), &[Arc::clone(*c) as Arc<dyn QueryChunk>], &predicate, ) .ok() .map(|res| res[0]) .unwrap_or(true) }) .map(|x| Arc::clone(x) as Arc<dyn QueryChunk>) .collect::<Vec<_>>()) } fn retention_time_ns(&self) -> Option<i64> { self.retention_time_ns } fn record_query( &self, _ctx: &IOxSessionContext, _query_type: &str, _query_text: QueryText, ) -> QueryCompletedToken { QueryCompletedToken::new(|_| {}) } fn new_query_context(&self, span_ctx: Option<SpanContext>) -> IOxSessionContext { // Note: unlike Db this does not register a catalog provider self.executor .new_execution_config(ExecutorType::Query) .with_default_catalog(Arc::new(TestDatabaseCatalogProvider::from_test_database( self, ))) .with_span_context(span_ctx) .build() } } struct TestDatabaseCatalogProvider { partitions: BTreeMap<String, BTreeMap<ChunkId, Arc<TestChunk>>>, } impl TestDatabaseCatalogProvider { fn from_test_database(db: &TestDatabase) -> Self { Self { partitions: db.partitions.lock().clone(), } } } impl CatalogProvider for TestDatabaseCatalogProvider { fn as_any(&self) -> &dyn Any { self } fn schema_names(&self) -> Vec<String> { vec![DEFAULT_SCHEMA.to_string()] } fn schema(&self, name: &str) -> Option<Arc<dyn SchemaProvider>> { match name { DEFAULT_SCHEMA => Some(Arc::new(TestDatabaseSchemaProvider { partitions: self.partitions.clone(), })), _ => None, } } } struct TestDatabaseSchemaProvider { partitions: BTreeMap<String, BTreeMap<ChunkId, Arc<TestChunk>>>, } #[async_trait] impl SchemaProvider for TestDatabaseSchemaProvider { fn as_any(&self) -> &dyn Any { self } fn table_names(&self) -> Vec<String> { self.partitions .values() .flat_map(|c| c.values()) .map(|c| c.table_name.to_owned()) .unique() .collect() } async fn table(&self, name: &str) -> Option<Arc<dyn TableProvider>> { Some(Arc::new(TestDatabaseTableProvider { partitions: self .partitions .values() .flat_map(|chunks| chunks.values().filter(|c| c.table_name() == name)) .map(Clone::clone) .collect(), })) } fn table_exist(&self, name: &str) -> bool { self.table_names().contains(&name.to_string()) } } struct TestDatabaseTableProvider { partitions: Vec<Arc<TestChunk>>, } #[async_trait] impl TableProvider for TestDatabaseTableProvider { fn as_any(&self) -> &dyn Any { self } fn schema(&self) -> SchemaRef { self.partitions .iter() .fold(SchemaMerger::new(), |merger, chunk| { merger.merge(chunk.schema()).expect("consistent schemas") }) .build() .as_arrow() } fn table_type(&self) -> TableType { TableType::Base } async fn scan( &self, _ctx: &SessionState, _projection: Option<&Vec<usize>>, _filters: &[Expr], _limit: Option<usize>, ) -> crate::exec::context::Result<Arc<dyn ExecutionPlan>> { unimplemented!() } } #[derive(Debug)] pub struct TestChunk { /// Table name table_name: String, /// Schema of the table schema: Schema, /// Values for stats() column_stats: HashMap<String, ColumnStatistics>, num_rows: Option<usize>, id: ChunkId, partition_id: TransitionPartitionId, /// Set the flag if this chunk might contain duplicates may_contain_pk_duplicates: bool, /// Data in this chunk. table_data: QueryChunkData, /// A saved error that is returned instead of actual results saved_error: Option<String>, /// Order of this chunk relative to other overlapping chunks. order: ChunkOrder, /// The sort key of this chunk sort_key: Option<SortKey>, /// Suppress output quiet: bool, } /// Implements a method for adding a column with default stats macro_rules! impl_with_column { ($NAME:ident, $DATA_TYPE:ident) => { pub fn $NAME(self, column_name: impl Into<String>) -> Self { let column_name = column_name.into(); let new_column_schema = SchemaBuilder::new() .field(&column_name, DataType::$DATA_TYPE) .unwrap() .build() .unwrap(); self.add_schema_to_table(new_column_schema, None) } }; } /// Implements a method for adding a column with stats that have the specified min and max macro_rules! impl_with_column_with_stats { ($NAME:ident, $DATA_TYPE:ident, $RUST_TYPE:ty, $STAT_TYPE:ident) => { pub fn $NAME( self, column_name: impl Into<String>, min: Option<$RUST_TYPE>, max: Option<$RUST_TYPE>, ) -> Self { let column_name = column_name.into(); let new_column_schema = SchemaBuilder::new() .field(&column_name, DataType::$DATA_TYPE) .unwrap() .build() .unwrap(); let stats = ColumnStatistics { null_count: None, max_value: max.map(|s| ScalarValue::from(s)), min_value: min.map(|s| ScalarValue::from(s)), distinct_count: None, }; self.add_schema_to_table(new_column_schema, Some(stats)) } }; } impl TestChunk { pub fn new(table_name: impl Into<String>) -> Self { let table_name = table_name.into(); Self { table_name, schema: SchemaBuilder::new().build().unwrap(), column_stats: Default::default(), num_rows: None, id: ChunkId::new_test(0), may_contain_pk_duplicates: Default::default(), table_data: QueryChunkData::RecordBatches(vec![]), saved_error: Default::default(), order: ChunkOrder::MIN, sort_key: None, partition_id: TransitionPartitionId::arbitrary_for_testing(), quiet: false, } } fn push_record_batch(&mut self, batch: RecordBatch) { match &mut self.table_data { QueryChunkData::RecordBatches(batches) => { batches.push(batch); } QueryChunkData::Parquet(_) => panic!("chunk is parquet-based"), } } pub fn with_order(self, order: i64) -> Self { Self { order: ChunkOrder::new(order), ..self } } pub fn with_dummy_parquet_file(self) -> Self { self.with_dummy_parquet_file_and_store("iox://store") } pub fn with_dummy_parquet_file_and_store(self, store: &str) -> Self { match self.table_data { QueryChunkData::RecordBatches(batches) => { assert!(batches.is_empty(), "chunk already has record batches"); } QueryChunkData::Parquet(_) => panic!("chunk already has a file"), } Self { table_data: QueryChunkData::Parquet(ParquetExecInput { object_store_url: ObjectStoreUrl::parse(store).unwrap(), object_meta: ObjectMeta { location: Self::parquet_location(self.id), last_modified: Default::default(), size: 1, e_tag: None, }, }), ..self } } fn parquet_location(chunk_id: ChunkId) -> Path { Path::parse(format!("{}.parquet", chunk_id.get().as_u128())).unwrap() } /// Returns the receiver configured to suppress any output to STDOUT. pub fn with_quiet(mut self) -> Self { self.quiet = true; self } pub fn with_id(mut self, id: u128) -> Self { self.id = ChunkId::new_test(id); if let QueryChunkData::Parquet(parquet_input) = &mut self.table_data { parquet_input.object_meta.location = Self::parquet_location(self.id); } self } pub fn with_partition(mut self, id: i64) -> Self { self.partition_id = TransitionPartitionId::new(TableId::new(id), &PartitionKey::from("arbitrary")); self } pub fn with_partition_id(mut self, id: TransitionPartitionId) -> Self { self.partition_id = id; self } /// specify that any call should result in an error with the message /// specified pub fn with_error(mut self, error_message: impl Into<String>) -> Self { self.saved_error = Some(error_message.into()); self } /// Checks the saved error, and returns it if any, otherwise returns OK fn check_error(&self) -> Result<(), DataFusionError> { if let Some(message) = self.saved_error.as_ref() { Err(DataFusionError::External(message.clone().into())) } else { Ok(()) } } /// Set the `may_contain_pk_duplicates` flag pub fn with_may_contain_pk_duplicates(mut self, v: bool) -> Self { self.may_contain_pk_duplicates = v; self } /// Register a tag column with the test chunk with default stats pub fn with_tag_column(self, column_name: impl Into<String>) -> Self { let column_name = column_name.into(); // make a new schema with the specified column and // merge it in to any existing schema let new_column_schema = SchemaBuilder::new().tag(&column_name).build().unwrap(); self.add_schema_to_table(new_column_schema, None) } /// Register a tag column with stats with the test chunk pub fn with_tag_column_with_stats( self, column_name: impl Into<String>, min: Option<&str>, max: Option<&str>, ) -> Self { self.with_tag_column_with_full_stats(column_name, min, max, 0, None) } /// Register a tag column with stats with the test chunk pub fn with_tag_column_with_full_stats( self, column_name: impl Into<String>, min: Option<&str>, max: Option<&str>, count: u64, distinct_count: Option<NonZeroU64>, ) -> Self { let null_count = 0; self.with_tag_column_with_nulls_and_full_stats( column_name, min, max, count, distinct_count, null_count, ) } fn update_count(&mut self, count: usize) { match self.num_rows { Some(existing) => assert_eq!(existing, count), None => self.num_rows = Some(count), } } /// Register a tag column with stats with the test chunk pub fn with_tag_column_with_nulls_and_full_stats( mut self, column_name: impl Into<String>, min: Option<&str>, max: Option<&str>, count: u64, distinct_count: Option<NonZeroU64>, null_count: u64, ) -> Self { let column_name = column_name.into(); // make a new schema with the specified column and // merge it in to any existing schema let new_column_schema = SchemaBuilder::new().tag(&column_name).build().unwrap(); // Construct stats let stats = ColumnStatistics { null_count: Some(null_count as usize), max_value: max.map(ScalarValue::from), min_value: min.map(ScalarValue::from), distinct_count: distinct_count.map(|c| c.get() as usize), }; self.update_count(count as usize); self.add_schema_to_table(new_column_schema, Some(stats)) } /// Register a timestamp column with the test chunk with default stats pub fn with_time_column(self) -> Self { // make a new schema with the specified column and // merge it in to any existing schema let new_column_schema = SchemaBuilder::new().timestamp().build().unwrap(); self.add_schema_to_table(new_column_schema, None) } /// Register a timestamp column with the test chunk pub fn with_time_column_with_stats(self, min: Option<i64>, max: Option<i64>) -> Self { self.with_time_column_with_full_stats(min, max, 0, None) } /// Register a timestamp column with full stats with the test chunk pub fn with_time_column_with_full_stats( mut self, min: Option<i64>, max: Option<i64>, count: u64, distinct_count: Option<NonZeroU64>, ) -> Self { // make a new schema with the specified column and // merge it in to any existing schema let new_column_schema = SchemaBuilder::new().timestamp().build().unwrap(); let null_count = 0; // Construct stats let stats = ColumnStatistics { null_count: Some(null_count as usize), max_value: max.map(|v| ScalarValue::TimestampNanosecond(Some(v), None)), min_value: min.map(|v| ScalarValue::TimestampNanosecond(Some(v), None)), distinct_count: distinct_count.map(|c| c.get() as usize), }; self.update_count(count as usize); self.add_schema_to_table(new_column_schema, Some(stats)) } pub fn with_timestamp_min_max(mut self, min: i64, max: i64) -> Self { let stats = self .column_stats .get_mut(TIME_COLUMN_NAME) .expect("stats in sync w/ columns"); stats.min_value = Some(ScalarValue::TimestampNanosecond(Some(min), None)); stats.max_value = Some(ScalarValue::TimestampNanosecond(Some(max), None)); self } impl_with_column!(with_i64_field_column, Int64); impl_with_column_with_stats!(with_i64_field_column_with_stats, Int64, i64, I64); impl_with_column!(with_u64_column, UInt64); impl_with_column_with_stats!(with_u64_field_column_with_stats, UInt64, u64, U64); impl_with_column!(with_f64_field_column, Float64); impl_with_column_with_stats!(with_f64_field_column_with_stats, Float64, f64, F64); impl_with_column!(with_bool_field_column, Boolean); impl_with_column_with_stats!(with_bool_field_column_with_stats, Boolean, bool, Bool); /// Register a string field column with the test chunk pub fn with_string_field_column_with_stats( self, column_name: impl Into<String>, min: Option<&str>, max: Option<&str>, ) -> Self { let column_name = column_name.into(); // make a new schema with the specified column and // merge it in to any existing schema let new_column_schema = SchemaBuilder::new() .field(&column_name, DataType::Utf8) .unwrap() .build() .unwrap(); // Construct stats let stats = ColumnStatistics { null_count: None, max_value: max.map(ScalarValue::from), min_value: min.map(ScalarValue::from), distinct_count: None, }; self.add_schema_to_table(new_column_schema, Some(stats)) } /// Adds the specified schema and optionally a column summary containing optional stats. /// If `add_column_summary` is false, `stats` is ignored. If `add_column_summary` is true but /// `stats` is `None`, default stats will be added to the column summary. fn add_schema_to_table( mut self, new_column_schema: Schema, input_stats: Option<ColumnStatistics>, ) -> Self { let mut merger = SchemaMerger::new(); merger = merger.merge(&new_column_schema).unwrap(); merger = merger.merge(&self.schema).expect("merging was successful"); self.schema = merger.build(); for f in new_column_schema.inner().fields() { self.column_stats.insert( f.name().clone(), input_stats.as_ref().cloned().unwrap_or_default(), ); } self } /// Prepares this chunk to return a specific record batch with one /// row of non null data. /// tag: MA pub fn with_one_row_of_data(mut self) -> Self { // create arrays let columns = self .schema .iter() .map(|(_influxdb_column_type, field)| match field.data_type() { DataType::Int64 => Arc::new(Int64Array::from(vec![1000])) as ArrayRef, DataType::UInt64 => Arc::new(UInt64Array::from(vec![1000])) as ArrayRef, DataType::Utf8 => Arc::new(StringArray::from(vec!["MA"])) as ArrayRef, DataType::Timestamp(TimeUnit::Nanosecond, _) => { Arc::new(TimestampNanosecondArray::from(vec![1000])) as ArrayRef } DataType::Dictionary(key, value) if key.as_ref() == &DataType::Int32 && value.as_ref() == &DataType::Utf8 => { let dict: DictionaryArray<Int32Type> = vec!["MA"].into_iter().collect(); Arc::new(dict) as ArrayRef } DataType::Float64 => Arc::new(Float64Array::from(vec![99.5])) as ArrayRef, DataType::Boolean => Arc::new(BooleanArray::from(vec![true])) as ArrayRef, _ => unimplemented!( "Unimplemented data type for test database: {:?}", field.data_type() ), }) .collect::<Vec<_>>(); let batch = RecordBatch::try_new(self.schema.as_arrow(), columns).expect("made record batch"); if !self.quiet { println!("TestChunk batch data: {batch:#?}"); } self.push_record_batch(batch); self } /// Prepares this chunk to return a specific record batch with a single tag, field and timestamp like pub fn with_one_row_of_specific_data( mut self, tag_val: impl AsRef<str>, field_val: i64, ts_val: i64, ) -> Self { // create arrays let columns = self .schema .iter() .map(|(_influxdb_column_type, field)| match field.data_type() { DataType::Int64 => Arc::new(Int64Array::from(vec![field_val])) as ArrayRef, DataType::Timestamp(TimeUnit::Nanosecond, _) => { Arc::new(TimestampNanosecondArray::from(vec![ts_val])) as ArrayRef } DataType::Dictionary(key, value) if key.as_ref() == &DataType::Int32 && value.as_ref() == &DataType::Utf8 => { let dict: DictionaryArray<Int32Type> = vec![tag_val.as_ref()].into_iter().collect(); Arc::new(dict) as ArrayRef } _ => unimplemented!( "Unimplemented data type for test database: {:?}", field.data_type() ), }) .collect::<Vec<_>>(); let batch = RecordBatch::try_new(self.schema.as_arrow(), columns).expect("made record batch"); if !self.quiet { println!("TestChunk batch data: {batch:#?}"); } self.push_record_batch(batch); self } /// Prepares this chunk to return a specific record batch with three /// rows of non null data that look like, no duplicates within /// "+------+------+-----------+-------------------------------+", /// "| tag1 | tag2 | field_int | time |", /// "+------+------+-----------+-------------------------------+", /// "| WA | SC | 1000 | 1970-01-01 00:00:00.000008 |", /// "| VT | NC | 10 | 1970-01-01 00:00:00.000010 |", /// "| UT | RI | 70 | 1970-01-01 00:00:00.000020 |", /// "+------+------+-----------+-------------------------------+", /// Stats(min, max) : tag1(UT, WA), tag2(RI, SC), time(8000, 20000) pub fn with_three_rows_of_data(mut self) -> Self { // create arrays let columns = self .schema .iter() .map(|(_influxdb_column_type, field)| match field.data_type() { DataType::Int64 => Arc::new(Int64Array::from(vec![1000, 10, 70])) as ArrayRef, DataType::UInt64 => Arc::new(UInt64Array::from(vec![1000, 10, 70])) as ArrayRef, DataType::Utf8 => match field.name().as_str() { "tag1" => Arc::new(StringArray::from(vec!["WA", "VT", "UT"])) as ArrayRef, "tag2" => Arc::new(StringArray::from(vec!["SC", "NC", "RI"])) as ArrayRef, _ => Arc::new(StringArray::from(vec!["TX", "PR", "OR"])) as ArrayRef, }, DataType::Timestamp(TimeUnit::Nanosecond, _) => { Arc::new(TimestampNanosecondArray::from(vec![8000, 10000, 20000])) as ArrayRef } DataType::Dictionary(key, value) if key.as_ref() == &DataType::Int32 && value.as_ref() == &DataType::Utf8 => { match field.name().as_str() { "tag1" => Arc::new( vec!["WA", "VT", "UT"] .into_iter() .collect::<DictionaryArray<Int32Type>>(), ) as ArrayRef, "tag2" => Arc::new( vec!["SC", "NC", "RI"] .into_iter() .collect::<DictionaryArray<Int32Type>>(), ) as ArrayRef, _ => Arc::new( vec!["TX", "PR", "OR"] .into_iter() .collect::<DictionaryArray<Int32Type>>(), ) as ArrayRef, } } _ => unimplemented!( "Unimplemented data type for test database: {:?}", field.data_type() ), }) .collect::<Vec<_>>(); let batch = RecordBatch::try_new(self.schema.as_arrow(), columns).expect("made record batch"); self.push_record_batch(batch); self } /// Prepares this chunk to return a specific record batch with four /// rows of non null data that look like, duplicates within /// "+------+------+-----------+-------------------------------+", /// "| tag1 | tag2 | field_int | time |", /// "+------+------+-----------+-------------------------------+", /// "| WA | SC | 1000 | 1970-01-01 00:00:00.000028 |", /// "| VT | NC | 10 | 1970-01-01 00:00:00.000210 |", (1) /// "| UT | RI | 70 | 1970-01-01 00:00:00.000220 |", /// "| VT | NC | 50 | 1970-01-01 00:00:00.000210 |", // duplicate of (1) /// "+------+------+-----------+-------------------------------+", /// Stats(min, max) : tag1(UT, WA), tag2(RI, SC), time(28000, 220000) pub fn with_four_rows_of_data(mut self) -> Self { // create arrays let columns = self .schema .iter() .map(|(_influxdb_column_type, field)| match field.data_type() { DataType::Int64 => Arc::new(Int64Array::from(vec![1000, 10, 70, 50])) as ArrayRef, DataType::Utf8 => match field.name().as_str() { "tag1" => Arc::new(StringArray::from(vec!["WA", "VT", "UT", "VT"])) as ArrayRef, "tag2" => Arc::new(StringArray::from(vec!["SC", "NC", "RI", "NC"])) as ArrayRef, _ => Arc::new(StringArray::from(vec!["TX", "PR", "OR", "AL"])) as ArrayRef, }, DataType::Timestamp(TimeUnit::Nanosecond, _) => { Arc::new(TimestampNanosecondArray::from(vec![ 28000, 210000, 220000, 210000, ])) as ArrayRef } DataType::Dictionary(key, value) if key.as_ref() == &DataType::Int32 && value.as_ref() == &DataType::Utf8 => { match field.name().as_str() { "tag1" => Arc::new( vec!["WA", "VT", "UT", "VT"] .into_iter() .collect::<DictionaryArray<Int32Type>>(), ) as ArrayRef, "tag2" => Arc::new( vec!["SC", "NC", "RI", "NC"] .into_iter() .collect::<DictionaryArray<Int32Type>>(), ) as ArrayRef, _ => Arc::new( vec!["TX", "PR", "OR", "AL"] .into_iter() .collect::<DictionaryArray<Int32Type>>(), ) as ArrayRef, } } _ => unimplemented!( "Unimplemented data type for test database: {:?}", field.data_type() ), }) .collect::<Vec<_>>(); let batch = RecordBatch::try_new(self.schema.as_arrow(), columns).expect("made record batch"); self.push_record_batch(batch); self } /// Prepares this chunk to return a specific record batch with five /// rows of non null data that look like, no duplicates within /// "+------+------+-----------+-------------------------------+", /// "| tag1 | tag2 | field_int | time |", /// "+------+------+-----------+-------------------------------+", /// "| MT | CT | 1000 | 1970-01-01 00:00:00.000001 |", /// "| MT | AL | 10 | 1970-01-01 00:00:00.000007 |", /// "| CT | CT | 70 | 1970-01-01 00:00:00.000000100 |", /// "| AL | MA | 100 | 1970-01-01 00:00:00.000000050 |", /// "| MT | AL | 5 | 1970-01-01 00:00:00.000005 |", /// "+------+------+-----------+-------------------------------+", /// Stats(min, max) : tag1(AL, MT), tag2(AL, MA), time(5, 7000) pub fn with_five_rows_of_data(mut self) -> Self { // create arrays let columns = self.schema .iter() .map(|(_influxdb_column_type, field)| match field.data_type() { DataType::Int64 => { Arc::new(Int64Array::from(vec![1000, 10, 70, 100, 5])) as ArrayRef } DataType::Utf8 => match field.name().as_str() { "tag1" => Arc::new(StringArray::from(vec!["MT", "MT", "CT", "AL", "MT"])) as ArrayRef, "tag2" => Arc::new(StringArray::from(vec!["CT", "AL", "CT", "MA", "AL"])) as ArrayRef, _ => Arc::new(StringArray::from(vec!["CT", "MT", "AL", "AL", "MT"])) as ArrayRef, }, DataType::Timestamp(TimeUnit::Nanosecond, _) => { Arc::new(TimestampNanosecondArray::from(vec![ 1000, 7000, 100, 50, 5000, ])) as ArrayRef } DataType::Dictionary(key, value) if key.as_ref() == &DataType::Int32 && value.as_ref() == &DataType::Utf8 => { match field.name().as_str() { "tag1" => Arc::new( vec!["MT", "MT", "CT", "AL", "MT"] .into_iter() .collect::<DictionaryArray<Int32Type>>(), ) as ArrayRef, "tag2" => Arc::new( vec!["CT", "AL", "CT", "MA", "AL"] .into_iter() .collect::<DictionaryArray<Int32Type>>(), ) as ArrayRef, _ => Arc::new( vec!["CT", "MT", "AL", "AL", "MT"] .into_iter() .collect::<DictionaryArray<Int32Type>>(), ) as ArrayRef, } } _ => unimplemented!( "Unimplemented data type for test database: {:?}", field.data_type() ), }) .collect::<Vec<_>>(); let batch = RecordBatch::try_new(self.schema.as_arrow(), columns).expect("made record batch"); self.push_record_batch(batch); self } /// Prepares this chunk to return a specific record batch with ten /// rows of non null data that look like, duplicates within /// "+------+------+-----------+-------------------------------+", /// "| tag1 | tag2 | field_int | time |", /// "+------+------+-----------+-------------------------------+", /// "| MT | CT | 1000 | 1970-01-01 00:00:00.000001 |", /// "| MT | AL | 10 | 1970-01-01 00:00:00.000007 |", (1) /// "| CT | CT | 70 | 1970-01-01 00:00:00.000000100 |", /// "| AL | MA | 100 | 1970-01-01 00:00:00.000000050 |", (2) /// "| MT | AL | 5 | 1970-01-01 00:00:00.000005 |", (3) /// "| MT | CT | 1000 | 1970-01-01 00:00:00.000002 |", /// "| MT | AL | 20 | 1970-01-01 00:00:00.000007 |", // Duplicate with (1) /// "| CT | CT | 70 | 1970-01-01 00:00:00.000000500 |", /// "| AL | MA | 10 | 1970-01-01 00:00:00.000000050 |", // Duplicate with (2) /// "| MT | AL | 30 | 1970-01-01 00:00:00.000005 |", // Duplicate with (3) /// "+------+------+-----------+-------------------------------+", /// Stats(min, max) : tag1(AL, MT), tag2(AL, MA), time(5, 7000) pub fn with_ten_rows_of_data_some_duplicates(mut self) -> Self { // create arrays let columns = self .schema .iter() .map(|(_influxdb_column_type, field)| match field.data_type() { DataType::Int64 => Arc::new(Int64Array::from(vec![ 1000, 10, 70, 100, 5, 1000, 20, 70, 10, 30, ])) as ArrayRef, DataType::Utf8 => match field.name().as_str() { "tag1" => Arc::new(StringArray::from(vec![ "MT", "MT", "CT", "AL", "MT", "MT", "MT", "CT", "AL", "MT", ])) as ArrayRef, "tag2" => Arc::new(StringArray::from(vec![ "CT", "AL", "CT", "MA", "AL", "CT", "AL", "CT", "MA", "AL", ])) as ArrayRef, _ => Arc::new(StringArray::from(vec![ "CT", "MT", "AL", "AL", "MT", "CT", "MT", "AL", "AL", "MT", ])) as ArrayRef, }, DataType::Timestamp(TimeUnit::Nanosecond, _) => { Arc::new(TimestampNanosecondArray::from(vec![ 1000, 7000, 100, 50, 5, 2000, 7000, 500, 50, 5, ])) as ArrayRef } DataType::Dictionary(key, value) if key.as_ref() == &DataType::Int32 && value.as_ref() == &DataType::Utf8 => { match field.name().as_str() { "tag1" => Arc::new( vec!["MT", "MT", "CT", "AL", "MT", "MT", "MT", "CT", "AL", "MT"] .into_iter() .collect::<DictionaryArray<Int32Type>>(), ) as ArrayRef, "tag2" => Arc::new( vec!["CT", "AL", "CT", "MA", "AL", "CT", "AL", "CT", "MA", "AL"] .into_iter() .collect::<DictionaryArray<Int32Type>>(), ) as ArrayRef, _ => Arc::new( vec!["CT", "MT", "AL", "AL", "MT", "CT", "MT", "AL", "AL", "MT"] .into_iter() .collect::<DictionaryArray<Int32Type>>(), ) as ArrayRef, } } _ => unimplemented!( "Unimplemented data type for test database: {:?}", field.data_type() ), }) .collect::<Vec<_>>(); let batch = RecordBatch::try_new(self.schema.as_arrow(), columns).expect("made record batch"); self.push_record_batch(batch); self } /// Set the sort key for this chunk pub fn with_sort_key(self, sort_key: SortKey) -> Self { Self { sort_key: Some(sort_key), ..self } } pub fn table_name(&self) -> &str { &self.table_name } } impl fmt::Display for TestChunk { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.table_name()) } } impl QueryChunk for TestChunk { fn stats(&self) -> Arc<DataFusionStatistics> { self.check_error().unwrap(); Arc::new(DataFusionStatistics { num_rows: self.num_rows, total_byte_size: None, column_statistics: Some( self.schema .inner() .fields() .iter() .map(|f| self.column_stats.get(f.name()).cloned().unwrap_or_default()) .collect(), ), is_exact: true, }) } fn schema(&self) -> &Schema { &self.schema } fn partition_id(&self) -> &TransitionPartitionId { &self.partition_id } fn sort_key(&self) -> Option<&SortKey> { self.sort_key.as_ref() } fn id(&self) -> ChunkId { self.id } fn may_contain_pk_duplicates(&self) -> bool { self.may_contain_pk_duplicates } fn data(&self) -> QueryChunkData { self.check_error().unwrap(); self.table_data.clone() } fn chunk_type(&self) -> &str { "Test Chunk" } fn order(&self) -> ChunkOrder { self.order } fn as_any(&self) -> &dyn Any { self } } /// Return the raw data from the list of chunks pub async fn raw_data(chunks: &[Arc<dyn QueryChunk>]) -> Vec<RecordBatch> { let ctx = IOxSessionContext::with_testing(); let mut batches = vec![]; for c in chunks { batches.append(&mut c.data().read_to_batches(c.schema(), ctx.inner()).await); } batches } pub fn format_logical_plan(plan: &LogicalPlan) -> Vec<String> { format_lines(&plan.display_indent().to_string()) } pub fn format_execution_plan(plan: &Arc<dyn ExecutionPlan>) -> Vec<String> { format_lines(&displayable(plan.as_ref()).indent(false).to_string()) } fn format_lines(s: &str) -> Vec<String> { s.trim() .split('\n') .map(|s| { // Always add a leading space to ensure tha all lines in the YAML insta snapshots are quoted, otherwise the // alignment gets messed up and the snapshot would be hard to read. format!(" {s}") }) .collect() }
use ordered_vec_map::{InsertionResult, OrderedVecMap, RemovalResult}; use std::cmp::{min, max, Ord, Ordering}; use typeahead::{Parse, RemapType, Typeahead}; // TODO Handle noremap (key,value) by surrounding value with non-input-able // keys, so if it gets put in the typeahead, it cannot possibly be remapped. // This would also mean such values would be ignored by the op-map. #[derive(Debug, PartialEq)] pub struct DisambiguationMap<K, T> where K: Ord, K: Copy, K: Parse, T: Clone, { // Use an ordered map in order to trade insertion speed for lookup speed. vec_map: OrderedVecMap<Vec<K>, T>, max_key_len: usize, } #[derive(Clone, Debug, PartialEq)] pub enum Match<T> { FullMatch(T), PartialMatch, NoMatch, } fn match_length<K>(query: &Vec<K>, probe: &Vec<K>) -> usize where K: Ord, { let mut match_len: usize = 0; while { let p = probe.get(match_len); let q = query.get(match_len); match_len += 1; p.and(q).is_some() && p.cmp(&q) == Ordering::Equal // Loop criteria } {} match_len - 1 } /// Matches a sequence `Vec<K>` using Vi's mapping rules. /// ``` /// // Summary: /// // MatchLen < QueryLen < KeyLen => Not a match /// // MatchLen < KeyLen < QueryLen => Not a match /// // MatchLen < KeyLen = QueryLen => Not a match /// // MatchLen = QueryLen < KeyLen => Partial | /// // MatchLen = KeyLen < QueryLen => Full |- MatchLen >= /// // MatchLen = KeyLen = QueryLen => Full | min(QueryLen, KeyLen) /// ``` fn find_match<'a, K, T>( map: &'a OrderedVecMap<Vec<K>, T>, query: &Vec<K>, ) -> Match<&'a (Vec<K>, T)> where K: Ord, K: Copy, { let query_len = query.len(); let initial: Vec<K>; match query.get(0) { Some(val) => { // Create a vector containing just the first query element. initial = vec![*val]; } None => { // Query is empty. return Match::NoMatch; } }; // Start at the first potential match, where keys start with `initial`. let mut index = { match map.find_idx(&initial) { Ok(idx) => idx, Err(idx) => idx, } }; let mut longest_match_key_len: usize = 0; let mut longest_match: Option<&(Vec<K>, T)> = None; while let Some(kv) = map.get(index) { let match_len = match_length(query, &kv.0); if match_len == 0 { // Stop early if we are guaranteed not to find any more matches. break; } let key_len = kv.0.len(); if (match_len >= query_len || match_len >= key_len) && key_len > longest_match_key_len { longest_match = Some(kv); longest_match_key_len = key_len; } index += 1; } if longest_match_key_len > query_len { Match::PartialMatch } else if longest_match.is_some() { Match::FullMatch(longest_match.unwrap()) } else { Match::NoMatch } } impl<K, T> DisambiguationMap<K, T> where K: Ord, K: Copy, K: Parse, T: Clone, { pub fn new() -> Self { DisambiguationMap { vec_map: OrderedVecMap::new(), max_key_len: 0, } } pub fn insert(&mut self, datum: (Vec<K>, T)) -> InsertionResult { let key_len = datum.0.len(); let result = self.vec_map.insert(datum); match result { InsertionResult::Create => { self.max_key_len = max(self.max_key_len, key_len); } InsertionResult::Overwrite => {} InsertionResult::InvalidKey => {} } result } pub fn remove(&mut self, key: &Vec<K>) -> RemovalResult { let result = self.vec_map.remove(key); for kv in self.vec_map.iter() { self.max_key_len = max(self.max_key_len, kv.0.len()); } result } fn fill_query( &self, typeahead: &Typeahead<K>, remap_type: RemapType, ) -> Vec<K> { // Optimization: // Limit query length to no more than longer than longest key. let capacity = min(typeahead.len(), self.max_key_len + 1); let mut query = Vec::<K>::with_capacity(capacity); for k in typeahead.value_iter() { query.push(k); if query.len() >= query.capacity() { break; } } query } pub fn process( &self, typeahead: &Typeahead<K>, remap_type: RemapType, ) -> Match<&(Vec<K>, T)> { let query = self.fill_query(typeahead, remap_type); find_match(&self.vec_map, &query) } } #[cfg(test)] mod find_match { use super::*; #[test] fn partial_match() { // MatchLen = QueryLen < KeyLen => Partial let mut map = OrderedVecMap::<Vec<u8>, u8>::new(); map.insert((vec![1u8, 2u8, 3u8, 4u8], 6u8)); let query = vec![1u8, 2u8, 3u8]; assert_eq!(Match::PartialMatch, find_match(&map, &query)) } #[test] fn full_match() { // MatchLen = KeyLen = QueryLen => Full let mut map = OrderedVecMap::<Vec<u8>, u8>::new(); map.insert((vec![1u8, 2u8, 3u8], 6u8)); let query = vec![1u8, 2u8, 3u8]; assert_eq!( Match::FullMatch(&(vec![1u8, 2u8, 3u8], 6u8)), find_match(&map, &query) ); } #[test] fn overspecified_full_match() { // MatchLen = KeyLen < QueryLen => Full let mut map = OrderedVecMap::<Vec<u8>, u8>::new(); map.insert((vec![1u8, 2u8], 6u8)); let query = vec![1u8, 2u8, 3u8]; assert_eq!( Match::FullMatch(&(vec![1u8, 2u8], 6u8)), find_match(&map, &query) ); } #[test] fn best_full_match() { // MatchLen = KeyLen = QueryLen => Full let mut map = OrderedVecMap::<Vec<u8>, u8>::new(); map.insert((vec![1u8], 4u8)); map.insert((vec![1u8, 2u8], 5u8)); map.insert((vec![1u8, 2u8, 3u8], 6u8)); let query = vec![1u8, 2u8, 3u8]; assert_eq!( Match::FullMatch(&(vec![1u8, 2u8, 3u8], 6u8)), find_match(&map, &query) ) } #[test] fn underspecified_no_match() { // MatchLen < QueryLen < KeyLen => Not a match let mut map = OrderedVecMap::<Vec<u8>, u8>::new(); map.insert((vec![1u8, 2u8, 3u8, 4u8], 6u8)); let query = vec![1u8, 3u8]; assert_eq!(Match::NoMatch, find_match(&map, &query)) } #[test] fn overspecified_no_match() { // MatchLen < KeyLen < QueryLen => Not a match let mut map = OrderedVecMap::<Vec<u8>, u8>::new(); map.insert((vec![1u8, 2u8, 3u8], 6u8)); let query = vec![1u8, 2u8, 4u8, 5u8]; assert_eq!(Match::NoMatch, find_match(&map, &query)) } #[test] fn critically_specified_no_match() { // MatchLen < KeyLen = QueryLen => Not a match let mut map = OrderedVecMap::<Vec<u8>, u8>::new(); map.insert((vec![1u8, 2u8, 3u8], 6u8)); let query = vec![1u8, 2u8, 4u8]; assert_eq!(Match::NoMatch, find_match(&map, &query)) } #[test] fn no_query() { let mut map = OrderedVecMap::<Vec<u8>, u8>::new(); map.insert((vec![1u8, 2u8, 3u8, 4u8], 6u8)); let query = vec![]; assert_eq!(Match::NoMatch, find_match(&map, &query)) } } #[cfg(test)] mod match_length { use super::*; #[test] fn exact() { let p = Vec::<u8>::from("asdf".as_bytes()); let q = Vec::<u8>::from("asdf".as_bytes()); assert_eq!("asdf".as_bytes().len(), match_length(&q, &p)); } #[test] fn longer_q() { let p = Vec::<u8>::from("asd".as_bytes()); let q = Vec::<u8>::from("asdf".as_bytes()); assert_eq!("asd".as_bytes().len(), match_length(&q, &p)); } #[test] fn longer_p() { let p = Vec::<u8>::from("asdf".as_bytes()); let q = Vec::<u8>::from("asd".as_bytes()); assert_eq!("asd".as_bytes().len(), match_length(&q, &p)); } #[test] fn both_zero() { let p = Vec::<u8>::from("".as_bytes()); let q = Vec::<u8>::from("".as_bytes()); assert_eq!(0, match_length(&q, &p)); } #[test] fn zero_q() { let p = Vec::<u8>::from("asdf".as_bytes()); let q = Vec::<u8>::from("".as_bytes()); assert_eq!(0, match_length(&q, &p)); } }
pub fn u32_from_pcm8(data: u8) -> u32 { (data as u32) << 24 } pub fn u32_from_pcm16(data: u16) -> u32 { (data as u32) << 16 } pub fn u32_from_pcm32(data: u32) -> u32 { data } pub fn u32_from_ieee(data: f32) -> u32 { // TODO 0 } pub fn u32_from_alaw(data: u8) -> u32 { // TODO 0 } pub fn u32_from_mulaw(data: u8) -> u32 { // TODO 0 } fn u8_from_u32(data: u32) -> u8 { (data >> 24) as u8 } fn u9_from_u32(data: u32) -> u16 { (data >> 23) as u16 } fn u10_from_u32(data: u32) -> u16 { (data >> 22) as u16 } fn u11_from_u32(data: u32) -> u16 { (data >> 21) as u16 } fn u12_from_u32(data: u32) -> u16 { (data >> 20) as u16 } fn u13_from_u32(data: u32) -> u16 { (data >> 22) as u16 } fn u14_from_u32(data: u32) -> u16 { (data >> 21) as u16 } fn u15_from_u32(data: u32) -> u16 { (data >> 20) as u16 } fn u16_from_u32(data: u32) -> u16 { (data >> 19) as u16 } pub fn u8_from_pcm8(data: u8) -> u8 { u8_from_u32( u32_from_pcm8(data) ) } pub fn u9_from_pcm8(data: u8) -> u16 { u9_from_u32( u32_from_pcm8(data) ) } pub fn u10_from_pcm8(data: u8) -> u16 { u10_from_u32( u32_from_pcm8(data) ) } pub fn u11_from_pcm8(data: u8) -> u16 { u11_from_u32( u32_from_pcm8(data) ) } pub fn u12_from_pcm8(data: u8) -> u16 { u12_from_u32( u32_from_pcm8(data) ) } pub fn u8_from_pcm16(data: u16) -> u8 { u8_from_u32( u32_from_pcm16(data) ) } pub fn u9_from_pcm16(data: u16) -> u16 { u9_from_u32( u32_from_pcm16(data) ) } pub fn u8_from_pcm32(data: u32) -> u8 { u8_from_u32( u32_from_pcm32(data) ) } pub fn u9_from_pcm32(data: u32) -> u16 { u9_from_u32( u32_from_pcm32(data) ) } pub fn u8_from_ieee(data: f32) -> u8 { u8_from_u32( u32_from_ieee(data) ) } pub fn u9_from_ieee(data: f32) -> u16 { u9_from_u32( u32_from_ieee(data) ) } pub fn u8_from_alaw(data: u8) -> u8 { u8_from_u32( u32_from_alaw(data) ) } pub fn u9_from_alaw(data: u8) -> u16 { u9_from_u32( u32_from_alaw(data) ) } pub fn u8_from_mulaw(data: u8) -> u8 { u8_from_u32( u32_from_mulaw(data) ) } pub fn u9_from_mulaw(data: u8) -> u16 { u9_from_u32( u32_from_mulaw(data) ) }
use crate::order::Order; use std::sync::Mutex; /// A threadsafe FIFO queue to store unprocessed messages arriving from traders. pub struct Queue { items: Mutex<Vec<Order>>, } impl Queue { pub fn new() -> Queue { Queue { items: Mutex::new(Vec::<Order>::new()), } } // New orders are pushed to the end of the Queue pub fn add(&self, order: Order) { let mut items = self.items.lock().unwrap(); items.push(order); } pub fn pop(&self) -> Option<Order> { let mut items = self.items.lock().unwrap(); items.pop() } // Empties the Queue into a vector of Orders. Drain() pops the items // out in the order of arrival, so once iterated upon, orders will be // processed first -> last. pub fn pop_all(&self) -> Vec<Order> { // Acquire the lock let mut items = self.items.lock().unwrap(); // Pop all items out of the queue and return the contents as a vec items.drain(..).collect() } }